Skip to content

Commit 79fe6ec

Browse files
Merge branch 'main' into css-grid
2 parents de3871c + 8877573 commit 79fe6ec

13 files changed

Lines changed: 4087 additions & 3963 deletions

File tree

.github/actions/setup-apple/action.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ name: Setup Apple envirionment
33
runs:
44
using: "composite"
55
steps:
6-
# TODO: This and Ruby should be versioned
7-
- name: Install Cocoapods
8-
shell: bash
9-
run: sudo gem install cocoapods
10-
116
- uses: maxim-lobanov/setup-xcode@v1
127
with:
13-
xcode-version: 14.3.1
8+
xcode-version: 26.2

.github/workflows/publish-cocoapods-release.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Validate Apple
1+
name: Validate SwiftPM
22

33
on:
44
pull_request:
@@ -9,22 +9,9 @@ on:
99
workflow_dispatch:
1010

1111
jobs:
12-
lint-pods:
13-
name: Build [CocoaPods]
14-
runs-on: macos-13
15-
16-
steps:
17-
- uses: actions/checkout@v3
18-
19-
- name: Setup
20-
uses: ./.github/actions/setup-apple
21-
22-
- name: pod lib lint
23-
run: pod lib lint --verbose --include-podspecs=**/*.podspec
24-
2512
test:
26-
name: Build [SwiftPM]
27-
runs-on: macos-13
13+
name: Build
14+
runs-on: macos-latest
2815

2916
steps:
3017
- uses: actions/checkout@v3

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Yoga [![CocoaPods](https://img.shields.io/cocoapods/v/Yoga.svg)](http://cocoapods.org/pods/Yoga) [![npm](https://img.shields.io/npm/v/yoga-layout.svg)](https://www.npmjs.com/package/yoga-layout) [![Maven Central](https://img.shields.io/maven-central/v/com.facebook.yoga/yoga)](https://search.maven.org/artifact/com.facebook.yoga/yoga) ![SPM](https://img.shields.io/badge/SPM-Supported-blue.svg)
1+
# Yoga [![npm](https://img.shields.io/npm/v/yoga-layout.svg)](https://www.npmjs.com/package/yoga-layout) [![Maven Central](https://img.shields.io/maven-central/v/com.facebook.yoga/yoga)](https://search.maven.org/artifact/com.facebook.yoga/yoga) ![SPM](https://img.shields.io/badge/SPM-Supported-blue.svg)
22

33
Yoga is an embeddable and performant flexbox layout engine with bindings for multiple languages.
44

Yoga.podspec

Lines changed: 0 additions & 50 deletions
This file was deleted.

enums.py

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@
9191
],
9292
}
9393

94+
# Temporary filter enums to not upgrade all enums at once
95+
KOTLIN_ENUM_NAMES = {"Direction"}
96+
97+
ENUMS_KOTLIN = {name: ENUMS[name] for name in KOTLIN_ENUM_NAMES}
98+
ENUMS_JAVA = {
99+
name: values for name, values in ENUMS.items() if name not in KOTLIN_ENUM_NAMES
100+
}
101+
94102
DO_NOT_STRIP = ["LogLevel"]
95103

96104
BITSET_ENUMS = ["Errata"]
@@ -127,6 +135,10 @@ def to_java_upper(symbol):
127135
return _format_name(symbol, "_", "upper")
128136

129137

138+
def to_kotlin_upper(symbol):
139+
return _format_name(symbol, "_", "upper")
140+
141+
130142
def to_hyphenated_lower(symbol):
131143
return _format_name(symbol, "-", "lower")
132144

@@ -222,7 +234,7 @@ def to_hyphenated_lower(symbol):
222234
f.write("\n")
223235

224236
# write out java files
225-
for name, values in sorted(ENUMS.items()):
237+
for name, values in sorted(ENUMS_JAVA.items()):
226238
with open(root + "/java/com/facebook/yoga/Yoga%s.java" % name, "w") as f:
227239
f.write(get_license("java"))
228240
f.write("package com.facebook.yoga;\n\n")
@@ -274,6 +286,46 @@ def to_hyphenated_lower(symbol):
274286
f.write(" }\n")
275287
f.write("}\n")
276288

289+
# write out Kotlin files
290+
for name, values in sorted(ENUMS_KOTLIN.items()):
291+
with open(root + "/java/com/facebook/yoga/Yoga%s.kt" % name, "w") as f:
292+
f.write(get_license("kotlin"))
293+
f.write("package com.facebook.yoga\n\n")
294+
f.write("public enum class Yoga%s(public val intValue: Int) {\n" % name)
295+
if len(values) > 0:
296+
for value in values:
297+
if isinstance(value, tuple):
298+
f.write(" %s(%d)" % (to_kotlin_upper(value[0]), value[1]))
299+
else:
300+
f.write(" %s(%d)" % (to_kotlin_upper(value), values.index(value)))
301+
if values.index(value) is len(values) - 1:
302+
f.write(";\n")
303+
else:
304+
f.write(",\n")
305+
else:
306+
f.write("__EMPTY(-1);")
307+
f.write("\n")
308+
f.write(" public fun intValue(): Int = intValue\n")
309+
f.write("\n")
310+
f.write(" public companion object {\n")
311+
f.write(" @JvmStatic\n")
312+
f.write(" public fun fromInt(value: Int): Yoga%s =\n" % name)
313+
f.write(" when (value) {\n")
314+
for value in values:
315+
if isinstance(value, tuple):
316+
f.write(" %d -> %s\n" % (value[1], to_kotlin_upper(value[0])))
317+
else:
318+
f.write(
319+
" %d -> %s\n"
320+
% (values.index(value), to_kotlin_upper(value))
321+
)
322+
f.write(
323+
' else -> throw IllegalArgumentException("Unknown enum value: $value")\n'
324+
)
325+
f.write(" }\n")
326+
f.write(" }\n")
327+
f.write("}\n")
328+
277329
# write out TypeScript file
278330
with open(root + "/javascript/src/generated/YGEnums.ts", "w") as f:
279331
f.write(get_license("js"))

java/com/facebook/yoga/YogaDirection.java

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
// @generated by enums.py
9+
10+
package com.facebook.yoga
11+
12+
public enum class YogaDirection(public val intValue: Int) {
13+
INHERIT(0),
14+
LTR(1),
15+
RTL(2);
16+
17+
public fun intValue(): Int = intValue
18+
19+
public companion object {
20+
@JvmStatic
21+
public fun fromInt(value: Int): YogaDirection =
22+
when (value) {
23+
0 -> INHERIT
24+
1 -> LTR
25+
2 -> RTL
26+
else -> throw IllegalArgumentException("Unknown enum value: $value")
27+
}
28+
}
29+
}

set-version.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,3 @@
3535
f.seek(0)
3636
f.truncate()
3737
f.write(new_contents)
38-
39-
with open("Yoga.podspec", "r+") as f:
40-
new_contents = re.sub(
41-
r"spec\.version = '.*'", f"spec.version = '{version}'", f.read()
42-
)
43-
f.seek(0)
44-
f.truncate()
45-
f.write(new_contents)

website/src/components/EditorToolbar.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,7 @@ export type Props = Readonly<{
2222
style?: React.CSSProperties;
2323
}>;
2424

25-
export default function EditorToolbar({
26-
code,
27-
className,
28-
style,
29-
}: Props): JSX.Element {
25+
export default function EditorToolbar({code, className, style}: Props) {
3026
const handleShare = useCallback(() => {
3127
navigator.clipboard.writeText(
3228
window.location.origin +
@@ -47,11 +43,7 @@ type ToolbarButtonProps = Readonly<{
4743
label?: string;
4844
}>;
4945

50-
function ToolbarButton({
51-
onClick,
52-
Icon,
53-
label,
54-
}: ToolbarButtonProps): JSX.Element {
46+
function ToolbarButton({onClick, Icon, label}: ToolbarButtonProps) {
5547
const [isSuccess, setIsSuccess] = useState(false);
5648
const copyTimeout = useRef<number | undefined>(undefined);
5749

0 commit comments

Comments
 (0)