react-native-ariel 0.1.0-dev.50 → 0.1.0-dev.52

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 CHANGED
@@ -38,33 +38,57 @@ yarn add react-native-ariel react-native-svg
38
38
  ### Simple render
39
39
 
40
40
  ```typescript
41
- import { renderMermaid } from 'react-native-ariel';
41
+ import { useState, useEffect } from 'react';
42
+ import { View } from 'react-native';
42
43
  import { SvgXml } from 'react-native-svg';
43
-
44
- const svg = renderMermaid('flowchart TD\n A[Hello] --> B[World]');
45
-
46
- <SvgXml xml={svg} width="100%" />
44
+ import { renderMermaid, uniffiInitAsync } from 'react-native-ariel';
45
+
46
+ export default function DiagramView() {
47
+ const [svg, setSvg] = useState<string | null>(null);
48
+
49
+ useEffect(() => {
50
+ async function run() {
51
+ // uniffiInitAsync is a no-op on native and loads the WASM module on web.
52
+ // Always await it before rendering so the same code works on both platforms.
53
+ await uniffiInitAsync();
54
+ try {
55
+ setSvg(renderMermaid('flowchart TD\n A[Hello] --> B[World]'));
56
+ } catch (e) {
57
+ console.error('Render failed:', e);
58
+ }
59
+ }
60
+ run();
61
+ }, []);
62
+
63
+ return <View>{svg && <SvgXml xml={svg} width="100%" />}</View>;
64
+ }
47
65
  ```
48
66
 
67
+ `renderMermaid` is **synchronous** on native — no async overhead after init.
68
+
49
69
  ### With theme and layout control
50
70
 
51
71
  ```typescript
52
- import { renderMermaidWithOptions, ArielTheme } from 'react-native-ariel';
72
+ import { renderMermaidWithOptions, uniffiInitAsync, ArielTheme } from 'react-native-ariel';
53
73
 
54
- const theme = ArielTheme.modern(); // or ArielTheme.mermaidDefault()
55
- const config = { nodeSpacing: 50, rankSpacing: 80, aspectRatioHint: null };
74
+ const config = { nodeSpacing: 50, rankSpacing: 80 };
56
75
 
57
- const svg = renderMermaidWithOptions(diagram, theme, config);
76
+ await uniffiInitAsync();
77
+ const svg = renderMermaidWithOptions(diagram, ArielTheme.modern(), config);
78
+ // or: ArielTheme.mermaidDefault()
58
79
  ```
59
80
 
60
81
  ### With timing metrics
61
82
 
62
83
  ```typescript
63
- import { renderMermaidWithTiming, ArielTheme } from 'react-native-ariel';
84
+ import { renderMermaidWithTiming, uniffiInitAsync, ArielTheme } from 'react-native-ariel';
64
85
 
86
+ const config = { nodeSpacing: 50, rankSpacing: 80 };
87
+
88
+ await uniffiInitAsync();
65
89
  const result = renderMermaidWithTiming(diagram, ArielTheme.modern(), config);
66
90
  console.log(`Total: ${result.totalMs.toFixed(2)}ms`);
67
- // Parse: 420µs Layout: 610µs Render: 200µs
91
+ // parseUs / layoutUs / renderUs are bigint (µs); totalMs is number (ms)
68
92
  ```
69
93
 
70
94
  ### Full pipeline (parse once, render with multiple themes)
@@ -74,9 +98,13 @@ import {
74
98
  parseDiagram,
75
99
  computeDiagramLayout,
76
100
  renderSvgFromLayout,
101
+ uniffiInitAsync,
77
102
  ArielTheme,
78
103
  } from 'react-native-ariel';
79
104
 
105
+ const config = { nodeSpacing: 50, rankSpacing: 80 };
106
+
107
+ await uniffiInitAsync();
80
108
  const parsed = parseDiagram('flowchart LR\n A --> B --> C');
81
109
  const layout = computeDiagramLayout(parsed, ArielTheme.modern(), config);
82
110
  const svg = renderSvgFromLayout(layout, ArielTheme.modern(), config);
@@ -95,18 +123,6 @@ Logs are written to **Android Logcat**, the **Xcode console** on iOS, and the **
95
123
 
96
124
  > **Note:** When timing is on, every render call allocates a format string regardless of whether you can see the output. This is cheap but not free. The flag is intended for debugging — avoid shipping with `setTimingLogs(true)` hardcoded.
97
125
 
98
- ### Web (WASM) initialisation
99
-
100
- On web, call `uniffiInitAsync` before any render calls:
101
-
102
- ```typescript
103
- import { uniffiInitAsync } from 'react-native-ariel';
104
-
105
- uniffiInitAsync().then(() => {
106
- // safe to call renderMermaid here
107
- });
108
- ```
109
-
110
126
  ---
111
127
 
112
128
  ## API
