@open-artifact/wasm-canvas 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.
@@ -0,0 +1,172 @@
1
+ // Generated by scripts/build-wasm.mjs from crates/open-artifact-canvas. Do not edit.
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+
5
+ export class CanvasCore {
6
+ free(): void;
7
+ [Symbol.dispose](): void;
8
+ /**
9
+ * Applies a patch: REC f64s per record plus the path command stream.
10
+ */
11
+ apply(ops: Float64Array, paths: Float32Array): void;
12
+ /**
13
+ * [x, y, zoom, width, height, dpr, minZoom, maxZoom, moving]
14
+ */
15
+ camera(): Float64Array;
16
+ cancel_gesture(): void;
17
+ context_lost(): void;
18
+ context_restored(gl: WebGL2RenderingContext): void;
19
+ cursor(): number;
20
+ /**
21
+ * Advances and draws one frame. Returns FRAME_* bits (1 drew, 2 wants another, 4 holes changed).
22
+ */
23
+ frame(now: number): number;
24
+ glide_to(x: number, y: number, w: number, h: number, duration: number, padding: number, max_zoom: number): void;
25
+ has_events(): boolean;
26
+ /**
27
+ * The resize handle at a screen point: [item, handle edges (1 left, 2 right, 4 top, 8 bottom)], or empty.
28
+ */
29
+ hit_handle(x: number, y: number): Uint32Array;
30
+ /**
31
+ * Topmost hittable item at a screen point, or -1.
32
+ */
33
+ hit_test(x: number, y: number): number;
34
+ /**
35
+ * Visible holes: [handle, x, y, w, h, rotation, zoom] each, in CSS pixels.
36
+ */
37
+ holes(): Float32Array;
38
+ /**
39
+ * [x, y, w, h, rotation] of an item as the engine has it now, or empty.
40
+ */
41
+ item_rect(id: number): Float64Array;
42
+ key(code: number, down: boolean, mods: number): boolean;
43
+ /**
44
+ * Largest texture side the atlas accepts (sources above it must be scaled down).
45
+ */
46
+ max_texture_side(): number;
47
+ /**
48
+ * `gl` None runs headless: everything but drawing (for tests and tools).
49
+ */
50
+ constructor(gl: WebGL2RenderingContext | null | undefined, width: number, height: number, dpr: number);
51
+ pan_by(dx: number, dy: number): void;
52
+ pointer_cancel(pid: number): void;
53
+ pointer_down(pid: number, x: number, y: number, button: number, mods: number, ptype: number): boolean;
54
+ /**
55
+ * A double click (`kind` 0) or context menu (1) at a screen point: reported as an event with the item under it.
56
+ */
57
+ pointer_event(kind: number, x: number, y: number, mods: number): void;
58
+ pointer_leave(): void;
59
+ pointer_move(pid: number, x: number, y: number, buttons: number, mods: number): boolean;
60
+ pointer_up(pid: number, x: number, y: number, button: number, mods: number): boolean;
61
+ /**
62
+ * Items whose bounds meet a world rect.
63
+ */
64
+ query_rect(x: number, y: number, w: number, h: number): Uint32Array;
65
+ remove_texture(key: number): void;
66
+ resize(width: number, height: number, dpr: number): void;
67
+ selection(): Uint32Array;
68
+ set_camera(x: number, y: number, zoom: number): void;
69
+ set_option(key: number, value: number): void;
70
+ /**
71
+ * Peers: [color, hasCursor, x, y, n, ...n ids] per peer.
72
+ */
73
+ set_peers(data: Float64Array): void;
74
+ set_selection(ids: Uint32Array): void;
75
+ /**
76
+ * Stores texture `key`: one source per (w, h) pair in `sizes`. Returns a bit per
77
+ * resolution that found room in the atlas.
78
+ */
79
+ set_texture(key: number, sources: Array<any>, sizes: Uint32Array): number;
80
+ set_tool(tool: number): void;
81
+ /**
82
+ * Starts moving item `id` from a press the host received; pointer `pid` drives it from here.
83
+ */
84
+ start_move(pid: number, x: number, y: number, id: number, mods: number): boolean;
85
+ /**
86
+ * [items, visible, drawCalls, textures, textureBytes, atlasLayers, quads, pathVertices, pathIndices, batches, holesVisible, maxAtlasLayers]
87
+ */
88
+ stats(): Float64Array;
89
+ /**
90
+ * Pending events as a JSON array (then cleared).
91
+ */
92
+ take_events(): string;
93
+ tool(): number;
94
+ wheel(x: number, y: number, dx: number, dy: number, mods: number): boolean;
95
+ zoom_at(factor: number, x: number, y: number): void;
96
+ }
97
+
98
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
99
+
100
+ export interface InitOutput {
101
+ readonly memory: WebAssembly.Memory;
102
+ readonly __wbg_canvascore_free: (a: number, b: number) => void;
103
+ readonly canvascore_apply: (a: number, b: number, c: number, d: number, e: number) => void;
104
+ readonly canvascore_camera: (a: number) => [number, number];
105
+ readonly canvascore_cancel_gesture: (a: number) => void;
106
+ readonly canvascore_context_lost: (a: number) => void;
107
+ readonly canvascore_context_restored: (a: number, b: any) => [number, number];
108
+ readonly canvascore_cursor: (a: number) => number;
109
+ readonly canvascore_frame: (a: number, b: number) => number;
110
+ readonly canvascore_glide_to: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
111
+ readonly canvascore_has_events: (a: number) => number;
112
+ readonly canvascore_hit_handle: (a: number, b: number, c: number) => [number, number];
113
+ readonly canvascore_hit_test: (a: number, b: number, c: number) => number;
114
+ readonly canvascore_holes: (a: number) => [number, number];
115
+ readonly canvascore_item_rect: (a: number, b: number) => [number, number];
116
+ readonly canvascore_key: (a: number, b: number, c: number, d: number) => number;
117
+ readonly canvascore_max_texture_side: (a: number) => number;
118
+ readonly canvascore_new: (a: number, b: number, c: number, d: number) => [number, number, number];
119
+ readonly canvascore_pan_by: (a: number, b: number, c: number) => void;
120
+ readonly canvascore_pointer_cancel: (a: number, b: number) => void;
121
+ readonly canvascore_pointer_down: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number;
122
+ readonly canvascore_pointer_event: (a: number, b: number, c: number, d: number, e: number) => void;
123
+ readonly canvascore_pointer_leave: (a: number) => void;
124
+ readonly canvascore_pointer_move: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
125
+ readonly canvascore_pointer_up: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
126
+ readonly canvascore_query_rect: (a: number, b: number, c: number, d: number, e: number) => [number, number];
127
+ readonly canvascore_remove_texture: (a: number, b: number) => void;
128
+ readonly canvascore_resize: (a: number, b: number, c: number, d: number) => void;
129
+ readonly canvascore_selection: (a: number) => [number, number];
130
+ readonly canvascore_set_camera: (a: number, b: number, c: number, d: number) => void;
131
+ readonly canvascore_set_option: (a: number, b: number, c: number) => void;
132
+ readonly canvascore_set_peers: (a: number, b: number, c: number) => void;
133
+ readonly canvascore_set_selection: (a: number, b: number, c: number) => void;
134
+ readonly canvascore_set_texture: (a: number, b: number, c: any, d: number, e: number) => [number, number, number];
135
+ readonly canvascore_set_tool: (a: number, b: number) => void;
136
+ readonly canvascore_start_move: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
137
+ readonly canvascore_stats: (a: number) => [number, number];
138
+ readonly canvascore_take_events: (a: number) => [number, number];
139
+ readonly canvascore_tool: (a: number) => number;
140
+ readonly canvascore_wheel: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
141
+ readonly canvascore_zoom_at: (a: number, b: number, c: number, d: number) => void;
142
+ readonly __externref_table_alloc: () => number;
143
+ readonly __wbindgen_externrefs: WebAssembly.Table;
144
+ readonly __wbindgen_exn_store: (a: number) => void;
145
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
146
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
147
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
148
+ readonly __externref_table_dealloc: (a: number) => void;
149
+ readonly __wbindgen_start: () => void;
150
+ }
151
+
152
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
153
+
154
+ /**
155
+ * Instantiates the given `module`, which can either be bytes or
156
+ * a precompiled `WebAssembly.Module`.
157
+ *
158
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
159
+ *
160
+ * @returns {InitOutput}
161
+ */
162
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
163
+
164
+ /**
165
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
166
+ * for everything else, calls `WebAssembly.instantiate` directly.
167
+ *
168
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
169
+ *
170
+ * @returns {Promise<InitOutput>}
171
+ */
172
+ export default function __wbg_init (module_or_path: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;