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:
committed by
Facebook Github Bot
parent
663a93912b
commit
7108454455
91
javascript/sources/YGEnums.js
Normal file
91
javascript/sources/YGEnums.js
Normal file
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
|
||||
FLEX_DIRECTION_COUNT: 4,
|
||||
FLEX_DIRECTION_COLUMN: 0,
|
||||
FLEX_DIRECTION_COLUMN_REVERSE: 1,
|
||||
FLEX_DIRECTION_ROW: 2,
|
||||
FLEX_DIRECTION_ROW_REVERSE: 3,
|
||||
|
||||
MEASURE_MODE_COUNT: 3,
|
||||
MEASURE_MODE_UNDEFINED: 0,
|
||||
MEASURE_MODE_EXACTLY: 1,
|
||||
MEASURE_MODE_AT_MOST: 2,
|
||||
|
||||
PRINT_OPTIONS_COUNT: 3,
|
||||
PRINT_OPTIONS_LAYOUT: 1,
|
||||
PRINT_OPTIONS_STYLE: 2,
|
||||
PRINT_OPTIONS_CHILDREN: 4,
|
||||
|
||||
EDGE_COUNT: 9,
|
||||
EDGE_LEFT: 0,
|
||||
EDGE_TOP: 1,
|
||||
EDGE_RIGHT: 2,
|
||||
EDGE_BOTTOM: 3,
|
||||
EDGE_START: 4,
|
||||
EDGE_END: 5,
|
||||
EDGE_HORIZONTAL: 6,
|
||||
EDGE_VERTICAL: 7,
|
||||
EDGE_ALL: 8,
|
||||
|
||||
POSITION_TYPE_COUNT: 2,
|
||||
POSITION_TYPE_RELATIVE: 0,
|
||||
POSITION_TYPE_ABSOLUTE: 1,
|
||||
|
||||
DIMENSION_COUNT: 2,
|
||||
DIMENSION_WIDTH: 0,
|
||||
DIMENSION_HEIGHT: 1,
|
||||
|
||||
JUSTIFY_COUNT: 5,
|
||||
JUSTIFY_FLEX_START: 0,
|
||||
JUSTIFY_CENTER: 1,
|
||||
JUSTIFY_FLEX_END: 2,
|
||||
JUSTIFY_SPACE_BETWEEN: 3,
|
||||
JUSTIFY_SPACE_AROUND: 4,
|
||||
|
||||
DIRECTION_COUNT: 3,
|
||||
DIRECTION_INHERIT: 0,
|
||||
DIRECTION_LTR: 1,
|
||||
DIRECTION_RTL: 2,
|
||||
|
||||
LOG_LEVEL_COUNT: 5,
|
||||
LOG_LEVEL_ERROR: 0,
|
||||
LOG_LEVEL_WARN: 1,
|
||||
LOG_LEVEL_INFO: 2,
|
||||
LOG_LEVEL_DEBUG: 3,
|
||||
LOG_LEVEL_VERBOSE: 4,
|
||||
|
||||
WRAP_COUNT: 2,
|
||||
WRAP_NO_WRAP: 0,
|
||||
WRAP_WRAP: 1,
|
||||
|
||||
OVERFLOW_COUNT: 3,
|
||||
OVERFLOW_VISIBLE: 0,
|
||||
OVERFLOW_HIDDEN: 1,
|
||||
OVERFLOW_SCROLL: 2,
|
||||
|
||||
EXPERIMENTAL_FEATURE_COUNT: 2,
|
||||
EXPERIMENTAL_FEATURE_ROUNDING: 0,
|
||||
EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS: 1,
|
||||
|
||||
ALIGN_COUNT: 5,
|
||||
ALIGN_AUTO: 0,
|
||||
ALIGN_FLEX_START: 1,
|
||||
ALIGN_CENTER: 2,
|
||||
ALIGN_FLEX_END: 3,
|
||||
ALIGN_STRETCH: 4,
|
||||
|
||||
UNIT_COUNT: 3,
|
||||
UNIT_UNDEFINED: 0,
|
||||
UNIT_PIXEL: 1,
|
||||
UNIT_PERCENT: 2,
|
||||
|
||||
};
|
Reference in New Issue
Block a user