react-native-ariel 0.1.0-dev.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/Ariel.podspec +44 -0
- package/LICENSE +20 -0
- package/README.md +349 -0
- package/android/CMakeLists.txt +79 -0
- package/android/build.gradle +144 -0
- package/android/cpp-adapter.cpp +43 -0
- package/android/generated/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeArielSpec.java +41 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/ArielSpec-generated.cpp +38 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/ArielSpec.h +31 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/CMakeLists.txt +28 -0
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/ArielSpec/ArielSpecJSI.h +45 -0
- package/android/src/main/AndroidManifest.xml +5 -0
- package/android/src/main/java/com/ariel/ArielModule.kt +43 -0
- package/android/src/main/java/com/ariel/ArielPackage.kt +34 -0
- package/android/src/main/jniLibs/arm64-v8a/libmermaid_wrapper.a +0 -0
- package/android/src/main/jniLibs/armeabi-v7a/libmermaid_wrapper.a +0 -0
- package/android/src/main/jniLibs/x86/libmermaid_wrapper.a +0 -0
- package/android/src/main/jniLibs/x86_64/libmermaid_wrapper.a +0 -0
- package/cpp/mermaid_wrapper.cpp +2368 -0
- package/cpp/mermaid_wrapper.hpp +77 -0
- package/cpp/react-native-ariel.cpp +16 -0
- package/cpp/react-native-ariel.h +15 -0
- package/ios/Ariel.h +16 -0
- package/ios/Ariel.mm +66 -0
- package/ios/generated/build/generated/ios/ReactCodegen/ArielSpec/ArielSpec-generated.mm +46 -0
- package/ios/generated/build/generated/ios/ReactCodegen/ArielSpec/ArielSpec.h +63 -0
- package/ios/generated/build/generated/ios/ReactCodegen/ArielSpecJSI.h +45 -0
- package/lib/module/NativeAriel.js +7 -0
- package/lib/module/NativeAriel.js.map +1 -0
- package/lib/module/generated/rn/mermaid_wrapper-ffi.js +47 -0
- package/lib/module/generated/rn/mermaid_wrapper-ffi.js.map +1 -0
- package/lib/module/generated/rn/mermaid_wrapper.js +487 -0
- package/lib/module/generated/rn/mermaid_wrapper.js.map +1 -0
- package/lib/module/generated/web/mermaid_wrapper.js +532 -0
- package/lib/module/generated/web/mermaid_wrapper.js.map +1 -0
- package/lib/module/index.js +43 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/index.web.js +28 -0
- package/lib/module/index.web.js.map +2 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeAriel.d.ts +8 -0
- package/lib/typescript/src/NativeAriel.d.ts.map +1 -0
- package/lib/typescript/src/generated/rn/mermaid_wrapper-ffi.d.ts +102 -0
- package/lib/typescript/src/generated/rn/mermaid_wrapper-ffi.d.ts.map +1 -0
- package/lib/typescript/src/generated/rn/mermaid_wrapper.d.ts +291 -0
- package/lib/typescript/src/generated/rn/mermaid_wrapper.d.ts.map +1 -0
- package/lib/typescript/src/generated/web/mermaid_wrapper.d.ts +291 -0
- package/lib/typescript/src/generated/web/mermaid_wrapper.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +8 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/index.web.d.ts +8 -0
- package/lib/typescript/src/index.web.d.ts.map +1 -0
- package/package.json +146 -0
- package/react-native.config.js +15 -0
- package/src/NativeAriel.ts +10 -0
- package/src/generated/rn/mermaid_wrapper-ffi.ts +161 -0
- package/src/generated/rn/mermaid_wrapper.ts +765 -0
- package/src/generated/web/mermaid_wrapper.ts +771 -0
- package/src/index.tsx +41 -0
- package/src/index.web.ts +26 -0
- package/src/index.web.tsx +17 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJavaSpec.js
|
|
9
|
+
*
|
|
10
|
+
* @nolint
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
package com.facebook.fbreact.specs;
|
|
14
|
+
|
|
15
|
+
import com.facebook.proguard.annotations.DoNotStrip;
|
|
16
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
17
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
18
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
19
|
+
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
|
20
|
+
import javax.annotation.Nonnull;
|
|
21
|
+
|
|
22
|
+
public abstract class NativeArielSpec extends ReactContextBaseJavaModule implements TurboModule {
|
|
23
|
+
public static final String NAME = "Ariel";
|
|
24
|
+
|
|
25
|
+
public NativeArielSpec(ReactApplicationContext reactContext) {
|
|
26
|
+
super(reactContext);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@Override
|
|
30
|
+
public @Nonnull String getName() {
|
|
31
|
+
return NAME;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
35
|
+
@DoNotStrip
|
|
36
|
+
public abstract boolean installRustCrate();
|
|
37
|
+
|
|
38
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
public abstract boolean cleanupRustCrate();
|
|
41
|
+
}
|
package/android/generated/android/app/build/generated/source/codegen/jni/ArielSpec-generated.cpp
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJniCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "ArielSpec.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
static facebook::jsi::Value __hostFunction_NativeArielSpecJSI_installRustCrate(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
16
|
+
static jmethodID cachedMethodId = nullptr;
|
|
17
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, BooleanKind, "installRustCrate", "()Z", args, count, cachedMethodId);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static facebook::jsi::Value __hostFunction_NativeArielSpecJSI_cleanupRustCrate(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
21
|
+
static jmethodID cachedMethodId = nullptr;
|
|
22
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, BooleanKind, "cleanupRustCrate", "()Z", args, count, cachedMethodId);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
NativeArielSpecJSI::NativeArielSpecJSI(const JavaTurboModule::InitParams ¶ms)
|
|
26
|
+
: JavaTurboModule(params) {
|
|
27
|
+
methodMap_["installRustCrate"] = MethodMetadata {0, __hostFunction_NativeArielSpecJSI_installRustCrate};
|
|
28
|
+
methodMap_["cleanupRustCrate"] = MethodMetadata {0, __hostFunction_NativeArielSpecJSI_cleanupRustCrate};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
std::shared_ptr<TurboModule> ArielSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) {
|
|
32
|
+
if (moduleName == "Ariel") {
|
|
33
|
+
return std::make_shared<NativeArielSpecJSI>(params);
|
|
34
|
+
}
|
|
35
|
+
return nullptr;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJniH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <ReactCommon/JavaTurboModule.h>
|
|
14
|
+
#include <ReactCommon/TurboModule.h>
|
|
15
|
+
#include <jsi/jsi.h>
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* JNI C++ class for module 'NativeAriel'
|
|
21
|
+
*/
|
|
22
|
+
class JSI_EXPORT NativeArielSpecJSI : public JavaTurboModule {
|
|
23
|
+
public:
|
|
24
|
+
NativeArielSpecJSI(const JavaTurboModule::InitParams ¶ms);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
JSI_EXPORT
|
|
29
|
+
std::shared_ptr<TurboModule> ArielSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms);
|
|
30
|
+
|
|
31
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
#
|
|
3
|
+
# This source code is licensed under the MIT license found in the
|
|
4
|
+
# LICENSE file in the root directory of this source tree.
|
|
5
|
+
|
|
6
|
+
cmake_minimum_required(VERSION 3.13)
|
|
7
|
+
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
8
|
+
|
|
9
|
+
file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/ArielSpec/*.cpp)
|
|
10
|
+
|
|
11
|
+
add_library(
|
|
12
|
+
react_codegen_ArielSpec
|
|
13
|
+
OBJECT
|
|
14
|
+
${react_codegen_SRCS}
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
target_include_directories(react_codegen_ArielSpec PUBLIC . react/renderer/components/ArielSpec)
|
|
18
|
+
|
|
19
|
+
target_link_libraries(
|
|
20
|
+
react_codegen_ArielSpec
|
|
21
|
+
fbjni
|
|
22
|
+
jsi
|
|
23
|
+
# We need to link different libraries based on whether we are building rncore or not, that's necessary
|
|
24
|
+
# because we want to break a circular dependency between react_codegen_rncore and reactnative
|
|
25
|
+
reactnative
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
target_compile_reactnative_options(react_codegen_ArielSpec PRIVATE)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateModuleH.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <ReactCommon/TurboModule.h>
|
|
13
|
+
#include <react/bridging/Bridging.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook::react {
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
template <typename T>
|
|
19
|
+
class JSI_EXPORT NativeArielCxxSpec : public TurboModule {
|
|
20
|
+
public:
|
|
21
|
+
static constexpr std::string_view kModuleName = "Ariel";
|
|
22
|
+
|
|
23
|
+
protected:
|
|
24
|
+
NativeArielCxxSpec(std::shared_ptr<CallInvoker> jsInvoker) : TurboModule(std::string{NativeArielCxxSpec::kModuleName}, jsInvoker) {
|
|
25
|
+
methodMap_["installRustCrate"] = MethodMetadata {.argCount = 0, .invoker = __installRustCrate};
|
|
26
|
+
methodMap_["cleanupRustCrate"] = MethodMetadata {.argCount = 0, .invoker = __cleanupRustCrate};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
private:
|
|
30
|
+
static jsi::Value __installRustCrate(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
|
|
31
|
+
static_assert(
|
|
32
|
+
bridging::getParameterCount(&T::installRustCrate) == 1,
|
|
33
|
+
"Expected installRustCrate(...) to have 1 parameters");
|
|
34
|
+
return bridging::callFromJs<bool>(rt, &T::installRustCrate, static_cast<NativeArielCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static jsi::Value __cleanupRustCrate(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* /*args*/, size_t /*count*/) {
|
|
38
|
+
static_assert(
|
|
39
|
+
bridging::getParameterCount(&T::cleanupRustCrate) == 1,
|
|
40
|
+
"Expected cleanupRustCrate(...) to have 1 parameters");
|
|
41
|
+
return bridging::callFromJs<bool>(rt, &T::cleanupRustCrate, static_cast<NativeArielCxxSpec*>(&turboModule)->jsInvoker_, static_cast<T*>(&turboModule));
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// Generated by uniffi-bindgen-react-native
|
|
2
|
+
package com.ariel
|
|
3
|
+
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
6
|
+
import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder
|
|
7
|
+
|
|
8
|
+
@ReactModule(name = ArielModule.NAME)
|
|
9
|
+
class ArielModule(reactContext: ReactApplicationContext) :
|
|
10
|
+
NativeArielSpec(reactContext) {
|
|
11
|
+
|
|
12
|
+
override fun getName(): String {
|
|
13
|
+
return NAME
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Two native methods implemented in cpp-adapter.cpp, and ultimately
|
|
17
|
+
// react-native-ariel.cpp
|
|
18
|
+
|
|
19
|
+
external fun nativeInstallRustCrate(runtimePointer: Long, callInvoker: CallInvokerHolder): Boolean
|
|
20
|
+
external fun nativeCleanupRustCrate(runtimePointer: Long): Boolean
|
|
21
|
+
|
|
22
|
+
override fun installRustCrate(): Boolean {
|
|
23
|
+
val context = this.reactApplicationContext
|
|
24
|
+
return nativeInstallRustCrate(
|
|
25
|
+
context.javaScriptContextHolder!!.get(),
|
|
26
|
+
context.jsCallInvokerHolder!!
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
override fun cleanupRustCrate(): Boolean {
|
|
31
|
+
return nativeCleanupRustCrate(
|
|
32
|
+
this.reactApplicationContext.javaScriptContextHolder!!.get()
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
companion object {
|
|
37
|
+
const val NAME = "Ariel"
|
|
38
|
+
|
|
39
|
+
init {
|
|
40
|
+
System.loadLibrary("react-native-ariel")
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Generated by uniffi-bindgen-react-native
|
|
2
|
+
package com.ariel
|
|
3
|
+
|
|
4
|
+
import com.facebook.react.TurboReactPackage
|
|
5
|
+
import com.facebook.react.bridge.NativeModule
|
|
6
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
7
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
8
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
9
|
+
import java.util.HashMap
|
|
10
|
+
|
|
11
|
+
class ArielPackage : TurboReactPackage() {
|
|
12
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
13
|
+
return if (name == ArielModule.NAME) {
|
|
14
|
+
ArielModule(reactContext)
|
|
15
|
+
} else {
|
|
16
|
+
null
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
21
|
+
return ReactModuleInfoProvider {
|
|
22
|
+
val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap()
|
|
23
|
+
moduleInfos[ArielModule.NAME] = ReactModuleInfo(
|
|
24
|
+
ArielModule.NAME,
|
|
25
|
+
ArielModule.NAME,
|
|
26
|
+
false, // canOverrideExistingModule
|
|
27
|
+
false, // needsEagerInit
|
|
28
|
+
false, // isCxxModule
|
|
29
|
+
true // isTurboModule
|
|
30
|
+
)
|
|
31
|
+
moduleInfos
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|