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:
committed by
Facebook GitHub Bot
parent
fd180de774
commit
5a18ccdbe2
@@ -1,10 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* 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
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
namespace Facebook.Yoga
|
namespace Facebook.Yoga
|
||||||
{
|
{
|
||||||
public enum YogaAlign
|
public enum YogaAlign
|
||||||
|
@@ -1,10 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* 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
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
namespace Facebook.Yoga
|
namespace Facebook.Yoga
|
||||||
{
|
{
|
||||||
public enum YogaDimension
|
public enum YogaDimension
|
||||||
|
@@ -1,10 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* 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
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
namespace Facebook.Yoga
|
namespace Facebook.Yoga
|
||||||
{
|
{
|
||||||
public enum YogaDirection
|
public enum YogaDirection
|
||||||
|
@@ -1,10 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* 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
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
namespace Facebook.Yoga
|
namespace Facebook.Yoga
|
||||||
{
|
{
|
||||||
public enum YogaDisplay
|
public enum YogaDisplay
|
||||||
|
@@ -1,10 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* 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
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
namespace Facebook.Yoga
|
namespace Facebook.Yoga
|
||||||
{
|
{
|
||||||
public enum YogaEdge
|
public enum YogaEdge
|
||||||
|
@@ -1,10 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* 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
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
namespace Facebook.Yoga
|
namespace Facebook.Yoga
|
||||||
{
|
{
|
||||||
public enum YogaExperimentalFeature
|
public enum YogaExperimentalFeature
|
||||||
|
@@ -1,10 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* 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
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
namespace Facebook.Yoga
|
namespace Facebook.Yoga
|
||||||
{
|
{
|
||||||
public enum YogaFlexDirection
|
public enum YogaFlexDirection
|
||||||
|
@@ -1,10 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* 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
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
namespace Facebook.Yoga
|
namespace Facebook.Yoga
|
||||||
{
|
{
|
||||||
public enum YogaJustify
|
public enum YogaJustify
|
||||||
|
@@ -1,10 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* 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
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
namespace Facebook.Yoga
|
namespace Facebook.Yoga
|
||||||
{
|
{
|
||||||
public enum YogaLogLevel
|
public enum YogaLogLevel
|
||||||
|
@@ -1,10 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* 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
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
namespace Facebook.Yoga
|
namespace Facebook.Yoga
|
||||||
{
|
{
|
||||||
public enum YogaMeasureMode
|
public enum YogaMeasureMode
|
||||||
|
@@ -1,10 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* 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
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
namespace Facebook.Yoga
|
namespace Facebook.Yoga
|
||||||
{
|
{
|
||||||
public enum YogaNodeType
|
public enum YogaNodeType
|
||||||
|
@@ -1,10 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* 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
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
namespace Facebook.Yoga
|
namespace Facebook.Yoga
|
||||||
{
|
{
|
||||||
public enum YogaOverflow
|
public enum YogaOverflow
|
||||||
|
@@ -1,14 +1,17 @@
|
|||||||
/*
|
/*
|
||||||
* 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
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
namespace Facebook.Yoga
|
namespace Facebook.Yoga
|
||||||
{
|
{
|
||||||
public enum YogaPositionType
|
public enum YogaPositionType
|
||||||
{
|
{
|
||||||
|
Static,
|
||||||
Relative,
|
Relative,
|
||||||
Absolute,
|
Absolute,
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* 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
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
namespace Facebook.Yoga
|
namespace Facebook.Yoga
|
||||||
{
|
{
|
||||||
[System.Flags]
|
[System.Flags]
|
||||||
|
@@ -1,10 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* 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
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
namespace Facebook.Yoga
|
namespace Facebook.Yoga
|
||||||
{
|
{
|
||||||
public enum YogaUnit
|
public enum YogaUnit
|
||||||
|
@@ -1,10 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* 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
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
namespace Facebook.Yoga
|
namespace Facebook.Yoga
|
||||||
{
|
{
|
||||||
public enum YogaWrap
|
public enum YogaWrap
|
||||||
|
99
enums.py
99
enums.py
@@ -1,4 +1,4 @@
|
|||||||
# 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
|
# This source code is licensed under the MIT license found in the
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
@@ -31,7 +31,7 @@ ENUMS = {
|
|||||||
"SpaceBetween",
|
"SpaceBetween",
|
||||||
"SpaceAround",
|
"SpaceAround",
|
||||||
],
|
],
|
||||||
"PositionType": ["Relative", "Absolute"],
|
"PositionType": ["Static", "Relative", "Absolute"],
|
||||||
"Display": ["Flex", "None"],
|
"Display": ["Flex", "None"],
|
||||||
"Wrap": ["NoWrap", "Wrap", "WrapReverse"],
|
"Wrap": ["NoWrap", "Wrap", "WrapReverse"],
|
||||||
"MeasureMode": ["Undefined", "Exactly", "AtMost"],
|
"MeasureMode": ["Undefined", "Exactly", "AtMost"],
|
||||||
@@ -56,14 +56,26 @@ ENUMS = {
|
|||||||
"PrintOptions": [("Layout", 1), ("Style", 2), ("Children", 4)],
|
"PrintOptions": [("Layout", 1), ("Style", 2), ("Children", 4)],
|
||||||
}
|
}
|
||||||
|
|
||||||
LICENSE = """/**
|
# Generated Java enums used to emit @DoNotStrip, but D17519844 removed them
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
# manually from all but YogaLogLevel. TODO: Is it safe to remove from it as
|
||||||
|
# well?
|
||||||
|
DO_NOT_STRIP = ["LogLevel"]
|
||||||
|
|
||||||
|
|
||||||
|
def get_license(ext):
|
||||||
|
prologue = "/**" if ext == "js" else "/*"
|
||||||
|
return """{}
|
||||||
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
*
|
*
|
||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
"""
|
// @generated by enums.py
|
||||||
|
|
||||||
|
""".format(
|
||||||
|
prologue
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def to_java_upper(symbol):
|
def to_java_upper(symbol):
|
||||||
@@ -92,30 +104,38 @@ root = os.path.dirname(os.path.abspath(__file__))
|
|||||||
|
|
||||||
# write out C & Objective-C headers
|
# write out C & Objective-C headers
|
||||||
with open(root + "/yoga/YGEnums.h", "w") as f:
|
with open(root + "/yoga/YGEnums.h", "w") as f:
|
||||||
f.write(LICENSE)
|
f.write(get_license("cpp"))
|
||||||
f.write("#pragma once\n\n")
|
f.write("#pragma once\n")
|
||||||
|
f.write("// clang-format: off\n\n")
|
||||||
f.write('#include "YGMacros.h"\n\n')
|
f.write('#include "YGMacros.h"\n\n')
|
||||||
f.write("YG_EXTERN_C_BEGIN\n\n")
|
|
||||||
for name, values in sorted(ENUMS.items()):
|
f.write('YG_EXTERN_C_BEGIN\n\n')
|
||||||
f.write("#define YG%sCount %s\n" % (name, len(values)))
|
items = sorted(ENUMS.items())
|
||||||
f.write("typedef YG_ENUM_BEGIN(YG%s) {\n" % name)
|
for name, values in items:
|
||||||
|
if (isinstance(values[0], tuple)):
|
||||||
|
f.write("YG_ENUM_DECL(\n")
|
||||||
|
else:
|
||||||
|
f.write("YG_ENUM_SEQ_DECL(\n")
|
||||||
|
|
||||||
|
f.write(" YG%s,\n" % name)
|
||||||
for value in values:
|
for value in values:
|
||||||
if isinstance(value, tuple):
|
if isinstance(value, tuple):
|
||||||
f.write(" YG%s%s = %d,\n" % (name, value[0], value[1]))
|
f.write(" YG%s%s = %d" % (name, value[0], value[1]))
|
||||||
else:
|
else:
|
||||||
f.write(" YG%s%s,\n" % (name, value))
|
f.write(" YG%s%s" % (name, value))
|
||||||
f.write("} YG_ENUM_END(YG%s);\n" % name)
|
if value == values[-1]:
|
||||||
f.write(
|
f.write(")\n")
|
||||||
"WIN_EXPORT const char *YG%sToString(const YG%s value);\n" % (name, name)
|
else:
|
||||||
)
|
f.write(",\n")
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
f.write("YG_EXTERN_C_END\n")
|
f.write("YG_EXTERN_C_END\n")
|
||||||
|
|
||||||
# write out C body for printing
|
# write out C body for printing
|
||||||
with open(root + "/yoga/YGEnums.cpp", "w") as f:
|
with open(root + "/yoga/YGEnums.cpp", "w") as f:
|
||||||
f.write(LICENSE)
|
f.write(get_license("cpp"))
|
||||||
f.write('#include "YGEnums.h"\n\n')
|
f.write('#include "YGEnums.h"\n\n')
|
||||||
for name, values in sorted(ENUMS.items()):
|
items = sorted(ENUMS.items())
|
||||||
|
for name, values in items:
|
||||||
f.write("const char* YG%sToString(const YG%s value) {\n" % (name, name))
|
f.write("const char* YG%sToString(const YG%s value) {\n" % (name, name))
|
||||||
f.write(" switch (value) {\n")
|
f.write(" switch (value) {\n")
|
||||||
for value in values:
|
for value in values:
|
||||||
@@ -127,13 +147,16 @@ with open(root + "/yoga/YGEnums.cpp", "w") as f:
|
|||||||
f.write(' return "%s";\n' % to_log_lower(value))
|
f.write(' return "%s";\n' % to_log_lower(value))
|
||||||
f.write(" }\n")
|
f.write(" }\n")
|
||||||
f.write(' return "unknown";\n')
|
f.write(' return "unknown";\n')
|
||||||
f.write("}\n\n")
|
f.write("}\n")
|
||||||
|
if name != items[-1][0]:
|
||||||
|
f.write("\n")
|
||||||
|
|
||||||
# write out java files
|
# write out java files
|
||||||
for name, values in sorted(ENUMS.items()):
|
for name, values in sorted(ENUMS.items()):
|
||||||
with open(root + "/java/com/facebook/yoga/Yoga%s.java" % name, "w") as f:
|
with open(root + "/java/com/facebook/yoga/Yoga%s.java" % name, "w") as f:
|
||||||
f.write(LICENSE.replace("/**", "/*", 1))
|
f.write(get_license("java"))
|
||||||
f.write("package com.facebook.yoga;\n\n")
|
f.write("package com.facebook.yoga;\n\n")
|
||||||
|
if name in DO_NOT_STRIP:
|
||||||
f.write("import com.facebook.proguard.annotations.DoNotStrip;\n\n")
|
f.write("import com.facebook.proguard.annotations.DoNotStrip;\n\n")
|
||||||
f.write("@DoNotStrip\n")
|
f.write("@DoNotStrip\n")
|
||||||
f.write("public enum Yoga%s {\n" % name)
|
f.write("public enum Yoga%s {\n" % name)
|
||||||
@@ -150,7 +173,7 @@ for name, values in sorted(ENUMS.items()):
|
|||||||
else:
|
else:
|
||||||
f.write("__EMPTY(-1);")
|
f.write("__EMPTY(-1);")
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
f.write(" private int mIntValue;\n")
|
f.write(" private final int mIntValue;\n")
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
f.write(" Yoga%s(int intValue) {\n" % name)
|
f.write(" Yoga%s(int intValue) {\n" % name)
|
||||||
f.write(" mIntValue = intValue;\n")
|
f.write(" mIntValue = intValue;\n")
|
||||||
@@ -160,6 +183,8 @@ for name, values in sorted(ENUMS.items()):
|
|||||||
f.write(" return mIntValue;\n")
|
f.write(" return mIntValue;\n")
|
||||||
f.write(" }\n")
|
f.write(" }\n")
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
|
if name in DO_NOT_STRIP:
|
||||||
|
f.write(" @DoNotStrip\n")
|
||||||
f.write(" public static Yoga%s fromInt(int value) {\n" % name)
|
f.write(" public static Yoga%s fromInt(int value) {\n" % name)
|
||||||
f.write(" switch (value) {\n")
|
f.write(" switch (value) {\n")
|
||||||
for value in values:
|
for value in values:
|
||||||
@@ -182,7 +207,7 @@ for name, values in sorted(ENUMS.items()):
|
|||||||
# write out csharp files
|
# write out csharp files
|
||||||
for name, values in sorted(ENUMS.items()):
|
for name, values in sorted(ENUMS.items()):
|
||||||
with open(root + "/csharp/Facebook.Yoga/Yoga%s.cs" % name, "w") as f:
|
with open(root + "/csharp/Facebook.Yoga/Yoga%s.cs" % name, "w") as f:
|
||||||
f.write(LICENSE)
|
f.write(get_license("cs"))
|
||||||
f.write("namespace Facebook.Yoga\n{\n")
|
f.write("namespace Facebook.Yoga\n{\n")
|
||||||
if isinstance(next(iter(values or []), None), tuple):
|
if isinstance(next(iter(values or []), None), tuple):
|
||||||
f.write(" [System.Flags]\n")
|
f.write(" [System.Flags]\n")
|
||||||
@@ -197,9 +222,12 @@ for name, values in sorted(ENUMS.items()):
|
|||||||
|
|
||||||
# write out javascript file
|
# write out javascript file
|
||||||
with open(root + "/javascript/sources/YGEnums.js", "w") as f:
|
with open(root + "/javascript/sources/YGEnums.js", "w") as f:
|
||||||
f.write(LICENSE)
|
f.write(get_license("js"))
|
||||||
f.write("module.exports = {\n\n")
|
f.write("// @flow\n")
|
||||||
for name, values in sorted(ENUMS.items()):
|
f.write("// @format\n")
|
||||||
|
f.write("const CONSTANTS = {\n")
|
||||||
|
items = sorted(ENUMS.items())
|
||||||
|
for name, values in items:
|
||||||
f.write(" %s_COUNT: %s,\n" % (to_java_upper(name), len(values)))
|
f.write(" %s_COUNT: %s,\n" % (to_java_upper(name), len(values)))
|
||||||
base = 0
|
base = 0
|
||||||
for value in values:
|
for value in values:
|
||||||
@@ -214,5 +242,24 @@ with open(root + "/javascript/sources/YGEnums.js", "w") as f:
|
|||||||
" %s_%s: %d,\n" % (to_java_upper(name), to_java_upper(value), base)
|
" %s_%s: %d,\n" % (to_java_upper(name), to_java_upper(value), base)
|
||||||
)
|
)
|
||||||
base += 1
|
base += 1
|
||||||
|
|
||||||
|
if name != items[-1][0]:
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
f.write("};\n")
|
f.write("};\n")
|
||||||
|
|
||||||
|
for name, values in sorted(ENUMS.items()):
|
||||||
|
f.write("export type Yoga${} =\n".format(name))
|
||||||
|
for value in values:
|
||||||
|
unpackedValue = value[0] if isinstance(value, tuple) else value
|
||||||
|
f.write(
|
||||||
|
" | typeof CONSTANTS.{}_{}".format(
|
||||||
|
to_java_upper(name), to_java_upper(unpackedValue)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if values[-1] == value:
|
||||||
|
f.write(";\n")
|
||||||
|
else:
|
||||||
|
f.write("\n")
|
||||||
|
|
||||||
|
f.write("\n")
|
||||||
|
f.write("module.exports = CONSTANTS;\n")
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
public enum YogaAlign {
|
public enum YogaAlign {
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
public enum YogaDimension {
|
public enum YogaDimension {
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
public enum YogaDirection {
|
public enum YogaDirection {
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
public enum YogaDisplay {
|
public enum YogaDisplay {
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
public enum YogaEdge {
|
public enum YogaEdge {
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
public enum YogaExperimentalFeature {
|
public enum YogaExperimentalFeature {
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
public enum YogaFlexDirection {
|
public enum YogaFlexDirection {
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
public enum YogaJustify {
|
public enum YogaJustify {
|
||||||
@@ -32,8 +34,7 @@ public enum YogaJustify {
|
|||||||
case 2: return FLEX_END;
|
case 2: return FLEX_END;
|
||||||
case 3: return SPACE_BETWEEN;
|
case 3: return SPACE_BETWEEN;
|
||||||
case 4: return SPACE_AROUND;
|
case 4: return SPACE_AROUND;
|
||||||
case 5:
|
case 5: return SPACE_EVENLY;
|
||||||
return SPACE_EVENLY;
|
|
||||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
import com.facebook.proguard.annotations.DoNotStrip;
|
import com.facebook.proguard.annotations.DoNotStrip;
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
public enum YogaMeasureMode {
|
public enum YogaMeasureMode {
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
public enum YogaNodeType {
|
public enum YogaNodeType {
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
public enum YogaOverflow {
|
public enum YogaOverflow {
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
public enum YogaPositionType {
|
public enum YogaPositionType {
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
public enum YogaPrintOptions {
|
public enum YogaPrintOptions {
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
public enum YogaUnit {
|
public enum YogaUnit {
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
public enum YogaWrap {
|
public enum YogaWrap {
|
||||||
|
@@ -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
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*
|
|
||||||
* @flow
|
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
|
// @flow
|
||||||
|
// @format
|
||||||
const CONSTANTS = {
|
const CONSTANTS = {
|
||||||
ALIGN_COUNT: 8,
|
ALIGN_COUNT: 8,
|
||||||
ALIGN_AUTO: 0,
|
ALIGN_AUTO: 0,
|
||||||
@@ -82,9 +83,10 @@ const CONSTANTS = {
|
|||||||
OVERFLOW_HIDDEN: 1,
|
OVERFLOW_HIDDEN: 1,
|
||||||
OVERFLOW_SCROLL: 2,
|
OVERFLOW_SCROLL: 2,
|
||||||
|
|
||||||
POSITION_TYPE_COUNT: 2,
|
POSITION_TYPE_COUNT: 3,
|
||||||
POSITION_TYPE_RELATIVE: 0,
|
POSITION_TYPE_STATIC: 0,
|
||||||
POSITION_TYPE_ABSOLUTE: 1,
|
POSITION_TYPE_RELATIVE: 1,
|
||||||
|
POSITION_TYPE_ABSOLUTE: 2,
|
||||||
|
|
||||||
PRINT_OPTIONS_COUNT: 3,
|
PRINT_OPTIONS_COUNT: 3,
|
||||||
PRINT_OPTIONS_LAYOUT: 1,
|
PRINT_OPTIONS_LAYOUT: 1,
|
||||||
@@ -102,41 +104,28 @@ const CONSTANTS = {
|
|||||||
WRAP_WRAP: 1,
|
WRAP_WRAP: 1,
|
||||||
WRAP_WRAP_REVERSE: 2,
|
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 =
|
export type Yoga$Align =
|
||||||
| typeof CONSTANTS.ALIGN_AUTO
|
| typeof CONSTANTS.ALIGN_AUTO
|
||||||
| typeof CONSTANTS.ALIGN_BASELINE
|
| typeof CONSTANTS.ALIGN_FLEX_START
|
||||||
| typeof CONSTANTS.ALIGN_CENTER
|
| typeof CONSTANTS.ALIGN_CENTER
|
||||||
| typeof CONSTANTS.ALIGN_FLEX_END
|
| typeof CONSTANTS.ALIGN_FLEX_END
|
||||||
| typeof CONSTANTS.ALIGN_FLEX_START
|
| typeof CONSTANTS.ALIGN_STRETCH
|
||||||
| typeof CONSTANTS.ALIGN_SPACE_AROUND
|
| typeof CONSTANTS.ALIGN_BASELINE
|
||||||
| typeof CONSTANTS.ALIGN_SPACE_BETWEEN
|
| typeof CONSTANTS.ALIGN_SPACE_BETWEEN
|
||||||
| typeof CONSTANTS.ALIGN_STRETCH;
|
| typeof CONSTANTS.ALIGN_SPACE_AROUND;
|
||||||
|
|
||||||
export type Yoga$FlexDirection =
|
export type Yoga$Dimension =
|
||||||
| typeof CONSTANTS.FLEX_DIRECTION_COLUMN
|
| typeof CONSTANTS.DIMENSION_WIDTH
|
||||||
| typeof CONSTANTS.FLEX_DIRECTION_COLUMN_REVERSE
|
| typeof CONSTANTS.DIMENSION_HEIGHT;
|
||||||
| typeof CONSTANTS.FLEX_DIRECTION_COUNT
|
|
||||||
| typeof CONSTANTS.FLEX_DIRECTION_ROW
|
|
||||||
| typeof CONSTANTS.FLEX_DIRECTION_ROW_REVERSE;
|
|
||||||
|
|
||||||
export type Yoga$Direction =
|
export type Yoga$Direction =
|
||||||
| typeof CONSTANTS.DIRECTION_INHERIT
|
| typeof CONSTANTS.DIRECTION_INHERIT
|
||||||
| typeof CONSTANTS.DIRECTION_LTR
|
| typeof CONSTANTS.DIRECTION_LTR
|
||||||
| typeof CONSTANTS.DIRECTION_RTL;
|
| typeof CONSTANTS.DIRECTION_RTL;
|
||||||
|
|
||||||
export type Yoga$FlexWrap =
|
export type Yoga$Display =
|
||||||
| typeof CONSTANTS.WRAP_NO_WRAP
|
| typeof CONSTANTS.DISPLAY_FLEX
|
||||||
| typeof CONSTANTS.WRAP_WRAP
|
| typeof CONSTANTS.DISPLAY_NONE;
|
||||||
| typeof CONSTANTS.WRAP_WRAP_REVERSE;
|
|
||||||
|
|
||||||
export type Yoga$Edge =
|
export type Yoga$Edge =
|
||||||
| typeof CONSTANTS.EDGE_LEFT
|
| typeof CONSTANTS.EDGE_LEFT
|
||||||
@@ -149,25 +138,64 @@ export type Yoga$Edge =
|
|||||||
| typeof CONSTANTS.EDGE_VERTICAL
|
| typeof CONSTANTS.EDGE_VERTICAL
|
||||||
| typeof CONSTANTS.EDGE_ALL;
|
| typeof CONSTANTS.EDGE_ALL;
|
||||||
|
|
||||||
export type Yoga$Display =
|
export type Yoga$ExperimentalFeature =
|
||||||
| typeof CONSTANTS.DISPLAY_FLEX
|
| typeof CONSTANTS.EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS;
|
||||||
| typeof CONSTANTS.DISPLAY_NONE;
|
|
||||||
|
|
||||||
export type Yoga$Unit =
|
export type Yoga$FlexDirection =
|
||||||
| typeof CONSTANTS.UNIT_AUTO
|
| typeof CONSTANTS.FLEX_DIRECTION_COLUMN
|
||||||
| typeof CONSTANTS.UNIT_PERCENT
|
| typeof CONSTANTS.FLEX_DIRECTION_COLUMN_REVERSE
|
||||||
| typeof CONSTANTS.UNIT_POINT
|
| typeof CONSTANTS.FLEX_DIRECTION_ROW
|
||||||
| typeof CONSTANTS.UNIT_UNDEFINED;
|
| 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 =
|
export type Yoga$Overflow =
|
||||||
|
| typeof CONSTANTS.OVERFLOW_VISIBLE
|
||||||
| typeof CONSTANTS.OVERFLOW_HIDDEN
|
| typeof CONSTANTS.OVERFLOW_HIDDEN
|
||||||
| typeof CONSTANTS.OVERFLOW_SCROLL
|
| typeof CONSTANTS.OVERFLOW_SCROLL;
|
||||||
| typeof CONSTANTS.OVERFLOW_VISIBLE;
|
|
||||||
|
|
||||||
export type Yoga$PositionType =
|
export type Yoga$PositionType =
|
||||||
| typeof CONSTANTS.POSITION_TYPE_ABSOLUTE
|
| typeof CONSTANTS.POSITION_TYPE_STATIC
|
||||||
| typeof CONSTANTS.POSITION_TYPE_RELATIVE;
|
| 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;
|
module.exports = CONSTANTS;
|
||||||
|
@@ -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
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
@@ -38,11 +38,11 @@ if (!ran) {
|
|||||||
module.exports = Yoga(ret.bind, ret.lib);
|
module.exports = Yoga(ret.bind, ret.lib);
|
||||||
|
|
||||||
export type {
|
export type {
|
||||||
Yoga$JustifyContent,
|
Yoga$Justify,
|
||||||
Yoga$Align,
|
Yoga$Align,
|
||||||
Yoga$FlexDirection,
|
Yoga$FlexDirection,
|
||||||
Yoga$Direction,
|
Yoga$Direction,
|
||||||
Yoga$FlexWrap,
|
Yoga$Wrap,
|
||||||
Yoga$Edge,
|
Yoga$Edge,
|
||||||
Yoga$Display,
|
Yoga$Display,
|
||||||
Yoga$Unit,
|
Yoga$Unit,
|
||||||
|
@@ -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
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
@@ -8,16 +8,17 @@
|
|||||||
* @format
|
* @format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
const CONSTANTS = require('./YGEnums');
|
const CONSTANTS = require('./YGEnums');
|
||||||
import type {
|
import type {
|
||||||
Yoga$Edge,
|
Yoga$Edge,
|
||||||
Yoga$FlexWrap,
|
Yoga$Wrap,
|
||||||
Yoga$Align,
|
Yoga$Align,
|
||||||
Yoga$FlexDirection,
|
Yoga$FlexDirection,
|
||||||
Yoga$Direction,
|
Yoga$Direction,
|
||||||
Yoga$PositionType,
|
Yoga$PositionType,
|
||||||
Yoga$Overflow,
|
Yoga$Overflow,
|
||||||
Yoga$JustifyContent,
|
Yoga$Justify,
|
||||||
Yoga$Display,
|
Yoga$Display,
|
||||||
Yoga$ExperimentalFeature,
|
Yoga$ExperimentalFeature,
|
||||||
} from './YGEnums';
|
} from './YGEnums';
|
||||||
@@ -151,9 +152,9 @@ export type Yoga$Node = {
|
|||||||
getFlexDirection(): Yoga$FlexDirection,
|
getFlexDirection(): Yoga$FlexDirection,
|
||||||
getFlexGrow(): number,
|
getFlexGrow(): number,
|
||||||
getFlexShrink(): number,
|
getFlexShrink(): number,
|
||||||
getFlexWrap(): Yoga$FlexWrap,
|
getFlexWrap(): Yoga$Wrap,
|
||||||
getHeight(): Value,
|
getHeight(): Value,
|
||||||
getJustifyContent(): Yoga$JustifyContent,
|
getJustifyContent(): Yoga$Justify,
|
||||||
getMargin(edge: Yoga$Edge): Value,
|
getMargin(edge: Yoga$Edge): Value,
|
||||||
getMaxHeight(): Value,
|
getMaxHeight(): Value,
|
||||||
getMaxWidth(): Value,
|
getMaxWidth(): Value,
|
||||||
@@ -182,11 +183,11 @@ export type Yoga$Node = {
|
|||||||
setFlexDirection(flexDirection: Yoga$FlexDirection): void,
|
setFlexDirection(flexDirection: Yoga$FlexDirection): void,
|
||||||
setFlexGrow(flexGrow: number): void,
|
setFlexGrow(flexGrow: number): void,
|
||||||
setFlexShrink(flexShrink: number): void,
|
setFlexShrink(flexShrink: number): void,
|
||||||
setFlexWrap(flexWrap: Yoga$FlexWrap): void,
|
setFlexWrap(flexWrap: Yoga$Wrap): void,
|
||||||
setHeight(height: number | string): void,
|
setHeight(height: number | string): void,
|
||||||
setHeightAuto(): void,
|
setHeightAuto(): void,
|
||||||
setHeightPercent(height: number): void,
|
setHeightPercent(height: number): void,
|
||||||
setJustifyContent(justifyContent: Yoga$JustifyContent): void,
|
setJustifyContent(justifyContent: Yoga$Justify): void,
|
||||||
setMargin(edge: Yoga$Edge, margin: number): void,
|
setMargin(edge: Yoga$Edge, margin: number): void,
|
||||||
setMarginAuto(edge: Yoga$Edge): void,
|
setMarginAuto(edge: Yoga$Edge): void,
|
||||||
setMarginPercent(edge: Yoga$Edge, margin: number): void,
|
setMarginPercent(edge: Yoga$Edge, margin: number): void,
|
||||||
|
@@ -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
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
@@ -13,11 +13,11 @@ const nbind = require('nbind');
|
|||||||
const {bind, lib} = nbind.init(__dirname + '/../');
|
const {bind, lib} = nbind.init(__dirname + '/../');
|
||||||
module.exports = Yoga(bind, lib);
|
module.exports = Yoga(bind, lib);
|
||||||
export type {
|
export type {
|
||||||
Yoga$JustifyContent,
|
Yoga$Justify,
|
||||||
Yoga$Align,
|
Yoga$Align,
|
||||||
Yoga$FlexDirection,
|
Yoga$FlexDirection,
|
||||||
Yoga$Direction,
|
Yoga$Direction,
|
||||||
Yoga$FlexWrap,
|
Yoga$Wrap,
|
||||||
Yoga$Edge,
|
Yoga$Edge,
|
||||||
Yoga$Display,
|
Yoga$Display,
|
||||||
Yoga$Unit,
|
Yoga$Unit,
|
||||||
|
@@ -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
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
* @format
|
* @format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
import {Record, List} from 'immutable';
|
import {Record, List} from 'immutable';
|
||||||
import type {RecordOf} from 'immutable';
|
import type {RecordOf} from 'immutable';
|
||||||
import PositionRecord from './PositionRecord';
|
import PositionRecord from './PositionRecord';
|
||||||
@@ -16,9 +17,9 @@ import yoga from 'yoga-layout/dist/entry-browser';
|
|||||||
|
|
||||||
import type {
|
import type {
|
||||||
Yoga$Align,
|
Yoga$Align,
|
||||||
Yoga$JustifyContent,
|
Yoga$Justify,
|
||||||
Yoga$FlexDirection,
|
Yoga$FlexDirection,
|
||||||
Yoga$FlexWrap,
|
Yoga$Wrap,
|
||||||
Yoga$PositionType,
|
Yoga$PositionType,
|
||||||
} from 'yoga-layout';
|
} from 'yoga-layout';
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@ export type LayoutRecordT = RecordOf<{
|
|||||||
minHeight?: ?number,
|
minHeight?: ?number,
|
||||||
maxWidth?: ?number,
|
maxWidth?: ?number,
|
||||||
maxHeight?: ?number,
|
maxHeight?: ?number,
|
||||||
justifyContent?: Yoga$JustifyContent,
|
justifyContent?: Yoga$Justify,
|
||||||
padding: PositionRecordT,
|
padding: PositionRecordT,
|
||||||
border: PositionRecordT,
|
border: PositionRecordT,
|
||||||
margin: PositionRecordT,
|
margin: PositionRecordT,
|
||||||
@@ -43,7 +44,7 @@ export type LayoutRecordT = RecordOf<{
|
|||||||
flexGrow?: number,
|
flexGrow?: number,
|
||||||
flexShrink?: number,
|
flexShrink?: number,
|
||||||
padding?: number,
|
padding?: number,
|
||||||
flexWrap?: Yoga$FlexWrap,
|
flexWrap?: Yoga$Wrap,
|
||||||
aspectRatio?: number,
|
aspectRatio?: number,
|
||||||
children?: List<LayoutRecordT>,
|
children?: List<LayoutRecordT>,
|
||||||
minWidth?: number,
|
minWidth?: number,
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
#include "YGEnums.h"
|
#include "YGEnums.h"
|
||||||
|
|
||||||
const char* YGAlignToString(const YGAlign value) {
|
const char* YGAlignToString(const YGAlign value) {
|
||||||
|
@@ -5,53 +5,13 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// @generated by enums.py
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
// clang-format: off
|
||||||
|
|
||||||
#include "YGMacros.h"
|
#include "YGMacros.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
namespace facebook {
|
|
||||||
namespace yoga {
|
|
||||||
namespace enums {
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
constexpr int count(); // can't use `= delete` due to a defect in clang < 3.9
|
|
||||||
|
|
||||||
namespace detail {
|
|
||||||
template <int... xs>
|
|
||||||
constexpr int n() {
|
|
||||||
return sizeof...(xs);
|
|
||||||
}
|
|
||||||
} // namespace detail
|
|
||||||
|
|
||||||
} // namespace enums
|
|
||||||
} // namespace yoga
|
|
||||||
} // namespace facebook
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define YG_ENUM_DECL(NAME, ...) \
|
|
||||||
typedef YG_ENUM_BEGIN(NAME){__VA_ARGS__} YG_ENUM_END(NAME); \
|
|
||||||
WIN_EXPORT const char* NAME##ToString(NAME);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define YG_ENUM_SEQ_DECL(NAME, ...) \
|
|
||||||
YG_ENUM_DECL(NAME, __VA_ARGS__) \
|
|
||||||
YG_EXTERN_C_END \
|
|
||||||
namespace facebook { \
|
|
||||||
namespace yoga { \
|
|
||||||
namespace enums { \
|
|
||||||
template <> \
|
|
||||||
constexpr int count<NAME>() { \
|
|
||||||
return detail::n<__VA_ARGS__>(); \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
YG_EXTERN_C_BEGIN
|
|
||||||
#else
|
|
||||||
#define YG_ENUM_SEQ_DECL YG_ENUM_DECL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
YG_EXTERN_C_BEGIN
|
YG_EXTERN_C_BEGIN
|
||||||
|
|
||||||
YG_ENUM_SEQ_DECL(
|
YG_ENUM_SEQ_DECL(
|
||||||
@@ -63,9 +23,12 @@ YG_ENUM_SEQ_DECL(
|
|||||||
YGAlignStretch,
|
YGAlignStretch,
|
||||||
YGAlignBaseline,
|
YGAlignBaseline,
|
||||||
YGAlignSpaceBetween,
|
YGAlignSpaceBetween,
|
||||||
YGAlignSpaceAround);
|
YGAlignSpaceAround)
|
||||||
|
|
||||||
YG_ENUM_SEQ_DECL(YGDimension, YGDimensionWidth, YGDimensionHeight)
|
YG_ENUM_SEQ_DECL(
|
||||||
|
YGDimension,
|
||||||
|
YGDimensionWidth,
|
||||||
|
YGDimensionHeight)
|
||||||
|
|
||||||
YG_ENUM_SEQ_DECL(
|
YG_ENUM_SEQ_DECL(
|
||||||
YGDirection,
|
YGDirection,
|
||||||
@@ -73,7 +36,10 @@ YG_ENUM_SEQ_DECL(
|
|||||||
YGDirectionLTR,
|
YGDirectionLTR,
|
||||||
YGDirectionRTL)
|
YGDirectionRTL)
|
||||||
|
|
||||||
YG_ENUM_SEQ_DECL(YGDisplay, YGDisplayFlex, YGDisplayNone)
|
YG_ENUM_SEQ_DECL(
|
||||||
|
YGDisplay,
|
||||||
|
YGDisplayFlex,
|
||||||
|
YGDisplayNone)
|
||||||
|
|
||||||
YG_ENUM_SEQ_DECL(
|
YG_ENUM_SEQ_DECL(
|
||||||
YGEdge,
|
YGEdge,
|
||||||
@@ -87,7 +53,9 @@ YG_ENUM_SEQ_DECL(
|
|||||||
YGEdgeVertical,
|
YGEdgeVertical,
|
||||||
YGEdgeAll)
|
YGEdgeAll)
|
||||||
|
|
||||||
YG_ENUM_SEQ_DECL(YGExperimentalFeature, YGExperimentalFeatureWebFlexBasis)
|
YG_ENUM_SEQ_DECL(
|
||||||
|
YGExperimentalFeature,
|
||||||
|
YGExperimentalFeatureWebFlexBasis)
|
||||||
|
|
||||||
YG_ENUM_SEQ_DECL(
|
YG_ENUM_SEQ_DECL(
|
||||||
YGFlexDirection,
|
YGFlexDirection,
|
||||||
@@ -120,7 +88,10 @@ YG_ENUM_SEQ_DECL(
|
|||||||
YGMeasureModeExactly,
|
YGMeasureModeExactly,
|
||||||
YGMeasureModeAtMost)
|
YGMeasureModeAtMost)
|
||||||
|
|
||||||
YG_ENUM_SEQ_DECL(YGNodeType, YGNodeTypeDefault, YGNodeTypeText)
|
YG_ENUM_SEQ_DECL(
|
||||||
|
YGNodeType,
|
||||||
|
YGNodeTypeDefault,
|
||||||
|
YGNodeTypeText)
|
||||||
|
|
||||||
YG_ENUM_SEQ_DECL(
|
YG_ENUM_SEQ_DECL(
|
||||||
YGOverflow,
|
YGOverflow,
|
||||||
@@ -147,9 +118,10 @@ YG_ENUM_SEQ_DECL(
|
|||||||
YGUnitPercent,
|
YGUnitPercent,
|
||||||
YGUnitAuto)
|
YGUnitAuto)
|
||||||
|
|
||||||
YG_ENUM_SEQ_DECL(YGWrap, YGWrapNoWrap, YGWrapWrap, YGWrapWrapReverse)
|
YG_ENUM_SEQ_DECL(
|
||||||
|
YGWrap,
|
||||||
|
YGWrapNoWrap,
|
||||||
|
YGWrapWrap,
|
||||||
|
YGWrapWrapReverse)
|
||||||
|
|
||||||
YG_EXTERN_C_END
|
YG_EXTERN_C_END
|
||||||
|
|
||||||
#undef YG_ENUM_DECL
|
|
||||||
#undef YG_ENUM_SEQ_DECL
|
|
||||||
|
@@ -40,6 +40,49 @@
|
|||||||
#define YG_ENUM_END(name) name
|
#define YG_ENUM_END(name) name
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
namespace facebook {
|
||||||
|
namespace yoga {
|
||||||
|
namespace enums {
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
constexpr int count(); // can't use `= delete` due to a defect in clang < 3.9
|
||||||
|
|
||||||
|
namespace detail {
|
||||||
|
template <int... xs>
|
||||||
|
constexpr int n() {
|
||||||
|
return sizeof...(xs);
|
||||||
|
}
|
||||||
|
} // namespace detail
|
||||||
|
|
||||||
|
} // namespace enums
|
||||||
|
} // namespace yoga
|
||||||
|
} // namespace facebook
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define YG_ENUM_DECL(NAME, ...) \
|
||||||
|
typedef YG_ENUM_BEGIN(NAME){__VA_ARGS__} YG_ENUM_END(NAME); \
|
||||||
|
WIN_EXPORT const char* NAME##ToString(NAME);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define YG_ENUM_SEQ_DECL(NAME, ...) \
|
||||||
|
YG_ENUM_DECL(NAME, __VA_ARGS__) \
|
||||||
|
YG_EXTERN_C_END \
|
||||||
|
namespace facebook { \
|
||||||
|
namespace yoga { \
|
||||||
|
namespace enums { \
|
||||||
|
template <> \
|
||||||
|
constexpr int count<NAME>() { \
|
||||||
|
return detail::n<__VA_ARGS__>(); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
YG_EXTERN_C_BEGIN
|
||||||
|
#else
|
||||||
|
#define YG_ENUM_SEQ_DECL YG_ENUM_DECL
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define YG_DEPRECATED __attribute__((deprecated))
|
#define YG_DEPRECATED __attribute__((deprecated))
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(_MSC_VER)
|
||||||
|
Reference in New Issue
Block a user