diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..1aea015
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,14 @@
+# EditorConfig: http://editorconfig.org
+
+root = true
+
+[*]
+indent_style = tab
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true
+
+[*.md,yml]
+indent_style = space
+indent_size = 2
diff --git a/.prettierignore b/.prettierignore
index 12008a4..c2d7688 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -1,4 +1,3 @@
tmp/
-es/
+dist/
/coverage
-lib/
diff --git a/.prettierrc.cjs b/.prettierrc.js
similarity index 58%
rename from .prettierrc.cjs
rename to .prettierrc.js
index 3a535ed..6d2059f 100644
--- a/.prettierrc.cjs
+++ b/.prettierrc.js
@@ -1,4 +1,4 @@
-module.exports = {
+export default {
useTabs: true,
semi: false,
singleQuote: true,
@@ -7,5 +7,5 @@ module.exports = {
printWidth: 120,
arrowParens: 'avoid',
- overrides: [{files: '*.md', options: {tabWidth: 2, useTabs: false}}],
+ overrides: [{files: ['*.md', '*.yml'], options: {useTabs: false, tabWidth: 2}}],
}
diff --git a/README.md b/README.md
index 3fd7394..4649e94 100644
--- a/README.md
+++ b/README.md
@@ -13,12 +13,13 @@ compiler).
## Index
-- [Getting started](#getting-started)
+- [Install](#install)
+- [Usage](#usage)
- [Documentation](#documentation)
- [Benchmarks](#benchmarks)
- [Tests](#tests)
-## Getting started
+## Install
Install using NPM:
@@ -26,18 +27,7 @@ Install using NPM:
npm install @lume/kiwi
```
-then either load `kiwi` as a global variable using a script tag,
-
-```html
-
-
-```
-
-or import it into your ES Module script:
+then import it into your project:
```js
import * as kiwi from '@lume/kiwi'
@@ -47,6 +37,23 @@ console.log(kiwi)
// ...use kiwi...
```
+If you have a plain web app with no build, or a non-browser JS runtime that also
+supports import maps like Deno, you'll need to add `@lume/kiwi` to your
+`importmap` script so that the browser knows where to import kiwi from. F.e.
+something like this:
+
+```html
+
+```
+
+## Usage
+
The following example creates a solver which automatically calculates a width based on some constraints:
```js
@@ -84,6 +91,24 @@ To run the benchmark locally using nodejs, _clone or download this repository_ a
npm install
npm run bench
+Statically serve the project, f.e. `npx five-server .` which opens a new browser
+tab, then visit `/bench/index.html` to verify that the benchmark also runs in a
+browser.
+
+Sample result output:
+
+```
+----- Running creation benchmark...
+Cassowary.js x 2,597 ops/sec ±1.56% (93 runs sampled)
+kiwi x 26,243 ops/sec ±1.34% (91 runs sampled)
+kiwi new API x 20,840 ops/sec ±7.19% (80 runs sampled)
+Fastest is kiwi (± 10.11x faster)
+----- Running solving benchmark...
+Cassowary.js x 260,002 ops/sec ±2.62% (89 runs sampled)
+kiwi x 595,455 ops/sec ±1.74% (89 runs sampled)
+Fastest is kiwi (± 2.29x faster)
+```
+
## Tests
To run the tests in the browser, [just visit this page](https://rawgit.com/IjzerenHein/kiwi/master/test/index.html).
@@ -93,16 +118,20 @@ To run the tests locally using nodejs, _clone or download this repository_ and e
npm install
npm run build && npm run test
+Start a static server, f.e. `npx five-server .` which opens a new browser tab,
+and visit `/test/index.html` to verify that tests also pass in a browser.
+
## Contribute
-If you like this project and want to support it, show some love
-and give it a star.
+If you like this project and want to support it, show some love and give it a
+star, try it and report any bugs, write new feature ideas, or even
+open a pull request!
## License
© 2013 Nucleic Development Team
© 2021 Joseph Orbegoso Pea (http://github.com/trusktr)
-© 2021 LUME
+© 2021 Lume
[![License](https://img.shields.io/badge/license-BDS%203--clause-brightgreen)]()
diff --git a/bench/index.html b/bench/index.html
index 0050022..d8de00d 100644
--- a/bench/index.html
+++ b/bench/index.html
@@ -2,6 +2,13 @@
Benchmark Tests
+
@@ -13,7 +20,8 @@
type="text/javascript"
src="https://rawcdn.githack.com/slightlyoff/cassowary.js/68f82a0a9c365701a1cba8d929c5c7be097cd716/bin/c.min.js"
>
-
-
+