Skip to content

Commit

Permalink
Rename sprawl to taffy (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
alice-i-cecile authored Jun 10, 2022
1 parent de9123e commit 8936790
Show file tree
Hide file tree
Showing 496 changed files with 11,712 additions and 11,902 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ labels: bug
assignees: ''
---

## `sprawl` version
## `taffy` version

The release number or commit hash of the version you're using.

## Platform

What platform are you using `sprawl` on? e.g. Rust, Andriod, IOS, JavaScript/TypeScript
What platform are you using `taffy` on? e.g. Rust, Andriod, IOS, JavaScript/TypeScript

## What you did

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ New contributions are extremely welcome!

The basic process is simple:

1. Pick an [issue](https://github.com/DioxusLabs/sprawl/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22), or [file a new one](https://github.com/DioxusLabs/sprawl/issues/new).
1. Pick an [issue](https://github.com/DioxusLabs/taffy/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22), or [file a new one](https://github.com/DioxusLabs/taffy/issues/new).
2. Comment in the issue that you plan to tackle it, and the team will assign the task to you.
3. Submit a PR.
4. Respond to feedback from reviewers and make sure CI passes.
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "sprawl"
name = "taffy"
version = "0.1.0"
authors = [
"Alice Cecile <[email protected]>",
Expand All @@ -8,7 +8,7 @@ authors = [
edition = "2021"
include = ["src/**/*", "Cargo.toml"]
description = "A flexible UI layout library"
repository = "https://github.com/DioxusLabs/sprawl"
repository = "https://github.com/DioxusLabs/taffy"
keywords = ["cross-platform", "layout", "flexbox"]
categories = ["gui"]
license = "MIT"
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# sprawl
# taffy

[![GitHub CI](https://github.com/DioxusLabs/sprawl/actions/workflows/ci.yml/badge.svg)](https://github.com/DioxusLabs/sprawl/actions/workflows/ci.yml)
[![crates.io](https://img.shields.io/crates/v/sprawl.svg)](https://crates.io/crates/sprawl)
[![GitHub CI](https://github.com/DioxusLabs/taffy/actions/workflows/ci.yml/badge.svg)](https://github.com/DioxusLabs/taffy/actions/workflows/ci.yml)
[![crates.io](https://img.shields.io/crates/v/taffy.svg)](https://crates.io/crates/taffy)

`sprawl` is a flexible, high-performance, cross-platform UI layout library written in [Rust](https://www.rust-lang.org).
`taffy` is a flexible, high-performance, cross-platform UI layout library written in [Rust](https://www.rust-lang.org).

Currently, we only support a [flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/) layout algorithm, but support for other paradigms [is planned](https://github.com/DioxusLabs/sprawl/issues/28).
Currently, we only support a [flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/) layout algorithm, but support for other paradigms [is planned](https://github.com/DioxusLabs/taffy/issues/28).

This crate is a collaborative, cross-team project, and is designed to be used as a dependency for other UI and GUI libraries.
Right now, it powers:

- [Dioxus](https://dioxuslabs.com/): a React-like library for building fast, portable, and beautiful user interfaces with Rust
- [Bevy](https://bevyengine.org/): an ergonomic, ECS-first Rust game engine

[Contributions welcome](https://github.com/DioxusLabs/sprawl/blob/main/CONTRIBUTING.md):
if you'd like to use, improve or build `sprawl`, feel free to join the conversation, open an [issue](https://github.com/DioxusLabs/sprawl/issues) or submit a [PR](https://github.com/DioxusLabs/sprawl/pulls).
If you have questions about how to use `sprawl`, open a [discussion](https://github.com/DioxusLabs/sprawl/discussions) so we can answer your questions in a way that others can find.
[Contributions welcome](https://github.com/DioxusLabs/taffy/blob/main/CONTRIBUTING.md):
if you'd like to use, improve or build `taffy`, feel free to join the conversation, open an [issue](https://github.com/DioxusLabs/taffy/issues) or submit a [PR](https://github.com/DioxusLabs/taffy/pulls).
If you have questions about how to use `taffy`, open a [discussion](https://github.com/DioxusLabs/taffy/discussions) so we can answer your questions in a way that others can find.
8 changes: 4 additions & 4 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
### 0.1.0 Changed

- the `order` field of `Layout` is now public, and describes the relative z-ordering of nodes
- renamed crate from `stretch2` to `sprawl`
- renamed crate from `stretch2` to `taffy`
- updated to the latest version of all dependencies to reduce upstream pain caused by duplicate dependencies
- renamed `stretch::node::Strech` -> `sprawl::node::Sprawl`
- renamed `stretch::node::Strech` -> `taffy::node::Taffy`

### 0.1.0 Fixed

Expand All @@ -18,14 +18,14 @@
- removed Javascript / Kotlin / Swift bindings
- the maintainer team lacks expertise to keep these working
- more serious refactors are planned, and this will be challenging to keep working through that process
- if you are interested in helping us maintain bindings to other languages, [get in touch](https://github.com/DioxusLabs/sprawl/discussions)!
- if you are interested in helping us maintain bindings to other languages, [get in touch](https://github.com/DioxusLabs/taffy/discussions)!
- the `serde_camel_case` and `serde_kebab_case` features have been removed: they were poorly motivated and were not correctly additive (if both were enabled compilation would fail)
- removed the `Direction` and `Overflow` structs, and the corresponding `direction` and `overflow` fields from `Style`
- these had no effect in the current code base and were actively misleading

## stretch2 0.4.3

This is the final release of `stretch`: migrate to the crate named `sprawl` for future fixes and features!
This is the final release of `stretch`: migrate to the crate named `taffy` for future fixes and features!

These notes describe the differences between this release and `stretch` 0.3.2, the abandoned crate from which this library was forked.

Expand Down
118 changes: 59 additions & 59 deletions benches/complex.rs
Original file line number Diff line number Diff line change
@@ -1,144 +1,144 @@
use criterion::{criterion_group, criterion_main, Criterion};

fn build_deep_hierarchy(sprawl: &mut sprawl::node::Sprawl) -> sprawl::node::Node {
let node111 = sprawl
fn build_deep_hierarchy(taffy: &mut taffy::node::Taffy) -> taffy::node::Node {
let node111 = taffy
.new_node(
sprawl::style::Style {
size: sprawl::geometry::Size {
width: sprawl::style::Dimension::Points(10.0),
height: sprawl::style::Dimension::Points(10.0),
taffy::style::Style {
size: taffy::geometry::Size {
width: taffy::style::Dimension::Points(10.0),
height: taffy::style::Dimension::Points(10.0),
},
..Default::default()
},
&[],
)
.unwrap();
let node112 = sprawl
let node112 = taffy
.new_node(
sprawl::style::Style {
size: sprawl::geometry::Size {
width: sprawl::style::Dimension::Points(10.0),
height: sprawl::style::Dimension::Points(10.0),
taffy::style::Style {
size: taffy::geometry::Size {
width: taffy::style::Dimension::Points(10.0),
height: taffy::style::Dimension::Points(10.0),
},
..Default::default()
},
&[],
)
.unwrap();

let node121 = sprawl
let node121 = taffy
.new_node(
sprawl::style::Style {
size: sprawl::geometry::Size {
width: sprawl::style::Dimension::Points(10.0),
height: sprawl::style::Dimension::Points(10.0),
taffy::style::Style {
size: taffy::geometry::Size {
width: taffy::style::Dimension::Points(10.0),
height: taffy::style::Dimension::Points(10.0),
},
..Default::default()
},
&[],
)
.unwrap();
let node122 = sprawl
let node122 = taffy
.new_node(
sprawl::style::Style {
size: sprawl::geometry::Size {
width: sprawl::style::Dimension::Points(10.0),
height: sprawl::style::Dimension::Points(10.0),
taffy::style::Style {
size: taffy::geometry::Size {
width: taffy::style::Dimension::Points(10.0),
height: taffy::style::Dimension::Points(10.0),
},
..Default::default()
},
&[],
)
.unwrap();

let node11 = sprawl.new_node(sprawl::style::Style { ..Default::default() }, &[node111, node112]).unwrap();
let node12 = sprawl.new_node(sprawl::style::Style { ..Default::default() }, &[node121, node122]).unwrap();
let node1 = sprawl.new_node(sprawl::style::Style { ..Default::default() }, &[node11, node12]).unwrap();
let node11 = taffy.new_node(taffy::style::Style { ..Default::default() }, &[node111, node112]).unwrap();
let node12 = taffy.new_node(taffy::style::Style { ..Default::default() }, &[node121, node122]).unwrap();
let node1 = taffy.new_node(taffy::style::Style { ..Default::default() }, &[node11, node12]).unwrap();

let node211 = sprawl
let node211 = taffy
.new_node(
sprawl::style::Style {
size: sprawl::geometry::Size {
width: sprawl::style::Dimension::Points(10.0),
height: sprawl::style::Dimension::Points(10.0),
taffy::style::Style {
size: taffy::geometry::Size {
width: taffy::style::Dimension::Points(10.0),
height: taffy::style::Dimension::Points(10.0),
},
..Default::default()
},
&[],
)
.unwrap();
let node212 = sprawl
let node212 = taffy
.new_node(
sprawl::style::Style {
size: sprawl::geometry::Size {
width: sprawl::style::Dimension::Points(10.0),
height: sprawl::style::Dimension::Points(10.0),
taffy::style::Style {
size: taffy::geometry::Size {
width: taffy::style::Dimension::Points(10.0),
height: taffy::style::Dimension::Points(10.0),
},
..Default::default()
},
&[],
)
.unwrap();

let node221 = sprawl
let node221 = taffy
.new_node(
sprawl::style::Style {
size: sprawl::geometry::Size {
width: sprawl::style::Dimension::Points(10.0),
height: sprawl::style::Dimension::Points(10.0),
taffy::style::Style {
size: taffy::geometry::Size {
width: taffy::style::Dimension::Points(10.0),
height: taffy::style::Dimension::Points(10.0),
},
..Default::default()
},
&[],
)
.unwrap();
let node222 = sprawl
let node222 = taffy
.new_node(
sprawl::style::Style {
size: sprawl::geometry::Size {
width: sprawl::style::Dimension::Points(10.0),
height: sprawl::style::Dimension::Points(10.0),
taffy::style::Style {
size: taffy::geometry::Size {
width: taffy::style::Dimension::Points(10.0),
height: taffy::style::Dimension::Points(10.0),
},
..Default::default()
},
&[],
)
.unwrap();

let node21 = sprawl.new_node(sprawl::style::Style { ..Default::default() }, &[node211, node212]).unwrap();
let node22 = sprawl.new_node(sprawl::style::Style { ..Default::default() }, &[node221, node222]).unwrap();
let node21 = taffy.new_node(taffy::style::Style { ..Default::default() }, &[node211, node212]).unwrap();
let node22 = taffy.new_node(taffy::style::Style { ..Default::default() }, &[node221, node222]).unwrap();

let node2 = sprawl.new_node(sprawl::style::Style { ..Default::default() }, &[node21, node22]).unwrap();
let node2 = taffy.new_node(taffy::style::Style { ..Default::default() }, &[node21, node22]).unwrap();

sprawl.new_node(sprawl::style::Style { ..Default::default() }, &[node1, node2]).unwrap()
taffy.new_node(taffy::style::Style { ..Default::default() }, &[node1, node2]).unwrap()
}

fn sprawl_benchmarks(c: &mut Criterion) {
fn taffy_benchmarks(c: &mut Criterion) {
c.bench_function("deep hierarchy - build", |b| {
b.iter(|| {
let mut sprawl = sprawl::node::Sprawl::new();
build_deep_hierarchy(&mut sprawl);
let mut taffy = taffy::node::Taffy::new();
build_deep_hierarchy(&mut taffy);
})
});

c.bench_function("deep hierarchy - single", |b| {
b.iter(|| {
let mut sprawl = sprawl::node::Sprawl::new();
let root = build_deep_hierarchy(&mut sprawl);
sprawl.compute_layout(root, sprawl::geometry::Size::undefined()).unwrap()
let mut taffy = taffy::node::Taffy::new();
let root = build_deep_hierarchy(&mut taffy);
taffy.compute_layout(root, taffy::geometry::Size::undefined()).unwrap()
})
});

c.bench_function("deep hierarchy - relayout", |b| {
let mut sprawl = sprawl::node::Sprawl::new();
let root = build_deep_hierarchy(&mut sprawl);
let mut taffy = taffy::node::Taffy::new();
let root = build_deep_hierarchy(&mut taffy);

b.iter(|| {
sprawl.mark_dirty(root).unwrap();
sprawl.compute_layout(root, sprawl::geometry::Size::undefined()).unwrap()
taffy.mark_dirty(root).unwrap();
taffy.compute_layout(root, taffy::geometry::Size::undefined()).unwrap()
})
});
}

criterion_group!(benches, sprawl_benchmarks);
criterion_group!(benches, taffy_benchmarks);
criterion_main!(benches);
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
pub fn compute() {
let mut sprawl = sprawl::Sprawl::new();
let node0 = sprawl
let mut taffy = taffy::Taffy::new();
let node0 = taffy
.new_node(
sprawl::style::Style {
position_type: sprawl::style::PositionType::Absolute,
size: sprawl::geometry::Size {
width: sprawl::style::Dimension::Points(60f32),
height: sprawl::style::Dimension::Points(40f32),
taffy::style::Style {
position_type: taffy::style::PositionType::Absolute,
size: taffy::geometry::Size {
width: taffy::style::Dimension::Points(60f32),
height: taffy::style::Dimension::Points(40f32),
..Default::default()
},
..Default::default()
},
&[],
)
.unwrap();
let node = sprawl
let node = taffy
.new_node(
sprawl::style::Style {
align_items: sprawl::style::AlignItems::Center,
justify_content: sprawl::style::JustifyContent::Center,
size: sprawl::geometry::Size {
width: sprawl::style::Dimension::Points(110f32),
height: sprawl::style::Dimension::Points(100f32),
taffy::style::Style {
align_items: taffy::style::AlignItems::Center,
justify_content: taffy::style::JustifyContent::Center,
size: taffy::geometry::Size {
width: taffy::style::Dimension::Points(110f32),
height: taffy::style::Dimension::Points(100f32),
..Default::default()
},
..Default::default()
},
&[node0],
)
.unwrap();
sprawl.compute_layout(node, sprawl::geometry::Size::undefined()).unwrap();
taffy.compute_layout(node, taffy::geometry::Size::undefined()).unwrap();
}
Loading

0 comments on commit 8936790

Please sign in to comment.