gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 5364Rust 86Markdown 12TOML 91841 Sutichaykuna

⎇ b15d179fa7eb68d71fed80f98d103aa4b04d865f README.md Markdown · 89 siq'ikuna · 4.9 KB Ñawpa willay ch'uya

Add badges to readme 831362752 · Emil Sjölander ·

1# Stretch
2[![CircleCI](https://circleci.com/gh/vislyhq/stretch.svg?style=svg)](https://circleci.com/gh/vislyhq/stretch)
3[![Cargo](https://img.shields.io/crates/v/stretch.svg)](https://crates.io/crates/stretch)
4[![npm](https://img.shields.io/npm/v/stretch-layout.svg)](https://www.npmjs.com/package/stretch-layout)
5[![cocoapods](https://img.shields.io/cocoapods/v/StretchKit.svg)](https://cocoapods.org/pods/StretchKit)
6[![bintray](https://api.bintray.com/packages/visly/maven/stretch-kotlin-bindings/images/download.svg)](https://bintray.com/visly/maven/stretch-kotlin-bindings)
7
8Stretch is an implemnetation of Flexbox written in [Rust](https://www.rust-lang.org). The goal of stretch is to provide a solid foundation for layout across all platforms with a specific focus on mobile. Long term we want stretch to not only support flexbox but also many other layout algorithms such as grid layout. Stretch was made for and powers https://visly.app.
9
10## Goals
11Before using or contributing to stretch it is good to be aware of the core goals of the project. These are goals we are working towards, not necessarily features we currently support.
12
13- High performance
14- Cross platform
15- Small binary size
16- Support multiple layout systems
17- Multi-threaded layout
18- Language bindings for most common languages
19
20## Usage
21Stretch is still in its initial development phase so we currently don't publish any artifacts to package managers. If you want to use stretch today or start contributing to the development of stretch you will need to build it locally.
22
23### Installation
24If you don't have rust installed you have to do that first as well as install some components that we make use of to format and lint the codebase. For more on rust see their [website](https://www.rust-lang.org).
25
26```bash
27curl https://sh.rustup.rs -sSf | sh
28rustup component add rustfmt
29rustup component add clippy
30```
31
32Once that is done you can clone the repo and do some sanity checks to make sure everything is working correctly.
33
34```bash
35git clone https://github.com/vislyhq/stretch.git
36cd stretch
37cargo test
38```
39
40### Testing
41Stretch is tested by validating that layouts written in stretch perform the same as in Chrome. This is done by rendering an equivalent layout in HTML and then generating a rust test case which asserts that the resulting layout is the same when run through stretch.
42
43You can run these tests without setting up a webdriver environment but if you are looking to add any test case you will need to install [chromedriver](http://chromedriver.chromium.org). If you are developing on macOS this is easy to do through brew.
44
45```bash
46brew tap homebrew/cask
47brew cask install chromedriver
48```
49
50Once you have chromedriver installed and available in `PATH` you can re-generate all tests by running `cargo run --package gentest`.
51
52To add a new test case add another HTML file to `/test_fixtures` following the current tests as a template for new tests.
53
54## Contributing
55Contributions are very welcome. Though we ask that you open an issue or pull request early in the process (before writing code) so we can discuss solutions and additions before you start spending time on implementing them. There are some specific areas where we would be extra happy to receive contributions in.
56
57- Binary size reduction
58- Runtime performance
59- Ensure build / test environment works well on non macOS platforms
60- Alternate layout systems (grid layout perhaps?)
61- Web compatibility tests
62- RTL support
63- Platform bindings
64
65## Relationship to Yoga
66[Yoga](https://www.yogalayout.com) is a cross-platform implementation of Flexbox written in C. Yoga is a fantastic project but has some fundamental issues which we hope to resolve. Compared to Yoga we aim to have a stronger adherence to web standards, a flexible architecture eventually supporting multiple layout algorithms, and future performance improvements including multi-threaded layout. In addition to this we aim to use a safer language with a more modern codebase.
67
68# LICENCE
69```
70Copyright (c) 2018 Visly Inc.
71
72Permission is hereby granted, free of charge, to any person obtaining a copy
73of this software and associated documentation files (the "Software"), to deal
74in the Software without restriction, including without limitation the rights
75to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
76copies of the Software, and to permit persons to whom the Software is
77furnished to do so, subject to the following conditions:
78
79The above copyright notice and this permission notice shall be included in all
80copies or substantial portions of the Software.
81
82THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
83IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
84FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
85AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
86LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
87OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
88SOFTWARE.
89```

README.md

Stretch

CircleCI Cargo npm cocoapods bintray

Stretch is an implemnetation of Flexbox written in Rust. The goal of stretch is to provide a solid foundation for layout across all platforms with a specific focus on mobile. Long term we want stretch to not only support flexbox but also many other layout algorithms such as grid layout. Stretch was made for and powers https://visly.app.

Goals

Before using or contributing to stretch it is good to be aware of the core goals of the project. These are goals we are working towards, not necessarily features we currently support.

Usage

Stretch is still in its initial development phase so we currently don't publish any artifacts to package managers. If you want to use stretch today or start contributing to the development of stretch you will need to build it locally.

Installation

If you don't have rust installed you have to do that first as well as install some components that we make use of to format and lint the codebase. For more on rust see their website.

curl https://sh.rustup.rs -sSf | sh
rustup component add rustfmt
rustup component add clippy

Once that is done you can clone the repo and do some sanity checks to make sure everything is working correctly.

git clone https://github.com/vislyhq/stretch.git
cd stretch
cargo test

Testing

Stretch is tested by validating that layouts written in stretch perform the same as in Chrome. This is done by rendering an equivalent layout in HTML and then generating a rust test case which asserts that the resulting layout is the same when run through stretch.

You can run these tests without setting up a webdriver environment but if you are looking to add any test case you will need to install chromedriver. If you are developing on macOS this is easy to do through brew.

brew tap homebrew/cask
brew cask install chromedriver

Once you have chromedriver installed and available in PATH you can re-generate all tests by running cargo run --package gentest.

To add a new test case add another HTML file to /test_fixtures following the current tests as a template for new tests.

Contributing

Contributions are very welcome. Though we ask that you open an issue or pull request early in the process (before writing code) so we can discuss solutions and additions before you start spending time on implementing them. There are some specific areas where we would be extra happy to receive contributions in.

Relationship to Yoga

Yoga is a cross-platform implementation of Flexbox written in C. Yoga is a fantastic project but has some fundamental issues which we hope to resolve. Compared to Yoga we aim to have a stronger adherence to web standards, a flexible architecture eventually supporting multiple layout algorithms, and future performance improvements including multi-threaded layout. In addition to this we aim to use a safer language with a more modern codebase.

LICENCE

Copyright (c) 2018 Visly Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.