fix(deps): update rust crate taffy to 0.7 #46
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
0.3
->0.7
Release Notes
DioxusLabs/taffy (taffy)
v0.7.0
Compare Source
Changed
cache_mut
method on theLayoutPartialTree
trait has been replaced with a separateCacheTree
trait. This allowsTaffy to be more easily used without caching or with a custom cache implementation.
TaffyTree::set_children
method now removes the children from their previous parent (if they have one).Added
Layout
v0.6.3
Compare Source
Fixes
v0.6.2
Compare Source
Fixes
v0.6.1
Compare Source
Fixes
auto-fill
/auto-fit
repetition count when container has a definite percentage size (#722)v0.6.0
Compare Source
Highlights
Style
struct has been "traitified". This supports Taffy's integration in Servo and generally makes Taffy more flexible. TheStyle
struct still exists and implements the new traits so existing uses of Taffy will continue to work as before.box-sizing
style is supportedLayout
Fixes
print_tree()
when rounding is disabled (#680)Added
<center>
and<div align="..">
) is supportedis_table
for block items (#701)Debug
andClone
forCache
(#688)Debug
andPartialEq
for tree types (#697)v0.5.2
Compare Source
v0.5.1
Compare Source
v0.5.0
Compare Source
The changes in 0.5 are relatively small but the new measure function parameter is a breaking change so it requires a minor version bump.
style: &Style
parameter has been added to measure functions.MaybeMath
,MaybeResolve
, andResolveOrZero
traits have been made public.v0.4.4
Compare Source
Fixes
align-content
/justify-content
) behaviour was updated to match the latest spec (and Chrome 123+) (#635)v0.4.3
Compare Source
Fixes
evenly_sized_tracks
style helper in recent versions of rustc caused by a change/regression in typeinference (#643). Note that 3rd-party code that call style helpers that take an
Into<f32>
parameter may still be affected by this issue,but they should be able to fix on their side by clarifying the type passed in
v0.4.2
Compare Source
v0.4.1
Compare Source
v0.4.0
Compare Source
Highlights
display: block
)overflow
property (+scrollbar_width
foroverflow: scroll
)padding
andborder
are now output into theLayout
structBlock layout
Support for CSS Block layout has been added. This can be used via the new
Display::Block
variant of theDisplay
enum. Note that full flow layout: inline, inline-block and float layout have not been implemented. The use case supported is block container nodes which contain block-level children.Overflow property
Support has been added for a new
overflow
style property withVisible
,Clip
,Hidden
, andScroll
values (Auto
is not currently implemented). Additionally ascrollbar_width
property has been added to control the size of scrollbars for nodes withOverflow::Scroll
set.Visible
andClip
will produce layouts equivalent to the Taffy 0.3.Clip
will affect the newcontent_size
output by restricting it to the available space.Hidden
andScroll
affect layout by changing the automatic minimum size of Flexbox and Grid childrenScroll
additionally reservesscrollbar_width
pixels for a scrollbar in the opposite axis to which scrolling is enabled.Scroll
withscrollbar_width
set to zero is equivalent toHidden
.Measure function changes
The "measure function" API for integrating Taffy with other measurement systems (such as text layout) has been changed to be more flexible
and to interact better with borrow checking (you can now borrow external data in your measure function!).
Taffy
tree is now a genericTaffyTree<T>
whereT
is the "context" type.behaviour then your measure function should return
Size::ZERO
for leaf nodes whose context isNone
.If you are not using measure functions, then the only change you will need to make is from:
to
And generally update any uses of
Taffy
in your codebase toTaffyTree<()>
.If you are using measure functions then you will need to make some bigger (but straightforward) changes. The following Taffy 0.3 code:
Should become something like the following with Taffy 0.4:
Note that:
Size
in the above example. This includes your own custom type (which can be an enum or a trait object).()
for the context typecompute_layout_with_measure
only needs to exist for the duration of a single layout run,it can (mutably) borrow data from it's environment
Low-level API (
LayoutTree
trait) refactorThe low-level API has been completely reworked:
LayoutTree
trait has been split into 5 smaller traits which live in thetaffy::tree:traits
module (along with their associated documentation)LayoutTree
traits entirely:parent
,is_childless
,measure_node
,needs_measure
, andmark_dirty
.taffy::node::Node
has been replaced withtaffy::NodeId
. This should make it much easier to implement the low-level traits as the underlying type backing the node id now au64
rather than aslotmap::DefaultKey
.compute_flexbox_layout
compute_grid_layout
compute_block_layout
compute_leaf_layout
compute_root_layout
compute_hidden_layout
It is believed that nobody was previously using the low-level API so we are not providing a migration guide. However, along with the refactor we have greatly
improved both the documentation and have added examples using the new API, both of which are linked to from the main documentation page.
Module hierarchy changes
The specific changes are detailed below. However for most users the most significant change will be that almost all types are now re-exported from the root module. This means that module specific imports like
use taffy::layout::Layout
can now in almost all cases be replaced with the simpleruse taffy::Layout
.Specific changes:
math
module has been made privateaxis
module has been merged into thegeometry
moduleprint_tree
function is now accessible underutil
.node
,data
,layout
,error
andcache
modules have been moved to the thetree
module.layout_flexbox()
function has been removed from the prelude. Usetaffy::compute_flexbox_layout
instead.Many APIs have been renamed to replace
points
orPoints
withlength
orLength
This new name better describes one-dimensional measure of space in some unspecified unit
which is often unrelated to the PostScript point or the CSS
pt
unit.This also removes a misleading similarity with the 2D
Point
,whose components can have any unit and are not even necessarily absolute lengths.
Example usage change:
Other Changes
Taffy
type was renamed toTaffyTree
and made generic of a context parameterflexbox
feature. Theflexbox
feature is enabled by default.justify_self
property has been moved behind thegrid
feature.RunMode::PeformLayout
renamed intoRunMode::PerformLayout
(added missingr
).serde
dependency has been made compatible withno_std
environmentsslotmap
dependency has been made compatible withno_std
environmentsinsert_child_at_index()
method to theTaffyTree
. This can be used to insert a child node at any position instead of just the end.total_node_count()
method to theTaffyTree
which returns the total number of nodes in the tree.get_disjoint_node_context_mut()
method to theTaffyTree
. This can be used to safely get multiple mutable borrows at the same time.Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.