Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

T3TerminalModule.swift

60 lines1.9 KB

1import ExpoModulesCore
2​
3public 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("autoFocus") { (view: T3TerminalView, autoFocus: Bool) in
31 view.autoFocus = autoFocus
32 }
33​
34 Prop("appearanceScheme") { (view: T3TerminalView, appearanceScheme: String) in
35 view.appearanceScheme = appearanceScheme
36 }
37​
38 Prop("themeConfig") { (view: T3TerminalView, themeConfig: String) in
39 view.themeConfig = themeConfig
40 }
41​
42 Prop("backgroundColor") { (view: T3TerminalView, backgroundColor: String) in
43 view.backgroundColorHex = backgroundColor
44 }
45​
46 Prop("foregroundColor") { (view: T3TerminalView, foregroundColor: String) in
47 view.foregroundColorHex = foregroundColor
48 }
49​
50 Prop("mutedForegroundColor") { (view: T3TerminalView, mutedForegroundColor: String) in
51 view.mutedForegroundColorHex = mutedForegroundColor
52 }
53​
54 Prop("captureRequest") { (view: T3TerminalView, request: Double) in
55 view.captureRequest = request
56 }
57 Events("onInput", "onResize", "onCapture")
58 }
59 }