Govern task context and advance execution pointer
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled

This commit is contained in:
mes123456
2026-08-20 06:02:43 -04:00
parent 380cbed4ff
commit 10640aeb3c
984 changed files with 543475 additions and 327 deletions

View File

@@ -11,6 +11,12 @@ export interface InputModalState {
mainCommitCount: number;
}
export interface InputModalEvent {
type: "pointerdown" | "pointerup" | "pointercancel";
pointerType: "touch" | "pen";
pointerId: number;
}
export function createInputModalState(): InputModalState {
return { schemaVersion: 1, kind: "NONE", activePointerIds: [], cancelled: false, navigationRevision: 0, mainCommitCount: 0 };
}
@@ -39,3 +45,15 @@ export function commitPenStroke(state: InputModalState, pointerId: number): Inpu
if (state.kind !== "PEN_STROKE" || !state.activePointerIds.includes(pointerId) || state.cancelled) return state;
return { ...state, kind: "NONE", activePointerIds: [], mainCommitCount: state.mainCommitCount + 1 };
}
export function reduceInputModal(state: InputModalState, event: InputModalEvent): InputModalState {
if (!Number.isSafeInteger(event.pointerId) || event.pointerId < 0) throw new Error("POINTER_ID_INVALID");
if (event.pointerType === "touch") {
if (event.type === "pointerdown") return beginTouch(state, event.pointerId);
if (event.type === "pointerup") return endTouch(state, event.pointerId);
return cancelInputModal(state);
}
if (event.type === "pointerdown") return beginPenStroke(state, event.pointerId);
if (event.type === "pointerup") return commitPenStroke(state, event.pointerId);
return cancelInputModal(state);
}