@wasi-gfx/js-webgpu 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 +26 -0
- package/dist/index.js +1665 -0
- package/package.json +35 -0
- package/types/interfaces/wasi-cli-run.d.ts +5 -0
- package/types/interfaces/wasi-cli-stdout.d.ts +3 -0
- package/types/interfaces/wasi-frame-buffer-frame-buffer.d.ts +21 -0
- package/types/interfaces/wasi-graphics-context-graphics-context.d.ts +17 -0
- package/types/interfaces/wasi-io-error.d.ts +18 -0
- package/types/interfaces/wasi-io-poll.d.ts +43 -0
- package/types/interfaces/wasi-io-streams.d.ts +240 -0
- package/types/interfaces/wasi-surface-surface.d.ts +400 -0
- package/types/interfaces/wasi-webgpu-webgpu.d.ts +1636 -0
- package/types/wit.d.ts +10 -0
- package/wit/deps/cli/command.wit +7 -0
- package/wit/deps/cli/environment.wit +18 -0
- package/wit/deps/cli/exit.wit +4 -0
- package/wit/deps/cli/imports.wit +20 -0
- package/wit/deps/cli/run.wit +4 -0
- package/wit/deps/cli/stdio.wit +17 -0
- package/wit/deps/cli/terminal.wit +49 -0
- package/wit/deps/clocks/monotonic-clock.wit +45 -0
- package/wit/deps/clocks/wall-clock.wit +42 -0
- package/wit/deps/clocks/world.wit +6 -0
- package/wit/deps/filesystem/preopens.wit +8 -0
- package/wit/deps/filesystem/types.wit +634 -0
- package/wit/deps/filesystem/world.wit +6 -0
- package/wit/deps/frame-buffer/frame-buffer.wit +23 -0
- package/wit/deps/graphics-context/graphics-context.wit +18 -0
- package/wit/deps/io/error.wit +34 -0
- package/wit/deps/io/poll.wit +41 -0
- package/wit/deps/io/streams.wit +262 -0
- package/wit/deps/io/world.wit +6 -0
- package/wit/deps/random/insecure-seed.wit +25 -0
- package/wit/deps/random/insecure.wit +22 -0
- package/wit/deps/random/random.wit +26 -0
- package/wit/deps/random/world.wit +7 -0
- package/wit/deps/sockets/instance-network.wit +9 -0
- package/wit/deps/sockets/ip-name-lookup.wit +51 -0
- package/wit/deps/sockets/network.wit +145 -0
- package/wit/deps/sockets/tcp-create-socket.wit +27 -0
- package/wit/deps/sockets/tcp.wit +353 -0
- package/wit/deps/sockets/udp-create-socket.wit +27 -0
- package/wit/deps/sockets/udp.wit +266 -0
- package/wit/deps/sockets/world.wit +11 -0
- package/wit/deps/surface/surface.wit +248 -0
- package/wit/deps/webgpu/imports.wit +5 -0
- package/wit/deps/webgpu/webgpu.wit +1085 -0
- package/wit/deps.lock +51 -0
- package/wit/deps.toml +18 -0
- package/wit/world.wit +10 -0
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
/** @module Interface wasi:surface/surface@0.0.1 **/
|
|
2
|
+
export type Context = import('./wasi-graphics-context-graphics-context.js').Context;
|
|
3
|
+
export type Pollable = import('./wasi-io-poll.js').Pollable;
|
|
4
|
+
export interface CreateDesc {
|
|
5
|
+
height?: number,
|
|
6
|
+
width?: number,
|
|
7
|
+
}
|
|
8
|
+
export interface ResizeEvent {
|
|
9
|
+
height: number,
|
|
10
|
+
width: number,
|
|
11
|
+
}
|
|
12
|
+
export interface FrameEvent {
|
|
13
|
+
/**
|
|
14
|
+
* TODO: This field doesn't mean anything.
|
|
15
|
+
* Can't have empty record. Would like to have a way around this.
|
|
16
|
+
*/
|
|
17
|
+
nothing: boolean,
|
|
18
|
+
}
|
|
19
|
+
export interface PointerEvent {
|
|
20
|
+
x: number,
|
|
21
|
+
y: number,
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* corresponds with https://w3c.github.io/uievents-code/#code-value-tables
|
|
25
|
+
* `Unidentified` is not included, use `option<key>` instead.
|
|
26
|
+
* # Variants
|
|
27
|
+
*
|
|
28
|
+
* ## `"backquote"`
|
|
29
|
+
*
|
|
30
|
+
* ## `"backslash"`
|
|
31
|
+
*
|
|
32
|
+
* ## `"bracket-left"`
|
|
33
|
+
*
|
|
34
|
+
* ## `"bracket-right"`
|
|
35
|
+
*
|
|
36
|
+
* ## `"comma"`
|
|
37
|
+
*
|
|
38
|
+
* ## `"digit0"`
|
|
39
|
+
*
|
|
40
|
+
* ## `"digit1"`
|
|
41
|
+
*
|
|
42
|
+
* ## `"digit2"`
|
|
43
|
+
*
|
|
44
|
+
* ## `"digit3"`
|
|
45
|
+
*
|
|
46
|
+
* ## `"digit4"`
|
|
47
|
+
*
|
|
48
|
+
* ## `"digit5"`
|
|
49
|
+
*
|
|
50
|
+
* ## `"digit6"`
|
|
51
|
+
*
|
|
52
|
+
* ## `"digit7"`
|
|
53
|
+
*
|
|
54
|
+
* ## `"digit8"`
|
|
55
|
+
*
|
|
56
|
+
* ## `"digit9"`
|
|
57
|
+
*
|
|
58
|
+
* ## `"equal"`
|
|
59
|
+
*
|
|
60
|
+
* ## `"intl-backslash"`
|
|
61
|
+
*
|
|
62
|
+
* ## `"intl-ro"`
|
|
63
|
+
*
|
|
64
|
+
* ## `"intl-yen"`
|
|
65
|
+
*
|
|
66
|
+
* ## `"key-a"`
|
|
67
|
+
*
|
|
68
|
+
* ## `"key-b"`
|
|
69
|
+
*
|
|
70
|
+
* ## `"key-c"`
|
|
71
|
+
*
|
|
72
|
+
* ## `"key-d"`
|
|
73
|
+
*
|
|
74
|
+
* ## `"key-e"`
|
|
75
|
+
*
|
|
76
|
+
* ## `"key-f"`
|
|
77
|
+
*
|
|
78
|
+
* ## `"key-g"`
|
|
79
|
+
*
|
|
80
|
+
* ## `"key-h"`
|
|
81
|
+
*
|
|
82
|
+
* ## `"key-i"`
|
|
83
|
+
*
|
|
84
|
+
* ## `"key-j"`
|
|
85
|
+
*
|
|
86
|
+
* ## `"key-k"`
|
|
87
|
+
*
|
|
88
|
+
* ## `"key-l"`
|
|
89
|
+
*
|
|
90
|
+
* ## `"key-m"`
|
|
91
|
+
*
|
|
92
|
+
* ## `"key-n"`
|
|
93
|
+
*
|
|
94
|
+
* ## `"key-o"`
|
|
95
|
+
*
|
|
96
|
+
* ## `"key-p"`
|
|
97
|
+
*
|
|
98
|
+
* ## `"key-q"`
|
|
99
|
+
*
|
|
100
|
+
* ## `"key-r"`
|
|
101
|
+
*
|
|
102
|
+
* ## `"key-s"`
|
|
103
|
+
*
|
|
104
|
+
* ## `"key-t"`
|
|
105
|
+
*
|
|
106
|
+
* ## `"key-u"`
|
|
107
|
+
*
|
|
108
|
+
* ## `"key-v"`
|
|
109
|
+
*
|
|
110
|
+
* ## `"key-w"`
|
|
111
|
+
*
|
|
112
|
+
* ## `"key-x"`
|
|
113
|
+
*
|
|
114
|
+
* ## `"key-y"`
|
|
115
|
+
*
|
|
116
|
+
* ## `"key-z"`
|
|
117
|
+
*
|
|
118
|
+
* ## `"minus"`
|
|
119
|
+
*
|
|
120
|
+
* ## `"period"`
|
|
121
|
+
*
|
|
122
|
+
* ## `"quote"`
|
|
123
|
+
*
|
|
124
|
+
* ## `"semicolon"`
|
|
125
|
+
*
|
|
126
|
+
* ## `"slash"`
|
|
127
|
+
*
|
|
128
|
+
* ## `"alt-left"`
|
|
129
|
+
*
|
|
130
|
+
* ## `"alt-right"`
|
|
131
|
+
*
|
|
132
|
+
* ## `"backspace"`
|
|
133
|
+
*
|
|
134
|
+
* ## `"caps-lock"`
|
|
135
|
+
*
|
|
136
|
+
* ## `"context-menu"`
|
|
137
|
+
*
|
|
138
|
+
* ## `"control-left"`
|
|
139
|
+
*
|
|
140
|
+
* ## `"control-right"`
|
|
141
|
+
*
|
|
142
|
+
* ## `"enter"`
|
|
143
|
+
*
|
|
144
|
+
* ## `"meta-left"`
|
|
145
|
+
*
|
|
146
|
+
* ## `"meta-right"`
|
|
147
|
+
*
|
|
148
|
+
* ## `"shift-left"`
|
|
149
|
+
*
|
|
150
|
+
* ## `"shift-right"`
|
|
151
|
+
*
|
|
152
|
+
* ## `"space"`
|
|
153
|
+
*
|
|
154
|
+
* ## `"tab"`
|
|
155
|
+
*
|
|
156
|
+
* ## `"convert"`
|
|
157
|
+
*
|
|
158
|
+
* ## `"kana-mode"`
|
|
159
|
+
*
|
|
160
|
+
* ## `"lang1"`
|
|
161
|
+
*
|
|
162
|
+
* ## `"lang2"`
|
|
163
|
+
*
|
|
164
|
+
* ## `"lang3"`
|
|
165
|
+
*
|
|
166
|
+
* ## `"lang4"`
|
|
167
|
+
*
|
|
168
|
+
* ## `"lang5"`
|
|
169
|
+
*
|
|
170
|
+
* ## `"non-convert"`
|
|
171
|
+
*
|
|
172
|
+
* ## `"delete"`
|
|
173
|
+
*
|
|
174
|
+
* ## `"end"`
|
|
175
|
+
*
|
|
176
|
+
* ## `"help"`
|
|
177
|
+
*
|
|
178
|
+
* ## `"home"`
|
|
179
|
+
*
|
|
180
|
+
* ## `"insert"`
|
|
181
|
+
*
|
|
182
|
+
* ## `"page-down"`
|
|
183
|
+
*
|
|
184
|
+
* ## `"page-up"`
|
|
185
|
+
*
|
|
186
|
+
* ## `"arrow-down"`
|
|
187
|
+
*
|
|
188
|
+
* ## `"arrow-left"`
|
|
189
|
+
*
|
|
190
|
+
* ## `"arrow-right"`
|
|
191
|
+
*
|
|
192
|
+
* ## `"arrow-up"`
|
|
193
|
+
*
|
|
194
|
+
* ## `"num-lock"`
|
|
195
|
+
*
|
|
196
|
+
* ## `"numpad0"`
|
|
197
|
+
*
|
|
198
|
+
* ## `"numpad1"`
|
|
199
|
+
*
|
|
200
|
+
* ## `"numpad2"`
|
|
201
|
+
*
|
|
202
|
+
* ## `"numpad3"`
|
|
203
|
+
*
|
|
204
|
+
* ## `"numpad4"`
|
|
205
|
+
*
|
|
206
|
+
* ## `"numpad5"`
|
|
207
|
+
*
|
|
208
|
+
* ## `"numpad6"`
|
|
209
|
+
*
|
|
210
|
+
* ## `"numpad7"`
|
|
211
|
+
*
|
|
212
|
+
* ## `"numpad8"`
|
|
213
|
+
*
|
|
214
|
+
* ## `"numpad9"`
|
|
215
|
+
*
|
|
216
|
+
* ## `"numpad-add"`
|
|
217
|
+
*
|
|
218
|
+
* ## `"numpad-backspace"`
|
|
219
|
+
*
|
|
220
|
+
* ## `"numpad-clear"`
|
|
221
|
+
*
|
|
222
|
+
* ## `"numpad-clear-entry"`
|
|
223
|
+
*
|
|
224
|
+
* ## `"numpad-comma"`
|
|
225
|
+
*
|
|
226
|
+
* ## `"numpad-decimal"`
|
|
227
|
+
*
|
|
228
|
+
* ## `"numpad-divide"`
|
|
229
|
+
*
|
|
230
|
+
* ## `"numpad-enter"`
|
|
231
|
+
*
|
|
232
|
+
* ## `"numpad-equal"`
|
|
233
|
+
*
|
|
234
|
+
* ## `"numpad-hash"`
|
|
235
|
+
*
|
|
236
|
+
* ## `"numpad-memory-add"`
|
|
237
|
+
*
|
|
238
|
+
* ## `"numpad-memory-clear"`
|
|
239
|
+
*
|
|
240
|
+
* ## `"numpad-memory-recall"`
|
|
241
|
+
*
|
|
242
|
+
* ## `"numpad-memory-store"`
|
|
243
|
+
*
|
|
244
|
+
* ## `"numpad-memory-subtract"`
|
|
245
|
+
*
|
|
246
|
+
* ## `"numpad-multiply"`
|
|
247
|
+
*
|
|
248
|
+
* ## `"numpad-paren-left"`
|
|
249
|
+
*
|
|
250
|
+
* ## `"numpad-paren-right"`
|
|
251
|
+
*
|
|
252
|
+
* ## `"numpad-star"`
|
|
253
|
+
*
|
|
254
|
+
* ## `"numpad-subtract"`
|
|
255
|
+
*
|
|
256
|
+
* ## `"escape"`
|
|
257
|
+
*
|
|
258
|
+
* ## `"f1"`
|
|
259
|
+
*
|
|
260
|
+
* ## `"f2"`
|
|
261
|
+
*
|
|
262
|
+
* ## `"f3"`
|
|
263
|
+
*
|
|
264
|
+
* ## `"f4"`
|
|
265
|
+
*
|
|
266
|
+
* ## `"f5"`
|
|
267
|
+
*
|
|
268
|
+
* ## `"f6"`
|
|
269
|
+
*
|
|
270
|
+
* ## `"f7"`
|
|
271
|
+
*
|
|
272
|
+
* ## `"f8"`
|
|
273
|
+
*
|
|
274
|
+
* ## `"f9"`
|
|
275
|
+
*
|
|
276
|
+
* ## `"f10"`
|
|
277
|
+
*
|
|
278
|
+
* ## `"f11"`
|
|
279
|
+
*
|
|
280
|
+
* ## `"f12"`
|
|
281
|
+
*
|
|
282
|
+
* ## `"fn"`
|
|
283
|
+
*
|
|
284
|
+
* ## `"fn-lock"`
|
|
285
|
+
*
|
|
286
|
+
* ## `"print-screen"`
|
|
287
|
+
*
|
|
288
|
+
* ## `"scroll-lock"`
|
|
289
|
+
*
|
|
290
|
+
* ## `"pause"`
|
|
291
|
+
*
|
|
292
|
+
* ## `"browser-back"`
|
|
293
|
+
*
|
|
294
|
+
* ## `"browser-favorites"`
|
|
295
|
+
*
|
|
296
|
+
* ## `"browser-forward"`
|
|
297
|
+
*
|
|
298
|
+
* ## `"browser-home"`
|
|
299
|
+
*
|
|
300
|
+
* ## `"browser-refresh"`
|
|
301
|
+
*
|
|
302
|
+
* ## `"browser-search"`
|
|
303
|
+
*
|
|
304
|
+
* ## `"browser-stop"`
|
|
305
|
+
*
|
|
306
|
+
* ## `"eject"`
|
|
307
|
+
*
|
|
308
|
+
* ## `"launch-app1"`
|
|
309
|
+
*
|
|
310
|
+
* ## `"launch-app2"`
|
|
311
|
+
*
|
|
312
|
+
* ## `"launch-mail"`
|
|
313
|
+
*
|
|
314
|
+
* ## `"media-play-pause"`
|
|
315
|
+
*
|
|
316
|
+
* ## `"media-select"`
|
|
317
|
+
*
|
|
318
|
+
* ## `"media-stop"`
|
|
319
|
+
*
|
|
320
|
+
* ## `"media-track-next"`
|
|
321
|
+
*
|
|
322
|
+
* ## `"media-track-previous"`
|
|
323
|
+
*
|
|
324
|
+
* ## `"power"`
|
|
325
|
+
*
|
|
326
|
+
* ## `"sleep"`
|
|
327
|
+
*
|
|
328
|
+
* ## `"audio-volume-down"`
|
|
329
|
+
*
|
|
330
|
+
* ## `"audio-volume-mute"`
|
|
331
|
+
*
|
|
332
|
+
* ## `"audio-volume-up"`
|
|
333
|
+
*
|
|
334
|
+
* ## `"wake-up"`
|
|
335
|
+
*
|
|
336
|
+
* ## `"hyper"`
|
|
337
|
+
*
|
|
338
|
+
* ## `"super"`
|
|
339
|
+
*
|
|
340
|
+
* ## `"turbo"`
|
|
341
|
+
*
|
|
342
|
+
* ## `"abort"`
|
|
343
|
+
*
|
|
344
|
+
* ## `"resume"`
|
|
345
|
+
*
|
|
346
|
+
* ## `"suspend"`
|
|
347
|
+
*
|
|
348
|
+
* ## `"again"`
|
|
349
|
+
*
|
|
350
|
+
* ## `"copy"`
|
|
351
|
+
*
|
|
352
|
+
* ## `"cut"`
|
|
353
|
+
*
|
|
354
|
+
* ## `"find"`
|
|
355
|
+
*
|
|
356
|
+
* ## `"open"`
|
|
357
|
+
*
|
|
358
|
+
* ## `"paste"`
|
|
359
|
+
*
|
|
360
|
+
* ## `"props"`
|
|
361
|
+
*
|
|
362
|
+
* ## `"select"`
|
|
363
|
+
*
|
|
364
|
+
* ## `"undo"`
|
|
365
|
+
*
|
|
366
|
+
* ## `"hiragana"`
|
|
367
|
+
*
|
|
368
|
+
* ## `"katakana"`
|
|
369
|
+
*/
|
|
370
|
+
export type Key = 'backquote' | 'backslash' | 'bracket-left' | 'bracket-right' | 'comma' | 'digit0' | 'digit1' | 'digit2' | 'digit3' | 'digit4' | 'digit5' | 'digit6' | 'digit7' | 'digit8' | 'digit9' | 'equal' | 'intl-backslash' | 'intl-ro' | 'intl-yen' | 'key-a' | 'key-b' | 'key-c' | 'key-d' | 'key-e' | 'key-f' | 'key-g' | 'key-h' | 'key-i' | 'key-j' | 'key-k' | 'key-l' | 'key-m' | 'key-n' | 'key-o' | 'key-p' | 'key-q' | 'key-r' | 'key-s' | 'key-t' | 'key-u' | 'key-v' | 'key-w' | 'key-x' | 'key-y' | 'key-z' | 'minus' | 'period' | 'quote' | 'semicolon' | 'slash' | 'alt-left' | 'alt-right' | 'backspace' | 'caps-lock' | 'context-menu' | 'control-left' | 'control-right' | 'enter' | 'meta-left' | 'meta-right' | 'shift-left' | 'shift-right' | 'space' | 'tab' | 'convert' | 'kana-mode' | 'lang1' | 'lang2' | 'lang3' | 'lang4' | 'lang5' | 'non-convert' | 'delete' | 'end' | 'help' | 'home' | 'insert' | 'page-down' | 'page-up' | 'arrow-down' | 'arrow-left' | 'arrow-right' | 'arrow-up' | 'num-lock' | 'numpad0' | 'numpad1' | 'numpad2' | 'numpad3' | 'numpad4' | 'numpad5' | 'numpad6' | 'numpad7' | 'numpad8' | 'numpad9' | 'numpad-add' | 'numpad-backspace' | 'numpad-clear' | 'numpad-clear-entry' | 'numpad-comma' | 'numpad-decimal' | 'numpad-divide' | 'numpad-enter' | 'numpad-equal' | 'numpad-hash' | 'numpad-memory-add' | 'numpad-memory-clear' | 'numpad-memory-recall' | 'numpad-memory-store' | 'numpad-memory-subtract' | 'numpad-multiply' | 'numpad-paren-left' | 'numpad-paren-right' | 'numpad-star' | 'numpad-subtract' | 'escape' | 'f1' | 'f2' | 'f3' | 'f4' | 'f5' | 'f6' | 'f7' | 'f8' | 'f9' | 'f10' | 'f11' | 'f12' | 'fn' | 'fn-lock' | 'print-screen' | 'scroll-lock' | 'pause' | 'browser-back' | 'browser-favorites' | 'browser-forward' | 'browser-home' | 'browser-refresh' | 'browser-search' | 'browser-stop' | 'eject' | 'launch-app1' | 'launch-app2' | 'launch-mail' | 'media-play-pause' | 'media-select' | 'media-stop' | 'media-track-next' | 'media-track-previous' | 'power' | 'sleep' | 'audio-volume-down' | 'audio-volume-mute' | 'audio-volume-up' | 'wake-up' | 'hyper' | 'super' | 'turbo' | 'abort' | 'resume' | 'suspend' | 'again' | 'copy' | 'cut' | 'find' | 'open' | 'paste' | 'props' | 'select' | 'undo' | 'hiragana' | 'katakana';
|
|
371
|
+
export interface KeyEvent {
|
|
372
|
+
key?: Key,
|
|
373
|
+
text?: string,
|
|
374
|
+
altKey: boolean,
|
|
375
|
+
ctrlKey: boolean,
|
|
376
|
+
metaKey: boolean,
|
|
377
|
+
shiftKey: boolean,
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export class Surface {
|
|
381
|
+
constructor(desc: CreateDesc)
|
|
382
|
+
connectGraphicsContext(context: Context): void;
|
|
383
|
+
height(): number;
|
|
384
|
+
width(): number;
|
|
385
|
+
requestSetSize(height: number | undefined, width: number | undefined): void;
|
|
386
|
+
subscribeResize(): Pollable;
|
|
387
|
+
getResize(): ResizeEvent | undefined;
|
|
388
|
+
subscribeFrame(): Pollable;
|
|
389
|
+
getFrame(): FrameEvent | undefined;
|
|
390
|
+
subscribePointerUp(): Pollable;
|
|
391
|
+
getPointerUp(): PointerEvent | undefined;
|
|
392
|
+
subscribePointerDown(): Pollable;
|
|
393
|
+
getPointerDown(): PointerEvent | undefined;
|
|
394
|
+
subscribePointerMove(): Pollable;
|
|
395
|
+
getPointerMove(): PointerEvent | undefined;
|
|
396
|
+
subscribeKeyUp(): Pollable;
|
|
397
|
+
getKeyUp(): KeyEvent | undefined;
|
|
398
|
+
subscribeKeyDown(): Pollable;
|
|
399
|
+
getKeyDown(): KeyEvent | undefined;
|
|
400
|
+
}
|