kiwi.js
Kiwi is a high speed implementation of the Cassowary constraint solving algorithm
Last updated 6 years ago by ijzerenhein .
BSD-3-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ npm install kiwi.js 
SYNC missed versions from official npm registry.

THIS REPOSITORY IS NO LONGER MAINTAINED

Looking for an alternative? Please have a look at lume/kiwi.

If you are interested in maintaining this repository (and taking ownership of it), please reach out to me here.

kiwi.js

view on npm Build Status codecov

Kiwi.js is a fast TypeScript implementation of the Cassowary constraint solving algorithm, based on the seminal Cassowary paper. Originally created by Chris Colbert, it was redesigned from the ground up to be lightweight, fast and easy to maintain. View the benchmarks to see how it compares to Cassowary.js.

Index

Getting started

Install using NPM:

npm install kiwi.js

The following example creates a solver which automatically calculates the width:

import * as kiwi from 'kiwi.js';
import { equal } from 'assert';

// Create a solver
var solver = new kiwi.Solver();

// Create edit variables
var left = new kiwi.Variable();
var width = new kiwi.Variable();
solver.addEditVariable(left, kiwi.Strength.strong);
solver.addEditVariable(width, kiwi.Strength.strong);
solver.suggestValue(left, 100);
solver.suggestValue(width, 400);

// Create and add a constraint
var right = new kiwi.Variable();
solver.addConstraint(new kiwi.Constraint(new kiwi.Expression([-1, right], left, width), kiwi.Operator.Eq));

// Solve the constraints
solver.updateVariables();
equal(right.value(), 500);

Documentation

Benchmarks

To run the benchmark in the browser, just visit this page.

To run the benchmark locally using nodejs, clone or download this repository and execute the following steps:

npm install
npm run bench

Tests

To run the tests in the browser, just visit this page.

To run the tests locally using nodejs, clone or download this repository and execute the following steps:

npm install
npm run build && npm run test

Contribute

If you like this project and want to support it, show some love and give it a star.

Current Tags

  • 1.1.3                                ...           latest (3 years ago)

7 Versions

  • 1.1.3                                ...           3 years ago
  • 1.1.2                                ...           5 years ago
  • 1.1.1                                ...           6 years ago
  • 1.1.0                                ...           6 years ago
  • 1.0.2                                ...           7 years ago
  • 1.0.1                                ...           8 years ago
  • 1.0.0                                ...           8 years ago
Maintainers (1)
Downloads
Total 1
Today 1
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (11)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE