chore: update taffy

This commit is contained in:
galister 2026-07-06 13:56:44 +09:00
parent 80237d36cd
commit a10b20aea9
15 changed files with 128 additions and 111 deletions

4
Cargo.lock generated
View File

@ -5713,9 +5713,9 @@ dependencies = [
[[package]]
name = "taffy"
version = "0.9.2"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41ba83ebaf2954d31d05d67340fd46cebe99da2b7133b0dd68d70c65473a437b"
checksum = "73afc801dd6bd47529eaa7c7e90557f107527d1b7c9c7ed7d7803c7b8d0c357f"
dependencies = [
"arrayvec",
"grid",

View File

@ -27,12 +27,17 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1.0.145"
serde_json5 = "0.2.1"
slotmap = "1.1.1"
smallvec = "1.15.2"
smol = "2.0.2"
strum = { version = "0.27.2", features = ["derive"] }
uuid = { version = "1.19.0", features = ["fast-rng", "serde", "v4"] }
vulkano = { version = "0.35.2", default-features = false, features = [
"macros",
] }
vulkano = {
version = "0.35.2",
default-features = false,
features = [
"macros",
]
}
vulkano-shaders = "0.35.0"
wayland-client = { version = "0.31" }
wayland-protocols = { version = "0.32" }
@ -40,7 +45,10 @@ wayland-protocols-misc = { version = "0.3.12" }
xdg = "3.0.0"
[patch.crates-io]
vulkano = { git = "https://github.com/galister/vulkano.git", rev = "cf7f92867928a56ce16b376037c1120f2b167678" }
vulkano = {
git = "https://github.com/galister/vulkano.git",
rev = "cf7f92867928a56ce16b376037c1120f2b167678"
}
[profile.dev]
opt-level = 1

View File

@ -580,7 +580,7 @@ pub fn horiz_cell(layout: &mut Layout, parent: WidgetID) -> anyhow::Result<Widge
WidgetDiv::create(),
taffy::Style {
flex_direction: taffy::FlexDirection::Row,
align_items: Some(taffy::AlignItems::Center),
align_items: Some(taffy::AlignItems::CENTER),
gap: length(8.0),
..Default::default()
},

View File

@ -69,8 +69,8 @@ impl ToastManager {
width: percent(1.0),
height: percent(0.8),
},
align_items: Some(taffy::AlignItems::End),
justify_content: Some(taffy::JustifyContent::Center),
align_items: Some(taffy::AlignItems::END),
justify_content: Some(taffy::JustifyContent::CENTER),
..Default::default()
},
)?;

View File

