package wasi-gfx:surface@0.2.0; world imports { import surface; } interface surface { record create-desc { height: option, width: option, } resource surface { constructor(desc: create-desc); height: func() -> u32; width: func() -> u32; request-set-size: func(height: option, width: option); on-resize: func() -> stream; on-frame: func() -> stream; on-pointer-up: func() -> stream; on-pointer-down: func() -> stream; on-pointer-move: func() -> stream; on-key-up: func() -> stream; on-key-down: func() -> stream; } record resize-event { height: u32, width: u32, } record frame-event { /// TODO: This field doesn't mean anything. /// Can't have empty record. Would like to have a way around this. nothing: bool, } record pointer-event { x: f64, y: f64, } record key-event { key: option, text: option, alt-key: bool, ctrl-key: bool, meta-key: bool, shift-key: bool, } // corresponds with https://w3c.github.io/uievents-code/#code-value-tables // `Unidentified` is not included, use `option` instead. enum 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, } }