Deno bindings for yoga, using Deno FFI.

Overview

deno_yoga

Deno bindings for yoga, using Deno FFI.

Usage

flags:

  • --allow-ffi: Requires ffi access to "yogacore.dll", "libyogacore.so", "libyogacore.dylib"
  • --unstable: FFI is unstable feature
import * as Yoga from "https://deno.land/x/yoga/mod.ts";

const root = Yoga.Node.create();
root.setWidth(500);
root.setHeight(300);
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);

const node1 = Yoga.Node.create();
node1.setWidth(100);
node1.setHeight(100);

const node2 = Yoga.Node.create();
node2.setWidth(100);
node2.setHeight(100);

root.insertChild(node1, 0);
root.insertChild(node2, 1);

root.calculateLayout(500, 300, Yoga.DIRECTION_LTR);
console.log(root.getComputedLayout());
// {left: 0, top: 0, width: 500, height: 300}
console.log(node1.getComputedLayout());
// {left: 150, top: 0, width: 100, height: 100}
console.log(node2.getComputedLayout());
// {left: 250, top: 0, width: 100, height: 100}

console.log(`Height is: ${root.getHeight()}, Width is: ${root.getWidth()}`);
// Height is: 300, Width is: 500

Examples

deno run --allow-ffi --unstable https://deno.land/x/yoga/examples/basic.ts

Status

  • absolute_position_test 10/21
  • lign_baseline_test 2/2
  • align_content_test 19/19
  • align_items_test 28/28
  • align_self_test 5/5
  • android_news_feed 1/1
  • border_test 5/5
  • computed_border_test 1/1
  • computed_margin_test 1/1
  • computed_padding_test 1/1
  • dimension_test 2/2
  • dirtied_test 0/4
  • display_test 6/6
  • flex_direction_test 6/6
  • flex_test 10/10
  • flex_wrap_test 20/20
  • justify_content_test 18/18
  • margin_test 30/30
  • measure_cache_test 0/1
  • measure_test 1/1
  • min_max_dimension_test 26/26
  • padding_test 6/6
  • percentage_test 18/20
  • rounding_test 13/13
  • size_overflow_test 3/3

License

deno_yoga is released under the MIT License. See the bundled LICENSE file for details.

You might also like...

JS bindings and playground of post-quantum asymmetric ciphers

pqc.js Overview This project provides JS bindings and playground of post-quantum asymmetric cipher compiled to WebAssembly using emscripten with a fal

Oct 30, 2022

This is a simple boilerplate for a Deno website, deployed with Deno Deploy.

Simple Deno Website Boilerplate This is a simple website boilerplate built using Deno and deployed using Deno Deploy. Demo at simple-deno-website-boil

Dec 3, 2022

TypeSafe MongoDB Atlas Data API SDK for Deno & Deno Deploy

Atlas SDK atlas_sdk is a TypeSafe MongoDB Atlas Data API SDK for Deno & Deno Deploy Links Docs Import Replace LATEST_VERSION with current latest versi

Dec 26, 2022

🛣️ A tiny and fast http request router designed for use with deno and deno deploy

Rutt Rutt is a tiny http router designed for use with deno and deno deploy. It is written in about 200 lines of code and is pretty fast, using an exte

Dec 10, 2022

A small, but powerful HTTP library for Deno & Deno Deploy, built for convenience and simplicity

A small, but powerful HTTP library for Deno & Deno Deploy, built for convenience and simplicity

Wren Wren is a small, but powerful HTTP library for Deno & Deno Deploy, built for convenience and simplicity. convenient aliases for HTTP responses au

Dec 12, 2022

deno-ja (Deno Japanese community) showcase

Showcase Deno本家よりも気軽に作ったものを公開できるようなShowcaseです。 スクリーンショットの撮影方法 短めのidを決めていただいて、下記のようにスクリプトを実行してください。 deno task screenshot [url] [id] ※エラーが出る場合は、下記を実行してみ

Oct 28, 2022

A command-line tool to manage Deno scripts installed via deno install

🏞️ nublar nublar is a command-line tool to manage your scripts installed via deno install. 🛳️ Installation deno install --allow-read --allow-write -

Dec 26, 2022

🦕 Deno port of Microsoft/vscode-textmate: A library that helps tokenize text using TextMate grammars.

TextMate A library that helps tokenize text using TextMate grammars. Deno port of Microsoft/vscode-textmate. See original license here. An interpreter

Sep 13, 2022

Deno module to generate images from source code using Aloxaf/silicon.

Deno module to generate images from source code using Aloxaf/silicon.

deno-silicon Deno module to generate images from source code using Aloxaf/silicon. Dependencies Please refer silicon's dependencies Support Version de

Dec 13, 2022
Owner
迷渡
Creator of vscode-deno. Currently a contributor to Deno @denoland.
迷渡
Proposal(s) for a stable Deno FFI API

Proposal(s) for a stable API for Deno FFI In this repository I propose a possible stable APIs for Deno FFI. The proposals are split into folders by to

Aapo Alasuutari 6 Dec 5, 2022
Fastest JavaScript client for MySQL, with Deno FFI.

mysql-native The fastest [1] JavaScript MySQL client. import { Connection } from "https://deno.land/x/mysql_native/mod.ts"; const conn = new Connectio

Deno Drivers 7 Sep 27, 2022
CF Workers Wrangler GraphQL Yoga template 📦 🚀

GraphQL Yoga for Cloudflare Workers (Wrangler template) Fully-featured GraphQL Server with focus on easy setup, performance & great developer experien

The Guild 23 Nov 17, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Opinionated collection of TypeScript definitions and utilities for Deno and Deno Deploy. With complete types for Deno/NPM/TS config files, constructed from official JSON schemas.

Schemas Note: You can also import any type from the default module, ./mod.ts deno.json import { type DenoJson } from "https://deno.land/x/[email protected]

deno911 2 Oct 12, 2022
Create your own wrappings with optional key bindings for selected text, a set of useful defaults is also provided.

Create your own wrappings with optional key bindings for selected text, a set of useful defaults is also provided.

Seth Yuan 66 Jan 1, 2023
Melon.js game engine bindings for Solid

Melon Solid This project fuses the awesome frameworks Melon.js (for game development) and Solid.js (for making websites). By combining them together y

null 10 Oct 4, 2022
🦆 lightning fast duckdb bindings for bun runtime

@evan/duckdb lightning fast duckdb bindings for bun runtime Install bun add @evan/duckdb Features ?? batteries included ?? jit optimized bindings ?? 4

evan 29 Oct 20, 2022