react-native-ariel 0.1.0-dev.5 → 0.1.0-dev.50
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 +2 -2
- package/README.md +10 -65
- package/android/CMakeLists.txt +12 -12
- package/android/build.gradle +11 -9
- package/android/generated/{android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs → java/com/ariel}/NativeArielSpec.java +1 -1
- package/android/generated/{android/app/build/generated/source/codegen/jni → jni}/CMakeLists.txt +9 -1
- package/android/generated/jni/react/renderer/components/ArielSpec/ArielSpecJSI-generated.cpp +32 -0
- package/android/generated/jni/react/renderer/components/ArielSpec/ArielSpecJSI.h +80 -0
- package/android/proguard-rules.pro +4 -0
- package/android/src/main/java/com/ariel/ArielModule.kt +11 -1
- package/cpp/generated/mermaid_wrapper.cpp +2369 -0
- package/cpp/generated/mermaid_wrapper.hpp +77 -0
- package/cpp/mermaid_wrapper.cpp +1 -0
- package/ios/generated/ArielSpecJSI-generated.cpp +32 -0
- package/ios/generated/ArielSpecJSI.h +80 -0
- package/lib/module/index.web.js +4 -6
- package/lib/module/index.web.js.map +1 -2
- package/package.json +31 -25
- package/react-native.config.js +0 -1
- package/android/generated/android/app/build/generated/source/codegen/jni/react/renderer/components/ArielSpec/ArielSpecJSI.h +0 -45
- package/ios/generated/build/generated/ios/ReactCodegen/ArielSpecJSI.h +0 -45
- package/lib/typescript/src/index.web.d.ts +0 -8
- package/lib/typescript/src/index.web.d.ts.map +0 -1
- package/src/generated/web/wasm-bindgen/package.json +0 -15
- /package/android/generated/{android/app/build/generated/source/codegen/jni → jni}/ArielSpec-generated.cpp +0 -0
- /package/android/generated/{android/app/build/generated/source/codegen/jni → jni}/ArielSpec.h +0 -0
- /package/ios/generated/{build/generated/ios/ReactCodegen/ArielSpec → ArielSpec}/ArielSpec-generated.mm +0 -0
- /package/ios/generated/{build/generated/ios/ReactCodegen/ArielSpec → ArielSpec}/ArielSpec.h +0 -0
package/Ariel.podspec
CHANGED
|
@@ -13,9 +13,9 @@ Pod::Spec.new do |s|
|
|
|
13
13
|
s.authors = package["author"]
|
|
14
14
|
|
|
15
15
|
s.platforms = { :ios => min_ios_version_supported }
|
|
16
|
-
s.source = { :git => "https://github.com/
|
|
16
|
+
s.source = { :git => "https://github.com/rinfimate/ariel.git", :tag => "#{s.version}" }
|
|
17
17
|
|
|
18
|
-
s.source_files = "ios/**/*.{h,m,mm,swift}", "
|
|
18
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}", "cpp/**/*.{hpp,cpp,c,h}"
|
|
19
19
|
s.vendored_frameworks = "ArielFramework.xcframework"
|
|
20
20
|
s.dependency "uniffi-bindgen-react-native", "0.31.0-2"
|
|
21
21
|
|
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ Every other Mermaid solution for React Native requires a DOM, a WebView, or a he
|
|
|
29
29
|
yarn add react-native-ariel react-native-svg
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
> **
|
|
32
|
+
> **Requirements:** React Native **≥ 0.73** with **New Architecture enabled**. On RN 0.73–0.75 you must set `newArchEnabled=true` in `android/gradle.properties` and enable it in your iOS Podfile — New Architecture became the default in RN 0.76.
|
|
33
33
|
|
|
34
34
|
---
|
|
35
35
|
|
|
@@ -199,7 +199,7 @@ rustup target add wasm32-unknown-unknown
|
|
|
199
199
|
### Clone and install
|
|
200
200
|
|
|
201
201
|
```sh
|
|
202
|
-
git clone https://github.com/
|
|
202
|
+
git clone https://github.com/rinfimate/ariel.git
|
|
203
203
|
cd ariel
|
|
204
204
|
yarn
|
|
205
205
|
```
|
|
@@ -269,72 +269,17 @@ yarn ubrn:clean
|
|
|
269
269
|
|
|
270
270
|
---
|
|
271
271
|
|
|
272
|
-
## Running the example app
|
|
273
|
-
|
|
274
|
-
The `example/` directory is an Expo app with a live Mermaid editor — type a diagram, see the SVG update in real time with timing stats.
|
|
275
|
-
|
|
276
|
-
### Step 1 — Generate bindings (all platforms, run once)
|
|
277
|
-
|
|
278
|
-
```sh
|
|
279
|
-
yarn ubrn:generate
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
### Step 2 — Build native libs for your target platform
|
|
283
|
-
|
|
284
|
-
```sh
|
|
285
|
-
# Android
|
|
286
|
-
yarn ubrn:android
|
|
287
|
-
|
|
288
|
-
# iOS (macOS only)
|
|
289
|
-
yarn ubrn:ios
|
|
290
|
-
|
|
291
|
-
# Web — compile WASM bundle
|
|
292
|
-
yarn ubrn:web
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
### Step 3 — Run the example
|
|
296
|
-
|
|
297
|
-
**Web** (no emulator needed — opens in your browser):
|
|
298
|
-
```sh
|
|
299
|
-
yarn example:web
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
**Android** (emulator or USB device with debugging enabled):
|
|
303
|
-
```sh
|
|
304
|
-
yarn example:android
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
**iOS** (macOS only):
|
|
308
|
-
```sh
|
|
309
|
-
yarn example:ios
|
|
310
|
-
```
|
|
311
|
-
|
|
312
|
-
### With Expo Dev Client (install on device)
|
|
313
|
-
|
|
314
|
-
For a shareable installable build that includes the Ariel native module:
|
|
315
|
-
|
|
316
|
-
```sh
|
|
317
|
-
# Install EAS CLI
|
|
318
|
-
npm install -g eas-cli
|
|
319
|
-
|
|
320
|
-
# Build dev client (free for public repos)
|
|
321
|
-
eas build --profile development
|
|
322
|
-
|
|
323
|
-
# Install the .apk / .ipa on your device, then run:
|
|
324
|
-
yarn example:android # or example:ios
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
---
|
|
328
|
-
|
|
329
272
|
## CI
|
|
330
273
|
|
|
331
|
-
|
|
274
|
+
On every push to `main` and on pull requests, `ci.yml` runs:
|
|
332
275
|
|
|
333
|
-
|
|
|
276
|
+
| Job | Runner | What it does |
|
|
334
277
|
|---|---|---|
|
|
335
|
-
| `
|
|
336
|
-
| `build-
|
|
337
|
-
| `build-
|
|
278
|
+
| `test-rust` | `ubuntu-latest` | Rust unit tests |
|
|
279
|
+
| `build-android` | `ubuntu-latest` | Cross-compiles Rust for all Android ABIs |
|
|
280
|
+
| `build-ios` | `macos-latest` | Builds iOS xcframework |
|
|
281
|
+
| `build-web` | `ubuntu-latest` | Builds WASM bundle |
|
|
282
|
+
| `publish` | `ubuntu-latest` | Publishes to npm (push to main or release only) |
|
|
338
283
|
|
|
339
284
|
iOS uses GitHub's free `macos-latest` runner (unlimited minutes on public repos).
|
|
340
285
|
|
|
@@ -342,7 +287,7 @@ iOS uses GitHub's free `macos-latest` runner (unlimited minutes on public repos)
|
|
|
342
287
|
|
|
343
288
|
## License
|
|
344
289
|
|
|
345
|
-
MIT © 2026 [Rochanglien Infimate](https://github.com/
|
|
290
|
+
MIT © 2026 [Rochanglien Infimate](https://github.com/rinfimate)
|
|
346
291
|
|
|
347
292
|
---
|
|
348
293
|
|
package/android/CMakeLists.txt
CHANGED
|
@@ -5,22 +5,22 @@ project(Ariel)
|
|
|
5
5
|
set (CMAKE_VERBOSE_MAKEFILE ON)
|
|
6
6
|
set (CMAKE_CXX_STANDARD 17)
|
|
7
7
|
|
|
8
|
-
# Resolve
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
# Resolve uniffi-bindgen-react-native includes.
|
|
9
|
+
# When building the library locally: ../node_modules/ (workspace root)
|
|
10
|
+
# When installed as npm dependency: ../../ (npm hoists to consumer's node_modules)
|
|
11
|
+
set(_UNIFFI_LOCAL "${CMAKE_CURRENT_LIST_DIR}/../node_modules/uniffi-bindgen-react-native/cpp/includes")
|
|
12
|
+
set(_UNIFFI_HOISTED "${CMAKE_CURRENT_LIST_DIR}/../../uniffi-bindgen-react-native/cpp/includes")
|
|
13
|
+
if(EXISTS "${_UNIFFI_LOCAL}")
|
|
14
|
+
cmake_path(SET UNIFFI_INCLUDES "${_UNIFFI_LOCAL}" NORMALIZE)
|
|
15
|
+
else()
|
|
16
|
+
cmake_path(SET UNIFFI_INCLUDES "${_UNIFFI_HOISTED}" NORMALIZE)
|
|
17
|
+
endif()
|
|
17
18
|
|
|
18
|
-
# Specifies a path to native header files.
|
|
19
19
|
include_directories(
|
|
20
20
|
../cpp
|
|
21
21
|
../cpp/generated
|
|
22
22
|
|
|
23
|
-
${
|
|
23
|
+
${UNIFFI_INCLUDES}
|
|
24
24
|
)
|
|
25
25
|
|
|
26
26
|
add_library(react-native-ariel SHARED
|
|
@@ -42,7 +42,7 @@ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,max-page-size
|
|
|
42
42
|
|
|
43
43
|
cmake_path(
|
|
44
44
|
SET MY_RUST_LIB
|
|
45
|
-
${
|
|
45
|
+
${CMAKE_CURRENT_LIST_DIR}/src/main/jniLibs/${ANDROID_ABI}/libmermaid_wrapper.a
|
|
46
46
|
NORMALIZE
|
|
47
47
|
)
|
|
48
48
|
add_library(my_rust_lib STATIC IMPORTED)
|
package/android/build.gradle
CHANGED
|
@@ -28,9 +28,7 @@ def isNewArchitectureEnabled() {
|
|
|
28
28
|
apply plugin: "com.android.library"
|
|
29
29
|
apply plugin: "kotlin-android"
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
apply plugin: "com.facebook.react"
|
|
33
|
-
}
|
|
31
|
+
apply plugin: "com.facebook.react"
|
|
34
32
|
|
|
35
33
|
def getExtOrDefault(name) {
|
|
36
34
|
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["Ariel_" + name]
|
|
@@ -120,6 +118,12 @@ android {
|
|
|
120
118
|
}
|
|
121
119
|
}
|
|
122
120
|
|
|
121
|
+
android {
|
|
122
|
+
packagingOptions {
|
|
123
|
+
excludes += ['lib/*/libjsi.so', 'lib/*/libturbomodulejsijni.so', 'lib/*/libreact_nativemodule_core.so']
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
123
127
|
repositories {
|
|
124
128
|
mavenCentral()
|
|
125
129
|
google()
|
|
@@ -135,10 +139,8 @@ dependencies {
|
|
|
135
139
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
136
140
|
}
|
|
137
141
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
codegenJavaPackageName = "com.ariel"
|
|
143
|
-
}
|
|
142
|
+
react {
|
|
143
|
+
jsRootDir = file("../src/")
|
|
144
|
+
libraryName = "Ariel"
|
|
145
|
+
codegenJavaPackageName = "com.ariel"
|
|
144
146
|
}
|
package/android/generated/{android/app/build/generated/source/codegen/jni → jni}/CMakeLists.txt
RENAMED
|
@@ -25,4 +25,12 @@ target_link_libraries(
|
|
|
25
25
|
reactnative
|
|
26
26
|
)
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
target_compile_options(
|
|
29
|
+
react_codegen_ArielSpec
|
|
30
|
+
PRIVATE
|
|
31
|
+
-DLOG_TAG=\"ReactNative\"
|
|
32
|
+
-fexceptions
|
|
33
|
+
-frtti
|
|
34
|
+
-std=c++20
|
|
35
|
+
-Wall
|
|
36
|
+
)
|
|
@@ -0,0 +1,32 @@
|
|
|
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: GenerateModuleCpp.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include "ArielSpecJSI.h"
|
|
11
|
+
|
|
12
|
+
namespace facebook::react {
|
|
13
|
+
|
|
14
|
+
static jsi::Value __hostFunction_NativeArielCxxSpecJSI_installRustCrate(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
15
|
+
return static_cast<NativeArielCxxSpecJSI *>(&turboModule)->installRustCrate(
|
|
16
|
+
rt
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
static jsi::Value __hostFunction_NativeArielCxxSpecJSI_cleanupRustCrate(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
|
20
|
+
return static_cast<NativeArielCxxSpecJSI *>(&turboModule)->cleanupRustCrate(
|
|
21
|
+
rt
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
NativeArielCxxSpecJSI::NativeArielCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
|
26
|
+
: TurboModule("Ariel", jsInvoker) {
|
|
27
|
+
methodMap_["installRustCrate"] = MethodMetadata {0, __hostFunction_NativeArielCxxSpecJSI_installRustCrate};
|
|
28
|
+
methodMap_["cleanupRustCrate"] = MethodMetadata {0, __hostFunction_NativeArielCxxSpecJSI_cleanupRustCrate};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,80 @@
|
|
|
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
|
+
class JSI_EXPORT NativeArielCxxSpecJSI : public TurboModule {
|
|
19
|
+
protected:
|
|
20
|
+
NativeArielCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
21
|
+
|
|
22
|
+
public:
|
|
23
|
+
virtual bool installRustCrate(jsi::Runtime &rt) = 0;
|
|
24
|
+
virtual bool cleanupRustCrate(jsi::Runtime &rt) = 0;
|
|
25
|
+
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
template <typename T>
|
|
29
|
+
class JSI_EXPORT NativeArielCxxSpec : public TurboModule {
|
|
30
|
+
public:
|
|
31
|
+
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
32
|
+
return delegate_.create(rt, propName);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
|
|
36
|
+
return delegate_.getPropertyNames(runtime);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static constexpr std::string_view kModuleName = "Ariel";
|
|
40
|
+
|
|
41
|
+
protected:
|
|
42
|
+
NativeArielCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
|
43
|
+
: TurboModule(std::string{NativeArielCxxSpec::kModuleName}, jsInvoker),
|
|
44
|
+
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
private:
|
|
48
|
+
class Delegate : public NativeArielCxxSpecJSI {
|
|
49
|
+
public:
|
|
50
|
+
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
51
|
+
NativeArielCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
bool installRustCrate(jsi::Runtime &rt) override {
|
|
56
|
+
static_assert(
|
|
57
|
+
bridging::getParameterCount(&T::installRustCrate) == 1,
|
|
58
|
+
"Expected installRustCrate(...) to have 1 parameters");
|
|
59
|
+
|
|
60
|
+
return bridging::callFromJs<bool>(
|
|
61
|
+
rt, &T::installRustCrate, jsInvoker_, instance_);
|
|
62
|
+
}
|
|
63
|
+
bool cleanupRustCrate(jsi::Runtime &rt) override {
|
|
64
|
+
static_assert(
|
|
65
|
+
bridging::getParameterCount(&T::cleanupRustCrate) == 1,
|
|
66
|
+
"Expected cleanupRustCrate(...) to have 1 parameters");
|
|
67
|
+
|
|
68
|
+
return bridging::callFromJs<bool>(
|
|
69
|
+
rt, &T::cleanupRustCrate, jsInvoker_, instance_);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private:
|
|
73
|
+
friend class NativeArielCxxSpec;
|
|
74
|
+
T *instance_;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
Delegate delegate_;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace facebook::react
|
|
@@ -23,10 +23,20 @@ class ArielModule(reactContext: ReactApplicationContext) :
|
|
|
23
23
|
val context = this.reactApplicationContext
|
|
24
24
|
return nativeInstallRustCrate(
|
|
25
25
|
context.javaScriptContextHolder!!.get(),
|
|
26
|
-
context
|
|
26
|
+
resolveCallInvokerHolder(context)
|
|
27
27
|
)
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
private fun resolveCallInvokerHolder(context: ReactApplicationContext): CallInvokerHolder {
|
|
31
|
+
// RN 0.74+ exposes getJSCallInvokerHolder() on ReactContext directly.
|
|
32
|
+
// RN 0.73 only has it on CatalystInstance — use reflection to handle both.
|
|
33
|
+
val direct = context.javaClass.methods.firstOrNull { it.name == "getJSCallInvokerHolder" }
|
|
34
|
+
if (direct != null) return direct.invoke(context) as CallInvokerHolder
|
|
35
|
+
@Suppress("DEPRECATION")
|
|
36
|
+
val ci = checkNotNull(context.catalystInstance) { "No CatalystInstance" }
|
|
37
|
+
return ci.javaClass.methods.first { it.name == "getJSCallInvokerHolder" }.invoke(ci) as CallInvokerHolder
|
|
38
|
+
}
|
|
39
|
+
|
|
30
40
|
override fun cleanupRustCrate(): Boolean {
|
|
31
41
|
return nativeCleanupRustCrate(
|
|
32
42
|
this.reactApplicationContext.javaScriptContextHolder!!.get()
|