@rerun-io/web-viewer 0.11.0-rc.2 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -5
- package/index.d.ts +12 -2
- package/index.js +13 -4
- package/package.json +1 -1
- package/re_viewer_bg.js +30 -30
- package/re_viewer_bg.wasm +0 -0
- package/re_viewer_bg.wasm.d.ts +2 -2
package/README.md
CHANGED
|
@@ -12,6 +12,8 @@ Embed the Rerun web viewer within your app.
|
|
|
12
12
|
</picture>
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
|
+
This package is framework-agnostic. A React wrapper is available at <https://www.npmjs.com/package/@rerun-io/web-viewer-react>.
|
|
16
|
+
|
|
15
17
|
## Install
|
|
16
18
|
|
|
17
19
|
```
|
|
@@ -29,22 +31,27 @@ The web viewer is an object which manages a canvas element:
|
|
|
29
31
|
```js
|
|
30
32
|
import { WebViewer } from "@rerun-io/web-viewer";
|
|
31
33
|
|
|
32
|
-
const
|
|
34
|
+
const rrd = "…";
|
|
33
35
|
const parentElement = document.body;
|
|
34
36
|
|
|
35
37
|
const viewer = new WebViewer();
|
|
36
|
-
await viewer.start(
|
|
38
|
+
await viewer.start(rrd, parentElement);
|
|
37
39
|
// …
|
|
38
40
|
viewer.stop();
|
|
39
41
|
```
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
The `rrd` in the snippet above should be a URL pointing to either:
|
|
44
|
+
- A hosted `.rrd` file, such as <https://demo.rerun.io/version/0.11.0/examples/dna/data.rrd>
|
|
45
|
+
- A WebSocket connection to the SDK opened via the [`serve`](https://www.rerun.io/docs/reference/sdk-operating-modes#serve) API
|
|
46
|
+
|
|
47
|
+
If `rrd` is not set, the viewer will display the same welcome screen as <https://app.rerun.io>.
|
|
42
48
|
|
|
43
|
-
For a
|
|
49
|
+
For a full example, see https://github.com/rerun-io/web-viewer-example.
|
|
50
|
+
You can open the example via CodeSandbox: https://codesandbox.io/s/github/rerun-io/web-viewer-example
|
|
44
51
|
|
|
45
52
|
ℹ️ Note:
|
|
46
53
|
This package only targets recent versions of browsers.
|
|
47
|
-
If your target browser does not support Wasm imports, you may need to install additional plugins for your bundler.
|
|
54
|
+
If your target browser does not support Wasm imports or top-level await, you may need to install additional plugins for your bundler.
|
|
48
55
|
|
|
49
56
|
## Development
|
|
50
57
|
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
declare module '@rerun-io/web-viewer' {
|
|
2
2
|
export class WebViewer {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Start the viewer.
|
|
5
|
+
*
|
|
6
|
+
* @param rrd Optional URL to an `.rrd` file or a WebSocket connection to our SDK.
|
|
7
|
+
* @param parent The element to attach the canvas onto.
|
|
8
|
+
* */
|
|
9
|
+
start(rrd?: string | undefined, parent?: HTMLElement | undefined): Promise<this>;
|
|
10
|
+
/**
|
|
11
|
+
* Stop the viewer, freeing all associated memory.
|
|
12
|
+
*
|
|
13
|
+
* The same viewer instance may be started multiple times.
|
|
14
|
+
*/
|
|
5
15
|
stop(): void;
|
|
6
16
|
#private;
|
|
7
17
|
}
|
package/index.js
CHANGED
|
@@ -29,18 +29,22 @@ export class WebViewer {
|
|
|
29
29
|
#canvas = null;
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
32
|
+
* Start the viewer.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} [rrd] Optional URL to an `.rrd` file or a WebSocket connection to our SDK.
|
|
35
|
+
* @param {HTMLElement} [parent] The element to attach the canvas onto.
|
|
34
36
|
* @returns {Promise<this>}
|
|
35
37
|
*/
|
|
36
|
-
async start(
|
|
38
|
+
async start(rrd, parent = document.body) {
|
|
39
|
+
if (this.#canvas || this.#handle) return this;
|
|
40
|
+
|
|
37
41
|
const canvas = document.createElement("canvas");
|
|
38
42
|
canvas.id = randomId();
|
|
39
43
|
parent.append(canvas);
|
|
40
44
|
|
|
41
45
|
let WebHandle_class = await load();
|
|
42
46
|
const handle = new WebHandle_class();
|
|
43
|
-
await handle.start(canvas.id,
|
|
47
|
+
await handle.start(canvas.id, rrd);
|
|
44
48
|
if (handle.has_panicked()) {
|
|
45
49
|
throw new Error(`Web viewer crashed: ${handle.panic_message()}`);
|
|
46
50
|
}
|
|
@@ -51,6 +55,11 @@ export class WebViewer {
|
|
|
51
55
|
return this;
|
|
52
56
|
}
|
|
53
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Stop the viewer, freeing all associated memory.
|
|
60
|
+
*
|
|
61
|
+
* The same viewer instance may be started multiple times.
|
|
62
|
+
*/
|
|
54
63
|
stop() {
|
|
55
64
|
const canvas = this.#canvas;
|
|
56
65
|
this.#canvas = null;
|
package/package.json
CHANGED
package/re_viewer_bg.js
CHANGED
|
@@ -222,7 +222,7 @@ function makeMutClosure(arg0, arg1, dtor, f) {
|
|
|
222
222
|
return real;
|
|
223
223
|
}
|
|
224
224
|
function __wbg_adapter_34(arg0, arg1) {
|
|
225
|
-
wasm.
|
|
225
|
+
wasm.wasm_bindgen__convert__closures__invoke0_mut__h4d9356db3b382851(arg0, arg1);
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
function __wbg_adapter_37(arg0, arg1) {
|
|
@@ -256,7 +256,7 @@ function __wbg_adapter_49(arg0, arg1, arg2) {
|
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
function __wbg_adapter_58(arg0, arg1, arg2) {
|
|
259
|
-
wasm.
|
|
259
|
+
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb6c91d6a883cccef(arg0, arg1, addHeapObject(arg2));
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
function __wbg_adapter_61(arg0, arg1, arg2) {
|
|
@@ -709,12 +709,12 @@ export function __wbg_stack_21698d2a5852e13e(arg0, arg1) {
|
|
|
709
709
|
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
710
710
|
};
|
|
711
711
|
|
|
712
|
-
export function
|
|
712
|
+
export function __wbg_new_0903e6940a560550() {
|
|
713
713
|
const ret = new Error();
|
|
714
714
|
return addHeapObject(ret);
|
|
715
715
|
};
|
|
716
716
|
|
|
717
|
-
export function
|
|
717
|
+
export function __wbg_stack_fc23607ceb8c8fbf(arg0, arg1) {
|
|
718
718
|
const ret = getObject(arg1).stack;
|
|
719
719
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
720
720
|
const len1 = WASM_VECTOR_LEN;
|
|
@@ -2678,19 +2678,19 @@ export function __wbg_matches_0f7e350783b542c2(arg0) {
|
|
|
2678
2678
|
return ret;
|
|
2679
2679
|
};
|
|
2680
2680
|
|
|
2681
|
-
export function
|
|
2681
|
+
export function __wbg_warn_15e5227af2df42e7(arg0, arg1) {
|
|
2682
2682
|
console.warn(getStringFromWasm0(arg0, arg1));
|
|
2683
2683
|
};
|
|
2684
2684
|
|
|
2685
|
-
export function
|
|
2685
|
+
export function __wbg_info_400b2eea0b4c0ff9(arg0, arg1) {
|
|
2686
2686
|
console.info(getStringFromWasm0(arg0, arg1));
|
|
2687
2687
|
};
|
|
2688
2688
|
|
|
2689
|
-
export function
|
|
2689
|
+
export function __wbg_debug_79e9757132ad993c(arg0, arg1) {
|
|
2690
2690
|
console.debug(getStringFromWasm0(arg0, arg1));
|
|
2691
2691
|
};
|
|
2692
2692
|
|
|
2693
|
-
export function
|
|
2693
|
+
export function __wbg_trace_f505d9f2cc9953a6(arg0, arg1) {
|
|
2694
2694
|
console.trace(getStringFromWasm0(arg0, arg1));
|
|
2695
2695
|
};
|
|
2696
2696
|
|
|
@@ -3049,63 +3049,63 @@ export function __wbindgen_memory() {
|
|
|
3049
3049
|
return addHeapObject(ret);
|
|
3050
3050
|
};
|
|
3051
3051
|
|
|
3052
|
-
export function
|
|
3052
|
+
export function __wbindgen_closure_wrapper1797(arg0, arg1, arg2) {
|
|
3053
3053
|
const ret = makeMutClosure(arg0, arg1, 475, __wbg_adapter_34);
|
|
3054
3054
|
return addHeapObject(ret);
|
|
3055
3055
|
};
|
|
3056
3056
|
|
|
3057
|
-
export function
|
|
3057
|
+
export function __wbindgen_closure_wrapper2420(arg0, arg1, arg2) {
|
|
3058
3058
|
const ret = makeMutClosure(arg0, arg1, 619, __wbg_adapter_37);
|
|
3059
3059
|
return addHeapObject(ret);
|
|
3060
3060
|
};
|
|
3061
3061
|
|
|
3062
|
-
export function
|
|
3063
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3062
|
+
export function __wbindgen_closure_wrapper4144(arg0, arg1, arg2) {
|
|
3063
|
+
const ret = makeMutClosure(arg0, arg1, 1169, __wbg_adapter_40);
|
|
3064
3064
|
return addHeapObject(ret);
|
|
3065
3065
|
};
|
|
3066
3066
|
|
|
3067
|
-
export function
|
|
3068
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3067
|
+
export function __wbindgen_closure_wrapper4146(arg0, arg1, arg2) {
|
|
3068
|
+
const ret = makeMutClosure(arg0, arg1, 1169, __wbg_adapter_43);
|
|
3069
3069
|
return addHeapObject(ret);
|
|
3070
3070
|
};
|
|
3071
3071
|
|
|
3072
|
-
export function
|
|
3073
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3072
|
+
export function __wbindgen_closure_wrapper4148(arg0, arg1, arg2) {
|
|
3073
|
+
const ret = makeMutClosure(arg0, arg1, 1169, __wbg_adapter_46);
|
|
3074
3074
|
return addHeapObject(ret);
|
|
3075
3075
|
};
|
|
3076
3076
|
|
|
3077
|
-
export function
|
|
3078
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3077
|
+
export function __wbindgen_closure_wrapper20075(arg0, arg1, arg2) {
|
|
3078
|
+
const ret = makeMutClosure(arg0, arg1, 6994, __wbg_adapter_49);
|
|
3079
3079
|
return addHeapObject(ret);
|
|
3080
3080
|
};
|
|
3081
3081
|
|
|
3082
|
-
export function
|
|
3083
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3082
|
+
export function __wbindgen_closure_wrapper20077(arg0, arg1, arg2) {
|
|
3083
|
+
const ret = makeMutClosure(arg0, arg1, 6994, __wbg_adapter_49);
|
|
3084
3084
|
return addHeapObject(ret);
|
|
3085
3085
|
};
|
|
3086
3086
|
|
|
3087
|
-
export function
|
|
3088
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3087
|
+
export function __wbindgen_closure_wrapper20079(arg0, arg1, arg2) {
|
|
3088
|
+
const ret = makeMutClosure(arg0, arg1, 6994, __wbg_adapter_49);
|
|
3089
3089
|
return addHeapObject(ret);
|
|
3090
3090
|
};
|
|
3091
3091
|
|
|
3092
|
-
export function
|
|
3093
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3092
|
+
export function __wbindgen_closure_wrapper20081(arg0, arg1, arg2) {
|
|
3093
|
+
const ret = makeMutClosure(arg0, arg1, 6994, __wbg_adapter_49);
|
|
3094
3094
|
return addHeapObject(ret);
|
|
3095
3095
|
};
|
|
3096
3096
|
|
|
3097
|
-
export function
|
|
3098
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3097
|
+
export function __wbindgen_closure_wrapper20889(arg0, arg1, arg2) {
|
|
3098
|
+
const ret = makeMutClosure(arg0, arg1, 7540, __wbg_adapter_58);
|
|
3099
3099
|
return addHeapObject(ret);
|
|
3100
3100
|
};
|
|
3101
3101
|
|
|
3102
|
-
export function
|
|
3103
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3102
|
+
export function __wbindgen_closure_wrapper21262(arg0, arg1, arg2) {
|
|
3103
|
+
const ret = makeMutClosure(arg0, arg1, 7649, __wbg_adapter_61);
|
|
3104
3104
|
return addHeapObject(ret);
|
|
3105
3105
|
};
|
|
3106
3106
|
|
|
3107
|
-
export function
|
|
3108
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
3107
|
+
export function __wbindgen_closure_wrapper21294(arg0, arg1, arg2) {
|
|
3108
|
+
const ret = makeMutClosure(arg0, arg1, 7660, __wbg_adapter_64);
|
|
3109
3109
|
return addHeapObject(ret);
|
|
3110
3110
|
};
|
|
3111
3111
|
|
package/re_viewer_bg.wasm
CHANGED
|
Binary file
|
package/re_viewer_bg.wasm.d.ts
CHANGED
|
@@ -82,14 +82,14 @@ export function intounderlyingsource_cancel(a: number): void;
|
|
|
82
82
|
export function __wbindgen_malloc(a: number, b: number): number;
|
|
83
83
|
export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
|
|
84
84
|
export const __wbindgen_export_2: WebAssembly.Table;
|
|
85
|
-
export function
|
|
85
|
+
export function wasm_bindgen__convert__closures__invoke0_mut__h4d9356db3b382851(a: number, b: number): void;
|
|
86
86
|
export function wasm_bindgen__convert__closures__invoke0_mut__hbb2d466e4a580595(a: number, b: number): void;
|
|
87
87
|
export function _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hf64c3fc72d424f95(a: number, b: number): void;
|
|
88
88
|
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hcda1bc7f6baacddd(a: number, b: number, c: number): void;
|
|
89
89
|
export function __wbindgen_add_to_stack_pointer(a: number): number;
|
|
90
90
|
export function _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h3960a85cd94e1623(a: number, b: number, c: number): void;
|
|
91
91
|
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h00f3b5d0b78ac098(a: number, b: number, c: number): void;
|
|
92
|
-
export function
|
|
92
|
+
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb6c91d6a883cccef(a: number, b: number, c: number): void;
|
|
93
93
|
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hefb91f3bd6a8bfc9(a: number, b: number, c: number): void;
|
|
94
94
|
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hbc8a650979ad564c(a: number, b: number, c: number): void;
|
|
95
95
|
export function __wbindgen_free(a: number, b: number, c: number): void;
|