@ -125,8 +125,8 @@ impl View {
label,
taffy::Style {
position: taffy::Position::Absolute,
align_self: Some(AlignSelf::Baseline),
justify_self: Some(JustifySelf::Center),
align_self: Some(AlignSelf::BASELINE),
justify_self: Some(JustifySelf::CENTER),
margin: taffy::Rect {
top: length(32.0),
bottom: auto(),
@ -184,8 +184,8 @@ impl View {
}),
style: taffy::Style {
position: taffy::Position::Relative,
align_items: Some(taffy::AlignItems::Center),
justify_content: Some(taffy::JustifyContent::Center),
align_items: Some(AlignItems::CENTER),
justify_content: Some(JustifyContent::CENTER),
size: taffy::Size {
width: length(GAME_COVER_SIZE_X * params.scale),
height: length(GAME_COVER_SIZE_Y * params.scale),
@ -206,8 +206,8 @@ impl View {
height: percent(1.0),
},
padding: taffy::Rect::length(2.0),
align_items: Some(AlignItems::Center),
justify_content: Some(JustifyContent::Center),
align_items: Some(AlignItems::CENTER),
justify_content: Some(JustifyContent::CENTER),
..Default::default()
},
)?;
@ -239,7 +239,7 @@ impl View {
drawing::Color::new(1.0, 1.0, 1.0, 0.2),
drawing::Color::new(1.0, 1.0, 1.0, 0.02),
),
rect_gradient_style(taffy::AlignSelf::Baseline, 0.05),
rect_gradient_style(taffy::AlignSelf::BASELINE, 0.05),
)?;
// not optimal, this forces us to create a new pass for every created cover art just to overlay various rectangles at the top of the image cover art
@ -252,7 +252,7 @@ impl View {
drawing::Color::new(1.0, 1.0, 1.0, 0.15),
drawing::Color::new(1.0, 1.0, 1.0, 0.0),
),
rect_gradient_style(taffy::AlignSelf::Baseline, 0.5),
rect_gradient_style(taffy::AlignSelf::BASELINE, 0.5),
)?;
// bottom black gradient
@ -262,7 +262,7 @@ impl View {
drawing::Color::new(0.0, 0.0, 0.0, 0.0),
drawing::Color::new(0.0, 0.0, 0.0, 0.25),
),
rect_gradient_style(taffy::AlignSelf::End, 0.5),
rect_gradient_style(taffy::AlignSelf::END, 0.5),
)?;
// bottom shadow
@ -272,7 +272,7 @@ impl View {
drawing::Color::new(0.0, 0.0, 0.0, 0.1),
drawing::Color::new(0.0, 0.0, 0.0, 0.9),
),
rect_gradient_style(taffy::AlignSelf::End, 0.05),
rect_gradient_style(taffy::AlignSelf::END, 0.05),
)?;
let id_loading = wgui_simple::create_loading(wgui_simple::CreateLoadingParams {

View File

@ -9,36 +9,45 @@ repository = "https://github.com/wlx-team/wayvr"
[dependencies]
anyhow.workspace = true
cosmic-text = "0.15.0"
etagere = "0.2.15"
flate2 = "1.1.5"
glam.workspace = true
image = { version = "0.25.9", default-features = false, features = [
"gif",
"jpeg",
"png",
"rayon",
"webp",
] }
log.workspace = true
lru = "0.16.2"
ouroboros = "0.18.5"
parking_lot = "0.12.5"
regex.workspace = true
resvg = { version = "0.45.1", default-features = false }
roxmltree = "0.21.1"
rust-embed.workspace = true
rustc-hash = "2.1.1"
serde_json.workspace = true
slotmap.workspace = true
smallvec = "1.15.1"
taffy = "0.9.2"
smallvec.workspace = true
vulkano.workspace = true
vulkano-shaders.workspace = true
cosmic-text = "0.15.0"
etagere = "0.2.15"
flate2 = "1.1.5"
image = {
version = "0.25.9",
default-features = false,
features = [
"gif",
"jpeg",
"png",
"rayon",
"webp",
]
}
lru = "0.16.2"
ouroboros = "0.18.5"
parking_lot = "0.12.5"
resvg = { version = "0.45.1", default-features = false }
roxmltree = "0.21.1"
rustc-hash = "2.1.1"
taffy = "0.12.1"
# `video` wgui feature
bytes = { workspace = true, optional = true }
dav1d-sys = { git = "https://github.com/rust-av/dav1d-rs.git", rev = "03477a36c3de4f2aacbab81a8951150ffdb9c4c3", optional = true }
dav1d-sys = {
git = "https://github.com/rust-av/dav1d-rs.git",
rev = "03477a36c3de4f2aacbab81a8951150ffdb9c4c3",
optional = true
}
[features]
default = ["video"]

View File

@ -120,7 +120,7 @@ pub fn construct(
root.id,
WidgetDiv::create(),
taffy::Style {
justify_content: Some(JustifyContent::SpaceBetween),
justify_content: Some(JustifyContent::SPACE_BETWEEN),
flex_direction: FlexDirection::Column,
size: taffy::Size {
width: auto(),

View File

@ -438,10 +438,10 @@ pub fn construct(ess: &mut ConstructEssentials, params: Params) -> anyhow::Resul
let theme = &ess.layout.state.theme;
if style.align_items.is_none() {
style.align_items = Some(AlignItems::Center);
style.align_items = Some(AlignItems::CENTER);
}
if style.justify_content.is_none() {
style.justify_content = Some(JustifyContent::Center);
style.justify_content = Some(JustifyContent::CENTER);
}
style.overflow.x = taffy::Overflow::Hidden;
style.overflow.y = taffy::Overflow::Hidden;

View File

@ -333,7 +333,7 @@ pub fn construct(ess: &mut ConstructEssentials, params: Params) -> anyhow::Resul
// force-override style
style.flex_wrap = taffy::FlexWrap::NoWrap;
style.align_items = Some(AlignItems::Center);
style.align_items = Some(AlignItems::CENTER);
// make checkbox interaction box larger by setting padding and negative margin
style.padding = taffy::Rect {

View File

@ -282,7 +282,7 @@ pub fn construct(
}
// override style
params.style.align_items = Some(taffy::AlignItems::Center);
params.style.align_items = Some(taffy::AlignItems::CENTER);
params.style.position = taffy::Position::Relative;
params.style.overflow = taffy::Point {
x: taffy::Overflow::Scroll,
@ -307,8 +307,8 @@ pub fn construct(
taffy::Style {
position: taffy::Position::Absolute,
flex_direction: taffy::FlexDirection::Column,
align_content: Some(taffy::AlignContent::Center),
align_items: Some(taffy::AlignItems::Center),
align_content: Some(taffy::AlignContent::CENTER),
align_items: Some(taffy::AlignItems::CENTER),
size: taffy::Size {
width: percent(1.0),
height: percent(1.0),
@ -364,8 +364,8 @@ pub fn construct(
..Default::default()
}),
taffy::Style {
align_self: Some(taffy::AlignSelf::Center),
justify_self: Some(taffy::JustifySelf::End),
align_self: Some(taffy::AlignSelf::CENTER),
justify_self: Some(taffy::JustifySelf::END),
min_size: taffy::Size {
width: length(2.0),
height: length(16.0),

View File

@ -593,8 +593,8 @@ fn mount_slider_handle(
height: percent(1.0),
},
position: taffy::Position::Absolute,
align_items: Some(taffy::AlignItems::Center),
justify_content: Some(taffy::JustifyContent::Center),
align_items: Some(taffy::AlignItems::CENTER),
justify_content: Some(taffy::JustifyContent::CENTER),
..Default::default()
};
@ -671,8 +671,8 @@ pub fn construct(ess: &mut ConstructEssentials, params: Params) -> anyhow::Resul
height: percent(PAD_PERCENT),
},
position: taffy::Position::Absolute,
align_self: Some(taffy::AlignItems::Center),
justify_self: Some(taffy::JustifySelf::Center),
align_self: Some(taffy::AlignItems::CENTER),
justify_self: Some(taffy::JustifySelf::CENTER),
..Default::default()
},
)?;

View File

@ -1,18 +1,18 @@
use crate::{
assets::AssetPath,
components::{
Component, ComponentBase, ComponentTrait, RefreshData,
button::{self, ComponentButton},
Component, ComponentBase, ComponentTrait, RefreshData,
},
event::CallbackDataCommon,
i18n::Translation,
layout::WidgetPair,
widget::{ConstructEssentials, div::WidgetDiv},
widget::{div::WidgetDiv, ConstructEssentials},
};
use std::{cell::RefCell, rc::Rc};
use taffy::{
AlignItems,
prelude::{length, percent},
AlignItems,
};
pub struct Entry<'a> {
@ -113,7 +113,7 @@ pub fn construct(ess: &mut ConstructEssentials, params: Params) -> anyhow::Resul
style.overflow.y = taffy::Overflow::Scroll;
style.flex_direction = taffy::FlexDirection::Column;
style.flex_wrap = taffy::FlexWrap::NoWrap;
style.align_items = Some(AlignItems::Center);
style.align_items = Some(AlignItems::CENTER);
style.gap = length(4.0);
let (root, _) = ess.layout.add_child(ess.parent, WidgetDiv::create(), style)?;
@ -135,7 +135,7 @@ pub fn construct(ess: &mut ConstructEssentials, params: Params) -> anyhow::Resul
width: percent(1.0),
height: length(32.0),
},
justify_content: Some(taffy::JustifyContent::Start),
justify_content: Some(taffy::JustifyContent::START),
..Default::default()
},
..Default::default()

View File

@ -183,26 +183,26 @@ pub fn construct(ess: &mut ConstructEssentials, params: Params) -> anyhow::Resul
TooltipSide::Left => (
absolute_boundary.left() - spacing - pin_size,
absolute_boundary.top() + absolute_boundary.size.y / 2.0 - pin_size / 2.0,
taffy::AlignItems::Center,
taffy::JustifyContent::End,
taffy::AlignItems::CENTER,
taffy::JustifyContent::END,
),
TooltipSide::Right => (
absolute_boundary.left() + absolute_boundary.size.x + spacing,
absolute_boundary.top() + absolute_boundary.size.y / 2.0 - pin_size / 2.0,
taffy::AlignItems::Center,
taffy::JustifyContent::Start,
taffy::AlignItems::CENTER,
taffy::JustifyContent::START,
),
TooltipSide::Top => (
absolute_boundary.left() + absolute_boundary.size.x / 2.0 - pin_size / 2.0,
absolute_boundary.top() - spacing - pin_size,
taffy::AlignItems::End,
taffy::JustifyContent::Center,
taffy::AlignItems::END,
taffy::JustifyContent::CENTER,
),
TooltipSide::Bottom => (
absolute_boundary.left() + absolute_boundary.size.x / 2.0 - pin_size / 2.0,
absolute_boundary.top() + absolute_boundary.size.y + spacing,
taffy::AlignItems::Baseline,
taffy::JustifyContent::Center,
taffy::AlignItems::BASELINE,
taffy::JustifyContent::CENTER,
),
};

View File

@ -5,7 +5,7 @@ use taffy::{
use crate::{
drawing,
parser::{AttribPair, ParserContext, is_percent, parse_color_hex, parse_f32},
parser::{is_percent, parse_color_hex, parse_f32, AttribPair, ParserContext},
renderer_vk::text::{FontWeight, HorizontalAlign, TextStyle},
widget::util::WLength,
};
@ -315,64 +315,64 @@ pub fn parse_style(ctx: &ParserContext<'_>, attribs: &[AttribPair], tag_name: &s
}
},
"align_self" => match value {
"baseline" => style.align_self = Some(AlignSelf::Baseline),
"center" => style.align_self = Some(AlignSelf::Center),
"end" => style.align_self = Some(AlignSelf::End),
"flex_end" => style.align_self = Some(AlignSelf::FlexEnd),
"flex_start" => style.align_self = Some(AlignSelf::FlexStart),
"start" => style.align_self = Some(AlignSelf::Start),
"stretch" => style.align_self = Some(AlignSelf::Stretch),
"baseline" => style.align_self = Some(AlignSelf::BASELINE),
"center" => style.align_self = Some(AlignSelf::CENTER),
"end" => style.align_self = Some(AlignSelf::END),
"flex_end" => style.align_self = Some(AlignSelf::FLEX_END),
"flex_start" => style.align_self = Some(AlignSelf::FLEX_START),
"start" => style.align_self = Some(AlignSelf::START),
"stretch" => style.align_self = Some(AlignSelf::STRETCH),
_ => {
ctx.print_invalid_attrib(tag_name, key, value);
}
},
"justify_self" => match value {
"center" => style.justify_self = Some(JustifySelf::Center),
"end" => style.justify_self = Some(JustifySelf::End),
"flex_end" => style.justify_self = Some(JustifySelf::FlexEnd),
"flex_start" => style.justify_self = Some(JustifySelf::FlexStart),
"start" => style.justify_self = Some(JustifySelf::Start),
"stretch" => style.justify_self = Some(JustifySelf::Stretch),
"center" => style.justify_self = Some(JustifySelf::CENTER),
"end" => style.justify_self = Some(JustifySelf::END),
"flex_end" => style.justify_self = Some(JustifySelf::FLEX_END),
"flex_start" => style.justify_self = Some(JustifySelf::FLEX_START),
"start" => style.justify_self = Some(JustifySelf::START),
"stretch" => style.justify_self = Some(JustifySelf::STRETCH),
_ => {
ctx.print_invalid_attrib(tag_name, key, value);
}
},
"align_items" => match value {
"baseline" => style.align_items = Some(AlignItems::Baseline),
"center" => style.align_items = Some(AlignItems::Center),
"end" => style.align_items = Some(AlignItems::End),
"flex_end" => style.align_items = Some(AlignItems::FlexEnd),
"flex_start" => style.align_items = Some(AlignItems::FlexStart),
"start" => style.align_items = Some(AlignItems::Start),
"stretch" => style.align_items = Some(AlignItems::Stretch),
"baseline" => style.align_items = Some(AlignItems::BASELINE),
"center" => style.align_items = Some(AlignItems::CENTER),
"end" => style.align_items = Some(AlignItems::END),
"flex_end" => style.align_items = Some(AlignItems::FLEX_END),
"flex_start" => style.align_items = Some(AlignItems::FLEX_START),
"start" => style.align_items = Some(AlignItems::START),
"stretch" => style.align_items = Some(AlignItems::STRETCH),
_ => {
ctx.print_invalid_attrib(tag_name, key, value);
}
},
"align_content" => match value {
"center" => style.align_content = Some(AlignContent::Center),
"end" => style.align_content = Some(AlignContent::End),
"flex_end" => style.align_content = Some(AlignContent::FlexEnd),
"flex_start" => style.align_content = Some(AlignContent::FlexStart),
"space_around" => style.align_content = Some(AlignContent::SpaceAround),
"space_between" => style.align_content = Some(AlignContent::SpaceBetween),
"space_evenly" => style.align_content = Some(AlignContent::SpaceEvenly),
"start" => style.align_content = Some(AlignContent::Start),
"stretch" => style.align_content = Some(AlignContent::Stretch),
"center" => style.align_content = Some(AlignContent::CENTER),
"end" => style.align_content = Some(AlignContent::END),
"flex_end" => style.align_content = Some(AlignContent::FLEX_END),
"flex_start" => style.align_content = Some(AlignContent::FLEX_START),
"space_around" => style.align_content = Some(AlignContent::SPACE_AROUND),
"space_between" => style.align_content = Some(AlignContent::SPACE_BETWEEN),
"space_evenly" => style.align_content = Some(AlignContent::SPACE_EVENLY),
"start" => style.align_content = Some(AlignContent::START),
"stretch" => style.align_content = Some(AlignContent::STRETCH),
_ => {
ctx.print_invalid_attrib(tag_name, key, value);
}
},
"justify_content" => match value {
"center" => style.justify_content = Some(JustifyContent::Center),
"end" => style.justify_content = Some(JustifyContent::End),
"flex_end" => style.justify_content = Some(JustifyContent::FlexEnd),
"flex_start" => style.justify_content = Some(JustifyContent::FlexStart),
"space_around" => style.justify_content = Some(JustifyContent::SpaceAround),
"space_between" => style.justify_content = Some(JustifyContent::SpaceBetween),
"space_evenly" => style.justify_content = Some(JustifyContent::SpaceEvenly),
"start" => style.justify_content = Some(JustifyContent::Start),
"stretch" => style.justify_content = Some(JustifyContent::Stretch),
"center" => style.justify_content = Some(JustifyContent::CENTER),
"end" => style.justify_content = Some(JustifyContent::END),
"flex_end" => style.justify_content = Some(JustifyContent::FLEX_END),
"flex_start" => style.justify_content = Some(JustifyContent::FLEX_START),
"space_around" => style.justify_content = Some(JustifyContent::SPACE_AROUND),
"space_between" => style.justify_content = Some(JustifyContent::SPACE_BETWEEN),
"space_evenly" => style.justify_content = Some(JustifyContent::SPACE_EVENLY),
"start" => style.justify_content = Some(JustifyContent::START),
"stretch" => style.justify_content = Some(JustifyContent::STRETCH),
_ => {
ctx.print_invalid_attrib(tag_name, key, value);
}

View File

@ -122,8 +122,8 @@ impl WguiWindow {
bottom: length(0.0),
right: length(0.0),
},
taffy::JustifyContent::Start, // x start
taffy::AlignItems::Start, // y start
taffy::JustifyContent::START, // x start
taffy::AlignItems::START, // y start
),
WguiWindowPlacement::BottomLeft => (
taffy::Rect {
@ -132,8 +132,8 @@ impl WguiWindow {
bottom: length(params.position.y - window_padding),
right: length(0.0),
},
taffy::JustifyContent::Start, // x start
taffy::AlignItems::End, // y end
taffy::JustifyContent::START, // x start
taffy::AlignItems::END, // y end
),
WguiWindowPlacement::TopRight => (
taffy::Rect {
@ -142,8 +142,8 @@ impl WguiWindow {
bottom: length(0.0),
right: length(params.position.x - window_padding),
},
taffy::JustifyContent::End, // x end
taffy::AlignItems::Start, // y start
taffy::JustifyContent::END, // x end
taffy::AlignItems::START, // y start
),
WguiWindowPlacement::BottomRight => (
taffy::Rect {
@ -152,8 +152,8 @@ impl WguiWindow {
bottom: length(params.position.y - window_padding),
right: length(params.position.x - window_padding),
},
taffy::JustifyContent::End, // x end
taffy::AlignItems::End, // y end
taffy::JustifyContent::END, // x end
taffy::AlignItems::END, // y end
),
};