proteus-sdk 0.0.0-stage → 0.1.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 +69 -2
- package/dist/convert.d.ts +24 -0
- package/dist/convert.js +76 -0
- package/dist/index.d.ts +586 -0
- package/dist/index.js +750 -0
- package/dist/mount.d.ts +57 -0
- package/dist/mount.js +32 -0
- package/dist/types.d.ts +586 -0
- package/dist/types.js +9 -0
- package/package.json +53 -4
- package/pkg/README.md +11 -0
- package/pkg/package.json +34 -0
- package/pkg/proteus_sdk_web.d.ts +309 -0
- package/pkg/proteus_sdk_web.js +9 -0
- package/pkg/proteus_sdk_web_bg.js +1671 -0
- package/pkg/proteus_sdk_web_bg.wasm +0 -0
- package/pkg/proteus_sdk_web_bg.wasm.d.ts +76 -0
- package/pkg-host/README.md +11 -0
- package/pkg-host/package.json +34 -0
- package/pkg-host/proteus_host_web.d.ts +323 -0
- package/pkg-host/proteus_host_web.js +9 -0
- package/pkg-host/proteus_host_web_bg.js +3428 -0
- package/pkg-host/proteus_host_web_bg.wasm +0 -0
- package/pkg-host/proteus_host_web_bg.wasm.d.ts +84 -0
|
Binary file
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_proteusapp_free: (a: number, b: number) => void;
|
|
5
|
+
export const proteusapp_addChild: (a: number, b: number, c: number) => [number, number];
|
|
6
|
+
export const proteusapp_animateTo: (a: number, b: number, c: any, d: any) => [number, number];
|
|
7
|
+
export const proteusapp_bakeTexture: (a: number, b: number, c: number, d: number, e: number, f: any) => number;
|
|
8
|
+
export const proteusapp_bakedImageSize: (a: number, b: number) => any;
|
|
9
|
+
export const proteusapp_bakedTextSize: (a: number, b: number) => any;
|
|
10
|
+
export const proteusapp_channelDestroy: (a: number, b: number) => void;
|
|
11
|
+
export const proteusapp_channelSet: (a: number, b: number, c: number, d: number, e: any, f: number) => [number, number];
|
|
12
|
+
export const proteusapp_component: (a: number, b: any) => [number, number, number];
|
|
13
|
+
export const proteusapp_copyBakedImageFrom: (a: number, b: number, c: number) => [number, number, number];
|
|
14
|
+
export const proteusapp_createVideo: (a: number) => number;
|
|
15
|
+
export const proteusapp_cropImage: (a: number, b: number, c: any) => [number, number, number];
|
|
16
|
+
export const proteusapp_destroy: (a: number, b: number) => [number, number];
|
|
17
|
+
export const proteusapp_freeResources: (a: number, b: number) => [number, number];
|
|
18
|
+
export const proteusapp_get: (a: number, b: number) => any;
|
|
19
|
+
export const proteusapp_hideVideo: (a: number, b: number) => [number, number];
|
|
20
|
+
export const proteusapp_loadTexture: (a: number, b: number, c: number, d: any) => number;
|
|
21
|
+
export const proteusapp_mergeFrom: (a: number, b: number, c: number, d: number, e: any, f: any) => [number, number];
|
|
22
|
+
export const proteusapp_mergeFromWithBehavior: (a: number, b: number, c: number, d: number, e: any, f: any, g: any) => [number, number];
|
|
23
|
+
export const proteusapp_new: () => number;
|
|
24
|
+
export const proteusapp_onBlur: (a: number, b: number, c: any) => void;
|
|
25
|
+
export const proteusapp_onClick: (a: number, b: number, c: any) => void;
|
|
26
|
+
export const proteusapp_onDrag: (a: number, b: number, c: any) => void;
|
|
27
|
+
export const proteusapp_onDropped: (a: number, b: number, c: any) => void;
|
|
28
|
+
export const proteusapp_onFocus: (a: number, b: number, c: any) => void;
|
|
29
|
+
export const proteusapp_onHoverEnter: (a: number, b: number, c: any) => void;
|
|
30
|
+
export const proteusapp_onHoverExit: (a: number, b: number, c: any) => void;
|
|
31
|
+
export const proteusapp_onPress: (a: number, b: number, c: any) => void;
|
|
32
|
+
export const proteusapp_onRelease: (a: number, b: number, c: any) => void;
|
|
33
|
+
export const proteusapp_onTransitionComplete: (a: number, b: number, c: any) => void;
|
|
34
|
+
export const proteusapp_pointerLeft: (a: number) => void;
|
|
35
|
+
export const proteusapp_pointerMoved: (a: number, b: number, c: number) => void;
|
|
36
|
+
export const proteusapp_pointerPressed: (a: number) => void;
|
|
37
|
+
export const proteusapp_pointerReleased: (a: number) => void;
|
|
38
|
+
export const proteusapp_releaseVideo: (a: number, b: number) => void;
|
|
39
|
+
export const proteusapp_removeChild: (a: number, b: number, c: number) => [number, number];
|
|
40
|
+
export const proteusapp_setDeclaredGeometry: (a: number, b: number, c: any) => [number, number];
|
|
41
|
+
export const proteusapp_setDisabled: (a: number, b: number, c: number) => [number, number];
|
|
42
|
+
export const proteusapp_setImage: (a: number, b: number, c: any) => [number, number];
|
|
43
|
+
export const proteusapp_setInteractive: (a: number, b: number, c: number) => [number, number];
|
|
44
|
+
export const proteusapp_setOpacity: (a: number, b: number, c: number) => [number, number];
|
|
45
|
+
export const proteusapp_setText: (a: number, b: number, c: any) => [number, number];
|
|
46
|
+
export const proteusapp_setTexture: (a: number, b: number, c: number) => [number, number, number];
|
|
47
|
+
export const proteusapp_setTransitionInteraction: (a: number, b: number, c: any) => [number, number];
|
|
48
|
+
export const proteusapp_setVideoCrossfade: (a: number, b: number, c: number) => [number, number, number];
|
|
49
|
+
export const proteusapp_setVisible: (a: number, b: number, c: number) => [number, number];
|
|
50
|
+
export const proteusapp_showVideo: (a: number, b: number, c: number) => [number, number, number];
|
|
51
|
+
export const proteusapp_splitTo: (a: number, b: number, c: number, d: number, e: any, f: any) => [number, number];
|
|
52
|
+
export const proteusapp_splitToWithBehavior: (a: number, b: number, c: number, d: number, e: any, f: any, g: any) => [number, number];
|
|
53
|
+
export const proteusapp_splitToWithStates: (a: number, b: number, c: any, d: any, e: any) => [number, number];
|
|
54
|
+
export const proteusapp_texture: (a: number, b: number) => number;
|
|
55
|
+
export const proteusapp_textureState: (a: number, b: number) => any;
|
|
56
|
+
export const proteusapp_tick: (a: number, b: number) => void;
|
|
57
|
+
export const proteusapp_transitionChannel: (a: number, b: number, c: number) => number;
|
|
58
|
+
export const proteusapp_uploadVideoFrame: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
|
59
|
+
export const __wbg_handle_free: (a: number, b: number) => void;
|
|
60
|
+
export const __wbg_texturehandle_free: (a: number, b: number) => void;
|
|
61
|
+
export const __wbg_transitionchannel_free: (a: number, b: number) => void;
|
|
62
|
+
export const __wbg_videohandle_free: (a: number, b: number) => void;
|
|
63
|
+
export const handle_fromId: (a: number) => number;
|
|
64
|
+
export const handle_id: (a: number) => number;
|
|
65
|
+
export const texturehandle_fromId: (a: number) => number;
|
|
66
|
+
export const texturehandle_id: (a: number) => number;
|
|
67
|
+
export const wasm_bindgen_63f5332d1d9a4f22___convert__closures_____invoke___wasm_bindgen_63f5332d1d9a4f22___JsValue__core_608f92abc48d28da___result__Result_____wasm_bindgen_63f5332d1d9a4f22___JsError___true_: (a: number, b: number, c: any) => [number, number];
|
|
68
|
+
export const wasm_bindgen_63f5332d1d9a4f22___convert__closures_____invoke___wasm_bindgen_63f5332d1d9a4f22___JsValue______true_: (a: number, b: number, c: any) => void;
|
|
69
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
70
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
71
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
72
|
+
export const __externref_table_alloc: () => number;
|
|
73
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
74
|
+
export const __wbindgen_destroy_closure: (a: number, b: number) => void;
|
|
75
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
76
|
+
export const __wbindgen_start: () => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# proteus-host-web
|
|
2
|
+
|
|
3
|
+
Runs a Proteus app on an HTML canvas, compiled to WebAssembly, with WebGPU where it's available and WebGL2 otherwise.
|
|
4
|
+
|
|
5
|
+
Part of [Proteus](https://github.com/ichellin1/proteus).
|
|
6
|
+
|
|
7
|
+
From Rust, `proteus_host_web::run` runs an app on a canvas; see [Getting started in Rust](https://github.com/ichellin1/proteus/blob/main/docs/getting-started/rust.md#run-it-in-a-browser). It is also what the [`proteus-sdk` npm package](https://www.npmjs.com/package/proteus-sdk) runs on. It only builds for `wasm32-unknown-unknown`.
|
|
8
|
+
|
|
9
|
+
## License
|
|
10
|
+
|
|
11
|
+
MIT or Apache-2.0, at your option.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "proteus-host-web",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"collaborators": [
|
|
5
|
+
"Blue <isaac.chellin@gmail.com>"
|
|
6
|
+
],
|
|
7
|
+
"description": "Runs a Proteus app on an HTML canvas with WebGPU or WebGL2, from Rust or TypeScript.",
|
|
8
|
+
"version": "0.1.0",
|
|
9
|
+
"license": "MIT OR Apache-2.0",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/ichellin1/proteus"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"proteus_host_web_bg.wasm",
|
|
16
|
+
"proteus_host_web.js",
|
|
17
|
+
"proteus_host_web_bg.js",
|
|
18
|
+
"proteus_host_web.d.ts"
|
|
19
|
+
],
|
|
20
|
+
"main": "proteus_host_web.js",
|
|
21
|
+
"homepage": "https://ichellin1.github.io/proteus/",
|
|
22
|
+
"types": "proteus_host_web.d.ts",
|
|
23
|
+
"sideEffects": [
|
|
24
|
+
"./proteus_host_web.js",
|
|
25
|
+
"./snippets/*"
|
|
26
|
+
],
|
|
27
|
+
"keywords": [
|
|
28
|
+
"ui",
|
|
29
|
+
"gui",
|
|
30
|
+
"animation",
|
|
31
|
+
"transitions",
|
|
32
|
+
"wgpu"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A handle to a component.
|
|
6
|
+
*/
|
|
7
|
+
export class Handle {
|
|
8
|
+
private constructor();
|
|
9
|
+
free(): void;
|
|
10
|
+
[Symbol.dispose](): void;
|
|
11
|
+
/**
|
|
12
|
+
* Returns a handle for an ID from [`Handle::id`] or
|
|
13
|
+
* `ComponentData.children`. The ID isn't checked: if its component has
|
|
14
|
+
* been destroyed, methods that change it throw and `get` returns
|
|
15
|
+
* `undefined`.
|
|
16
|
+
*/
|
|
17
|
+
static fromId(id: number): Handle;
|
|
18
|
+
/**
|
|
19
|
+
* The component's ID: its entity's bits as a number, which is exact for
|
|
20
|
+
* any realistic app (see the `dto` module). [`Handle::from_id`] turns it
|
|
21
|
+
* back into a handle.
|
|
22
|
+
*/
|
|
23
|
+
id(): number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A [`Proteus`](sdk::Proteus) app, as JavaScript sees it. Cloning shares the
|
|
28
|
+
* same app.
|
|
29
|
+
*/
|
|
30
|
+
export class ProteusApp {
|
|
31
|
+
free(): void;
|
|
32
|
+
[Symbol.dispose](): void;
|
|
33
|
+
/**
|
|
34
|
+
* Calls [`Handle::add_child`](sdk::Handle::add_child).
|
|
35
|
+
*/
|
|
36
|
+
addChild(parent: Handle, child: Handle): void;
|
|
37
|
+
/**
|
|
38
|
+
* Calls [`Handle::animate_to`](sdk::Handle::animate_to).
|
|
39
|
+
*/
|
|
40
|
+
animateTo(handle: Handle, to: any, config: any): void;
|
|
41
|
+
/**
|
|
42
|
+
* Calls [`Proteus::bake_texture`](sdk::Proteus::bake_texture).
|
|
43
|
+
*/
|
|
44
|
+
bakeTexture(width: number, height: number, rgba: Uint8Array, request: any): TextureHandle;
|
|
45
|
+
/**
|
|
46
|
+
* Calls [`Handle::baked_image_size`](sdk::Handle::baked_image_size).
|
|
47
|
+
* Returns `undefined` if there is no baked image.
|
|
48
|
+
*/
|
|
49
|
+
bakedImageSize(handle: Handle): any;
|
|
50
|
+
/**
|
|
51
|
+
* Calls [`Handle::baked_text_size`](sdk::Handle::baked_text_size).
|
|
52
|
+
* Returns `undefined` if there is no baked text.
|
|
53
|
+
*/
|
|
54
|
+
bakedTextSize(handle: Handle): any;
|
|
55
|
+
/**
|
|
56
|
+
* Calls [`TransitionChannel::destroy`](sdk::TransitionChannel::destroy). Consumes
|
|
57
|
+
* `channel`: the JavaScript object can't be used afterwards.
|
|
58
|
+
*/
|
|
59
|
+
channelDestroy(channel: TransitionChannel): void;
|
|
60
|
+
/**
|
|
61
|
+
* Calls [`TransitionChannel::set`](sdk::TransitionChannel::set).
|
|
62
|
+
*/
|
|
63
|
+
channelSet(channel: TransitionChannel, to: Handle, from: Handle, config: any, interruptible: boolean): void;
|
|
64
|
+
/**
|
|
65
|
+
* Calls [`Proteus::component`](sdk::Proteus::component). `spec` is a
|
|
66
|
+
* `ComponentSpec` object; its `children` are handle IDs.
|
|
67
|
+
*/
|
|
68
|
+
component(spec: any): Handle;
|
|
69
|
+
/**
|
|
70
|
+
* Calls [`Handle::copy_baked_image_from`](sdk::Handle::copy_baked_image_from).
|
|
71
|
+
*/
|
|
72
|
+
copyBakedImageFrom(handle: Handle, source: Handle): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Calls [`Proteus::create_video`](sdk::Proteus::create_video).
|
|
75
|
+
*/
|
|
76
|
+
createVideo(): VideoHandle;
|
|
77
|
+
/**
|
|
78
|
+
* Calls [`Handle::crop_image`](sdk::Handle::crop_image). Throws if
|
|
79
|
+
* `crop` isn't a valid `ImageCrop`.
|
|
80
|
+
*/
|
|
81
|
+
cropImage(handle: Handle, crop: any): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Calls [`Handle::destroy`](sdk::Handle::destroy). Consumes `handle`: the
|
|
84
|
+
* JavaScript object can't be used afterwards.
|
|
85
|
+
*/
|
|
86
|
+
destroy(handle: Handle): void;
|
|
87
|
+
/**
|
|
88
|
+
* Calls [`Handle::free_resources`](sdk::Handle::free_resources).
|
|
89
|
+
*/
|
|
90
|
+
freeResources(handle: Handle): void;
|
|
91
|
+
/**
|
|
92
|
+
* Calls [`Proteus::get`](sdk::Proteus::get). Returns `undefined` if the
|
|
93
|
+
* component has been destroyed.
|
|
94
|
+
*/
|
|
95
|
+
get(handle: Handle): any;
|
|
96
|
+
/**
|
|
97
|
+
* Calls [`Handle::hide_video`](sdk::Handle::hide_video).
|
|
98
|
+
*/
|
|
99
|
+
hideVideo(handle: Handle): void;
|
|
100
|
+
/**
|
|
101
|
+
* Calls [`Proteus::load_texture`](sdk::Proteus::load_texture). Returns
|
|
102
|
+
* `undefined` if the bytes can't be decoded.
|
|
103
|
+
*/
|
|
104
|
+
loadTexture(bytes: Uint8Array, request: any): TextureHandle | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Calls [`Handle::merge_from`](sdk::Handle::merge_from). The sources
|
|
107
|
+
* cross as handle IDs.
|
|
108
|
+
*/
|
|
109
|
+
mergeFrom(handle: Handle, source_ids: Float64Array, config: any, layout: any): void;
|
|
110
|
+
/**
|
|
111
|
+
* Calls [`Handle::merge_from_with_behavior`](sdk::Handle::merge_from_with_behavior).
|
|
112
|
+
* `child_behavior` is called once per source, before the merge starts.
|
|
113
|
+
*/
|
|
114
|
+
mergeFromWithBehavior(handle: Handle, source_ids: Float64Array, config: any, layout: any, child_behavior: Function): void;
|
|
115
|
+
/**
|
|
116
|
+
* Creates a standalone app, with no host, that draws nothing.
|
|
117
|
+
*/
|
|
118
|
+
constructor();
|
|
119
|
+
/**
|
|
120
|
+
* Calls [`Handle::on_blur`](sdk::Handle::on_blur).
|
|
121
|
+
*/
|
|
122
|
+
onBlur(handle: Handle, cb: Function): void;
|
|
123
|
+
/**
|
|
124
|
+
* Calls [`Handle::on_click`](sdk::Handle::on_click).
|
|
125
|
+
*/
|
|
126
|
+
onClick(handle: Handle, cb: Function): void;
|
|
127
|
+
/**
|
|
128
|
+
* Calls [`Handle::on_drag`](sdk::Handle::on_drag). `cb` receives the
|
|
129
|
+
* movement as two numbers, `x` and `y`.
|
|
130
|
+
*/
|
|
131
|
+
onDrag(handle: Handle, cb: Function): void;
|
|
132
|
+
/**
|
|
133
|
+
* Calls [`TransitionChannel::on_dropped`](sdk::TransitionChannel::on_dropped).
|
|
134
|
+
*/
|
|
135
|
+
onDropped(channel: TransitionChannel, cb: Function): void;
|
|
136
|
+
/**
|
|
137
|
+
* Calls [`Handle::on_focus`](sdk::Handle::on_focus).
|
|
138
|
+
*/
|
|
139
|
+
onFocus(handle: Handle, cb: Function): void;
|
|
140
|
+
/**
|
|
141
|
+
* Calls [`Handle::on_hover_enter`](sdk::Handle::on_hover_enter).
|
|
142
|
+
*/
|
|
143
|
+
onHoverEnter(handle: Handle, cb: Function): void;
|
|
144
|
+
/**
|
|
145
|
+
* Calls [`Handle::on_hover_exit`](sdk::Handle::on_hover_exit).
|
|
146
|
+
*/
|
|
147
|
+
onHoverExit(handle: Handle, cb: Function): void;
|
|
148
|
+
/**
|
|
149
|
+
* Calls [`Handle::on_press`](sdk::Handle::on_press).
|
|
150
|
+
*/
|
|
151
|
+
onPress(handle: Handle, cb: Function): void;
|
|
152
|
+
/**
|
|
153
|
+
* Calls [`Handle::on_release`](sdk::Handle::on_release).
|
|
154
|
+
*/
|
|
155
|
+
onRelease(handle: Handle, cb: Function): void;
|
|
156
|
+
/**
|
|
157
|
+
* Calls [`Handle::on_transition_complete`](sdk::Handle::on_transition_complete).
|
|
158
|
+
*/
|
|
159
|
+
onTransitionComplete(handle: Handle, cb: Function): void;
|
|
160
|
+
/**
|
|
161
|
+
* Records that the pointer left the viewport: `pointer_moved(None)`.
|
|
162
|
+
*/
|
|
163
|
+
pointerLeft(): void;
|
|
164
|
+
/**
|
|
165
|
+
* Calls [`Proteus::pointer_moved`](sdk::Proteus::pointer_moved). `x` and
|
|
166
|
+
* `y` are world units: origin at the viewport center, y up.
|
|
167
|
+
*/
|
|
168
|
+
pointerMoved(x: number, y: number): void;
|
|
169
|
+
/**
|
|
170
|
+
* Calls [`Proteus::pointer_pressed`](sdk::Proteus::pointer_pressed).
|
|
171
|
+
*/
|
|
172
|
+
pointerPressed(): void;
|
|
173
|
+
/**
|
|
174
|
+
* Calls [`Proteus::pointer_released`](sdk::Proteus::pointer_released).
|
|
175
|
+
*/
|
|
176
|
+
pointerReleased(): void;
|
|
177
|
+
/**
|
|
178
|
+
* Calls [`VideoHandle::release`](sdk::VideoHandle::release).
|
|
179
|
+
*/
|
|
180
|
+
releaseVideo(video: VideoHandle): void;
|
|
181
|
+
/**
|
|
182
|
+
* Calls [`Handle::remove_child`](sdk::Handle::remove_child).
|
|
183
|
+
*/
|
|
184
|
+
removeChild(parent: Handle, child: Handle): void;
|
|
185
|
+
/**
|
|
186
|
+
* Calls [`Handle::set_declared_geometry`](sdk::Handle::set_declared_geometry).
|
|
187
|
+
*/
|
|
188
|
+
setDeclaredGeometry(handle: Handle, state: any): void;
|
|
189
|
+
/**
|
|
190
|
+
* Calls [`Handle::set_disabled`](sdk::Handle::set_disabled).
|
|
191
|
+
*/
|
|
192
|
+
setDisabled(handle: Handle, disabled: boolean): void;
|
|
193
|
+
/**
|
|
194
|
+
* Calls [`Handle::set_image`](sdk::Handle::set_image).
|
|
195
|
+
*/
|
|
196
|
+
setImage(handle: Handle, image: any): void;
|
|
197
|
+
/**
|
|
198
|
+
* Calls [`Handle::set_interactive`](sdk::Handle::set_interactive).
|
|
199
|
+
*/
|
|
200
|
+
setInteractive(handle: Handle, interactive: boolean): void;
|
|
201
|
+
/**
|
|
202
|
+
* Calls [`Handle::set_opacity`](sdk::Handle::set_opacity).
|
|
203
|
+
*/
|
|
204
|
+
setOpacity(handle: Handle, opacity: number): void;
|
|
205
|
+
/**
|
|
206
|
+
* Calls [`Handle::set_text`](sdk::Handle::set_text).
|
|
207
|
+
*/
|
|
208
|
+
setText(handle: Handle, text: any): void;
|
|
209
|
+
/**
|
|
210
|
+
* Calls [`Handle::set_texture`](sdk::Handle::set_texture).
|
|
211
|
+
*/
|
|
212
|
+
setTexture(handle: Handle, texture: TextureHandle): boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Calls [`Handle::set_transition_interaction`](sdk::Handle::set_transition_interaction).
|
|
215
|
+
* `null` or `undefined` restores the default.
|
|
216
|
+
*/
|
|
217
|
+
setTransitionInteraction(handle: Handle, config: any): void;
|
|
218
|
+
/**
|
|
219
|
+
* Calls [`Handle::set_video_crossfade`](sdk::Handle::set_video_crossfade).
|
|
220
|
+
*/
|
|
221
|
+
setVideoCrossfade(handle: Handle, video_t: number): boolean;
|
|
222
|
+
/**
|
|
223
|
+
* Calls [`Handle::set_visible`](sdk::Handle::set_visible).
|
|
224
|
+
*/
|
|
225
|
+
setVisible(handle: Handle, visible: boolean): void;
|
|
226
|
+
/**
|
|
227
|
+
* Calls [`Handle::show_video`](sdk::Handle::show_video).
|
|
228
|
+
*/
|
|
229
|
+
showVideo(handle: Handle, video: VideoHandle): boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Calls [`Handle::split_to`](sdk::Handle::split_to). The targets cross
|
|
232
|
+
* as handle IDs.
|
|
233
|
+
*/
|
|
234
|
+
splitTo(handle: Handle, target_ids: Float64Array, config: any, strategy: any): void;
|
|
235
|
+
/**
|
|
236
|
+
* Calls [`Handle::split_to_with_behavior`](sdk::Handle::split_to_with_behavior).
|
|
237
|
+
* `child_behavior` is called once per target, before the split starts.
|
|
238
|
+
*/
|
|
239
|
+
splitToWithBehavior(handle: Handle, target_ids: Float64Array, config: any, strategy: any, child_behavior: Function): void;
|
|
240
|
+
/**
|
|
241
|
+
* Calls [`Handle::split_to_with_states`](sdk::Handle::split_to_with_states).
|
|
242
|
+
* `targets` is an array of `{ id, state }` objects.
|
|
243
|
+
*/
|
|
244
|
+
splitToWithStates(handle: Handle, targets: any, config: any, strategy: any): void;
|
|
245
|
+
/**
|
|
246
|
+
* Returns a texture handle for a texture ID.
|
|
247
|
+
*/
|
|
248
|
+
texture(id: number): TextureHandle;
|
|
249
|
+
/**
|
|
250
|
+
* Calls [`TextureHandle::state`](sdk::TextureHandle::state). Returns
|
|
251
|
+
* `undefined` if the texture has been evicted or never existed.
|
|
252
|
+
*/
|
|
253
|
+
textureState(handle: TextureHandle): any;
|
|
254
|
+
/**
|
|
255
|
+
* Calls [`Proteus::tick`](sdk::Proteus::tick). For a standalone app only:
|
|
256
|
+
* a host ticks the shared `Proteus` itself.
|
|
257
|
+
*/
|
|
258
|
+
tick(dt: number): void;
|
|
259
|
+
/**
|
|
260
|
+
* Calls [`Proteus::transition_channel`](sdk::Proteus::transition_channel).
|
|
261
|
+
* `owner` is a handle ID, since `wasm-bindgen` can't take an optional
|
|
262
|
+
* reference.
|
|
263
|
+
*/
|
|
264
|
+
transitionChannel(owner?: number | null): TransitionChannel;
|
|
265
|
+
/**
|
|
266
|
+
* Calls [`VideoHandle::upload_frame`](sdk::VideoHandle::upload_frame).
|
|
267
|
+
*/
|
|
268
|
+
uploadVideoFrame(video: VideoHandle, width: number, height: number, rgba: Uint8Array): boolean;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* A handle to a texture in the atlas.
|
|
273
|
+
*/
|
|
274
|
+
export class TextureHandle {
|
|
275
|
+
private constructor();
|
|
276
|
+
free(): void;
|
|
277
|
+
[Symbol.dispose](): void;
|
|
278
|
+
/**
|
|
279
|
+
* Returns a handle for an ID from [`JsTextureHandle::id`]. To add a
|
|
280
|
+
* texture, use `loadTexture` or `bakeTexture`.
|
|
281
|
+
*/
|
|
282
|
+
static fromId(id: number): TextureHandle;
|
|
283
|
+
/**
|
|
284
|
+
* The texture's ID, as a number. [`JsTextureHandle::from_id`] turns it
|
|
285
|
+
* back into a handle.
|
|
286
|
+
*/
|
|
287
|
+
id(): number;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* A handle to a transition channel. It has no methods of its own; it is
|
|
292
|
+
* passed to `channelSet`, `channelDestroy` and `onDropped`.
|
|
293
|
+
*/
|
|
294
|
+
export class TransitionChannel {
|
|
295
|
+
private constructor();
|
|
296
|
+
free(): void;
|
|
297
|
+
[Symbol.dispose](): void;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* A handle to a video whose frames the app supplies. It has no methods of
|
|
302
|
+
* its own; it is passed to `uploadVideoFrame`, `releaseVideo` and
|
|
303
|
+
* `showVideo`.
|
|
304
|
+
*/
|
|
305
|
+
export class VideoHandle {
|
|
306
|
+
private constructor();
|
|
307
|
+
free(): void;
|
|
308
|
+
[Symbol.dispose](): void;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Runs a JavaScript app on the `<canvas>` element with the given `id`.
|
|
313
|
+
*
|
|
314
|
+
* Calls `setup(app)` once, before the first frame, then `update(dtSeconds)`
|
|
315
|
+
* every frame if it is given. To use the app in `update`, keep the one
|
|
316
|
+
* passed to `setup`. `config` is a `ProteusConfigDto` object, or `null`.
|
|
317
|
+
*
|
|
318
|
+
* # Errors
|
|
319
|
+
*
|
|
320
|
+
* Throws if the canvas isn't found, the GPU can't be set up, or `config`
|
|
321
|
+
* is invalid.
|
|
322
|
+
*/
|
|
323
|
+
export function mount(canvas_id: string, setup: Function, update: Function | null | undefined, config: any): Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* @ts-self-types="./proteus_host_web.d.ts" */
|
|
2
|
+
import * as wasm from "./proteus_host_web_bg.wasm";
|
|
3
|
+
import { __wbg_set_wasm } from "./proteus_host_web_bg.js";
|
|
4
|
+
|
|
5
|
+
__wbg_set_wasm(wasm);
|
|
6
|
+
wasm.__wbindgen_start();
|
|
7
|
+
export {
|
|
8
|
+
Handle, ProteusApp, TextureHandle, TransitionChannel, VideoHandle, mount
|
|
9
|
+
} from "./proteus_host_web_bg.js";
|