-
Notifications
You must be signed in to change notification settings - Fork 8
/
rollup.config.js
70 lines (68 loc) · 2.02 KB
/
rollup.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
const license = /*js*/ `
/*-----------------------------------------------------------------------------
| Copyright (c) 2014-2019, Nucleic Development Team & H. Rutjes & Lume.
|
| Distributed under the terms of the Modified BSD License.
|
| The full license is in the file COPYING.txt, distributed with this software.
-----------------------------------------------------------------------------*/
`,
banner =
license +
/*js*/ `
/**
* Lume Kiwi is an efficient implementation of the Cassowary constraint solving
* algorithm, based on the seminal Cassowary paper.
* It is *not* a refactoring or port of the original C++ solver, but
* has been designed from the ground up to be lightweight and fast.
*
* **Example**
*
* \`\`\`javascript
* import * as kiwi from '@lume/kiwi';
*
* // Create a solver
* const solver = new kiwi.Solver();
*
* // Adjust the max number of solver iterations before an error is thrown if
* // more is needed. Default is 10,000.
* solver.maxIterations = 20000;
*
* // Create and add some editable variables
* const left = new kiwi.Variable();
* const width = new kiwi.Variable();
* solver.addEditVariable(left, kiwi.Strength.strong);
* solver.addEditVariable(width, kiwi.Strength.strong);
*
* // Create a variable calculated through a constraint
* const centerX = new kiwi.Variable();
* const expr = new kiwi.Expression([-1, centerX], left, [0.5, width]);
* solver.addConstraint(new kiwi.Constraint(expr, kiwi.Operator.Eq, kiwi.Strength.required));
*
* // Suggest some values to the solver
* solver.suggestValue(left, 0);
* solver.suggestValue(width, 500);
*
* // Lets solve the problem!
* solver.updateVariables();
*
* console.assert(centerX.value() === 250);
* \`\`\`
*
* ## API Documentation
* @module @lume/kiwi
*/
`
// we generate three output formats:
// - a fully ES6 version in tmp/kiwi.js, used just as the input to jsdoc2md.
const doc = {
input: 'dist/kiwi.js',
output: {
name: 'kiwi',
exports: 'named',
banner,
file: 'tmp/kiwi.js',
format: 'es',
},
}
export default [doc]