hex/ios/HEXShared/FullKeyboard/TypingConfig/KeyboardZone.swift
Ryan Vogel 05cf262b83 ios: typing config format 0 (.mhexconfig), frozen: reference, schema and one limits table
A typing config is the file a person's own agent writes from their Hex typing export: words
(keep, never correct to, typo fixes with apply or suggest, dictation fixes) and key positions,
meaning where a tap counts. Keycaps never move on screen.
- Aim: per-letter offsets [dx, dy] in keycaps from the keycap centre to the mean landing point
  of taps meant for the letter (±0.3). They replace Learn how I type's average and Adaptive
  touch's centre for the letters a config names; they never add to them.
- Zones: moves of one edge of a key's touch area, in letter keycaps (±0.25). Every key keeps
  its keycap centre ±0.3 keycap, every point belongs to one key, and zones are measured against
  Hex's hit model 1.
Both are tied to a context: width, orientation, posture, language, letters, split, Hex key
side and number row; keycap height, row pitch and letter width within 15%.

- ios/TypingConfig/limits.json is the one table. ios/scripts/build-typing-config.py generates
  TypingConfigLimits.swift (the phone's clamps), the package's scripts/limits.py and
  typing-config.schema.json from it, and --check fails on drift.
- ios/TypingConfig/package/reference/typing-config.md is the frozen definition: every field's
  meaning, unit, range, evidence and context, the order in which zones, next-letter odds and
  aim apply, how a reader treats unknown or newer fields, the App Group contract (switch
  experiments.typingConfigs, TypingConfigs/active.json, typingConfig.generation) and three
  worked examples.
- KeyboardZone.swift holds the zone model and hitModel only; nothing reads configs yet.

No behaviour change: nothing references the new types. Verified: build-typing-config.py
--check passes; the two Swift files type-check for the iOS simulator SDK.
2026-11-23 12:47:08 -05:00

20 lines
877 B
Swift

import CoreGraphics
/// One moved edge of a key's touch area (a typing config's zone, `ios/TypingConfig/package/
/// reference/typing-config.md`): `move` letter keycaps outward from Hex's own edge (negative
/// gives a strip to the neighbours across it).
nonisolated struct KeyboardZone: Equatable, Sendable {
enum Edge: String, Equatable, Sendable, CaseIterable {
case top, bottom, left, right
}
/// The version of Hex's default touch areas a zone is measured from. Bump it whenever
/// `KeyboardLayout.buildKeys` moves an edge (as #2379 gave the gap above the space bar to
/// it): a stored zone then no longer means what it was checked as, and readers skip it.
static let hitModel = 1
/// The key's id as typing logs name it (`TypingLogger.keyID`): a letter, `space`, …
var key: String
var edge: Edge
var move: CGFloat
}