Files
yoga/javascript/src/generated/YGEnums.ts

208 lines
4.5 KiB
TypeScript
Raw Normal View History

/**
* 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,
SpaceEvenly = 8,
}
export enum BoxSizing {
BorderBox = 0,
ContentBox = 1,
}
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,
Remove legacy absolute positioning path (#1725) Summary: X-link: https://github.com/facebook/react-native/pull/46984 Pull Request resolved: https://github.com/facebook/yoga/pull/1725 The legacy (wrong) absolute positioning path positions in two places, including work that is definitely always overwritten in the new absolute layout path. This came up before for position: static, but we didn't clean this up at the time. This code is also now leading display: contents impl being more annoying. This diff tries to converge to the more spec correct implementation of positioning here, that also only happens in one place. Previous path would potentially also incorrectly justify when `justify-content` was non-default, but not handled in the previous few cases? We don't have access to the flexLine at this point later, and apart from the existing tests now passing I reused the new correct logic for justification (spec says we should position child as if its the only child in the container https://www.w3.org/TR/css-flexbox-1/#abspos-items). I added a new, more scoped errata `AbsolutePositionWithoutInsetsExcludesPadding` to preserve some of the legacy behavior that showed as very breaking. I also did not try removing `AbsolutePercentAgainstInnerSize` which I suspect would be more breaking than this change. Changelog: [General][Breaking] - More spec compliant absolute positioning Reviewed By: joevilches Differential Revision: D64244949 fbshipit-source-id: ca97570e0de82e8f0424a0912adfd0b05254559e
2024-10-17 22:40:16 -07:00
AbsolutePositionWithoutInsetsExcludesPadding = 2,
AbsolutePercentAgainstInnerSize = 4,
All = 2147483647,
Classic = 2147483646,
}
export enum ExperimentalFeature {
WebFlexBasis = 0,
}
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 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,
ALIGN_SPACE_EVENLY: Align.SpaceEvenly,
BOX_SIZING_BORDER_BOX: BoxSizing.BorderBox,
BOX_SIZING_CONTENT_BOX: BoxSizing.ContentBox,
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,
Remove legacy absolute positioning path (#1725) Summary: X-link: https://github.com/facebook/react-native/pull/46984 Pull Request resolved: https://github.com/facebook/yoga/pull/1725 The legacy (wrong) absolute positioning path positions in two places, including work that is definitely always overwritten in the new absolute layout path. This came up before for position: static, but we didn't clean this up at the time. This code is also now leading display: contents impl being more annoying. This diff tries to converge to the more spec correct implementation of positioning here, that also only happens in one place. Previous path would potentially also incorrectly justify when `justify-content` was non-default, but not handled in the previous few cases? We don't have access to the flexLine at this point later, and apart from the existing tests now passing I reused the new correct logic for justification (spec says we should position child as if its the only child in the container https://www.w3.org/TR/css-flexbox-1/#abspos-items). I added a new, more scoped errata `AbsolutePositionWithoutInsetsExcludesPadding` to preserve some of the legacy behavior that showed as very breaking. I also did not try removing `AbsolutePercentAgainstInnerSize` which I suspect would be more breaking than this change. Changelog: [General][Breaking] - More spec compliant absolute positioning Reviewed By: joevilches Differential Revision: D64244949 fbshipit-source-id: ca97570e0de82e8f0424a0912adfd0b05254559e
2024-10-17 22:40:16 -07:00
ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING: Errata.AbsolutePositionWithoutInsetsExcludesPadding,
ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE: Errata.AbsolutePercentAgainstInnerSize,
ERRATA_ALL: Errata.All,
ERRATA_CLASSIC: Errata.Classic,
EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS: ExperimentalFeature.WebFlexBasis,
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,
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