@@ -120,6 +136,7 @@ uniffiInitAsync().then(() => {
120
136
  | `computeDiagramLayout(parsed, theme, config)` | Layout stage — returns opaque `ArielLayout` |
121
137
  | `renderSvgFromLayout(layout, theme, config)` | SVG stage from pre-computed layout |
122
138
  | `setTimingLogs(enabled)` | Toggle timing output to console (default: off) |
139
+ | `uniffiInitAsync()` | Load WASM module on web; no-op on native. Call once before rendering |
123
140
  | `ArielTheme.modern()` | Modern theme — see below |
124
141
  | `ArielTheme.mermaidDefault()` | Classic Mermaid theme — see below |
125
142
 
@@ -147,9 +164,8 @@ const svg = renderMermaidWithOptions(diagram, ArielTheme.mermaidDefault(), confi
147
164
 
148
165
  ```typescript
149
166
  {
150
- nodeSpacing?: number | null;
151
- rankSpacing?: number | null;
152
- aspectRatioHint?: number | null;
167
+ nodeSpacing?: number;
168
+ rankSpacing?: number;
153
169
  }
154
170
  ```
155
171
 
@@ -158,10 +174,10 @@ const svg = renderMermaidWithOptions(diagram, ArielTheme.mermaidDefault(), confi
158
174
  ```typescript
159
175
  {
160
176
  svg: string;
161
- parseUs: number;
162
- layoutUs: number;
163
- renderUs: number;
164
- totalMs: number;
177
+ parseUs: bigint; // microseconds (u64)
178
+ layoutUs: bigint; // microseconds (u64)
179
+ renderUs: bigint; // microseconds (u64)
180
+ totalMs: number; // milliseconds (f64)
165
181
  }
166
182
  ```
167
183
 
@@ -174,7 +190,7 @@ const svg = renderMermaidWithOptions(diagram, ArielTheme.mermaidDefault(), confi
174
190
  | Tool | Purpose | Install |
175
191
  |---|---|---|
176
192
  | [Rust](https://rustup.rs) | Compile the Rust crate | `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \| sh` |
177
- | [Node.js](https://nodejs.org) ≥ 20 | JS toolchain | nodejs.org |
193
+ | [Node.js](https://nodejs.org) ≥ 22 | JS toolchain | nodejs.org |
178
194
  | Yarn | Package manager | `npm i -g yarn` |
179
195
  | [Android Studio](https://developer.android.com/studio) | Android SDK + NDK | See below |
180
196
  | Xcode ≥ 15 | iOS builds (macOS only) | Mac App Store |
@@ -222,29 +238,44 @@ This works on **Windows**, **macOS**, and **Linux** and writes to `src/generated
222
238
 
223
239
  ### Android
224
240
 
225
- Compiles the Rust crate for all Android ABIs and places `.a` / `.so` files under `android/src/main/jniLibs/`. Run `yarn ubrn:generate` first if you haven't already.
241
+ Compiles the Rust crate for all Android ABIs and places `.a` files under `android/src/main/jniLibs/`. Run `yarn ubrn:generate` first if you haven't already.
226
242
 
227
243
  ```sh
228
244
  yarn ubrn:generate # generates src/generated/rn/ and cpp/
229
245
  yarn ubrn:android # compiles for arm64-v8a, armeabi-v7a, x86_64, x86
246
+ yarn bob build # compiles TypeScript → lib/
230
247
  ```
231
248
 
232
249
  ### iOS (macOS only)
233
250
 
234
- Compiles for device + simulator and runs `pod install`. Run `yarn ubrn:generate` first.
251
+ Compiles for device + simulator. Run `yarn ubrn:generate` first.
235
252
 
236
253
  ```sh
237
254
  yarn ubrn:generate # generates src/generated/rn/ and cpp/
238
255
  yarn ubrn:ios # compiles for aarch64-apple-ios, x86_64-apple-ios, aarch64-apple-ios-sim
256
+ yarn bob build # compiles TypeScript → lib/
239
257
  ```
240
258
 
241
259
  ### Web (WASM)
242
260
 
243
- Compiles to `wasm32-unknown-unknown` and produces a `.wasm` bundle under `src/generated/web/`. Run `yarn ubrn:generate` first.
261
+ Compiles to `wasm32-unknown-unknown` and produces a `.wasm` bundle. Run `yarn ubrn:generate` first.
244
262
 
245
263
  ```sh
246
264
  yarn ubrn:generate # generates src/generated/web/ (WASM TypeScript bindings)
247
265
  yarn ubrn:web # compiles the WASM crate with wasm-pack
266
+ yarn bob build # compiles TypeScript → lib/ and copies WASM into lib/module/
267
+ ```
268
+
269
+ ### Building the npm package
270
+
271
+ To produce a publishable tarball locally (mirrors what CI does, skipping iOS):
272
+
273
+ ```sh
274
+ yarn ubrn:generate
275
+ yarn ubrn:android
276
+ yarn ubrn:web
277
+ yarn bob build
278
+ npm pack --ignore-scripts
248
279
  ```
249
280
 
250
281
  ### Rust unit tests
@@ -0,0 +1,202 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ export class RustCallStatus {
5
+ free(): void;
6
+ [Symbol.dispose](): void;
7
+ constructor();
8
+ code: number;
9
+ get errorBuf(): Uint8Array | undefined;
10
+ set errorBuf(value: Uint8Array | null | undefined);
11
+ }
12
+
13
+ export function ubrn_ffi_mermaid_wrapper_uniffi_contract_version(): number;
14
+
15
+ export function ubrn_uniffi_mermaid_wrapper_checksum_constructor_arieltheme_mermaid_default(): number;
16
+
17
+ export function ubrn_uniffi_mermaid_wrapper_checksum_constructor_arieltheme_modern(): number;
18
+
19
+ export function ubrn_uniffi_mermaid_wrapper_checksum_func_compute_diagram_layout(): number;
20
+
21
+ export function ubrn_uniffi_mermaid_wrapper_checksum_func_parse_diagram(): number;
22
+
23
+ export function ubrn_uniffi_mermaid_wrapper_checksum_func_render_mermaid(): number;
24
+
25
+ export function ubrn_uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_options(): number;
26
+
27
+ export function ubrn_uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_timing(): number;
28
+
29
+ export function ubrn_uniffi_mermaid_wrapper_checksum_func_render_svg_from_layout(): number;
30
+
31
+ export function ubrn_uniffi_mermaid_wrapper_checksum_func_set_timing_logs(): number;
32
+
33
+ export function ubrn_uniffi_mermaid_wrapper_fn_clone_ariellayout(handle: bigint, f_status_: RustCallStatus): bigint;
34
+
35
+ export function ubrn_uniffi_mermaid_wrapper_fn_clone_arielparseddiagram(handle: bigint, f_status_: RustCallStatus): bigint;
36
+
37
+ export function ubrn_uniffi_mermaid_wrapper_fn_clone_arieltheme(handle: bigint, f_status_: RustCallStatus): bigint;
38
+
39
+ export function ubrn_uniffi_mermaid_wrapper_fn_constructor_arieltheme_mermaid_default(f_status_: RustCallStatus): bigint;
40
+
41
+ export function ubrn_uniffi_mermaid_wrapper_fn_constructor_arieltheme_modern(f_status_: RustCallStatus): bigint;
42
+
43
+ export function ubrn_uniffi_mermaid_wrapper_fn_free_ariellayout(handle: bigint, f_status_: RustCallStatus): void;
44
+
45
+ export function ubrn_uniffi_mermaid_wrapper_fn_free_arielparseddiagram(handle: bigint, f_status_: RustCallStatus): void;
46
+
47
+ export function ubrn_uniffi_mermaid_wrapper_fn_free_arieltheme(handle: bigint, f_status_: RustCallStatus): void;
48
+
49
+ export function ubrn_uniffi_mermaid_wrapper_fn_func_compute_diagram_layout(parsed: bigint, theme: bigint, config: Uint8Array, f_status_: RustCallStatus): bigint;
50
+
51
+ export function ubrn_uniffi_mermaid_wrapper_fn_func_parse_diagram(input: Uint8Array, f_status_: RustCallStatus): bigint;
52
+
53
+ export function ubrn_uniffi_mermaid_wrapper_fn_func_render_mermaid(input: Uint8Array, f_status_: RustCallStatus): Uint8Array;
54
+
55
+ export function ubrn_uniffi_mermaid_wrapper_fn_func_render_mermaid_with_options(input: Uint8Array, _theme: bigint, _config: Uint8Array, f_status_: RustCallStatus): Uint8Array;
56
+
57
+ export function ubrn_uniffi_mermaid_wrapper_fn_func_render_mermaid_with_timing(input: Uint8Array, _theme: bigint, _config: Uint8Array, f_status_: RustCallStatus): Uint8Array;
58
+
59
+ export function ubrn_uniffi_mermaid_wrapper_fn_func_render_svg_from_layout(layout: bigint, theme: bigint, config: Uint8Array, f_status_: RustCallStatus): Uint8Array;
60
+
61
+ export function ubrn_uniffi_mermaid_wrapper_fn_func_set_timing_logs(enabled: number, f_status_: RustCallStatus): void;
62
+
63
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
64
+
65
+ export interface InitOutput {
66
+ readonly memory: WebAssembly.Memory;
67
+ readonly uniffi_mermaid_wrapper_fn_func_compute_diagram_layout: (a: bigint, b: bigint, c: number, d: number) => bigint;
68
+ readonly uniffi_mermaid_wrapper_fn_constructor_arieltheme_mermaid_default: (a: number) => bigint;
69
+ readonly uniffi_mermaid_wrapper_fn_constructor_arieltheme_modern: (a: number) => bigint;
70
+ readonly uniffi_mermaid_wrapper_fn_func_render_mermaid_with_timing: (a: number, b: number, c: bigint, d: number, e: number) => void;
71
+ readonly uniffi_mermaid_wrapper_fn_free_arieltheme: (a: bigint, b: number) => void;
72
+ readonly uniffi_mermaid_wrapper_fn_clone_ariellayout: (a: bigint, b: number) => bigint;
73
+ readonly uniffi_mermaid_wrapper_fn_clone_arieltheme: (a: bigint, b: number) => bigint;
74
+ readonly uniffi_mermaid_wrapper_fn_free_arielparseddiagram: (a: bigint, b: number) => void;
75
+ readonly uniffi_mermaid_wrapper_fn_func_render_mermaid_with_options: (a: number, b: number, c: bigint, d: number, e: number) => void;
76
+ readonly uniffi_mermaid_wrapper_fn_func_parse_diagram: (a: number, b: number) => bigint;
77
+ readonly uniffi_mermaid_wrapper_fn_func_set_timing_logs: (a: number, b: number) => void;
78
+ readonly uniffi_mermaid_wrapper_fn_clone_arielparseddiagram: (a: bigint, b: number) => bigint;
79
+ readonly uniffi_mermaid_wrapper_fn_func_render_mermaid: (a: number, b: number, c: number) => void;
80
+ readonly uniffi_mermaid_wrapper_fn_free_ariellayout: (a: bigint, b: number) => void;
81
+ readonly uniffi_mermaid_wrapper_fn_func_render_svg_from_layout: (a: number, b: bigint, c: bigint, d: number, e: number) => void;
82
+ readonly ubrn_ffi_mermaid_wrapper_uniffi_contract_version: () => number;
83
+ readonly ffi_mermaid_wrapper_uniffi_contract_version: () => number;
84
+ readonly ubrn_uniffi_mermaid_wrapper_checksum_constructor_arieltheme_mermaid_default: () => number;
85
+ readonly uniffi_mermaid_wrapper_checksum_constructor_arieltheme_mermaid_default: () => number;
86
+ readonly ubrn_uniffi_mermaid_wrapper_checksum_constructor_arieltheme_modern: () => number;
87
+ readonly uniffi_mermaid_wrapper_checksum_constructor_arieltheme_modern: () => number;
88
+ readonly ubrn_uniffi_mermaid_wrapper_checksum_func_compute_diagram_layout: () => number;
89
+ readonly uniffi_mermaid_wrapper_checksum_func_compute_diagram_layout: () => number;
90
+ readonly ubrn_uniffi_mermaid_wrapper_checksum_func_parse_diagram: () => number;
91
+ readonly uniffi_mermaid_wrapper_checksum_func_parse_diagram: () => number;
92
+ readonly ubrn_uniffi_mermaid_wrapper_checksum_func_render_mermaid: () => number;
93
+ readonly uniffi_mermaid_wrapper_checksum_func_render_mermaid: () => number;
94
+ readonly ubrn_uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_options: () => number;
95
+ readonly uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_options: () => number;
96
+ readonly ubrn_uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_timing: () => number;
97
+ readonly uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_timing: () => number;
98
+ readonly ubrn_uniffi_mermaid_wrapper_checksum_func_render_svg_from_layout: () => number;
99
+ readonly uniffi_mermaid_wrapper_checksum_func_render_svg_from_layout: () => number;
100
+ readonly ubrn_uniffi_mermaid_wrapper_checksum_func_set_timing_logs: () => number;
101
+ readonly uniffi_mermaid_wrapper_checksum_func_set_timing_logs: () => number;
102
+ readonly ubrn_uniffi_mermaid_wrapper_fn_clone_ariellayout: (a: bigint, b: number) => bigint;
103
+ readonly ubrn_uniffi_mermaid_wrapper_fn_clone_arielparseddiagram: (a: bigint, b: number) => bigint;
104
+ readonly ubrn_uniffi_mermaid_wrapper_fn_clone_arieltheme: (a: bigint, b: number) => bigint;
105
+ readonly ubrn_uniffi_mermaid_wrapper_fn_constructor_arieltheme_mermaid_default: (a: number) => bigint;
106
+ readonly ubrn_uniffi_mermaid_wrapper_fn_constructor_arieltheme_modern: (a: number) => bigint;
107
+ readonly ubrn_uniffi_mermaid_wrapper_fn_free_ariellayout: (a: bigint, b: number) => void;
108
+ readonly ubrn_uniffi_mermaid_wrapper_fn_free_arielparseddiagram: (a: bigint, b: number) => void;
109
+ readonly ubrn_uniffi_mermaid_wrapper_fn_free_arieltheme: (a: bigint, b: number) => void;
110
+ readonly ubrn_uniffi_mermaid_wrapper_fn_func_compute_diagram_layout: (a: bigint, b: bigint, c: number, d: number, e: number) => bigint;
111
+ readonly ubrn_uniffi_mermaid_wrapper_fn_func_parse_diagram: (a: number, b: number, c: number) => bigint;
112
+ readonly ubrn_uniffi_mermaid_wrapper_fn_func_render_mermaid: (a: number, b: number, c: number) => [number, number];
113
+ readonly ubrn_uniffi_mermaid_wrapper_fn_func_render_mermaid_with_options: (a: number, b: number, c: bigint, d: number, e: number, f: number) => [number, number];
114
+ readonly ubrn_uniffi_mermaid_wrapper_fn_func_render_mermaid_with_timing: (a: number, b: number, c: bigint, d: number, e: number, f: number) => [number, number];
115
+ readonly ubrn_uniffi_mermaid_wrapper_fn_func_render_svg_from_layout: (a: bigint, b: bigint, c: number, d: number, e: number) => [number, number];
116
+ readonly ubrn_uniffi_mermaid_wrapper_fn_func_set_timing_logs: (a: number, b: number) => void;
117
+ readonly __wbg_get_rustcallstatus_code: (a: number) => number;
118
+ readonly __wbg_rustcallstatus_free: (a: number, b: number) => void;
119
+ readonly __wbg_set_rustcallstatus_code: (a: number, b: number) => void;
120
+ readonly rustcallstatus_error_buf: (a: number) => [number, number];
121
+ readonly rustcallstatus_new: () => number;
122
+ readonly rustcallstatus_set_error_buf: (a: number, b: number, c: number) => void;
123
+ readonly ffi_mermaid_wrapper_rust_future_cancel_f32: (a: bigint) => void;
124
+ readonly ffi_mermaid_wrapper_rust_future_cancel_f64: (a: bigint) => void;
125
+ readonly ffi_mermaid_wrapper_rust_future_cancel_i16: (a: bigint) => void;
126
+ readonly ffi_mermaid_wrapper_rust_future_cancel_i32: (a: bigint) => void;
127
+ readonly ffi_mermaid_wrapper_rust_future_cancel_i64: (a: bigint) => void;
128
+ readonly ffi_mermaid_wrapper_rust_future_cancel_i8: (a: bigint) => void;
129
+ readonly ffi_mermaid_wrapper_rust_future_cancel_rust_buffer: (a: bigint) => void;
130
+ readonly ffi_mermaid_wrapper_rust_future_cancel_u16: (a: bigint) => void;
131
+ readonly ffi_mermaid_wrapper_rust_future_cancel_u32: (a: bigint) => void;
132
+ readonly ffi_mermaid_wrapper_rust_future_cancel_u64: (a: bigint) => void;
133
+ readonly ffi_mermaid_wrapper_rust_future_cancel_u8: (a: bigint) => void;
134
+ readonly ffi_mermaid_wrapper_rust_future_cancel_void: (a: bigint) => void;
135
+ readonly ffi_mermaid_wrapper_rust_future_complete_f32: (a: bigint, b: number) => number;
136
+ readonly ffi_mermaid_wrapper_rust_future_complete_f64: (a: bigint, b: number) => number;
137
+ readonly ffi_mermaid_wrapper_rust_future_complete_i16: (a: bigint, b: number) => number;
138
+ readonly ffi_mermaid_wrapper_rust_future_complete_i32: (a: bigint, b: number) => number;
139
+ readonly ffi_mermaid_wrapper_rust_future_complete_i64: (a: bigint, b: number) => bigint;
140
+ readonly ffi_mermaid_wrapper_rust_future_complete_i8: (a: bigint, b: number) => number;
141
+ readonly ffi_mermaid_wrapper_rust_future_complete_rust_buffer: (a: number, b: bigint, c: number) => void;
142
+ readonly ffi_mermaid_wrapper_rust_future_complete_u16: (a: bigint, b: number) => number;
143
+ readonly ffi_mermaid_wrapper_rust_future_complete_u32: (a: bigint, b: number) => number;
144
+ readonly ffi_mermaid_wrapper_rust_future_complete_u64: (a: bigint, b: number) => bigint;
145
+ readonly ffi_mermaid_wrapper_rust_future_complete_u8: (a: bigint, b: number) => number;
146
+ readonly ffi_mermaid_wrapper_rust_future_complete_void: (a: bigint, b: number) => void;
147
+ readonly ffi_mermaid_wrapper_rust_future_free_f32: (a: bigint) => void;
148
+ readonly ffi_mermaid_wrapper_rust_future_free_f64: (a: bigint) => void;
149
+ readonly ffi_mermaid_wrapper_rust_future_free_i16: (a: bigint) => void;
150
+ readonly ffi_mermaid_wrapper_rust_future_free_i32: (a: bigint) => void;
151
+ readonly ffi_mermaid_wrapper_rust_future_free_i64: (a: bigint) => void;
152
+ readonly ffi_mermaid_wrapper_rust_future_free_i8: (a: bigint) => void;
153
+ readonly ffi_mermaid_wrapper_rust_future_free_rust_buffer: (a: bigint) => void;
154
+ readonly ffi_mermaid_wrapper_rust_future_free_u16: (a: bigint) => void;
155
+ readonly ffi_mermaid_wrapper_rust_future_free_u32: (a: bigint) => void;
156
+ readonly ffi_mermaid_wrapper_rust_future_free_u64: (a: bigint) => void;
157
+ readonly ffi_mermaid_wrapper_rust_future_free_u8: (a: bigint) => void;
158
+ readonly ffi_mermaid_wrapper_rust_future_free_void: (a: bigint) => void;
159
+ readonly ffi_mermaid_wrapper_rust_future_poll_f32: (a: bigint, b: number, c: bigint) => void;
160
+ readonly ffi_mermaid_wrapper_rust_future_poll_f64: (a: bigint, b: number, c: bigint) => void;
161
+ readonly ffi_mermaid_wrapper_rust_future_poll_i16: (a: bigint, b: number, c: bigint) => void;
162
+ readonly ffi_mermaid_wrapper_rust_future_poll_i32: (a: bigint, b: number, c: bigint) => void;
163
+ readonly ffi_mermaid_wrapper_rust_future_poll_i64: (a: bigint, b: number, c: bigint) => void;
164
+ readonly ffi_mermaid_wrapper_rust_future_poll_i8: (a: bigint, b: number, c: bigint) => void;
165
+ readonly ffi_mermaid_wrapper_rust_future_poll_rust_buffer: (a: bigint, b: number, c: bigint) => void;
166
+ readonly ffi_mermaid_wrapper_rust_future_poll_u16: (a: bigint, b: number, c: bigint) => void;
167
+ readonly ffi_mermaid_wrapper_rust_future_poll_u32: (a: bigint, b: number, c: bigint) => void;
168
+ readonly ffi_mermaid_wrapper_rust_future_poll_u64: (a: bigint, b: number, c: bigint) => void;
169
+ readonly ffi_mermaid_wrapper_rust_future_poll_u8: (a: bigint, b: number, c: bigint) => void;
170
+ readonly ffi_mermaid_wrapper_rust_future_poll_void: (a: bigint, b: number, c: bigint) => void;
171
+ readonly ffi_mermaid_wrapper_rustbuffer_alloc: (a: number, b: bigint, c: number) => void;
172
+ readonly ffi_mermaid_wrapper_rustbuffer_free: (a: number, b: number) => void;
173
+ readonly ffi_mermaid_wrapper_rustbuffer_from_bytes: (a: number, b: number, c: number) => void;
174
+ readonly ffi_mermaid_wrapper_rustbuffer_reserve: (a: number, b: number, c: bigint, d: number) => void;
175
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
176
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
177
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
178
+ readonly __wbindgen_externrefs: WebAssembly.Table;
179
+ readonly __wbindgen_start: () => void;
180
+ }
181
+
182
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
183
+
184
+ /**
185
+ * Instantiates the given `module`, which can either be bytes or
186
+ * a precompiled `WebAssembly.Module`.
187
+ *
188
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
189
+ *
190
+ * @returns {InitOutput}
191
+ */
192
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
193
+
194
+ /**
195
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
196
+ * for everything else, calls `WebAssembly.instantiate` directly.
197
+ *
198
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
199
+ *
200
+ * @returns {Promise<InitOutput>}
201
+ */
202
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
@@ -0,0 +1,579 @@
1
+ /* @ts-self-types="./react_native_ariel.d.ts" */
2
+
3
+ export class RustCallStatus {
4
+ __destroy_into_raw() {
5
+ const ptr = this.__wbg_ptr;
6
+ this.__wbg_ptr = 0;
7
+ RustCallStatusFinalization.unregister(this);
8
+ return ptr;
9
+ }
10
+ free() {
11
+ const ptr = this.__destroy_into_raw();
12
+ wasm.__wbg_rustcallstatus_free(ptr, 0);
13
+ }
14
+ /**
15
+ * @returns {number}
16
+ */
17
+ get code() {
18
+ const ret = wasm.__wbg_get_rustcallstatus_code(this.__wbg_ptr);
19
+ return ret;
20
+ }
21
+ /**
22
+ * @returns {Uint8Array | undefined}
23
+ */
24
+ get errorBuf() {
25
+ const ptr = this.__destroy_into_raw();
26
+ const ret = wasm.rustcallstatus_error_buf(ptr);
27
+ let v1;
28
+ if (ret[0] !== 0) {
29
+ v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
30
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
31
+ }
32
+ return v1;
33
+ }
34
+ constructor() {
35
+ const ret = wasm.rustcallstatus_new();
36
+ this.__wbg_ptr = ret;
37
+ RustCallStatusFinalization.register(this, this.__wbg_ptr, this);
38
+ return this;
39
+ }
40
+ /**
41
+ * @param {Uint8Array | null} [bytes]
42
+ */
43
+ set errorBuf(bytes) {
44
+ var ptr0 = isLikeNone(bytes) ? 0 : passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
45
+ var len0 = WASM_VECTOR_LEN;
46
+ wasm.rustcallstatus_set_error_buf(this.__wbg_ptr, ptr0, len0);
47
+ }
48
+ /**
49
+ * @param {number} arg0
50
+ */
51
+ set code(arg0) {
52
+ wasm.__wbg_set_rustcallstatus_code(this.__wbg_ptr, arg0);
53
+ }
54
+ }
55
+ if (Symbol.dispose) RustCallStatus.prototype[Symbol.dispose] = RustCallStatus.prototype.free;
56
+
57
+ /**
58
+ * @returns {number}
59
+ */
60
+ export function ubrn_ffi_mermaid_wrapper_uniffi_contract_version() {
61
+ const ret = wasm.ubrn_ffi_mermaid_wrapper_uniffi_contract_version();
62
+ return ret >>> 0;
63
+ }
64
+
65
+ /**
66
+ * @returns {number}
67
+ */
68
+ export function ubrn_uniffi_mermaid_wrapper_checksum_constructor_arieltheme_mermaid_default() {
69
+ const ret = wasm.ubrn_uniffi_mermaid_wrapper_checksum_constructor_arieltheme_mermaid_default();
70
+ return ret;
71
+ }
72
+
73
+ /**
74
+ * @returns {number}
75
+ */
76
+ export function ubrn_uniffi_mermaid_wrapper_checksum_constructor_arieltheme_modern() {
77
+ const ret = wasm.ubrn_uniffi_mermaid_wrapper_checksum_constructor_arieltheme_modern();
78
+ return ret;
79
+ }
80
+
81
+ /**
82
+ * @returns {number}
83
+ */
84
+ export function ubrn_uniffi_mermaid_wrapper_checksum_func_compute_diagram_layout() {
85
+ const ret = wasm.ubrn_uniffi_mermaid_wrapper_checksum_func_compute_diagram_layout();
86
+ return ret;
87
+ }
88
+
89
+ /**
90
+ * @returns {number}
91
+ */
92
+ export function ubrn_uniffi_mermaid_wrapper_checksum_func_parse_diagram() {
93
+ const ret = wasm.ubrn_uniffi_mermaid_wrapper_checksum_func_parse_diagram();
94
+ return ret;
95
+ }
96
+
97
+ /**
98
+ * @returns {number}
99
+ */
100
+ export function ubrn_uniffi_mermaid_wrapper_checksum_func_render_mermaid() {
101
+ const ret = wasm.ubrn_uniffi_mermaid_wrapper_checksum_func_render_mermaid();
102
+ return ret;
103
+ }
104
+
105
+ /**
106
+ * @returns {number}
107
+ */
108
+ export function ubrn_uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_options() {
109
+ const ret = wasm.ubrn_uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_options();
110
+ return ret;
111
+ }
112
+
113
+ /**
114
+ * @returns {number}
115
+ */
116
+ export function ubrn_uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_timing() {
117
+ const ret = wasm.ubrn_uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_timing();
118
+ return ret;
119
+ }
120
+
121
+ /**
122
+ * @returns {number}
123
+ */
124
+ export function ubrn_uniffi_mermaid_wrapper_checksum_func_render_svg_from_layout() {
125
+ const ret = wasm.ubrn_uniffi_mermaid_wrapper_checksum_func_render_svg_from_layout();
126
+ return ret;
127
+ }
128
+
129
+ /**
130
+ * @returns {number}
131
+ */
132
+ export function ubrn_uniffi_mermaid_wrapper_checksum_func_set_timing_logs() {
133
+ const ret = wasm.ubrn_uniffi_mermaid_wrapper_checksum_func_set_timing_logs();
134
+ return ret;
135
+ }
136
+
137
+ /**
138
+ * @param {bigint} handle
139
+ * @param {RustCallStatus} f_status_
140
+ * @returns {bigint}
141
+ */
142
+ export function ubrn_uniffi_mermaid_wrapper_fn_clone_ariellayout(handle, f_status_) {
143
+ _assertClass(f_status_, RustCallStatus);
144
+ const ret = wasm.ubrn_uniffi_mermaid_wrapper_fn_clone_ariellayout(handle, f_status_.__wbg_ptr);
145
+ return BigInt.asUintN(64, ret);
146
+ }
147
+
148
+ /**
149
+ * @param {bigint} handle
150
+ * @param {RustCallStatus} f_status_
151
+ * @returns {bigint}
152
+ */
153
+ export function ubrn_uniffi_mermaid_wrapper_fn_clone_arielparseddiagram(handle, f_status_) {
154
+ _assertClass(f_status_, RustCallStatus);
155
+ const ret = wasm.ubrn_uniffi_mermaid_wrapper_fn_clone_arielparseddiagram(handle, f_status_.__wbg_ptr);
156
+ return BigInt.asUintN(64, ret);
157
+ }
158
+
159
+ /**
160
+ * @param {bigint} handle
161
+ * @param {RustCallStatus} f_status_
162
+ * @returns {bigint}
163
+ */
164
+ export function ubrn_uniffi_mermaid_wrapper_fn_clone_arieltheme(handle, f_status_) {
165
+ _assertClass(f_status_, RustCallStatus);
166
+ const ret = wasm.ubrn_uniffi_mermaid_wrapper_fn_clone_arieltheme(handle, f_status_.__wbg_ptr);
167
+ return BigInt.asUintN(64, ret);
168
+ }
169
+
170
+ /**
171
+ * @param {RustCallStatus} f_status_
172
+ * @returns {bigint}
173
+ */
174
+ export function ubrn_uniffi_mermaid_wrapper_fn_constructor_arieltheme_mermaid_default(f_status_) {
175
+ _assertClass(f_status_, RustCallStatus);
176
+ const ret = wasm.ubrn_uniffi_mermaid_wrapper_fn_constructor_arieltheme_mermaid_default(f_status_.__wbg_ptr);
177
+ return BigInt.asUintN(64, ret);
178
+ }
179
+
180
+ /**
181
+ * @param {RustCallStatus} f_status_
182
+ * @returns {bigint}
183
+ */
184
+ export function ubrn_uniffi_mermaid_wrapper_fn_constructor_arieltheme_modern(f_status_) {
185
+ _assertClass(f_status_, RustCallStatus);
186
+ const ret = wasm.ubrn_uniffi_mermaid_wrapper_fn_constructor_arieltheme_modern(f_status_.__wbg_ptr);
187
+ return BigInt.asUintN(64, ret);
188
+ }
189
+
190
+ /**
191
+ * @param {bigint} handle
192
+ * @param {RustCallStatus} f_status_
193
+ */
194
+ export function ubrn_uniffi_mermaid_wrapper_fn_free_ariellayout(handle, f_status_) {
195
+ _assertClass(f_status_, RustCallStatus);
196
+ wasm.ubrn_uniffi_mermaid_wrapper_fn_free_ariellayout(handle, f_status_.__wbg_ptr);
197
+ }
198
+
199
+ /**
200
+ * @param {bigint} handle
201
+ * @param {RustCallStatus} f_status_
202
+ */
203
+ export function ubrn_uniffi_mermaid_wrapper_fn_free_arielparseddiagram(handle, f_status_) {
204
+ _assertClass(f_status_, RustCallStatus);
205
+ wasm.ubrn_uniffi_mermaid_wrapper_fn_free_arielparseddiagram(handle, f_status_.__wbg_ptr);
206
+ }
207
+
208
+ /**
209
+ * @param {bigint} handle
210
+ * @param {RustCallStatus} f_status_
211
+ */
212
+ export function ubrn_uniffi_mermaid_wrapper_fn_free_arieltheme(handle, f_status_) {
213
+ _assertClass(f_status_, RustCallStatus);
214
+ wasm.ubrn_uniffi_mermaid_wrapper_fn_free_arieltheme(handle, f_status_.__wbg_ptr);
215
+ }
216
+
217
+ /**
218
+ * @param {bigint} parsed
219
+ * @param {bigint} theme
220
+ * @param {Uint8Array} config
221
+ * @param {RustCallStatus} f_status_
222
+ * @returns {bigint}
223
+ */
224
+ export function ubrn_uniffi_mermaid_wrapper_fn_func_compute_diagram_layout(parsed, theme, config, f_status_) {
225
+ const ptr0 = passArray8ToWasm0(config, wasm.__wbindgen_malloc);
226
+ const len0 = WASM_VECTOR_LEN;
227
+ _assertClass(f_status_, RustCallStatus);
228
+ const ret = wasm.ubrn_uniffi_mermaid_wrapper_fn_func_compute_diagram_layout(parsed, theme, ptr0, len0, f_status_.__wbg_ptr);
229
+ return BigInt.asUintN(64, ret);
230
+ }
231
+
232
+ /**
233
+ * @param {Uint8Array} input
234
+ * @param {RustCallStatus} f_status_
235
+ * @returns {bigint}
236
+ */
237
+ export function ubrn_uniffi_mermaid_wrapper_fn_func_parse_diagram(input, f_status_) {
238
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
239
+ const len0 = WASM_VECTOR_LEN;
240
+ _assertClass(f_status_, RustCallStatus);
241
+ const ret = wasm.ubrn_uniffi_mermaid_wrapper_fn_func_parse_diagram(ptr0, len0, f_status_.__wbg_ptr);
242
+ return BigInt.asUintN(64, ret);
243
+ }
244
+
245
+ /**
246
+ * @param {Uint8Array} input
247
+ * @param {RustCallStatus} f_status_
248
+ * @returns {Uint8Array}
249
+ */
250
+ export function ubrn_uniffi_mermaid_wrapper_fn_func_render_mermaid(input, f_status_) {
251
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
252
+ const len0 = WASM_VECTOR_LEN;
253
+ _assertClass(f_status_, RustCallStatus);
254
+ const ret = wasm.ubrn_uniffi_mermaid_wrapper_fn_func_render_mermaid(ptr0, len0, f_status_.__wbg_ptr);
255
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
256
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
257
+ return v2;
258
+ }
259
+
260
+ /**
261
+ * @param {Uint8Array} input
262
+ * @param {bigint} _theme
263
+ * @param {Uint8Array} _config
264
+ * @param {RustCallStatus} f_status_
265
+ * @returns {Uint8Array}
266
+ */
267
+ export function ubrn_uniffi_mermaid_wrapper_fn_func_render_mermaid_with_options(input, _theme, _config, f_status_) {
268
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
269
+ const len0 = WASM_VECTOR_LEN;
270
+ const ptr1 = passArray8ToWasm0(_config, wasm.__wbindgen_malloc);
271
+ const len1 = WASM_VECTOR_LEN;
272
+ _assertClass(f_status_, RustCallStatus);
273
+ const ret = wasm.ubrn_uniffi_mermaid_wrapper_fn_func_render_mermaid_with_options(ptr0, len0, _theme, ptr1, len1, f_status_.__wbg_ptr);
274
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
275
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
276
+ return v3;
277
+ }
278
+
279
+ /**
280
+ * @param {Uint8Array} input
281
+ * @param {bigint} _theme
282
+ * @param {Uint8Array} _config
283
+ * @param {RustCallStatus} f_status_
284
+ * @returns {Uint8Array}
285
+ */
286
+ export function ubrn_uniffi_mermaid_wrapper_fn_func_render_mermaid_with_timing(input, _theme, _config, f_status_) {
287
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
288
+ const len0 = WASM_VECTOR_LEN;
289
+ const ptr1 = passArray8ToWasm0(_config, wasm.__wbindgen_malloc);
290
+ const len1 = WASM_VECTOR_LEN;
291
+ _assertClass(f_status_, RustCallStatus);
292
+ const ret = wasm.ubrn_uniffi_mermaid_wrapper_fn_func_render_mermaid_with_timing(ptr0, len0, _theme, ptr1, len1, f_status_.__wbg_ptr);
293
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
294
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
295
+ return v3;
296
+ }
297
+
298
+ /**
299
+ * @param {bigint} layout
300
+ * @param {bigint} theme
301
+ * @param {Uint8Array} config
302
+ * @param {RustCallStatus} f_status_
303
+ * @returns {Uint8Array}
304
+ */
305
+ export function ubrn_uniffi_mermaid_wrapper_fn_func_render_svg_from_layout(layout, theme, config, f_status_) {
306
+ const ptr0 = passArray8ToWasm0(config, wasm.__wbindgen_malloc);
307
+ const len0 = WASM_VECTOR_LEN;
308
+ _assertClass(f_status_, RustCallStatus);
309
+ const ret = wasm.ubrn_uniffi_mermaid_wrapper_fn_func_render_svg_from_layout(layout, theme, ptr0, len0, f_status_.__wbg_ptr);
310
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
311
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
312
+ return v2;
313
+ }
314
+
315
+ /**
316
+ * @param {number} enabled
317
+ * @param {RustCallStatus} f_status_
318
+ */
319
+ export function ubrn_uniffi_mermaid_wrapper_fn_func_set_timing_logs(enabled, f_status_) {
320
+ _assertClass(f_status_, RustCallStatus);
321
+ wasm.ubrn_uniffi_mermaid_wrapper_fn_func_set_timing_logs(enabled, f_status_.__wbg_ptr);
322
+ }
323
+ function __wbg_get_imports() {
324
+ const import0 = {
325
+ __proto__: null,
326
+ __wbg___wbindgen_throw_9c31b086c2b26051: function(arg0, arg1) {
327
+ throw new Error(getStringFromWasm0(arg0, arg1));
328
+ },
329
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
330
+ let deferred0_0;
331
+ let deferred0_1;
332
+ try {
333
+ deferred0_0 = arg0;
334
+ deferred0_1 = arg1;
335
+ console.error(getStringFromWasm0(arg0, arg1));
336
+ } finally {
337
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
338
+ }
339
+ },
340
+ __wbg_log_eb752234eec406d1: function(arg0) {
341
+ console.log(arg0);
342
+ },
343
+ __wbg_new_227d7c05414eb861: function() {
344
+ const ret = new Error();
345
+ return ret;
346
+ },
347
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
348
+ const ret = arg1.stack;
349
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
350
+ const len1 = WASM_VECTOR_LEN;
351
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
352
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
353
+ },
354
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
355
+ // Cast intrinsic for `Ref(String) -> Externref`.
356
+ const ret = getStringFromWasm0(arg0, arg1);
357
+ return ret;
358
+ },
359
+ __wbindgen_init_externref_table: function() {
360
+ const table = wasm.__wbindgen_externrefs;
361
+ const offset = table.grow(4);
362
+ table.set(0, undefined);
363
+ table.set(offset + 0, undefined);
364
+ table.set(offset + 1, null);
365
+ table.set(offset + 2, true);
366
+ table.set(offset + 3, false);
367
+ },
368
+ };
369
+ return {
370
+ __proto__: null,
371
+ "./react_native_ariel_bg.js": import0,
372
+ };
373
+ }
374
+
375
+ const RustCallStatusFinalization = (typeof FinalizationRegistry === 'undefined')
376
+ ? { register: () => {}, unregister: () => {} }
377
+ : new FinalizationRegistry(ptr => wasm.__wbg_rustcallstatus_free(ptr, 1));
378
+
379
+ function _assertClass(instance, klass) {
380
+ if (!(instance instanceof klass)) {
381
+ throw new Error(`expected instance of ${klass.name}`);
382
+ }
383
+ }
384
+
385
+ function getArrayU8FromWasm0(ptr, len) {
386
+ ptr = ptr >>> 0;
387
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
388
+ }
389
+
390
+ let cachedDataViewMemory0 = null;
391
+ function getDataViewMemory0() {
392
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
393
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
394
+ }
395
+ return cachedDataViewMemory0;
396
+ }
397
+
398
+ function getStringFromWasm0(ptr, len) {
399
+ return decodeText(ptr >>> 0, len);
400
+ }
401
+
402
+ let cachedUint8ArrayMemory0 = null;
403
+ function getUint8ArrayMemory0() {
404
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
405
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
406
+ }
407
+ return cachedUint8ArrayMemory0;
408
+ }
409
+
410
+ function isLikeNone(x) {
411
+ return x === undefined || x === null;
412
+ }
413
+
414
+ function passArray8ToWasm0(arg, malloc) {
415
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
416
+ getUint8ArrayMemory0().set(arg, ptr / 1);
417
+ WASM_VECTOR_LEN = arg.length;
418
+ return ptr;
419
+ }
420
+
421
+ function passStringToWasm0(arg, malloc, realloc) {
422
+ if (realloc === undefined) {
423
+ const buf = cachedTextEncoder.encode(arg);
424
+ const ptr = malloc(buf.length, 1) >>> 0;
425
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
426
+ WASM_VECTOR_LEN = buf.length;
427
+ return ptr;
428
+ }
429
+
430
+ let len = arg.length;
431
+ let ptr = malloc(len, 1) >>> 0;
432
+
433
+ const mem = getUint8ArrayMemory0();
434
+
435
+ let offset = 0;
436
+
437
+ for (; offset < len; offset++) {
438
+ const code = arg.charCodeAt(offset);
439
+ if (code > 0x7F) break;
440
+ mem[ptr + offset] = code;
441
+ }
442
+ if (offset !== len) {
443
+ if (offset !== 0) {
444
+ arg = arg.slice(offset);
445
+ }
446
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
447
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
448
+ const ret = cachedTextEncoder.encodeInto(arg, view);
449
+
450
+ offset += ret.written;
451
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
452
+ }
453
+
454
+ WASM_VECTOR_LEN = offset;
455
+ return ptr;
456
+ }
457
+
458
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
459
+ cachedTextDecoder.decode();
460
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
461
+ let numBytesDecoded = 0;
462
+ function decodeText(ptr, len) {
463
+ numBytesDecoded += len;
464
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
465
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
466
+ cachedTextDecoder.decode();
467
+ numBytesDecoded = len;
468
+ }
469
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
470
+ }
471
+
472
+ const cachedTextEncoder = new TextEncoder();
473
+
474
+ if (!('encodeInto' in cachedTextEncoder)) {
475
+ cachedTextEncoder.encodeInto = function (arg, view) {
476
+ const buf = cachedTextEncoder.encode(arg);
477
+ view.set(buf);
478
+ return {
479
+ read: arg.length,
480
+ written: buf.length
481
+ };
482
+ };
483
+ }
484
+
485
+ let WASM_VECTOR_LEN = 0;
486
+
487
+ let wasmModule, wasmInstance, wasm;
488
+ function __wbg_finalize_init(instance, module) {
489
+ wasmInstance = instance;
490
+ wasm = instance.exports;
491
+ wasmModule = module;
492
+ cachedDataViewMemory0 = null;
493
+ cachedUint8ArrayMemory0 = null;
494
+ wasm.__wbindgen_start();
495
+ return wasm;
496
+ }
497
+
498
+ async function __wbg_load(module, imports) {
499
+ if (typeof Response === 'function' && module instanceof Response) {
500
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
501
+ try {
502
+ return await WebAssembly.instantiateStreaming(module, imports);
503
+ } catch (e) {
504
+ const validResponse = module.ok && expectedResponseType(module.type);
505
+
506
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
507
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
508
+
509
+ } else { throw e; }
510
+ }
511
+ }
512
+
513
+ const bytes = await module.arrayBuffer();
514
+ return await WebAssembly.instantiate(bytes, imports);
515
+ } else {
516
+ const instance = await WebAssembly.instantiate(module, imports);
517
+
518
+ if (instance instanceof WebAssembly.Instance) {
519
+ return { instance, module };
520
+ } else {
521
+ return instance;
522
+ }
523
+ }
524
+
525
+ function expectedResponseType(type) {
526
+ switch (type) {
527
+ case 'basic': case 'cors': case 'default': return true;
528
+ }
529
+ return false;
530
+ }
531
+ }
532
+
533
+ function initSync(module) {
534
+ if (wasm !== undefined) return wasm;
535
+
536
+
537
+ if (module !== undefined) {
538
+ if (Object.getPrototypeOf(module) === Object.prototype) {
539
+ ({module} = module)
540
+ } else {
541
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
542
+ }
543
+ }
544
+
545
+ const imports = __wbg_get_imports();
546
+ if (!(module instanceof WebAssembly.Module)) {
547
+ module = new WebAssembly.Module(module);
548
+ }
549
+ const instance = new WebAssembly.Instance(module, imports);
550
+ return __wbg_finalize_init(instance, module);
551
+ }
552
+
553
+ async function __wbg_init(module_or_path) {
554
+ if (wasm !== undefined) return wasm;
555
+
556
+
557
+ if (module_or_path !== undefined) {
558
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
559
+ ({module_or_path} = module_or_path)
560
+ } else {
561
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
562
+ }
563
+ }
564
+
565
+ if (module_or_path === undefined) {
566
+ module_or_path = new URL('react_native_ariel_bg.wasm', '');
567
+ }
568
+ const imports = __wbg_get_imports();
569
+
570
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
571
+ module_or_path = fetch(module_or_path);
572
+ }
573
+
574
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
575
+
576
+ return __wbg_finalize_init(instance, module);
577
+ }
578
+
579
+ export { initSync, __wbg_init as default };
@@ -0,0 +1,116 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const uniffi_mermaid_wrapper_fn_func_compute_diagram_layout: (a: bigint, b: bigint, c: number, d: number) => bigint;
5
+ export const uniffi_mermaid_wrapper_fn_constructor_arieltheme_mermaid_default: (a: number) => bigint;
6
+ export const uniffi_mermaid_wrapper_fn_constructor_arieltheme_modern: (a: number) => bigint;
7
+ export const uniffi_mermaid_wrapper_fn_func_render_mermaid_with_timing: (a: number, b: number, c: bigint, d: number, e: number) => void;
8
+ export const uniffi_mermaid_wrapper_fn_free_arieltheme: (a: bigint, b: number) => void;
9
+ export const uniffi_mermaid_wrapper_fn_clone_ariellayout: (a: bigint, b: number) => bigint;
10
+ export const uniffi_mermaid_wrapper_fn_clone_arieltheme: (a: bigint, b: number) => bigint;
11
+ export const uniffi_mermaid_wrapper_fn_free_arielparseddiagram: (a: bigint, b: number) => void;
12
+ export const uniffi_mermaid_wrapper_fn_func_render_mermaid_with_options: (a: number, b: number, c: bigint, d: number, e: number) => void;
13
+ export const uniffi_mermaid_wrapper_fn_func_parse_diagram: (a: number, b: number) => bigint;
14
+ export const uniffi_mermaid_wrapper_fn_func_set_timing_logs: (a: number, b: number) => void;
15
+ export const uniffi_mermaid_wrapper_fn_clone_arielparseddiagram: (a: bigint, b: number) => bigint;
16
+ export const uniffi_mermaid_wrapper_fn_func_render_mermaid: (a: number, b: number, c: number) => void;
17
+ export const uniffi_mermaid_wrapper_fn_free_ariellayout: (a: bigint, b: number) => void;
18
+ export const uniffi_mermaid_wrapper_fn_func_render_svg_from_layout: (a: number, b: bigint, c: bigint, d: number, e: number) => void;
19
+ export const ubrn_ffi_mermaid_wrapper_uniffi_contract_version: () => number;
20
+ export const ffi_mermaid_wrapper_uniffi_contract_version: () => number;
21
+ export const ubrn_uniffi_mermaid_wrapper_checksum_constructor_arieltheme_mermaid_default: () => number;
22
+ export const uniffi_mermaid_wrapper_checksum_constructor_arieltheme_mermaid_default: () => number;
23
+ export const ubrn_uniffi_mermaid_wrapper_checksum_constructor_arieltheme_modern: () => number;
24
+ export const uniffi_mermaid_wrapper_checksum_constructor_arieltheme_modern: () => number;
25
+ export const ubrn_uniffi_mermaid_wrapper_checksum_func_compute_diagram_layout: () => number;
26
+ export const uniffi_mermaid_wrapper_checksum_func_compute_diagram_layout: () => number;
27
+ export const ubrn_uniffi_mermaid_wrapper_checksum_func_parse_diagram: () => number;
28
+ export const uniffi_mermaid_wrapper_checksum_func_parse_diagram: () => number;
29
+ export const ubrn_uniffi_mermaid_wrapper_checksum_func_render_mermaid: () => number;
30
+ export const uniffi_mermaid_wrapper_checksum_func_render_mermaid: () => number;
31
+ export const ubrn_uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_options: () => number;
32
+ export const uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_options: () => number;
33
+ export const ubrn_uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_timing: () => number;
34
+ export const uniffi_mermaid_wrapper_checksum_func_render_mermaid_with_timing: () => number;
35
+ export const ubrn_uniffi_mermaid_wrapper_checksum_func_render_svg_from_layout: () => number;
36
+ export const uniffi_mermaid_wrapper_checksum_func_render_svg_from_layout: () => number;
37
+ export const ubrn_uniffi_mermaid_wrapper_checksum_func_set_timing_logs: () => number;
38
+ export const uniffi_mermaid_wrapper_checksum_func_set_timing_logs: () => number;
39
+ export const ubrn_uniffi_mermaid_wrapper_fn_clone_ariellayout: (a: bigint, b: number) => bigint;
40
+ export const ubrn_uniffi_mermaid_wrapper_fn_clone_arielparseddiagram: (a: bigint, b: number) => bigint;
41
+ export const ubrn_uniffi_mermaid_wrapper_fn_clone_arieltheme: (a: bigint, b: number) => bigint;
42
+ export const ubrn_uniffi_mermaid_wrapper_fn_constructor_arieltheme_mermaid_default: (a: number) => bigint;
43
+ export const ubrn_uniffi_mermaid_wrapper_fn_constructor_arieltheme_modern: (a: number) => bigint;
44
+ export const ubrn_uniffi_mermaid_wrapper_fn_free_ariellayout: (a: bigint, b: number) => void;
45
+ export const ubrn_uniffi_mermaid_wrapper_fn_free_arielparseddiagram: (a: bigint, b: number) => void;
46
+ export const ubrn_uniffi_mermaid_wrapper_fn_free_arieltheme: (a: bigint, b: number) => void;
47
+ export const ubrn_uniffi_mermaid_wrapper_fn_func_compute_diagram_layout: (a: bigint, b: bigint, c: number, d: number, e: number) => bigint;
48
+ export const ubrn_uniffi_mermaid_wrapper_fn_func_parse_diagram: (a: number, b: number, c: number) => bigint;
49
+ export const ubrn_uniffi_mermaid_wrapper_fn_func_render_mermaid: (a: number, b: number, c: number) => [number, number];
50
+ export const ubrn_uniffi_mermaid_wrapper_fn_func_render_mermaid_with_options: (a: number, b: number, c: bigint, d: number, e: number, f: number) => [number, number];
51
+ export const ubrn_uniffi_mermaid_wrapper_fn_func_render_mermaid_with_timing: (a: number, b: number, c: bigint, d: number, e: number, f: number) => [number, number];
52
+ export const ubrn_uniffi_mermaid_wrapper_fn_func_render_svg_from_layout: (a: bigint, b: bigint, c: number, d: number, e: number) => [number, number];
53
+ export const ubrn_uniffi_mermaid_wrapper_fn_func_set_timing_logs: (a: number, b: number) => void;
54
+ export const __wbg_get_rustcallstatus_code: (a: number) => number;
55
+ export const __wbg_rustcallstatus_free: (a: number, b: number) => void;
56
+ export const __wbg_set_rustcallstatus_code: (a: number, b: number) => void;
57
+ export const rustcallstatus_error_buf: (a: number) => [number, number];
58
+ export const rustcallstatus_new: () => number;
59
+ export const rustcallstatus_set_error_buf: (a: number, b: number, c: number) => void;
60
+ export const ffi_mermaid_wrapper_rust_future_cancel_f32: (a: bigint) => void;
61
+ export const ffi_mermaid_wrapper_rust_future_cancel_f64: (a: bigint) => void;
62
+ export const ffi_mermaid_wrapper_rust_future_cancel_i16: (a: bigint) => void;
63
+ export const ffi_mermaid_wrapper_rust_future_cancel_i32: (a: bigint) => void;
64
+ export const ffi_mermaid_wrapper_rust_future_cancel_i64: (a: bigint) => void;
65
+ export const ffi_mermaid_wrapper_rust_future_cancel_i8: (a: bigint) => void;
66
+ export const ffi_mermaid_wrapper_rust_future_cancel_rust_buffer: (a: bigint) => void;
67
+ export const ffi_mermaid_wrapper_rust_future_cancel_u16: (a: bigint) => void;
68
+ export const ffi_mermaid_wrapper_rust_future_cancel_u32: (a: bigint) => void;
69
+ export const ffi_mermaid_wrapper_rust_future_cancel_u64: (a: bigint) => void;
70
+ export const ffi_mermaid_wrapper_rust_future_cancel_u8: (a: bigint) => void;
71
+ export const ffi_mermaid_wrapper_rust_future_cancel_void: (a: bigint) => void;
72
+ export const ffi_mermaid_wrapper_rust_future_complete_f32: (a: bigint, b: number) => number;
73
+ export const ffi_mermaid_wrapper_rust_future_complete_f64: (a: bigint, b: number) => number;
74
+ export const ffi_mermaid_wrapper_rust_future_complete_i16: (a: bigint, b: number) => number;
75
+ export const ffi_mermaid_wrapper_rust_future_complete_i32: (a: bigint, b: number) => number;
76
+ export const ffi_mermaid_wrapper_rust_future_complete_i64: (a: bigint, b: number) => bigint;
77
+ export const ffi_mermaid_wrapper_rust_future_complete_i8: (a: bigint, b: number) => number;
78
+ export const ffi_mermaid_wrapper_rust_future_complete_rust_buffer: (a: number, b: bigint, c: number) => void;
79
+ export const ffi_mermaid_wrapper_rust_future_complete_u16: (a: bigint, b: number) => number;
80
+ export const ffi_mermaid_wrapper_rust_future_complete_u32: (a: bigint, b: number) => number;
81
+ export const ffi_mermaid_wrapper_rust_future_complete_u64: (a: bigint, b: number) => bigint;
82
+ export const ffi_mermaid_wrapper_rust_future_complete_u8: (a: bigint, b: number) => number;
83
+ export const ffi_mermaid_wrapper_rust_future_complete_void: (a: bigint, b: number) => void;
84
+ export const ffi_mermaid_wrapper_rust_future_free_f32: (a: bigint) => void;
85
+ export const ffi_mermaid_wrapper_rust_future_free_f64: (a: bigint) => void;
86
+ export const ffi_mermaid_wrapper_rust_future_free_i16: (a: bigint) => void;
87
+ export const ffi_mermaid_wrapper_rust_future_free_i32: (a: bigint) => void;
88
+ export const ffi_mermaid_wrapper_rust_future_free_i64: (a: bigint) => void;
89
+ export const ffi_mermaid_wrapper_rust_future_free_i8: (a: bigint) => void;
90
+ export const ffi_mermaid_wrapper_rust_future_free_rust_buffer: (a: bigint) => void;
91
+ export const ffi_mermaid_wrapper_rust_future_free_u16: (a: bigint) => void;
92
+ export const ffi_mermaid_wrapper_rust_future_free_u32: (a: bigint) => void;
93
+ export const ffi_mermaid_wrapper_rust_future_free_u64: (a: bigint) => void;
94
+ export const ffi_mermaid_wrapper_rust_future_free_u8: (a: bigint) => void;
95
+ export const ffi_mermaid_wrapper_rust_future_free_void: (a: bigint) => void;
96
+ export const ffi_mermaid_wrapper_rust_future_poll_f32: (a: bigint, b: number, c: bigint) => void;
97
+ export const ffi_mermaid_wrapper_rust_future_poll_f64: (a: bigint, b: number, c: bigint) => void;
98
+ export const ffi_mermaid_wrapper_rust_future_poll_i16: (a: bigint, b: number, c: bigint) => void;
99
+ export const ffi_mermaid_wrapper_rust_future_poll_i32: (a: bigint, b: number, c: bigint) => void;
100
+ export const ffi_mermaid_wrapper_rust_future_poll_i64: (a: bigint, b: number, c: bigint) => void;
101
+ export const ffi_mermaid_wrapper_rust_future_poll_i8: (a: bigint, b: number, c: bigint) => void;
102
+ export const ffi_mermaid_wrapper_rust_future_poll_rust_buffer: (a: bigint, b: number, c: bigint) => void;
103
+ export const ffi_mermaid_wrapper_rust_future_poll_u16: (a: bigint, b: number, c: bigint) => void;
104
+ export const ffi_mermaid_wrapper_rust_future_poll_u32: (a: bigint, b: number, c: bigint) => void;
105
+ export const ffi_mermaid_wrapper_rust_future_poll_u64: (a: bigint, b: number, c: bigint) => void;
106
+ export const ffi_mermaid_wrapper_rust_future_poll_u8: (a: bigint, b: number, c: bigint) => void;
107
+ export const ffi_mermaid_wrapper_rust_future_poll_void: (a: bigint, b: number, c: bigint) => void;
108
+ export const ffi_mermaid_wrapper_rustbuffer_alloc: (a: number, b: bigint, c: number) => void;
109
+ export const ffi_mermaid_wrapper_rustbuffer_free: (a: number, b: number) => void;
110
+ export const ffi_mermaid_wrapper_rustbuffer_from_bytes: (a: number, b: number, c: number) => void;
111
+ export const ffi_mermaid_wrapper_rustbuffer_reserve: (a: number, b: number, c: bigint, d: number) => void;
112
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
113
+ export const __wbindgen_malloc: (a: number, b: number) => number;
114
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
115
+ export const __wbindgen_externrefs: WebAssembly.Table;
116
+ export const __wbindgen_start: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ariel",
3
- "version": "0.1.0-dev.50",
3
+ "version": "0.1.0-dev.52",
4
4
  "description": "Mermaid diagrams for React Native and React Native Web. No DOM. No WebView. Pure Rust.",
5
5
  "main": "./lib/module/index.js",
6
6
  "source": "./src/index.tsx",
@@ -1,79 +0,0 @@
1
- # Generated by uniffi-bindgen-react-native
2
- cmake_minimum_required(VERSION 3.9.0)
3
- project(Ariel)
4
-
5
- set (CMAKE_VERBOSE_MAKEFILE ON)
6
- set (CMAKE_CXX_STANDARD 17)
7
-
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()
18
-
19
- include_directories(
20
- ../cpp
21
- ../cpp/generated
22
-
23
- ${UNIFFI_INCLUDES}
24
- )
25
-
26
- add_library(react-native-ariel SHARED
27
- ../cpp/react-native-ariel.cpp
28
- ../cpp/generated/mermaid_wrapper.cpp
29
- cpp-adapter.cpp
30
- )
31
-
32
- # Set C++ compiler flags
33
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
34
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions")
35
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti")
36
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-all")
37
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
38
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
39
-
40
- # Set linker flags for 16KB page size alignment (required for Android 15+)
41
- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,max-page-size=16384")
42
-
43
- cmake_path(
44
- SET MY_RUST_LIB
45
- ${CMAKE_CURRENT_LIST_DIR}/src/main/jniLibs/${ANDROID_ABI}/libmermaid_wrapper.a
46
- NORMALIZE
47
- )
48
- add_library(my_rust_lib STATIC IMPORTED)
49
- set_target_properties(my_rust_lib PROPERTIES IMPORTED_LOCATION ${MY_RUST_LIB})
50
-
51
- # Add ReactAndroid libraries, being careful to account for different versions.
52
- find_package(ReactAndroid REQUIRED CONFIG)
53
- find_library(LOGCAT log)
54
-
55
- # REACTNATIVE_MERGED_SO seems to be only be set in a build.gradle.kt file,
56
- # which we don't use. Thus falling back to version number sniffing.
57
- if (ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
58
- set(REACTNATIVE_MERGED_SO true)
59
- endif()
60
-
61
- # https://github.com/react-native-community/discussions-and-proposals/discussions/816
62
- # This if-then-else can be removed once this library does not support version below 0.76
63
- if (REACTNATIVE_MERGED_SO)
64
- target_link_libraries(react-native-ariel ReactAndroid::reactnative)
65
- else()
66
- target_link_libraries(react-native-ariel
67
- ReactAndroid::turbomodulejsijni
68
- ReactAndroid::react_nativemodule_core
69
- )
70
- endif()
71
-
72
- find_package(fbjni REQUIRED CONFIG)
73
- target_link_libraries(
74
- react-native-ariel
75
- fbjni::fbjni
76
- ReactAndroid::jsi
77
- ${LOGCAT}
78
- my_rust_lib
79
- )