Improve JS bindings

Summary:
- Fix a few things related to how npm should publish the package (sources were in the gitignore file, so I think it would have break the build during install - I fixed this by adding a npmignore that should override the gitignore rules)

- The enumerations values are now generated directly from `enums.py`

- I added percent unit support (#258) to the bindings (`.setWidthPercent` is currently exposed, but I've also added a very very little parsing to also support `.setWidth("100%")` and `.setWidth(.getWidth())`), added the missing tests, and fixed Travis.
Closes https://github.com/facebook/yoga/pull/314

Reviewed By: mikearmstrong001

Differential Revision: D4377198

Pulled By: emilsjolander

fbshipit-source-id: 774dfafd416f5421f3be59a1d181eb7056487abe
This commit is contained in:
Maël Nison
2017-01-04 04:33:39 -08:00
committed by Facebook Github Bot
parent 663a93912b
commit 7108454455
12 changed files with 1344 additions and 110 deletions

View File

@@ -12,6 +12,7 @@
#include "./Node.hh"
#include "./Layout.hh"
#include "./Size.hh"
#include "./Value.hh"
#include "./global.hh"
#define NBIND_DUPLICATE_POINTERS true
@@ -36,6 +37,12 @@ NBIND_CLASS(Layout)
construct<>();
}
NBIND_CLASS(Value)
{
construct<>();
construct<int, double>();
}
NBIND_CLASS(Node)
{
method(create);
@@ -47,6 +54,7 @@ NBIND_CLASS(Node)
method(setPositionType);
method(setPosition);
method(setPositionPercent);
method(setAlignContent);
method(setAlignItems);
@@ -56,28 +64,37 @@ NBIND_CLASS(Node)
method(setJustifyContent);
method(setMargin);
method(setMarginPercent);
method(setOverflow);
method(setFlex);
method(setFlexBasis);
method(setFlexBasisPercent);
method(setFlexGrow);
method(setFlexShrink);
method(setWidth);
method(setWidthPercent);
method(setHeight);
method(setHeightPercent);
method(setMinWidth);
method(setMinWidthPercent);
method(setMinHeight);
method(setMinHeightPercent);
method(setMaxWidth);
method(setMaxWidthPercent);
method(setMaxHeight);
method(setMaxHeightPercent);
method(setAspectRatio);
method(setBorder);
method(setPadding);
method(setPaddingPercent);
method(getPositionType);
method(getPosition);