Update deps

This commit is contained in:
Piotr Siuszko 2025-01-06 17:02:01 +01:00
parent 588fab72ef
commit 1c57713780
5 changed files with 1503 additions and 1292 deletions

2728
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -3,13 +3,14 @@ name = "rpack"
version = "0.1.0" version = "0.1.0"
authors = ["Piotr Siuszko <siuszko@zoho.com>"] authors = ["Piotr Siuszko <siuszko@zoho.com>"]
edition = "2021" edition = "2021"
rust-version = "1.81"
repository = "https://github.com/Leinnan/rpack.git" repository = "https://github.com/Leinnan/rpack.git"
homepage = "https://github.com/Leinnan/rpack" homepage = "https://github.com/Leinnan/rpack"
[dependencies] [dependencies]
egui = "0.26.2" egui = "0.30"
eframe = { version = "0.26.2", default-features = false, features = [ eframe = { version = "0.30", default-features = false, features = [
"accesskit", # Make egui comptaible with screen readers. NOTE: adds a lot of dependencies. "accesskit", # Make egui comptaible with screen readers. NOTE: adds a lot of dependencies.
"default_fonts", # Embed the default egui fonts. "default_fonts", # Embed the default egui fonts.
"glow", # Use the glow rendering backend. Alternative: "wgpu". "glow", # Use the glow rendering backend. Alternative: "wgpu".
@ -17,25 +18,30 @@ eframe = { version = "0.26.2", default-features = false, features = [
] } ] }
log = "0.4" log = "0.4"
serde_json = "1" serde_json = "1"
egui_json_tree = "0.4" egui_json_tree = "0.10"
# You only need serde if you want app persistence: # You only need serde if you want app persistence:
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
texture_packer = { version = "0.27.0", features = ["common"] } texture_packer = { version = "0.27.0", features = ["common"] }
image = { version = "0.24", features = ["jpeg", "png"] } image = { version = "0.24", features = ["jpeg", "png"] }
egui_extras = { version = "*", features = ["all_loaders"] } egui_extras = { version = "*", features = ["all_loaders"] }
rfd = {version="0.14", features = []} rfd = { version = "0.15", features = [] }
wasm-bindgen-futures = "0.4.42" wasm-bindgen-futures = "0.4"
# native: # native:
[target.'cfg(not(target_arch = "wasm32"))'.dependencies] [target.'cfg(not(target_arch = "wasm32"))'.dependencies]
env_logger = "0.10" env_logger = "0.11"
# web: # web:
[target.'cfg(target_arch = "wasm32")'.dependencies] [target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen-futures = "0.4" wasm-bindgen-futures = "0.4"
wasm-bindgen = "0.2" wasm-bindgen = "0.2"
web-sys = {version = "0.3", features=["Url","HtmlAnchorElement","Blob", "BlobPropertyBag"]} web-sys = { version = "0.3", features = [
"Url",
"HtmlAnchorElement",
"Blob",
"BlobPropertyBag",
] }
js-sys = "0.3" js-sys = "0.3"

View File

@ -5,6 +5,6 @@
# to the user in the error, instead of "error: invalid channel name '[toolchain]'". # to the user in the error, instead of "error: invalid channel name '[toolchain]'".
[toolchain] [toolchain]
channel = "1.72.0" channel = "1.81"
components = [ "rustfmt", "clippy" ] components = [ "rustfmt", "clippy" ]
targets = [ "wasm32-unknown-unknown" ] targets = [ "wasm32-unknown-unknown" ]

View File

@ -259,11 +259,11 @@ fn setup_custom_fonts(ctx: &egui::Context) {
// .ttf and .otf files supported. // .ttf and .otf files supported.
fonts.font_data.insert( fonts.font_data.insert(
"regular".to_owned(), "regular".to_owned(),
egui::FontData::from_static(include_bytes!("../static/JetBrainsMonoNL-Regular.ttf")), egui::FontData::from_static(include_bytes!("../static/JetBrainsMonoNL-Regular.ttf")).into(),
); );
fonts.font_data.insert( fonts.font_data.insert(
"semibold".to_owned(), "semibold".to_owned(),
egui::FontData::from_static(include_bytes!("../static/JetBrainsMono-SemiBold.ttf")), egui::FontData::from_static(include_bytes!("../static/JetBrainsMono-SemiBold.ttf")).into(),
); );
// Put my font first (highest priority) for proportional text: // Put my font first (highest priority) for proportional text:
@ -488,7 +488,7 @@ fn powered_by_egui_and_eframe(ui: &mut egui::Ui) {
ui.hyperlink_to(format!("Build: {}", GIT_HASH), env!("CARGO_PKG_HOMEPAGE")); ui.hyperlink_to(format!("Build: {}", GIT_HASH), env!("CARGO_PKG_HOMEPAGE"));
egui::warn_if_debug_build(ui); egui::warn_if_debug_build(ui);
ui.separator(); ui.separator();
egui::widgets::global_dark_light_mode_buttons(ui); egui::widgets::global_theme_preference_switch(ui);
ui.separator(); ui.separator();
ui.spacing_mut().item_spacing.x = 0.0; ui.spacing_mut().item_spacing.x = 0.0;
ui.label("Made by "); ui.label("Made by ");

View File

@ -15,7 +15,7 @@ fn main() -> eframe::Result<()> {
eframe::run_native( eframe::run_native(
"rPack", "rPack",
native_options, native_options,
Box::new(|cc| Box::new(rpack::TemplateApp::new(cc))), Box::new(|cc| Ok(Box::new(rpack::TemplateApp::new(cc)))),
) )
} }
@ -28,13 +28,38 @@ fn main() {
let web_options = eframe::WebOptions::default(); let web_options = eframe::WebOptions::default();
wasm_bindgen_futures::spawn_local(async { wasm_bindgen_futures::spawn_local(async {
eframe::WebRunner::new() use web_sys::wasm_bindgen::JsCast;
use web_sys::{window, HtmlCanvasElement};
let canvas = window()
.and_then(|w| w.document())
.and_then(|d| d.get_element_by_id("the_canvas_id"))
.expect("No Canvas found")
.dyn_into::<HtmlCanvasElement>()
.expect("Could not cast to Canvas");
let start_result = eframe::WebRunner::new()
.start( .start(
"the_canvas_id", // hardcode it canvas,
web_options, web_options,
Box::new(|cc| Box::new(rpack::TemplateApp::new(cc))), Box::new(|cc| Ok(Box::new(rpack::TemplateApp::new(cc)))),
) )
.await .await;
.expect("failed to start eframe");
// Remove the loading text and spinner:
let loading_text = window()
.and_then(|w| w.document())
.and_then(|d| d.get_element_by_id("loading_text"));
if let Some(loading_text) = loading_text {
match start_result {
Ok(_) => {
loading_text.remove();
}
Err(e) => {
loading_text.set_inner_html(
"<p> The app has crashed. See the developer console for details. </p>",
);
panic!("Failed to start eframe: {e:?}");
}
}
}
}); });
} }