Namespaced and TypeScript Enums (#1285)
Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1285 Enums are currently exposed to the JS package as constants (e.g. `import {ERRATA_NONE} from 'yoga-layout'`). This exports enums in the form of `import {Errata} from 'yoga-layout'` then `Errata.None`. It would be more ergonomic for these to be string union based enums instead, but right now it is a pretty thin wrapper around the native API, we need ordinal values to do things with bit masks, and folks have wanted to serialize them before. Reviewed By: yungsters Differential Revision: D45570417 fbshipit-source-id: dbfd330e939051d0c16460a4d2a996f88f98875c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
aa812d0e48
commit
104646d8ca
208
javascript/src/generated/YGEnums.ts
Normal file
208
javascript/src/generated/YGEnums.ts
Normal file
@@ -0,0 +1,208 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// @generated by enums.py
|
||||
|
||||
export enum Align {
|
||||
Auto = 0,
|
||||
FlexStart = 1,
|
||||
Center = 2,
|
||||
FlexEnd = 3,
|
||||
Stretch = 4,
|
||||
Baseline = 5,
|
||||
SpaceBetween = 6,
|
||||
SpaceAround = 7,
|
||||
}
|
||||
|
||||
export enum Dimension {
|
||||
Width = 0,
|
||||
Height = 1,
|
||||
}
|
||||
|
||||
export enum Direction {
|
||||
Inherit = 0,
|
||||
LTR = 1,
|
||||
RTL = 2,
|
||||
}
|
||||
|
||||
export enum Display {
|
||||
Flex = 0,
|
||||
None = 1,
|
||||
}
|
||||
|
||||
export enum Edge {
|
||||
Left = 0,
|
||||
Top = 1,
|
||||
Right = 2,
|
||||
Bottom = 3,
|
||||
Start = 4,
|
||||
End = 5,
|
||||
Horizontal = 6,
|
||||
Vertical = 7,
|
||||
All = 8,
|
||||
}
|
||||
|
||||
export enum Errata {
|
||||
None = 0,
|
||||
StretchFlexBasis = 1,
|
||||
All = 2147483647,
|
||||
Classic = 2147483646,
|
||||
}
|
||||
|
||||
export enum ExperimentalFeature {
|
||||
WebFlexBasis = 0,
|
||||
AbsolutePercentageAgainstPaddingEdge = 1,
|
||||
FixAbsoluteTrailingColumnMargin = 2,
|
||||
}
|
||||
|
||||
export enum FlexDirection {
|
||||
Column = 0,
|
||||
ColumnReverse = 1,
|
||||
Row = 2,
|
||||
RowReverse = 3,
|
||||
}
|
||||
|
||||
export enum Gutter {
|
||||
Column = 0,
|
||||
Row = 1,
|
||||
All = 2,
|
||||
}
|
||||
|
||||
export enum Justify {
|
||||
FlexStart = 0,
|
||||
Center = 1,
|
||||
FlexEnd = 2,
|
||||
SpaceBetween = 3,
|
||||
SpaceAround = 4,
|
||||
SpaceEvenly = 5,
|
||||
}
|
||||
|
||||
export enum LogLevel {
|
||||
Error = 0,
|
||||
Warn = 1,
|
||||
Info = 2,
|
||||
Debug = 3,
|
||||
Verbose = 4,
|
||||
Fatal = 5,
|
||||
}
|
||||
|
||||
export enum MeasureMode {
|
||||
Undefined = 0,
|
||||
Exactly = 1,
|
||||
AtMost = 2,
|
||||
}
|
||||
|
||||
export enum NodeType {
|
||||
Default = 0,
|
||||
Text = 1,
|
||||
}
|
||||
|
||||
export enum Overflow {
|
||||
Visible = 0,
|
||||
Hidden = 1,
|
||||
Scroll = 2,
|
||||
}
|
||||
|
||||
export enum PositionType {
|
||||
Static = 0,
|
||||
Relative = 1,
|
||||
Absolute = 2,
|
||||
}
|
||||
|
||||
export enum PrintOptions {
|
||||
Layout = 1,
|
||||
Style = 2,
|
||||
Children = 4,
|
||||
}
|
||||
|
||||
export enum Unit {
|
||||
Undefined = 0,
|
||||
Point = 1,
|
||||
Percent = 2,
|
||||
Auto = 3,
|
||||
}
|
||||
|
||||
export enum Wrap {
|
||||
NoWrap = 0,
|
||||
Wrap = 1,
|
||||
WrapReverse = 2,
|
||||
}
|
||||
|
||||
const constants = {
|
||||
ALIGN_AUTO: Align.Auto,
|
||||
ALIGN_FLEX_START: Align.FlexStart,
|
||||
ALIGN_CENTER: Align.Center,
|
||||
ALIGN_FLEX_END: Align.FlexEnd,
|
||||
ALIGN_STRETCH: Align.Stretch,
|
||||
ALIGN_BASELINE: Align.Baseline,
|
||||
ALIGN_SPACE_BETWEEN: Align.SpaceBetween,
|
||||
ALIGN_SPACE_AROUND: Align.SpaceAround,
|
||||
DIMENSION_WIDTH: Dimension.Width,
|
||||
DIMENSION_HEIGHT: Dimension.Height,
|
||||
DIRECTION_INHERIT: Direction.Inherit,
|
||||
DIRECTION_LTR: Direction.LTR,
|
||||
DIRECTION_RTL: Direction.RTL,
|
||||
DISPLAY_FLEX: Display.Flex,
|
||||
DISPLAY_NONE: Display.None,
|
||||
EDGE_LEFT: Edge.Left,
|
||||
EDGE_TOP: Edge.Top,
|
||||
EDGE_RIGHT: Edge.Right,
|
||||
EDGE_BOTTOM: Edge.Bottom,
|
||||
EDGE_START: Edge.Start,
|
||||
EDGE_END: Edge.End,
|
||||
EDGE_HORIZONTAL: Edge.Horizontal,
|
||||
EDGE_VERTICAL: Edge.Vertical,
|
||||
EDGE_ALL: Edge.All,
|
||||
ERRATA_NONE: Errata.None,
|
||||
ERRATA_STRETCH_FLEX_BASIS: Errata.StretchFlexBasis,
|
||||
ERRATA_ALL: Errata.All,
|
||||
ERRATA_CLASSIC: Errata.Classic,
|
||||
EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS: ExperimentalFeature.WebFlexBasis,
|
||||
EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE: ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge,
|
||||
EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN: ExperimentalFeature.FixAbsoluteTrailingColumnMargin,
|
||||
FLEX_DIRECTION_COLUMN: FlexDirection.Column,
|
||||
FLEX_DIRECTION_COLUMN_REVERSE: FlexDirection.ColumnReverse,
|
||||
FLEX_DIRECTION_ROW: FlexDirection.Row,
|
||||
FLEX_DIRECTION_ROW_REVERSE: FlexDirection.RowReverse,
|
||||
GUTTER_COLUMN: Gutter.Column,
|
||||
GUTTER_ROW: Gutter.Row,
|
||||
GUTTER_ALL: Gutter.All,
|
||||
JUSTIFY_FLEX_START: Justify.FlexStart,
|
||||
JUSTIFY_CENTER: Justify.Center,
|
||||
JUSTIFY_FLEX_END: Justify.FlexEnd,
|
||||
JUSTIFY_SPACE_BETWEEN: Justify.SpaceBetween,
|
||||
JUSTIFY_SPACE_AROUND: Justify.SpaceAround,
|
||||
JUSTIFY_SPACE_EVENLY: Justify.SpaceEvenly,
|
||||
LOG_LEVEL_ERROR: LogLevel.Error,
|
||||
LOG_LEVEL_WARN: LogLevel.Warn,
|
||||
LOG_LEVEL_INFO: LogLevel.Info,
|
||||
LOG_LEVEL_DEBUG: LogLevel.Debug,
|
||||
LOG_LEVEL_VERBOSE: LogLevel.Verbose,
|
||||
LOG_LEVEL_FATAL: LogLevel.Fatal,
|
||||
MEASURE_MODE_UNDEFINED: MeasureMode.Undefined,
|
||||
MEASURE_MODE_EXACTLY: MeasureMode.Exactly,
|
||||
MEASURE_MODE_AT_MOST: MeasureMode.AtMost,
|
||||
NODE_TYPE_DEFAULT: NodeType.Default,
|
||||
NODE_TYPE_TEXT: NodeType.Text,
|
||||
OVERFLOW_VISIBLE: Overflow.Visible,
|
||||
OVERFLOW_HIDDEN: Overflow.Hidden,
|
||||
OVERFLOW_SCROLL: Overflow.Scroll,
|
||||
POSITION_TYPE_STATIC: PositionType.Static,
|
||||
POSITION_TYPE_RELATIVE: PositionType.Relative,
|
||||
POSITION_TYPE_ABSOLUTE: PositionType.Absolute,
|
||||
PRINT_OPTIONS_LAYOUT: PrintOptions.Layout,
|
||||
PRINT_OPTIONS_STYLE: PrintOptions.Style,
|
||||
PRINT_OPTIONS_CHILDREN: PrintOptions.Children,
|
||||
UNIT_UNDEFINED: Unit.Undefined,
|
||||
UNIT_POINT: Unit.Point,
|
||||
UNIT_PERCENT: Unit.Percent,
|
||||
UNIT_AUTO: Unit.Auto,
|
||||
WRAP_NO_WRAP: Wrap.NoWrap,
|
||||
WRAP_WRAP: Wrap.Wrap,
|
||||
WRAP_WRAP_REVERSE: Wrap.WrapReverse,
|
||||
}
|
||||
export default constants
|
Reference in New Issue
Block a user