Introduce oxlint, and fix lint warnings

This commit is contained in:
James Babcock committed 2026-09-29 11:54:22 -07:00
1 parent cb6dddd120
commit 06146c2b08
89 files changed
+818 -469

No files matched your search

+85
View File
@@ -0,0 +1,85 @@
{
// Run via ./lint.sh (or `npm run lint`). Rule docs:
// https://oxc.rs/docs/guide/usage/linter/rules.html
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["eslint", "typescript", "unicorn", "oxc", "import", "promise"],
"options": {
// Type-aware rules run through oxlint-tsgolint (typescript-go), which
// reads tsconfig.json with TS7 semantics (no baseUrl, rootDir explicit).
"typeAware": true
},
"categories": {
"correctness": "warn",
"suspicious": "warn",
"pedantic": "off",
"perf": "off",
"style": "off",
"restriction": "off",
"nursery": "off"
},
"rules": {
// --- Opted in from non-default categories ---
"eslint/eqeqeq": ["warn", "always", { "null": "ignore" }],
"eslint/no-fallthrough": "warn",
"eslint/no-var": "warn",
"eslint/prefer-const": "warn",
"import/no-duplicates": "warn",
"typescript/no-deprecated": "warn",
"typescript/no-misused-promises": "warn",
// Rethrowing / rejecting with a caught `unknown` is propagation, not a bug.
"typescript/only-throw-error": ["warn", { "allowThrowingUnknown": true }],
"typescript/prefer-promise-reject-errors": ["warn", { "allowThrowingUnknown": true }],
"typescript/restrict-plus-operands": "warn",
"typescript/switch-exhaustiveness-check": [
"warn",
{ "considerDefaultExhaustiveForUnions": true }
],
// --- Turned off from the enabled categories ---
// Intentional control-character stripping and ANSI/terminal handling.
"eslint/no-control-regex": "off",
// Private-by-convention `_field` names are common here.
"eslint/no-underscore-dangle": "off",
// Side-effect imports (polyfills, registrations) are deliberate.
"import/no-unassigned-import": "off",
// Fires on `.then()` chains used for side effects.
"promise/always-return": "off",
// Worker onmessage/postMessage are NativeScript workers, not windows.
"unicorn/prefer-add-event-listener": "off",
"unicorn/require-post-message-target-origin": "off",
// In-place sort/reverse on locally owned arrays is fine.
"unicorn/no-array-sort": "off",
"unicorn/no-array-reverse": "off",
// Stylistic: prefers hoisting closures that don't capture anything.
"unicorn/consistent-function-scoping": "off",
// `for (const l of [...listeners])` snapshots before notifying.
"unicorn/no-useless-spread": "off",
// references.d.ts pulls in @nativescript/types this way.
"typescript/triple-slash-reference": "off",
// Mostly `${error}` on unknown catch values, which is fine.
"typescript/restrict-template-expressions": "off",
// Mostly String(x) on unknown-typed parsed JSON.
"typescript/no-base-to-string": "off",
// Flags exhaustive switches that tsc already checks.
"typescript/consistent-return": "off",
// The app is not strictNullChecks, so these misfire on `!` and on
// String()/Number() coercions of Java-bridged values.
"typescript/no-unnecessary-type-assertion": "off",
"typescript/no-unnecessary-type-conversion": "off",
// Too noisy for NativeScript code that casts bridged `any` values.
"typescript/no-unsafe-type-assertion": "off"
},
// TypeScript only: scripts, tests and vendored web code are plain JS.
"ignorePatterns": [
"**/*.js",
"**/*.cjs",
"**/*.mjs",
"**/*.jsx",
"node_modules/**",
"platforms/**",
"dist/**",
"faceclaw-extensions/dist/**",
"old/**",
"tmp/**"
]
}
+3 -2
View File
@@ -21,9 +21,10 @@ relevant tools and an Android device ID to install on; do this in
build_paths.sh, which is created from build_paths.sh.template and not checked build_paths.sh, which is created from build_paths.sh.template and not checked
into git. into git.
To lint and typecheck, prefer to use build.sh; if the user asks you to run or To typecheck, prefer to use build.sh; if the user asks you to run or
test the app, use build_and_run.sh and then use `adb logcat` to view the test the app, use build_and_run.sh and then use `adb logcat` to view the
results. results. `lint.sh` (`npm run lint`) runs oxlint over the TypeScript, including
type-aware rules; rule selection is in .oxlintrc.json.
If you are working on low-level communication bits, consider checking out If you are working on low-level communication bits, consider checking out
https://github.com/Commute773/g2-kit-unofficial/ and referring to ble/docs/ https://github.com/Commute773/g2-kit-unofficial/ and referring to ble/docs/
+4 -3
View File
@@ -108,6 +108,7 @@ class AiChatLayer implements Layer {
return; return;
case "long-press-release": this.draft.release(); return; case "long-press-release": this.draft.release(); return;
case "double-click": this.draft.cancel(); shell.yieldFocusToSidebar(); return; case "double-click": this.draft.cancel(); shell.yieldFocusToSidebar(); return;
default: return;
} }
} }
menuItems(): MenuItem[] { menuItems(): MenuItem[] {
@@ -123,20 +124,20 @@ class AiChatLayer implements Layer {
{ label: "Switch session", disabled: () => external || busy(), onSelect: (ctx) => submenu(ctx, "Sessions", { label: "Switch session", disabled: () => external || busy(), onSelect: (ctx) => submenu(ctx, "Sessions",
[...this.conversations.list()].reverse().map((item) => ({ [...this.conversations.list()].reverse().map((item) => ({
label: `${item.id === record.id ? "✓ " : ""}${this.conversations.title(item)}`, label: `${item.id === record.id ? "✓ " : ""}${this.conversations.title(item)}`,
onSelect: (ctx) => { if (this.conversations.select(item.id)) ctx.stack.clearToBase(); }, onSelect: (pickCtx) => { if (this.conversations.select(item.id)) pickCtx.stack.clearToBase(); },
}))) }, }))) },
{ label: `Model: ${assistantModelLabel(record.model)}`, disabled: () => external || busy(), onSelect: (ctx) => submenu(ctx, "Model", { label: `Model: ${assistantModelLabel(record.model)}`, disabled: () => external || busy(), onSelect: (ctx) => submenu(ctx, "Model",
ASSISTANT_MODEL_CHOICES.map((model) => ({ ASSISTANT_MODEL_CHOICES.map((model) => ({
label: `${model === record.model ? "✓ " : ""}${assistantModelLabel(model)}`, label: `${model === record.model ? "✓ " : ""}${assistantModelLabel(model)}`,
disabled: () => !this.conversations.available(model, record.reasoning), disabled: () => !this.conversations.available(model, record.reasoning),
onSelect: (ctx) => { if (this.conversations.configure(model, record.reasoning)) ctx.stack.clearToBase(); }, onSelect: (pickCtx) => { if (this.conversations.configure(model, record.reasoning)) pickCtx.stack.clearToBase(); },
}))) }, }))) },
{ label: `Reasoning: ${record.reasoning}`, disabled: () => { { label: `Reasoning: ${record.reasoning}`, disabled: () => {
const llm = resolveAssistantModel(record.model, { anthropic: anthropicApiKeySetting.get(), openai: openAiApiKeySetting.get() }); const llm = resolveAssistantModel(record.model, { anthropic: anthropicApiKeySetting.get(), openai: openAiApiKeySetting.get() });
return external || busy() || !llm?.effort; return external || busy() || !llm?.effort;
}, onSelect: (ctx) => submenu(ctx, "Reasoning", (["default", "low", "medium", "high"] as ReasoningLevel[]).map((reasoning) => ({ }, onSelect: (ctx) => submenu(ctx, "Reasoning", (["default", "low", "medium", "high"] as ReasoningLevel[]).map((reasoning) => ({
label: `${reasoning === record.reasoning ? "✓ " : ""}${reasoning === "default" ? "Model default" : reasoning}`, label: `${reasoning === record.reasoning ? "✓ " : ""}${reasoning === "default" ? "Model default" : reasoning}`,
onSelect: (ctx) => { if (this.conversations.configure(record.model, reasoning)) ctx.stack.clearToBase(); }, onSelect: (pickCtx) => { if (this.conversations.configure(record.model, reasoning)) pickCtx.stack.clearToBase(); },
}))) }, }))) },
...(record.session?.isTurnActive() ? [{ label: "Cancel response", onSelect: (ctx: LayerContext) => { ...(record.session?.isTurnActive() ? [{ label: "Cancel response", onSelect: (ctx: LayerContext) => {
record.session?.cancel(); ctx.stack.clearToBase(); record.session?.cancel(); ctx.stack.clearToBase();
+8 -3
View File
@@ -284,6 +284,11 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
updateTickTimer(window); updateTickTimer(window);
} }
break; break;
case "navigation-sensors":
case "resize-window":
case "text-input":
case "tool-call":
break;
} }
}; };
@@ -349,7 +354,7 @@ function handleInput(window: BlocksWindow, event: InputEvent, frameId: number):
// An open window menu owns all input (it closes itself via pop); menus are // An open window menu owns all input (it closes itself via pop); menus are
// list UIs, so watch swipes take their standard fallback meanings there. // list UIs, so watch swipes take their standard fallback meanings there.
if (window.menu?.isOpen()) { if (window.menu?.isOpen()) {
window.menu void window.menu
.handleInput(directionalFallback(event)) .handleInput(directionalFallback(event))
.catch((error) => console.error(`blocks menu input failed: ${error}`)) .catch((error) => console.error(`blocks menu input failed: ${error}`))
.then(() => renderAndSubmit(window, frameId)); .then(() => renderAndSubmit(window, frameId));
@@ -605,7 +610,7 @@ function paintContent(window: BlocksWindow): GrayImage {
drawCenteredIn(image, smallFont, BOARD_X, COLS * CELL, BOARD_Y + 150, `${GESTURE_DOUBLE_CLICK} leave`, 150); drawCenteredIn(image, smallFont, BOARD_X, COLS * CELL, BOARD_Y + 150, `${GESTURE_DOUBLE_CLICK} leave`, 150);
} else { } else {
paintBoard(image, window); paintBoard(image, window);
if (window.phase === "game-over") paintGameOver(image, window); if (window.phase === "game-over") paintGameOver(image);
} }
paintPanel(image, window); paintPanel(image, window);
return image; return image;
@@ -637,7 +642,7 @@ function drawCell(image: GrayImage, x: number, y: number, shade: number): void {
image.fillRect(BOARD_X + x * CELL, BOARD_Y + y * CELL, CELL - 1, CELL - 1, shade); image.fillRect(BOARD_X + x * CELL, BOARD_Y + y * CELL, CELL - 1, CELL - 1, shade);
} }
function paintGameOver(image: GrayImage, window: BlocksWindow): void { function paintGameOver(image: GrayImage): void {
const boxY = BOARD_Y + 70; const boxY = BOARD_Y + 70;
image.fillRect(BOARD_X, boxY, COLS * CELL, 100, 0); image.fillRect(BOARD_X, boxY, COLS * CELL, 100, 0);
image.drawRect(BOARD_X + 4, boxY + 4, COLS * CELL - 8, 92, 150); image.drawRect(BOARD_X + 4, boxY + 4, COLS * CELL - 8, 92, 150);
+1 -2
View File
@@ -96,8 +96,7 @@ export function createCalculatorAppWindow(options: InProcessAppOptions): InProce
}, },
]; ];
let app: InProcessWindow; const app = createInProcessWindow({
app = createInProcessWindow({
appId: "calculator", appId: "calculator",
windowId: CALCULATOR_WINDOW_ID, windowId: CALCULATOR_WINDOW_ID,
title: "Calculator", title: "Calculator",
+1 -1
View File
@@ -24,7 +24,7 @@ import {
findDigits, findDigits,
highlightedMatch, highlightedMatch,
} from "./digit-search"; } from "./digit-search";
import { type MathWorkload, longRunOffer as makeLongRunOffer, type LongRunOffer } from "./workload"; import { type MathWorkload } from "./workload";
import { import {
binomial, binomial,
factorizationText, factorizationText,
+1 -1
View File
@@ -322,7 +322,7 @@ export function digitalRoot(value: number): number {
export function isPalindrome(value: number): boolean { export function isPalindrome(value: number): boolean {
const text = String(Math.abs(value)); const text = String(Math.abs(value));
return text === [...text].reverse().join(""); return text === text.split("").reverse().join("");
} }
export function isPerfect(value: number): boolean { export function isPerfect(value: number): boolean {
+2 -2
View File
@@ -123,7 +123,7 @@ export class Polynomial {
*/ */
dividingByRoot(root: MathNumber): Polynomial { dividingByRoot(root: MathNumber): Polynomial {
if (this.degree < 1) return this; if (this.degree < 1) return this;
const quotient: MathNumber[] = new Array(this.degree).fill(integer(0)); const quotient: MathNumber[] = Array.from({ length: this.degree }, () => integer(0));
let carry: MathNumber = integer(0); let carry: MathNumber = integer(0);
for (let power = this.degree; power >= 1; power--) { for (let power = this.degree; power >= 1; power--) {
const coefficient = add(this.at(power), carry); const coefficient = add(this.at(power), carry);
@@ -235,7 +235,7 @@ function addAt(value: MathNumber, power: number, coefficients: MathNumber[]): vo
function convolve(lhs: MathNumber[], rhs: MathNumber[]): MathNumber[] { function convolve(lhs: MathNumber[], rhs: MathNumber[]): MathNumber[] {
if (lhs.length === 0 || rhs.length === 0) return [integer(0)]; if (lhs.length === 0 || rhs.length === 0) return [integer(0)];
const result: MathNumber[] = new Array(lhs.length + rhs.length - 1).fill(integer(0)); const result: MathNumber[] = Array.from({ length: lhs.length + rhs.length - 1 }, () => integer(0));
for (let i = 0; i < lhs.length; i++) { for (let i = 0; i < lhs.length; i++) {
if (isZero(lhs[i]!)) continue; if (isZero(lhs[i]!)) continue;
for (let j = 0; j < rhs.length; j++) { for (let j = 0; j < rhs.length; j++) {
-1
View File
@@ -19,7 +19,6 @@ import {
multiplyExpr, multiplyExpr,
negate, negate,
num, num,
numberValue,
relation as relationExpr, relation as relationExpr,
spokenRelation, spokenRelation,
subtractExpr, subtractExpr,
@@ -29,12 +29,12 @@ import {
numberEquals, numberEquals,
rational, rational,
reciprocal, reciprocal,
isZero,
} from "./math-number"; } from "./math-number";
import { simplify } from "./simplifier"; import { simplify } from "./simplifier";
import { differentiate, integrateNumeric } from "./derivative"; import { differentiate, integrateNumeric } from "./derivative";
import { evaluateValue } from "./evaluator"; import { evaluateValue } from "./evaluator";
import { Polynomial } from "./polynomial"; import { Polynomial } from "./polynomial";
import { isZero } from "./math-number";
/** Indefinite integral with respect to `variable`, without the constant. */ /** Indefinite integral with respect to `variable`, without the constant. */
export function integrate(expression: MathExpression, variable: string): MathExpression | null { export function integrate(expression: MathExpression, variable: string): MathExpression | null {
+2 -7
View File
@@ -103,8 +103,7 @@ function render(expression: MathExpression, parentPrecedence: number): string {
return wrap(`1/${inner}`, parentPrecedence > PRECEDENCE.product); return wrap(`1/${inner}`, parentPrecedence > PRECEDENCE.product);
} }
const body = const body =
`${render(expression.base, PRECEDENCE.power + 1)}` + `${render(expression.base, PRECEDENCE.power + 1)}^${render(expression.exponent, PRECEDENCE.power + 1)}`;
`^${render(expression.exponent, PRECEDENCE.power + 1)}`;
return wrap(body, parentPrecedence > PRECEDENCE.power); return wrap(body, parentPrecedence > PRECEDENCE.power);
} }
@@ -116,11 +115,7 @@ function render(expression: MathExpression, parentPrecedence: number): string {
} }
case "relation": case "relation":
return ( return `${render(expression.lhs, PRECEDENCE.relation)} ${expression.relation} ${render(expression.rhs, PRECEDENCE.relation)}`;
`${render(expression.lhs, PRECEDENCE.relation)} ` +
`${expression.relation} ` +
`${render(expression.rhs, PRECEDENCE.relation)}`
);
} }
} }
+10 -10
View File
@@ -26,14 +26,14 @@ export type SolutionFamily = {
baseExpression: MathExpression | null; baseExpression: MathExpression | null;
}; };
export function familyValues(family: SolutionFamily, lower: number, upper: number): number[] { export function familyValues(solutionFamily: SolutionFamily, lower: number, upper: number): number[] {
if (family.period <= 0) { if (solutionFamily.period <= 0) {
return family.base >= lower && family.base <= upper ? [family.base] : []; return solutionFamily.base >= lower && solutionFamily.base <= upper ? [solutionFamily.base] : [];
} }
const results: number[] = []; const results: number[] = [];
let n = Math.floor((lower - family.base) / family.period); let n = Math.floor((lower - solutionFamily.base) / solutionFamily.period);
for (;;) { for (;;) {
const value = family.base + n * family.period; const value = solutionFamily.base + n * solutionFamily.period;
if (value > upper) break; if (value > upper) break;
if (value >= lower) results.push(value); if (value >= lower) results.push(value);
n += 1; n += 1;
@@ -42,14 +42,14 @@ export function familyValues(family: SolutionFamily, lower: number, upper: numbe
return results; return results;
} }
export function familyText(family: SolutionFamily): string { export function familyText(solutionFamily: SolutionFamily): string {
const baseText = family.baseExpression const baseText = solutionFamily.baseExpression
? plain(family.baseExpression) ? plain(solutionFamily.baseExpression)
: describeNumber(fromDecimal(family.base)); : describeNumber(fromDecimal(solutionFamily.base));
// The separator is load-bearing: "2*pi" run straight into the index reads // The separator is load-bearing: "2*pi" run straight into the index reads
// as "2*pin", a different and nonsensical expression to anyone scanning it // as "2*pin", a different and nonsensical expression to anyone scanning it
// on the lens. // on the lens.
const periodText = describePi(family.period); const periodText = describePi(solutionFamily.period);
return `${baseText} + ${periodText}·n`; return `${baseText} + ${periodText}·n`;
} }
+1 -2
View File
@@ -21,7 +21,6 @@ export const CALENDAR_SURFACE_ID = "window:calendar";
*/ */
export function createCalendarAppWindow(options: InProcessAppOptions): InProcessWindow { export function createCalendarAppWindow(options: InProcessAppOptions): InProcessWindow {
let requesting = false; let requesting = false;
let app: InProcessWindow;
let unsubscribe = () => {}; let unsubscribe = () => {};
let tick: ReturnType<typeof setInterval> | null = null; let tick: ReturnType<typeof setInterval> | null = null;
@@ -37,7 +36,7 @@ export function createCalendarAppWindow(options: InProcessAppOptions): InProcess
.finally(() => { requesting = false; }); .finally(() => { requesting = false; });
}; };
app = createInProcessWindow({ const app = createInProcessWindow({
appId: "calendar", appId: "calendar",
windowId: CALENDAR_WINDOW_ID, windowId: CALENDAR_WINDOW_ID,
title: "Calendar", title: "Calendar",
+1 -2
View File
@@ -211,10 +211,9 @@ class CompassLayer implements Layer {
} }
export function createCompassAppWindow(options: InProcessAppOptions): InProcessWindow { export function createCompassAppWindow(options: InProcessAppOptions): InProcessWindow {
let app: InProcessWindow;
let requestRender = () => {}; let requestRender = () => {};
const layer = new CompassLayer(() => requestRender()); const layer = new CompassLayer(() => requestRender());
app = createInProcessWindow({ const app = createInProcessWindow({
appId: "compass", appId: "compass",
windowId: COMPASS_WINDOW_ID, windowId: COMPASS_WINDOW_ID,
title: "Compass", title: "Compass",
+1 -1
View File
@@ -2,7 +2,7 @@ import { getDefaultMediumFont, getDefaultSmallFont } from "../../graphics/ui-fon
import { GrayImage } from "../../graphics/image"; import { GrayImage } from "../../graphics/image";
import { clamp } from "../../util/numeric-util"; import { clamp } from "../../util/numeric-util";
import { addImuListener, imuSourceLabel, setImuReportEnabled, type ImuReading } from "../../native/imu"; import { addImuListener, imuSourceLabel, setImuReportEnabled, type ImuReading } from "../../native/imu";
import { GESTURE_DOUBLE_CLICK, type InputEvent } from "../../ui/gestures"; import { type InputEvent } from "../../ui/gestures";
import { Layer, type LayerContext } from "../../ui/layers"; import { Layer, type LayerContext } from "../../ui/layers";
import { shell } from "../../ui/shell/shell"; import { shell } from "../../ui/shell/shell";
+1 -1
View File
@@ -1,7 +1,7 @@
import { getDefaultSmallFont } from "../../graphics/ui-fonts"; import { getDefaultSmallFont } from "../../graphics/ui-fonts";
import { GrayImage } from "../../graphics/image"; import { GrayImage } from "../../graphics/image";
import { Layer, type LayerActions, type LayerContext } from "../../ui/layers"; import { Layer, type LayerActions, type LayerContext } from "../../ui/layers";
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL, type InputEvent } from "../../ui/gestures"; import { GESTURE_CLICK, type InputEvent } from "../../ui/gestures";
import { Menu, type MenuDrawArgs } from "../../ui/menu-core"; import { Menu, type MenuDrawArgs } from "../../ui/menu-core";
import { centeredTextY, tightRowHeight } from "../../ui/metrics"; import { centeredTextY, tightRowHeight } from "../../ui/metrics";
import { import {
+2
View File
@@ -64,6 +64,8 @@ export class ScreenTestLayer implements Layer {
case "double-click": case "double-click":
ctx.stack.pop(); ctx.stack.pop();
return; return;
default:
return;
} }
} }
} }
+2
View File
@@ -236,6 +236,8 @@ export class UnicodeSampleLayer implements Layer {
case "double-click": case "double-click":
ctx.stack.pop(); ctx.stack.pop();
return; return;
default:
return;
} }
} }
+2 -2
View File
@@ -1,4 +1,4 @@
import { Application } from "@nativescript/core"; import { Utils } from "@nativescript/core";
export function hmacSha256Base64(secret: string, message: string): string { export function hmacSha256Base64(secret: string, message: string): string {
const charset = java.nio.charset.StandardCharsets.UTF_8; const charset = java.nio.charset.StandardCharsets.UTF_8;
@@ -10,7 +10,7 @@ export function hmacSha256Base64(secret: string, message: string): string {
} }
export function getPhoneOpenUdid(): string { export function getPhoneOpenUdid(): string {
const resolver = Application.android.context?.getContentResolver(); const resolver = Utils.android.getApplicationContext()?.getContentResolver();
const id = resolver ? String(android.provider.Settings.Secure.getString(resolver, android.provider.Settings.Secure.ANDROID_ID) ?? "") : ""; const id = resolver ? String(android.provider.Settings.Secure.getString(resolver, android.provider.Settings.Secure.ANDROID_ID) ?? "") : "";
if (!id) throw new Error("Android did not provide a device ID for EvenHub authentication."); if (!id) throw new Error("Android did not provide a device ID for EvenHub authentication.");
return id; return id;
+1 -1
View File
@@ -22,7 +22,7 @@ export type EvenHubPermissionName =
| "album" | "album"
| "camera" | "camera"
| "fs" | "fs"
| string; | (string & {});
export type EvenHubPermission = { export type EvenHubPermission = {
name: EvenHubPermissionName; name: EvenHubPermissionName;
+1 -1
View File
@@ -1177,7 +1177,7 @@ export class EvenHubSession implements EvenHubMicClient, EvenHubImuClient, EvenH
} }
return out; return out;
}; };
if (requested.length === 0 || requested.every((id) => this.grantedApiKeys.has(id))) { if (requested.every((id) => this.grantedApiKeys.has(id))) {
return Promise.resolve(buildGrant()); return Promise.resolve(buildGrant());
} }
if (!this.windowHooks) return Promise.resolve({}); if (!this.windowHooks) return Promise.resolve({});
+1 -1
View File
@@ -73,7 +73,7 @@ export async function checkForEvenHubUpdates(
onProgress?: (done: number, total: number) => void, onProgress?: (done: number, total: number) => void,
): Promise<EvenHubAppUpdate[]> { ): Promise<EvenHubAppUpdate[]> {
const installed = getInstalledEvenHubApps(); const installed = getInstalledEvenHubApps();
const results: EvenHubAppUpdate[] = new Array(installed.length); const results: EvenHubAppUpdate[] = [];
let next = 0; let next = 0;
let done = 0; let done = 0;
const worker = async () => { const worker = async () => {
-1
View File
@@ -1,4 +1,3 @@
import { type BdfFont } from "../../graphics/bdffont";
import { getDefaultSmallFont } from "../../graphics/ui-fonts"; import { getDefaultSmallFont } from "../../graphics/ui-fonts";
import { truncateText } from "../../graphics/textwrap"; import { truncateText } from "../../graphics/textwrap";
import { GrayImage } from "../../graphics/image"; import { GrayImage } from "../../graphics/image";
+8 -1
View File
@@ -287,6 +287,10 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
syncTickTimer(window); syncTickTimer(window);
} }
break; break;
case "navigation-sensors":
case "text-input":
case "tool-call":
break;
} }
}; };
@@ -383,7 +387,7 @@ function handleInput(window: FlappyWindow, event: InputEvent, frameId: number):
// An open window menu owns all input (it closes itself via pop); menus are // An open window menu owns all input (it closes itself via pop); menus are
// list UIs, so watch swipes take their standard fallback meanings there. // list UIs, so watch swipes take their standard fallback meanings there.
if (window.menu?.isOpen()) { if (window.menu?.isOpen()) {
window.menu void window.menu
.handleInput(directionalFallback(event)) .handleInput(directionalFallback(event))
.catch((error) => console.error(`flappy menu input failed: ${error}`)) .catch((error) => console.error(`flappy menu input failed: ${error}`))
.then(() => renderAndSubmit(window, frameId)); .then(() => renderAndSubmit(window, frameId));
@@ -728,6 +732,9 @@ function paintHud(image: GrayImage, window: FlappyWindow): void {
`${GESTURE_CLICK} new game ${GESTURE_DOUBLE_CLICK} leave`, `${GESTURE_CLICK} new game ${GESTURE_DOUBLE_CLICK} leave`,
]); ]);
break; break;
case "playing":
case "dying":
break;
} }
} }
+8 -5
View File
@@ -58,9 +58,6 @@ function rankOf(card: number): number {
function isRed(card: number): boolean { function isRed(card: number): boolean {
return (card & 1) === 1; return (card & 1) === 1;
} }
function cardLabel(card: number): string {
return RANK_CHARS[rankOf(card)]! + SUIT_CHARS[suitOf(card)]!;
}
const CARD_W = 60; const CARD_W = 60;
const CARD_H = 36; const CARD_H = 36;
@@ -208,6 +205,13 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
if (window.foreground) renderAndSubmit(window, 0); if (window.foreground) renderAndSubmit(window, 0);
break; break;
} }
case "input-focus":
case "navigation-sensors":
case "resize-window":
case "screen":
case "text-input":
case "tool-call":
break;
} }
}; };
@@ -285,7 +289,7 @@ function handleInput(window: FreecellWindow, event: InputEvent, frameId: number)
// An open window menu owns all input (it closes itself via pop); menus are // An open window menu owns all input (it closes itself via pop); menus are
// list UIs, so watch swipes take their standard fallback meanings there. // list UIs, so watch swipes take their standard fallback meanings there.
if (window.menu?.isOpen()) { if (window.menu?.isOpen()) {
window.menu void window.menu
.handleInput(directionalFallback(event)) .handleInput(directionalFallback(event))
.catch((error) => console.error(`freecell menu input failed: ${error}`)) .catch((error) => console.error(`freecell menu input failed: ${error}`))
.then(() => renderAndSubmit(window, frameId)); .then(() => renderAndSubmit(window, frameId));
@@ -792,7 +796,6 @@ function paintCard(
if (selected) image.drawRoundedRect(x + 1, y + 1, CARD_W - 2, CARD_H - 2, 255, 3); if (selected) image.drawRoundedRect(x + 1, y + 1, CARD_W - 2, CARD_H - 2, 255, 3);
const rankText: string = RANK_CHARS[rankOf(card)]! const rankText: string = RANK_CHARS[rankOf(card)]!
const suitText: string = SUIT_CHARS[suitOf(card)]!; const suitText: string = SUIT_CHARS[suitOf(card)]!;
const labelText = rankText + suitText;
image.drawText(labelFont, x + 5, y, rankText, 255); image.drawText(labelFont, x + 5, y, rankText, 255);
image.drawText(suitFont, x + 5 + labelFont.measureText(rankText), y + 3, suitText, 150); image.drawText(suitFont, x + 5 + labelFont.measureText(rankText), y + 3, suitText, 150);
if (isRed(card)) { if (isRed(card)) {
+2 -3
View File
@@ -344,7 +344,6 @@ class GlancePreviewLayer implements Layer {
export function createGlanceboardAppWindow(options: InProcessAppOptions): InProcessWindow { export function createGlanceboardAppWindow(options: InProcessAppOptions): InProcessWindow {
let previewVisible = false; let previewVisible = false;
const heightMode = () => previewVisible && glanceLayoutSetting.get() === "2x3" ? "max" as const : "medium" as const; const heightMode = () => previewVisible && glanceLayoutSetting.get() === "2x3" ? "max" as const : "medium" as const;
let unsubscribeSettings: (() => void) | undefined;
const app = createInProcessWindow({ const app = createInProcessWindow({
appId: "glanceboard", appId: "glanceboard",
windowId: GLANCEBOARD_WINDOW_ID, windowId: GLANCEBOARD_WINDOW_ID,
@@ -367,10 +366,10 @@ export function createGlanceboardAppWindow(options: InProcessAppOptions): InProc
removeSurface: options.removeSurface, removeSurface: options.removeSurface,
reconfigureSurface: options.reconfigureSurface, reconfigureSurface: options.reconfigureSurface,
onClosed: () => { onClosed: () => {
unsubscribeSettings?.(); unsubscribeSettings();
options.onClosed(); options.onClosed();
}, },
}); });
unsubscribeSettings = onAnySettingChanged(() => app.setHeightMode(heightMode())); const unsubscribeSettings = onAnySettingChanged(() => app.setHeightMode(heightMode()));
return app; return app;
} }
+1 -1
View File
@@ -16,7 +16,7 @@ export const GLANCE_WIDGETS: readonly GlanceWidgetDefinition[] = [
{ id: "music", label: "Music", create: () => new MusicWidget() }, { id: "music", label: "Music", create: () => new MusicWidget() },
]; ];
export function findGlanceWidget(id: GlanceWidgetId | string): GlanceWidgetDefinition | null { export function findGlanceWidget(id: GlanceWidgetId | (string & {})): GlanceWidgetDefinition | null {
return GLANCE_WIDGETS.find((widget) => widget.id === id) ?? null; return GLANCE_WIDGETS.find((widget) => widget.id === id) ?? null;
} }
@@ -26,7 +26,7 @@ const BOTTOM_MARGIN = 2;
* once the snapshot is in. * once the snapshot is in.
*/ */
export class TerminalWidget implements GlanceWidget { export class TerminalWidget implements GlanceWidget {
private snapshot: TerminalSessionsSnapshot | undefined = readWorkerState(TERMINAL_SESSIONS_STATE_KEY); private snapshot = readWorkerState(TERMINAL_SESSIONS_STATE_KEY) as TerminalSessionsSnapshot | undefined;
private unsubscribe: (() => void) | null = null; private unsubscribe: (() => void) | null = null;
private requestRender: (() => void) | null = null; private requestRender: (() => void) | null = null;
private phase = 0; private phase = 0;
@@ -34,9 +34,9 @@ export class TerminalWidget implements GlanceWidget {
start(requestRender: () => void): void { start(requestRender: () => void): void {
this.requestRender = requestRender; this.requestRender = requestRender;
this.snapshot = readWorkerState(TERMINAL_SESSIONS_STATE_KEY); this.snapshot = readWorkerState(TERMINAL_SESSIONS_STATE_KEY) as TerminalSessionsSnapshot | undefined;
this.unsubscribe = onWorkerStateChanged<TerminalSessionsSnapshot>(TERMINAL_SESSIONS_STATE_KEY, (snapshot) => { this.unsubscribe = onWorkerStateChanged(TERMINAL_SESSIONS_STATE_KEY, (snapshot) => {
this.snapshot = snapshot; this.snapshot = snapshot as TerminalSessionsSnapshot;
this.syncAnimation(); this.syncAnimation();
requestRender(); requestRender();
}); });
-1
View File
@@ -1,4 +1,3 @@
import { type BdfFont } from "../../graphics/bdffont";
import { getDefaultSmallFont } from "../../graphics/ui-fonts"; import { getDefaultSmallFont } from "../../graphics/ui-fonts";
import { truncateText } from "../../graphics/textwrap"; import { truncateText } from "../../graphics/textwrap";
import { GrayImage } from "../../graphics/image"; import { GrayImage } from "../../graphics/image";
+3 -3
View File
@@ -57,7 +57,7 @@ export function loadMicConfig(): MicConfig {
return { return {
...defaults, ...defaults,
...parsed, ...parsed,
hostMics: { ...defaults.hostMics, ...(parsed.hostMics ?? {}) }, hostMics: { ...defaults.hostMics, ...parsed.hostMics },
}; };
} catch { } catch {
return defaultMicConfig(); return defaultMicConfig();
@@ -72,8 +72,8 @@ class MicArrayController {
private readonly statusListeners = new Set<(statuses: MicArrayStatuses) => void>(); private readonly statusListeners = new Set<(statuses: MicArrayStatuses) => void>();
private statuses: MicArrayStatuses = { left: null, right: null }; private statuses: MicArrayStatuses = { left: null, right: null };
// The Java listener proxy must stay referenced or it gets GC'd. // The Java listener proxy must stay referenced or it gets GC'd.
private statusProxy: any | null = null; private statusProxy: any = null;
private proxyCommunicator: any | null = null; private proxyCommunicator: any = null;
private leaseTimer: ReturnType<typeof setInterval> | null = null; private leaseTimer: ReturnType<typeof setInterval> | null = null;
private armed = false; private armed = false;
+6 -6
View File
@@ -16,7 +16,6 @@ import {
type HeadOrientation, type HeadOrientation,
} from "./dsp"; } from "./dsp";
import { micArrayController, micControlSupported, loadMicConfig, saveMicConfig } from "./mic-control"; import { micArrayController, micControlSupported, loadMicConfig, saveMicConfig } from "./mic-control";
import type { MicConfig } from "./mic-protocol";
import { micModelPath } from "./mic-models"; import { micModelPath } from "./mic-models";
import { import {
MIC_CHANNEL_KEYS, MIC_CHANNEL_KEYS,
@@ -27,6 +26,7 @@ import {
splitConcatenatedPcm16, splitConcatenatedPcm16,
templeActive, templeActive,
type MicChannelKey, type MicChannelKey,
type MicConfig,
type MicSide, type MicSide,
} from "./mic-protocol"; } from "./mic-protocol";
import { import {
@@ -158,8 +158,8 @@ class MicSession {
// Captions state. // Captions state.
private captionLines: CaptionLine[] = []; private captionLines: CaptionLine[] = [];
private captionEngine: any | null = null; private captionEngine: any = null;
private captionListenerProxy: any | null = null; private captionListenerProxy: any = null;
private captionsActive = false; private captionsActive = false;
private engineStartWallMs = 0; private engineStartWallMs = 0;
private sessionRowId = -1; private sessionRowId = -1;
@@ -168,7 +168,7 @@ class MicSession {
private conversationLang = "und"; private conversationLang = "und";
// Recording state. // Recording state.
private recorder: any | null = null; private recorder: any = null;
private recordingPath = ""; private recordingPath = "";
// Stock path subscriptions. // Stock path subscriptions.
@@ -177,7 +177,7 @@ class MicSession {
private offCompass: (() => void) | null = null; private offCompass: (() => void) | null = null;
// Extended path. // Extended path.
private forwardingProxy: any | null = null; private forwardingProxy: any = null;
private temples = new Map<MicSide, TempleAudioPipeline>(); private temples = new Map<MicSide, TempleAudioPipeline>();
private templeAngles: { left: number | null; right: number | null } = { left: null, right: null }; private templeAngles: { left: number | null; right: number | null } = { left: null, right: null };
private templeSsr: { left: number; right: number } = { left: 0, right: 0 }; private templeSsr: { left: number; right: number } = { left: 0, right: 0 };
@@ -193,7 +193,7 @@ class MicSession {
private offVoiceActivity: (() => void) | null = null; private offVoiceActivity: (() => void) | null = null;
// Phone-side spectral noise suppressor (FaceclawNoiseSuppressor). // Phone-side spectral noise suppressor (FaceclawNoiseSuppressor).
private suppressor: any | null = null; private suppressor: any = null;
private suppressorEngine = ""; private suppressorEngine = "";
// True between the caption engine's speech-start event and the utterance // True between the caption engine's speech-start event and the utterance
+2 -2
View File
@@ -8,7 +8,7 @@ declare const java: any;
* translation to the phone's default language beneath it. * translation to the phone's default language beneath it.
*/ */
let languageIdentifier: any | null = null; let languageIdentifier: any = null;
// Translators are expensive to build (model download on first use); cache by // Translators are expensive to build (model download on first use); cache by
// "src>dst" and keep the proxies referenced so they aren't GC'd mid-flight. // "src>dst" and keep the proxies referenced so they aren't GC'd mid-flight.
const translators = new Map<string, any>(); const translators = new Map<string, any>();
@@ -59,7 +59,7 @@ export function identifyLanguage(text: string): Promise<string> {
}); });
} }
function translatorFor(sourceLang: string, targetLang: string): any | null { function translatorFor(sourceLang: string, targetLang: string): any {
const key = `${sourceLang}>${targetLang}`; const key = `${sourceLang}>${targetLang}`;
const cached = translators.get(key); const cached = translators.get(key);
if (cached) return cached; if (cached) return cached;
@@ -250,6 +250,11 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
syncClock(window); syncClock(window);
} }
break; break;
case "navigation-sensors":
case "resize-window":
case "text-input":
case "tool-call":
break;
} }
}; };
@@ -350,7 +355,7 @@ function handleInput(window: MinesweeperWindow, event: InputEvent, frameId: numb
// An open window menu owns all input (it closes itself via pop); menus are // An open window menu owns all input (it closes itself via pop); menus are
// list UIs, so watch swipes take their standard fallback meanings there. // list UIs, so watch swipes take their standard fallback meanings there.
if (window.menu?.isOpen()) { if (window.menu?.isOpen()) {
window.menu void window.menu
.handleInput(directionalFallback(event)) .handleInput(directionalFallback(event))
.catch((error) => console.error(`minesweeper menu input failed: ${error}`)) .catch((error) => console.error(`minesweeper menu input failed: ${error}`))
.then(() => renderAndSubmit(window, frameId)); .then(() => renderAndSubmit(window, frameId));
+32 -24
View File
@@ -63,7 +63,16 @@ import {
GESTURE_SHORT_THEN_LONG_PRESS, GESTURE_SHORT_THEN_LONG_PRESS,
type InputEvent, type InputEvent,
} from "../../ui/gestures"; } from "../../ui/gestures";
import { LocationTracker, type TrackedLocation } from "./navigation-sensors"; import {
addCompassListener,
COMPASS_CHANGED,
handleNavigationSensorEvent,
LocationTracker,
magneticDeclinationDegrees,
setCompassEnabled,
type CompassEvent,
type TrackedLocation,
} from "./navigation-sensors";
import { import {
fetchRoute, fetchRoute,
fetchStaticMapGray, fetchStaticMapGray,
@@ -75,14 +84,11 @@ import {
type RouteProfile, type RouteProfile,
type StaticMapCamera, type StaticMapCamera,
} from "../../native/mapbox"; } from "../../native/mapbox";
import { addCompassListener, COMPASS_CHANGED, setCompassEnabled, type CompassEvent } from "./navigation-sensors";
import { magneticDeclinationDegrees, handleNavigationSensorEvent } from "./navigation-sensors";
import { calibrateHeading, normalizeHeading } from "../compass/calibration"; import { calibrateHeading, normalizeHeading } from "../compass/calibration";
import { bearingDegrees, haversineMeters, RouteFollower, type RouteProgress } from "./route-follower"; import { bearingDegrees, haversineMeters, RouteFollower, type RouteProgress } from "./route-follower";
import { drawManeuverGlyph } from "./maneuver-icons"; import { drawManeuverGlyph } from "./maneuver-icons";
declare const global: any; declare const global: any;
declare const com: any;
const MAP_SIZE = 260; const MAP_SIZE = 260;
const PANEL_X = MAP_SIZE + 10; const PANEL_X = MAP_SIZE + 10;
@@ -376,6 +382,8 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
); );
break; break;
} }
case "input-focus":
break;
} }
}; };
@@ -914,7 +922,7 @@ function describeRouteStatus(): string {
* display and saved-destination settings (Home, Work, custom named places), and the * display and saved-destination settings (Home, Work, custom named places), and the
* recent-destinations preference. * recent-destinations preference.
*/ */
function windowMenuItems(win: NavWindow): MenuItem[] { function windowMenuItems(): MenuItem[] {
const items: MenuItem[] = []; const items: MenuItem[] = [];
if (phase !== "idle") { if (phase !== "idle") {
items.push({ items.push({
@@ -993,15 +1001,15 @@ function savedDestinationMenuItems(): MenuItem[] {
const work = saved.find((d) => d.id === WORK_DESTINATION_ID); const work = saved.find((d) => d.id === WORK_DESTINATION_ID);
items.push(addressMenuItem("Home", HOME_DESTINATION_ID, home?.address ?? "")); items.push(addressMenuItem("Home", HOME_DESTINATION_ID, home?.address ?? ""));
items.push(addressMenuItem("Work", WORK_DESTINATION_ID, work?.address ?? "")); items.push(addressMenuItem("Work", WORK_DESTINATION_ID, work?.address ?? ""));
for (const destination of saved) { for (const dest of saved) {
if (destination.builtin) continue; if (dest.builtin) continue;
items.push({ items.push({
label: destination.name, label: dest.name,
onSelect: (ctx) => { onSelect: (ctx) => {
ctx.stack.push(new WindowMenuLayer(destination.name, customDestinationMenuItems(destination))); ctx.stack.push(new WindowMenuLayer(dest.name, customDestinationMenuItems(dest)));
}, },
render: ({ image, x, y, width, height }) => { render: ({ image, x, y, width, height }) => {
drawAddressRow(image, x, y, width, destination.name, destination.address, true); drawAddressRow(image, x, y, width, dest.name, dest.address, true);
drawSubmenuIndicator(image, smallFont, x - 10, y, width + 20, height, 150); drawSubmenuIndicator(image, smallFont, x - 10, y, width + 20, height, 150);
}, },
}); });
@@ -1028,14 +1036,14 @@ function addressMenuItem(label: string, id: string, address: string): MenuItem {
}; };
} }
function customDestinationMenuItems(destination: SavedDestination): MenuItem[] { function customDestinationMenuItems(dest: SavedDestination): MenuItem[] {
return [ return [
{ {
label: "Navigate there", label: "Navigate there",
disabled: !destination.address, disabled: !dest.address,
onSelect: (ctx) => { onSelect: (ctx) => {
closeMenusAnd(ctx, () => { closeMenusAnd(ctx, () => {
void startNavigationTo({ kind: "query", query: destination.address, label: destination.name }, profile).catch( void startNavigationTo({ kind: "query", query: dest.address, label: dest.name }, profile).catch(
() => {}, () => {},
); );
}); });
@@ -1044,16 +1052,16 @@ function customDestinationMenuItems(destination: SavedDestination): MenuItem[] {
{ {
label: "Set address", label: "Set address",
onSelect: (ctx) => { onSelect: (ctx) => {
closeMenusAnd(ctx, () => beginAddressEdit(destination.id, destination.name, destination.address)); closeMenusAnd(ctx, () => beginAddressEdit(dest.id, dest.name, dest.address));
}, },
}, },
{ {
label: "Rename", label: "Rename",
onSelect: (ctx) => { onSelect: (ctx) => {
closeMenusAnd(ctx, () => { closeMenusAnd(ctx, () => {
navigateDestinationNameDraftSetting.set(destination.name); navigateDestinationNameDraftSetting.set(dest.name);
beginEdit(navigateDestinationNameDraftSetting, `Rename ${destination.name}`, (name) => { beginEdit(navigateDestinationNameDraftSetting, `Rename ${dest.name}`, (name) => {
if (name) updateCustomDestination(destination.id, { name }); if (name) updateCustomDestination(dest.id, { name });
}); });
}); });
}, },
@@ -1062,7 +1070,7 @@ function customDestinationMenuItems(destination: SavedDestination): MenuItem[] {
label: "Remove", label: "Remove",
onSelect: (ctx) => { onSelect: (ctx) => {
closeMenusAnd(ctx, () => { closeMenusAnd(ctx, () => {
removeCustomDestination(destination.id); removeCustomDestination(dest.id);
syncIdleList(); syncIdleList();
}); });
}, },
@@ -1195,10 +1203,10 @@ function idleEntries(): IdleEntry[] {
run: () => { void startMap(); }, run: () => { void startMap(); },
}]; }];
entries.push(...loadSavedDestinations() entries.push(...loadSavedDestinations()
.filter((destination) => destination.address) .filter((dest) => dest.address)
.map((destination): IdleEntry => ({ kind: "saved", destination }))); .map((dest): IdleEntry => ({ kind: "saved", destination: dest })));
for (const destination of loadRecentDestinations()) { for (const dest of loadRecentDestinations()) {
entries.push({ kind: "recent", destination }); entries.push({ kind: "recent", destination: dest });
} }
return entries; return entries;
} }
@@ -1250,7 +1258,7 @@ function windowMenu(win: NavWindow): WindowMenu {
windowId: win.windowId, windowId: win.windowId,
post, post,
title: () => win.title, title: () => win.title,
items: () => windowMenuItems(win), items: () => windowMenuItems(),
size: { width: win.viewportWidth, height: win.viewportHeight }, size: { width: win.viewportWidth, height: win.viewportHeight },
paintBase: () => paintContent(win), paintBase: () => paintContent(win),
isFocused: () => win.focused, isFocused: () => win.focused,
@@ -1261,7 +1269,7 @@ function windowMenu(win: NavWindow): WindowMenu {
function handleInput(win: NavWindow, event: InputEvent, frameId: number): void { function handleInput(win: NavWindow, event: InputEvent, frameId: number): void {
if (win.menu?.isOpen()) { if (win.menu?.isOpen()) {
win.menu void win.menu
.handleInput(event) .handleInput(event)
.catch((error) => console.error(`navigate menu input failed: ${error}`)) .catch((error) => console.error(`navigate menu input failed: ${error}`))
.then(() => renderAndSubmit(win, frameId)); .then(() => renderAndSubmit(win, frameId));
+2 -2
View File
@@ -46,7 +46,7 @@ export class RouteFollower {
constructor(route: Route) { constructor(route: Route) {
this.route = route; this.route = route;
this.vertexMeters = new Array(route.coordinates.length); this.vertexMeters = Array.from({ length: route.coordinates.length }, () => 0);
let along = 0; let along = 0;
this.vertexMeters[0] = 0; this.vertexMeters[0] = 0;
for (let i = 1; i < route.coordinates.length; i++) { for (let i = 1; i < route.coordinates.length; i++) {
@@ -58,7 +58,7 @@ export class RouteFollower {
// Each step's maneuver happens where the previous step's travel ends, so // Each step's maneuver happens where the previous step's travel ends, so
// the maneuver point of step k sits at the sum of steps 0..k-1 distances. // the maneuver point of step k sits at the sum of steps 0..k-1 distances.
// (Slight drift vs the geometry is fine at guidance granularity.) // (Slight drift vs the geometry is fine at guidance granularity.)
this.stepStartMeters = new Array(route.steps.length); this.stepStartMeters = Array.from({ length: route.steps.length }, () => 0);
let stepAlong = 0; let stepAlong = 0;
for (let i = 0; i < route.steps.length; i++) { for (let i = 0; i < route.steps.length; i++) {
this.stepStartMeters[i] = Math.min(stepAlong, this.totalMeters); this.stepStartMeters[i] = Math.min(stepAlong, this.totalMeters);
+8 -1
View File
@@ -405,6 +405,11 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
syncTickTimer(window); syncTickTimer(window);
} }
break; break;
case "navigation-sensors":
case "resize-window":
case "text-input":
case "tool-call":
break;
} }
}; };
@@ -500,7 +505,7 @@ function handleInput(window: PinballWindow, event: InputEvent, frameId: number):
// An open window menu owns all input (it closes itself via pop); menus are // An open window menu owns all input (it closes itself via pop); menus are
// list UIs, so watch swipes take their standard fallback meanings there. // list UIs, so watch swipes take their standard fallback meanings there.
if (window.menu?.isOpen()) { if (window.menu?.isOpen()) {
window.menu void window.menu
.handleInput(directionalFallback(event)) .handleInput(directionalFallback(event))
.catch((error) => console.error(`pinball menu input failed: ${error}`)) .catch((error) => console.error(`pinball menu input failed: ${error}`))
.then(() => renderAndSubmit(window, frameId)); .then(() => renderAndSubmit(window, frameId));
@@ -744,6 +749,8 @@ function stepFlippers(window: PinballWindow, dt: number): void {
flipper.state = "rest"; flipper.state = "rest";
} }
break; break;
case "rest":
break;
} }
} }
} }
+1 -1
View File
@@ -121,7 +121,7 @@ async function roamPost(endpoint: "q" | "pull" | "write", body: object): Promise
base = API_BASE; base = API_BASE;
continue; continue;
} }
throw new Error(`Roam API request failed: ${(error as Error)?.message ?? error}`); throw new Error(`Roam API request failed: ${(error as Error)?.message ?? error}`, { cause: error });
} }
if (response.status >= 300 && response.status < 400) { if (response.status >= 300 && response.status < 400) {
const location = response.headers?.get?.("Location") ?? response.headers?.get?.("location"); const location = response.headers?.get?.("Location") ?? response.headers?.get?.("location");
+7 -4
View File
@@ -52,7 +52,6 @@ import {
} from "./roam-doc"; } from "./roam-doc";
declare const global: any; declare const global: any;
declare const com: any;
const HEADER_HEIGHT = 30; const HEADER_HEIGHT = 30;
const BOTTOM_MARGIN = 6; const BOTTOM_MARGIN = 6;
@@ -252,6 +251,10 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
); );
break; break;
} }
case "input-focus":
case "navigation-sensors":
case "resize-window":
break;
} }
}; };
@@ -339,7 +342,7 @@ function windowMenu(win: RoamWindow): WindowMenu {
windowId: win.windowId, windowId: win.windowId,
post, post,
title: () => win.title, title: () => win.title,
items: () => menuItems(win), items: () => menuItems(),
size: { width: win.viewportWidth, height: win.viewportHeight }, size: { width: win.viewportWidth, height: win.viewportHeight },
paintBase: () => paintContent(win), paintBase: () => paintContent(win),
isFocused: () => win.focused, isFocused: () => win.focused,
@@ -348,7 +351,7 @@ function windowMenu(win: RoamWindow): WindowMenu {
return win.menu; return win.menu;
} }
function menuItems(win: RoamWindow): MenuItem[] { function menuItems(): MenuItem[] {
const items: MenuItem[] = []; const items: MenuItem[] = [];
const today = todayRef(); const today = todayRef();
if (currentRef?.uid !== today.uid) { if (currentRef?.uid !== today.uid) {
@@ -415,7 +418,7 @@ function endSettingEdit(): void {
function handleInput(win: RoamWindow, event: InputEvent, frameId: number): void { function handleInput(win: RoamWindow, event: InputEvent, frameId: number): void {
if (win.menu?.isOpen()) { if (win.menu?.isOpen()) {
win.menu void win.menu
.handleInput(event) .handleInput(event)
.catch((error) => console.error(`roam menu input failed: ${error}`)) .catch((error) => console.error(`roam menu input failed: ${error}`))
.then(() => renderAndSubmit(win, frameId)); .then(() => renderAndSubmit(win, frameId));
+4 -3
View File
@@ -39,7 +39,6 @@ import { flattenPlanesWithDraws, planesFingerprint, type Plane } from "../../gra
import { prepareFrameDraws } from "../../graphics/glyph-wire"; import { prepareFrameDraws } from "../../graphics/glyph-wire";
import { getDefaultSmallFont, getTerminalFontConfig } from "../../graphics/ui-fonts"; import { getDefaultSmallFont, getTerminalFontConfig } from "../../graphics/ui-fonts";
import { layoutHubHeader } from "./hub-header"; import { layoutHubHeader } from "./hub-header";
import { truncateText } from "../../graphics/textwrap";
import { TERMINAL_ICON_GLYPHS, type IconActivity } from "../../graphics/icons"; import { TERMINAL_ICON_GLYPHS, type IconActivity } from "../../graphics/icons";
import { import {
drawSessionRow, drawSessionRow,
@@ -64,7 +63,6 @@ import type { WorkerAppMessage, WorkerAppReply } from "../../ui/shell/worker-win
import type { ToolResult, ToolSpec } from "../../assistant/tool-registry"; import type { ToolResult, ToolSpec } from "../../assistant/tool-registry";
declare const global: any; declare const global: any;
declare const com: any;
// Cell geometry comes from the terminal font setting (Settings > Terminal > // Cell geometry comes from the terminal font setting (Settings > Terminal >
// Font; the default is Terminus-12's 6x12). Each window derives its grid from // Font; the default is Terminus-12's 6x12). Each window derives its grid from
@@ -429,6 +427,9 @@ global.onmessage = (event: { data: WorkerAppMessage }) => {
); );
break; break;
} }
case "input-focus":
case "navigation-sensors":
break;
} }
}; };
@@ -1092,7 +1093,7 @@ function handleInput(window: TerminalWindow, event: InputEvent, frameId: number)
if (window.kind === "view") activeViewId = window.windowId; if (window.kind === "view") activeViewId = window.windowId;
// An open window menu owns all input (it closes itself via pop). // An open window menu owns all input (it closes itself via pop).
if (window.menu?.isOpen()) { if (window.menu?.isOpen()) {
window.menu void window.menu
.handleInput(event) .handleInput(event)
.catch((error) => console.error(`terminal menu input failed: ${error}`)) .catch((error) => console.error(`terminal menu input failed: ${error}`))
.then(() => renderAndSubmit(window, frameId)); .then(() => renderAndSubmit(window, frameId));
+1
View File
@@ -368,6 +368,7 @@ export class TimersLayer implements Layer {
else timerEngine.restartTimer(timer.id); else timerEngine.restartTimer(timer.id);
return; return;
} }
return;
} }
case "new-timer": case "new-timer":
this.openDial(""); this.openDial("");
+1 -1
View File
@@ -43,7 +43,7 @@ export class TranscribeLayer implements Layer {
const { width, height } = ctx.stack.getBaseSize(); const { width, height } = ctx.stack.getBaseSize();
const image = new GrayImage(width, height, 0); const image = new GrayImage(width, height, 0);
const text = this.transcript.text || (this.listening ? "Listening..." : this.detail); const text = this.transcript.text || (this.listening ? "Listening..." : this.detail);
const wrapped = wrapTranscribeText((text) => font.measureText(text), text, width - 64); const wrapped = wrapTranscribeText((line) => font.measureText(line), text, width - 64);
image.drawText(font, 24, 20, "Transcribe", 200); image.drawText(font, 24, 20, "Transcribe", 200);
image.drawText(font, 24, 40, this.saveNotice || this.status, 110); image.drawText(font, 24, 40, this.saveNotice || this.status, 110);
+1 -2
View File
@@ -16,7 +16,6 @@ export function createWeatherAppWindow(options: InProcessAppOptions): InProcessW
let closed = false; let closed = false;
let requestingPermission = false; let requestingPermission = false;
let unsubscribe: (() => void) | null = null; let unsubscribe: (() => void) | null = null;
let app: InProcessWindow;
const requestUpdate = () => { const requestUpdate = () => {
if (closed || requestingPermission) return; if (closed || requestingPermission) return;
@@ -33,7 +32,7 @@ export function createWeatherAppWindow(options: InProcessAppOptions): InProcessW
}).catch((error) => { requestingPermission = false; console.warn(`Weather permission: ${error}`); }); }).catch((error) => { requestingPermission = false; console.warn(`Weather permission: ${error}`); });
}; };
app = createInProcessWindow({ const app = createInProcessWindow({
appId: "weather", appId: "weather",
windowId: WEATHER_WINDOW_ID, windowId: WEATHER_WINDOW_ID,
title: "Weather", title: "Weather",
+6 -4
View File
@@ -47,7 +47,7 @@ const MIRROR_TOUCH_GESTURES: Record<Exclude<MirrorTouchKind, "tap">, WearRemoteI
import { findSoundEffect, playSoundEffect } from "../ui/sound-effects"; import { findSoundEffect, playSoundEffect } from "../ui/sound-effects";
import { GlanceHost } from "./glance-host"; import { GlanceHost } from "./glance-host";
import { type GlanceEvent } from "./glance-state"; import { type GlanceEvent } from "./glance-state";
import { isWelcomeSoundPending, setWelcomeSoundPending } from "../phone-ui/onboarding-state"; import { isPreviewOnlyMode, isWelcomeSoundPending, setWelcomeSoundPending } from "../phone-ui/onboarding-state";
import { beginRenderPass, endRenderPass } from "../util/render-freshness"; import { beginRenderPass, endRenderPass } from "../util/render-freshness";
import { voiceControlBridge } from "../native/voice-control"; import { voiceControlBridge } from "../native/voice-control";
import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage } from "../graphics/image"; import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage } from "../graphics/image";
@@ -92,7 +92,6 @@ import { wearerVerificationOptions } from "../apps/microphones/speakers";
import { micSession } from "../apps/microphones/mic-session"; import { micSession } from "../apps/microphones/mic-session";
import { glassesDisplayLabel } from "./glasses-display-state"; import { glassesDisplayLabel } from "./glasses-display-state";
import { PreviewDisplayTarget, type DisplayTarget } from "../native/preview-display"; import { PreviewDisplayTarget, type DisplayTarget } from "../native/preview-display";
import { isPreviewOnlyMode } from "../phone-ui/onboarding-state";
type ConnectionPhase = "disconnected" | "connecting" | "connected" | "charging" | "disconnecting"; type ConnectionPhase = "disconnected" | "connecting" | "connected" | "charging" | "disconnecting";
@@ -186,6 +185,9 @@ function createInitialDisplayPreview(): ImageSource | null {
return grayImageToPreviewSource(new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0)); return grayImageToPreviewSource(new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0));
} }
/** Echo the controller's appendLog() trace to the console. */
const VERBOSE_CONTROLLER_LOG = false;
function formatTimestamp(date: Date): string { function formatTimestamp(date: Date): string {
return date.toISOString().slice(11, 23); return date.toISOString().slice(11, 23);
} }
@@ -2004,7 +2006,7 @@ class DashboardController {
} }
private startContinuousVoiceCapture(): void { private startContinuousVoiceCapture(): void {
this.beginVoiceCapture("continuous"); void this.beginVoiceCapture("continuous");
} }
private stopContinuousVoiceCapture(): void { private stopContinuousVoiceCapture(): void {
@@ -2761,7 +2763,7 @@ class DashboardController {
} }
private appendLog(line: string): void { private appendLog(line: string): void {
//console.log(`[${formatTimestamp(new Date())}] ${line}`); if (VERBOSE_CONTROLLER_LOG) console.log(`[${formatTimestamp(new Date())}] ${line}`);
} }
private setDisplayPreview(preview: ImageSource | null): void { private setDisplayPreview(preview: ImageSource | null): void {
+1 -1
View File
@@ -95,7 +95,7 @@ export function g2NameAddressTail(name: string | null | undefined): string | nul
* Even's wire order is reversed human order: "AA:BB:CC:DD:EE:FF" ⇄ [FF EE DD CC BB AA]. * Even's wire order is reversed human order: "AA:BB:CC:DD:EE:FF" ⇄ [FF EE DD CC BB AA].
*/ */
export function wireBytesFromHumanReadableAddress(address: string): Uint8Array | null { export function wireBytesFromHumanReadableAddress(address: string): Uint8Array | null {
const cleaned = address.replace(/[:\-]/g, "").trim(); const cleaned = address.replace(/[:-]/g, "").trim();
if (cleaned.length !== 12 || !/^[0-9a-fA-F]{12}$/.test(cleaned)) return null; if (cleaned.length !== 12 || !/^[0-9a-fA-F]{12}$/.test(cleaned)) return null;
const human = hexToBytes(cleaned); const human = hexToBytes(cleaned);
return new Uint8Array(Array.from(human).reverse()); return new Uint8Array(Array.from(human).reverse());
+1 -1
View File
@@ -187,7 +187,7 @@ function persistEvenHubFonts(base: ArrayBuffer): void {
writeError = error; writeError = error;
}, },
); );
if (writeError) throw writeError; if (writeError) throw writeError instanceof Error ? writeError : new Error(String(writeError));
// A degraded EvenHubFont (built before this extraction existed) is cached // A degraded EvenHubFont (built before this extraction existed) is cached
// per JS context; drop it so the next render picks up the real fonts // per JS context; drop it so the next render picks up the real fonts
// without an app restart. // without an app restart.
+1 -1
View File
@@ -79,7 +79,7 @@ export class GlanceHost {
* "Show on head tilt" is off (it then wakes the regular UI). A release * "Show on head tilt" is off (it then wakes the regular UI). A release
* always passes so a hold in progress can end. * always passes so a hold in progress can end.
*/ */
eventForGesture(gesture: "head-tilt" | string): GlanceEvent | null { eventForGesture(gesture: "head-tilt" | (string & {})): GlanceEvent | null {
const provider = this.options.getProvider(); const provider = this.options.getProvider();
if (!provider?.isEnabled()) return null; if (!provider?.isEnabled()) return null;
if (gesture === "click" && !provider.showOnTap()) return null; if (gesture === "click" && !provider.showOnTap()) return null;
+1 -1
View File
@@ -66,7 +66,7 @@ export function reduceGlance(
* already handles or ignores while asleep. * already handles or ignores while asleep.
*/ */
export function glanceEventForGesture( export function glanceEventForGesture(
gesture: "click" | "double-click" | "long-press" | "short-then-long-press" | "long-press-release" | "head-tilt" | string, gesture: "click" | "double-click" | "long-press" | "short-then-long-press" | "long-press-release" | "head-tilt" | (string & {}),
boardVisible: boolean, boardVisible: boolean,
): GlanceEvent | null { ): GlanceEvent | null {
switch (gesture) { switch (gesture) {
+6 -8
View File
@@ -1,9 +1,8 @@
import { startRemoteInput } from "../remote/service" import { startRemoteInput } from "../remote/service"
import type { KeyboardInputSession } from '../ui/shell/keyboard-input' import type { KeyboardInputSession } from '../ui/shell/keyboard-input'
import { acceptInput, resetRingInputFilter } from "../ui/input-monitor"; import { acceptInput, resetRingInputFilter } from "../ui/input-monitor";
import { bindIosNotifications, iosNotificationsChanged, onIosNotificationPopup } from '../native/notification-icons.ios' import { bindIosNotifications, iosNotificationsChanged, onIosNotificationPopup, readActiveNotifications } from '../native/notification-icons.ios'
import { shouldShowNotificationOnGlasses } from '../native/notification-sources' import { shouldShowNotificationOnGlasses } from '../native/notification-sources'
import { readActiveNotifications } from '../native/notification-icons.ios'
import { launcherEntries } from '../apps/launcher' import { launcherEntries } from '../apps/launcher'
import { getInstalledEvenHubAppById, installedEvenHubPackageId, uninstallEvenHubPackage } from '../apps/evenhub/installed-apps' import { getInstalledEvenHubAppById, installedEvenHubPackageId, uninstallEvenHubPackage } from '../apps/evenhub/installed-apps'
import { isInstalledPackagePresent } from '../apps/evenhub/updates' import { isInstalledPackagePresent } from '../apps/evenhub/updates'
@@ -14,9 +13,8 @@ import { registerWindowTools } from '../assistant/window-tools'
import { registerNavigateTools } from '../assistant/navigate-tools' import { registerNavigateTools } from '../assistant/navigate-tools'
import { registerRoamTools } from '../assistant/roam-tools' import { registerRoamTools } from '../assistant/roam-tools'
import { IosNavigationSensors } from '../native/ios-navigation-sensors' import { IosNavigationSensors } from '../native/ios-navigation-sensors'
import { Utils } from '@nativescript/core'
import { bindCompassSession, receiveCompassEvent } from '../native/compass.ios' import { bindCompassSession, receiveCompassEvent } from '../native/compass.ios'
import { Dialogs, File, knownFolders, path, type ImageSource } from '@nativescript/core' import { Dialogs, File, knownFolders, path, Utils, type ImageSource } from '@nativescript/core'
import { iosVoiceInput } from '../native/ios-voice-input' import { iosVoiceInput } from '../native/ios-voice-input'
import { nightscoutBridge } from '../native/nightscout-bridge' import { nightscoutBridge } from '../native/nightscout-bridge'
import { FaceclawCommunicatorBridge, resolveIosPeripherals, type CommunicatorState, type RawInputEvent } from '../native/faceclaw-communicator.ios' import { FaceclawCommunicatorBridge, resolveIosPeripherals, type CommunicatorState, type RawInputEvent } from '../native/faceclaw-communicator.ios'
@@ -32,7 +30,6 @@ import { ALL_APPS } from '../apps/all-apps'
import type { AppContext, AppDefinition, AppLaunchParams } from '../apps/app-definition' import type { AppContext, AppDefinition, AppLaunchParams } from '../apps/app-definition'
import { WorkerAppHost } from '../ui/shell/worker-window' import { WorkerAppHost } from '../ui/shell/worker-window'
import { createInProcessWindow, YieldAtRootLayer, type InProcessAppOptions, type InProcessWindow } from '../ui/shell/in-process-window' import { createInProcessWindow, YieldAtRootLayer, type InProcessAppOptions, type InProcessWindow } from '../ui/shell/in-process-window'
import { getStringSettingById, nightscoutSiteUrlSetting, nightscoutApiTokenSetting } from '../ui/dashboard-settings'
import { readPhoneBatteryState } from '../native/phone-battery' import { readPhoneBatteryState } from '../native/phone-battery'
import { iosAppUnavailableReason } from '../apps/ios-availability' import { iosAppUnavailableReason } from '../apps/ios-availability'
import { flattenPlanesWithDraws, planesFingerprint, type Plane } from '../graphics/plane' import { flattenPlanesWithDraws, planesFingerprint, type Plane } from '../graphics/plane'
@@ -44,7 +41,8 @@ import { TextViewerLayer } from '../apps/files/text-viewer'
import { shell, rawInputEventToInputEvent, type ShellWindow } from '../ui/shell/shell' import { shell, rawInputEventToInputEvent, type ShellWindow } from '../ui/shell/shell'
import { appViewportRect, SIDEBAR_WIDTH, sidebarStripVisible } from '../ui/shell/geometry' import { appViewportRect, SIDEBAR_WIDTH, sidebarStripVisible } from '../ui/shell/geometry'
import { DISPLAY_MODE_VALUES, displayModeLabel, displayModeSetting, onAnySettingChanged, import { DISPLAY_MODE_VALUES, displayModeLabel, displayModeSetting, onAnySettingChanged,
previewColorSetting, lockScreenEnabledSetting, getBrightnessPreferences } from '../ui/dashboard-settings' previewColorSetting, lockScreenEnabledSetting, getBrightnessPreferences, getStringSettingById,
nightscoutSiteUrlSetting, nightscoutApiTokenSetting } from '../ui/dashboard-settings'
import type { PhoneGesture } from '../phone-ui/phone-gestures' import type { PhoneGesture } from '../phone-ui/phone-gestures'
import { isWelcomeSoundPending, setWelcomeSoundPending } from '../phone-ui/onboarding-state' import { isWelcomeSoundPending, setWelcomeSoundPending } from '../phone-ui/onboarding-state'
import { findSoundEffect, playSoundEffect } from '../ui/sound-effects' import { findSoundEffect, playSoundEffect } from '../ui/sound-effects'
@@ -548,10 +546,10 @@ export class IosPreviewController {
this.requestShellRender() this.requestShellRender()
} }
async launchApp(id: string, params?: AppLaunchParams): Promise<void> { async launchApp(id: string, params?: AppLaunchParams): Promise<void> {
const app = ALL_APPS.find(app => app.appId === id) const app = ALL_APPS.find(candidate => candidate.appId === id)
if (!app) { if (!app) {
const installed = getInstalledEvenHubAppById(id) const installed = getInstalledEvenHubAppById(id)
const host = ALL_APPS.find(app => app.appId === 'evenhub') const host = ALL_APPS.find(candidate => candidate.appId === 'evenhub')
if (installed && host) { if (installed && host) {
try { try {
if (isInstalledPackagePresent(installed.packageId)) if (isInstalledPackagePresent(installed.packageId))
+5 -5
View File
@@ -121,24 +121,24 @@ export function readDisplayList(bytes: Uint8Array, offset: number, now = Date.no
const x = r.i16(), y = r.i16(), width = r.u16(), height = r.u16(), depth = r.u8() << 24 >> 24; const x = r.i16(), y = r.i16(), width = r.u16(), height = r.u16(), depth = r.u8() << 24 >> 24;
const token = r.u32(), elapsed = r.u32(), count = r.u16(); integer(count, 0, 256); const token = r.u32(), elapsed = r.u32(), count = r.u16(); integer(count, 0, 256);
const resources: ListImage[] = []; const resources: ListImage[] = [];
for (let i = 0; i < count; i++) { const width = r.u16(), height = r.u16(); resources.push({ width, height, pixels: r.take(width * height) }); } for (let i = 0; i < count; i++) { const w = r.u16(), h = r.u16(); resources.push({ width: w, height: h, pixels: r.take(w * h) }); }
const calls: ListCall[] = [], callCount = r.u16(); integer(callCount, 0, 4096); const calls: ListCall[] = [], callCount = r.u16(); integer(callCount, 0, 4096);
for (let i = 0; i < callCount; i++) { for (let i = 0; i < callCount; i++) {
const header = r.u8(), op = header & ~CLIPPED, depth = r.i16(); const header = r.u8(), op = header & ~CLIPPED, callDepth = r.i16();
const clip = header & CLIPPED ? { x: r.i16(), y: r.i16(), width: r.u16(), height: r.u16() } : undefined; const clip = header & CLIPPED ? { x: r.i16(), y: r.i16(), width: r.u16(), height: r.u16() } : undefined;
const common = clip ? { depth, clip } : { depth }; const common = clip ? { depth: callDepth, clip } : { depth: callDepth };
if (op === DrawOp.ROUNDED_RECT) calls.push({ op, ...common, x: readValue(r), y: readValue(r), width: r.u16(), height: r.u16(), radius: r.u16(), background: r.u8(), border: r.u8() }); if (op === DrawOp.ROUNDED_RECT) calls.push({ op, ...common, x: readValue(r), y: readValue(r), width: r.u16(), height: r.u16(), radius: r.u16(), background: r.u8(), border: r.u8() });
else if (op === DrawOp.IMAGE) calls.push({ op, ...common, resource: r.u16(), x: r.i16(), y: r.i16(), transparent: (r.u8() & 16) !== 0 }); else if (op === DrawOp.IMAGE) calls.push({ op, ...common, resource: r.u16(), x: r.i16(), y: r.i16(), transparent: (r.u8() & 16) !== 0 });
else if (op === DrawOp.RECT_COPY) calls.push({ op, ...common, resource: r.u16(), x: readValue(r), y: readValue(r), width: r.u16(), height: r.u16(), dx: readValue(r), dy: readValue(r) }); else if (op === DrawOp.RECT_COPY) calls.push({ op, ...common, resource: r.u16(), x: readValue(r), y: readValue(r), width: r.u16(), height: r.u16(), dx: readValue(r), dy: readValue(r) });
else if (op === DrawOp.CLEAR) calls.push({ op, ...common, color: r.u8() }); else if (op === DrawOp.CLEAR) calls.push({ op, ...common, color: r.u8() });
else if (op === DrawOp.DRAWS) { else if (op === DrawOp.DRAWS) {
const x = readValue(r), y = readValue(r), records = r.u16(), start = r.offset; const drawX = readValue(r), drawY = readValue(r), records = r.u16(), start = r.offset;
for (let n = 0; n < records; n++) { for (let n = 0; n < records; n++) {
const size = RECORD_BYTES[r.bytes[r.offset]!]; const size = RECORD_BYTES[r.bytes[r.offset]!];
if (!size) throw new Error('Unsupported display-list draw record'); if (!size) throw new Error('Unsupported display-list draw record');
r.take(size); r.take(size);
} }
calls.push({ op, ...common, x, y, count: records, records: r.bytes.slice(start, r.offset) }); calls.push({ op, ...common, x: drawX, y: drawY, count: records, records: r.bytes.slice(start, r.offset) });
} else throw new Error('Unsupported display-list call'); } else throw new Error('Unsupported display-list call');
} }
if (r.offset !== length) throw new Error('Trailing display-list bytes'); if (r.offset !== length) throw new Error('Trailing display-list bytes');
+4 -4
View File
@@ -112,10 +112,10 @@ export function evaluate(value: DrawValue, elapsed: number, presentTime = 0): {
if (typeof value === 'number') return { value, pending: false }; if (typeof value === 'number') return { value, pending: false };
const reader = new DrawBytes(Uint8Array.from(value.code)), stack: { value: number; float: boolean }[] = []; const reader = new DrawBytes(Uint8Array.from(value.code)), stack: { value: number; float: boolean }[] = [];
let pending = false; let pending = false;
const push = (value: number, float = false) => { const push = (n: number, float = false) => {
value = float ? Math.fround(value) : value | 0; n = float ? Math.fround(n) : n | 0;
if (!Number.isFinite(value) || stack.length === 32) throw new Error('Invalid expression stack'); if (!Number.isFinite(n) || stack.length === 32) throw new Error('Invalid expression stack');
stack.push({ value, float }); stack.push({ value: n, float });
}; };
const pop = (float: boolean) => { const v = stack.pop(); if (!v || v.float !== float) throw new Error('Expression type mismatch'); return v.value; }; const pop = (float: boolean) => { const v = stack.pop(); if (!v || v.float !== float) throw new Error('Expression type mismatch'); return v.value; };
const toInt = (v: number) => { if (v < -2147483648 || v >= 2147483648) throw new Error('Invalid integer conversion'); return Math.trunc(v); }; const toInt = (v: number) => { if (v < -2147483648 || v >= 2147483648) throw new Error('Invalid integer conversion'); return Math.trunc(v); };
+1 -1
View File
@@ -192,7 +192,7 @@ export function prepareFrameDraws(draws: readonly DeferredDraw[]): ArrayBuffer |
offset = writeGlyphRecord(out, offset, state, placed); offset = writeGlyphRecord(out, offset, state, placed);
} else if (placed.kind === "image") { } else if (placed.kind === "image") {
if (!inRange16(placed.x) || !inRange16(placed.y)) continue; if (!inRange16(placed.x) || !inRange16(placed.y)) continue;
if (placed.presentation) { const bytes = presentations.get(placed)!; new Uint8Array(out.buffer).set(bytes, offset); offset += bytes.length; continue; } if (placed.presentation) { const record = presentations.get(placed)!; new Uint8Array(out.buffer).set(record, offset); offset += record.length; continue; }
const id = imageId(placed); const id = imageId(placed);
if (id === null) continue; if (id === null) continue;
offset = writeImageRecord(out, offset, id, placed); offset = writeImageRecord(out, offset, id, placed);
+3 -1
View File
@@ -288,7 +288,9 @@ export class GrayImage {
const dst = this.pixels; const dst = this.pixels;
// A blit within one image copies pixel by pixel, forwards, as it always has. // A blit within one image copies pixel by pixel, forwards, as it always has.
const bulk = !opts.transparentZero && source !== this; const bulk = !opts.transparentZero && source !== this;
for (let row = rowStart; span > 0 && row < rowEnd; row++) { // No columns in range means no rows to copy.
const rowLimit = span > 0 ? rowEnd : rowStart;
for (let row = rowStart; row < rowLimit; row++) {
const from = (srcY + row) * source.width + srcX + colStart; const from = (srcY + row) * source.width + srcX + colStart;
const to = (destY + row) * this.width + destX + colStart; const to = (destY + row) * this.width + destX + colStart;
if (bulk) { if (bulk) {
+1 -1
View File
@@ -30,7 +30,7 @@ export function encodeShellScene(planes: readonly Plane[]): Uint8Array {
presentation: { ...d.presentation!, depth: d.presentation!.depth + (plane.depth ?? 0) } })) presentation: { ...d.presentation!, depth: d.presentation!.depth + (plane.depth ?? 0) } }))
layers.push({ depth: plane.depth ?? 0, selections, image: cropped.image, x: plane.x + left, y: plane.y + top, key: plane.shellKey!, dim: Math.round((plane.dimUnderneath ?? 1) * 256) }) layers.push({ depth: plane.depth ?? 0, selections, image: cropped.image, x: plane.x + left, y: plane.y + top, key: plane.shellKey!, dim: Math.round((plane.dimUnderneath ?? 1) * 256) })
} }
const result = new Uint8Array(2 + layers.reduce((n, l) => n + 16 + l.image.pixels.length + l.selections.reduce((n, b) => n + b.length, 0), 0)) const result = new Uint8Array(2 + layers.reduce((n, l) => n + 16 + l.image.pixels.length + l.selections.reduce((sum, b) => sum + b.length, 0), 0))
const view = new DataView(result.buffer); let p = 0 const view = new DataView(result.buffer); let p = 0
const word = (n: number) => { view.setUint16(p, n, true); p += 2 } const word = (n: number) => { view.setUint16(p, n, true); p += 2 }
word(layers.length) word(layers.length)
+1 -1
View File
@@ -193,7 +193,7 @@ function finalizeBlocks(blocks: Map<number, StreamingBlock>): AnthropicContentBl
} }
/** Parse one SSE line; returns the JSON payload of a data: line, else null. */ /** Parse one SSE line; returns the JSON payload of a data: line, else null. */
function parseSseDataLine(line: string): any | null { function parseSseDataLine(line: string): any {
if (!line.startsWith("data:")) return null; if (!line.startsWith("data:")) return null;
const payload = line.slice(5).trim(); const payload = line.slice(5).trim();
if (!payload || payload === "[DONE]") return null; if (!payload || payload === "[DONE]") return null;
+1 -1
View File
@@ -24,7 +24,7 @@ async function requestPermission(): Promise<boolean> {
okButtonText: "Open Settings", okButtonText: "Open Settings",
cancelButtonText: "Cancel", cancelButtonText: "Cancel",
}); });
if (open) await Utils.openUrl("app-settings:"); if (open) Utils.openUrl("app-settings:");
return false; return false;
} }
if (status === "restricted") { if (status === "restricted") {
+1 -1
View File
@@ -97,7 +97,7 @@ export async function readUpcomingEventsAsync(maxEvents = 50, windowMs = DEFAULT
try { try {
if (!hasCalendarPermission()) throw new Error("Calendar permission is required."); if (!hasCalendarPermission()) throw new Error("Calendar permission is required.");
resolve(parseEvents(json, error, maxEvents, endMs)); resolve(parseEvents(json, error, maxEvents, endMs));
} catch (error) { reject(error); } } catch (err) { reject(err); }
}); });
}); });
} }
-1
View File
@@ -10,7 +10,6 @@ export type { FirmwareInfo };
// Kotlin/Native facades exported by FaceclawKit (see native/kotlin/shared/src/iosMain/.../ble). // Kotlin/Native facades exported by FaceclawKit (see native/kotlin/shared/src/iosMain/.../ble).
declare const FaceclawKitIosGlassesSession: any; declare const FaceclawKitIosGlassesSession: any;
declare const FaceclawKitIosProtocolPlatform: any;
declare const FaceclawKitFaceclawBleCommunicatorListener: any; declare const FaceclawKitFaceclawBleCommunicatorListener: any;
declare const FaceclawKitIosAncsListener: any; declare const FaceclawKitIosAncsListener: any;
declare const FaceclawKitIosAudioPacketListener: any; declare const FaceclawKitIosAudioPacketListener: any;
-1
View File
@@ -1,7 +1,6 @@
import { openSocket } from "./socket"; import { openSocket } from "./socket";
import { toUint8Array } from "../util/array-util"; import { toUint8Array } from "../util/array-util";
declare const com: any;
declare const android: any; declare const android: any;
declare const java: any; declare const java: any;
+2 -2
View File
@@ -38,7 +38,7 @@ export class IosBluetooth {
this.state = Number(state); this.authorization = Number(authorization) this.state = Number(state); this.authorization = Number(authorization)
this.emit({ kind: 'state', state: this.state, authorization: this.authorization }) this.emit({ kind: 'state', state: this.state, authorization: this.authorization })
}, },
onAdvertisementIdentifierNameManufacturerDataHexRssiConnectable: (identifier: string, name: string, manufacturerData: string, rssi: number, connectable: boolean) => { onAdvertisementIdentifierNameManufacturerDataHexRssiConnectable: (identifier: string, name: string, manufacturerData: string, rssi: number, connectable: boolean | undefined) => {
// The Kotlin central already merges split advertisements and bounds its cache. // The Kotlin central already merges split advertisements and bounds its cache.
const raw: IosAdvertisement = { identifier: String(identifier), name: String(name ?? ''), manufacturerData: String(manufacturerData ?? ''), rssi: Number(rssi), connectable: connectable !== false } const raw: IosAdvertisement = { identifier: String(identifier), name: String(name ?? ''), manufacturerData: String(manufacturerData ?? ''), rssi: Number(rssi), connectable: connectable !== false }
this.emit({ kind: 'advertisement', ...raw }) this.emit({ kind: 'advertisement', ...raw })
@@ -65,7 +65,7 @@ export class IosBluetooth {
ensureReady(): Promise<void> { ensureReady(): Promise<void> {
if (this.state === BLE_STATE_POWERED_ON) return Promise.resolve() if (this.state === BLE_STATE_POWERED_ON) return Promise.resolve()
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const finish = (error?: Error) => { clearTimeout(timer); off(); error ? reject(error) : resolve() } const finish = (error?: Error) => { clearTimeout(timer); off(); if (error) reject(error); else resolve() }
const off = this.onEvent(event => { const off = this.onEvent(event => {
if (event.kind !== 'state') return if (event.kind !== 'state') return
if (event.state === BLE_STATE_POWERED_ON) finish() if (event.state === BLE_STATE_POWERED_ON) finish()
+1 -1
View File
@@ -33,6 +33,6 @@ export function runKotlinBridgeSmokeTest(): void {
console.log("FACECLAW_KOTLIN_BRIDGE_PASS " + JSON.stringify({ platform, thread, reply })); console.log("FACECLAW_KOTLIN_BRIDGE_PASS " + JSON.stringify({ platform, thread, reply }));
} catch (error) { } catch (error) {
// Diagnostics must not prevent the rest of the app from launching. // Diagnostics must not prevent the rest of the app from launching.
console.error("FACECLAW_KOTLIN_BRIDGE_FAIL " + error); console.error(`FACECLAW_KOTLIN_BRIDGE_FAIL ${error}`);
} }
} }
+2
View File
@@ -4,6 +4,8 @@ import type { KotlinBridge } from './kotlin-platform';
// Handwritten declarations for the small native surface, checked against the // Handwritten declarations for the small native surface, checked against the
// compiled API. NativeScript runtime metadata is generated from the AAR. // compiled API. NativeScript runtime metadata is generated from the AAR.
declare namespace com.faceclaw.shared { declare namespace com.faceclaw.shared {
// Used as com.faceclaw.shared.KotlinBridge; oxlint misses qualified references.
// oxlint-disable-next-line no-unused-vars
class KotlinBridge extends java.lang.Object { class KotlinBridge extends java.lang.Object {
constructor(); constructor();
platform(): string; platform(): string;
+2 -2
View File
@@ -30,8 +30,8 @@ type PendingRequest<T> = {
* Holds at most one connection at a time. * Holds at most one connection at a time.
*/ */
export class FaceclawMediaBrowserBridge { export class FaceclawMediaBrowserBridge {
private browser: any | null = null; private browser: any = null;
private listenerProxy: any | null = null; private listenerProxy: any = null;
private nextRequestId = 1; private nextRequestId = 1;
private readonly pendingConnects = new Map<number, PendingRequest<string>>(); private readonly pendingConnects = new Map<number, PendingRequest<string>>();
private readonly pendingBrowses = new Map<number, PendingRequest<MediaBrowseItem[]>>(); private readonly pendingBrowses = new Map<number, PendingRequest<MediaBrowseItem[]>>();
+2 -2
View File
@@ -59,8 +59,8 @@ const DEFAULT_MEDIA_STATE: MediaControllerState = {
export class FaceclawMediaControllerBridge { export class FaceclawMediaControllerBridge {
private readonly stateListeners = new Set<(state: MediaControllerState) => void>(); private readonly stateListeners = new Set<(state: MediaControllerState) => void>();
private controller: any | null = null; private controller: any = null;
private listenerProxy: any | null = null; private listenerProxy: any = null;
private state: MediaControllerState = { ...DEFAULT_MEDIA_STATE }; private state: MediaControllerState = { ...DEFAULT_MEDIA_STATE };
private stateUpdatedAtMs = Date.now(); private stateUpdatedAtMs = Date.now();
private started = false; private started = false;
-1
View File
@@ -106,7 +106,6 @@ type NightscoutTreatmentResponse = {
const NIGHTSCOUT_REFRESH_MS = 60_000; const NIGHTSCOUT_REFRESH_MS = 60_000;
const NIGHTSCOUT_HISTORY_COUNT = 30; const NIGHTSCOUT_HISTORY_COUNT = 30;
const NIGHTSCOUT_GRAPH_WINDOW_MS = 2 * 60 * 60 * 1000;
const NIGHTSCOUT_TREATMENT_LOOKBACK_MS = 3 * 60 * 60 * 1000; const NIGHTSCOUT_TREATMENT_LOOKBACK_MS = 3 * 60 * 60 * 1000;
// The v1 treatments API silently adds `created_at >= now - 4 days` to any // The v1 treatments API silently adds `created_at >= now - 4 days` to any
// query without an explicit date filter (lib/server/query.js enforceDateFilter), // query without an explicit date filter (lib/server/query.js enforceDateFilter),
+1 -1
View File
@@ -20,7 +20,7 @@ let cachedIcons: GrayImage[] = [];
let cachedAtMs = 0; let cachedAtMs = 0;
const keyedIconCache = new Map<string, { icon: GrayImage | null; atMs: number }>(); const keyedIconCache = new Map<string, { icon: GrayImage | null; atMs: number }>();
const KEYED_ICON_CACHE_MAX = 128; const KEYED_ICON_CACHE_MAX = 128;
let notificationListenerProxy: any | null = null; let notificationListenerProxy: any = null;
const notificationPostedListeners = new Set<(notificationKey: string) => void>(); const notificationPostedListeners = new Set<(notificationKey: string) => void>();
function invalidateIconCaches(): void { function invalidateIconCaches(): void {
+1 -1
View File
@@ -288,7 +288,7 @@ function extractMessageText(item: any): string {
.join(""); .join("");
} }
function parseSseDataLine(line: string): any | null { function parseSseDataLine(line: string): any {
if (!line.startsWith("data:")) return null; if (!line.startsWith("data:")) return null;
const payload = line.slice(5).trim(); const payload = line.slice(5).trim();
if (!payload || payload === "[DONE]") return null; if (!payload || payload === "[DONE]") return null;
+2 -1
View File
@@ -14,7 +14,8 @@ export function scanQrCode(): Promise<string | null> {
if (settled) return if (settled) return
settled = true settled = true
if (activeScanner === scanner) activeScanner = null if (activeScanner === scanner) activeScanner = null
error ? reject(new Error(String(error))) : resolve(text == null ? null : String(text)) if (error) reject(new Error(String(error)))
else resolve(text == null ? null : String(text))
} }
try { scanner.startWithCompletion(finish) } try { scanner.startWithCompletion(finish) }
catch (error) { finish(null, String(error)) } catch (error) { finish(null, String(error)) }
+3 -3
View File
@@ -64,8 +64,8 @@ export class IosVoiceControlBridge {
const generation = ++this.generation const generation = ++this.generation
this.log = log; this.source = 'glasses'; this.session = session; this.packets = 0; this.capturing = true this.log = log; this.source = 'glasses'; this.session = session; this.packets = 0; this.capturing = true
this.completion = new Promise(resolve => { this.resolveCompletion = resolve }) this.completion = new Promise(resolve => { this.resolveCompletion = resolve })
const error = String(this.ensureNative().startWithEndpointing(endpointing) ?? '') const startError = String(this.ensureNative().startWithEndpointing(endpointing) ?? '')
if (error) { this.stop(); this.setStatus(error); this.emitEnd(); return } if (startError) { this.stop(); this.setStatus(startError); this.emitEnd(); return }
try { try {
await session.setMicrophone(true, packet => { await session.setMicrophone(true, packet => {
if (generation !== this.generation || !this.capturing) return if (generation !== this.generation || !this.capturing) return
@@ -136,7 +136,7 @@ export class IosVoiceControlBridge {
this.log(`Voice audio: ${event.seconds?.toFixed(1)}s, packets=${event.packets}, RMS=${event.rms?.toFixed(4)}, missing=${event.missing}, errors=${event.errors}`) this.log(`Voice audio: ${event.seconds?.toFixed(1)}s, packets=${event.packets}, RMS=${event.rms?.toFixed(4)}, missing=${event.missing}, errors=${event.errors}`)
if (this.capturing) this.setStatus(`Listening on ${this.source === 'phone' ? 'phone' : 'glasses'}… ${event.seconds?.toFixed(0)}s`) if (this.capturing) this.setStatus(`Listening on ${this.source === 'phone' ? 'phone' : 'glasses'}… ${event.seconds?.toFixed(0)}s`)
} else if (event.kind === 'finishing') { } else if (event.kind === 'finishing') {
this.stopPushToTalk(); this.emitEnd() void this.stopPushToTalk(); this.emitEnd()
} else if (event.kind === 'ended') { } else if (event.kind === 'ended') {
this.source = null this.source = null
this.capturing = this.finalizing = false this.capturing = this.finalizing = false
+2 -2
View File
@@ -102,8 +102,8 @@ export class FaceclawVoiceControlBridge {
private readonly speechPauseListeners = new Set<() => void>(); private readonly speechPauseListeners = new Set<() => void>();
private readonly speechPause = new SpeechPauseDetector(); private readonly speechPause = new SpeechPauseDetector();
private readonly speechEndListeners = new Set<() => void>(); private readonly speechEndListeners = new Set<() => void>();
private controller: any | null = null; private controller: any = null;
private listenerProxy: any | null = null; private listenerProxy: any = null;
private status = "Voice control stopped."; private status = "Voice control stopped.";
private listening = false; private listening = false;
private detail = ""; private detail = "";
+2 -2
View File
@@ -54,14 +54,14 @@ type MessageListener = (message: WearMessage) => void;
type ConnectionListener = (connection: WearWatchConnection) => void; type ConnectionListener = (connection: WearWatchConnection) => void;
class WearBridge { class WearBridge {
private java: any | null | undefined = undefined; private java: any = undefined;
// The Java-side listener proxy must stay referenced or it gets GC'd. // The Java-side listener proxy must stay referenced or it gets GC'd.
private retainedListenerProxy: any = null; private retainedListenerProxy: any = null;
private readonly messageListeners = new Set<MessageListener>(); private readonly messageListeners = new Set<MessageListener>();
private readonly connectionListeners = new Set<ConnectionListener>(); private readonly connectionListeners = new Set<ConnectionListener>();
private lastConnection: WearWatchConnection = { reachable: false, watchName: "" }; private lastConnection: WearWatchConnection = { reachable: false, watchName: "" };
private getJava(): any | null { private getJava(): any {
if (this.java !== undefined) return this.java; if (this.java !== undefined) return this.java;
if (!global.isAndroid) { if (!global.isAndroid) {
this.java = null; this.java = null;
+1 -1
View File
@@ -148,7 +148,7 @@ export function createMainPage(): Page {
model.set('onPadTouch', touch(watchInput)) model.set('onPadTouch', touch(watchInput))
model.set('onRingPadTouch', touch(ringInput)) model.set('onRingPadTouch', touch(ringInput))
model.set('onSyntheticMicTap', () => controller.startVoiceInput()) model.set('onSyntheticMicTap', () => controller.startVoiceInput())
model.set('onKeyboardTap', () => { void controller.typeIntoApp() }) model.set('onKeyboardTap', () => { controller.typeIntoApp() })
mirror.on('touch', touch(mirrorInput)) mirror.on('touch', touch(mirrorInput))
const cancelGestures = () => { watchInput.cancel(); ringInput.cancel(); mirrorInput.cancel() } const cancelGestures = () => { watchInput.cancel(); ringInput.cancel(); mirrorInput.cancel() }
model.on('propertyChange', (args: PropertyChangeData) => { model.on('propertyChange', (args: PropertyChangeData) => {
+3 -3
View File
@@ -55,7 +55,7 @@ export class OnboardingFlashViewModel extends Observable {
private promptBattery: FlashPromptBattery | null = null; private promptBattery: FlashPromptBattery | null = null;
private flasher: FirmwareFlasher | null = null; private flasher: FirmwareFlasher | null = null;
private flasherUnsubscribers: Array<() => void> = []; private flasherUnsubscribers: Array<() => void> = [];
private retryAction: () => void = () => this.beginPrompt(); private retryAction: () => void | Promise<void> = () => this.beginPrompt();
constructor(options?: { mode?: FlashMode; fromOnboarding?: boolean; autoStart?: boolean }) { constructor(options?: { mode?: FlashMode; fromOnboarding?: boolean; autoStart?: boolean }) {
super(); super();
@@ -211,7 +211,7 @@ export class OnboardingFlashViewModel extends Observable {
this.finish(); this.finish();
return; return;
case "error": case "error":
this.retryAction(); void this.retryAction();
return; return;
default: default:
return; return;
@@ -569,7 +569,7 @@ export class OnboardingFlashViewModel extends Observable {
}); });
} }
private toError(message: string, retry: () => void, headline = "Something Went Wrong"): void { private toError(message: string, retry: () => void | Promise<void>, headline = "Something Went Wrong"): void {
this.retryAction = retry; this.retryAction = retry;
this.status = message; this.status = message;
this.setPhase("error"); this.setPhase("error");
+2
View File
@@ -22,6 +22,8 @@ export function startRemoteInput(host: RemoteHost): () => void {
if (busy || stopped) return; if (busy || stopped) return;
busy = true; busy = true;
try { try {
// stop() can flip `stopped` while handleRequest is awaited.
// oxlint-disable-next-line no-unmodified-loop-condition
while (!stopped) { while (!stopped) {
const raw = native.nextRequest(); const raw = native.nextRequest();
if (!raw) break; if (!raw) break;
+2 -7
View File
@@ -100,7 +100,8 @@ export abstract class ConfigSetting<TValue, TId extends string = string> {
} }
export class ConfigSettingBoolean<TId extends string = string> extends ConfigSetting<boolean, TId> { export class ConfigSettingBoolean<TId extends string = string> extends ConfigSetting<boolean, TId> {
constructor(options: ConfigSettingOptions<boolean, TId>) { // Widens ConfigSetting's protected constructor.
public constructor(options: ConfigSettingOptions<boolean, TId>) {
super(options); super(options);
} }
@@ -1086,11 +1087,6 @@ export function isNightscoutSettingsConfigured(): boolean {
} }
function normalizeSystemCardName(name: string | null | undefined): string {
const normalized = (name ?? "").replace(/[\x00-\x1f]+/g, " ").replace(/\s+/g, " ").trim();
return normalized;
}
function normalizeNightscoutSiteUrl(siteUrl: string | null | undefined): string { function normalizeNightscoutSiteUrl(siteUrl: string | null | undefined): string {
return (siteUrl ?? "").replace(/[\x00-\x1f]+/g, "").trim().replace(/\/+$/, ""); return (siteUrl ?? "").replace(/[\x00-\x1f]+/g, "").trim().replace(/\/+$/, "");
} }
@@ -1169,7 +1165,6 @@ export function toggleSettingMenuItem<TId extends string = string>(
export function textSettingMenuItem<TId extends string = string>( export function textSettingMenuItem<TId extends string = string>(
setting: ConfigSettingString<TId>, setting: ConfigSettingString<TId>,
opts?: SettingsMenuOptions<string>
): MenuItem { ): MenuItem {
return { return {
label: setting.label, label: setting.label,
+1 -1
View File
@@ -22,7 +22,7 @@ import {
type BitmapFace, type BitmapFace,
type UiFontSelection, type UiFontSelection,
} from "../graphics/ui-fonts"; } from "../graphics/ui-fonts";
import { GESTURE_DOUBLE_CLICK, type InputEvent } from "./gestures"; import { type InputEvent } from "./gestures";
import { drawRightValueMenuItem, openModalMenu, type MenuItem } from "./menu"; import { drawRightValueMenuItem, openModalMenu, type MenuItem } from "./menu";
import { Menu, type MenuDrawArgs } from "./menu-core"; import { Menu, type MenuDrawArgs } from "./menu-core";
import { LIST_ROW_TEXT_INSET, listRowHeight } from "./metrics"; import { LIST_ROW_TEXT_INSET, listRowHeight } from "./metrics";
+4 -5
View File
@@ -1,9 +1,8 @@
import { clamp } from "~/util/numeric-util"; import { clamp } from "~/util/numeric-util";
import { formatRelativeTime } from "~/util/date-util"; import { formatRelativeTime } from "~/util/date-util";
import { getDefaultSmallFont } from "../graphics/ui-fonts"; import { getDefaultSmallFont } from "../graphics/ui-fonts";
import { truncateText } from "../graphics/textwrap"; import { truncateText, wrapText } from "../graphics/textwrap";
import { GrayImage, type UiFont } from "../graphics/image"; import { GrayImage, type UiFont } from "../graphics/image";
import { wrapText } from "../graphics/textwrap";
import { LIST_ROW_TEXT_INSET, lineStep, listRowHeight } from "./metrics"; import { LIST_ROW_TEXT_INSET, lineStep, listRowHeight } from "./metrics";
import { import {
ALL_NOTIFICATIONS, ALL_NOTIFICATIONS,
@@ -255,7 +254,7 @@ export class SingleNotificationLayer implements Layer {
this.close(ctx); this.close(ctx);
} else if (item.kind === "action") { } else if (item.kind === "action") {
invokeNotificationAction(this.notificationKey, item.action.index); invokeNotificationAction(this.notificationKey, item.action.index);
if (!readActiveNotifications(ALL_NOTIFICATIONS).some((item) => item.key === this.notificationKey)) { if (!readActiveNotifications(ALL_NOTIFICATIONS).some((active) => active.key === this.notificationKey)) {
this.closeUnavailableNotification(ctx); this.closeUnavailableNotification(ctx);
} }
} else if (item.kind === "dismiss") { } else if (item.kind === "dismiss") {
@@ -276,8 +275,8 @@ export class SingleNotificationLayer implements Layer {
wrap: true, wrap: true,
rowGap: 1, rowGap: 1,
getHeight: () => listRowHeight(getDefaultSmallFont()), getHeight: () => listRowHeight(getDefaultSmallFont()),
draw: ({ image, item, x, y, selected }) => { draw: ({ image, item: option, x, y, selected }) => {
image.drawText(getDefaultSmallFont(), x + CONFIRM_TEXT_X, y + LIST_ROW_TEXT_INSET, item.label, selected ? 255 : 200); image.drawText(getDefaultSmallFont(), x + CONFIRM_TEXT_X, y + LIST_ROW_TEXT_INSET, option.label, selected ? 255 : 200);
}, },
}), }),
}; };
+2
View File
@@ -61,6 +61,8 @@ export class BrightnessPickerLayer implements Layer {
case "double-click": case "double-click":
ctx.stack.pop(); ctx.stack.pop();
return; return;
default:
return;
} }
} }
} }
+3 -3
View File
@@ -57,12 +57,12 @@ export function savePersistedOpenApps(state: PersistedOpenApps): void {
if (writeTimer !== null) clearTimeout(writeTimer); if (writeTimer !== null) clearTimeout(writeTimer);
writeTimer = setTimeout(() => { writeTimer = setTimeout(() => {
writeTimer = null; writeTimer = null;
const state = pendingState; const pending = pendingState;
pendingState = null; pendingState = null;
if (!state) return; if (!pending) return;
try { try {
File.fromPath(openAppsFilePath()).writeTextSync( File.fromPath(openAppsFilePath()).writeTextSync(
JSON.stringify({ version: STATE_VERSION, ...state }), JSON.stringify({ version: STATE_VERSION, ...pending }),
); );
} catch (error) { } catch (error) {
console.warn("open-apps state write failed", error); console.warn("open-apps state write failed", error);
+1 -2
View File
@@ -1440,7 +1440,6 @@ class Shell {
if (!this.screenOn || this.activeVoiceLayer || !this.stack.isAtBase()) return; if (!this.screenOn || this.activeVoiceLayer || !this.stack.isAtBase()) return;
const foreground = this.foregroundWindow(); const foreground = this.foregroundWindow();
if (!foreground) return; if (!foreground) return;
let layer: ShellOverlayMenuLayer;
const items: MenuItem[] = []; const items: MenuItem[] = [];
if (foreground.closeable) { if (foreground.closeable) {
items.push({ items.push({
@@ -1500,7 +1499,7 @@ class Shell {
const footer = foreground.hasAppMenu?.() const footer = foreground.hasAppMenu?.()
? (foreground.holdToTalk ? undefined : gestureHints([[GESTURE_SHORT_THEN_LONG_PRESS, "app menu"]])) ? (foreground.holdToTalk ? undefined : gestureHints([[GESTURE_SHORT_THEN_LONG_PRESS, "app menu"]]))
: undefined; : undefined;
layer = new ShellOverlayMenuLayer(items, footer, () => this.yieldFocusToSidebar()); const layer = new ShellOverlayMenuLayer(items, footer, () => this.yieldFocusToSidebar());
layer.selectItem(initialSelection); layer.selectItem(initialSelection);
this.stack.push(layer); this.stack.push(layer);
// Tell the window the system menu opened over it: an app with its own // Tell the window the system menu opened over it: an app with its own
+3 -1
View File
@@ -6,7 +6,7 @@ import type { ToolDebugEntry } from "../../assistant/tool-registry";
import { InputEvent } from "../gestures"; import { InputEvent } from "../gestures";
import { Layer, LayerContext, PaintBelow } from "../layers"; import { Layer, LayerContext, PaintBelow } from "../layers";
import { MenuLayer, drawListScrollbar, type MenuItem } from "../menu"; import { MenuLayer, drawListScrollbar, type MenuItem } from "../menu";
import { MIN_WINDOW_HEIGHT, minWindowTop, sidebarWidth, TOP_BAR_HEIGHT } from "./geometry"; import { minWindowTop, sidebarWidth, TOP_BAR_HEIGHT } from "./geometry";
import { lineStep } from "../metrics"; import { lineStep } from "../metrics";
/** /**
@@ -153,6 +153,8 @@ class ToolDetailLayer implements Layer {
case "double-click": case "double-click":
ctx.stack.pop(); ctx.stack.pop();
return; return;
default:
return;
} }
} }
} }
+5 -5
View File
@@ -20,19 +20,19 @@ export function publishWorkerState(key: string, value: unknown): void {
} }
/** The latest published value for `key`, or undefined when nothing was published yet. */ /** The latest published value for `key`, or undefined when nothing was published yet. */
export function readWorkerState<T>(key: string): T | undefined { export function readWorkerState(key: string): unknown {
return values.get(key) as T | undefined; return values.get(key);
} }
/** Subscribe to later publications of `key`; returns the unsubscribe. */ /** Subscribe to later publications of `key`; returns the unsubscribe. */
export function onWorkerStateChanged<T>(key: string, listener: (value: T) => void): () => void { export function onWorkerStateChanged(key: string, listener: (value: unknown) => void): () => void {
let set = listeners.get(key); let set = listeners.get(key);
if (!set) { if (!set) {
set = new Set(); set = new Set();
listeners.set(key, set); listeners.set(key, set);
} }
set.add(listener as (value: unknown) => void); set.add(listener);
return () => { return () => {
set!.delete(listener as (value: unknown) => void); set!.delete(listener);
}; };
} }
+3
View File
@@ -400,6 +400,9 @@ export class WorkerAppHost {
} }
break; break;
} }
case "worker-stopped":
// Only meaningful as the reply to shutdown(), handled above.
break;
} }
}; };
options.worker.onerror = (error) => { options.worker.onerror = (error) => {
-236
View File
@@ -1,236 +0,0 @@
/**
* faceclaw-extensions — type definitions for the Faceclaw extension API.
*
* Faceclaw (https://github.com/…/faceclaw) is an alternative host for EvenHub
* apps that runs them directly on the Even Realities G2 glasses instead of the
* stock Even app. An app built against the standard `@evenrealities/even_hub_sdk`
* runs unchanged. When it happens to be running inside Faceclaw, this package
* lets it detect that and reach a few extra, Faceclaw-only capabilities.
*
* Design contract:
* - The only entry point is the injected global `window.getFaceclawExtensions`.
* It is `(() => FaceclawExtensions) | null` inside Faceclaw and `undefined`
* in the stock Even app (and any other host). Nothing on the standard SDK or
* on built-in prototypes is modified — every Faceclaw capability lives behind
* this one global, so it is always obvious what is an extension and standard
* apps keep working everywhere.
* - New functionality is only ever *added* here; existing members keep their
* behavior, so pinning a version stays backwards-compatible.
*
* Usage:
* ```ts
* import { getFaceclawExtensions } from "faceclaw-extensions";
*
* const fc = getFaceclawExtensions();
* if (fc) {
* console.log("Running in", fc.getVersion()); // "Faceclaw/0.4.0"
* fc.addWindowLifecycleListener((e) => {
* if (e.type === "hidden") pauseExpensiveWork();
* });
* }
* ```
*/
/** Third-party API-key services whose keys the user may have configured in Faceclaw. */
export type ApiKeyService = "openai" | "anthropic" | "soniox" | "elevenlabs" | "mapbox";
/**
* One step of a piezo-buzzer tone sequence. The G2 has a single monophonic PWM
* buzzer; a sequence plays back-to-back steps on the firmware's own timer.
*/
export interface BuzzerStep {
/** Tone frequency in Hz. The piezo is loudest ~1–4 kHz; faint below ~150 Hz. */
freq: number;
/** Step duration in milliseconds (1–65535). */
ms: number;
/** PWM duty cycle, 0–100 (default 50). `duty: 0` is a rest (silence) for `ms`. */
duty?: number;
}
/**
* Window lifecycle transitions, delivered to
* {@link FaceclawExtensions.addWindowLifecycleListener}:
* - `visible` / `hidden`: the app's glasses window became the shown surface, or
* stopped being it — because the user switched the foreground window or the
* phone screen turned on/off. A hidden app keeps running (Faceclaw keeps its
* webview alive) but nothing it renders reaches the glasses.
* - `focused` / `blurred`: input focus moved onto or off the app's window (e.g.
* the user opened the app switcher). A blurred-but-visible app is still shown
* but no longer receives taps/scrolls.
*
* An app can assume it starts `visible` and `focused` at launch; events report
* changes from there.
*/
export type WindowLifecycleEventType = "visible" | "hidden" | "focused" | "blurred";
export interface WindowLifecycleEvent {
type: WindowLifecycleEventType;
}
/**
* A magnetometer heading sample from {@link FaceclawExtensions.addCompassListener}.
* All headings are degrees clockwise in [0, 360).
*/
export interface CompassReading {
/**
* Raw magnetic heading as reported by the glasses, with no correction for
* how they sit on the wearer's head. Kept for apps that zero it themselves.
*/
headingDegrees: number;
/**
* Magnetic heading corrected by the wearer's calibration offset from the
* host's Compass app. Equal to `headingDegrees` until they calibrate.
*/
magneticHeadingDegrees: number;
/**
* Whether the wearer has been through the host's compass calibration, i.e.
* whether `magneticHeadingDegrees` and `trueHeadingDegrees` can be trusted
* as absolute rather than relative.
*/
wearerCalibrated: boolean;
/**
* Local magnetic declination (east positive), from the phone's location and
* the World Magnetic Model. Absent when the host has no location.
*/
declinationDegrees?: number;
/** `magneticHeadingDegrees` plus declination. Absent when declination is. */
trueHeadingDegrees?: number;
}
export interface FaceclawContainerCommon {
containerID: number;
containerName: string;
xPosition: number;
yPosition: number;
width: number;
height: number;
zOrderIndex?: number;
isEventCapture?: 0 | 1 | boolean;
/** Inherit content from the same-named container in the previous layout. */
preserve?: boolean;
}
export interface FaceclawTextContainer extends FaceclawContainerCommon {
content?: string;
borderWidth?: number;
borderRadius?: number;
paddingLength?: number;
}
/** Image containers may be up to 576x452 in the extended layout. */
export type FaceclawImageContainer = FaceclawContainerCommon;
export interface FaceclawListContainer extends FaceclawContainerCommon {
itemContainer?: {
itemName?: string[];
itemWidth?: number;
isItemSelectBorderEn?: 0 | 1 | boolean;
};
}
export interface FaceclawLayout {
textObject?: FaceclawTextContainer[];
imageObject?: FaceclawImageContainer[];
listObject?: FaceclawListContainer[];
}
/**
* A tool the app contributes to Faceclaw's voice assistant. The assistant sees
* it namespaced by the app's package name (`app.<packageName>.<name>`); `name`
* here is the bare, un-prefixed name.
*/
export interface AssistantTool {
/** Bare tool name (no package prefix), e.g. `"set_color"`. */
name: string;
/** What the tool does — the assistant reads this to decide when to call it. */
description: string;
/** JSON Schema for the arguments object the assistant will pass to `handler`. */
parameters?: object;
/**
* When the tool is callable: `"foreground"` (default) only while the app owns
* the visible window; `"open"` any time the app is running (even backgrounded).
*/
availability?: "open" | "foreground";
/**
* Invoked when the assistant calls the tool. Return a string (or any
* JSON-serializable value) to report back to the assistant; throw to report an
* error. May be async.
*/
handler: (args: any) => unknown | Promise<unknown>;
}
/**
* The Faceclaw-only capability surface. Obtained via {@link getFaceclawExtensions}.
* Every method is additive to the standard EvenHub SDK.
*/
export interface FaceclawExtensions {
/** Host version string, e.g. `"Faceclaw/0.4.0"`. */
getVersion(): string;
/**
* Hand input focus back to Faceclaw's app switcher without closing the app
* (it keeps running in the background). Equivalent to the user double-tapping
* out, but explicit.
*/
returnToAppSwitcher(): void;
/**
* Close this app for real and tear down its window. Unlike the stock
* `shutDownPageContainer(1)` — which Faceclaw interprets as "return to the app
* switcher" so double-tap-to-quit apps stay alive — this always quits.
*/
quit(): void;
/**
* Subscribe to window lifecycle changes (see {@link WindowLifecycleEvent}).
* Returns an unsubscribe function.
*/
addWindowLifecycleListener(listener: (event: WindowLifecycleEvent) => void): () => void;
/**
* List which API-key services the user has configured in Faceclaw. Returns
* only the service names, never the key values — use
* {@link requestApiKeyAccess} to obtain values (with the user's consent).
*/
getConfiguredApiKeys(): Promise<ApiKeyService[]>;
/**
* Ask the user to share one or more configured API keys with this app. Opens
* a consent prompt on the glasses. Resolves with a map of the granted keys'
* values (only for services that are both requested and configured); services
* the user declines, or that aren't configured, are absent. Resolves with an
* empty object if the user denies.
*/
requestApiKeyAccess(services: ApiKeyService[]): Promise<Partial<Record<ApiKeyService, string>>>;
/**
* Play a tone sequence on the glasses' piezo buzzer. Sequences longer than the
* firmware's per-message cap (48 steps) are split and paced automatically.
* Resolves once every message has been queued.
*/
playBuzzer(steps: BuzzerStep[]): Promise<void>;
/**
* Activate the glasses' magnetometer compass and receive heading samples.
* Returns an unsubscribe function; the sensor stays on while at least one
* listener is registered and the app is the foreground window.
*
* The magnetometer sits inside the right arm, which rests against the
* wearer's head with a slight curl that differs between wearers (and between
* wears), so `headingDegrees` is relative. The host's Compass app lets the
* wearer calibrate that away and adds local declination: prefer
* `trueHeadingDegrees` when present, then `magneticHeadingDegrees`, and check
* `wearerCalibrated` before trusting either as absolute.
*/
addCompassListener(listener: (reading: CompassReading) => void): () => void;
/**
* Build the app's initial page from an extended layout (superset of the stock
* createStartUpPageContainer — full 576x452 canvas, no container-count limit,
* per-container `preserve`). Resolves true on success.
*/
createLayout(layout: FaceclawLayout): Promise<boolean>;
/**
* Replace the current page with a new extended layout (superset of the stock
* rebuildPageContainer). Containers marked `preserve` inherit their content
* from the same-named container in the outgoing layout. Resolves true on success.
*/
replaceLayout(layout: FaceclawLayout): Promise<boolean>;
/**
* Declare the app's voice-assistant tools, replacing any previously set. Each
* tool's `handler` runs in the app when the assistant calls it. The assistant
* sees the tools namespaced by the app's package name. Pass `[]` to remove all.
*/
setAssistantTools(tools: AssistantTool[]): void;
}
declare global {
interface Window {
/** Injected by Faceclaw; `undefined` in the stock Even app and other hosts. */
getFaceclawExtensions?: (() => FaceclawExtensions) | null;
}
}
/**
* Return the Faceclaw extension API if the app is running inside Faceclaw, or
* `null` otherwise (the stock Even app, a browser, etc.). Safe to call anywhere.
*/
export declare function getFaceclawExtensions(): FaceclawExtensions | null;
-40
View File
@@ -1,40 +0,0 @@
/**
* faceclaw-extensions — type definitions for the Faceclaw extension API.
*
* Faceclaw (https://github.com/…/faceclaw) is an alternative host for EvenHub
* apps that runs them directly on the Even Realities G2 glasses instead of the
* stock Even app. An app built against the standard `@evenrealities/even_hub_sdk`
* runs unchanged. When it happens to be running inside Faceclaw, this package
* lets it detect that and reach a few extra, Faceclaw-only capabilities.
*
* Design contract:
* - The only entry point is the injected global `window.getFaceclawExtensions`.
* It is `(() => FaceclawExtensions) | null` inside Faceclaw and `undefined`
* in the stock Even app (and any other host). Nothing on the standard SDK or
* on built-in prototypes is modified — every Faceclaw capability lives behind
* this one global, so it is always obvious what is an extension and standard
* apps keep working everywhere.
* - New functionality is only ever *added* here; existing members keep their
* behavior, so pinning a version stays backwards-compatible.
*
* Usage:
* ```ts
* import { getFaceclawExtensions } from "faceclaw-extensions";
*
* const fc = getFaceclawExtensions();
* if (fc) {
* console.log("Running in", fc.getVersion()); // "Faceclaw/0.4.0"
* fc.addWindowLifecycleListener((e) => {
* if (e.type === "hidden") pauseExpensiveWork();
* });
* }
* ```
*/
/**
* Return the Faceclaw extension API if the app is running inside Faceclaw, or
* `null` otherwise (the stock Even app, a browser, etc.). Safe to call anywhere.
*/
export function getFaceclawExtensions() {
const getter = typeof window !== "undefined" ? window.getFaceclawExtensions : null;
return typeof getter === "function" ? getter() : null;
}
+1 -1
View File
@@ -172,7 +172,7 @@ export interface AssistantTool {
* JSON-serializable value) to report back to the assistant; throw to report an * JSON-serializable value) to report back to the assistant; throw to report an
* error. May be async. * error. May be async.
*/ */
handler: (args: any) => unknown | Promise<unknown>; handler: (args: any) => unknown;
} }
/** /**
+1
View File
@@ -4,6 +4,7 @@
"module": "ESNext", "module": "ESNext",
"moduleResolution": "bundler", "moduleResolution": "bundler",
"declaration": true, "declaration": true,
"rootDir": "src",
"outDir": "dist", "outDir": "dist",
"strict": true, "strict": true,
"skipLibCheck": true, "skipLibCheck": true,
+500
View File
@@ -26,6 +26,8 @@
"@nativescript/ios": "9.0.3", "@nativescript/ios": "9.0.3",
"@nativescript/types": "~9.0.0", "@nativescript/types": "~9.0.0",
"@nativescript/webpack": "~5.0.25", "@nativescript/webpack": "~5.0.25",
"oxlint": "^1.85.0",
"oxlint-tsgolint": "^7.0.2003",
"typescript": "~5.4.0" "typescript": "~5.4.0"
} }
}, },
@@ -622,6 +624,437 @@
} }
} }
}, },
"node_modules/@oxlint-tsgolint/darwin-arm64": {
"version": "7.0.2003",
"resolved": "https://registry.npmjs.org/@oxlint-tsgolint/darwin-arm64/-/darwin-arm64-7.0.2003.tgz",
"integrity": "sha512-TgV33rXr6ueXBwvc+0nssUkTBSXHJxv77I8p4RCjDjCnvexHtmoPiudVRDfj3S3puMDdeQdHW6jdUgUPy3nr/w==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@oxlint-tsgolint/darwin-x64": {
"version": "7.0.2003",
"resolved": "https://registry.npmjs.org/@oxlint-tsgolint/darwin-x64/-/darwin-x64-7.0.2003.tgz",
"integrity": "sha512-hY3FMAjIaPDdK3FNxyRXRfHPOFeoBn6dmnLyKZgQ2IbTTD1adXhl6PfCIqHhCPvurigv7nf7mYuWZZ19MmJzmg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
]
},
"node_modules/@oxlint-tsgolint/linux-arm64": {
"version": "7.0.2003",
"resolved": "https://registry.npmjs.org/@oxlint-tsgolint/linux-arm64/-/linux-arm64-7.0.2003.tgz",
"integrity": "sha512-eAET4JpyfBbg8SO0K74o4R55tEjVC292pIyxGOw2XGf8x/HrPNyxwQ478jMYOM54FIVOHc8sJ6VRHxluy6lucw==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@oxlint-tsgolint/linux-x64": {
"version": "7.0.2003",
"resolved": "https://registry.npmjs.org/@oxlint-tsgolint/linux-x64/-/linux-x64-7.0.2003.tgz",
"integrity": "sha512-GXdyO/XyqDJ3s/llR/oOktLsYNjZtWSQBy0JMc+/0gsNPvTcseKPhn9c6KcFyWmnr6H4vljYALbujonqSzzEGw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
]
},
"node_modules/@oxlint-tsgolint/win32-arm64": {
"version": "7.0.2003",
"resolved": "https://registry.npmjs.org/@oxlint-tsgolint/win32-arm64/-/win32-arm64-7.0.2003.tgz",
"integrity": "sha512-TWauXnPfet0VgpmrstoAK58eJ4gbuwPUuUTQmYQAzE/RG1CpnxXtrKUJULf6lyerPE4KN3gM+DflIA1hOH+38Q==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
]
},
"node_modules/@oxlint-tsgolint/win32-x64": {
"version": "7.0.2003",
"resolved": "https://registry.npmjs.org/@oxlint-tsgolint/win32-x64/-/win32-x64-7.0.2003.tgz",
"integrity": "sha512-DoRmfe7j8VqNlukp8liRVW45GQDhzRccNenjD/pdzelgtffW47pCMd1xbJLkPaPbKnTwID3onn3VZlL7JbebEA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
]
},
"node_modules/@oxlint/binding-android-arm-eabi": {
"version": "1.85.0",
"resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm-eabi/-/binding-android-arm-eabi-1.85.0.tgz",
"integrity": "sha512-q2KO/Zso9UT+OMn0NF9ywn4E4t0MI3yxiDhNyhsQ7DyQJrC4FhFE4TXOi4bktFnOWXTMds8qZSbpv2XwRaNOBg==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxlint/binding-android-arm64": {
"version": "1.85.0",
"resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm64/-/binding-android-arm64-1.85.0.tgz",
"integrity": "sha512-SxLN3ALjoT9NNdvpjEevGeHvfzTAFrF0NBYB5tzK7/GtCKMze3j1e/m/X2ozqGj2U9hfGG/dg/OG8vpVK4PiDA==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxlint/binding-darwin-arm64": {
"version": "1.85.0",
"resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-arm64/-/binding-darwin-arm64-1.85.0.tgz",
"integrity": "sha512-Y/Sup/J4f0f9UGsSd/xyCNTeWL+gepO63GBdEDAfue9nBsnk9zMmnIXx1O6b1V8C90vB5nucYNZ0pbMXAp8zJA==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxlint/binding-darwin-x64": {
"version": "1.85.0",
"resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-x64/-/binding-darwin-x64-1.85.0.tgz",
"integrity": "sha512-ApOSNC04ynpDTwvBD+//0wyfODRSbEzvRoKpX8teffmc27z8AockwSNeMXGJXn5KP85eahDgR/2llICWLkzcnw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxlint/binding-freebsd-x64": {
"version": "1.85.0",
"resolved": "https://registry.npmjs.org/@oxlint/binding-freebsd-x64/-/binding-freebsd-x64-1.85.0.tgz",
"integrity": "sha512-bNrVrCOA/kHky3Tu79IXWXe5bhIgLXfUuUEDHlAGOHUk96MkvDZ1ecaQF19rwstrnaqfP1o9nBTqzIr9+ZHkUg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxlint/binding-linux-arm-gnueabihf": {
"version": "1.85.0",
"resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.85.0.tgz",
"integrity": "sha512-NUrzOJ1s/EqsVvfn2L/1D8Wro2LPIZUbihL8kOJLh5fEdGEN3rdOGUYq3HwnUIL8sjpoP+4N6RaGrgmMJnaMPw==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxlint/binding-linux-arm-musleabihf": {
"version": "1.85.0",
"resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-1.85.0.tgz",
"integrity": "sha512-UJXrAT3E/RWkEqXLIs2ehETja1qfgkPb+5gwLIIS+o/6cf+grHvoOXTa5997a/YNQfcJS0DRBTOfZt95cvOI1g==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxlint/binding-linux-arm64-gnu": {
"version": "1.85.0",
"resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.85.0.tgz",
"integrity": "sha512-lK40QLjI0HxigO7CjDDshEtfYIeiYS0020v5BHFPqN4uuQBQxd2K9LNom2dW15o9F1937quSCRVp4ZsVhdbYdg==",
"cpu": [
"arm64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxlint/binding-linux-arm64-musl": {
"version": "1.85.0",
"resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.85.0.tgz",
"integrity": "sha512-c2zbdBwGKreHXwRx3gWBuFGJxLhxgsg6YlZ+3H+RgRusU/UEV9jNwJ3HGYK+nRo0LvBa7mt6Kj86xoVotUo8cw==",
"cpu": [
"arm64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxlint/binding-linux-ppc64-gnu": {
"version": "1.85.0",
"resolved": "https://registry.npmjs.org/@oxlint/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.85.0.tgz",
"integrity": "sha512-tlt/Hy8lZ97/lCPmCgw/B3k/mwh+BzaIPbPkldZEly7TwLmx0xe2CQcaW2g/rR0dOgS9JNGCZsMEqLhUNMGvaw==",
"cpu": [
"ppc64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxlint/binding-linux-riscv64-gnu": {
"version": "1.85.0",
"resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-1.85.0.tgz",
"integrity": "sha512-3tNR9Xey82X0zKuY1d8hJ6Rc9gwRDurmqGLnQZa5xqOXy8/YyiqFXjAtugkKLY82obOlpK1eSiDRlgcNPuxtIg==",
"cpu": [
"riscv64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxlint/binding-linux-riscv64-musl": {
"version": "1.85.0",
"resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-1.85.0.tgz",
"integrity": "sha512-wbGRd5PqCcjkJFHhZuZ2OBSUQY9czlQsoA/cQQB9JK/L9mC5MQgGoKAh+xd8QjA5V+0D3j+Qd1lAWn1I8zlelA==",
"cpu": [
"riscv64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxlint/binding-linux-s390x-gnu": {
"version": "1.85.0",
"resolved": "https://registry.npmjs.org/@oxlint/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.85.0.tgz",
"integrity": "sha512-3Sn0kSrE4DPZCWV/8o+n4x3aFZxI9ulMnkYlwCbJ8eUVkwRK2IerohE/A/z3SNbCwoPFOCJmGE5Avrq0rrvdvQ==",
"cpu": [
"s390x"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxlint/binding-linux-x64-gnu": {
"version": "1.85.0",
"resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.85.0.tgz",
"integrity": "sha512-JY2pxxYfB62bAGfejljVCqc44etItehPuAyaeSAdMuEMtwNA00ggMnS66lC1oIhos6oOXUkuU6mZ9bpFh3BqWg==",
"cpu": [
"x64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxlint/binding-linux-x64-musl": {
"version": "1.85.0",
"resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-musl/-/binding-linux-x64-musl-1.85.0.tgz",
"integrity": "sha512-5k74vZ6qJBjBHEOlBk9B/iv68Yu0F1Afw/vvT2ar6OGCqEeXLaSjXz2n/IPCbhLG22UoKoYEJTzpYraRdcp6PA==",
"cpu": [
"x64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxlint/binding-openharmony-arm64": {
"version": "1.85.0",
"resolved": "https://registry.npmjs.org/@oxlint/binding-openharmony-arm64/-/binding-openharmony-arm64-1.85.0.tgz",
"integrity": "sha512-GbAl5qt5TCkPLXTaIISZJnugrcBhra6rodcXc9jYt620UtdsTt71NlNmJmm0frxzFpd54x/G+MkitEJA8I/BoA==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openharmony"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxlint/binding-win32-arm64-msvc": {
"version": "1.85.0",
"resolved": "https://registry.npmjs.org/@oxlint/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.85.0.tgz",
"integrity": "sha512-kjmws5MK0et2swk4ND85D7NVQyDHw162i6whtZDLUA/lo6FQyBZDcmMRCMcVZcNrAhIaftVb00x9ChGDOjjNJA==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxlint/binding-win32-ia32-msvc": {
"version": "1.85.0",
"resolved": "https://registry.npmjs.org/@oxlint/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.85.0.tgz",
"integrity": "sha512-eSsIJx9n4yxvOqYTZyPEMyEXRmE60XH7xGAU7i0Qbsn1lf6Za3CWJ9aRd82oSFKXaxhp+sA6/yMJVRIpLpna6A==",
"cpu": [
"ia32"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@oxlint/binding-win32-x64-msvc": {
"version": "1.85.0",
"resolved": "https://registry.npmjs.org/@oxlint/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.85.0.tgz",
"integrity": "sha512-pBebIPUpKKhWrhSMWhy8TdAZBewiXnfxmaAGxhzxM1068GagqFaTwgKlU6e+UyJ2sPR+VoHouhXuGJkQjsrDvA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@parcel/watcher": { "node_modules/@parcel/watcher": {
"version": "2.5.6", "version": "2.5.6",
"resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.6.tgz", "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.5.6.tgz",
@@ -3235,6 +3668,73 @@
"opener": "bin/opener-bin.js" "opener": "bin/opener-bin.js"
} }
}, },
"node_modules/oxlint": {
"version": "1.85.0",
"resolved": "https://registry.npmjs.org/oxlint/-/oxlint-1.85.0.tgz",
"integrity": "sha512-bc26s97nuvPj1ViyPsqmKecVkUWFMEdtayO8MaQ6oiLfs1pj94cQlZZhrh4BPNlr9HQosjhIlwgZKsfcwmcNgg==",
"dev": true,
"license": "MIT",
"bin": {
"oxlint": "bin/oxlint"
},
"engines": {
"node": "^20.19.0 || >=22.12.0"
},
"funding": {
"url": "https://github.com/sponsors/oxc-project"
},
"optionalDependencies": {
"@oxlint/binding-android-arm-eabi": "1.85.0",
"@oxlint/binding-android-arm64": "1.85.0",
"@oxlint/binding-darwin-arm64": "1.85.0",
"@oxlint/binding-darwin-x64": "1.85.0",
"@oxlint/binding-freebsd-x64": "1.85.0",
"@oxlint/binding-linux-arm-gnueabihf": "1.85.0",
"@oxlint/binding-linux-arm-musleabihf": "1.85.0",
"@oxlint/binding-linux-arm64-gnu": "1.85.0",
"@oxlint/binding-linux-arm64-musl": "1.85.0",
"@oxlint/binding-linux-ppc64-gnu": "1.85.0",
"@oxlint/binding-linux-riscv64-gnu": "1.85.0",
"@oxlint/binding-linux-riscv64-musl": "1.85.0",
"@oxlint/binding-linux-s390x-gnu": "1.85.0",
"@oxlint/binding-linux-x64-gnu": "1.85.0",
"@oxlint/binding-linux-x64-musl": "1.85.0",
"@oxlint/binding-openharmony-arm64": "1.85.0",
"@oxlint/binding-win32-arm64-msvc": "1.85.0",
"@oxlint/binding-win32-ia32-msvc": "1.85.0",
"@oxlint/binding-win32-x64-msvc": "1.85.0"
},
"peerDependencies": {
"oxlint-tsgolint": ">=7.0.2001",
"vite-plus": "*"
},
"peerDependenciesMeta": {
"oxlint-tsgolint": {
"optional": true
},
"vite-plus": {
"optional": true
}
}
},
"node_modules/oxlint-tsgolint": {
"version": "7.0.2003",
"resolved": "https://registry.npmjs.org/oxlint-tsgolint/-/oxlint-tsgolint-7.0.2003.tgz",
"integrity": "sha512-VnK4zlqgmgq/7ZcjzCk/WpN8kKFsYGcB85Io9qT3wL4K8Un3RKmJkp793crNETieMusPMKOA4a+Mw2wbteI6TQ==",
"dev": true,
"license": "MIT",
"bin": {
"tsgolint": "bin/tsgolint.js"
},
"optionalDependencies": {
"@oxlint-tsgolint/darwin-arm64": "7.0.2003",
"@oxlint-tsgolint/darwin-x64": "7.0.2003",
"@oxlint-tsgolint/linux-arm64": "7.0.2003",
"@oxlint-tsgolint/linux-x64": "7.0.2003",
"@oxlint-tsgolint/win32-arm64": "7.0.2003",
"@oxlint-tsgolint/win32-x64": "7.0.2003"
}
},
"node_modules/p-limit": { "node_modules/p-limit": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
+3
View File
@@ -14,6 +14,7 @@
"prepare:ios": "scripts/ios.sh prepare ios", "prepare:ios": "scripts/ios.sh prepare ios",
"doctor:ios": "scripts/ios.sh doctor ios", "doctor:ios": "scripts/ios.sh doctor ios",
"build": "./build.sh", "build": "./build.sh",
"lint": "./lint.sh",
"run": "./build_and_run.sh", "run": "./build_and_run.sh",
"release": "scripts/release.sh", "release": "scripts/release.sh",
"clean": "rm -rf platforms", "clean": "rm -rf platforms",
@@ -39,6 +40,8 @@
"@nativescript/ios": "9.0.3", "@nativescript/ios": "9.0.3",
"@nativescript/types": "~9.0.0", "@nativescript/types": "~9.0.0",
"@nativescript/webpack": "~5.0.25", "@nativescript/webpack": "~5.0.25",
"oxlint": "^1.85.0",
"oxlint-tsgolint": "^7.0.2003",
"typescript": "~5.4.0" "typescript": "~5.4.0"
} }
} }
+2 -3
View File
@@ -9,10 +9,9 @@
"noEmitOnError": true, "noEmitOnError": true,
"skipLibCheck": true, "skipLibCheck": true,
"lib": ["ESNext", "dom"], "lib": ["ESNext", "dom"],
"baseUrl": ".",
"paths": { "paths": {
"~/*": ["app/*"], "~/*": ["./app/*"],
"@/*": ["app/*"] "@/*": ["./app/*"]
} }
}, },
"include": ["app/**/*"], "include": ["app/**/*"],