Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Wasm bindings #394

Draft
wants to merge 43 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
92116b6
Add wasm_bindgen annotations to enums (behind wasm feature)
nicoburns Mar 11, 2023
53e87c1
Add TryFrom<Dimension> impls for LengthPercentage and LengthPercentag…
nicoburns Mar 12, 2023
890fbce
Wasm bindings WIP
nicoburns Mar 12, 2023
8d7913c
Simplify JsValue accessing code
nicoburns Mar 12, 2023
690d0ac
Improve AvailableSpace parsing
nicoburns Mar 12, 2023
8bb725f
Add FromStr impls to Dimension and AvailableSpace
nicoburns Mar 12, 2023
f977612
Use Dimension and AvailableSpace's FromStr impls in wasm bindings
nicoburns Mar 12, 2023
3a9e5ff
Add TODO for measure functions
nicoburns Mar 12, 2023
c481ea2
Feature flag Display::Grid variant in From<i32> impl
nicoburns Mar 12, 2023
45c39b0
Enable measure func setting
nicoburns Mar 12, 2023
f1c62d9
Add wasm_test.html
nicoburns Mar 20, 2023
94eaca2
Bump package version to 0.3.9
nicoburns Mar 20, 2023
5d681b4
Add set_flex_grow and set_height functions
nicoburns Mar 20, 2023
6f15afd
Don't parse styles when creating nodes
nicoburns Mar 20, 2023
2608814
Add style_mut function to Taffy struct
nicoburns Mar 20, 2023
975a6f9
Improve test page
nicoburns Mar 20, 2023
c8f54c8
Remove style property from Node
nicoburns Mar 24, 2023
8d36740
Add style getter/setter macros + add a few more methods
nicoburns Mar 24, 2023
dc2dc07
wasm test: log to div rather than console + reduce warmup iterations
nicoburns Mar 24, 2023
f917a6e
Flesh out wasm API
nicoburns Apr 5, 2023
b3beedd
Fix clippy lints
nicoburns Apr 5, 2023
40eb6c3
cargo fmt
nicoburns Apr 5, 2023
677d9e1
Fix clippy lints
nicoburns Apr 5, 2023
884956e
Merge branch 'main' into wasm-bindings
nicoburns Jan 13, 2024
77d8b03
Rename Allocator to TaffyTree
nicoburns Jan 13, 2024
0815709
Fix compilation with flexbox feature disabled
nicoburns Jan 17, 2024
f1fa708
Use fair iteration count in test
nicoburns Jan 17, 2024
5f2f88a
Move unused code out of lib.rs
nicoburns Jan 18, 2024
ba699b5
Actually use wasm measure function
nicoburns Jan 18, 2024
b180f38
Fix clippy lints
nicoburns Jan 18, 2024
be88889
Format wasm bindings
nicoburns Jan 18, 2024
2355399
Add CI checks for WASM bindings
nicoburns Jan 18, 2024
c32b246
Disable documentation requirement for WASM bindings
nicoburns Jan 18, 2024
b20c710
Fix WASM doc check
nicoburns Jan 18, 2024
a9e2de5
Use Option for alignment setters
nicoburns Jan 18, 2024
491fcd8
Use option for setting aspect ratio
nicoburns Jan 18, 2024
3361b25
Move utils code into lib.rs
nicoburns Jan 18, 2024
2b3aa8c
Add overflow to prelude
nicoburns Jan 18, 2024
0e1aa1c
Add WASM bindings for overflow property
nicoburns Jan 18, 2024
80b572b
Add WASM bindings for scrollbar_width
nicoburns Jan 18, 2024
f22610b
Uncomment grid_auto_flow bindings
nicoburns Jan 18, 2024
c2001d3
Fix duplicate childCount
nicoburns Jan 18, 2024
c9ed1e6
Merge branch 'main' into wasm-bindings
nicoburns Mar 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
on:
pull_request:
push:
branches:
- main

name: WASM

env:
RUSTDOCFLAGS: "-D warnings"
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: "sparse"

jobs:
# Default
test-features-default:
name: "Build & Test"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo build
- run: cargo test

fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- run: cargo fmt -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: clippy
- run: cargo +nightly clippy -- -D warnings

doc:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- run: cargo doc
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ num-traits = { version = "0.2", default-features = false }
serde = { version = "1.0", default-features = false, optional = true, features = ["serde_derive"] }
slotmap = { version = "1.0.6", default-features = false, optional = true }
grid = { version = "0.13.0", default-features = false, optional = true }
wasm-bindgen = { version = "0.2.84", optional = true }

### FEATURES #################################################################

Expand Down Expand Up @@ -51,6 +52,8 @@ serde = ["dep:serde"]
std = ["num-traits/std", "grid?/std", "serde?/std", "slotmap?/std"]
# Allow Taffy to depend on the alloc library
alloc = ["serde?/alloc"]
# Enable WASM bindgen derives on core types
wasm = ["dep:wasm-bindgen"]
# Internal feature for debugging
debug = ["std"]
# Internal feature for profiling
Expand Down
1 change: 1 addition & 0 deletions bindings/wasm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target
27 changes: 27 additions & 0 deletions bindings/wasm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[package]
name = "taffy-layout"
version = "0.3.9"
edition = "2021"

# This crate is for WASM bindings: it should never be published to crates.io
publish = false

[lib]
crate-type = ["cdylib", "rlib"]

[features]
default = ["console_error_panic_hook"]

[dependencies]
wasm-bindgen = "0.2.84"
js-sys = "0.3"
taffy = { path = "../..", features = ["wasm"] }
console_error_panic_hook = { version = "0.1.1", optional = true }

[dev-dependencies]
wasm-bindgen-test = "0.3.33"

[profile.release]
opt-level = "s"

[workspace]
Loading