| 1 | import ExpoModulesCore |
| 2 | |
| 3 | public class T3TerminalModule: Module { |
| 4 | public func definition() -> ModuleDefinition { |
| 5 | Name("T3TerminalSurface") |
| 6 | |
| 7 | // Bumped when native hardware-keyboard handling changes; surfaced in the JS debug |
| 8 | // logs so a stale native binary is distinguishable from a broken key pipeline. |
| 9 | Constants([ |
| 10 | "hardwareKeyRevision": 3, |
| 11 | ]) |
| 12 | |
| 13 | View(T3TerminalView.self) { |
| 14 | Prop("terminalKey") { (view: T3TerminalView, terminalKey: String) in |
| 15 | view.terminalKey = terminalKey |
| 16 | } |
| 17 | |
| 18 | Prop("initialBuffer") { (view: T3TerminalView, initialBuffer: String) in |
| 19 | view.initialBuffer = initialBuffer |
| 20 | } |
| 21 | |
| 22 | Prop("fontSize") { (view: T3TerminalView, fontSize: Double) in |
| 23 | view.fontSize = CGFloat(fontSize) |
| 24 | } |
| 25 | |
| 26 | Prop("focusRequest") { (view: T3TerminalView, focusRequest: Double) in |
| 27 | view.focusRequest = focusRequest |
| 28 | } |
| 29 | |
| 30 | Prop("readOnly") { (view: T3TerminalView, readOnly: Bool) in |
| 31 | view.readOnly = readOnly |
| 32 | } |
| 33 | |
| 34 | Prop("autoFocus") { (view: T3TerminalView, autoFocus: Bool) in |
| 35 | view.autoFocus = autoFocus |
| 36 | } |
| 37 | |
| 38 | Prop("appearanceScheme") { (view: T3TerminalView, appearanceScheme: String) in |
| 39 | view.appearanceScheme = appearanceScheme |
| 40 | } |
| 41 | |
| 42 | Prop("themeConfig") { (view: T3TerminalView, themeConfig: String) in |
| 43 | view.themeConfig = themeConfig |
| 44 | } |
| 45 | |
| 46 | Prop("backgroundColor") { (view: T3TerminalView, backgroundColor: String) in |
| 47 | view.backgroundColorHex = backgroundColor |
| 48 | } |
| 49 | |
| 50 | Prop("foregroundColor") { (view: T3TerminalView, foregroundColor: String) in |
| 51 | view.foregroundColorHex = foregroundColor |
| 52 | } |
| 53 | |
| 54 | Prop("mutedForegroundColor") { (view: T3TerminalView, mutedForegroundColor: String) in |
| 55 | view.mutedForegroundColorHex = mutedForegroundColor |
| 56 | } |
| 57 | |
| 58 | Prop("captureRequest") { (view: T3TerminalView, request: Double) in |
| 59 | view.captureRequest = request |
| 60 | } |
| 61 | Events("onInput", "onResize", "onCapture") |
| 62 | } |
| 63 | } |
| 64 | } |