@fressh/react-native-terminal 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +182 -0
- package/ReactNativeTerminal.podspec +82 -0
- package/android/CMakeLists.txt +76 -0
- package/android/build.gradle +121 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/src/main/assets/fonts/DejaVuSansMono.ttf +0 -0
- package/android/src/main/cpp/cpp-adapter.cpp +180 -0
- package/android/src/main/java/com/margelo/nitro/fressh/HybridTerminal.kt +146 -0
- package/android/src/main/java/com/margelo/nitro/fressh/ReactNativeTerminalModule.kt +43 -0
- package/android/src/main/java/com/margelo/nitro/fressh/ReactNativeTerminalPackage.kt +32 -0
- package/android/src/main/jniLibs/arm64-v8a/libshim_uniffi.so +0 -0
- package/android/src/main/jniLibs/x86_64/libshim_uniffi.so +0 -0
- package/babel.config.js +12 -0
- package/cpp/README.md +14 -0
- package/cpp/generated/shim_uniffi.cpp +4246 -0
- package/cpp/generated/shim_uniffi.hpp +364 -0
- package/ios/FresshTerminalRenderABI.h +46 -0
- package/ios/HybridTerminal.swift +144 -0
- package/ios/ReactNativeTerminalUniffi.mm +77 -0
- package/ios/fetch-angle.sh +39 -0
- package/ios/fonts/DejaVuSansMono.ttf +0 -0
- package/libEGL.xcframework/Info.plist +44 -0
- package/libEGL.xcframework/ios-arm64/libEGL.framework/Info.plist +0 -0
- package/libEGL.xcframework/ios-arm64/libEGL.framework/libEGL +0 -0
- package/libEGL.xcframework/ios-arm64_x86_64-simulator/libEGL.framework/Info.plist +0 -0
- package/libEGL.xcframework/ios-arm64_x86_64-simulator/libEGL.framework/libEGL +0 -0
- package/libGLESv2.xcframework/Info.plist +44 -0
- package/libGLESv2.xcframework/ios-arm64/libGLESv2.framework/Info.plist +0 -0
- package/libGLESv2.xcframework/ios-arm64/libGLESv2.framework/libGLESv2 +0 -0
- package/libGLESv2.xcframework/ios-arm64_x86_64-simulator/libGLESv2.framework/Info.plist +0 -0
- package/libGLESv2.xcframework/ios-arm64_x86_64-simulator/libGLESv2.framework/libGLESv2 +0 -0
- package/nitro/Terminal.nitro.ts +40 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/ReactNativeTerminal+autolinking.cmake +83 -0
- package/nitrogen/generated/android/ReactNativeTerminal+autolinking.gradle +27 -0
- package/nitrogen/generated/android/ReactNativeTerminalOnLoad.cpp +56 -0
- package/nitrogen/generated/android/ReactNativeTerminalOnLoad.hpp +34 -0
- package/nitrogen/generated/android/c++/JHybridTerminalSpec.cpp +76 -0
- package/nitrogen/generated/android/c++/JHybridTerminalSpec.hpp +68 -0
- package/nitrogen/generated/android/c++/views/JHybridTerminalStateUpdater.cpp +64 -0
- package/nitrogen/generated/android/c++/views/JHybridTerminalStateUpdater.hpp +49 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/fressh/HybridTerminalSpec.kt +69 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/fressh/ReactNativeTerminalOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/fressh/views/HybridTerminalManager.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/fressh/views/HybridTerminalStateUpdater.kt +23 -0
- package/nitrogen/generated/ios/ReactNativeTerminal+autolinking.rb +62 -0
- package/nitrogen/generated/ios/ReactNativeTerminal-Swift-Cxx-Bridge.cpp +33 -0
- package/nitrogen/generated/ios/ReactNativeTerminal-Swift-Cxx-Bridge.hpp +57 -0
- package/nitrogen/generated/ios/ReactNativeTerminal-Swift-Cxx-Umbrella.hpp +43 -0
- package/nitrogen/generated/ios/ReactNativeTerminalAutolinking.mm +33 -0
- package/nitrogen/generated/ios/ReactNativeTerminalAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridTerminalSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridTerminalSpecSwift.hpp +96 -0
- package/nitrogen/generated/ios/c++/views/HybridTerminalComponent.mm +132 -0
- package/nitrogen/generated/ios/swift/HybridTerminalSpec.swift +57 -0
- package/nitrogen/generated/ios/swift/HybridTerminalSpec_cxx.swift +204 -0
- package/nitrogen/generated/shared/c++/HybridTerminalSpec.cpp +26 -0
- package/nitrogen/generated/shared/c++/HybridTerminalSpec.hpp +68 -0
- package/nitrogen/generated/shared/c++/views/HybridTerminalComponent.cpp +110 -0
- package/nitrogen/generated/shared/c++/views/HybridTerminalComponent.hpp +113 -0
- package/nitrogen/generated/shared/json/TerminalConfig.json +12 -0
- package/package.json +97 -0
- package/react-native.config.js +12 -0
- package/shim_uniffi.xcframework/Info.plist +44 -0
- package/shim_uniffi.xcframework/ios-arm64/libshim_uniffi.a +0 -0
- package/shim_uniffi.xcframework/ios-arm64_x86_64-simulator/libshim_uniffi.a +0 -0
- package/src/Terminal.tsx +135 -0
- package/src/generated/shim_uniffi-ffi.ts +320 -0
- package/src/generated/shim_uniffi.ts +2527 -0
- package/src/index.ts +52 -0
- package/src/ssh.ts +239 -0
- package/tsconfig.json +31 -0
- package/ubrn.config.yaml +24 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridTerminalSpec.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.fressh
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.HybridObject
|
|
14
|
+
import com.margelo.nitro.views.HybridView
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A Kotlin class representing the Terminal HybridObject.
|
|
18
|
+
* Implement this abstract class to create Kotlin-based instances of Terminal.
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress(
|
|
23
|
+
"KotlinJniMissingFunction", "unused",
|
|
24
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
25
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
26
|
+
)
|
|
27
|
+
abstract class HybridTerminalSpec: HybridView() {
|
|
28
|
+
// Properties
|
|
29
|
+
@get:DoNotStrip
|
|
30
|
+
@get:Keep
|
|
31
|
+
@set:DoNotStrip
|
|
32
|
+
@set:Keep
|
|
33
|
+
abstract var fontPath: String
|
|
34
|
+
|
|
35
|
+
@get:DoNotStrip
|
|
36
|
+
@get:Keep
|
|
37
|
+
@set:DoNotStrip
|
|
38
|
+
@set:Keep
|
|
39
|
+
abstract var configJson: String?
|
|
40
|
+
|
|
41
|
+
@get:DoNotStrip
|
|
42
|
+
@get:Keep
|
|
43
|
+
@set:DoNotStrip
|
|
44
|
+
@set:Keep
|
|
45
|
+
abstract var shellId: String?
|
|
46
|
+
|
|
47
|
+
// Methods
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
// Default implementation of `HybridObject.toString()`
|
|
51
|
+
override fun toString(): String {
|
|
52
|
+
return "[HybridObject Terminal]"
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// C++ backing class
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
@Keep
|
|
58
|
+
protected open class CxxPart(javaPart: HybridTerminalSpec): HybridObject.CxxPart(javaPart) {
|
|
59
|
+
// C++ JHybridTerminalSpec::CxxPart::initHybrid(...)
|
|
60
|
+
external override fun initHybrid(): HybridData
|
|
61
|
+
}
|
|
62
|
+
override fun createCxxPart(): CxxPart {
|
|
63
|
+
return CxxPart(this)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
companion object {
|
|
67
|
+
protected const val TAG = "HybridTerminalSpec"
|
|
68
|
+
}
|
|
69
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/fressh/ReactNativeTerminalOnLoad.kt
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeTerminalOnLoad.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.fressh
|
|
9
|
+
|
|
10
|
+
import android.util.Log
|
|
11
|
+
|
|
12
|
+
internal class ReactNativeTerminalOnLoad {
|
|
13
|
+
companion object {
|
|
14
|
+
private const val TAG = "ReactNativeTerminalOnLoad"
|
|
15
|
+
private var didLoad = false
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the native part of "ReactNativeTerminal".
|
|
18
|
+
* This method is idempotent and can be called more than once.
|
|
19
|
+
*/
|
|
20
|
+
@JvmStatic
|
|
21
|
+
fun initializeNative() {
|
|
22
|
+
if (didLoad) return
|
|
23
|
+
try {
|
|
24
|
+
Log.i(TAG, "Loading ReactNativeTerminal C++ library...")
|
|
25
|
+
System.loadLibrary("ReactNativeTerminal")
|
|
26
|
+
Log.i(TAG, "Successfully loaded ReactNativeTerminal C++ library!")
|
|
27
|
+
didLoad = true
|
|
28
|
+
} catch (e: Error) {
|
|
29
|
+
Log.e(TAG, "Failed to load ReactNativeTerminal C++ library! Is it properly installed and linked? " +
|
|
30
|
+
"Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
|
|
31
|
+
throw e
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/fressh/views/HybridTerminalManager.kt
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridTerminalManager.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.fressh.views
|
|
9
|
+
|
|
10
|
+
import android.view.View
|
|
11
|
+
import com.facebook.react.uimanager.ReactStylesDiffMap
|
|
12
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
|
13
|
+
import com.facebook.react.uimanager.StateWrapper
|
|
14
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
15
|
+
import com.margelo.nitro.R.id.associated_hybrid_view_tag
|
|
16
|
+
import com.margelo.nitro.views.RecyclableView
|
|
17
|
+
import com.margelo.nitro.fressh.*
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Represents the React Native `ViewManager` for the "Terminal" Nitro HybridView.
|
|
21
|
+
*/
|
|
22
|
+
public class HybridTerminalManager: SimpleViewManager<View>() {
|
|
23
|
+
init {
|
|
24
|
+
if (RecyclableView::class.java.isAssignableFrom(HybridTerminal::class.java)) {
|
|
25
|
+
// Enable view recycling
|
|
26
|
+
super.setupViewRecycling()
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
override fun getName(): String {
|
|
31
|
+
return "Terminal"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
override fun createViewInstance(reactContext: ThemedReactContext): View {
|
|
35
|
+
val hybridView = HybridTerminal(reactContext)
|
|
36
|
+
val view = hybridView.view
|
|
37
|
+
view.setTag(associated_hybrid_view_tag, hybridView)
|
|
38
|
+
return view
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
override fun updateState(view: View, props: ReactStylesDiffMap, stateWrapper: StateWrapper): Any? {
|
|
42
|
+
val hybridView = getHybridView(view)
|
|
43
|
+
?: throw Error("Couldn't find view $view in local views table!")
|
|
44
|
+
|
|
45
|
+
// 1. Update each prop individually
|
|
46
|
+
hybridView.beforeUpdate()
|
|
47
|
+
HybridTerminalStateUpdater.updateViewProps(hybridView, stateWrapper)
|
|
48
|
+
hybridView.afterUpdate()
|
|
49
|
+
|
|
50
|
+
// 2. Continue in base View props
|
|
51
|
+
return super.updateState(view, props, stateWrapper)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
override fun onDropViewInstance(view: View) {
|
|
55
|
+
val hybridView = getHybridView(view)
|
|
56
|
+
hybridView?.onDropView()
|
|
57
|
+
return super.onDropViewInstance(view)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
protected override fun prepareToRecycleView(reactContext: ThemedReactContext, view: View): View? {
|
|
61
|
+
super.prepareToRecycleView(reactContext, view)
|
|
62
|
+
val hybridView = getHybridView(view)
|
|
63
|
+
?: return null
|
|
64
|
+
|
|
65
|
+
@Suppress("USELESS_IS_CHECK")
|
|
66
|
+
if (hybridView is RecyclableView) {
|
|
67
|
+
// Recycle in it's implementation
|
|
68
|
+
hybridView.prepareForRecycle()
|
|
69
|
+
|
|
70
|
+
// Maybe update the view if it changed
|
|
71
|
+
return hybridView.view
|
|
72
|
+
} else {
|
|
73
|
+
return null
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
private fun getHybridView(view: View): HybridTerminal? {
|
|
78
|
+
return view.getTag(associated_hybrid_view_tag) as? HybridTerminal
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridTerminalStateUpdater.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.fressh.views
|
|
9
|
+
|
|
10
|
+
import com.facebook.react.uimanager.StateWrapper
|
|
11
|
+
import com.margelo.nitro.fressh.*
|
|
12
|
+
|
|
13
|
+
internal class HybridTerminalStateUpdater {
|
|
14
|
+
companion object {
|
|
15
|
+
/**
|
|
16
|
+
* Updates the props for [view] through C++.
|
|
17
|
+
* The [state] prop is expected to contain [view]'s props as wrapped Fabric state.
|
|
18
|
+
*/
|
|
19
|
+
@Suppress("KotlinJniMissingFunction")
|
|
20
|
+
@JvmStatic
|
|
21
|
+
external fun updateViewProps(view: HybridTerminalSpec, state: StateWrapper)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#
|
|
2
|
+
# ReactNativeTerminal+autolinking.rb
|
|
3
|
+
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
# https://github.com/mrousavy/nitro
|
|
5
|
+
# Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# This is a Ruby script that adds all files generated by Nitrogen
|
|
9
|
+
# to the given podspec.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your .podspec:
|
|
12
|
+
# ```ruby
|
|
13
|
+
# Pod::Spec.new do |spec|
|
|
14
|
+
# # ...
|
|
15
|
+
#
|
|
16
|
+
# # Add all files generated by Nitrogen
|
|
17
|
+
# load 'nitrogen/generated/ios/ReactNativeTerminal+autolinking.rb'
|
|
18
|
+
# add_nitrogen_files(spec)
|
|
19
|
+
# end
|
|
20
|
+
# ```
|
|
21
|
+
|
|
22
|
+
def add_nitrogen_files(spec)
|
|
23
|
+
Pod::UI.puts "[NitroModules] 🔥 ReactNativeTerminal is boosted by nitro!"
|
|
24
|
+
|
|
25
|
+
spec.dependency "NitroModules"
|
|
26
|
+
|
|
27
|
+
current_source_files = Array(spec.attributes_hash['source_files'])
|
|
28
|
+
spec.source_files = current_source_files + [
|
|
29
|
+
# Generated cross-platform specs
|
|
30
|
+
"nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
|
|
31
|
+
# Generated bridges for the cross-platform specs
|
|
32
|
+
"nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
current_public_header_files = Array(spec.attributes_hash['public_header_files'])
|
|
36
|
+
spec.public_header_files = current_public_header_files + [
|
|
37
|
+
# Generated specs
|
|
38
|
+
"nitrogen/generated/shared/**/*.{h,hpp}",
|
|
39
|
+
# Swift to C++ bridging helpers
|
|
40
|
+
"nitrogen/generated/ios/ReactNativeTerminal-Swift-Cxx-Bridge.hpp"
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
current_private_header_files = Array(spec.attributes_hash['private_header_files'])
|
|
44
|
+
spec.private_header_files = current_private_header_files + [
|
|
45
|
+
# iOS specific specs
|
|
46
|
+
"nitrogen/generated/ios/c++/**/*.{h,hpp}",
|
|
47
|
+
# Views are framework-specific and should be private
|
|
48
|
+
"nitrogen/generated/shared/**/views/**/*"
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
|
|
52
|
+
spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
|
|
53
|
+
# Use C++ 20
|
|
54
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
55
|
+
# Enables C++ <-> Swift interop (by default it's only ObjC)
|
|
56
|
+
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
|
+
# Enables stricter modular headers
|
|
58
|
+
"DEFINES_MODULE" => "YES",
|
|
59
|
+
# Disable auto-generated ObjC header for Swift (Static linkage on Xcode 26.4 breaks here)
|
|
60
|
+
"SWIFT_INSTALL_OBJC_HEADER" => "NO",
|
|
61
|
+
})
|
|
62
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeTerminal-Swift-Cxx-Bridge.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "ReactNativeTerminal-Swift-Cxx-Bridge.hpp"
|
|
9
|
+
|
|
10
|
+
// Include C++ implementation defined types
|
|
11
|
+
#include "HybridTerminalSpecSwift.hpp"
|
|
12
|
+
#include "ReactNativeTerminal-Swift-Cxx-Umbrella.hpp"
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::fressh::bridge::swift {
|
|
16
|
+
|
|
17
|
+
// pragma MARK: std::shared_ptr<HybridTerminalSpec>
|
|
18
|
+
std::shared_ptr<HybridTerminalSpec> create_std__shared_ptr_HybridTerminalSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
19
|
+
ReactNativeTerminal::HybridTerminalSpec_cxx swiftPart = ReactNativeTerminal::HybridTerminalSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
20
|
+
return std::make_shared<margelo::nitro::fressh::HybridTerminalSpecSwift>(swiftPart);
|
|
21
|
+
}
|
|
22
|
+
void* NON_NULL get_std__shared_ptr_HybridTerminalSpec_(std__shared_ptr_HybridTerminalSpec_ cppType) {
|
|
23
|
+
std::shared_ptr<margelo::nitro::fressh::HybridTerminalSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::fressh::HybridTerminalSpecSwift>(cppType);
|
|
24
|
+
#ifdef NITRO_DEBUG
|
|
25
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
26
|
+
throw std::runtime_error("Class \"HybridTerminalSpec\" is not implemented in Swift!");
|
|
27
|
+
}
|
|
28
|
+
#endif
|
|
29
|
+
ReactNativeTerminal::HybridTerminalSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
30
|
+
return swiftPart.toUnsafe();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
} // namespace margelo::nitro::fressh::bridge::swift
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeTerminal-Swift-Cxx-Bridge.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridTerminalSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::fressh { class HybridTerminalSpec; }
|
|
13
|
+
|
|
14
|
+
// Forward declarations of Swift defined types
|
|
15
|
+
// Forward declaration of `HybridTerminalSpec_cxx` to properly resolve imports.
|
|
16
|
+
namespace ReactNativeTerminal { class HybridTerminalSpec_cxx; }
|
|
17
|
+
|
|
18
|
+
// Include C++ defined types
|
|
19
|
+
#include "HybridTerminalSpec.hpp"
|
|
20
|
+
#include <memory>
|
|
21
|
+
#include <optional>
|
|
22
|
+
#include <string>
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
26
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
27
|
+
*/
|
|
28
|
+
namespace margelo::nitro::fressh::bridge::swift {
|
|
29
|
+
|
|
30
|
+
// pragma MARK: std::optional<std::string>
|
|
31
|
+
/**
|
|
32
|
+
* Specialized version of `std::optional<std::string>`.
|
|
33
|
+
*/
|
|
34
|
+
using std__optional_std__string_ = std::optional<std::string>;
|
|
35
|
+
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
|
|
36
|
+
return std::optional<std::string>(value);
|
|
37
|
+
}
|
|
38
|
+
inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
39
|
+
return optional.has_value();
|
|
40
|
+
}
|
|
41
|
+
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
42
|
+
return optional.value();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// pragma MARK: std::shared_ptr<HybridTerminalSpec>
|
|
46
|
+
/**
|
|
47
|
+
* Specialized version of `std::shared_ptr<HybridTerminalSpec>`.
|
|
48
|
+
*/
|
|
49
|
+
using std__shared_ptr_HybridTerminalSpec_ = std::shared_ptr<HybridTerminalSpec>;
|
|
50
|
+
std::shared_ptr<HybridTerminalSpec> create_std__shared_ptr_HybridTerminalSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
51
|
+
void* NON_NULL get_std__shared_ptr_HybridTerminalSpec_(std__shared_ptr_HybridTerminalSpec_ cppType);
|
|
52
|
+
|
|
53
|
+
// pragma MARK: std::weak_ptr<HybridTerminalSpec>
|
|
54
|
+
using std__weak_ptr_HybridTerminalSpec_ = std::weak_ptr<HybridTerminalSpec>;
|
|
55
|
+
inline std__weak_ptr_HybridTerminalSpec_ weakify_std__shared_ptr_HybridTerminalSpec_(const std::shared_ptr<HybridTerminalSpec>& strong) noexcept { return strong; }
|
|
56
|
+
|
|
57
|
+
} // namespace margelo::nitro::fressh::bridge::swift
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeTerminal-Swift-Cxx-Umbrella.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridTerminalSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::fressh { class HybridTerminalSpec; }
|
|
13
|
+
|
|
14
|
+
// Include C++ defined types
|
|
15
|
+
#include "HybridTerminalSpec.hpp"
|
|
16
|
+
#include <memory>
|
|
17
|
+
#include <optional>
|
|
18
|
+
#include <string>
|
|
19
|
+
|
|
20
|
+
// C++ helpers for Swift
|
|
21
|
+
#include "ReactNativeTerminal-Swift-Cxx-Bridge.hpp"
|
|
22
|
+
|
|
23
|
+
// Common C++ types used in Swift
|
|
24
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
25
|
+
#include <NitroModules/AnyMapUtils.hpp>
|
|
26
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
27
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
28
|
+
|
|
29
|
+
// Forward declarations of Swift defined types
|
|
30
|
+
// Forward declaration of `HybridTerminalSpec_cxx` to properly resolve imports.
|
|
31
|
+
namespace ReactNativeTerminal { class HybridTerminalSpec_cxx; }
|
|
32
|
+
|
|
33
|
+
// Include Swift defined types
|
|
34
|
+
#if __has_include("ReactNativeTerminal-Swift.h")
|
|
35
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
36
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "ReactNativeTerminal".
|
|
37
|
+
#include "ReactNativeTerminal-Swift.h"
|
|
38
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
39
|
+
#elif __has_include(<ReactNativeTerminal/ReactNativeTerminal-Swift.h>)
|
|
40
|
+
#include <ReactNativeTerminal/ReactNativeTerminal-Swift.h>
|
|
41
|
+
#else
|
|
42
|
+
#error ReactNativeTerminal's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "ReactNativeTerminal", and try building the app first.
|
|
43
|
+
#endif
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeTerminalAutolinking.mm
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
+
#import "ReactNativeTerminal-Swift-Cxx-Umbrella.hpp"
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "HybridTerminalSpecSwift.hpp"
|
|
14
|
+
|
|
15
|
+
@interface ReactNativeTerminalAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation ReactNativeTerminalAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void) load {
|
|
21
|
+
using namespace margelo::nitro;
|
|
22
|
+
using namespace margelo::nitro::fressh;
|
|
23
|
+
|
|
24
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
+
"Terminal",
|
|
26
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
+
std::shared_ptr<HybridTerminalSpec> hybridObject = ReactNativeTerminal::ReactNativeTerminalAutolinking::createTerminal();
|
|
28
|
+
return hybridObject;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeTerminalAutolinking.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
// TODO: Use empty enums once Swift supports exporting them as namespaces
|
|
11
|
+
// See: https://github.com/swiftlang/swift/pull/83616
|
|
12
|
+
public final class ReactNativeTerminalAutolinking {
|
|
13
|
+
public typealias bridge = margelo.nitro.fressh.bridge.swift
|
|
14
|
+
|
|
15
|
+
public static func createTerminal() -> bridge.std__shared_ptr_HybridTerminalSpec_ {
|
|
16
|
+
let hybridObject = HybridTerminal()
|
|
17
|
+
return { () -> bridge.std__shared_ptr_HybridTerminalSpec_ in
|
|
18
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
19
|
+
return __cxxWrapped.getCxxPart()
|
|
20
|
+
}()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public static func isTerminalRecyclable() -> Bool {
|
|
24
|
+
return HybridTerminal.self is any RecyclableView.Type
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridTerminalSpecSwift.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridTerminalSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::fressh {
|
|
11
|
+
} // namespace margelo::nitro::fressh
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridTerminalSpecSwift.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "HybridTerminalSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridTerminalSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace ReactNativeTerminal { class HybridTerminalSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
#include <string>
|
|
18
|
+
#include <optional>
|
|
19
|
+
|
|
20
|
+
#include "ReactNativeTerminal-Swift-Cxx-Umbrella.hpp"
|
|
21
|
+
|
|
22
|
+
namespace margelo::nitro::fressh {
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The C++ part of HybridTerminalSpec_cxx.swift.
|
|
26
|
+
*
|
|
27
|
+
* HybridTerminalSpecSwift (C++) accesses HybridTerminalSpec_cxx (Swift), and might
|
|
28
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
29
|
+
*
|
|
30
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
31
|
+
* the future, HybridTerminalSpec_cxx can directly inherit from the C++ class HybridTerminalSpec
|
|
32
|
+
* to simplify the whole structure and memory management.
|
|
33
|
+
*/
|
|
34
|
+
class HybridTerminalSpecSwift: public virtual HybridTerminalSpec {
|
|
35
|
+
public:
|
|
36
|
+
// Constructor from a Swift instance
|
|
37
|
+
explicit HybridTerminalSpecSwift(const ReactNativeTerminal::HybridTerminalSpec_cxx& swiftPart):
|
|
38
|
+
HybridObject(HybridTerminalSpec::TAG),
|
|
39
|
+
_swiftPart(swiftPart) { }
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
// Get the Swift part
|
|
43
|
+
inline ReactNativeTerminal::HybridTerminalSpec_cxx& getSwiftPart() noexcept {
|
|
44
|
+
return _swiftPart;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
49
|
+
return _swiftPart.getMemorySize();
|
|
50
|
+
}
|
|
51
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
52
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridTerminalSpecSwift>(other)) {
|
|
53
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
void dispose() noexcept override {
|
|
58
|
+
_swiftPart.dispose();
|
|
59
|
+
}
|
|
60
|
+
std::string toString() override {
|
|
61
|
+
return _swiftPart.toString();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public:
|
|
65
|
+
// Properties
|
|
66
|
+
inline std::string getFontPath() noexcept override {
|
|
67
|
+
auto __result = _swiftPart.getFontPath();
|
|
68
|
+
return __result;
|
|
69
|
+
}
|
|
70
|
+
inline void setFontPath(const std::string& fontPath) noexcept override {
|
|
71
|
+
_swiftPart.setFontPath(fontPath);
|
|
72
|
+
}
|
|
73
|
+
inline std::optional<std::string> getConfigJson() noexcept override {
|
|
74
|
+
auto __result = _swiftPart.getConfigJson();
|
|
75
|
+
return __result;
|
|
76
|
+
}
|
|
77
|
+
inline void setConfigJson(const std::optional<std::string>& configJson) noexcept override {
|
|
78
|
+
_swiftPart.setConfigJson(configJson);
|
|
79
|
+
}
|
|
80
|
+
inline std::optional<std::string> getShellId() noexcept override {
|
|
81
|
+
auto __result = _swiftPart.getShellId();
|
|
82
|
+
return __result;
|
|
83
|
+
}
|
|
84
|
+
inline void setShellId(const std::optional<std::string>& shellId) noexcept override {
|
|
85
|
+
_swiftPart.setShellId(shellId);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
public:
|
|
89
|
+
// Methods
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
private:
|
|
93
|
+
ReactNativeTerminal::HybridTerminalSpec_cxx _swiftPart;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
} // namespace margelo::nitro::fressh
|