Open History to see the last commit
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": 4,
11 "outputRevision": 1,
12 ])
13
14 View(T3TerminalView.self) {
15 AsyncFunction("writeOutput") { (view: T3TerminalView, data: String, reset: Bool) in
16 view.writeOutput(data, reset: reset)
17 }
18
19 AsyncFunction("resetInput") { (view: T3TerminalView) in
20 view.resetInputField()
21 }
22
23 Prop("terminalKey") { (view: T3TerminalView, terminalKey: String) in
24 view.terminalKey = terminalKey
25 }
26
27 Prop("initialBuffer") { (view: T3TerminalView, initialBuffer: String) in
28 view.initialBuffer = initialBuffer
29 }
30
31 Prop("fontSize") { (view: T3TerminalView, fontSize: Double) in
32 view.fontSize = CGFloat(fontSize)
33 }
34
35 Prop("focusRequest") { (view: T3TerminalView, focusRequest: Double) in
36 view.focusRequest = focusRequest
37 }
38
39 Prop("readOnly") { (view: T3TerminalView, readOnly: Bool) in
40 view.readOnly = readOnly
41 }
42
43 Prop("autoFocus") { (view: T3TerminalView, autoFocus: Bool) in
44 view.autoFocus = autoFocus
45 }
46
47 Prop("appearanceScheme") { (view: T3TerminalView, appearanceScheme: String) in
48 view.appearanceScheme = appearanceScheme
49 }
50
51 Prop("themeConfig") { (view: T3TerminalView, themeConfig: String) in
52 view.themeConfig = themeConfig
53 }
54
55 Prop("backgroundColor") { (view: T3TerminalView, backgroundColor: String) in
56 view.backgroundColorHex = backgroundColor
57 }
58
59 Prop("foregroundColor") { (view: T3TerminalView, foregroundColor: String) in
60 view.foregroundColorHex = foregroundColor
61 }
62
63 Prop("mutedForegroundColor") { (view: T3TerminalView, mutedForegroundColor: String) in
64 view.mutedForegroundColorHex = mutedForegroundColor
65 }
66
67 Prop("captureRequest") { (view: T3TerminalView, request: Double) in
68 view.captureRequest = request
69 }
70
71 Prop("sharedGrid") { (view: T3TerminalView, sharedGrid: [Int]) in
72 view.sharedGrid = sharedGrid
73 }
74 Events("onInput", "onResize", "onCapture", "onPaste")
75
76 OnViewDidUpdateProps { (view: T3TerminalView) in
77 view.applyPendingBuffer()
78 }
79 }
80 }
81}