mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-22 20:23:09 +00:00
Merge branch 'master' into master
This commit is contained in:
commit
37e5f53f9e
12 changed files with 60 additions and 14 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -2500,7 +2500,7 @@ dependencies = [
|
|||
"fern",
|
||||
"flate2",
|
||||
"fs_extra",
|
||||
"futures",
|
||||
"futures-util",
|
||||
"gitignore",
|
||||
"headers 0.3.9",
|
||||
"html_parser",
|
||||
|
@ -2519,10 +2519,8 @@ dependencies = [
|
|||
"serde",
|
||||
"serde_json",
|
||||
"subprocess",
|
||||
"syn 2.0.48",
|
||||
"tar",
|
||||
"tauri-bundler",
|
||||
"tauri-utils",
|
||||
"tempfile",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
|
@ -6278,9 +6276,9 @@ checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
|
|||
|
||||
[[package]]
|
||||
name = "memmap2"
|
||||
version = "0.9.3"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45fd3a57831bf88bc63f8cebc0cf956116276e97fef3966103e96416209f7c92"
|
||||
checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
|
|
@ -24,7 +24,7 @@ serde_json = "1.0.79"
|
|||
toml = "0.8.8"
|
||||
fs_extra = "1.2.0"
|
||||
cargo_toml = "0.18.0"
|
||||
futures = "0.3.21"
|
||||
futures-util.workspace = true
|
||||
notify = { version = "5.0.0-pre.16", features = ["serde"] }
|
||||
html_parser = { workspace = true }
|
||||
cargo_metadata = "0.18.1"
|
||||
|
@ -56,7 +56,6 @@ flate2 = "1.0.22"
|
|||
tar = "0.4.38"
|
||||
zip = "0.6.2"
|
||||
tower = "0.4.12"
|
||||
syn = { version = "2.0", features = ["full", "extra-traits"] }
|
||||
lazy_static = "1.4.0"
|
||||
|
||||
# plugin packages
|
||||
|
@ -74,7 +73,6 @@ toml_edit = "0.21.0"
|
|||
|
||||
# bundling
|
||||
tauri-bundler = { version = "=1.4.*", features = ["native-tls-vendored"] }
|
||||
tauri-utils = "=1.5.*"
|
||||
|
||||
manganis-cli-support = { workspace = true, features = ["webp", "html"] }
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use dioxus_autofmt::{IndentOptions, IndentType};
|
||||
use futures::{stream::FuturesUnordered, StreamExt};
|
||||
use futures_util::{stream::FuturesUnordered, StreamExt};
|
||||
use std::{fs, path::Path, process::exit};
|
||||
|
||||
use super::*;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use futures::{stream::FuturesUnordered, StreamExt};
|
||||
use futures_util::{stream::FuturesUnordered, StreamExt};
|
||||
use std::{path::Path, process::exit};
|
||||
|
||||
use super::*;
|
||||
|
|
|
@ -7,7 +7,7 @@ use std::{
|
|||
|
||||
use anyhow::Context;
|
||||
use flate2::read::GzDecoder;
|
||||
use futures::StreamExt;
|
||||
use futures_util::StreamExt;
|
||||
use tar::Archive;
|
||||
use tokio::io::AsyncWriteExt;
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ fn app(cx: Scope) -> Element {
|
|||
ctrlKey: false,
|
||||
metaKey: false,
|
||||
shiftKey: false,
|
||||
isComposing: false,
|
||||
isComposing: true,
|
||||
which: 65,
|
||||
bubbles: true,
|
||||
})"#,
|
||||
|
@ -356,6 +356,7 @@ fn app(cx: Scope) -> Element {
|
|||
assert_eq!(event.data.code().to_string(), "KeyA");
|
||||
assert_eq!(event.data.location(), Location::Standard);
|
||||
assert!(event.data.is_auto_repeating());
|
||||
assert!(event.data.is_composing());
|
||||
received_events.modify(|x| *x + 1)
|
||||
}
|
||||
}
|
||||
|
@ -368,6 +369,7 @@ fn app(cx: Scope) -> Element {
|
|||
assert_eq!(event.data.code().to_string(), "KeyA");
|
||||
assert_eq!(event.data.location(), Location::Standard);
|
||||
assert!(!event.data.is_auto_repeating());
|
||||
assert!(!event.data.is_composing());
|
||||
received_events.modify(|x| *x + 1)
|
||||
}
|
||||
}
|
||||
|
@ -380,6 +382,7 @@ fn app(cx: Scope) -> Element {
|
|||
assert_eq!(event.data.code().to_string(), "KeyA");
|
||||
assert_eq!(event.data.location(), Location::Standard);
|
||||
assert!(!event.data.is_auto_repeating());
|
||||
assert!(!event.data.is_composing());
|
||||
received_events.modify(|x| *x + 1)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ mod impl_ {
|
|||
])
|
||||
.unwrap();
|
||||
|
||||
let edit_menu = Submenu::new("Window", true);
|
||||
let edit_menu = Submenu::new("Edit", true);
|
||||
edit_menu
|
||||
.append_items(&[
|
||||
&PredefinedMenuItem::undo(None),
|
||||
|
|
|
@ -91,7 +91,28 @@ impl WebviewInstance {
|
|||
}
|
||||
};
|
||||
|
||||
let mut webview = WebViewBuilder::new(&window)
|
||||
#[cfg(any(
|
||||
target_os = "windows",
|
||||
target_os = "macos",
|
||||
target_os = "ios",
|
||||
target_os = "android"
|
||||
))]
|
||||
let mut webview = WebViewBuilder::new(&window);
|
||||
|
||||
#[cfg(not(any(
|
||||
target_os = "windows",
|
||||
target_os = "macos",
|
||||
target_os = "ios",
|
||||
target_os = "android"
|
||||
)))]
|
||||
let mut webview = {
|
||||
use tao::platform::unix::WindowExtUnix;
|
||||
use wry::WebViewBuilderExtUnix;
|
||||
let vbox = window.default_vbox().unwrap();
|
||||
WebViewBuilder::new_gtk(vbox)
|
||||
};
|
||||
|
||||
webview = webview
|
||||
.with_transparent(cfg.window.window.transparent)
|
||||
.with_url("dioxus://index.html/")
|
||||
.unwrap()
|
||||
|
|
|
@ -33,6 +33,7 @@ impl std::fmt::Debug for KeyboardData {
|
|||
.field("modifiers", &self.modifiers())
|
||||
.field("location", &self.location())
|
||||
.field("is_auto_repeating", &self.is_auto_repeating())
|
||||
.field("is_composing", &self.is_composing())
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +45,7 @@ impl PartialEq for KeyboardData {
|
|||
&& self.modifiers() == other.modifiers()
|
||||
&& self.location() == other.location()
|
||||
&& self.is_auto_repeating() == other.is_auto_repeating()
|
||||
&& self.is_composing() == other.is_composing()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,6 +77,11 @@ impl KeyboardData {
|
|||
self.inner.is_auto_repeating()
|
||||
}
|
||||
|
||||
/// Indicates whether the key is fired within a composition session.
|
||||
pub fn is_composing(&self) -> bool {
|
||||
self.inner.is_composing()
|
||||
}
|
||||
|
||||
/// Downcast this KeyboardData to a concrete type.
|
||||
pub fn downcast<T: 'static>(&self) -> Option<&T> {
|
||||
self.inner.as_any().downcast_ref::<T>()
|
||||
|
@ -92,6 +99,7 @@ impl ModifiersInteraction for KeyboardData {
|
|||
#[derive(serde::Serialize, serde::Deserialize, Debug, PartialEq, Clone)]
|
||||
pub struct SerializedKeyboardData {
|
||||
char_code: u32,
|
||||
is_composing: bool,
|
||||
key: String,
|
||||
key_code: KeyCode,
|
||||
#[serde(deserialize_with = "resilient_deserialize_code")]
|
||||
|
@ -114,9 +122,11 @@ impl SerializedKeyboardData {
|
|||
location: Location,
|
||||
is_auto_repeating: bool,
|
||||
modifiers: Modifiers,
|
||||
is_composing: bool,
|
||||
) -> Self {
|
||||
Self {
|
||||
char_code: key.legacy_charcode(),
|
||||
is_composing,
|
||||
key: key.to_string(),
|
||||
key_code: KeyCode::from_raw_code(
|
||||
std::convert::TryInto::try_into(key.legacy_keycode())
|
||||
|
@ -144,6 +154,7 @@ impl From<&KeyboardData> for SerializedKeyboardData {
|
|||
data.location(),
|
||||
data.is_auto_repeating(),
|
||||
data.modifiers(),
|
||||
data.is_composing(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -166,6 +177,10 @@ impl HasKeyboardData for SerializedKeyboardData {
|
|||
self.repeat
|
||||
}
|
||||
|
||||
fn is_composing(&self) -> bool {
|
||||
self.is_composing
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn std::any::Any {
|
||||
self
|
||||
}
|
||||
|
@ -236,6 +251,9 @@ pub trait HasKeyboardData: ModifiersInteraction + std::any::Any {
|
|||
/// `true` iff the key is being held down such that it is automatically repeating.
|
||||
fn is_auto_repeating(&self) -> bool;
|
||||
|
||||
/// Indicates whether the key is fired within a composition session.
|
||||
fn is_composing(&self) -> bool;
|
||||
|
||||
/// return self as Any
|
||||
fn as_any(&self) -> &dyn std::any::Any;
|
||||
}
|
||||
|
|
|
@ -78,6 +78,10 @@ impl HasKeyboardData for KeyboardEvent {
|
|||
self.repeat()
|
||||
}
|
||||
|
||||
fn is_composing(&self) -> bool {
|
||||
self.is_composing()
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn std::any::Any {
|
||||
self
|
||||
}
|
||||
|
|
|
@ -351,6 +351,7 @@ async function serialize_event(event) {
|
|||
case "keyup": {
|
||||
let {
|
||||
charCode,
|
||||
isComposing,
|
||||
key,
|
||||
altKey,
|
||||
ctrlKey,
|
||||
|
@ -364,6 +365,7 @@ async function serialize_event(event) {
|
|||
} = event;
|
||||
return {
|
||||
char_code: charCode,
|
||||
is_composing: isComposing,
|
||||
key: key,
|
||||
alt_key: altKey,
|
||||
ctrl_key: ctrlKey,
|
||||
|
|
|
@ -179,6 +179,7 @@ impl InnerInputState {
|
|||
k.location(),
|
||||
is_repeating,
|
||||
k.modifiers(),
|
||||
k.is_composing(),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -779,6 +780,7 @@ fn translate_key_event(event: crossterm::event::KeyEvent) -> Option<EventData> {
|
|||
Location::Standard,
|
||||
false,
|
||||
modifiers,
|
||||
false,
|
||||
)))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue