Fixup Enum Generator

Summary:
https://github.com/facebook/yoga/pull/1116 adds a new enum. The enum generator is out of date with copyright header, and some codemods, but it also looks like there were manual changes, types added, etc since generation. I fixed up the script to incorporate generating the changes folks made manually, and also added an enum that was previously only added manually to the C ABI.

Changelog:
[General][Fixed] - Fixup Yoga Enum Generator

Reviewed By: yungsters

Differential Revision: D39922252

fbshipit-source-id: b678fa9a43a896873d8c434745bdaf3f16fd991f
This commit is contained in:
Nick Gerleman
2022-09-29 22:25:24 -07:00
committed by Facebook GitHub Bot
parent fd180de774
commit 5a18ccdbe2
41 changed files with 320 additions and 162 deletions

View File

@@ -1,13 +1,14 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/
// @generated by enums.py
// @flow
// @format
const CONSTANTS = {
ALIGN_COUNT: 8,
ALIGN_AUTO: 0,
@@ -82,9 +83,10 @@ const CONSTANTS = {
OVERFLOW_HIDDEN: 1,
OVERFLOW_SCROLL: 2,
POSITION_TYPE_COUNT: 2,
POSITION_TYPE_RELATIVE: 0,
POSITION_TYPE_ABSOLUTE: 1,
POSITION_TYPE_COUNT: 3,
POSITION_TYPE_STATIC: 0,
POSITION_TYPE_RELATIVE: 1,
POSITION_TYPE_ABSOLUTE: 2,
PRINT_OPTIONS_COUNT: 3,
PRINT_OPTIONS_LAYOUT: 1,
@@ -102,41 +104,28 @@ const CONSTANTS = {
WRAP_WRAP: 1,
WRAP_WRAP_REVERSE: 2,
};
export type Yoga$JustifyContent =
| typeof CONSTANTS.JUSTIFY_CENTER
| typeof CONSTANTS.JUSTIFY_FLEX_END
| typeof CONSTANTS.JUSTIFY_FLEX_START
| typeof CONSTANTS.JUSTIFY_SPACE_AROUND
| typeof CONSTANTS.JUSTIFY_SPACE_BETWEEN
| typeof CONSTANTS.JUSTIFY_SPACE_EVENLY;
export type Yoga$Align =
| typeof CONSTANTS.ALIGN_AUTO
| typeof CONSTANTS.ALIGN_BASELINE
| typeof CONSTANTS.ALIGN_FLEX_START
| typeof CONSTANTS.ALIGN_CENTER
| typeof CONSTANTS.ALIGN_FLEX_END
| typeof CONSTANTS.ALIGN_FLEX_START
| typeof CONSTANTS.ALIGN_SPACE_AROUND
| typeof CONSTANTS.ALIGN_STRETCH
| typeof CONSTANTS.ALIGN_BASELINE
| typeof CONSTANTS.ALIGN_SPACE_BETWEEN
| typeof CONSTANTS.ALIGN_STRETCH;
| typeof CONSTANTS.ALIGN_SPACE_AROUND;
export type Yoga$FlexDirection =
| typeof CONSTANTS.FLEX_DIRECTION_COLUMN
| typeof CONSTANTS.FLEX_DIRECTION_COLUMN_REVERSE
| typeof CONSTANTS.FLEX_DIRECTION_COUNT
| typeof CONSTANTS.FLEX_DIRECTION_ROW
| typeof CONSTANTS.FLEX_DIRECTION_ROW_REVERSE;
export type Yoga$Dimension =
| typeof CONSTANTS.DIMENSION_WIDTH
| typeof CONSTANTS.DIMENSION_HEIGHT;
export type Yoga$Direction =
| typeof CONSTANTS.DIRECTION_INHERIT
| typeof CONSTANTS.DIRECTION_LTR
| typeof CONSTANTS.DIRECTION_RTL;
export type Yoga$FlexWrap =
| typeof CONSTANTS.WRAP_NO_WRAP
| typeof CONSTANTS.WRAP_WRAP
| typeof CONSTANTS.WRAP_WRAP_REVERSE;
export type Yoga$Display =
| typeof CONSTANTS.DISPLAY_FLEX
| typeof CONSTANTS.DISPLAY_NONE;
export type Yoga$Edge =
| typeof CONSTANTS.EDGE_LEFT
@@ -149,25 +138,64 @@ export type Yoga$Edge =
| typeof CONSTANTS.EDGE_VERTICAL
| typeof CONSTANTS.EDGE_ALL;
export type Yoga$Display =
| typeof CONSTANTS.DISPLAY_FLEX
| typeof CONSTANTS.DISPLAY_NONE;
export type Yoga$ExperimentalFeature =
| typeof CONSTANTS.EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS;
export type Yoga$Unit =
| typeof CONSTANTS.UNIT_AUTO
| typeof CONSTANTS.UNIT_PERCENT
| typeof CONSTANTS.UNIT_POINT
| typeof CONSTANTS.UNIT_UNDEFINED;
export type Yoga$FlexDirection =
| typeof CONSTANTS.FLEX_DIRECTION_COLUMN
| typeof CONSTANTS.FLEX_DIRECTION_COLUMN_REVERSE
| typeof CONSTANTS.FLEX_DIRECTION_ROW
| typeof CONSTANTS.FLEX_DIRECTION_ROW_REVERSE;
export type Yoga$Justify =
| typeof CONSTANTS.JUSTIFY_FLEX_START
| typeof CONSTANTS.JUSTIFY_CENTER
| typeof CONSTANTS.JUSTIFY_FLEX_END
| typeof CONSTANTS.JUSTIFY_SPACE_BETWEEN
| typeof CONSTANTS.JUSTIFY_SPACE_AROUND
| typeof CONSTANTS.JUSTIFY_SPACE_EVENLY;
export type Yoga$LogLevel =
| typeof CONSTANTS.LOG_LEVEL_ERROR
| typeof CONSTANTS.LOG_LEVEL_WARN
| typeof CONSTANTS.LOG_LEVEL_INFO
| typeof CONSTANTS.LOG_LEVEL_DEBUG
| typeof CONSTANTS.LOG_LEVEL_VERBOSE
| typeof CONSTANTS.LOG_LEVEL_FATAL;
export type Yoga$MeasureMode =
| typeof CONSTANTS.MEASURE_MODE_UNDEFINED
| typeof CONSTANTS.MEASURE_MODE_EXACTLY
| typeof CONSTANTS.MEASURE_MODE_AT_MOST;
export type Yoga$NodeType =
| typeof CONSTANTS.NODE_TYPE_DEFAULT
| typeof CONSTANTS.NODE_TYPE_TEXT;
export type Yoga$Overflow =
| typeof CONSTANTS.OVERFLOW_VISIBLE
| typeof CONSTANTS.OVERFLOW_HIDDEN
| typeof CONSTANTS.OVERFLOW_SCROLL
| typeof CONSTANTS.OVERFLOW_VISIBLE;
| typeof CONSTANTS.OVERFLOW_SCROLL;
export type Yoga$PositionType =
| typeof CONSTANTS.POSITION_TYPE_ABSOLUTE
| typeof CONSTANTS.POSITION_TYPE_RELATIVE;
| typeof CONSTANTS.POSITION_TYPE_STATIC
| typeof CONSTANTS.POSITION_TYPE_RELATIVE
| typeof CONSTANTS.POSITION_TYPE_ABSOLUTE;
export type Yoga$ExperimentalFeature = typeof CONSTANTS.EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS;
export type Yoga$PrintOptions =
| typeof CONSTANTS.PRINT_OPTIONS_LAYOUT
| typeof CONSTANTS.PRINT_OPTIONS_STYLE
| typeof CONSTANTS.PRINT_OPTIONS_CHILDREN;
export type Yoga$Unit =
| typeof CONSTANTS.UNIT_UNDEFINED
| typeof CONSTANTS.UNIT_POINT
| typeof CONSTANTS.UNIT_PERCENT
| typeof CONSTANTS.UNIT_AUTO;
export type Yoga$Wrap =
| typeof CONSTANTS.WRAP_NO_WRAP
| typeof CONSTANTS.WRAP_WRAP
| typeof CONSTANTS.WRAP_WRAP_REVERSE;
module.exports = CONSTANTS;

View File

@@ -1,5 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
@@ -38,11 +38,11 @@ if (!ran) {
module.exports = Yoga(ret.bind, ret.lib);
export type {
Yoga$JustifyContent,
Yoga$Justify,
Yoga$Align,
Yoga$FlexDirection,
Yoga$Direction,
Yoga$FlexWrap,
Yoga$Wrap,
Yoga$Edge,
Yoga$Display,
Yoga$Unit,

View File

@@ -1,5 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
@@ -8,16 +8,17 @@
* @format
*/
const CONSTANTS = require('./YGEnums');
import type {
Yoga$Edge,
Yoga$FlexWrap,
Yoga$Wrap,
Yoga$Align,
Yoga$FlexDirection,
Yoga$Direction,
Yoga$PositionType,
Yoga$Overflow,
Yoga$JustifyContent,
Yoga$Justify,
Yoga$Display,
Yoga$ExperimentalFeature,
} from './YGEnums';
@@ -151,9 +152,9 @@ export type Yoga$Node = {
getFlexDirection(): Yoga$FlexDirection,
getFlexGrow(): number,
getFlexShrink(): number,
getFlexWrap(): Yoga$FlexWrap,
getFlexWrap(): Yoga$Wrap,
getHeight(): Value,
getJustifyContent(): Yoga$JustifyContent,
getJustifyContent(): Yoga$Justify,
getMargin(edge: Yoga$Edge): Value,
getMaxHeight(): Value,
getMaxWidth(): Value,
@@ -182,11 +183,11 @@ export type Yoga$Node = {
setFlexDirection(flexDirection: Yoga$FlexDirection): void,
setFlexGrow(flexGrow: number): void,
setFlexShrink(flexShrink: number): void,
setFlexWrap(flexWrap: Yoga$FlexWrap): void,
setFlexWrap(flexWrap: Yoga$Wrap): void,
setHeight(height: number | string): void,
setHeightAuto(): void,
setHeightPercent(height: number): void,
setJustifyContent(justifyContent: Yoga$JustifyContent): void,
setJustifyContent(justifyContent: Yoga$Justify): void,
setMargin(edge: Yoga$Edge, margin: number): void,
setMarginAuto(edge: Yoga$Edge): void,
setMarginPercent(edge: Yoga$Edge, margin: number): void,

View File

@@ -1,5 +1,5 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
@@ -13,11 +13,11 @@ const nbind = require('nbind');
const {bind, lib} = nbind.init(__dirname + '/../');
module.exports = Yoga(bind, lib);
export type {
Yoga$JustifyContent,
Yoga$Justify,
Yoga$Align,
Yoga$FlexDirection,
Yoga$Direction,
Yoga$FlexWrap,
Yoga$Wrap,
Yoga$Edge,
Yoga$Display,
Yoga$Unit,