2019-04-28 01:15:43 +00:00
|
|
|
[package]
|
2019-05-08 16:46:19 +00:00
|
|
|
name = "ruffle_web"
|
2020-05-26 13:57:28 +00:00
|
|
|
description = "Web (WASM) bindings to the Ruffle flash player"
|
2022-12-16 23:09:19 +00:00
|
|
|
authors.workspace = true
|
|
|
|
edition.workspace = true
|
|
|
|
homepage.workspace = true
|
|
|
|
license.workspace = true
|
|
|
|
repository.workspace = true
|
|
|
|
version.workspace = true
|
2020-05-26 13:57:28 +00:00
|
|
|
publish = false # This crate is useless alone, people should use the npm package
|
2019-04-28 01:15:43 +00:00
|
|
|
|
2024-01-04 21:30:32 +00:00
|
|
|
[lints]
|
|
|
|
workspace = true
|
|
|
|
|
2019-04-28 01:15:43 +00:00
|
|
|
[lib]
|
|
|
|
crate-type = ["cdylib", "rlib"]
|
|
|
|
|
2019-04-28 06:08:59 +00:00
|
|
|
[features]
|
2024-01-16 21:35:43 +00:00
|
|
|
default = ["canvas", "console_error_panic_hook", "webgl", "wgpu-webgl", "webgpu"]
|
2021-04-21 07:22:42 +00:00
|
|
|
|
|
|
|
# core features
|
2020-07-23 17:32:22 +00:00
|
|
|
avm_debug = ["ruffle_core/avm_debug"]
|
2021-04-21 07:22:42 +00:00
|
|
|
lzma = ["ruffle_core/lzma"]
|
2023-10-15 15:25:30 +00:00
|
|
|
jpegxr = ["ruffle_core/jpegxr"]
|
2021-04-21 07:22:42 +00:00
|
|
|
|
|
|
|
# web features
|
2020-05-02 09:59:13 +00:00
|
|
|
canvas = ["ruffle_render_canvas"]
|
|
|
|
webgl = ["ruffle_render_webgl"]
|
2022-08-29 04:57:18 +00:00
|
|
|
webgpu = ["ruffle_render_wgpu"]
|
|
|
|
wgpu-webgl = ["ruffle_render_wgpu", "ruffle_render_wgpu/webgl"]
|
2023-03-03 15:28:58 +00:00
|
|
|
profiling = []
|
2019-04-28 06:08:59 +00:00
|
|
|
|
2019-04-28 01:15:43 +00:00
|
|
|
[dependencies]
|
2021-10-11 20:07:04 +00:00
|
|
|
console_error_panic_hook = { version = "0.1.7", optional = true }
|
2024-03-01 21:09:00 +00:00
|
|
|
slotmap = { workspace = true }
|
2024-04-04 11:55:46 +00:00
|
|
|
js-sys = { workspace = true }
|
2023-05-31 23:50:21 +00:00
|
|
|
tracing = { workspace = true, features = ["log"] }
|
2023-11-20 01:54:50 +00:00
|
|
|
tracing-subscriber = { version = "0.3.18", default-features = false, features = ["registry"] }
|
2023-10-31 22:01:51 +00:00
|
|
|
tracing-log = "0.2.0"
|
2023-01-04 12:54:21 +00:00
|
|
|
tracing-wasm = "0.2.1"
|
2020-05-02 09:59:13 +00:00
|
|
|
ruffle_render_canvas = { path = "../render/canvas", optional = true }
|
2020-04-23 22:04:07 +00:00
|
|
|
ruffle_web_common = { path = "common" }
|
2023-02-03 14:09:08 +00:00
|
|
|
ruffle_render = { path = "../render" }
|
2020-05-02 09:59:13 +00:00
|
|
|
ruffle_render_webgl = { path = "../render/webgl", optional = true }
|
2021-09-09 00:54:13 +00:00
|
|
|
ruffle_render_wgpu = { path = "../render/wgpu", optional = true }
|
2022-08-25 22:46:54 +00:00
|
|
|
ruffle_video_software = { path = "../video/software" }
|
2024-04-04 12:02:07 +00:00
|
|
|
url = { workspace = true }
|
2024-04-04 12:03:22 +00:00
|
|
|
wasm-bindgen = { workspace = true }
|
2024-08-26 10:21:07 +00:00
|
|
|
wasm-bindgen-futures = "0.4.43"
|
2024-03-01 11:53:55 +00:00
|
|
|
serde-wasm-bindgen = "0.6.5"
|
2024-04-04 11:38:58 +00:00
|
|
|
chrono = { workspace = true, features = ["wasmbind", "clock"] }
|
2021-09-17 07:35:13 +00:00
|
|
|
getrandom = { version = "0.2", features = ["js"] }
|
2024-04-04 12:00:14 +00:00
|
|
|
serde = { workspace = true, features = ["derive"] }
|
2024-04-04 12:01:11 +00:00
|
|
|
thiserror = { workspace = true }
|
2024-03-02 07:36:21 +00:00
|
|
|
base64 = "0.22.0"
|
2024-04-04 11:26:11 +00:00
|
|
|
async-channel = { workspace = true }
|
2023-12-25 06:27:55 +00:00
|
|
|
futures-util = { version = "0.3.30", features = ["sink"] }
|
2024-07-22 12:09:02 +00:00
|
|
|
gloo-net = { version = "0.6.0", default-features = false, features = ["websocket"] }
|
2024-08-22 09:30:16 +00:00
|
|
|
rfd = { workspace = true, features = ["file-handle-inner"] }
|
2024-01-29 06:47:01 +00:00
|
|
|
wasm-streams = "0.4.0"
|
2024-04-04 11:53:13 +00:00
|
|
|
futures = { workspace = true }
|
2024-08-05 14:50:30 +00:00
|
|
|
zip = { version = "2.1.6", default-features = false}
|
2019-07-25 07:58:34 +00:00
|
|
|
|
|
|
|
[dependencies.ruffle_core]
|
|
|
|
path = "../core"
|
2024-06-08 13:21:07 +00:00
|
|
|
features = ["audio", "mp3", "nellymoser", "default_compatibility_rules", "default_font", "serde"]
|
2019-04-28 01:15:43 +00:00
|
|
|
|
2019-04-28 06:08:59 +00:00
|
|
|
[dependencies.web-sys]
|
2024-08-18 13:57:07 +00:00
|
|
|
version = "0.3.70"
|
2019-08-09 21:50:20 +00:00
|
|
|
features = [
|
2023-04-22 19:23:24 +00:00
|
|
|
"AddEventListenerOptions", "AudioBuffer", "AudioBufferSourceNode", "AudioContext",
|
|
|
|
"AudioDestinationNode", "AudioNode", "AudioParam", "Blob", "BlobPropertyBag",
|
2023-05-16 09:27:36 +00:00
|
|
|
"ChannelMergerNode", "ChannelSplitterNode", "ClipboardEvent", "DataTransfer", "Element", "Event",
|
2023-04-28 18:01:46 +00:00
|
|
|
"EventTarget", "GainNode", "Headers", "HtmlCanvasElement", "HtmlDocument", "HtmlElement", "HtmlFormElement",
|
2023-07-31 01:52:57 +00:00
|
|
|
"HtmlInputElement", "HtmlTextAreaElement", "KeyboardEvent", "Location", "PointerEvent",
|
2024-04-30 20:18:15 +00:00
|
|
|
"Request", "RequestInit", "Response", "Storage", "WheelEvent", "Window", "ReadableStream", "RequestCredentials",
|
web: Use browser focus events for focus management
This patch changes how the player focus is managed.
Before this patch, `instance.has_focus` was unrelated
to the current focus managed by the browser.
When the user clicked anywhere on the window, it was set to `false`,
and when the user clicked on the player, it was set to `true`.
This had two major issues.
1. When the user clicked on the player, `has_focus` was set to `false`,
and then again to `true`. That was problematic when listening
to focus change events.
2. Not using browser's focus makes it harder to integrate with Ruffle,
i.e. tab out of Ruffle.
This patch uses browser's focus management to detect focus
and listen to focus events:
1. on `focusin` – FocusGained event is fired,
2. on `focusout` – FocusLost event is fired, and
3. on `pointerdown` – focus is manually set to the canvas.
The container has `tabindex` set to -1 in order to be focusable.
Virtual keyboard on web is represented as an input inside the container.
In order to preserve player focus when virtual keyboard is open,
this patch ensures that the container is focused and not the canvas.
This way, when the input is focused, the container does not lose its focus.
2024-07-18 09:11:29 +00:00
|
|
|
"Url", "Clipboard", "FocusEvent"
|
2022-03-16 18:22:06 +00:00
|
|
|
]
|
2024-03-26 01:05:37 +00:00
|
|
|
|
|
|
|
[package.metadata.cargo-machete]
|
|
|
|
ignored = [
|
|
|
|
# Not used directly, declared only to enable its `js` feature.
|
|
|
|
"getrandom"
|
|
|
|
]
|