aix 0.6.0 → 0.6.1
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/ios/EditMenuDefaultActions.swift +70 -0
- package/ios/HybridAix.swift +28 -3
- package/ios/HybridAixCellView.swift +0 -1
- package/ios/HybridAixComposer.swift +82 -0
- package/ios/HybridAixDropzone.swift +104 -0
- package/ios/HybridAixInputWrapper.swift +447 -0
- package/ios/InputType.swift +40 -0
- package/ios/PasteFileManager.swift +92 -0
- package/nitro.json +8 -0
- package/nitrogen/generated/android/Aix+autolinking.cmake +8 -0
- package/nitrogen/generated/android/AixOnLoad.cpp +26 -0
- package/nitrogen/generated/android/c++/JAixInputWrapperOnPasteEvent.hpp +70 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_AixInputWrapperOnPasteEvent_.hpp +98 -0
- package/nitrogen/generated/android/c++/JHybridAixComposerSpec.cpp +9 -0
- package/nitrogen/generated/android/c++/JHybridAixComposerSpec.hpp +2 -0
- package/nitrogen/generated/android/c++/JHybridAixDropzoneSpec.cpp +72 -0
- package/nitrogen/generated/android/c++/JHybridAixDropzoneSpec.hpp +66 -0
- package/nitrogen/generated/android/c++/JHybridAixInputWrapperSpec.cpp +144 -0
- package/nitrogen/generated/android/c++/JHybridAixInputWrapperSpec.hpp +74 -0
- package/nitrogen/generated/android/c++/views/JHybridAixComposerStateUpdater.cpp +4 -0
- package/nitrogen/generated/android/c++/views/JHybridAixDropzoneStateUpdater.cpp +56 -0
- package/nitrogen/generated/android/c++/views/JHybridAixDropzoneStateUpdater.hpp +49 -0
- package/nitrogen/generated/android/c++/views/JHybridAixInputWrapperStateUpdater.cpp +72 -0
- package/nitrogen/generated/android/c++/views/JHybridAixInputWrapperStateUpdater.hpp +49 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/AixInputWrapperOnPasteEvent.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/Func_void_std__vector_AixInputWrapperOnPasteEvent_.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/HybridAixComposerSpec.kt +6 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/HybridAixDropzoneSpec.kt +67 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/HybridAixInputWrapperSpec.kt +91 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/views/HybridAixDropzoneManager.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/views/HybridAixDropzoneStateUpdater.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/views/HybridAixInputWrapperManager.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/views/HybridAixInputWrapperStateUpdater.kt +23 -0
- package/nitrogen/generated/ios/Aix-Swift-Cxx-Bridge.cpp +42 -0
- package/nitrogen/generated/ios/Aix-Swift-Cxx-Bridge.hpp +112 -0
- package/nitrogen/generated/ios/Aix-Swift-Cxx-Umbrella.hpp +14 -0
- package/nitrogen/generated/ios/AixAutolinking.mm +16 -0
- package/nitrogen/generated/ios/AixAutolinking.swift +30 -0
- package/nitrogen/generated/ios/c++/HybridAixComposerSpecSwift.hpp +7 -0
- package/nitrogen/generated/ios/c++/HybridAixDropzoneSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridAixDropzoneSpecSwift.hpp +80 -0
- package/nitrogen/generated/ios/c++/HybridAixInputWrapperSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridAixInputWrapperSpecSwift.hpp +108 -0
- package/nitrogen/generated/ios/c++/views/HybridAixComposerComponent.mm +5 -0
- package/nitrogen/generated/ios/c++/views/HybridAixDropzoneComponent.mm +96 -0
- package/nitrogen/generated/ios/c++/views/HybridAixInputWrapperComponent.mm +116 -0
- package/nitrogen/generated/ios/swift/AixInputWrapperOnPasteEvent.swift +107 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_AixInputWrapperOnPasteEvent_.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridAixComposerSpec.swift +1 -0
- package/nitrogen/generated/ios/swift/HybridAixComposerSpec_cxx.swift +24 -0
- package/nitrogen/generated/ios/swift/HybridAixDropzoneSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridAixDropzoneSpec_cxx.swift +167 -0
- package/nitrogen/generated/ios/swift/HybridAixInputWrapperSpec.swift +60 -0
- package/nitrogen/generated/ios/swift/HybridAixInputWrapperSpec_cxx.swift +261 -0
- package/nitrogen/generated/shared/c++/AixInputWrapperOnPasteEvent.hpp +88 -0
- package/nitrogen/generated/shared/c++/HybridAixComposerSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridAixComposerSpec.hpp +2 -0
- package/nitrogen/generated/shared/c++/HybridAixDropzoneSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridAixDropzoneSpec.hpp +67 -0
- package/nitrogen/generated/shared/c++/HybridAixInputWrapperSpec.cpp +30 -0
- package/nitrogen/generated/shared/c++/HybridAixInputWrapperSpec.hpp +76 -0
- package/nitrogen/generated/shared/c++/views/HybridAixComposerComponent.cpp +12 -0
- package/nitrogen/generated/shared/c++/views/HybridAixComposerComponent.hpp +1 -0
- package/nitrogen/generated/shared/c++/views/HybridAixDropzoneComponent.cpp +87 -0
- package/nitrogen/generated/shared/c++/views/HybridAixDropzoneComponent.hpp +109 -0
- package/nitrogen/generated/shared/c++/views/HybridAixInputWrapperComponent.cpp +135 -0
- package/nitrogen/generated/shared/c++/views/HybridAixInputWrapperComponent.hpp +114 -0
- package/nitrogen/generated/shared/json/AixComposerConfig.json +1 -0
- package/nitrogen/generated/shared/json/AixDropzoneConfig.json +10 -0
- package/nitrogen/generated/shared/json/AixInputWrapperConfig.json +14 -0
- package/package.json +1 -1
- package/src/dropzone.ios.tsx +27 -0
- package/src/dropzone.tsx +10 -0
- package/src/index.ts +3 -0
- package/src/input-wrapper.ios.tsx +30 -0
- package/src/input-wrapper.tsx +17 -0
- package/src/views/aix.nitro.ts +33 -19
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridAixInputWrapperComponent.mm
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#import "HybridAixInputWrapperComponent.hpp"
|
|
9
|
+
#import <memory>
|
|
10
|
+
#import <react/renderer/componentregistry/ComponentDescriptorProvider.h>
|
|
11
|
+
#import <React/RCTViewComponentView.h>
|
|
12
|
+
#import <React/RCTComponentViewFactory.h>
|
|
13
|
+
#import <React/UIView+ComponentViewProtocol.h>
|
|
14
|
+
#import <NitroModules/NitroDefines.hpp>
|
|
15
|
+
#import <UIKit/UIKit.h>
|
|
16
|
+
|
|
17
|
+
#import "HybridAixInputWrapperSpecSwift.hpp"
|
|
18
|
+
#import "Aix-Swift-Cxx-Umbrella.hpp"
|
|
19
|
+
|
|
20
|
+
using namespace facebook;
|
|
21
|
+
using namespace margelo::nitro::aix;
|
|
22
|
+
using namespace margelo::nitro::aix::views;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Represents the React Native View holder for the Nitro "AixInputWrapper" HybridView.
|
|
26
|
+
*/
|
|
27
|
+
@interface HybridAixInputWrapperComponent: RCTViewComponentView
|
|
28
|
+
@end
|
|
29
|
+
|
|
30
|
+
@implementation HybridAixInputWrapperComponent {
|
|
31
|
+
std::shared_ptr<HybridAixInputWrapperSpecSwift> _hybridView;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
+ (void) load {
|
|
35
|
+
[super load];
|
|
36
|
+
[RCTComponentViewFactory.currentComponentViewFactory registerComponentViewClass:[HybridAixInputWrapperComponent class]];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
+ (react::ComponentDescriptorProvider) componentDescriptorProvider {
|
|
40
|
+
return react::concreteComponentDescriptorProvider<HybridAixInputWrapperComponentDescriptor>();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
- (instancetype) init {
|
|
44
|
+
if (self = [super init]) {
|
|
45
|
+
std::shared_ptr<HybridAixInputWrapperSpec> hybridView = Aix::AixAutolinking::createAixInputWrapper();
|
|
46
|
+
_hybridView = std::dynamic_pointer_cast<HybridAixInputWrapperSpecSwift>(hybridView);
|
|
47
|
+
[self updateView];
|
|
48
|
+
}
|
|
49
|
+
return self;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
- (void) updateView {
|
|
53
|
+
// 1. Get Swift part
|
|
54
|
+
Aix::HybridAixInputWrapperSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
55
|
+
|
|
56
|
+
// 2. Get UIView*
|
|
57
|
+
void* viewUnsafe = swiftPart.getView();
|
|
58
|
+
UIView* view = (__bridge_transfer UIView*) viewUnsafe;
|
|
59
|
+
|
|
60
|
+
// 3. Update RCTViewComponentView's [contentView]
|
|
61
|
+
[self setContentView:view];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
- (void) updateProps:(const std::shared_ptr<const react::Props>&)props
|
|
65
|
+
oldProps:(const std::shared_ptr<const react::Props>&)oldProps {
|
|
66
|
+
// 1. Downcast props
|
|
67
|
+
const auto& newViewPropsConst = *std::static_pointer_cast<HybridAixInputWrapperProps const>(props);
|
|
68
|
+
auto& newViewProps = const_cast<HybridAixInputWrapperProps&>(newViewPropsConst);
|
|
69
|
+
Aix::HybridAixInputWrapperSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
70
|
+
|
|
71
|
+
// 2. Update each prop individually
|
|
72
|
+
swiftPart.beforeUpdate();
|
|
73
|
+
|
|
74
|
+
// pasteConfiguration: optional
|
|
75
|
+
if (newViewProps.pasteConfiguration.isDirty) {
|
|
76
|
+
swiftPart.setPasteConfiguration(newViewProps.pasteConfiguration.value);
|
|
77
|
+
newViewProps.pasteConfiguration.isDirty = false;
|
|
78
|
+
}
|
|
79
|
+
// editMenuDefaultActions: optional
|
|
80
|
+
if (newViewProps.editMenuDefaultActions.isDirty) {
|
|
81
|
+
swiftPart.setEditMenuDefaultActions(newViewProps.editMenuDefaultActions.value);
|
|
82
|
+
newViewProps.editMenuDefaultActions.isDirty = false;
|
|
83
|
+
}
|
|
84
|
+
// maxLines: optional
|
|
85
|
+
if (newViewProps.maxLines.isDirty) {
|
|
86
|
+
swiftPart.setMaxLines(newViewProps.maxLines.value);
|
|
87
|
+
newViewProps.maxLines.isDirty = false;
|
|
88
|
+
}
|
|
89
|
+
// maxChars: optional
|
|
90
|
+
if (newViewProps.maxChars.isDirty) {
|
|
91
|
+
swiftPart.setMaxChars(newViewProps.maxChars.value);
|
|
92
|
+
newViewProps.maxChars.isDirty = false;
|
|
93
|
+
}
|
|
94
|
+
// onPaste: optional
|
|
95
|
+
if (newViewProps.onPaste.isDirty) {
|
|
96
|
+
swiftPart.setOnPaste(newViewProps.onPaste.value);
|
|
97
|
+
newViewProps.onPaste.isDirty = false;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
swiftPart.afterUpdate();
|
|
101
|
+
|
|
102
|
+
// 3. Update hybridRef if it changed
|
|
103
|
+
if (newViewProps.hybridRef.isDirty) {
|
|
104
|
+
// hybridRef changed - call it with new this
|
|
105
|
+
const auto& maybeFunc = newViewProps.hybridRef.value;
|
|
106
|
+
if (maybeFunc.has_value()) {
|
|
107
|
+
maybeFunc.value()(_hybridView);
|
|
108
|
+
}
|
|
109
|
+
newViewProps.hybridRef.isDirty = false;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// 4. Continue in base class
|
|
113
|
+
[super updateProps:props oldProps:oldProps];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@end
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AixInputWrapperOnPasteEvent.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Represents an instance of `AixInputWrapperOnPasteEvent`, backed by a C++ struct.
|
|
13
|
+
*/
|
|
14
|
+
public typealias AixInputWrapperOnPasteEvent = margelo.nitro.aix.AixInputWrapperOnPasteEvent
|
|
15
|
+
|
|
16
|
+
public extension AixInputWrapperOnPasteEvent {
|
|
17
|
+
private typealias bridge = margelo.nitro.aix.bridge.swift
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a new instance of `AixInputWrapperOnPasteEvent`.
|
|
21
|
+
*/
|
|
22
|
+
init(type: String, filePath: String, fileExtension: String?, fileName: String?) {
|
|
23
|
+
self.init(std.string(type), std.string(filePath), { () -> bridge.std__optional_std__string_ in
|
|
24
|
+
if let __unwrappedValue = fileExtension {
|
|
25
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
26
|
+
} else {
|
|
27
|
+
return .init()
|
|
28
|
+
}
|
|
29
|
+
}(), { () -> bridge.std__optional_std__string_ in
|
|
30
|
+
if let __unwrappedValue = fileName {
|
|
31
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
32
|
+
} else {
|
|
33
|
+
return .init()
|
|
34
|
+
}
|
|
35
|
+
}())
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
var type: String {
|
|
39
|
+
@inline(__always)
|
|
40
|
+
get {
|
|
41
|
+
return String(self.__type)
|
|
42
|
+
}
|
|
43
|
+
@inline(__always)
|
|
44
|
+
set {
|
|
45
|
+
self.__type = std.string(newValue)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
var filePath: String {
|
|
50
|
+
@inline(__always)
|
|
51
|
+
get {
|
|
52
|
+
return String(self.__filePath)
|
|
53
|
+
}
|
|
54
|
+
@inline(__always)
|
|
55
|
+
set {
|
|
56
|
+
self.__filePath = std.string(newValue)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var fileExtension: String? {
|
|
61
|
+
@inline(__always)
|
|
62
|
+
get {
|
|
63
|
+
return { () -> String? in
|
|
64
|
+
if bridge.has_value_std__optional_std__string_(self.__fileExtension) {
|
|
65
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__fileExtension)
|
|
66
|
+
return String(__unwrapped)
|
|
67
|
+
} else {
|
|
68
|
+
return nil
|
|
69
|
+
}
|
|
70
|
+
}()
|
|
71
|
+
}
|
|
72
|
+
@inline(__always)
|
|
73
|
+
set {
|
|
74
|
+
self.__fileExtension = { () -> bridge.std__optional_std__string_ in
|
|
75
|
+
if let __unwrappedValue = newValue {
|
|
76
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
77
|
+
} else {
|
|
78
|
+
return .init()
|
|
79
|
+
}
|
|
80
|
+
}()
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
var fileName: String? {
|
|
85
|
+
@inline(__always)
|
|
86
|
+
get {
|
|
87
|
+
return { () -> String? in
|
|
88
|
+
if bridge.has_value_std__optional_std__string_(self.__fileName) {
|
|
89
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__fileName)
|
|
90
|
+
return String(__unwrapped)
|
|
91
|
+
} else {
|
|
92
|
+
return nil
|
|
93
|
+
}
|
|
94
|
+
}()
|
|
95
|
+
}
|
|
96
|
+
@inline(__always)
|
|
97
|
+
set {
|
|
98
|
+
self.__fileName = { () -> bridge.std__optional_std__string_ in
|
|
99
|
+
if let __unwrappedValue = newValue {
|
|
100
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
101
|
+
} else {
|
|
102
|
+
return .init()
|
|
103
|
+
}
|
|
104
|
+
}()
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__vector_AixInputWrapperOnPasteEvent_.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a Swift `(_ events: [AixInputWrapperOnPasteEvent]) -> Void` as a class.
|
|
13
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
|
+
*/
|
|
15
|
+
public final class Func_void_std__vector_AixInputWrapperOnPasteEvent_ {
|
|
16
|
+
public typealias bridge = margelo.nitro.aix.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: (_ events: [AixInputWrapperOnPasteEvent]) -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping (_ events: [AixInputWrapperOnPasteEvent]) -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call(events: bridge.std__vector_AixInputWrapperOnPasteEvent_) -> Void {
|
|
26
|
+
self.closure(events.map({ __item in __item }))
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
+
* This acquires one additional strong reference on the object!
|
|
32
|
+
*/
|
|
33
|
+
@inline(__always)
|
|
34
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void_std__vector_AixInputWrapperOnPasteEvent_`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__vector_AixInputWrapperOnPasteEvent_>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__vector_AixInputWrapperOnPasteEvent_ {
|
|
45
|
+
return Unmanaged<Func_void_std__vector_AixInputWrapperOnPasteEvent_>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -130,6 +130,30 @@ open class HybridAixComposerSpec_cxx {
|
|
|
130
130
|
self.__implementation.stickToKeyboard = newValue.value
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
+
|
|
134
|
+
public final var fixInput: bridge.std__optional_bool_ {
|
|
135
|
+
@inline(__always)
|
|
136
|
+
get {
|
|
137
|
+
return { () -> bridge.std__optional_bool_ in
|
|
138
|
+
if let __unwrappedValue = self.__implementation.fixInput {
|
|
139
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
140
|
+
} else {
|
|
141
|
+
return .init()
|
|
142
|
+
}
|
|
143
|
+
}()
|
|
144
|
+
}
|
|
145
|
+
@inline(__always)
|
|
146
|
+
set {
|
|
147
|
+
self.__implementation.fixInput = { () -> Bool? in
|
|
148
|
+
if bridge.has_value_std__optional_bool_(newValue) {
|
|
149
|
+
let __unwrapped = bridge.get_std__optional_bool_(newValue)
|
|
150
|
+
return __unwrapped
|
|
151
|
+
} else {
|
|
152
|
+
return nil
|
|
153
|
+
}
|
|
154
|
+
}()
|
|
155
|
+
}
|
|
156
|
+
}
|
|
133
157
|
|
|
134
158
|
// Methods
|
|
135
159
|
public final func getView() -> UnsafeMutableRawPointer {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridAixDropzoneSpec.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/// See ``HybridAixDropzoneSpec``
|
|
12
|
+
public protocol HybridAixDropzoneSpec_protocol: HybridObject, HybridView {
|
|
13
|
+
// Properties
|
|
14
|
+
var onDrop: ((_ events: [AixInputWrapperOnPasteEvent]) -> Void)? { get set }
|
|
15
|
+
|
|
16
|
+
// Methods
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public extension HybridAixDropzoneSpec_protocol {
|
|
21
|
+
/// Default implementation of ``HybridObject.toString``
|
|
22
|
+
func toString() -> String {
|
|
23
|
+
return "[HybridObject AixDropzone]"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/// See ``HybridAixDropzoneSpec``
|
|
28
|
+
open class HybridAixDropzoneSpec_base {
|
|
29
|
+
private weak var cxxWrapper: HybridAixDropzoneSpec_cxx? = nil
|
|
30
|
+
public init() { }
|
|
31
|
+
public func getCxxWrapper() -> HybridAixDropzoneSpec_cxx {
|
|
32
|
+
#if DEBUG
|
|
33
|
+
guard self is HybridAixDropzoneSpec else {
|
|
34
|
+
fatalError("`self` is not a `HybridAixDropzoneSpec`! Did you accidentally inherit from `HybridAixDropzoneSpec_base` instead of `HybridAixDropzoneSpec`?")
|
|
35
|
+
}
|
|
36
|
+
#endif
|
|
37
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
38
|
+
return cxxWrapper
|
|
39
|
+
} else {
|
|
40
|
+
let cxxWrapper = HybridAixDropzoneSpec_cxx(self as! HybridAixDropzoneSpec)
|
|
41
|
+
self.cxxWrapper = cxxWrapper
|
|
42
|
+
return cxxWrapper
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A Swift base-protocol representing the AixDropzone HybridObject.
|
|
49
|
+
* Implement this protocol to create Swift-based instances of AixDropzone.
|
|
50
|
+
* ```swift
|
|
51
|
+
* class HybridAixDropzone : HybridAixDropzoneSpec {
|
|
52
|
+
* // ...
|
|
53
|
+
* }
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
public typealias HybridAixDropzoneSpec = HybridAixDropzoneSpec_protocol & HybridAixDropzoneSpec_base
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridAixDropzoneSpec_cxx.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A class implementation that bridges HybridAixDropzoneSpec over to C++.
|
|
13
|
+
* In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
|
|
14
|
+
*
|
|
15
|
+
* Also, some Swift types need to be bridged with special handling:
|
|
16
|
+
* - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
|
|
17
|
+
* - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
|
|
18
|
+
* - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
|
|
19
|
+
*/
|
|
20
|
+
open class HybridAixDropzoneSpec_cxx {
|
|
21
|
+
/**
|
|
22
|
+
* The Swift <> C++ bridge's namespace (`margelo::nitro::aix::bridge::swift`)
|
|
23
|
+
* from `Aix-Swift-Cxx-Bridge.hpp`.
|
|
24
|
+
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
|
25
|
+
*/
|
|
26
|
+
public typealias bridge = margelo.nitro.aix.bridge.swift
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Holds an instance of the `HybridAixDropzoneSpec` Swift protocol.
|
|
30
|
+
*/
|
|
31
|
+
private var __implementation: any HybridAixDropzoneSpec
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
|
35
|
+
*/
|
|
36
|
+
private var __cxxPart: bridge.std__weak_ptr_HybridAixDropzoneSpec_
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Create a new `HybridAixDropzoneSpec_cxx` that wraps the given `HybridAixDropzoneSpec`.
|
|
40
|
+
* All properties and methods bridge to C++ types.
|
|
41
|
+
*/
|
|
42
|
+
public init(_ implementation: any HybridAixDropzoneSpec) {
|
|
43
|
+
self.__implementation = implementation
|
|
44
|
+
self.__cxxPart = .init()
|
|
45
|
+
/* no base class */
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Get the actual `HybridAixDropzoneSpec` instance this class wraps.
|
|
50
|
+
*/
|
|
51
|
+
@inline(__always)
|
|
52
|
+
public func getHybridAixDropzoneSpec() -> any HybridAixDropzoneSpec {
|
|
53
|
+
return __implementation
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
58
|
+
* This acquires one additional strong reference on the object!
|
|
59
|
+
*/
|
|
60
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
61
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Casts an unsafe pointer to a `HybridAixDropzoneSpec_cxx`.
|
|
66
|
+
* The pointer has to be a retained opaque `Unmanaged<HybridAixDropzoneSpec_cxx>`.
|
|
67
|
+
* This removes one strong reference from the object!
|
|
68
|
+
*/
|
|
69
|
+
public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridAixDropzoneSpec_cxx {
|
|
70
|
+
return Unmanaged<HybridAixDropzoneSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Gets (or creates) the C++ part of this Hybrid Object.
|
|
75
|
+
* The C++ part is a `std::shared_ptr<HybridAixDropzoneSpec>`.
|
|
76
|
+
*/
|
|
77
|
+
public func getCxxPart() -> bridge.std__shared_ptr_HybridAixDropzoneSpec_ {
|
|
78
|
+
let cachedCxxPart = self.__cxxPart.lock()
|
|
79
|
+
if Bool(fromCxx: cachedCxxPart) {
|
|
80
|
+
return cachedCxxPart
|
|
81
|
+
} else {
|
|
82
|
+
let newCxxPart = bridge.create_std__shared_ptr_HybridAixDropzoneSpec_(self.toUnsafe())
|
|
83
|
+
__cxxPart = bridge.weakify_std__shared_ptr_HybridAixDropzoneSpec_(newCxxPart)
|
|
84
|
+
return newCxxPart
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Get the memory size of the Swift class (plus size of any other allocations)
|
|
92
|
+
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
|
93
|
+
*/
|
|
94
|
+
@inline(__always)
|
|
95
|
+
public var memorySize: Int {
|
|
96
|
+
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Call dispose() on the Swift class.
|
|
101
|
+
* This _may_ be called manually from JS.
|
|
102
|
+
*/
|
|
103
|
+
@inline(__always)
|
|
104
|
+
public func dispose() {
|
|
105
|
+
self.__implementation.dispose()
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Call toString() on the Swift class.
|
|
110
|
+
*/
|
|
111
|
+
@inline(__always)
|
|
112
|
+
public func toString() -> String {
|
|
113
|
+
return self.__implementation.toString()
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Properties
|
|
117
|
+
public final var onDrop: bridge.std__optional_std__function_void_const_std__vector_AixInputWrapperOnPasteEvent______events______ {
|
|
118
|
+
@inline(__always)
|
|
119
|
+
get {
|
|
120
|
+
return { () -> bridge.std__optional_std__function_void_const_std__vector_AixInputWrapperOnPasteEvent______events______ in
|
|
121
|
+
if let __unwrappedValue = self.__implementation.onDrop {
|
|
122
|
+
return bridge.create_std__optional_std__function_void_const_std__vector_AixInputWrapperOnPasteEvent______events______({ () -> bridge.Func_void_std__vector_AixInputWrapperOnPasteEvent_ in
|
|
123
|
+
let __closureWrapper = Func_void_std__vector_AixInputWrapperOnPasteEvent_(__unwrappedValue)
|
|
124
|
+
return bridge.create_Func_void_std__vector_AixInputWrapperOnPasteEvent_(__closureWrapper.toUnsafe())
|
|
125
|
+
}())
|
|
126
|
+
} else {
|
|
127
|
+
return .init()
|
|
128
|
+
}
|
|
129
|
+
}()
|
|
130
|
+
}
|
|
131
|
+
@inline(__always)
|
|
132
|
+
set {
|
|
133
|
+
self.__implementation.onDrop = { () -> ((_ events: [AixInputWrapperOnPasteEvent]) -> Void)? in
|
|
134
|
+
if bridge.has_value_std__optional_std__function_void_const_std__vector_AixInputWrapperOnPasteEvent______events______(newValue) {
|
|
135
|
+
let __unwrapped = bridge.get_std__optional_std__function_void_const_std__vector_AixInputWrapperOnPasteEvent______events______(newValue)
|
|
136
|
+
return { () -> ([AixInputWrapperOnPasteEvent]) -> Void in
|
|
137
|
+
let __wrappedFunction = bridge.wrap_Func_void_std__vector_AixInputWrapperOnPasteEvent_(__unwrapped)
|
|
138
|
+
return { (__events: [AixInputWrapperOnPasteEvent]) -> Void in
|
|
139
|
+
__wrappedFunction.call({ () -> bridge.std__vector_AixInputWrapperOnPasteEvent_ in
|
|
140
|
+
var __vector = bridge.create_std__vector_AixInputWrapperOnPasteEvent_(__events.count)
|
|
141
|
+
for __item in __events {
|
|
142
|
+
__vector.push_back(__item)
|
|
143
|
+
}
|
|
144
|
+
return __vector
|
|
145
|
+
}())
|
|
146
|
+
}
|
|
147
|
+
}()
|
|
148
|
+
} else {
|
|
149
|
+
return nil
|
|
150
|
+
}
|
|
151
|
+
}()
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Methods
|
|
156
|
+
public final func getView() -> UnsafeMutableRawPointer {
|
|
157
|
+
return Unmanaged.passRetained(__implementation.view).toOpaque()
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
public final func beforeUpdate() {
|
|
161
|
+
__implementation.beforeUpdate()
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
public final func afterUpdate() {
|
|
165
|
+
__implementation.afterUpdate()
|
|
166
|
+
}
|
|
167
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridAixInputWrapperSpec.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/// See ``HybridAixInputWrapperSpec``
|
|
12
|
+
public protocol HybridAixInputWrapperSpec_protocol: HybridObject, HybridView {
|
|
13
|
+
// Properties
|
|
14
|
+
var pasteConfiguration: [String]? { get set }
|
|
15
|
+
var editMenuDefaultActions: [String]? { get set }
|
|
16
|
+
var maxLines: Double? { get set }
|
|
17
|
+
var maxChars: Double? { get set }
|
|
18
|
+
var onPaste: ((_ events: [AixInputWrapperOnPasteEvent]) -> Void)? { get set }
|
|
19
|
+
|
|
20
|
+
// Methods
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public extension HybridAixInputWrapperSpec_protocol {
|
|
25
|
+
/// Default implementation of ``HybridObject.toString``
|
|
26
|
+
func toString() -> String {
|
|
27
|
+
return "[HybridObject AixInputWrapper]"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/// See ``HybridAixInputWrapperSpec``
|
|
32
|
+
open class HybridAixInputWrapperSpec_base {
|
|
33
|
+
private weak var cxxWrapper: HybridAixInputWrapperSpec_cxx? = nil
|
|
34
|
+
public init() { }
|
|
35
|
+
public func getCxxWrapper() -> HybridAixInputWrapperSpec_cxx {
|
|
36
|
+
#if DEBUG
|
|
37
|
+
guard self is HybridAixInputWrapperSpec else {
|
|
38
|
+
fatalError("`self` is not a `HybridAixInputWrapperSpec`! Did you accidentally inherit from `HybridAixInputWrapperSpec_base` instead of `HybridAixInputWrapperSpec`?")
|
|
39
|
+
}
|
|
40
|
+
#endif
|
|
41
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
42
|
+
return cxxWrapper
|
|
43
|
+
} else {
|
|
44
|
+
let cxxWrapper = HybridAixInputWrapperSpec_cxx(self as! HybridAixInputWrapperSpec)
|
|
45
|
+
self.cxxWrapper = cxxWrapper
|
|
46
|
+
return cxxWrapper
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* A Swift base-protocol representing the AixInputWrapper HybridObject.
|
|
53
|
+
* Implement this protocol to create Swift-based instances of AixInputWrapper.
|
|
54
|
+
* ```swift
|
|
55
|
+
* class HybridAixInputWrapper : HybridAixInputWrapperSpec {
|
|
56
|
+
* // ...
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
public typealias HybridAixInputWrapperSpec = HybridAixInputWrapperSpec_protocol & HybridAixInputWrapperSpec_base
|