diff --git a/javascript/.eslintrc.js b/.eslintrc.js similarity index 71% rename from javascript/.eslintrc.js rename to .eslintrc.js index e43435dcdd..1f2a76ab14 100644 --- a/javascript/.eslintrc.js +++ b/.eslintrc.js @@ -7,14 +7,18 @@ * @format */ -const path = require('path'); - module.exports = { root: true, - ignorePatterns: ['binaries/**', 'build/**', 'dist/**', 'tests/generated/**'], + ignorePatterns: [ + '/website', + '**/binaries/**', + '**/build/**', + '**/generated/**', + ], extends: ['eslint:recommended', 'plugin:prettier/recommended'], plugins: ['prettier'], rules: { + 'no-unused-vars': ['error', {argsIgnorePattern: '^_'}], 'no-var': 'error', 'prefer-arrow-callback': 'error', 'prefer-const': 'error', @@ -26,25 +30,25 @@ module.exports = { commonjs: true, es2018: true, }, + parserOptions: { + sourceType: 'module', + ecmaVersion: 'latest', + }, overrides: [ { - files: ['**/*.js'], - parser: '@babel/eslint-parser', - parserOptions: { - babelOptions: { - configFile: path.join(__dirname, '.babelrc.js'), - }, - }, - }, - { - files: ['**/*.ts'], + files: ['**/*.ts', '**/*.tsx'], extends: ['plugin:@typescript-eslint/recommended'], parser: '@typescript-eslint/parser', parserOptions: { - project: path.join(__dirname, 'tsconfig.json'), + project: true, }, plugins: ['@typescript-eslint'], rules: { + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/no-unused-vars': [ + 'error', + {argsIgnorePattern: '^_'}, + ], '@typescript-eslint/no-var-requires': 'off', }, }, @@ -55,7 +59,7 @@ module.exports = { }, }, { - files: ['jest.*', 'tests/**'], + files: ['jest.*', '**/tests/**'], env: { node: true, }, diff --git a/.github/actions/setup-cpp/action.yml b/.github/actions/setup-cpp/action.yml index 8947b695a4..c6f0ed0b73 100644 --- a/.github/actions/setup-cpp/action.yml +++ b/.github/actions/setup-cpp/action.yml @@ -1,4 +1,9 @@ name: Setup C++ envirionment +inputs: + toolchain: + description: Compiler toolchain to use (Clang, GCC, or MSVC) + required: false + default: 'Clang' runs: using: "composite" @@ -7,6 +12,20 @@ runs: if: ${{ runner.os != 'Windows' }} uses: ./.github/actions/install-ninja + - name: Set Clang as compiler + if: ${{ inputs.toolchain == 'Clang' }} + shell: bash + run: | + echo "CC=/usr/bin/clang" >> $GITHUB_ENV + echo "CXX=/usr/bin/clang++" >> $GITHUB_ENV + + - name: Set GCC as compiler + if: ${{ inputs.toolchain == 'GCC' }} + shell: bash + run: | + echo "CC=/usr/bin/gcc" >> $GITHUB_ENV + echo "CXX=/usr/bin/g++" >> $GITHUB_ENV + - name: Setup VS Developer Command Prompt if: ${{ runner.os == 'Windows' }} uses: ilammy/msvc-dev-cmd@v1 diff --git a/.github/workflows/validate-cpp.yml b/.github/workflows/validate-cpp.yml index 6d83c3906a..cbb8168a81 100644 --- a/.github/workflows/validate-cpp.yml +++ b/.github/workflows/validate-cpp.yml @@ -12,34 +12,38 @@ env: jobs: test: - name: Build and Test [${{ matrix.os }}][${{ matrix.mode }}] - runs-on: ${{ matrix.os }} + name: Build and Test [${{ matrix.toolchain }}][${{ matrix.mode }}] + runs-on: ${{ (matrix.toolchain == 'MSVC') && 'windows-latest' || 'ubuntu-latest' }} strategy: matrix: mode: [Debug, Release] - os: [ubuntu-latest] # TODO: fix issues building GTest Binary with MSVC in GitHub Actions + toolchain: [Clang, GCC] # TODO: fix issues building GTest Binary with MSVC in GitHub Actions steps: - uses: actions/checkout@v3 - name: Setup uses: ./.github/actions/setup-cpp + with: + toolchain: ${{ matrix.toolchain }} - name: Unit tests run: ./unit_tests ${{ matrix.mode }} benchmark: - name: Benchmark [${{ matrix.os }}] - runs-on: ${{ matrix.os }} + name: Benchmark [${{ matrix.toolchain }}] + runs-on: ${{ (matrix.toolchain == 'MSVC') && 'windows-latest' || 'ubuntu-latest' }} strategy: matrix: - os: [ubuntu-latest, windows-latest] + toolchain: [Clang, GCC, MSVC] steps: - uses: actions/checkout@v3 - name: Setup uses: ./.github/actions/setup-cpp + with: + toolchain: ${{ matrix.toolchain }} - name: Build benchmark run: | @@ -60,5 +64,3 @@ jobs: - name: clang-format uses: ./.github/actions/clang-format - with: - directory: ./yoga diff --git a/.github/workflows/validate-js.yml b/.github/workflows/validate-js.yml index 4f5628056a..d3ee83926a 100644 --- a/.github/workflows/validate-js.yml +++ b/.github/workflows/validate-js.yml @@ -60,17 +60,29 @@ jobs: working-directory: javascript lint: - name: Lint + name: ESLint (All Packages) runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: yarn install run: yarn install --frozen-lockfile - working-directory: javascript - name: yarn lint run: yarn lint + + typecheck: + name: Typecheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: yarn install + run: yarn install --frozen-lockfile + working-directory: javascript + + - name: yarn tsc + run: yarn tsc working-directory: javascript pack: diff --git a/.github/workflows/validate-swiftpm.yml b/.github/workflows/validate-swiftpm.yml new file mode 100644 index 0000000000..da58270804 --- /dev/null +++ b/.github/workflows/validate-swiftpm.yml @@ -0,0 +1,22 @@ +name: Swift + +on: + pull_request: + push: + branches: + - main + workflow_dispatch: + +jobs: + test: + name: Build + runs-on: macos-latest + + steps: + - uses: actions/checkout@v3 + + - name: Build Debug + run: swift build -c debug + + - name: Build Release + run: swift build -c release diff --git a/.github/workflows/validate-website-next.yml b/.github/workflows/validate-website-next.yml new file mode 100644 index 0000000000..e957e5f43a --- /dev/null +++ b/.github/workflows/validate-website-next.yml @@ -0,0 +1,41 @@ +name: Website (Next) + +on: + pull_request: + push: + branches: + - main + workflow_dispatch: + + build: + name: Build + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup + uses: ./.github/actions/setup-js + + - name: Build Yoga + run: yarn build + working-directory: javascript + + - name: Build Website + run: yarn build + working-directory: website-next + + typecheck: + name: Typecheck + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: yarn install + run: yarn install --frozen-lockfile + working-directory: javascript + + - name: yarn tsc + run: yarn tsc + working-directory: website-next diff --git a/.github/workflows/validate-website.yml b/.github/workflows/validate-website.yml index e6b8a40b3e..4f79beeb39 100644 --- a/.github/workflows/validate-website.yml +++ b/.github/workflows/validate-website.yml @@ -9,7 +9,7 @@ on: jobs: build: - name: Build + name: Build [Gatsby] runs-on: ubuntu-20.04 steps: @@ -21,3 +21,21 @@ jobs: - name: yarn build run: yarn build working-directory: website + + build_next: + name: Build [Docusaurus] + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup + uses: ./.github/actions/setup-js + + - name: Build Yoga + run: yarn build + working-directory: javascript + + - name: Build Website + run: yarn build + working-directory: website-next diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000000..b285b16a0e --- /dev/null +++ b/.prettierignore @@ -0,0 +1,3 @@ +**/binaries/** +**/build/** +**/generated/** diff --git a/javascript/.prettierrc.js b/.prettierrc.js similarity index 100% rename from javascript/.prettierrc.js rename to .prettierrc.js diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000000..4c8d846fa9 --- /dev/null +++ b/Package.swift @@ -0,0 +1,32 @@ +// swift-tools-version:5.0 +// The swift-tools-version declares the minimum version of Swift required to build this package. +/* + * 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. + */ + + +import PackageDescription + +let package = Package( + name: "yoga", + products: [ + .library(name: "yoga", targets: [ "core" ]) + ], + targets: [ + .target( + name: "core", + path: ".", + sources: [ + "yoga" + ], + publicHeadersPath: ".", + cxxSettings: [ + .headerSearchPath(".") + ] + ) + ], + cxxLanguageStandard: CXXLanguageStandard(rawValue: "c++17") +) diff --git a/Yoga.podspec b/Yoga.podspec index bd050ade43..4ebb5adff3 100644 --- a/Yoga.podspec +++ b/Yoga.podspec @@ -35,7 +35,14 @@ Pod::Spec.new do |spec| '-std=c++17', '-fPIC' ] - spec.source_files = 'yoga/**/*.{h,cpp}' - spec.public_header_files = 'yoga/{Yoga,YGEnums,YGMacros,YGValue}.h' + spec.swift_version = '5.1' + spec.source_files = 'yoga/**/*.{h,cpp}' + spec.header_mappings_dir = 'yoga' + + public_header_files = 'yoga/{Yoga,YGEnums,YGMacros,YGValue}.h' + spec.public_header_files = public_header_files + + all_header_files = 'yoga/**/*.h' + spec.private_header_files = Dir.glob(all_header_files) - Dir.glob(public_header_files) end diff --git a/enums.py b/enums.py index c2d9906ebb..0ae51722bc 100755 --- a/enums.py +++ b/enums.py @@ -52,8 +52,6 @@ "WebFlexBasis", # Conformance fix: https://github.com/facebook/yoga/pull/1028 "AbsolutePercentageAgainstPaddingEdge", - # fix JNI local ref overflows - "FixJNILocalRefOverflows", ], "PrintOptions": [ ("Layout", 1 << 0), diff --git a/gentest/gentest-cpp.js b/gentest/gentest-cpp.js index 9076958b65..9b50ac8143 100644 --- a/gentest/gentest-cpp.js +++ b/gentest/gentest-cpp.js @@ -5,254 +5,485 @@ * LICENSE file in the root directory of this source tree. */ +/* global Emitter:readable */ + function toValueCpp(value) { - var n = value.toString().replace('px','').replace('%',''); + const n = value.toString().replace('px', '').replace('%', ''); return n + (Number(n) == n && n % 1 !== 0 ? 'f' : ''); } function toFunctionName(value) { if (value.indexOf('%') >= 0) { return 'Percent'; - } else if(value.indexOf('Auto') >= 0) { + } else if (value.indexOf('Auto') >= 0) { return 'Auto'; } return ''; } -var CPPEmitter = function() { +const CPPEmitter = function () { Emitter.call(this, 'cpp', ' '); }; CPPEmitter.prototype = Object.create(Emitter.prototype, { - constructor:{value:CPPEmitter}, - - emitPrologue:{value:function() { - this.push([ - '#include ', - '#include ', - '', - ]); - }}, - - emitTestPrologue:{value:function(name, experiments, disabled) { - this.push('TEST(YogaTest, ' + name + ') {'); - this.pushIndent(); - - if (disabled) { - this.push('GTEST_SKIP();'); + constructor: {value: CPPEmitter}, + + emitPrologue: { + value: function () { + this.push(['#include ', '#include ', '']); + }, + }, + + emitTestPrologue: { + value: function (name, experiments, disabled) { + this.push('TEST(YogaTest, ' + name + ') {'); + this.pushIndent(); + + if (disabled) { + this.push('GTEST_SKIP();'); + this.push(''); + } + + this.push('const YGConfigRef config = YGConfigNew();'); + for (const i in experiments) { + this.push( + 'YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeature' + + experiments[i] + + ', true);', + ); + } this.push(''); - } - - this.push('const YGConfigRef config = YGConfigNew();') - for (var i in experiments) { - this.push('YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeature' + experiments[i] +', true);'); - } - this.push(''); - }}, - - emitTestTreePrologue:{value:function(nodeName) { - this.push('const YGNodeRef ' + nodeName + ' = YGNodeNewWithConfig(config);'); - }}, - - emitTestEpilogue:{value:function(experiments) { - this.push([ - '', - 'YGNodeFreeRecursive(root);', - ]); - - this.push(''); - this.push('YGConfigFree(config);') - - this.popIndent(); - this.push([ - '}', - '', - ]); - }}, - - emitEpilogue:{value:function() { - }}, - - AssertEQ:{value:function(v0, v1) { - this.push('ASSERT_FLOAT_EQ(' + toValueCpp(v0) + ', ' + v1 + ');'); - }}, - - YGAlignAuto:{value:'YGAlignAuto'}, - YGAlignCenter:{value:'YGAlignCenter'}, - YGAlignFlexEnd:{value:'YGAlignFlexEnd'}, - YGAlignFlexStart:{value:'YGAlignFlexStart'}, - YGAlignStretch:{value:'YGAlignStretch'}, - YGAlignSpaceBetween:{value:'YGAlignSpaceBetween'}, - YGAlignSpaceAround:{value:'YGAlignSpaceAround'}, - YGAlignBaseline:{value:'YGAlignBaseline'}, - - YGDirectionInherit:{value:'YGDirectionInherit'}, - YGDirectionLTR:{value:'YGDirectionLTR'}, - YGDirectionRTL:{value:'YGDirectionRTL'}, - - YGEdgeBottom:{value:'YGEdgeBottom'}, - YGEdgeEnd:{value:'YGEdgeEnd'}, - YGEdgeLeft:{value:'YGEdgeLeft'}, - YGEdgeRight:{value:'YGEdgeRight'}, - YGEdgeStart:{value:'YGEdgeStart'}, - YGEdgeTop:{value:'YGEdgeTop'}, - - YGGutterAll:{value:'YGGutterAll'}, - YGGutterColumn:{value:'YGGutterColumn'}, - YGGutterRow:{value:'YGGutterRow'}, - - YGFlexDirectionColumn:{value:'YGFlexDirectionColumn'}, - YGFlexDirectionColumnReverse:{value:'YGFlexDirectionColumnReverse'}, - YGFlexDirectionRow:{value:'YGFlexDirectionRow'}, - YGFlexDirectionRowReverse:{value:'YGFlexDirectionRowReverse'}, - - YGJustifyCenter:{value:'YGJustifyCenter'}, - YGJustifyFlexEnd:{value:'YGJustifyFlexEnd'}, - YGJustifyFlexStart:{value:'YGJustifyFlexStart'}, - YGJustifySpaceAround:{value:'YGJustifySpaceAround'}, - YGJustifySpaceBetween:{value:'YGJustifySpaceBetween'}, - YGJustifySpaceEvenly:{value:'YGJustifySpaceEvenly'}, - - YGOverflowHidden:{value:'YGOverflowHidden'}, - YGOverflowVisible:{value:'YGOverflowVisible'}, - - YGPositionTypeAbsolute:{value:'YGPositionTypeAbsolute'}, - YGPositionTypeRelative:{value:'YGPositionTypeRelative'}, - - YGWrapNoWrap:{value:'YGWrapNoWrap'}, - YGWrapWrap:{value:'YGWrapWrap'}, - YGWrapWrapReverse:{value: 'YGWrapWrapReverse'}, - - YGUndefined:{value:'YGUndefined'}, - - YGDisplayFlex:{value:'YGDisplayFlex'}, - YGDisplayNone:{value:'YGDisplayNone'}, - YGAuto:{value:'YGAuto'}, - - - YGNodeCalculateLayout:{value:function(node, dir, experiments) { - this.push('YGNodeCalculateLayout(' + node + ', YGUndefined, YGUndefined, ' + dir + ');'); - }}, - - YGNodeInsertChild:{value:function(parentName, nodeName, index) { - this.push('YGNodeInsertChild(' + parentName + ', ' + nodeName + ', ' + index + ');'); - }}, - - YGNodeLayoutGetLeft:{value:function(nodeName) { - return 'YGNodeLayoutGetLeft(' + nodeName + ')'; - }}, - - YGNodeLayoutGetTop:{value:function(nodeName) { - return 'YGNodeLayoutGetTop(' + nodeName + ')'; - }}, - - YGNodeLayoutGetWidth:{value:function(nodeName) { - return 'YGNodeLayoutGetWidth(' + nodeName + ')'; - }}, - - YGNodeLayoutGetHeight:{value:function(nodeName) { - return 'YGNodeLayoutGetHeight(' + nodeName + ')'; - }}, - - YGNodeStyleSetAlignContent:{value:function(nodeName, value) { - this.push('YGNodeStyleSetAlignContent(' + nodeName + ', ' + toValueCpp(value) + ');'); - }}, - - YGNodeStyleSetAlignItems:{value:function(nodeName, value) { - this.push('YGNodeStyleSetAlignItems(' + nodeName + ', ' + toValueCpp(value) + ');'); - }}, - - YGNodeStyleSetAlignSelf:{value:function(nodeName, value) { - this.push('YGNodeStyleSetAlignSelf(' + nodeName + ', ' + toValueCpp(value) + ');'); - }}, - - YGNodeStyleSetBorder:{value:function(nodeName, edge, value) { - this.push('YGNodeStyleSetBorder(' + nodeName + ', ' + edge + ', ' + toValueCpp(value) + ');'); - }}, - - YGNodeStyleSetDirection:{value:function(nodeName, value) { - this.push('YGNodeStyleSetDirection(' + nodeName + ', ' + toValueCpp(value) + ');'); - }}, - - YGNodeStyleSetDisplay:{value:function(nodeName, value) { - this.push('YGNodeStyleSetDisplay(' + nodeName + ', ' + toValueCpp(value) + ');'); - }}, - - YGNodeStyleSetFlexBasis:{value:function(nodeName, value) { - this.push('YGNodeStyleSetFlexBasis' + toFunctionName(value) + '(' + nodeName + ', ' + toValueCpp(value) + ');'); - }}, - - YGNodeStyleSetFlexDirection:{value:function(nodeName, value) { - this.push('YGNodeStyleSetFlexDirection(' + nodeName + ', ' + toValueCpp(value) + ');'); - }}, - - YGNodeStyleSetFlexGrow:{value:function(nodeName, value) { - this.push('YGNodeStyleSetFlexGrow(' + nodeName + ', ' + toValueCpp(value) + ');'); - }}, - - YGNodeStyleSetFlexShrink:{value:function(nodeName, value) { - this.push('YGNodeStyleSetFlexShrink(' + nodeName + ', ' + toValueCpp(value) + ');'); - }}, - - YGNodeStyleSetFlexWrap:{value:function(nodeName, value) { - this.push('YGNodeStyleSetFlexWrap(' + nodeName + ', ' + toValueCpp(value) + ');'); - }}, - - YGNodeStyleSetHeight:{value:function(nodeName, value) { - this.push('YGNodeStyleSetHeight' + toFunctionName(value) + '(' + nodeName + ', ' + toValueCpp(value) + ');'); - }}, - - YGNodeStyleSetJustifyContent:{value:function(nodeName, value) { - this.push('YGNodeStyleSetJustifyContent(' + nodeName + ', ' + toValueCpp(value) + ');'); - }}, + }, + }, + + emitTestTreePrologue: { + value: function (nodeName) { + this.push( + 'const YGNodeRef ' + nodeName + ' = YGNodeNewWithConfig(config);', + ); + }, + }, - YGNodeStyleSetMargin:{value:function(nodeName, edge, value) { - var valueStr = toValueCpp(value); - if (valueStr != 'YGAuto') { - valueStr = ', ' + valueStr; - } else { - valueStr = ''; - } - this.push('YGNodeStyleSetMargin' + toFunctionName(value) + '(' + nodeName + ', ' + edge + valueStr + ');'); - }}, + emitTestEpilogue: { + value: function (_experiments) { + this.push(['', 'YGNodeFreeRecursive(root);']); - YGNodeStyleSetMaxHeight:{value:function(nodeName, value) { - this.push('YGNodeStyleSetMaxHeight' + toFunctionName(value) + '(' + nodeName + ', ' + toValueCpp(value) + ');'); - }}, - - YGNodeStyleSetMaxWidth:{value:function(nodeName, value) { - this.push('YGNodeStyleSetMaxWidth' + toFunctionName(value) + '(' + nodeName + ', ' + toValueCpp(value) + ');'); - }}, - - YGNodeStyleSetMinHeight:{value:function(nodeName, value) { - this.push('YGNodeStyleSetMinHeight' + toFunctionName(value) + '(' + nodeName + ', ' + toValueCpp(value) + ');'); - }}, - - YGNodeStyleSetMinWidth:{value:function(nodeName, value) { - this.push('YGNodeStyleSetMinWidth' + toFunctionName(value) + '(' + nodeName + ', ' + toValueCpp(value) + ');'); - }}, - - YGNodeStyleSetOverflow:{value:function(nodeName, value) { - this.push('YGNodeStyleSetOverflow(' + nodeName + ', ' + toValueCpp(value) + ');'); - }}, - - YGNodeStyleSetPadding:{value:function(nodeName, edge, value) { - this.push('YGNodeStyleSetPadding' + toFunctionName(value) + '(' + nodeName + ', ' + edge + ', ' + toValueCpp(value) + ');'); - }}, - - YGNodeStyleSetPosition:{value:function(nodeName, edge, value) { - this.push('YGNodeStyleSetPosition' + toFunctionName(value) + '(' + nodeName + ', ' + edge + ', ' + toValueCpp(value) + ');'); - }}, - - YGNodeStyleSetPositionType:{value:function(nodeName, value) { - this.push('YGNodeStyleSetPositionType(' + nodeName + ', ' + toValueCpp(value) + ');'); - }}, - - YGNodeStyleSetWidth:{value:function(nodeName, value) { - this.push('YGNodeStyleSetWidth' + toFunctionName(value) + '(' + nodeName + ', ' + toValueCpp(value) + ');'); - }}, - - YGNodeStyleSetGap:{value:function(nodeName, gap, value) { - this.push('YGNodeStyleSetGap' + toFunctionName(value) + '(' + nodeName + ', ' + gap + ', ' + toValueCpp(value) + ');'); - }}, + this.push(''); + this.push('YGConfigFree(config);'); + + this.popIndent(); + this.push(['}', '']); + }, + }, + + emitEpilogue: {value: function () {}}, + + AssertEQ: { + value: function (v0, v1) { + this.push('ASSERT_FLOAT_EQ(' + toValueCpp(v0) + ', ' + v1 + ');'); + }, + }, + + YGAlignAuto: {value: 'YGAlignAuto'}, + YGAlignCenter: {value: 'YGAlignCenter'}, + YGAlignFlexEnd: {value: 'YGAlignFlexEnd'}, + YGAlignFlexStart: {value: 'YGAlignFlexStart'}, + YGAlignStretch: {value: 'YGAlignStretch'}, + YGAlignSpaceBetween: {value: 'YGAlignSpaceBetween'}, + YGAlignSpaceAround: {value: 'YGAlignSpaceAround'}, + YGAlignBaseline: {value: 'YGAlignBaseline'}, + + YGDirectionInherit: {value: 'YGDirectionInherit'}, + YGDirectionLTR: {value: 'YGDirectionLTR'}, + YGDirectionRTL: {value: 'YGDirectionRTL'}, + + YGEdgeBottom: {value: 'YGEdgeBottom'}, + YGEdgeEnd: {value: 'YGEdgeEnd'}, + YGEdgeLeft: {value: 'YGEdgeLeft'}, + YGEdgeRight: {value: 'YGEdgeRight'}, + YGEdgeStart: {value: 'YGEdgeStart'}, + YGEdgeTop: {value: 'YGEdgeTop'}, + + YGGutterAll: {value: 'YGGutterAll'}, + YGGutterColumn: {value: 'YGGutterColumn'}, + YGGutterRow: {value: 'YGGutterRow'}, + + YGFlexDirectionColumn: {value: 'YGFlexDirectionColumn'}, + YGFlexDirectionColumnReverse: {value: 'YGFlexDirectionColumnReverse'}, + YGFlexDirectionRow: {value: 'YGFlexDirectionRow'}, + YGFlexDirectionRowReverse: {value: 'YGFlexDirectionRowReverse'}, + + YGJustifyCenter: {value: 'YGJustifyCenter'}, + YGJustifyFlexEnd: {value: 'YGJustifyFlexEnd'}, + YGJustifyFlexStart: {value: 'YGJustifyFlexStart'}, + YGJustifySpaceAround: {value: 'YGJustifySpaceAround'}, + YGJustifySpaceBetween: {value: 'YGJustifySpaceBetween'}, + YGJustifySpaceEvenly: {value: 'YGJustifySpaceEvenly'}, + + YGOverflowHidden: {value: 'YGOverflowHidden'}, + YGOverflowVisible: {value: 'YGOverflowVisible'}, + + YGPositionTypeAbsolute: {value: 'YGPositionTypeAbsolute'}, + YGPositionTypeRelative: {value: 'YGPositionTypeRelative'}, + + YGWrapNoWrap: {value: 'YGWrapNoWrap'}, + YGWrapWrap: {value: 'YGWrapWrap'}, + YGWrapWrapReverse: {value: 'YGWrapWrapReverse'}, + + YGUndefined: {value: 'YGUndefined'}, + + YGDisplayFlex: {value: 'YGDisplayFlex'}, + YGDisplayNone: {value: 'YGDisplayNone'}, + YGAuto: {value: 'YGAuto'}, + + YGNodeCalculateLayout: { + value: function (node, dir, _experiments) { + this.push( + 'YGNodeCalculateLayout(' + + node + + ', YGUndefined, YGUndefined, ' + + dir + + ');', + ); + }, + }, + + YGNodeInsertChild: { + value: function (parentName, nodeName, index) { + this.push( + 'YGNodeInsertChild(' + + parentName + + ', ' + + nodeName + + ', ' + + index + + ');', + ); + }, + }, + + YGNodeLayoutGetLeft: { + value: function (nodeName) { + return 'YGNodeLayoutGetLeft(' + nodeName + ')'; + }, + }, + + YGNodeLayoutGetTop: { + value: function (nodeName) { + return 'YGNodeLayoutGetTop(' + nodeName + ')'; + }, + }, + + YGNodeLayoutGetWidth: { + value: function (nodeName) { + return 'YGNodeLayoutGetWidth(' + nodeName + ')'; + }, + }, + + YGNodeLayoutGetHeight: { + value: function (nodeName) { + return 'YGNodeLayoutGetHeight(' + nodeName + ')'; + }, + }, + + YGNodeStyleSetAlignContent: { + value: function (nodeName, value) { + this.push( + 'YGNodeStyleSetAlignContent(' + + nodeName + + ', ' + + toValueCpp(value) + + ');', + ); + }, + }, + + YGNodeStyleSetAlignItems: { + value: function (nodeName, value) { + this.push( + 'YGNodeStyleSetAlignItems(' + + nodeName + + ', ' + + toValueCpp(value) + + ');', + ); + }, + }, + + YGNodeStyleSetAlignSelf: { + value: function (nodeName, value) { + this.push( + 'YGNodeStyleSetAlignSelf(' + nodeName + ', ' + toValueCpp(value) + ');', + ); + }, + }, + + YGNodeStyleSetBorder: { + value: function (nodeName, edge, value) { + this.push( + 'YGNodeStyleSetBorder(' + + nodeName + + ', ' + + edge + + ', ' + + toValueCpp(value) + + ');', + ); + }, + }, + + YGNodeStyleSetDirection: { + value: function (nodeName, value) { + this.push( + 'YGNodeStyleSetDirection(' + nodeName + ', ' + toValueCpp(value) + ');', + ); + }, + }, + + YGNodeStyleSetDisplay: { + value: function (nodeName, value) { + this.push( + 'YGNodeStyleSetDisplay(' + nodeName + ', ' + toValueCpp(value) + ');', + ); + }, + }, + + YGNodeStyleSetFlexBasis: { + value: function (nodeName, value) { + this.push( + 'YGNodeStyleSetFlexBasis' + + toFunctionName(value) + + '(' + + nodeName + + ', ' + + toValueCpp(value) + + ');', + ); + }, + }, + + YGNodeStyleSetFlexDirection: { + value: function (nodeName, value) { + this.push( + 'YGNodeStyleSetFlexDirection(' + + nodeName + + ', ' + + toValueCpp(value) + + ');', + ); + }, + }, + + YGNodeStyleSetFlexGrow: { + value: function (nodeName, value) { + this.push( + 'YGNodeStyleSetFlexGrow(' + nodeName + ', ' + toValueCpp(value) + ');', + ); + }, + }, + + YGNodeStyleSetFlexShrink: { + value: function (nodeName, value) { + this.push( + 'YGNodeStyleSetFlexShrink(' + + nodeName + + ', ' + + toValueCpp(value) + + ');', + ); + }, + }, + + YGNodeStyleSetFlexWrap: { + value: function (nodeName, value) { + this.push( + 'YGNodeStyleSetFlexWrap(' + nodeName + ', ' + toValueCpp(value) + ');', + ); + }, + }, + + YGNodeStyleSetHeight: { + value: function (nodeName, value) { + this.push( + 'YGNodeStyleSetHeight' + + toFunctionName(value) + + '(' + + nodeName + + ', ' + + toValueCpp(value) + + ');', + ); + }, + }, + + YGNodeStyleSetJustifyContent: { + value: function (nodeName, value) { + this.push( + 'YGNodeStyleSetJustifyContent(' + + nodeName + + ', ' + + toValueCpp(value) + + ');', + ); + }, + }, + + YGNodeStyleSetMargin: { + value: function (nodeName, edge, value) { + let valueStr = toValueCpp(value); + if (valueStr != 'YGAuto') { + valueStr = ', ' + valueStr; + } else { + valueStr = ''; + } + this.push( + 'YGNodeStyleSetMargin' + + toFunctionName(value) + + '(' + + nodeName + + ', ' + + edge + + valueStr + + ');', + ); + }, + }, + + YGNodeStyleSetMaxHeight: { + value: function (nodeName, value) { + this.push( + 'YGNodeStyleSetMaxHeight' + + toFunctionName(value) + + '(' + + nodeName + + ', ' + + toValueCpp(value) + + ');', + ); + }, + }, + + YGNodeStyleSetMaxWidth: { + value: function (nodeName, value) { + this.push( + 'YGNodeStyleSetMaxWidth' + + toFunctionName(value) + + '(' + + nodeName + + ', ' + + toValueCpp(value) + + ');', + ); + }, + }, + + YGNodeStyleSetMinHeight: { + value: function (nodeName, value) { + this.push( + 'YGNodeStyleSetMinHeight' + + toFunctionName(value) + + '(' + + nodeName + + ', ' + + toValueCpp(value) + + ');', + ); + }, + }, + + YGNodeStyleSetMinWidth: { + value: function (nodeName, value) { + this.push( + 'YGNodeStyleSetMinWidth' + + toFunctionName(value) + + '(' + + nodeName + + ', ' + + toValueCpp(value) + + ');', + ); + }, + }, + + YGNodeStyleSetOverflow: { + value: function (nodeName, value) { + this.push( + 'YGNodeStyleSetOverflow(' + nodeName + ', ' + toValueCpp(value) + ');', + ); + }, + }, + + YGNodeStyleSetPadding: { + value: function (nodeName, edge, value) { + this.push( + 'YGNodeStyleSetPadding' + + toFunctionName(value) + + '(' + + nodeName + + ', ' + + edge + + ', ' + + toValueCpp(value) + + ');', + ); + }, + }, + + YGNodeStyleSetPosition: { + value: function (nodeName, edge, value) { + this.push( + 'YGNodeStyleSetPosition' + + toFunctionName(value) + + '(' + + nodeName + + ', ' + + edge + + ', ' + + toValueCpp(value) + + ');', + ); + }, + }, + + YGNodeStyleSetPositionType: { + value: function (nodeName, value) { + this.push( + 'YGNodeStyleSetPositionType(' + + nodeName + + ', ' + + toValueCpp(value) + + ');', + ); + }, + }, + + YGNodeStyleSetWidth: { + value: function (nodeName, value) { + this.push( + 'YGNodeStyleSetWidth' + + toFunctionName(value) + + '(' + + nodeName + + ', ' + + toValueCpp(value) + + ');', + ); + }, + }, + + YGNodeStyleSetGap: { + value: function (nodeName, gap, value) { + this.push( + 'YGNodeStyleSetGap' + + toFunctionName(value) + + '(' + + nodeName + + ', ' + + gap + + ', ' + + toValueCpp(value) + + ');', + ); + }, + }, }); diff --git a/gentest/gentest-java.js b/gentest/gentest-java.js index b36fa1ce82..096e83c76d 100644 --- a/gentest/gentest-java.js +++ b/gentest/gentest-java.js @@ -5,29 +5,35 @@ * LICENSE file in the root directory of this source tree. */ +/* global Emitter:readable */ + function toValueJava(value) { - var n = value.toString().replace('px','').replace('%',''); + const n = value.toString().replace('px', '').replace('%', ''); return n + (Number(n) == n && n % 1 !== 0 ? '' : ''); } function toMethodName(value) { - if (value.indexOf('%') >= 0){ + if (value.indexOf('%') >= 0) { return 'Percent'; - } else if(value.indexOf('AUTO') >= 0) { + } else if (value.indexOf('AUTO') >= 0) { return 'Auto'; } return ''; } -var JavaEmitter = function() { +const JavaEmitter = function () { Emitter.call(this, 'java', ' '); }; function toJavaUpper(symbol) { - var out = ''; - for (var i = 0; i < symbol.length; i++) { - var c = symbol[i]; - if (c == c.toUpperCase() && i != 0 && symbol[i - 1] != symbol[i - 1].toUpperCase()) { + let out = ''; + for (let i = 0; i < symbol.length; i++) { + const c = symbol[i]; + if ( + c == c.toUpperCase() && + i != 0 && + symbol[i - 1] != symbol[i - 1].toUpperCase() + ) { out += '_'; } out += c.toUpperCase(); @@ -36,260 +42,418 @@ function toJavaUpper(symbol) { } JavaEmitter.prototype = Object.create(Emitter.prototype, { - constructor:{value:JavaEmitter}, - - emitPrologue:{value:function() { - this.push([ - 'package com.facebook.yoga;', - '', - 'import static org.junit.Assert.assertEquals;', - '', - 'import org.junit.Ignore;', - 'import org.junit.Test;', - 'import org.junit.runner.RunWith;', - 'import org.junit.runners.Parameterized;', - '', - '@RunWith(Parameterized.class)', - 'public class YogaTest {', - ]); - this.pushIndent(); - this.push([ - '@Parameterized.Parameters(name = "{0}")', - 'public static Iterable nodeFactories() {', - ]); - this.pushIndent(); - this.push('return TestParametrization.nodeFactories();'); - this.popIndent(); - this.push('}'); - this.push([ - '', - '@Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory;', - '', - ]); - }}, - - emitTestPrologue:{value:function(name, experiments, disabled) { - this.push('@Test'); - if (disabled) { - this.push('@Ignore'); - } - this.push('public void test_' + name + '() {'); - this.pushIndent(); - - this.push("YogaConfig config = YogaConfigFactory.create();") - for (var i in experiments) { - this.push('config.setExperimentalFeatureEnabled(YogaExperimentalFeature.' + toJavaUpper(experiments[i]) +', true);'); - } - this.push(''); - }}, - - emitTestTreePrologue:{value:function(nodeName) { - this.push('final YogaNode ' + nodeName + ' = createNode(config);'); - }}, - - emitTestEpilogue:{value:function(experiments) { - this.popIndent(); - this.push([ - '}', - '', - ]); - }}, - - emitEpilogue:{value:function(lines) { - this.push('private YogaNode createNode(YogaConfig config) {'); - this.pushIndent(); - this.push('return mNodeFactory.create(config);'); - this.popIndent(); - this.push('}'); - this.popIndent(); - this.push([ - '}', - '', - ]); - }}, - - AssertEQ:{value:function(v0, v1) { - this.push('assertEquals(' + v0 + 'f, ' + v1 + ', 0.0f);'); - }}, - - YGAlignAuto:{value:'YogaAlign.AUTO'}, - YGAlignCenter:{value:'YogaAlign.CENTER'}, - YGAlignFlexEnd:{value:'YogaAlign.FLEX_END'}, - YGAlignFlexStart:{value:'YogaAlign.FLEX_START'}, - YGAlignStretch:{value:'YogaAlign.STRETCH'}, - YGAlignSpaceBetween:{value:'YogaAlign.SPACE_BETWEEN'}, - YGAlignSpaceAround:{value:'YogaAlign.SPACE_AROUND'}, - YGAlignBaseline:{value:'YogaAlign.BASELINE'}, - - YGDirectionInherit:{value:'YogaDirection.INHERIT'}, - YGDirectionLTR:{value:'YogaDirection.LTR'}, - YGDirectionRTL:{value:'YogaDirection.RTL'}, - - YGEdgeBottom:{value:'YogaEdge.BOTTOM'}, - YGEdgeEnd:{value:'YogaEdge.END'}, - YGEdgeLeft:{value:'YogaEdge.LEFT'}, - YGEdgeRight:{value:'YogaEdge.RIGHT'}, - YGEdgeStart:{value:'YogaEdge.START'}, - YGEdgeTop:{value:'YogaEdge.TOP'}, - - YGGutterAll:{value:'YogaGutter.ALL'}, - YGGutterColumn:{value:'YogaGutter.COLUMN'}, - YGGutterRow:{value:'YogaGutter.ROW'}, - - YGFlexDirectionColumn:{value:'YogaFlexDirection.COLUMN'}, - YGFlexDirectionColumnReverse:{value:'YogaFlexDirection.COLUMN_REVERSE'}, - YGFlexDirectionRow:{value:'YogaFlexDirection.ROW'}, - YGFlexDirectionRowReverse:{value:'YogaFlexDirection.ROW_REVERSE'}, - - YGJustifyCenter:{value:'YogaJustify.CENTER'}, - YGJustifyFlexEnd:{value:'YogaJustify.FLEX_END'}, - YGJustifyFlexStart:{value:'YogaJustify.FLEX_START'}, - YGJustifySpaceAround:{value:'YogaJustify.SPACE_AROUND'}, - YGJustifySpaceBetween:{value:'YogaJustify.SPACE_BETWEEN'}, - YGJustifySpaceEvenly:{value:'YogaJustify.SPACE_EVENLY'}, - - YGOverflowHidden:{value:'YogaOverflow.HIDDEN'}, - YGOverflowVisible:{value:'YogaOverflow.VISIBLE'}, - - YGPositionTypeAbsolute:{value:'YogaPositionType.ABSOLUTE'}, - YGPositionTypeRelative:{value:'YogaPositionType.RELATIVE'}, - - YGUndefined:{value:'YogaConstants.UNDEFINED'}, - - YGDisplayFlex:{value:'YogaDisplay.FLEX'}, - YGDisplayNone:{value:'YogaDisplay.NONE'}, - YGAuto:{value:'YogaConstants.AUTO'}, - - - YGWrapNoWrap:{value:'YogaWrap.NO_WRAP'}, - YGWrapWrap:{value:'YogaWrap.WRAP'}, - YGWrapWrapReverse:{value: 'YogaWrap.WRAP_REVERSE'}, - - YGNodeCalculateLayout:{value:function(node, dir, experiments) { - this.push(node + '.setDirection(' + dir + ');'); - this.push(node + '.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);'); - }}, - - YGNodeInsertChild:{value:function(parentName, nodeName, index) { - this.push(parentName + '.addChildAt(' + nodeName + ', ' + index + ');'); - }}, - - YGNodeLayoutGetLeft:{value:function(nodeName) { - return nodeName + '.getLayoutX()'; - }}, - - YGNodeLayoutGetTop:{value:function(nodeName) { - return nodeName + '.getLayoutY()'; - }}, - - YGNodeLayoutGetWidth:{value:function(nodeName) { - return nodeName + '.getLayoutWidth()'; - }}, - - YGNodeLayoutGetHeight:{value:function(nodeName) { - return nodeName + '.getLayoutHeight()'; - }}, - - YGNodeStyleSetAlignContent:{value:function(nodeName, value) { - this.push(nodeName + '.setAlignContent(' + toValueJava(value) + ');'); - }}, - - YGNodeStyleSetAlignItems:{value:function(nodeName, value) { - this.push(nodeName + '.setAlignItems(' + toValueJava(value) + ');'); - }}, - - YGNodeStyleSetAlignSelf:{value:function(nodeName, value) { - this.push(nodeName + '.setAlignSelf(' + toValueJava(value) + ');'); - }}, - - YGNodeStyleSetBorder:{value:function(nodeName, edge, value) { - this.push(nodeName + '.setBorder(' + edge + ', ' + toValueJava(value) + 'f);'); - }}, - - YGNodeStyleSetDirection:{value:function(nodeName, value) { - this.push(nodeName + '.setDirection(' + toValueJava(value) + ');'); - }}, - - YGNodeStyleSetDisplay:{value:function(nodeName, value) { - this.push(nodeName + '.setDisplay(' + toValueJava(value) + ');'); - }}, - - YGNodeStyleSetFlexBasis:{value:function(nodeName, value) { - this.push(nodeName + '.setFlexBasis' + toMethodName(value) + '(' + toValueJava(value) + 'f);'); - }}, - - YGNodeStyleSetFlexDirection:{value:function(nodeName, value) { - this.push(nodeName + '.setFlexDirection(' + toValueJava(value) + ');'); - }}, - - YGNodeStyleSetFlexGrow:{value:function(nodeName, value) { - this.push(nodeName + '.setFlexGrow(' + toValueJava(value) + 'f);'); - }}, - - YGNodeStyleSetFlexShrink:{value:function(nodeName, value) { - this.push(nodeName + '.setFlexShrink(' + toValueJava(value) + 'f);'); - }}, - - YGNodeStyleSetFlexWrap:{value:function(nodeName, value) { - this.push(nodeName + '.setWrap(' + toValueJava(value) + ');'); - }}, - - YGNodeStyleSetHeight:{value:function(nodeName, value) { - this.push(nodeName + '.setHeight' + toMethodName(value) + '(' + toValueJava(value) + 'f);'); - }}, - - YGNodeStyleSetJustifyContent:{value:function(nodeName, value) { - this.push(nodeName + '.setJustifyContent(' + toValueJava(value) + ');'); - }}, - - YGNodeStyleSetMargin:{value:function(nodeName, edge, value) { - var valueStr = toValueJava(value); - if (valueStr != 'YogaConstants.AUTO') { - valueStr = ', ' + valueStr + 'f'; - } else { - valueStr = ''; - } - - this.push(nodeName + '.setMargin' + toMethodName(value) + '(' + edge + valueStr + ');'); - }}, - - YGNodeStyleSetMaxHeight:{value:function(nodeName, value) { - this.push(nodeName + '.setMaxHeight' + toMethodName(value) + '(' + toValueJava(value) + 'f);'); - }}, - - YGNodeStyleSetMaxWidth:{value:function(nodeName, value) { - this.push(nodeName + '.setMaxWidth' + toMethodName(value) + '(' + toValueJava(value) + 'f);'); - }}, - - YGNodeStyleSetMinHeight:{value:function(nodeName, value) { - this.push(nodeName + '.setMinHeight' + toMethodName(value) + '(' + toValueJava(value) + 'f);'); - }}, - - YGNodeStyleSetMinWidth:{value:function(nodeName, value) { - this.push(nodeName + '.setMinWidth' + toMethodName(value) + '(' + toValueJava(value) + 'f);'); - }}, - - YGNodeStyleSetOverflow:{value:function(nodeName, value) { - this.push(nodeName + '.setOverflow(' + toValueJava(value) + ');'); - }}, - - YGNodeStyleSetPadding:{value:function(nodeName, edge, value) { - this.push(nodeName + '.setPadding' + toMethodName(value) + '(' + edge + ', ' + toValueJava(value) + ');'); - }}, - - YGNodeStyleSetPosition:{value:function(nodeName, edge, value) { - this.push(nodeName + '.setPosition' + toMethodName(value) + '(' + edge + ', ' + toValueJava(value) + 'f);'); - }}, - - YGNodeStyleSetPositionType:{value:function(nodeName, value) { - this.push(nodeName + '.setPositionType(' + toValueJava(value) + ');'); - }}, - - YGNodeStyleSetWidth:{value:function(nodeName, value) { - this.push(nodeName + '.setWidth' + toMethodName(value) + '(' + toValueJava(value) + 'f);'); - }}, - - YGNodeStyleSetGap:{value:function(nodeName, gap, value) { - this.push(nodeName + '.setGap' + toMethodName(value) + '(' + gap + ', ' + toValueJava(value) + 'f);'); - }}, + constructor: {value: JavaEmitter}, + + emitPrologue: { + value: function () { + this.push([ + 'package com.facebook.yoga;', + '', + 'import static org.junit.Assert.assertEquals;', + '', + 'import org.junit.Ignore;', + 'import org.junit.Test;', + 'import org.junit.runner.RunWith;', + 'import org.junit.runners.Parameterized;', + '', + '@RunWith(Parameterized.class)', + 'public class YogaTest {', + ]); + this.pushIndent(); + this.push([ + '@Parameterized.Parameters(name = "{0}")', + 'public static Iterable nodeFactories() {', + ]); + this.pushIndent(); + this.push('return TestParametrization.nodeFactories();'); + this.popIndent(); + this.push('}'); + this.push([ + '', + '@Parameterized.Parameter public TestParametrization.NodeFactory mNodeFactory;', + '', + ]); + }, + }, + + emitTestPrologue: { + value: function (name, experiments, disabled) { + this.push('@Test'); + if (disabled) { + this.push('@Ignore'); + } + this.push('public void test_' + name + '() {'); + this.pushIndent(); + + this.push('YogaConfig config = YogaConfigFactory.create();'); + for (const i in experiments) { + this.push( + 'config.setExperimentalFeatureEnabled(YogaExperimentalFeature.' + + toJavaUpper(experiments[i]) + + ', true);', + ); + } + this.push(''); + }, + }, + + emitTestTreePrologue: { + value: function (nodeName) { + this.push('final YogaNode ' + nodeName + ' = createNode(config);'); + }, + }, + + emitTestEpilogue: { + value: function (_experiments) { + this.popIndent(); + this.push(['}', '']); + }, + }, + + emitEpilogue: { + value: function (_lines) { + this.push('private YogaNode createNode(YogaConfig config) {'); + this.pushIndent(); + this.push('return mNodeFactory.create(config);'); + this.popIndent(); + this.push('}'); + this.popIndent(); + this.push(['}', '']); + }, + }, + + AssertEQ: { + value: function (v0, v1) { + this.push('assertEquals(' + v0 + 'f, ' + v1 + ', 0.0f);'); + }, + }, + + YGAlignAuto: {value: 'YogaAlign.AUTO'}, + YGAlignCenter: {value: 'YogaAlign.CENTER'}, + YGAlignFlexEnd: {value: 'YogaAlign.FLEX_END'}, + YGAlignFlexStart: {value: 'YogaAlign.FLEX_START'}, + YGAlignStretch: {value: 'YogaAlign.STRETCH'}, + YGAlignSpaceBetween: {value: 'YogaAlign.SPACE_BETWEEN'}, + YGAlignSpaceAround: {value: 'YogaAlign.SPACE_AROUND'}, + YGAlignBaseline: {value: 'YogaAlign.BASELINE'}, + + YGDirectionInherit: {value: 'YogaDirection.INHERIT'}, + YGDirectionLTR: {value: 'YogaDirection.LTR'}, + YGDirectionRTL: {value: 'YogaDirection.RTL'}, + + YGEdgeBottom: {value: 'YogaEdge.BOTTOM'}, + YGEdgeEnd: {value: 'YogaEdge.END'}, + YGEdgeLeft: {value: 'YogaEdge.LEFT'}, + YGEdgeRight: {value: 'YogaEdge.RIGHT'}, + YGEdgeStart: {value: 'YogaEdge.START'}, + YGEdgeTop: {value: 'YogaEdge.TOP'}, + + YGGutterAll: {value: 'YogaGutter.ALL'}, + YGGutterColumn: {value: 'YogaGutter.COLUMN'}, + YGGutterRow: {value: 'YogaGutter.ROW'}, + + YGFlexDirectionColumn: {value: 'YogaFlexDirection.COLUMN'}, + YGFlexDirectionColumnReverse: {value: 'YogaFlexDirection.COLUMN_REVERSE'}, + YGFlexDirectionRow: {value: 'YogaFlexDirection.ROW'}, + YGFlexDirectionRowReverse: {value: 'YogaFlexDirection.ROW_REVERSE'}, + + YGJustifyCenter: {value: 'YogaJustify.CENTER'}, + YGJustifyFlexEnd: {value: 'YogaJustify.FLEX_END'}, + YGJustifyFlexStart: {value: 'YogaJustify.FLEX_START'}, + YGJustifySpaceAround: {value: 'YogaJustify.SPACE_AROUND'}, + YGJustifySpaceBetween: {value: 'YogaJustify.SPACE_BETWEEN'}, + YGJustifySpaceEvenly: {value: 'YogaJustify.SPACE_EVENLY'}, + + YGOverflowHidden: {value: 'YogaOverflow.HIDDEN'}, + YGOverflowVisible: {value: 'YogaOverflow.VISIBLE'}, + + YGPositionTypeAbsolute: {value: 'YogaPositionType.ABSOLUTE'}, + YGPositionTypeRelative: {value: 'YogaPositionType.RELATIVE'}, + + YGUndefined: {value: 'YogaConstants.UNDEFINED'}, + + YGDisplayFlex: {value: 'YogaDisplay.FLEX'}, + YGDisplayNone: {value: 'YogaDisplay.NONE'}, + YGAuto: {value: 'YogaConstants.AUTO'}, + + YGWrapNoWrap: {value: 'YogaWrap.NO_WRAP'}, + YGWrapWrap: {value: 'YogaWrap.WRAP'}, + YGWrapWrapReverse: {value: 'YogaWrap.WRAP_REVERSE'}, + + YGNodeCalculateLayout: { + value: function (node, dir, _experiments) { + this.push(node + '.setDirection(' + dir + ');'); + this.push( + node + + '.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);', + ); + }, + }, + + YGNodeInsertChild: { + value: function (parentName, nodeName, index) { + this.push(parentName + '.addChildAt(' + nodeName + ', ' + index + ');'); + }, + }, + + YGNodeLayoutGetLeft: { + value: function (nodeName) { + return nodeName + '.getLayoutX()'; + }, + }, + + YGNodeLayoutGetTop: { + value: function (nodeName) { + return nodeName + '.getLayoutY()'; + }, + }, + + YGNodeLayoutGetWidth: { + value: function (nodeName) { + return nodeName + '.getLayoutWidth()'; + }, + }, + + YGNodeLayoutGetHeight: { + value: function (nodeName) { + return nodeName + '.getLayoutHeight()'; + }, + }, + + YGNodeStyleSetAlignContent: { + value: function (nodeName, value) { + this.push(nodeName + '.setAlignContent(' + toValueJava(value) + ');'); + }, + }, + + YGNodeStyleSetAlignItems: { + value: function (nodeName, value) { + this.push(nodeName + '.setAlignItems(' + toValueJava(value) + ');'); + }, + }, + + YGNodeStyleSetAlignSelf: { + value: function (nodeName, value) { + this.push(nodeName + '.setAlignSelf(' + toValueJava(value) + ');'); + }, + }, + + YGNodeStyleSetBorder: { + value: function (nodeName, edge, value) { + this.push( + nodeName + '.setBorder(' + edge + ', ' + toValueJava(value) + 'f);', + ); + }, + }, + + YGNodeStyleSetDirection: { + value: function (nodeName, value) { + this.push(nodeName + '.setDirection(' + toValueJava(value) + ');'); + }, + }, + + YGNodeStyleSetDisplay: { + value: function (nodeName, value) { + this.push(nodeName + '.setDisplay(' + toValueJava(value) + ');'); + }, + }, + + YGNodeStyleSetFlexBasis: { + value: function (nodeName, value) { + this.push( + nodeName + + '.setFlexBasis' + + toMethodName(value) + + '(' + + toValueJava(value) + + 'f);', + ); + }, + }, + + YGNodeStyleSetFlexDirection: { + value: function (nodeName, value) { + this.push(nodeName + '.setFlexDirection(' + toValueJava(value) + ');'); + }, + }, + + YGNodeStyleSetFlexGrow: { + value: function (nodeName, value) { + this.push(nodeName + '.setFlexGrow(' + toValueJava(value) + 'f);'); + }, + }, + + YGNodeStyleSetFlexShrink: { + value: function (nodeName, value) { + this.push(nodeName + '.setFlexShrink(' + toValueJava(value) + 'f);'); + }, + }, + + YGNodeStyleSetFlexWrap: { + value: function (nodeName, value) { + this.push(nodeName + '.setWrap(' + toValueJava(value) + ');'); + }, + }, + + YGNodeStyleSetHeight: { + value: function (nodeName, value) { + this.push( + nodeName + + '.setHeight' + + toMethodName(value) + + '(' + + toValueJava(value) + + 'f);', + ); + }, + }, + + YGNodeStyleSetJustifyContent: { + value: function (nodeName, value) { + this.push(nodeName + '.setJustifyContent(' + toValueJava(value) + ');'); + }, + }, + + YGNodeStyleSetMargin: { + value: function (nodeName, edge, value) { + let valueStr = toValueJava(value); + if (valueStr != 'YogaConstants.AUTO') { + valueStr = ', ' + valueStr + 'f'; + } else { + valueStr = ''; + } + + this.push( + nodeName + + '.setMargin' + + toMethodName(value) + + '(' + + edge + + valueStr + + ');', + ); + }, + }, + + YGNodeStyleSetMaxHeight: { + value: function (nodeName, value) { + this.push( + nodeName + + '.setMaxHeight' + + toMethodName(value) + + '(' + + toValueJava(value) + + 'f);', + ); + }, + }, + + YGNodeStyleSetMaxWidth: { + value: function (nodeName, value) { + this.push( + nodeName + + '.setMaxWidth' + + toMethodName(value) + + '(' + + toValueJava(value) + + 'f);', + ); + }, + }, + + YGNodeStyleSetMinHeight: { + value: function (nodeName, value) { + this.push( + nodeName + + '.setMinHeight' + + toMethodName(value) + + '(' + + toValueJava(value) + + 'f);', + ); + }, + }, + + YGNodeStyleSetMinWidth: { + value: function (nodeName, value) { + this.push( + nodeName + + '.setMinWidth' + + toMethodName(value) + + '(' + + toValueJava(value) + + 'f);', + ); + }, + }, + + YGNodeStyleSetOverflow: { + value: function (nodeName, value) { + this.push(nodeName + '.setOverflow(' + toValueJava(value) + ');'); + }, + }, + + YGNodeStyleSetPadding: { + value: function (nodeName, edge, value) { + this.push( + nodeName + + '.setPadding' + + toMethodName(value) + + '(' + + edge + + ', ' + + toValueJava(value) + + ');', + ); + }, + }, + + YGNodeStyleSetPosition: { + value: function (nodeName, edge, value) { + this.push( + nodeName + + '.setPosition' + + toMethodName(value) + + '(' + + edge + + ', ' + + toValueJava(value) + + 'f);', + ); + }, + }, + + YGNodeStyleSetPositionType: { + value: function (nodeName, value) { + this.push(nodeName + '.setPositionType(' + toValueJava(value) + ');'); + }, + }, + + YGNodeStyleSetWidth: { + value: function (nodeName, value) { + this.push( + nodeName + + '.setWidth' + + toMethodName(value) + + '(' + + toValueJava(value) + + 'f);', + ); + }, + }, + + YGNodeStyleSetGap: { + value: function (nodeName, gap, value) { + this.push( + nodeName + + '.setGap' + + toMethodName(value) + + '(' + + gap + + ', ' + + toValueJava(value) + + 'f);', + ); + }, + }, }); diff --git a/gentest/gentest-javascript.js b/gentest/gentest-javascript.js index 3b16b7a817..c447583835 100644 --- a/gentest/gentest-javascript.js +++ b/gentest/gentest-javascript.js @@ -5,7 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -const JavascriptEmitter = function() { +/* global Emitter:readable */ + +const JavascriptEmitter = function () { Emitter.call(this, 'js', ' '); }; @@ -17,255 +19,372 @@ function toValueJavascript(value) { } JavascriptEmitter.prototype = Object.create(Emitter.prototype, { - constructor:{value:JavascriptEmitter}, - - emitPrologue:{value:function() { - this.push('import {Yoga} from "../tools/globals";') - this.push('import {') - this.pushIndent(); - this.push('Align,'); - this.push('Direction,'); - this.push('Display,'); - this.push('Edge,'); - this.push('Errata,'); - this.push('ExperimentalFeature,'); - this.push('FlexDirection,'); - this.push('Gutter,'); - this.push('Justify,'); - this.push('MeasureMode,'); - this.push('Overflow,'); - this.push('PositionType,'); - this.push('Unit,'); - this.push('Wrap,'); - this.popIndent(); - this.push('} from \'yoga-layout\';'); - this.push(''); - }}, - - emitTestPrologue:{value:function(name, experiments, ignore) { - const testFn = ignore ? `test.skip` : 'test'; - this.push(`${testFn}('${name}', () => {`); - this.pushIndent(); - this.push('const config = Yoga.Config.create();'); - this.push('let root;'); - this.push(''); - - if (experiments.length > 0) { - for (const experiment of experiments) { - this.push(`config.setExperimentalFeatureEnabled(ExperimentalFeature.${experiment}, true);`); - } + constructor: {value: JavascriptEmitter}, + + emitPrologue: { + value: function () { + this.push('import {Yoga} from "../tools/globals";'); + this.push('import {'); + this.pushIndent(); + this.push('Align,'); + this.push('Direction,'); + this.push('Display,'); + this.push('Edge,'); + this.push('Errata,'); + this.push('ExperimentalFeature,'); + this.push('FlexDirection,'); + this.push('Gutter,'); + this.push('Justify,'); + this.push('MeasureMode,'); + this.push('Overflow,'); + this.push('PositionType,'); + this.push('Unit,'); + this.push('Wrap,'); + this.popIndent(); + this.push("} from 'yoga-layout';"); + this.push(''); + }, + }, + + emitTestPrologue: { + value: function (name, experiments, ignore) { + const testFn = ignore ? `test.skip` : 'test'; + this.push(`${testFn}('${name}', () => {`); + this.pushIndent(); + this.push('const config = Yoga.Config.create();'); + this.push('let root;'); this.push(''); - } - - this.push('try {'); - this.pushIndent(); - }}, - - emitTestTreePrologue:{value:function(nodeName) { - if (nodeName === 'root') { - this.push(`root = Yoga.Node.create(config);`); - } else { - this.push(`const ${nodeName} = Yoga.Node.create(config);`); - } - }}, - - emitTestEpilogue:{value:function(experiments) { - this.popIndent(); - this.push('} finally {'); - this.pushIndent(); - - this.push('if (typeof root !== \'undefined\') {'); - this.pushIndent(); - this.push('root.freeRecursive();'); - this.popIndent(); - this.push('}'); - this.push(''); - this.push('config.free();'); - - this.popIndent(); - this.push('}'); - - this.popIndent(); - this.push('});'); - }}, - - emitEpilogue:{value:function () { - this.push(''); - }}, - - AssertEQ:{value:function(v0, v1) { - this.push(`expect(${v1}).toBe(${v0});`); - }}, - - YGAlignAuto:{value: 'Align.Auto'}, - YGAlignCenter:{value: 'Align.Center'}, - YGAlignFlexEnd:{value: 'Align.FlexEnd'}, - YGAlignFlexStart:{value: 'Align.FlexStart'}, - YGAlignStretch:{value: 'Align.Stretch'}, - YGAlignSpaceBetween:{value: 'Align.SpaceBetween'}, - YGAlignSpaceAround:{value: 'Align.SpaceAround'}, - YGAlignBaseline:{value: 'Align.Baseline'}, - - YGDirectionInherit:{value: 'Direction.Inherit'}, - YGDirectionLTR:{value: 'Direction.LTR'}, - YGDirectionRTL:{value: 'Direction.RTL'}, - - YGEdgeBottom:{value: 'Edge.Bottom'}, - YGEdgeEnd:{value: 'Edge.End'}, - YGEdgeLeft:{value: 'Edge.Left'}, - YGEdgeRight:{value: 'Edge.Right'}, - YGEdgeStart:{value: 'Edge.Start'}, - YGEdgeTop:{value: 'Edge.Top'}, - - YGGutterAll:{value: 'Gutter.All'}, - YGGutterColumn:{value: 'Gutter.Column'}, - YGGutterRow:{value: 'Gutter.Row'}, - - YGFlexDirectionColumn:{value: 'FlexDirection.Column'}, - YGFlexDirectionColumnReverse:{value: 'FlexDirection.ColumnReverse'}, - YGFlexDirectionRow:{value: 'FlexDirection.Row'}, - YGFlexDirectionRowReverse:{value: 'FlexDirection.RowReverse'}, - - YGJustifyCenter:{value: 'Justify.Center'}, - YGJustifyFlexEnd:{value: 'Justify.FlexEnd'}, - YGJustifyFlexStart:{value: 'Justify.FlexStart'}, - YGJustifySpaceAround:{value: 'Justify.SpaceAround'}, - YGJustifySpaceBetween:{value: 'Justify.SpaceBetween'}, - YGJustifySpaceEvenly:{value: 'Justify.SpaceEvenly'}, - - YGOverflowHidden:{value: 'Overflow.Hidden'}, - YGOverflowVisible:{value: 'Overflow.Visible'}, - - YGPositionTypeAbsolute:{value: 'PositionType.Absolute'}, - YGPositionTypeRelative:{value: 'PositionType.Relative'}, - - YGAuto:{value:'\'auto\''}, - YGUndefined:{value:'undefined'}, - - YGWrapNoWrap:{value: 'Wrap.NoWrap'}, - YGWrapWrap:{value: 'Wrap.Wrap'}, - YGWrapWrapReverse:{value: 'Wrap.WrapReverse'}, - - YGDisplayFlex:{value: 'Display.Flex'}, - YGDisplayNone:{value: 'Display.None'}, - - YGNodeCalculateLayout:{value:function(node, dir, experiments) { - this.push(node + '.calculateLayout(undefined, undefined, ' + dir + ');'); - }}, - - YGNodeInsertChild:{value:function(parentName, nodeName, index) { - this.push(parentName + '.insertChild(' + nodeName + ', ' + index + ');'); - }}, - - YGNodeLayoutGetLeft:{value:function(nodeName) { - return nodeName + '.getComputedLeft()'; - }}, - - YGNodeLayoutGetTop:{value:function(nodeName) { - return nodeName + '.getComputedTop()'; - }}, - - YGNodeLayoutGetWidth:{value:function(nodeName) { - return nodeName + '.getComputedWidth()'; - }}, - - YGNodeLayoutGetHeight:{value:function(nodeName) { - return nodeName + '.getComputedHeight()'; - }}, - - YGNodeStyleSetAlignContent:{value:function(nodeName, value) { - this.push(nodeName + '.setAlignContent(' + toValueJavascript(value) + ');'); - }}, - - YGNodeStyleSetAlignItems:{value:function(nodeName, value) { - this.push(nodeName + '.setAlignItems(' + toValueJavascript(value) + ');'); - }}, - - YGNodeStyleSetAlignSelf:{value:function(nodeName, value) { - this.push(nodeName + '.setAlignSelf(' + toValueJavascript(value) + ');'); - }}, - - YGNodeStyleSetBorder:{value:function(nodeName, edge, value) { - this.push(nodeName + '.setBorder(' + toValueJavascript(edge) + ', ' + toValueJavascript(value) + ');'); - }}, - - YGNodeStyleSetDirection:{value:function(nodeName, value) { - this.push(nodeName + '.setDirection(' + toValueJavascript(value) + ');'); - }}, - - YGNodeStyleSetDisplay:{value:function(nodeName, value) { - this.push(nodeName + '.setDisplay(' + toValueJavascript(value) + ');'); - }}, - - YGNodeStyleSetFlexBasis:{value:function(nodeName, value) { - this.push(nodeName + '.setFlexBasis(' + toValueJavascript(value) + ');'); - }}, - - YGNodeStyleSetFlexDirection:{value:function(nodeName, value) { - this.push(nodeName + '.setFlexDirection(' + toValueJavascript(value) + ');'); - }}, - - YGNodeStyleSetFlexGrow:{value:function(nodeName, value) { - this.push(nodeName + '.setFlexGrow(' + toValueJavascript(value) + ');'); - }}, - - YGNodeStyleSetFlexShrink:{value:function(nodeName, value) { - this.push(nodeName + '.setFlexShrink(' + toValueJavascript(value) + ');'); - }}, - - YGNodeStyleSetFlexWrap:{value:function(nodeName, value) { - this.push(nodeName + '.setFlexWrap(' + toValueJavascript(value) + ');'); - }}, - - YGNodeStyleSetHeight:{value:function(nodeName, value) { - this.push(nodeName + '.setHeight(' + toValueJavascript(value) + ');'); - }}, - - YGNodeStyleSetJustifyContent:{value:function(nodeName, value) { - this.push(nodeName + '.setJustifyContent(' + toValueJavascript(value) + ');'); - }}, - - YGNodeStyleSetMargin:{value:function(nodeName, edge, value) { - this.push(nodeName + '.setMargin(' + toValueJavascript(edge) + ', ' + toValueJavascript(value) + ');'); - }}, - - YGNodeStyleSetMaxHeight:{value:function(nodeName, value) { - this.push(nodeName + '.setMaxHeight(' + toValueJavascript(value) + ');'); - }}, - - YGNodeStyleSetMaxWidth:{value:function(nodeName, value) { - this.push(nodeName + '.setMaxWidth(' + toValueJavascript(value) + ');'); - }}, - - YGNodeStyleSetMinHeight:{value:function(nodeName, value) { - this.push(nodeName + '.setMinHeight(' + toValueJavascript(value) + ');'); - }}, - - YGNodeStyleSetMinWidth:{value:function(nodeName, value) { - this.push(nodeName + '.setMinWidth(' + toValueJavascript(value) + ');'); - }}, - - YGNodeStyleSetOverflow:{value:function(nodeName, value) { - this.push(nodeName + '.setOverflow(' + toValueJavascript(value) + ');'); - }}, - YGNodeStyleSetPadding:{value:function(nodeName, edge, value) { - this.push(nodeName + '.setPadding(' + toValueJavascript(edge) + ', ' + toValueJavascript(value) + ');'); - }}, + if (experiments.length > 0) { + for (const experiment of experiments) { + this.push( + `config.setExperimentalFeatureEnabled(ExperimentalFeature.${experiment}, true);`, + ); + } + this.push(''); + } - YGNodeStyleSetPosition:{value:function(nodeName, edge, value) { - this.push(nodeName + '.setPosition(' + toValueJavascript(edge) + ', ' + toValueJavascript(value) + ');'); - }}, + this.push('try {'); + this.pushIndent(); + }, + }, + + emitTestTreePrologue: { + value: function (nodeName) { + if (nodeName === 'root') { + this.push(`root = Yoga.Node.create(config);`); + } else { + this.push(`const ${nodeName} = Yoga.Node.create(config);`); + } + }, + }, + + emitTestEpilogue: { + value: function (_experiments) { + this.popIndent(); + this.push('} finally {'); + this.pushIndent(); + + this.push("if (typeof root !== 'undefined') {"); + this.pushIndent(); + this.push('root.freeRecursive();'); + this.popIndent(); + this.push('}'); + this.push(''); + this.push('config.free();'); - YGNodeStyleSetPositionType:{value:function(nodeName, value) { - this.push(nodeName + '.setPositionType(' + toValueJavascript(value) + ');'); - }}, + this.popIndent(); + this.push('}'); - YGNodeStyleSetWidth:{value:function(nodeName, value) { - this.push(nodeName + '.setWidth(' + toValueJavascript(value) + ');'); - }}, + this.popIndent(); + this.push('});'); + }, + }, - YGNodeStyleSetGap:{value:function(nodeName, gap, value) { - this.push(nodeName + '.setGap('+ toValueJavascript(gap) + ', ' + toValueJavascript(value) + ');'); - }}, + emitEpilogue: { + value: function () { + this.push(''); + }, + }, + + AssertEQ: { + value: function (v0, v1) { + this.push(`expect(${v1}).toBe(${v0});`); + }, + }, + + YGAlignAuto: {value: 'Align.Auto'}, + YGAlignCenter: {value: 'Align.Center'}, + YGAlignFlexEnd: {value: 'Align.FlexEnd'}, + YGAlignFlexStart: {value: 'Align.FlexStart'}, + YGAlignStretch: {value: 'Align.Stretch'}, + YGAlignSpaceBetween: {value: 'Align.SpaceBetween'}, + YGAlignSpaceAround: {value: 'Align.SpaceAround'}, + YGAlignBaseline: {value: 'Align.Baseline'}, + + YGDirectionInherit: {value: 'Direction.Inherit'}, + YGDirectionLTR: {value: 'Direction.LTR'}, + YGDirectionRTL: {value: 'Direction.RTL'}, + + YGEdgeBottom: {value: 'Edge.Bottom'}, + YGEdgeEnd: {value: 'Edge.End'}, + YGEdgeLeft: {value: 'Edge.Left'}, + YGEdgeRight: {value: 'Edge.Right'}, + YGEdgeStart: {value: 'Edge.Start'}, + YGEdgeTop: {value: 'Edge.Top'}, + + YGGutterAll: {value: 'Gutter.All'}, + YGGutterColumn: {value: 'Gutter.Column'}, + YGGutterRow: {value: 'Gutter.Row'}, + + YGFlexDirectionColumn: {value: 'FlexDirection.Column'}, + YGFlexDirectionColumnReverse: {value: 'FlexDirection.ColumnReverse'}, + YGFlexDirectionRow: {value: 'FlexDirection.Row'}, + YGFlexDirectionRowReverse: {value: 'FlexDirection.RowReverse'}, + + YGJustifyCenter: {value: 'Justify.Center'}, + YGJustifyFlexEnd: {value: 'Justify.FlexEnd'}, + YGJustifyFlexStart: {value: 'Justify.FlexStart'}, + YGJustifySpaceAround: {value: 'Justify.SpaceAround'}, + YGJustifySpaceBetween: {value: 'Justify.SpaceBetween'}, + YGJustifySpaceEvenly: {value: 'Justify.SpaceEvenly'}, + + YGOverflowHidden: {value: 'Overflow.Hidden'}, + YGOverflowVisible: {value: 'Overflow.Visible'}, + + YGPositionTypeAbsolute: {value: 'PositionType.Absolute'}, + YGPositionTypeRelative: {value: 'PositionType.Relative'}, + + YGAuto: {value: "'auto'"}, + YGUndefined: {value: 'undefined'}, + + YGWrapNoWrap: {value: 'Wrap.NoWrap'}, + YGWrapWrap: {value: 'Wrap.Wrap'}, + YGWrapWrapReverse: {value: 'Wrap.WrapReverse'}, + + YGDisplayFlex: {value: 'Display.Flex'}, + YGDisplayNone: {value: 'Display.None'}, + + YGNodeCalculateLayout: { + value: function (node, dir, _experiments) { + this.push(node + '.calculateLayout(undefined, undefined, ' + dir + ');'); + }, + }, + + YGNodeInsertChild: { + value: function (parentName, nodeName, index) { + this.push(parentName + '.insertChild(' + nodeName + ', ' + index + ');'); + }, + }, + + YGNodeLayoutGetLeft: { + value: function (nodeName) { + return nodeName + '.getComputedLeft()'; + }, + }, + + YGNodeLayoutGetTop: { + value: function (nodeName) { + return nodeName + '.getComputedTop()'; + }, + }, + + YGNodeLayoutGetWidth: { + value: function (nodeName) { + return nodeName + '.getComputedWidth()'; + }, + }, + + YGNodeLayoutGetHeight: { + value: function (nodeName) { + return nodeName + '.getComputedHeight()'; + }, + }, + + YGNodeStyleSetAlignContent: { + value: function (nodeName, value) { + this.push( + nodeName + '.setAlignContent(' + toValueJavascript(value) + ');', + ); + }, + }, + + YGNodeStyleSetAlignItems: { + value: function (nodeName, value) { + this.push(nodeName + '.setAlignItems(' + toValueJavascript(value) + ');'); + }, + }, + + YGNodeStyleSetAlignSelf: { + value: function (nodeName, value) { + this.push(nodeName + '.setAlignSelf(' + toValueJavascript(value) + ');'); + }, + }, + + YGNodeStyleSetBorder: { + value: function (nodeName, edge, value) { + this.push( + nodeName + + '.setBorder(' + + toValueJavascript(edge) + + ', ' + + toValueJavascript(value) + + ');', + ); + }, + }, + + YGNodeStyleSetDirection: { + value: function (nodeName, value) { + this.push(nodeName + '.setDirection(' + toValueJavascript(value) + ');'); + }, + }, + + YGNodeStyleSetDisplay: { + value: function (nodeName, value) { + this.push(nodeName + '.setDisplay(' + toValueJavascript(value) + ');'); + }, + }, + + YGNodeStyleSetFlexBasis: { + value: function (nodeName, value) { + this.push(nodeName + '.setFlexBasis(' + toValueJavascript(value) + ');'); + }, + }, + + YGNodeStyleSetFlexDirection: { + value: function (nodeName, value) { + this.push( + nodeName + '.setFlexDirection(' + toValueJavascript(value) + ');', + ); + }, + }, + + YGNodeStyleSetFlexGrow: { + value: function (nodeName, value) { + this.push(nodeName + '.setFlexGrow(' + toValueJavascript(value) + ');'); + }, + }, + + YGNodeStyleSetFlexShrink: { + value: function (nodeName, value) { + this.push(nodeName + '.setFlexShrink(' + toValueJavascript(value) + ');'); + }, + }, + + YGNodeStyleSetFlexWrap: { + value: function (nodeName, value) { + this.push(nodeName + '.setFlexWrap(' + toValueJavascript(value) + ');'); + }, + }, + + YGNodeStyleSetHeight: { + value: function (nodeName, value) { + this.push(nodeName + '.setHeight(' + toValueJavascript(value) + ');'); + }, + }, + + YGNodeStyleSetJustifyContent: { + value: function (nodeName, value) { + this.push( + nodeName + '.setJustifyContent(' + toValueJavascript(value) + ');', + ); + }, + }, + + YGNodeStyleSetMargin: { + value: function (nodeName, edge, value) { + this.push( + nodeName + + '.setMargin(' + + toValueJavascript(edge) + + ', ' + + toValueJavascript(value) + + ');', + ); + }, + }, + + YGNodeStyleSetMaxHeight: { + value: function (nodeName, value) { + this.push(nodeName + '.setMaxHeight(' + toValueJavascript(value) + ');'); + }, + }, + + YGNodeStyleSetMaxWidth: { + value: function (nodeName, value) { + this.push(nodeName + '.setMaxWidth(' + toValueJavascript(value) + ');'); + }, + }, + + YGNodeStyleSetMinHeight: { + value: function (nodeName, value) { + this.push(nodeName + '.setMinHeight(' + toValueJavascript(value) + ');'); + }, + }, + + YGNodeStyleSetMinWidth: { + value: function (nodeName, value) { + this.push(nodeName + '.setMinWidth(' + toValueJavascript(value) + ');'); + }, + }, + + YGNodeStyleSetOverflow: { + value: function (nodeName, value) { + this.push(nodeName + '.setOverflow(' + toValueJavascript(value) + ');'); + }, + }, + + YGNodeStyleSetPadding: { + value: function (nodeName, edge, value) { + this.push( + nodeName + + '.setPadding(' + + toValueJavascript(edge) + + ', ' + + toValueJavascript(value) + + ');', + ); + }, + }, + + YGNodeStyleSetPosition: { + value: function (nodeName, edge, value) { + this.push( + nodeName + + '.setPosition(' + + toValueJavascript(edge) + + ', ' + + toValueJavascript(value) + + ');', + ); + }, + }, + + YGNodeStyleSetPositionType: { + value: function (nodeName, value) { + this.push( + nodeName + '.setPositionType(' + toValueJavascript(value) + ');', + ); + }, + }, + + YGNodeStyleSetWidth: { + value: function (nodeName, value) { + this.push(nodeName + '.setWidth(' + toValueJavascript(value) + ');'); + }, + }, + + YGNodeStyleSetGap: { + value: function (nodeName, gap, value) { + this.push( + nodeName + + '.setGap(' + + toValueJavascript(gap) + + ', ' + + toValueJavascript(value) + + ');', + ); + }, + }, }); diff --git a/gentest/gentest.js b/gentest/gentest.js index f38724686e..83fd4ee254 100755 --- a/gentest/gentest.js +++ b/gentest/gentest.js @@ -5,34 +5,38 @@ * LICENSE file in the root directory of this source tree. */ -const DEFAULT_EXPERIMENTS = [ - 'AbsolutePercentageAgainstPaddingEdge', -]; +/* eslint-env browser */ +/* global CPPEmitter:readable, JavaEmitter:readable, JavascriptEmitter:readable */ -window.onload = function() { +const DEFAULT_EXPERIMENTS = ['AbsolutePercentageAgainstPaddingEdge']; + +window.onload = function () { checkDefaultValues(); printTest( - new CPPEmitter(), - 'cpp', - document.body.children[0], - document.body.children[1], - document.body.children[2]); + new CPPEmitter(), + 'cpp', + document.body.children[0], + document.body.children[1], + document.body.children[2], + ); printTest( - new JavaEmitter(), - 'java', - document.body.children[0], - document.body.children[1], - document.body.children[2]); + new JavaEmitter(), + 'java', + document.body.children[0], + document.body.children[1], + document.body.children[2], + ); printTest( - new JavascriptEmitter(), - 'js', - document.body.children[0], - document.body.children[1], - document.body.children[2]); -} + new JavascriptEmitter(), + 'js', + document.body.children[0], + document.body.children[1], + document.body.children[2], + ); +}; function assert(condition, message) { if (!condition) { @@ -49,21 +53,23 @@ function printTest(e, ext, LTRContainer, RTLContainer, genericContainer) { ' * LICENSE file in the root directory of this source tree.', ' */', ext === 'cpp' ? '\n// clang-format off' : '', - '// @' + 'generated by gentest/gentest.rb from gentest/fixtures/' + document.title + '.html', + '// @' + + 'generated by gentest/gentest.rb from gentest/fixtures/' + + document.title + + '.html', '', ]); e.emitPrologue(); - var LTRLayoutTree = calculateTree(LTRContainer); - var RTLLayoutTree = calculateTree(RTLContainer); - var genericLayoutTree = calculateTree(genericContainer); + const LTRLayoutTree = calculateTree(LTRContainer); + const RTLLayoutTree = calculateTree(RTLContainer); + const genericLayoutTree = calculateTree(genericContainer); - - for (var i = 0; i < genericLayoutTree.length; i++) { + for (let i = 0; i < genericLayoutTree.length; i++) { e.emitTestPrologue( genericLayoutTree[i].name, genericLayoutTree[i].experiments, - genericLayoutTree[i].disabled + genericLayoutTree[i].disabled, ); if (genericLayoutTree[i].name == 'wrap_column') { @@ -71,36 +77,63 @@ function printTest(e, ext, LTRContainer, RTLContainer, genericContainer) { // specification. The undefined dimension of a parent should be defined by the total size // of their children in that dimension. // See diagram under flex-wrap header https://www.w3.org/TR/css-flexbox-1/ - assert(LTRLayoutTree[0].width == 30, 'wrap_column LTR root.width should be 30'); + assert( + LTRLayoutTree[0].width == 30, + 'wrap_column LTR root.width should be 30', + ); LTRLayoutTree[0].width = 60; - assert(RTLLayoutTree[0].width == 30, 'wrap_column RTL root.width should be 30'); + assert( + RTLLayoutTree[0].width == 30, + 'wrap_column RTL root.width should be 30', + ); RTLLayoutTree[0].width = 60; - var children = RTLLayoutTree[0].children; - assert(children[0].left == 0, 'wrap_column RTL root_child0.left should be 0'); + const children = RTLLayoutTree[0].children; + assert( + children[0].left == 0, + 'wrap_column RTL root_child0.left should be 0', + ); children[0].left = 30; - assert(children[1].left == 0, 'wrap_column RTL root_child0.left should be 0'); + assert( + children[1].left == 0, + 'wrap_column RTL root_child0.left should be 0', + ); children[1].left = 30; - assert(children[2].left == 0, 'wrap_column RTL root_child2.left should be 0'); + assert( + children[2].left == 0, + 'wrap_column RTL root_child2.left should be 0', + ); children[2].left = 30; - assert(children[3].left == -30, 'wrap_column RTL root_child3.left should be -30'); + assert( + children[3].left == -30, + 'wrap_column RTL root_child3.left should be -30', + ); children[3].left = 0; } setupTestTree( - e, - undefined, - LTRLayoutTree[i], - genericLayoutTree[i], - 'root', - null); - - e.YGNodeCalculateLayout('root', e.YGDirectionLTR, genericLayoutTree[i].experiments); + e, + undefined, + LTRLayoutTree[i], + genericLayoutTree[i], + 'root', + null, + ); + + e.YGNodeCalculateLayout( + 'root', + e.YGDirectionLTR, + genericLayoutTree[i].experiments, + ); e.push(''); assertTestTree(e, LTRLayoutTree[i], 'root', null); e.push(''); - e.YGNodeCalculateLayout('root', e.YGDirectionRTL, genericLayoutTree[i].experiments); + e.YGNodeCalculateLayout( + 'root', + e.YGDirectionRTL, + genericLayoutTree[i].experiments, + ); e.push(''); assertTestTree(e, RTLLayoutTree[i], 'root', null); @@ -112,15 +145,15 @@ function printTest(e, ext, LTRContainer, RTLContainer, genericContainer) { e.print(); } -function assertTestTree(e, node, nodeName, parentName) { +function assertTestTree(e, node, nodeName, _parentName) { e.AssertEQ(node.left, e.YGNodeLayoutGetLeft(nodeName)); e.AssertEQ(node.top, e.YGNodeLayoutGetTop(nodeName)); e.AssertEQ(node.width, e.YGNodeLayoutGetWidth(nodeName)); e.AssertEQ(node.height, e.YGNodeLayoutGetHeight(nodeName)); - for (var i = 0; i < node.children.length; i++) { + for (let i = 0; i < node.children.length; i++) { e.push(''); - var childName = nodeName + '_child' + i; + const childName = nodeName + '_child' + i; assertTestTree(e, node.children[i], childName, nodeName); } } @@ -128,81 +161,129 @@ function assertTestTree(e, node, nodeName, parentName) { function checkDefaultValues() { // Sanity check of the Yoga default values by test-template.html [ - {style:'flex-direction', value:'column'}, - {style:'justify-content', value:'flex-start'}, - {style:'align-content', value:'flex-start'}, - {style:'align-items', value:'stretch'}, - {style:'position', value:'relative'}, - {style:'flex-wrap', value:'nowrap'}, - {style:'overflow', value:'visible'}, - {style:'flex-grow', value:'0'}, - {style:'flex-shrink', value:'0'}, - {style:'left', value:'undefined'}, - {style:'top', value:'undefined'}, - {style:'right', value:'undefined'}, - {style:'bottom', value:'undefined'}, - {style:'display', value:'flex'}, - ].forEach(function(item) { - assert(isDefaultStyleValue(item.style, item.value), - item.style + ' should be ' + item.value); + {style: 'flex-direction', value: 'column'}, + {style: 'justify-content', value: 'flex-start'}, + {style: 'align-content', value: 'flex-start'}, + {style: 'align-items', value: 'stretch'}, + {style: 'position', value: 'relative'}, + {style: 'flex-wrap', value: 'nowrap'}, + {style: 'overflow', value: 'visible'}, + {style: 'flex-grow', value: '0'}, + {style: 'flex-shrink', value: '0'}, + {style: 'left', value: 'undefined'}, + {style: 'top', value: 'undefined'}, + {style: 'right', value: 'undefined'}, + {style: 'bottom', value: 'undefined'}, + {style: 'display', value: 'flex'}, + ].forEach(item => { + assert( + isDefaultStyleValue(item.style, item.value), + item.style + ' should be ' + item.value, + ); }); } -function setupTestTree(e, parent, node, genericNode, nodeName, parentName, index) { +function setupTestTree( + e, + parent, + node, + genericNode, + nodeName, + parentName, + index, +) { e.emitTestTreePrologue(nodeName); - for (var style in node.style) { + for (const style in node.style) { // Skip position info for root as it messes up tests - if (node.declaredStyle[style] === "" && - (style == 'position' || - style == 'left' || - style == 'top' || - style == 'right' || - style == 'bottom' || - style == 'width' || - style == 'height')) { + if ( + node.declaredStyle[style] === '' && + (style == 'position' || + style == 'left' || + style == 'top' || + style == 'right' || + style == 'bottom' || + style == 'width' || + style == 'height') + ) { continue; - } + } if (!isDefaultStyleValue(style, node.style[style])) { switch (style) { case 'gap': - e.YGNodeStyleSetGap(nodeName, e.YGGutterAll, pointValue(e, node.style[style])); + e.YGNodeStyleSetGap( + nodeName, + e.YGGutterAll, + pointValue(e, node.style[style]), + ); break; case 'column-gap': - e.YGNodeStyleSetGap(nodeName, e.YGGutterColumn, pointValue(e, node.style[style])); + e.YGNodeStyleSetGap( + nodeName, + e.YGGutterColumn, + pointValue(e, node.style[style]), + ); break; case 'row-gap': - e.YGNodeStyleSetGap(nodeName, e.YGGutterRow, pointValue(e, node.style[style])); + e.YGNodeStyleSetGap( + nodeName, + e.YGGutterRow, + pointValue(e, node.style[style]), + ); break; case 'direction': - e.YGNodeStyleSetDirection(nodeName, directionValue(e, node.style[style])); + e.YGNodeStyleSetDirection( + nodeName, + directionValue(e, node.style[style]), + ); break; case 'flex-direction': - e.YGNodeStyleSetFlexDirection(nodeName, flexDirectionValue(e, node.style[style])); + e.YGNodeStyleSetFlexDirection( + nodeName, + flexDirectionValue(e, node.style[style]), + ); break; case 'justify-content': - e.YGNodeStyleSetJustifyContent(nodeName, justifyValue(e, node.style[style])); + e.YGNodeStyleSetJustifyContent( + nodeName, + justifyValue(e, node.style[style]), + ); break; case 'align-content': - e.YGNodeStyleSetAlignContent(nodeName, alignValue(e, node.style[style])); + e.YGNodeStyleSetAlignContent( + nodeName, + alignValue(e, node.style[style]), + ); break; case 'align-items': - e.YGNodeStyleSetAlignItems(nodeName, alignValue(e, node.style[style])); + e.YGNodeStyleSetAlignItems( + nodeName, + alignValue(e, node.style[style]), + ); break; case 'align-self': if (!parent || node.style[style] !== parent.style['align-items']) { - e.YGNodeStyleSetAlignSelf(nodeName, alignValue(e, node.style[style])); + e.YGNodeStyleSetAlignSelf( + nodeName, + alignValue(e, node.style[style]), + ); } break; case 'position': - e.YGNodeStyleSetPositionType(nodeName, positionValue(e, node.style[style])); + e.YGNodeStyleSetPositionType( + nodeName, + positionValue(e, node.style[style]), + ); break; case 'flex-wrap': e.YGNodeStyleSetFlexWrap(nodeName, wrapValue(e, node.style[style])); break; case 'overflow': - e.YGNodeStyleSetOverflow(nodeName, overflowValue(e, node.style[style])); + e.YGNodeStyleSetOverflow( + nodeName, + overflowValue(e, node.style[style]), + ); break; case 'flex-grow': e.YGNodeStyleSetFlexGrow(nodeName, node.style[style]); @@ -215,83 +296,179 @@ function setupTestTree(e, parent, node, genericNode, nodeName, parentName, index break; case 'left': if (genericNode.rawStyle.indexOf('start:') >= 0) { - e.YGNodeStyleSetPosition(nodeName, e.YGEdgeStart, pointValue(e, node.style[style])); + e.YGNodeStyleSetPosition( + nodeName, + e.YGEdgeStart, + pointValue(e, node.style[style]), + ); } else { - e.YGNodeStyleSetPosition(nodeName, e.YGEdgeLeft, pointValue(e, node.style[style])); + e.YGNodeStyleSetPosition( + nodeName, + e.YGEdgeLeft, + pointValue(e, node.style[style]), + ); } break; case 'top': - e.YGNodeStyleSetPosition(nodeName, e.YGEdgeTop, pointValue(e, node.style[style])); + e.YGNodeStyleSetPosition( + nodeName, + e.YGEdgeTop, + pointValue(e, node.style[style]), + ); break; case 'right': if (genericNode.rawStyle.indexOf('end:') >= 0) { - e.YGNodeStyleSetPosition(nodeName, e.YGEdgeEnd, pointValue(e, node.style[style])); + e.YGNodeStyleSetPosition( + nodeName, + e.YGEdgeEnd, + pointValue(e, node.style[style]), + ); } else { - e.YGNodeStyleSetPosition(nodeName, e.YGEdgeRight, pointValue(e, node.style[style])); + e.YGNodeStyleSetPosition( + nodeName, + e.YGEdgeRight, + pointValue(e, node.style[style]), + ); } break; case 'bottom': - e.YGNodeStyleSetPosition(nodeName, e.YGEdgeBottom, pointValue(e, node.style[style])); + e.YGNodeStyleSetPosition( + nodeName, + e.YGEdgeBottom, + pointValue(e, node.style[style]), + ); break; case 'margin-left': if (genericNode.rawStyle.indexOf('margin-start:') >= 0) { - e.YGNodeStyleSetMargin(nodeName, e.YGEdgeStart, pointValue(e, node.style[style])); + e.YGNodeStyleSetMargin( + nodeName, + e.YGEdgeStart, + pointValue(e, node.style[style]), + ); } else { - e.YGNodeStyleSetMargin(nodeName, e.YGEdgeLeft, pointValue(e, node.style[style])); + e.YGNodeStyleSetMargin( + nodeName, + e.YGEdgeLeft, + pointValue(e, node.style[style]), + ); } break; case 'margin-top': - e.YGNodeStyleSetMargin(nodeName, e.YGEdgeTop, pointValue(e, node.style[style])); + e.YGNodeStyleSetMargin( + nodeName, + e.YGEdgeTop, + pointValue(e, node.style[style]), + ); break; case 'margin-right': if (genericNode.rawStyle.indexOf('margin-end:') >= 0) { - e.YGNodeStyleSetMargin(nodeName, e.YGEdgeEnd, pointValue(e, node.style[style])); + e.YGNodeStyleSetMargin( + nodeName, + e.YGEdgeEnd, + pointValue(e, node.style[style]), + ); } else { - e.YGNodeStyleSetMargin(nodeName, e.YGEdgeRight, pointValue(e, node.style[style])); + e.YGNodeStyleSetMargin( + nodeName, + e.YGEdgeRight, + pointValue(e, node.style[style]), + ); } break; case 'margin-bottom': - e.YGNodeStyleSetMargin(nodeName, e.YGEdgeBottom, pointValue(e, node.style[style])); + e.YGNodeStyleSetMargin( + nodeName, + e.YGEdgeBottom, + pointValue(e, node.style[style]), + ); break; case 'padding-left': if (genericNode.rawStyle.indexOf('padding-start:') >= 0) { - e.YGNodeStyleSetPadding(nodeName, e.YGEdgeStart, pointValue(e, node.style[style])); + e.YGNodeStyleSetPadding( + nodeName, + e.YGEdgeStart, + pointValue(e, node.style[style]), + ); } else { - e.YGNodeStyleSetPadding(nodeName, e.YGEdgeLeft, pointValue(e, node.style[style])); + e.YGNodeStyleSetPadding( + nodeName, + e.YGEdgeLeft, + pointValue(e, node.style[style]), + ); } break; case 'padding-top': - e.YGNodeStyleSetPadding(nodeName, e.YGEdgeTop, pointValue(e, node.style[style])); + e.YGNodeStyleSetPadding( + nodeName, + e.YGEdgeTop, + pointValue(e, node.style[style]), + ); break; case 'padding-right': if (genericNode.rawStyle.indexOf('padding-end:') >= 0) { - e.YGNodeStyleSetPadding(nodeName, e.YGEdgeEnd, pointValue(e, node.style[style])); + e.YGNodeStyleSetPadding( + nodeName, + e.YGEdgeEnd, + pointValue(e, node.style[style]), + ); } else { - e.YGNodeStyleSetPadding(nodeName, e.YGEdgeRight, pointValue(e, node.style[style])); + e.YGNodeStyleSetPadding( + nodeName, + e.YGEdgeRight, + pointValue(e, node.style[style]), + ); } break; case 'padding-bottom': - e.YGNodeStyleSetPadding(nodeName, e.YGEdgeBottom, pointValue(e, node.style[style])); + e.YGNodeStyleSetPadding( + nodeName, + e.YGEdgeBottom, + pointValue(e, node.style[style]), + ); break; case 'border-left-width': if (genericNode.rawStyle.indexOf('border-start-width:') >= 0) { - e.YGNodeStyleSetBorder(nodeName, e.YGEdgeStart, pointValue(e, node.style[style])); + e.YGNodeStyleSetBorder( + nodeName, + e.YGEdgeStart, + pointValue(e, node.style[style]), + ); } else { - e.YGNodeStyleSetBorder(nodeName, e.YGEdgeLeft, pointValue(e, node.style[style])); + e.YGNodeStyleSetBorder( + nodeName, + e.YGEdgeLeft, + pointValue(e, node.style[style]), + ); } break; case 'border-top-width': - e.YGNodeStyleSetBorder(nodeName, e.YGEdgeTop, pointValue(e, node.style[style])); + e.YGNodeStyleSetBorder( + nodeName, + e.YGEdgeTop, + pointValue(e, node.style[style]), + ); break; case 'border-right-width': if (genericNode.rawStyle.indexOf('border-end-width:') >= 0) { - e.YGNodeStyleSetBorder(nodeName, e.YGEdgeEnd, pointValue(e, node.style[style])); + e.YGNodeStyleSetBorder( + nodeName, + e.YGEdgeEnd, + pointValue(e, node.style[style]), + ); } else { - e.YGNodeStyleSetBorder(nodeName, e.YGEdgeRight, pointValue(e, node.style[style])); + e.YGNodeStyleSetBorder( + nodeName, + e.YGEdgeRight, + pointValue(e, node.style[style]), + ); } break; case 'border-bottom-width': - e.YGNodeStyleSetBorder(nodeName, e.YGEdgeBottom, pointValue(e, node.style[style])); + e.YGNodeStyleSetBorder( + nodeName, + e.YGEdgeBottom, + pointValue(e, node.style[style]), + ); break; case 'width': e.YGNodeStyleSetWidth(nodeName, pointValue(e, node.style[style])); @@ -312,7 +489,7 @@ function setupTestTree(e, parent, node, genericNode, nodeName, parentName, index e.YGNodeStyleSetMaxHeight(nodeName, pointValue(e, node.style[style])); break; case 'display': - e.YGNodeStyleSetDisplay(nodeName, displayValue(e, node.style[style])) + e.YGNodeStyleSetDisplay(nodeName, displayValue(e, node.style[style])); break; } } @@ -322,106 +499,140 @@ function setupTestTree(e, parent, node, genericNode, nodeName, parentName, index e.YGNodeInsertChild(parentName, nodeName, index); } - for (var i = 0; i < node.children.length; i++) { + for (let i = 0; i < node.children.length; i++) { e.push(''); - var childName = nodeName + '_child' + i; + const childName = nodeName + '_child' + i; setupTestTree( - e, - node, - node.children[i], - genericNode.children[i], - childName, - nodeName, - i); + e, + node, + node.children[i], + genericNode.children[i], + childName, + nodeName, + i, + ); } } function overflowValue(e, value) { switch (value) { - case 'visible': return e.YGOverflowVisible; - case 'hidden': return e.YGOverflowHidden; + case 'visible': + return e.YGOverflowVisible; + case 'hidden': + return e.YGOverflowHidden; } } function wrapValue(e, value) { switch (value) { - case 'wrap': return e.YGWrapWrap; - case 'wrap-reverse': return e.YGWrapWrapReverse; - case 'nowrap': return e.YGWrapNoWrap; + case 'wrap': + return e.YGWrapWrap; + case 'wrap-reverse': + return e.YGWrapWrapReverse; + case 'nowrap': + return e.YGWrapNoWrap; } } function flexDirectionValue(e, value) { switch (value) { - case 'row': return e.YGFlexDirectionRow; - case 'row-reverse': return e.YGFlexDirectionRowReverse; - case 'column': return e.YGFlexDirectionColumn; - case 'column-reverse': return e.YGFlexDirectionColumnReverse; + case 'row': + return e.YGFlexDirectionRow; + case 'row-reverse': + return e.YGFlexDirectionRowReverse; + case 'column': + return e.YGFlexDirectionColumn; + case 'column-reverse': + return e.YGFlexDirectionColumnReverse; } } function justifyValue(e, value) { switch (value) { - case 'center': return e.YGJustifyCenter; - case 'space-around': return e.YGJustifySpaceAround; - case 'space-between': return e.YGJustifySpaceBetween; - case 'space-evenly': return e.YGJustifySpaceEvenly; - case 'flex-start': return e.YGJustifyFlexStart; - case 'flex-end': return e.YGJustifyFlexEnd; + case 'center': + return e.YGJustifyCenter; + case 'space-around': + return e.YGJustifySpaceAround; + case 'space-between': + return e.YGJustifySpaceBetween; + case 'space-evenly': + return e.YGJustifySpaceEvenly; + case 'flex-start': + return e.YGJustifyFlexStart; + case 'flex-end': + return e.YGJustifyFlexEnd; } } function positionValue(e, value) { switch (value) { - case 'absolute': return e.YGPositionTypeAbsolute; - default: return e.YGPositionTypeRelative + case 'absolute': + return e.YGPositionTypeAbsolute; + default: + return e.YGPositionTypeRelative; } } function directionValue(e, value) { switch (value) { - case 'ltr': return e.YGDirectionLTR; - case 'rtl': return e.YGDirectionRTL; - case 'inherit': return e.YGDirectionInherit; + case 'ltr': + return e.YGDirectionLTR; + case 'rtl': + return e.YGDirectionRTL; + case 'inherit': + return e.YGDirectionInherit; } } function alignValue(e, value) { switch (value) { - case 'auto': return e.YGAlignAuto; - case 'center': return e.YGAlignCenter; - case 'stretch': return e.YGAlignStretch; - case 'flex-start': return e.YGAlignFlexStart; - case 'flex-end': return e.YGAlignFlexEnd; - case 'space-between': return e.YGAlignSpaceBetween; - case 'space-around': return e.YGAlignSpaceAround; - case 'baseline': return e.YGAlignBaseline; + case 'auto': + return e.YGAlignAuto; + case 'center': + return e.YGAlignCenter; + case 'stretch': + return e.YGAlignStretch; + case 'flex-start': + return e.YGAlignFlexStart; + case 'flex-end': + return e.YGAlignFlexEnd; + case 'space-between': + return e.YGAlignSpaceBetween; + case 'space-around': + return e.YGAlignSpaceAround; + case 'baseline': + return e.YGAlignBaseline; } } function pointValue(e, value) { switch (value) { - case 'auto': return e.YGAuto; - case 'undefined': return e.YGUndefined; - default: return value; + case 'auto': + return e.YGAuto; + case 'undefined': + return e.YGUndefined; + default: + return value; } } -function displayValue(e, value){ - switch(value){ - case 'flex': return e.YGDisplayFlex; - case 'none': return e.YGDisplayNone; +function displayValue(e, value) { + switch (value) { + case 'flex': + return e.YGDisplayFlex; + case 'none': + return e.YGDisplayNone; } } -var DEFAULT_STYLES = new Map(); +const DEFAULT_STYLES = new Map(); function isDefaultStyleValue(style, value) { let defaultStyle = DEFAULT_STYLES.get(style); if (defaultStyle == null) { switch (style) { case 'position': - defaultStyle = new Set(['relative']);; + defaultStyle = new Set(['relative']); break; case 'left': @@ -438,10 +649,11 @@ function isDefaultStyleValue(style, value) { defaultStyle = new Set(['0', '0px', 'auto']); break; - default: - var node = document.getElementById('default'); + default: { + const node = document.getElementById('default'); defaultStyle = new Set([getComputedStyle(node, null)[style]]); break; + } } DEFAULT_STYLES.set(style, defaultStyle); } @@ -449,19 +661,19 @@ function isDefaultStyleValue(style, value) { } function getRoundedSize(node) { - var boundingRect = node.getBoundingClientRect(); + const boundingRect = node.getBoundingClientRect(); return { width: Math.round(boundingRect.right) - Math.round(boundingRect.left), - height: Math.round(boundingRect.bottom) - Math.round(boundingRect.top) + height: Math.round(boundingRect.bottom) - Math.round(boundingRect.top), }; } function calculateTree(root, roundToPixelGrid) { - var rootLayout = []; + const rootLayout = []; - for (var i = 0; i < root.children.length; i++) { - var child = root.children[i]; - var layout = { + for (let i = 0; i < root.children.length; i++) { + const child = root.children[i]; + const layout = { name: child.id !== '' ? child.id : 'INSERT_NAME_HERE', left: child.offsetLeft + child.parentNode.clientLeft, top: child.offsetTop + child.parentNode.clientTop, @@ -472,12 +684,12 @@ function calculateTree(root, roundToPixelGrid) { declaredStyle: child.style, rawStyle: child.getAttribute('style'), experiments: child.dataset.experiments - ? child.dataset.experiments.split(' ') - : DEFAULT_EXPERIMENTS, + ? child.dataset.experiments.split(' ') + : DEFAULT_EXPERIMENTS, disabled: child.dataset.disabled === 'true', }; - var size = getRoundedSize(child); + const size = getRoundedSize(child); layout.width = size.width; layout.height = size.height; @@ -528,13 +740,14 @@ function getYogaStyle(node) { 'column-gap', 'row-gap', 'display', - ].reduce(function(map, key) { - map[key] = node.style[key] || getComputedStyle(node, null).getPropertyValue(key); + ].reduce((map, key) => { + map[key] = + node.style[key] || getComputedStyle(node, null).getPropertyValue(key); return map; }, {}); } -var Emitter = function(lang, indent) { +const Emitter = function (lang, indent) { this.lang = lang; this.indent = indent; this.indents = []; @@ -542,29 +755,37 @@ var Emitter = function(lang, indent) { }; Emitter.prototype = Object.create(Object.prototype, { - constructor:{value:Emitter}, - - pushIndent:{value:function() { - this.indents.push(this.indent); - }}, - - popIndent:{value:function() { - this.indents.pop(); - }}, - - push:{value:function(line) { - if (line instanceof Array) { - line.forEach(function(element) { - this.push(element); - }, this); - return; - } else if (line.length > 0) { - line = this.indents.join('') + line; - } - this.lines.push(line); - }}, - - print:{value:function() { - console.log(this.lines.join('\n')); - }}, + constructor: {value: Emitter}, + + pushIndent: { + value: function () { + this.indents.push(this.indent); + }, + }, + + popIndent: { + value: function () { + this.indents.pop(); + }, + }, + + push: { + value: function (line) { + if (line instanceof Array) { + line.forEach(function (element) { + this.push(element); + }, this); + return; + } else if (line.length > 0) { + line = this.indents.join('') + line; + } + this.lines.push(line); + }, + }, + + print: { + value: function () { + console.log(this.lines.join('\n')); + }, + }, }); diff --git a/java/com/facebook/yoga/YogaExperimentalFeature.java b/java/com/facebook/yoga/YogaExperimentalFeature.java index daa87bf0f8..a9e621ef5a 100644 --- a/java/com/facebook/yoga/YogaExperimentalFeature.java +++ b/java/com/facebook/yoga/YogaExperimentalFeature.java @@ -11,8 +11,7 @@ public enum YogaExperimentalFeature { WEB_FLEX_BASIS(0), - ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE(1), - FIX_JNILOCAL_REF_OVERFLOWS(2); + ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE(1); private final int mIntValue; @@ -28,7 +27,6 @@ public static YogaExperimentalFeature fromInt(int value) { switch (value) { case 0: return WEB_FLEX_BASIS; case 1: return ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE; - case 2: return FIX_JNILOCAL_REF_OVERFLOWS; default: throw new IllegalArgumentException("Unknown enum value: " + value); } } diff --git a/java/jni/YGJNIVanilla.cpp b/java/jni/YGJNIVanilla.cpp index 1f0dd1c4a8..5a712b0fa6 100644 --- a/java/jni/YGJNIVanilla.cpp +++ b/java/jni/YGJNIVanilla.cpp @@ -15,10 +15,14 @@ #include #include "YogaJniException.h" +#include + // TODO: Reconcile missing layoutContext functionality from callbacks in the C // API and use that -#include +#include +using namespace facebook; +using namespace facebook::yoga; using namespace facebook::yoga::vanillajni; static inline ScopedLocalRef YGNodeJobject( @@ -139,7 +143,9 @@ static int YGJNILogFunc( void* /*layoutContext*/, const char* format, va_list args) { - int result = vsnprintf(NULL, 0, format, args); + va_list argsCopy; + va_copy(argsCopy, args); + int result = vsnprintf(nullptr, 0, format, argsCopy); std::vector buffer(1 + result); vsnprintf(buffer.data(), buffer.size(), format, args); @@ -192,7 +198,7 @@ static void jni_YGConfigSetLoggerJNI( } *context = newGlobalRef(env, logger); - config->setLogger(YGJNILogFunc); + static_cast(config)->setLogger(YGJNILogFunc); } else { if (context != nullptr) { delete context; @@ -280,8 +286,7 @@ static void YGTransferLayoutOutputsRecursive( JNIEnv* env, jobject thiz, YGNodeRef root, - void* layoutContext, - bool shouldCleanLocalRef) { + void* layoutContext) { if (!YGNodeGetHasNewLayout(root)) { return; } @@ -335,28 +340,26 @@ static void YGTransferLayoutOutputsRecursive( arr[borderStartIndex + 3] = YGNodeLayoutGetBorder(root, YGEdgeBottom); } - // Don't change this field name without changing the name of the field in - // Database.java - auto objectClass = facebook::yoga::vanillajni::make_local_ref( - env, env->GetObjectClass(obj.get())); - static const jfieldID arrField = facebook::yoga::vanillajni::getFieldId( - env, objectClass.get(), "arr", "[F"); - - ScopedLocalRef arrFinal = - make_local_ref(env, env->NewFloatArray(arrSize)); - env->SetFloatArrayRegion(arrFinal.get(), 0, arrSize, arr); - env->SetObjectField(obj.get(), arrField, arrFinal.get()); - - if (shouldCleanLocalRef) { - objectClass.reset(); - arrFinal.reset(); + // Create scope to make sure to release any local refs created here + { + // Don't change this field name without changing the name of the field in + // Database.java + auto objectClass = facebook::yoga::vanillajni::make_local_ref( + env, env->GetObjectClass(obj.get())); + static const jfieldID arrField = facebook::yoga::vanillajni::getFieldId( + env, objectClass.get(), "arr", "[F"); + + ScopedLocalRef arrFinal = + make_local_ref(env, env->NewFloatArray(arrSize)); + env->SetFloatArrayRegion(arrFinal.get(), 0, arrSize, arr); + env->SetObjectField(obj.get(), arrField, arrFinal.get()); } YGNodeSetHasNewLayout(root, false); for (uint32_t i = 0; i < YGNodeGetChildCount(root); i++) { YGTransferLayoutOutputsRecursive( - env, thiz, YGNodeGetChild(root, i), layoutContext, shouldCleanLocalRef); + env, thiz, YGNodeGetChild(root, i), layoutContext); } } @@ -378,17 +381,13 @@ static void jni_YGNodeCalculateLayoutJNI( } const YGNodeRef root = _jlong2YGNodeRef(nativePointer); - const bool shouldCleanLocalRef = - root->getConfig()->isExperimentalFeatureEnabled( - YGExperimentalFeatureFixJNILocalRefOverflows); YGNodeCalculateLayoutWithContext( root, static_cast(width), static_cast(height), YGNodeStyleGetDirection(_jlong2YGNodeRef(nativePointer)), layoutContext); - YGTransferLayoutOutputsRecursive( - env, obj, root, layoutContext, shouldCleanLocalRef); + YGTransferLayoutOutputsRecursive(env, obj, root, layoutContext); } catch (const YogaJniException& jniException) { ScopedLocalRef throwable = jniException.getThrowable(); if (throwable.get()) { @@ -691,7 +690,7 @@ static void jni_YGNodeSetHasMeasureFuncJNI( jobject /*obj*/, jlong nativePointer, jboolean hasMeasureFunc) { - _jlong2YGNodeRef(nativePointer) + static_cast(_jlong2YGNodeRef(nativePointer)) ->setMeasureFunc(hasMeasureFunc ? YGJNIMeasureFunc : nullptr); } @@ -718,7 +717,7 @@ static void jni_YGNodeSetHasBaselineFuncJNI( jobject /*obj*/, jlong nativePointer, jboolean hasBaselineFunc) { - _jlong2YGNodeRef(nativePointer) + static_cast(_jlong2YGNodeRef(nativePointer)) ->setBaselineFunc(hasBaselineFunc ? YGJNIBaselineFunc : nullptr); } diff --git a/java/jni/YGJTypesVanilla.h b/java/jni/YGJTypesVanilla.h index 506c304909..c1534fea69 100644 --- a/java/jni/YGJTypesVanilla.h +++ b/java/jni/YGJTypesVanilla.h @@ -14,11 +14,12 @@ #include "jni.h" class PtrJNodeMapVanilla { - std::map ptrsToIdxs_; - jobjectArray javaNodes_; + std::map ptrsToIdxs_{}; + jobjectArray javaNodes_{}; public: - PtrJNodeMapVanilla() : ptrsToIdxs_{}, javaNodes_{} {} + PtrJNodeMapVanilla() = default; + PtrJNodeMapVanilla(jlongArray javaNativePointers, jobjectArray javaNodes) : javaNodes_{javaNodes} { using namespace facebook::yoga::vanillajni; @@ -30,11 +31,11 @@ class PtrJNodeMapVanilla { javaNativePointers, 0, nativePointersSize, nativePointers.data()); for (size_t i = 0; i < nativePointersSize; ++i) { - ptrsToIdxs_[(YGNodeRef) nativePointers[i]] = i; + ptrsToIdxs_[(YGNodeConstRef) nativePointers[i]] = i; } } - facebook::yoga::vanillajni::ScopedLocalRef ref(YGNodeRef node) { + facebook::yoga::vanillajni::ScopedLocalRef ref(YGNodeConstRef node) { using namespace facebook::yoga::vanillajni; JNIEnv* env = getCurrentEnv(); diff --git a/javascript/.prettierignore b/javascript/.prettierignore deleted file mode 100644 index 6ee820419a..0000000000 --- a/javascript/.prettierignore +++ /dev/null @@ -1,4 +0,0 @@ -binaries/ -build/ -src/generated/ -tests/generated/ diff --git a/javascript/just.config.ts b/javascript/just.config.ts index 9537dc7e80..68d8421f99 100644 --- a/javascript/just.config.ts +++ b/javascript/just.config.ts @@ -10,7 +10,6 @@ import { argv, cleanTask, - eslintTask, logger, jestTask, option, @@ -76,13 +75,7 @@ task( ), ); -task( - 'lint', - parallel( - tscTask({noEmit: true}), - series(eslintTask({fix: argv().fix}), clangFormatTask({fix: argv().fix})), - ), -); +task('clang-format', clangFormatTask({fix: argv().fix})); task('prepack-package-json', async () => { const packageJsonPath = path.join(__dirname, 'package.json'); diff --git a/javascript/package.json b/javascript/package.json index 2f9ed0a94b..2e9a2b4816 100644 --- a/javascript/package.json +++ b/javascript/package.json @@ -48,36 +48,30 @@ "scripts": { "benchmark": "just benchmark", "build": "just build", + "clang-format": "just clang-format", + "clang-format:fix": "just clang-format --fix", "clean": "just clean", - "lint": "just lint", - "lint:fix": "just lint --fix", + "lint": "eslint .", + "lint:fix": "eslint . --fix", "prepack": "just prepack", - "test": "just test" + "test": "just test", + "tsc": "tsc --noEmit" }, "devDependencies": { - "@babel/cli": "^7.20.7", - "@babel/core": "^7.20.7", - "@babel/eslint-parser": "^7.19.1", - "@babel/node": "^7.20.7", - "@babel/preset-env": "^7.20.2", + "@babel/cli": "^7.21.4", + "@babel/core": "^7.21.4", + "@babel/node": "^7.21.4", + "@babel/preset-env": "^7.21.4", "@babel/preset-typescript": "^7.21.4", "@types/glob": "^8.1.0", "@types/jest": "^29.5.1", "@types/node": "^16.18.25", "@types/which": "^3.0.0", - "@typescript-eslint/eslint-plugin": "^5.30.5", - "@typescript-eslint/parser": "^5.30.5", "clang-format": "^1.8.0", - "eslint": "^8.30.0", - "eslint-config-prettier": "^8.5.0", - "eslint-plugin-jest": "^27.1.7", - "eslint-plugin-prettier": "^4.2.1", "glob": "^8.0.3", "jest": "^29.3.1", "just-scripts": "^2.1.0", - "prettier": "2.8.8", "ts-node": "^10.9.1", - "typescript": "5.0.4", "which": "^3.0.0" } } diff --git a/javascript/src/generated/YGEnums.ts b/javascript/src/generated/YGEnums.ts index c7e492ad7d..6252336d49 100644 --- a/javascript/src/generated/YGEnums.ts +++ b/javascript/src/generated/YGEnums.ts @@ -56,7 +56,6 @@ export enum Errata { export enum ExperimentalFeature { WebFlexBasis = 0, AbsolutePercentageAgainstPaddingEdge = 1, - FixJNILocalRefOverflows = 2, } export enum FlexDirection { @@ -163,7 +162,6 @@ const constants = { ERRATA_CLASSIC: Errata.Classic, EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS: ExperimentalFeature.WebFlexBasis, EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE: ExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, - EXPERIMENTAL_FEATURE_FIX_JNILOCAL_REF_OVERFLOWS: ExperimentalFeature.FixJNILocalRefOverflows, FLEX_DIRECTION_COLUMN: FlexDirection.Column, FLEX_DIRECTION_COLUMN_REVERSE: FlexDirection.ColumnReverse, FLEX_DIRECTION_ROW: FlexDirection.Row, diff --git a/javascript/src/wrapAssembly.d.ts b/javascript/src/wrapAssembly.d.ts index 0b0b38b241..4e3cbb2bc9 100644 --- a/javascript/src/wrapAssembly.d.ts +++ b/javascript/src/wrapAssembly.d.ts @@ -81,7 +81,11 @@ export type MeasureFunction = ( ) => Size; export type Node = { - calculateLayout(width?: number, height?: number, direction?: Direction): void; + calculateLayout( + width?: number | 'auto', + height?: number | 'auto', + direction?: Direction, + ): void; copyStyle(node: Node): void; free(): void; freeRecursive(): void; diff --git a/package.json b/package.json index 860901329a..e6f69ce264 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,22 @@ "name": "yoga-repo", "version": "0.0.0", "private": true, + "scripts": { + "lint": "eslint .", + "lint:fix": "eslint . --fix" + }, "workspaces": [ "javascript", "website-next" - ] + ], + "devDependencies": { + "@typescript-eslint/eslint-plugin": "^5.30.5", + "@typescript-eslint/parser": "^5.30.5", + "eslint": "^8.30.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-jest": "^27.1.7", + "eslint-plugin-prettier": "^4.2.1", + "prettier": "2.8.8", + "typescript": "5.0.4" + } } diff --git a/set-version.py b/set-version.py index a4c837a3a1..2afff1a4e8 100755 --- a/set-version.py +++ b/set-version.py @@ -19,13 +19,13 @@ with open("gradle.properties", "r+") as f: new_contents = re.sub(r"VERSION_NAME=.*", f"VERSION_NAME={version}", f.read()) f.seek(0) + f.truncate() f.write(new_contents) - with open("javascript/package.json", "r+") as f: new_contents = re.sub(r'"version": ".*",', f'"version": "{version}",', f.read()) - print(new_contents) f.seek(0) + f.truncate() f.write(new_contents) with open("Yoga.podspec", "r+") as f: @@ -33,4 +33,5 @@ r"spec\.version = '.*'", f"spec.version = '{version}'", f.read() ) f.seek(0) + f.truncate() f.write(new_contents) diff --git a/tests/BitUtilsTest.cpp b/tests/BitUtilsTest.cpp deleted file mode 100644 index 211a155ca9..0000000000 --- a/tests/BitUtilsTest.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/* - * 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. - */ - -#include - -#include -#include - -namespace facebook::yoga { - -TEST(BitUtils, one_boolean_defaults_to_false) { - constexpr uint8_t flags = 0; - - ASSERT_EQ(detail::getBooleanData(flags, 0), false); - static_assert( - detail::getBooleanData(flags, 0) == false, - "first boolean member must default to false"); -} - -TEST(BitUtils, one_boolean_can_be_initialized_to_true) { - constexpr uint8_t flags = 1; - - ASSERT_EQ(detail::getBooleanData(flags, 0), true); - static_assert( - detail::getBooleanData(flags, 0) == true, - "first boolean member must be initialized to true"); -} - -TEST(BitUtils, one_boolean_can_be_set_to_true) { - uint8_t flags = 0; - - detail::setBooleanData(flags, 0, true); - ASSERT_EQ(detail::getBooleanData(flags, 0), true); -} - -TEST(BitUtils, second_boolean_defaults_to_false) { - constexpr uint8_t flags = 0; - - ASSERT_EQ(detail::getBooleanData(flags, 1), false); - static_assert( - detail::getBooleanData(flags, 1) == false, - "second boolean member must default to false"); -} - -TEST(BitUtils, second_boolean_can_be_initialized_to_true) { - constexpr uint8_t flags = 2; - - ASSERT_EQ(detail::getBooleanData(flags, 0), false); - ASSERT_EQ(detail::getBooleanData(flags, 1), true); - static_assert( - detail::getBooleanData(flags, 0) == false, - "first boolean member must default to false"); - static_assert( - detail::getBooleanData(flags, 1) == true, - "second boolean member must be initialized to true"); -} - -TEST(BitUtils, second_boolean_can_be_set_to_true) { - uint8_t flags = 0; - - detail::setBooleanData(flags, 1, true); - ASSERT_EQ(detail::getBooleanData(flags, 0), false); - ASSERT_EQ(detail::getBooleanData(flags, 1), true); -} - -TEST(BitUtils, third_boolean_defaults_to_false) { - constexpr uint8_t flags = 0; - - ASSERT_EQ(detail::getBooleanData(flags, 2), false); - static_assert( - detail::getBooleanData(flags, 2) == false, - "second boolean member must default to false"); -} - -TEST(BitUtils, third_boolean_can_be_initialized_to_true) { - constexpr uint8_t flags = 4; - - ASSERT_EQ(detail::getBooleanData(flags, 0), false); - ASSERT_EQ(detail::getBooleanData(flags, 1), false); - ASSERT_EQ(detail::getBooleanData(flags, 2), true); - static_assert( - detail::getBooleanData(flags, 0) == false, - "first boolean member must default to false"); - static_assert( - detail::getBooleanData(flags, 1) == false, - "second boolean member must default to false"); - static_assert( - detail::getBooleanData(flags, 2) == true, - "second boolean member must be initialized to true"); -} - -TEST(BitUtils, third_boolean_can_be_set_to_true) { - uint8_t flags = 0; - - detail::setBooleanData(flags, 2, true); - ASSERT_EQ(detail::getBooleanData(flags, 0), false); - ASSERT_EQ(detail::getBooleanData(flags, 1), false); - ASSERT_EQ(detail::getBooleanData(flags, 2), true); -} - -TEST(BitUtils, setting_boolean_values_does_not_spill_over) { - uint8_t flags = 0; - - detail::setBooleanData(flags, 1, (bool) 7); - - ASSERT_EQ(detail::getBooleanData(flags, 0), false); - ASSERT_EQ(detail::getBooleanData(flags, 1), true); - ASSERT_EQ(detail::getBooleanData(flags, 2), false); -} - -TEST(BitUtils, first_enum_defaults_to_0) { - constexpr uint8_t flags = 0; - - ASSERT_EQ(detail::getEnumData(flags, 0), YGAlignAuto); - static_assert( - detail::getEnumData(flags, 0) == YGAlignAuto, - "first enum member must default to 0"); -} - -TEST(BitUtils, first_enum_can_be_set) { - uint8_t flags = 0; - - detail::setEnumData(flags, 0, YGAlignSpaceBetween); - - ASSERT_EQ(detail::getEnumData(flags, 0), YGAlignSpaceBetween); -} - -TEST(BitUtils, second_enum_defaults_to_0) { - constexpr uint8_t flags = 0; - static constexpr size_t alignOffset = 0; - static constexpr size_t edgeOffset = 3; - - ASSERT_EQ(detail::getEnumData(flags, alignOffset), YGAlignAuto); - ASSERT_EQ(detail::getEnumData(flags, edgeOffset), YGEdgeLeft); - static_assert( - detail::getEnumData(flags, alignOffset) == YGAlignAuto, - "first enum member must default to 0"); - static_assert( - detail::getEnumData(flags, edgeOffset) == YGEdgeLeft, - "second enum member must default to 0"); -} - -TEST(BitUtils, second_enum_can_be_set) { - uint8_t flags = 0; - static constexpr size_t alignOffset = 0; - static constexpr size_t edgeOffset = 3; - - detail::setEnumData(flags, edgeOffset, YGEdgeAll); - - ASSERT_EQ(detail::getEnumData(flags, alignOffset), YGAlignAuto); - ASSERT_EQ(detail::getEnumData(flags, edgeOffset), YGEdgeAll); -} - -TEST(BitUtils, third_enum_defaults_to_0) { - constexpr uint8_t flags = 0; - static constexpr size_t alignOffset = 0; - static constexpr size_t boolOffset = 3; - static constexpr size_t edgesOffset = 4; - - ASSERT_EQ(detail::getEnumData(flags, alignOffset), YGAlignAuto); - ASSERT_EQ(detail::getBooleanData(flags, boolOffset), false); - ASSERT_EQ(detail::getEnumData(flags, edgesOffset), YGEdgeLeft); - static_assert( - detail::getEnumData(flags, alignOffset) == YGAlignAuto, - "first enum member must default to 0"); - static_assert( - detail::getBooleanData(flags, boolOffset) == false, - "middle boolean member must default to false"); - static_assert( - detail::getEnumData(flags, edgesOffset) == YGEdgeLeft, - "last enum member must default to 0"); -} - -TEST(BitUtils, third_enum_can_be_set) { - uint8_t flags = 0; - static constexpr size_t alignOffset = 0; - static constexpr size_t boolOffset = 3; - static constexpr size_t edgesOffset = 4; - - detail::setEnumData(flags, edgesOffset, YGEdgeVertical); - - ASSERT_EQ(detail::getEnumData(flags, alignOffset), YGAlignAuto); - ASSERT_EQ(detail::getBooleanData(flags, boolOffset), false); - ASSERT_EQ(detail::getEnumData(flags, edgesOffset), YGEdgeVertical); -} - -TEST(BitUtils, setting_values_does_not_spill_over) { - uint8_t flags = 0; - static constexpr size_t alignOffset = 0; - static constexpr size_t edgesOffset = 3; - static constexpr size_t boolOffset = 7; - - detail::setEnumData(flags, edgesOffset, (YGEdge) 0xffffff); - - ASSERT_EQ(detail::getEnumData(flags, alignOffset), 0); - ASSERT_EQ(detail::getBooleanData(flags, boolOffset), false); - ASSERT_EQ(detail::getEnumData(flags, edgesOffset), 0xf); -} - -} // namespace facebook::yoga diff --git a/tests/CompactValueTest.cpp b/tests/CompactValueTest.cpp index 5a875f8e9c..5b78a06074 100644 --- a/tests/CompactValueTest.cpp +++ b/tests/CompactValueTest.cpp @@ -7,11 +7,11 @@ #define YOGA_COMPACT_VALUE_TEST -#include +#include #include #include -using facebook::yoga::detail::CompactValue; +using facebook::yoga::CompactValue; const auto tooSmall = nextafterf(CompactValue::LOWER_BOUND, -INFINITY); const auto tooLargePoints = diff --git a/tests/EventsTest.cpp b/tests/EventsTest.cpp index 648d844d54..11131d4333 100644 --- a/tests/EventsTest.cpp +++ b/tests/EventsTest.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include #include @@ -30,7 +29,7 @@ struct TypedEventTestData { }; struct EventArgs { - const YGNode* node; + const YGNodeConstRef node; Event::Type type; std::unique_ptr> dataPtr; std::unique_ptr> eventTestDataPtr; @@ -48,7 +47,7 @@ struct EventArgs { class EventTest : public ::testing::Test { ScopedEventSubscription subscription = {&EventTest::listen}; - static void listen(const YGNode&, Event::Type, Event::Data); + static void listen(YGNodeConstRef, Event::Type, Event::Data); public: static std::vector events; @@ -284,16 +283,16 @@ TEST_F(EventTest, baseline_functions_get_wrapped) { namespace { template -EventArgs createArgs(const YGNode& node, const Event::Data data) { +EventArgs createArgs(YGNodeConstRef node, const Event::Data data) { using Data = Event::TypedData; auto deleteData = [](void* x) { delete static_cast(x); }; - return {&node, E, {new Data{(data.get())}, deleteData}, nullptr}; + return {node, E, {new Data{(data.get())}, deleteData}, nullptr}; } template EventArgs createArgs( - const YGNode& node, + YGNodeConstRef node, const Event::Data data, TypedEventTestData eventTestData) { using EventTestData = TypedEventTestData; @@ -309,7 +308,10 @@ EventArgs createArgs( } // namespace -void EventTest::listen(const YGNode& node, Event::Type type, Event::Data data) { +void EventTest::listen( + YGNodeConstRef node, + Event::Type type, + Event::Data data) { switch (type) { case Event::NodeAllocation: events.push_back(createArgs(node, data)); diff --git a/tests/YGFloatOptionalTest.cpp b/tests/FloatOptionalTest.cpp similarity index 72% rename from tests/YGFloatOptionalTest.cpp rename to tests/FloatOptionalTest.cpp index c35f7b2e08..95a3f3da94 100644 --- a/tests/YGFloatOptionalTest.cpp +++ b/tests/FloatOptionalTest.cpp @@ -7,17 +7,20 @@ #include -#include -#include +#include +#include #include -constexpr auto empty = YGFloatOptional{}; -constexpr auto zero = YGFloatOptional{0.0f}; -constexpr auto one = YGFloatOptional{1.0f}; -constexpr auto positive = YGFloatOptional{1234.5f}; -constexpr auto negative = YGFloatOptional{-9876.5f}; +using namespace facebook; +using namespace facebook::yoga; -TEST(YGFloatOptional, value) { +constexpr auto empty = FloatOptional{}; +constexpr auto zero = FloatOptional{0.0f}; +constexpr auto one = FloatOptional{1.0f}; +constexpr auto positive = FloatOptional{1234.5f}; +constexpr auto negative = FloatOptional{-9876.5f}; + +TEST(FloatOptional, value) { ASSERT_TRUE(YGFloatIsUndefined(empty.unwrap())); ASSERT_EQ(zero.unwrap(), 0.0f); ASSERT_EQ(one.unwrap(), 1.0f); @@ -31,7 +34,7 @@ TEST(YGFloatOptional, value) { ASSERT_FALSE(negative.isUndefined()); } -TEST(YGFloatOptional, equality) { +TEST(FloatOptional, equality) { ASSERT_TRUE(empty == empty); ASSERT_TRUE(empty == YGUndefined); ASSERT_FALSE(empty == zero); @@ -56,7 +59,7 @@ TEST(YGFloatOptional, equality) { ASSERT_FALSE(negative == zero); } -TEST(YGFloatOptional, inequality) { +TEST(FloatOptional, inequality) { ASSERT_FALSE(empty != empty); ASSERT_FALSE(empty != YGUndefined); ASSERT_TRUE(empty != zero); @@ -81,7 +84,7 @@ TEST(YGFloatOptional, inequality) { ASSERT_TRUE(negative != zero); } -TEST(YGFloatOptional, greater_than_with_undefined) { +TEST(FloatOptional, greater_than_with_undefined) { ASSERT_FALSE(empty > empty); ASSERT_FALSE(empty > zero); ASSERT_FALSE(empty > one); @@ -93,7 +96,7 @@ TEST(YGFloatOptional, greater_than_with_undefined) { ASSERT_FALSE(negative > empty); } -TEST(YGFloatOptional, greater_than) { +TEST(FloatOptional, greater_than) { ASSERT_TRUE(zero > negative); ASSERT_FALSE(zero > zero); ASSERT_FALSE(zero > positive); @@ -103,10 +106,10 @@ TEST(YGFloatOptional, greater_than) { ASSERT_TRUE(one > zero); ASSERT_FALSE(one > positive); - ASSERT_TRUE(negative > YGFloatOptional{-INFINITY}); + ASSERT_TRUE(negative > FloatOptional{-INFINITY}); } -TEST(YGFloatOptional, less_than_with_undefined) { +TEST(FloatOptional, less_than_with_undefined) { ASSERT_FALSE(empty < empty); ASSERT_FALSE(zero < empty); ASSERT_FALSE(one < empty); @@ -118,7 +121,7 @@ TEST(YGFloatOptional, less_than_with_undefined) { ASSERT_FALSE(empty < negative); } -TEST(YGFloatOptional, less_than) { +TEST(FloatOptional, less_than) { ASSERT_TRUE(negative < zero); ASSERT_FALSE(zero < zero); ASSERT_FALSE(positive < zero); @@ -128,10 +131,10 @@ TEST(YGFloatOptional, less_than) { ASSERT_TRUE(zero < one); ASSERT_FALSE(positive < one); - ASSERT_TRUE(YGFloatOptional{-INFINITY} < negative); + ASSERT_TRUE(FloatOptional{-INFINITY} < negative); } -TEST(YGFloatOptional, greater_than_equals_with_undefined) { +TEST(FloatOptional, greater_than_equals_with_undefined) { ASSERT_TRUE(empty >= empty); ASSERT_FALSE(empty >= zero); ASSERT_FALSE(empty >= one); @@ -143,7 +146,7 @@ TEST(YGFloatOptional, greater_than_equals_with_undefined) { ASSERT_FALSE(negative >= empty); } -TEST(YGFloatOptional, greater_than_equals) { +TEST(FloatOptional, greater_than_equals) { ASSERT_TRUE(zero >= negative); ASSERT_TRUE(zero >= zero); ASSERT_FALSE(zero >= positive); @@ -153,10 +156,10 @@ TEST(YGFloatOptional, greater_than_equals) { ASSERT_TRUE(one >= zero); ASSERT_FALSE(one >= positive); - ASSERT_TRUE(negative >= YGFloatOptional{-INFINITY}); + ASSERT_TRUE(negative >= FloatOptional{-INFINITY}); } -TEST(YGFloatOptional, less_than_equals_with_undefined) { +TEST(FloatOptional, less_than_equals_with_undefined) { ASSERT_TRUE(empty <= empty); ASSERT_FALSE(zero <= empty); ASSERT_FALSE(one <= empty); @@ -168,7 +171,7 @@ TEST(YGFloatOptional, less_than_equals_with_undefined) { ASSERT_FALSE(empty <= negative); } -TEST(YGFloatOptional, less_than_equals) { +TEST(FloatOptional, less_than_equals) { ASSERT_TRUE(negative <= zero); ASSERT_TRUE(zero <= zero); ASSERT_FALSE(positive <= zero); @@ -178,32 +181,32 @@ TEST(YGFloatOptional, less_than_equals) { ASSERT_TRUE(zero <= one); ASSERT_FALSE(positive <= one); - ASSERT_TRUE(YGFloatOptional{-INFINITY} <= negative); + ASSERT_TRUE(FloatOptional{-INFINITY} <= negative); } -TEST(YGFloatOptional, addition) { +TEST(FloatOptional, addition) { auto n = negative.unwrap(); auto p = positive.unwrap(); ASSERT_EQ(zero + one, one); - ASSERT_EQ(negative + positive, YGFloatOptional{n + p}); + ASSERT_EQ(negative + positive, FloatOptional{n + p}); ASSERT_EQ(empty + zero, empty); ASSERT_EQ(empty + empty, empty); ASSERT_EQ(negative + empty, empty); } -TEST(YGFloatOptionalTest, YGFloatOptionalMax) { - ASSERT_EQ(YGFloatOptionalMax(empty, empty), empty); - ASSERT_EQ(YGFloatOptionalMax(empty, positive), positive); - ASSERT_EQ(YGFloatOptionalMax(negative, empty), negative); - ASSERT_EQ(YGFloatOptionalMax(negative, YGFloatOptional{-INFINITY}), negative); +TEST(YGFloatOptiona, maxOrDefined) { + ASSERT_EQ(yoga::maxOrDefined(empty, empty), empty); + ASSERT_EQ(yoga::maxOrDefined(empty, positive), positive); + ASSERT_EQ(yoga::maxOrDefined(negative, empty), negative); + ASSERT_EQ(yoga::maxOrDefined(negative, FloatOptional{-INFINITY}), negative); ASSERT_EQ( - YGFloatOptionalMax(YGFloatOptional{1.0f}, YGFloatOptional{1.125f}), - YGFloatOptional{1.125f}); + yoga::maxOrDefined(FloatOptional{1.0f}, FloatOptional{1.125f}), + FloatOptional{1.125f}); } -TEST(YGFloatOptionalTest, unwrap) { +TEST(FloatOptional, unwrap) { ASSERT_TRUE(YGFloatIsUndefined(empty.unwrap())); ASSERT_EQ(zero.unwrap(), 0.0f); - ASSERT_EQ(YGFloatOptional{123456.78f}.unwrap(), 123456.78f); + ASSERT_EQ(FloatOptional{123456.78f}.unwrap(), 123456.78f); } diff --git a/tests/NumericBitfieldTest.cpp b/tests/NumericBitfieldTest.cpp new file mode 100644 index 0000000000..9b487cee21 --- /dev/null +++ b/tests/NumericBitfieldTest.cpp @@ -0,0 +1,204 @@ +/* + * 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. + */ + +#include + +#include +#include + +namespace facebook::yoga { + +TEST(NumericBitfield, one_boolean_defaults_to_false) { + constexpr uint8_t flags = 0; + + ASSERT_EQ(getBooleanData(flags, 0), false); + static_assert( + getBooleanData(flags, 0) == false, + "first boolean member must default to false"); +} + +TEST(NumericBitfield, one_boolean_can_be_initialized_to_true) { + constexpr uint8_t flags = 1; + + ASSERT_EQ(getBooleanData(flags, 0), true); + static_assert( + getBooleanData(flags, 0) == true, + "first boolean member must be initialized to true"); +} + +TEST(NumericBitfield, one_boolean_can_be_set_to_true) { + uint8_t flags = 0; + + setBooleanData(flags, 0, true); + ASSERT_EQ(getBooleanData(flags, 0), true); +} + +TEST(NumericBitfield, second_boolean_defaults_to_false) { + constexpr uint8_t flags = 0; + + ASSERT_EQ(getBooleanData(flags, 1), false); + static_assert( + getBooleanData(flags, 1) == false, + "second boolean member must default to false"); +} + +TEST(NumericBitfield, second_boolean_can_be_initialized_to_true) { + constexpr uint8_t flags = 2; + + ASSERT_EQ(getBooleanData(flags, 0), false); + ASSERT_EQ(getBooleanData(flags, 1), true); + static_assert( + getBooleanData(flags, 0) == false, + "first boolean member must default to false"); + static_assert( + getBooleanData(flags, 1) == true, + "second boolean member must be initialized to true"); +} + +TEST(NumericBitfield, second_boolean_can_be_set_to_true) { + uint8_t flags = 0; + + setBooleanData(flags, 1, true); + ASSERT_EQ(getBooleanData(flags, 0), false); + ASSERT_EQ(getBooleanData(flags, 1), true); +} + +TEST(NumericBitfield, third_boolean_defaults_to_false) { + constexpr uint8_t flags = 0; + + ASSERT_EQ(getBooleanData(flags, 2), false); + static_assert( + getBooleanData(flags, 2) == false, + "second boolean member must default to false"); +} + +TEST(NumericBitfield, third_boolean_can_be_initialized_to_true) { + constexpr uint8_t flags = 4; + + ASSERT_EQ(getBooleanData(flags, 0), false); + ASSERT_EQ(getBooleanData(flags, 1), false); + ASSERT_EQ(getBooleanData(flags, 2), true); + static_assert( + getBooleanData(flags, 0) == false, + "first boolean member must default to false"); + static_assert( + getBooleanData(flags, 1) == false, + "second boolean member must default to false"); + static_assert( + getBooleanData(flags, 2) == true, + "second boolean member must be initialized to true"); +} + +TEST(NumericBitfield, third_boolean_can_be_set_to_true) { + uint8_t flags = 0; + + setBooleanData(flags, 2, true); + ASSERT_EQ(getBooleanData(flags, 0), false); + ASSERT_EQ(getBooleanData(flags, 1), false); + ASSERT_EQ(getBooleanData(flags, 2), true); +} + +TEST(NumericBitfield, setting_boolean_values_does_not_spill_over) { + uint8_t flags = 0; + + setBooleanData(flags, 1, (bool) 7); + + ASSERT_EQ(getBooleanData(flags, 0), false); + ASSERT_EQ(getBooleanData(flags, 1), true); + ASSERT_EQ(getBooleanData(flags, 2), false); +} + +TEST(NumericBitfield, first_enum_defaults_to_0) { + constexpr uint8_t flags = 0; + + ASSERT_EQ(getEnumData(flags, 0), YGAlignAuto); + static_assert( + getEnumData(flags, 0) == YGAlignAuto, + "first enum member must default to 0"); +} + +TEST(NumericBitfield, first_enum_can_be_set) { + uint8_t flags = 0; + + setEnumData(flags, 0, YGAlignSpaceBetween); + + ASSERT_EQ(getEnumData(flags, 0), YGAlignSpaceBetween); +} + +TEST(NumericBitfield, second_enum_defaults_to_0) { + constexpr uint8_t flags = 0; + static constexpr size_t alignOffset = 0; + static constexpr size_t edgeOffset = 3; + + ASSERT_EQ(getEnumData(flags, alignOffset), YGAlignAuto); + ASSERT_EQ(getEnumData(flags, edgeOffset), YGEdgeLeft); + static_assert( + getEnumData(flags, alignOffset) == YGAlignAuto, + "first enum member must default to 0"); + static_assert( + getEnumData(flags, edgeOffset) == YGEdgeLeft, + "second enum member must default to 0"); +} + +TEST(NumericBitfield, second_enum_can_be_set) { + uint8_t flags = 0; + static constexpr size_t alignOffset = 0; + static constexpr size_t edgeOffset = 3; + + setEnumData(flags, edgeOffset, YGEdgeAll); + + ASSERT_EQ(getEnumData(flags, alignOffset), YGAlignAuto); + ASSERT_EQ(getEnumData(flags, edgeOffset), YGEdgeAll); +} + +TEST(NumericBitfield, third_enum_defaults_to_0) { + constexpr uint8_t flags = 0; + static constexpr size_t alignOffset = 0; + static constexpr size_t boolOffset = 3; + static constexpr size_t edgesOffset = 4; + + ASSERT_EQ(getEnumData(flags, alignOffset), YGAlignAuto); + ASSERT_EQ(getBooleanData(flags, boolOffset), false); + ASSERT_EQ(getEnumData(flags, edgesOffset), YGEdgeLeft); + static_assert( + getEnumData(flags, alignOffset) == YGAlignAuto, + "first enum member must default to 0"); + static_assert( + getBooleanData(flags, boolOffset) == false, + "middle boolean member must default to false"); + static_assert( + getEnumData(flags, edgesOffset) == YGEdgeLeft, + "last enum member must default to 0"); +} + +TEST(NumericBitfield, third_enum_can_be_set) { + uint8_t flags = 0; + static constexpr size_t alignOffset = 0; + static constexpr size_t boolOffset = 3; + static constexpr size_t edgesOffset = 4; + + setEnumData(flags, edgesOffset, YGEdgeVertical); + + ASSERT_EQ(getEnumData(flags, alignOffset), YGAlignAuto); + ASSERT_EQ(getBooleanData(flags, boolOffset), false); + ASSERT_EQ(getEnumData(flags, edgesOffset), YGEdgeVertical); +} + +TEST(NumericBitfield, setting_values_does_not_spill_over) { + uint8_t flags = 0; + static constexpr size_t alignOffset = 0; + static constexpr size_t edgesOffset = 3; + static constexpr size_t boolOffset = 7; + + setEnumData(flags, edgesOffset, (YGEdge) 0xffffff); + + ASSERT_EQ(getEnumData(flags, alignOffset), 0); + ASSERT_EQ(getBooleanData(flags, boolOffset), false); + ASSERT_EQ(getEnumData(flags, edgesOffset), 0xf); +} + +} // namespace facebook::yoga diff --git a/tests/YGAlignBaselineTest.cpp b/tests/YGAlignBaselineTest.cpp index 92885725f0..df64a1517a 100644 --- a/tests/YGAlignBaselineTest.cpp +++ b/tests/YGAlignBaselineTest.cpp @@ -6,7 +6,6 @@ */ #include -#include #include static float _baselineFunc( @@ -197,7 +196,7 @@ TEST(YogaTest, align_baseline_parent_using_child_in_column_as_reference) { const YGNodeRef root_child1_child1 = createYGNode(config, YGFlexDirectionColumn, 500, 400, false); - root_child1_child1->setBaselineFunc(_baselineFunc); + YGNodeSetBaselineFunc(root_child1_child1, _baselineFunc); YGNodeSetIsReferenceBaseline(root_child1_child1, true); YGNodeInsertChild(root_child1, root_child1_child1, 1); @@ -242,7 +241,7 @@ TEST( const YGNodeRef root_child1_child1 = createYGNode(config, YGFlexDirectionColumn, 500, 400, false); - root_child1_child1->setBaselineFunc(_baselineFunc); + YGNodeSetBaselineFunc(root_child1_child1, _baselineFunc); YGNodeSetIsReferenceBaseline(root_child1_child1, true); YGNodeStyleSetPadding(root_child1_child1, YGEdgeLeft, 100); YGNodeStyleSetPadding(root_child1_child1, YGEdgeRight, 100); @@ -295,7 +294,7 @@ TEST( const YGNodeRef root_child1_child1 = createYGNode(config, YGFlexDirectionColumn, 500, 400, false); - root_child1_child1->setBaselineFunc(_baselineFunc); + YGNodeSetBaselineFunc(root_child1_child1, _baselineFunc); YGNodeSetIsReferenceBaseline(root_child1_child1, true); YGNodeInsertChild(root_child1, root_child1_child1, 1); @@ -344,7 +343,7 @@ TEST( const YGNodeRef root_child1_child1 = createYGNode(config, YGFlexDirectionColumn, 500, 400, false); - root_child1_child1->setBaselineFunc(_baselineFunc); + YGNodeSetBaselineFunc(root_child1_child1, _baselineFunc); YGNodeSetIsReferenceBaseline(root_child1_child1, true); YGNodeInsertChild(root_child1, root_child1_child1, 1); @@ -389,7 +388,7 @@ TEST( const YGNodeRef root_child1_child1 = createYGNode(config, YGFlexDirectionColumn, 500, 400, false); - root_child1_child1->setBaselineFunc(_baselineFunc); + YGNodeSetBaselineFunc(root_child1_child1, _baselineFunc); YGNodeSetIsReferenceBaseline(root_child1_child1, true); YGNodeStyleSetMargin(root_child1_child1, YGEdgeLeft, 100); YGNodeStyleSetMargin(root_child1_child1, YGEdgeRight, 100); @@ -436,7 +435,7 @@ TEST(YogaTest, align_baseline_parent_using_child_in_row_as_reference) { const YGNodeRef root_child1_child1 = createYGNode(config, YGFlexDirectionColumn, 500, 400, false); - root_child1_child1->setBaselineFunc(_baselineFunc); + YGNodeSetBaselineFunc(root_child1_child1, _baselineFunc); YGNodeSetIsReferenceBaseline(root_child1_child1, true); YGNodeInsertChild(root_child1, root_child1_child1, 1); @@ -481,7 +480,7 @@ TEST( const YGNodeRef root_child1_child1 = createYGNode(config, YGFlexDirectionColumn, 500, 400, false); - root_child1_child1->setBaselineFunc(_baselineFunc); + YGNodeSetBaselineFunc(root_child1_child1, _baselineFunc); YGNodeSetIsReferenceBaseline(root_child1_child1, true); YGNodeStyleSetPadding(root_child1_child1, YGEdgeLeft, 100); YGNodeStyleSetPadding(root_child1_child1, YGEdgeRight, 100); @@ -530,7 +529,7 @@ TEST( const YGNodeRef root_child1_child1 = createYGNode(config, YGFlexDirectionColumn, 500, 400, false); - root_child1_child1->setBaselineFunc(_baselineFunc); + YGNodeSetBaselineFunc(root_child1_child1, _baselineFunc); YGNodeSetIsReferenceBaseline(root_child1_child1, true); YGNodeStyleSetMargin(root_child1_child1, YGEdgeLeft, 100); YGNodeStyleSetMargin(root_child1_child1, YGEdgeRight, 100); @@ -670,7 +669,7 @@ TEST( const YGNodeRef root_child1_child1 = createYGNode(config, YGFlexDirectionColumn, 500, 400, false); - root_child1_child1->setBaselineFunc(_baselineFunc); + YGNodeSetBaselineFunc(root_child1_child1, _baselineFunc); YGNodeSetIsReferenceBaseline(root_child1_child1, true); YGNodeInsertChild(root_child1, root_child1_child1, 1); @@ -721,7 +720,7 @@ TEST( const YGNodeRef root_child1_child1 = createYGNode(config, YGFlexDirectionColumn, 500, 400, false); - root_child1_child1->setBaselineFunc(_baselineFunc); + YGNodeSetBaselineFunc(root_child1_child1, _baselineFunc); YGNodeSetIsReferenceBaseline(root_child1_child1, true); YGNodeInsertChild(root_child1, root_child1_child1, 1); diff --git a/tests/YGAspectRatioTest.cpp b/tests/YGAspectRatioTest.cpp index 149ff43547..4a5fe60003 100644 --- a/tests/YGAspectRatioTest.cpp +++ b/tests/YGAspectRatioTest.cpp @@ -6,7 +6,6 @@ */ #include -#include #include static YGSize _measure( @@ -449,7 +448,7 @@ TEST(YogaTest, aspect_ratio_with_measure_func) { YGNodeStyleSetHeight(root, 100); const YGNodeRef root_child0 = YGNodeNew(); - root_child0->setMeasureFunc(_measure); + YGNodeSetMeasureFunc(root_child0, _measure); YGNodeStyleSetAspectRatio(root_child0, 1); YGNodeInsertChild(root, root_child0, 0); diff --git a/tests/YGBaselineFuncTest.cpp b/tests/YGBaselineFuncTest.cpp index f380100d47..5888dcae88 100644 --- a/tests/YGBaselineFuncTest.cpp +++ b/tests/YGBaselineFuncTest.cpp @@ -6,14 +6,13 @@ */ #include -#include #include static float _baseline( YGNodeRef node, const float /*width*/, const float /*height*/) { - float* baseline = (float*) node->getContext(); + float* baseline = (float*) YGNodeGetContext(node); return *baseline; } @@ -36,9 +35,9 @@ TEST(YogaTest, align_baseline_customer_func) { float baselineValue = 10; const YGNodeRef root_child1_child0 = YGNodeNew(); - root_child1_child0->setContext(&baselineValue); + YGNodeSetContext(root_child1_child0, &baselineValue); YGNodeStyleSetWidth(root_child1_child0, 50); - root_child1_child0->setBaselineFunc(_baseline); + YGNodeSetBaselineFunc(root_child1_child0, _baseline); YGNodeStyleSetHeight(root_child1_child0, 20); YGNodeInsertChild(root_child1, root_child1_child0, 0); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); diff --git a/tests/YGDirtiedTest.cpp b/tests/YGDirtiedTest.cpp index c3e0785115..f996ac5f1b 100644 --- a/tests/YGDirtiedTest.cpp +++ b/tests/YGDirtiedTest.cpp @@ -6,10 +6,13 @@ */ #include -#include +#include +#include + +using namespace facebook; static void _dirtied(YGNodeRef node) { - int* dirtiedCount = (int*) node->getContext(); + int* dirtiedCount = (int*) YGNodeGetContext(node); (*dirtiedCount)++; } @@ -22,17 +25,17 @@ TEST(YogaTest, dirtied) { YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); int dirtiedCount = 0; - root->setContext(&dirtiedCount); - root->setDirtiedFunc(_dirtied); + YGNodeSetContext(root, &dirtiedCount); + YGNodeSetDirtiedFunc(root, _dirtied); ASSERT_EQ(0, dirtiedCount); // `_dirtied` MUST be called in case of explicit dirtying. - root->setDirty(true); + static_cast(root)->setDirty(true); ASSERT_EQ(1, dirtiedCount); // `_dirtied` MUST be called ONCE. - root->setDirty(true); + static_cast(root)->setDirty(true); ASSERT_EQ(1, dirtiedCount); } @@ -55,17 +58,17 @@ TEST(YogaTest, dirtied_propagation) { YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); int dirtiedCount = 0; - root->setContext(&dirtiedCount); - root->setDirtiedFunc(_dirtied); + YGNodeSetContext(root, &dirtiedCount); + YGNodeSetDirtiedFunc(root, _dirtied); ASSERT_EQ(0, dirtiedCount); // `_dirtied` MUST be called for the first time. - root_child0->markDirtyAndPropagate(); + static_cast(root_child0)->markDirtyAndPropagate(); ASSERT_EQ(1, dirtiedCount); // `_dirtied` must NOT be called for the second time. - root_child0->markDirtyAndPropagate(); + static_cast(root_child0)->markDirtyAndPropagate(); ASSERT_EQ(1, dirtiedCount); } @@ -88,20 +91,20 @@ TEST(YogaTest, dirtied_hierarchy) { YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); int dirtiedCount = 0; - root_child0->setContext(&dirtiedCount); - root_child0->setDirtiedFunc(_dirtied); + YGNodeSetContext(root_child0, &dirtiedCount); + YGNodeSetDirtiedFunc(root_child0, _dirtied); ASSERT_EQ(0, dirtiedCount); // `_dirtied` must NOT be called for descendants. - root->markDirtyAndPropagate(); + static_cast(root)->markDirtyAndPropagate(); ASSERT_EQ(0, dirtiedCount); // `_dirtied` must NOT be called for the sibling node. - root_child1->markDirtyAndPropagate(); + static_cast(root_child1)->markDirtyAndPropagate(); ASSERT_EQ(0, dirtiedCount); // `_dirtied` MUST be called in case of explicit dirtying. - root_child0->markDirtyAndPropagate(); + static_cast(root_child0)->markDirtyAndPropagate(); ASSERT_EQ(1, dirtiedCount); } diff --git a/tests/YGDirtyMarkingTest.cpp b/tests/YGDirtyMarkingTest.cpp index 4597f90715..b548a921e9 100644 --- a/tests/YGDirtyMarkingTest.cpp +++ b/tests/YGDirtyMarkingTest.cpp @@ -6,7 +6,7 @@ */ #include -#include +#include TEST(YogaTest, dirty_propagation) { const YGNodeRef root = YGNodeNew(); @@ -28,15 +28,15 @@ TEST(YogaTest, dirty_propagation) { YGNodeStyleSetWidth(root_child0, 20); - EXPECT_TRUE(root_child0->isDirty()); - EXPECT_FALSE(root_child1->isDirty()); - EXPECT_TRUE(root->isDirty()); + EXPECT_TRUE(YGNodeIsDirty(root_child0)); + EXPECT_FALSE(YGNodeIsDirty(root_child1)); + EXPECT_TRUE(YGNodeIsDirty(root)); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); - EXPECT_FALSE(root_child0->isDirty()); - EXPECT_FALSE(root_child1->isDirty()); - EXPECT_FALSE(root->isDirty()); + EXPECT_FALSE(YGNodeIsDirty(root_child0)); + EXPECT_FALSE(YGNodeIsDirty(root_child1)); + EXPECT_FALSE(YGNodeIsDirty(root)); YGNodeFreeRecursive(root); } @@ -61,9 +61,9 @@ TEST(YogaTest, dirty_propagation_only_if_prop_changed) { YGNodeStyleSetWidth(root_child0, 50); - EXPECT_FALSE(root_child0->isDirty()); - EXPECT_FALSE(root_child1->isDirty()); - EXPECT_FALSE(root->isDirty()); + EXPECT_FALSE(YGNodeIsDirty(root_child0)); + EXPECT_FALSE(YGNodeIsDirty(root_child1)); + EXPECT_FALSE(YGNodeIsDirty(root)); YGNodeFreeRecursive(root); } @@ -91,26 +91,26 @@ TEST(YogaTest, dirty_propagation_changing_layout_config) { YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); - EXPECT_FALSE(root->isDirty()); - EXPECT_FALSE(root_child0->isDirty()); - EXPECT_FALSE(root_child1->isDirty()); - EXPECT_FALSE(root_child0_child0->isDirty()); + EXPECT_FALSE(YGNodeIsDirty(root)); + EXPECT_FALSE(YGNodeIsDirty(root_child0)); + EXPECT_FALSE(YGNodeIsDirty(root_child1)); + EXPECT_FALSE(YGNodeIsDirty(root_child0_child0)); YGConfigRef newConfig = YGConfigNew(); YGConfigSetErrata(newConfig, YGErrataStretchFlexBasis); YGNodeSetConfig(root_child0, newConfig); - EXPECT_TRUE(root->isDirty()); - EXPECT_TRUE(root_child0->isDirty()); - EXPECT_FALSE(root_child1->isDirty()); - EXPECT_FALSE(root_child0_child0->isDirty()); + EXPECT_TRUE(YGNodeIsDirty(root)); + EXPECT_TRUE(YGNodeIsDirty(root_child0)); + EXPECT_FALSE(YGNodeIsDirty(root_child1)); + EXPECT_FALSE(YGNodeIsDirty(root_child0_child0)); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); - EXPECT_FALSE(root->isDirty()); - EXPECT_FALSE(root_child0->isDirty()); - EXPECT_FALSE(root_child1->isDirty()); - EXPECT_FALSE(root_child0_child0->isDirty()); + EXPECT_FALSE(YGNodeIsDirty(root)); + EXPECT_FALSE(YGNodeIsDirty(root_child0)); + EXPECT_FALSE(YGNodeIsDirty(root_child1)); + EXPECT_FALSE(YGNodeIsDirty(root_child0_child0)); YGConfigFree(newConfig); YGNodeFreeRecursive(root); @@ -139,10 +139,10 @@ TEST(YogaTest, dirty_propagation_changing_benign_config) { YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); - EXPECT_FALSE(root->isDirty()); - EXPECT_FALSE(root_child0->isDirty()); - EXPECT_FALSE(root_child1->isDirty()); - EXPECT_FALSE(root_child0_child0->isDirty()); + EXPECT_FALSE(YGNodeIsDirty(root)); + EXPECT_FALSE(YGNodeIsDirty(root_child0)); + EXPECT_FALSE(YGNodeIsDirty(root_child1)); + EXPECT_FALSE(YGNodeIsDirty(root_child0_child0)); YGConfigRef newConfig = YGConfigNew(); YGConfigSetLogger( @@ -152,10 +152,10 @@ TEST(YogaTest, dirty_propagation_changing_benign_config) { }); YGNodeSetConfig(root_child0, newConfig); - EXPECT_FALSE(root->isDirty()); - EXPECT_FALSE(root_child0->isDirty()); - EXPECT_FALSE(root_child1->isDirty()); - EXPECT_FALSE(root_child0_child0->isDirty()); + EXPECT_FALSE(YGNodeIsDirty(root)); + EXPECT_FALSE(YGNodeIsDirty(root_child0)); + EXPECT_FALSE(YGNodeIsDirty(root_child1)); + EXPECT_FALSE(YGNodeIsDirty(root_child0_child0)); YGConfigFree(newConfig); YGNodeFreeRecursive(root); @@ -224,11 +224,11 @@ TEST(YogaTest, dirty_node_only_if_children_are_actually_removed) { const YGNodeRef child1 = YGNodeNew(); YGNodeRemoveChild(root, child1); - EXPECT_FALSE(root->isDirty()); + EXPECT_FALSE(YGNodeIsDirty(root)); YGNodeFree(child1); YGNodeRemoveChild(root, child0); - EXPECT_TRUE(root->isDirty()); + EXPECT_TRUE(YGNodeIsDirty(root)); YGNodeFree(child0); YGNodeFreeRecursive(root); @@ -241,12 +241,11 @@ TEST(YogaTest, dirty_node_only_if_undefined_values_gets_set_to_undefined) { YGNodeStyleSetMinWidth(root, YGUndefined); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); - - EXPECT_FALSE(root->isDirty()); + EXPECT_FALSE(YGNodeIsDirty(root)); YGNodeStyleSetMinWidth(root, YGUndefined); - EXPECT_FALSE(root->isDirty()); + EXPECT_FALSE(YGNodeIsDirty(root)); YGNodeFreeRecursive(root); } diff --git a/tests/YGMeasureCacheTest.cpp b/tests/YGMeasureCacheTest.cpp index 86f9f5e644..a973837413 100644 --- a/tests/YGMeasureCacheTest.cpp +++ b/tests/YGMeasureCacheTest.cpp @@ -6,7 +6,6 @@ */ #include -#include #include static YGSize _measureMax( @@ -15,7 +14,7 @@ static YGSize _measureMax( YGMeasureMode widthMode, float height, YGMeasureMode heightMode) { - int* measureCount = (int*) node->getContext(); + int* measureCount = (int*) YGNodeGetContext(node); (*measureCount)++; return YGSize{ @@ -30,7 +29,7 @@ static YGSize _measureMin( YGMeasureMode widthMode, float height, YGMeasureMode heightMode) { - int* measureCount = (int*) node->getContext(); + int* measureCount = (int*) YGNodeGetContext(node); *measureCount = *measureCount + 1; return YGSize{ widthMode == YGMeasureModeUndefined || @@ -50,7 +49,7 @@ static YGSize _measure_84_49( YGMeasureMode /*widthMode*/, float /*height*/, YGMeasureMode /*heightMode*/) { - int* measureCount = (int*) node->getContext(); + int* measureCount = (int*) YGNodeGetContext(node); if (measureCount) { (*measureCount)++; } @@ -67,8 +66,8 @@ TEST(YogaTest, measure_once_single_flexible_child) { const YGNodeRef root_child0 = YGNodeNew(); int measureCount = 0; - root_child0->setContext(&measureCount); - root_child0->setMeasureFunc(_measureMax); + YGNodeSetContext(root_child0, &measureCount); + YGNodeSetMeasureFunc(root_child0, _measureMax); YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeInsertChild(root, root_child0, 0); @@ -84,8 +83,8 @@ TEST(YogaTest, remeasure_with_same_exact_width_larger_than_needed_height) { const YGNodeRef root_child0 = YGNodeNew(); int measureCount = 0; - root_child0->setContext(&measureCount); - root_child0->setMeasureFunc(_measureMin); + YGNodeSetContext(root_child0, &measureCount); + YGNodeSetMeasureFunc(root_child0, _measureMin); YGNodeInsertChild(root, root_child0, 0); YGNodeCalculateLayout(root, 100, 100, YGDirectionLTR); @@ -102,8 +101,8 @@ TEST(YogaTest, remeasure_with_same_atmost_width_larger_than_needed_height) { const YGNodeRef root_child0 = YGNodeNew(); int measureCount = 0; - root_child0->setContext(&measureCount); - root_child0->setMeasureFunc(_measureMin); + YGNodeSetContext(root_child0, &measureCount); + YGNodeSetMeasureFunc(root_child0, _measureMin); YGNodeInsertChild(root, root_child0, 0); YGNodeCalculateLayout(root, 100, 100, YGDirectionLTR); @@ -120,8 +119,8 @@ TEST(YogaTest, remeasure_with_computed_width_larger_than_needed_height) { const YGNodeRef root_child0 = YGNodeNew(); int measureCount = 0; - root_child0->setContext(&measureCount); - root_child0->setMeasureFunc(_measureMin); + YGNodeSetContext(root_child0, &measureCount); + YGNodeSetMeasureFunc(root_child0, _measureMin); YGNodeInsertChild(root, root_child0, 0); YGNodeCalculateLayout(root, 100, 100, YGDirectionLTR); @@ -139,8 +138,8 @@ TEST(YogaTest, remeasure_with_atmost_computed_width_undefined_height) { const YGNodeRef root_child0 = YGNodeNew(); int measureCount = 0; - root_child0->setContext(&measureCount); - root_child0->setMeasureFunc(_measureMin); + YGNodeSetContext(root_child0, &measureCount); + YGNodeSetMeasureFunc(root_child0, _measureMin); YGNodeInsertChild(root, root_child0, 0); YGNodeCalculateLayout(root, 100, YGUndefined, YGDirectionLTR); @@ -167,8 +166,8 @@ TEST( YGNodeInsertChild(root, root_child0, 0); const YGNodeRef root_child0_child0 = YGNodeNew(); - root_child0_child0->setContext(&measureCount); - root_child0_child0->setMeasureFunc(_measure_84_49); + YGNodeSetContext(root_child0_child0, &measureCount); + YGNodeSetMeasureFunc(root_child0_child0, _measure_84_49); YGNodeInsertChild(root_child0, root_child0_child0, 0); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); diff --git a/tests/YGMeasureModeTest.cpp b/tests/YGMeasureModeTest.cpp index 6547ed66a5..e9f977aa4e 100644 --- a/tests/YGMeasureModeTest.cpp +++ b/tests/YGMeasureModeTest.cpp @@ -6,7 +6,6 @@ */ #include -#include #include struct _MeasureConstraint { @@ -28,7 +27,7 @@ static YGSize _measure( float height, YGMeasureMode heightMode) { struct _MeasureConstraintList* constraintList = - (struct _MeasureConstraintList*) node->getContext(); + (struct _MeasureConstraintList*) YGNodeGetContext(node); struct _MeasureConstraint* constraints = constraintList->constraints; uint32_t currentIndex = constraintList->length; (&constraints[currentIndex])->width = width; @@ -55,10 +54,8 @@ TEST(YogaTest, exactly_measure_stretched_child_column) { YGNodeStyleSetHeight(root, 100); const YGNodeRef root_child0 = YGNodeNew(); - // root_child0->setContext(&constraintList); - root_child0->setContext(&constraintList); - root_child0->setMeasureFunc(_measure); - // root_child0->setMeasureFunc(_measure); + YGNodeSetContext(root_child0, &constraintList); + YGNodeSetMeasureFunc(root_child0, _measure); YGNodeInsertChild(root, root_child0, 0); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); @@ -85,9 +82,8 @@ TEST(YogaTest, exactly_measure_stretched_child_row) { YGNodeStyleSetHeight(root, 100); const YGNodeRef root_child0 = YGNodeNew(); - // root_child0->setContext(&constraintList); - root_child0->setContext(&constraintList); - root_child0->setMeasureFunc(_measure); + YGNodeSetContext(root_child0, &constraintList); + YGNodeSetMeasureFunc(root_child0, _measure); YGNodeInsertChild(root, root_child0, 0); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); @@ -113,8 +109,8 @@ TEST(YogaTest, at_most_main_axis_column) { YGNodeStyleSetHeight(root, 100); const YGNodeRef root_child0 = YGNodeNew(); - root_child0->setContext(&constraintList); - root_child0->setMeasureFunc(_measure); + YGNodeSetContext(root_child0, &constraintList); + YGNodeSetMeasureFunc(root_child0, _measure); YGNodeInsertChild(root, root_child0, 0); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); @@ -141,8 +137,8 @@ TEST(YogaTest, at_most_cross_axis_column) { YGNodeStyleSetHeight(root, 100); const YGNodeRef root_child0 = YGNodeNew(); - root_child0->setContext(&constraintList); - root_child0->setMeasureFunc(_measure); + YGNodeSetContext(root_child0, &constraintList); + YGNodeSetMeasureFunc(root_child0, _measure); YGNodeInsertChild(root, root_child0, 0); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); @@ -169,8 +165,8 @@ TEST(YogaTest, at_most_main_axis_row) { YGNodeStyleSetHeight(root, 100); const YGNodeRef root_child0 = YGNodeNew(); - root_child0->setContext(&constraintList); - root_child0->setMeasureFunc(_measure); + YGNodeSetContext(root_child0, &constraintList); + YGNodeSetMeasureFunc(root_child0, _measure); YGNodeInsertChild(root, root_child0, 0); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); @@ -198,8 +194,8 @@ TEST(YogaTest, at_most_cross_axis_row) { YGNodeStyleSetHeight(root, 100); const YGNodeRef root_child0 = YGNodeNew(); - root_child0->setContext(&constraintList); - root_child0->setMeasureFunc(_measure); + YGNodeSetContext(root_child0, &constraintList); + YGNodeSetMeasureFunc(root_child0, _measure); YGNodeInsertChild(root, root_child0, 0); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); @@ -225,8 +221,8 @@ TEST(YogaTest, flex_child) { const YGNodeRef root_child0 = YGNodeNew(); YGNodeStyleSetFlexGrow(root_child0, 1); - root_child0->setContext(&constraintList); - root_child0->setMeasureFunc(_measure); + YGNodeSetContext(root_child0, &constraintList); + YGNodeSetMeasureFunc(root_child0, _measure); YGNodeInsertChild(root, root_child0, 0); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); @@ -256,8 +252,8 @@ TEST(YogaTest, flex_child_with_flex_basis) { const YGNodeRef root_child0 = YGNodeNew(); YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexBasis(root_child0, 0); - root_child0->setContext(&constraintList); - root_child0->setMeasureFunc(_measure); + YGNodeSetContext(root_child0, &constraintList); + YGNodeSetMeasureFunc(root_child0, _measure); YGNodeInsertChild(root, root_child0, 0); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); @@ -285,8 +281,8 @@ TEST(YogaTest, overflow_scroll_column) { YGNodeStyleSetWidth(root, 100); const YGNodeRef root_child0 = YGNodeNew(); - root_child0->setContext(&constraintList); - root_child0->setMeasureFunc(_measure); + YGNodeSetContext(root_child0, &constraintList); + YGNodeSetMeasureFunc(root_child0, _measure); YGNodeInsertChild(root, root_child0, 0); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); @@ -318,8 +314,8 @@ TEST(YogaTest, overflow_scroll_row) { YGNodeStyleSetWidth(root, 100); const YGNodeRef root_child0 = YGNodeNew(); - root_child0->setContext(&constraintList); - root_child0->setMeasureFunc(_measure); + YGNodeSetContext(root_child0, &constraintList); + YGNodeSetMeasureFunc(root_child0, _measure); YGNodeInsertChild(root, root_child0, 0); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); diff --git a/tests/YGMeasureTest.cpp b/tests/YGMeasureTest.cpp index bb046b58aa..e6d851cdc2 100644 --- a/tests/YGMeasureTest.cpp +++ b/tests/YGMeasureTest.cpp @@ -6,7 +6,6 @@ */ #include -#include #include static YGSize _measure( @@ -15,7 +14,7 @@ static YGSize _measure( YGMeasureMode /*widthMode*/, float /*height*/, YGMeasureMode /*heightMode*/) { - int* measureCount = (int*) node->getContext(); + int* measureCount = (int*) YGNodeGetContext(node); if (measureCount) { (*measureCount)++; } @@ -56,8 +55,8 @@ TEST(YogaTest, dont_measure_single_grow_shrink_child) { int measureCount = 0; const YGNodeRef root_child0 = YGNodeNew(); - root_child0->setContext(&measureCount); - root_child0->setMeasureFunc(_measure); + YGNodeSetContext(root_child0, &measureCount); + YGNodeSetMeasureFunc(root_child0, _measure); YGNodeStyleSetFlexGrow(root_child0, 1); YGNodeStyleSetFlexShrink(root_child0, 1); YGNodeInsertChild(root, root_child0, 0); @@ -79,8 +78,8 @@ TEST(YogaTest, measure_absolute_child_with_no_constraints) { const YGNodeRef root_child0_child0 = YGNodeNew(); YGNodeStyleSetPositionType(root_child0_child0, YGPositionTypeAbsolute); - root_child0_child0->setContext(&measureCount); - root_child0_child0->setMeasureFunc(_measure); + YGNodeSetContext(root_child0_child0, &measureCount); + YGNodeSetMeasureFunc(root_child0_child0, _measure); YGNodeInsertChild(root_child0, root_child0_child0, 0); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); @@ -99,8 +98,8 @@ TEST(YogaTest, dont_measure_when_min_equals_max) { int measureCount = 0; const YGNodeRef root_child0 = YGNodeNew(); - root_child0->setContext(&measureCount); - root_child0->setMeasureFunc(_measure); + YGNodeSetContext(root_child0, &measureCount); + YGNodeSetMeasureFunc(root_child0, _measure); YGNodeStyleSetMinWidth(root_child0, 10); YGNodeStyleSetMaxWidth(root_child0, 10); YGNodeStyleSetMinHeight(root_child0, 10); @@ -127,8 +126,8 @@ TEST(YogaTest, dont_measure_when_min_equals_max_percentages) { int measureCount = 0; const YGNodeRef root_child0 = YGNodeNew(); - root_child0->setContext(&measureCount); - root_child0->setMeasureFunc(_measure); + YGNodeSetContext(root_child0, &measureCount); + YGNodeSetMeasureFunc(root_child0, _measure); YGNodeStyleSetMinWidthPercent(root_child0, 10); YGNodeStyleSetMaxWidthPercent(root_child0, 10); YGNodeStyleSetMinHeightPercent(root_child0, 10); @@ -152,7 +151,7 @@ TEST(YogaTest, measure_nodes_with_margin_auto_and_stretch) { YGNodeStyleSetHeight(root, 500); const YGNodeRef root_child0 = YGNodeNew(); - root_child0->setMeasureFunc(_measure); + YGNodeSetMeasureFunc(root_child0, _measure); YGNodeStyleSetMarginAuto(root_child0, YGEdgeLeft); YGNodeInsertChild(root, root_child0, 0); @@ -175,8 +174,8 @@ TEST(YogaTest, dont_measure_when_min_equals_max_mixed_width_percent) { int measureCount = 0; const YGNodeRef root_child0 = YGNodeNew(); - root_child0->setContext(&measureCount); - root_child0->setMeasureFunc(_measure); + YGNodeSetContext(root_child0, &measureCount); + YGNodeSetMeasureFunc(root_child0, _measure); YGNodeStyleSetMinWidthPercent(root_child0, 10); YGNodeStyleSetMaxWidthPercent(root_child0, 10); YGNodeStyleSetMinHeight(root_child0, 10); @@ -203,8 +202,8 @@ TEST(YogaTest, dont_measure_when_min_equals_max_mixed_height_percent) { int measureCount = 0; const YGNodeRef root_child0 = YGNodeNew(); - root_child0->setContext(&measureCount); - root_child0->setMeasureFunc(_measure); + YGNodeSetContext(root_child0, &measureCount); + YGNodeSetMeasureFunc(root_child0, _measure); YGNodeStyleSetMinWidth(root_child0, 10); YGNodeStyleSetMaxWidth(root_child0, 10); YGNodeStyleSetMinHeightPercent(root_child0, 10); @@ -228,7 +227,7 @@ TEST(YogaTest, measure_enough_size_should_be_in_single_line) { const YGNodeRef root_child0 = YGNodeNew(); YGNodeStyleSetAlignSelf(root_child0, YGAlignFlexStart); - root_child0->setMeasureFunc(_simulate_wrapping_text); + YGNodeSetMeasureFunc(root_child0, _simulate_wrapping_text); YGNodeInsertChild(root, root_child0, 0); @@ -247,7 +246,7 @@ TEST(YogaTest, measure_not_enough_size_should_wrap) { const YGNodeRef root_child0 = YGNodeNew(); YGNodeStyleSetAlignSelf(root_child0, YGAlignFlexStart); // YGNodeSetMeasureFunc(root_child0, _simulate_wrapping_text); - root_child0->setMeasureFunc(_simulate_wrapping_text); + YGNodeSetMeasureFunc(root_child0, _simulate_wrapping_text); YGNodeInsertChild(root, root_child0, 0); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); @@ -269,8 +268,8 @@ TEST(YogaTest, measure_zero_space_should_grow) { const YGNodeRef root_child0 = YGNodeNew(); YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionColumn); YGNodeStyleSetPadding(root_child0, YGEdgeAll, 100); - root_child0->setContext(&measureCount); - root_child0->setMeasureFunc(_measure); + YGNodeSetContext(root_child0, &measureCount); + YGNodeSetMeasureFunc(root_child0, _measure); YGNodeInsertChild(root, root_child0, 0); @@ -295,8 +294,7 @@ TEST(YogaTest, measure_flex_direction_row_and_padding) { YGNodeStyleSetHeight(root, 50); const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - root_child0->setMeasureFunc(_simulate_wrapping_text); - // YGNodeSetMeasureFunc(root_child0, _simulate_wrapping_text); + YGNodeSetMeasureFunc(root_child0, _simulate_wrapping_text); YGNodeInsertChild(root, root_child0, 0); const YGNodeRef root_child1 = YGNodeNewWithConfig(config); @@ -335,7 +333,7 @@ TEST(YogaTest, measure_flex_direction_column_and_padding) { YGNodeStyleSetHeight(root, 50); const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - root_child0->setMeasureFunc(_simulate_wrapping_text); + YGNodeSetMeasureFunc(root_child0, _simulate_wrapping_text); // YGNodeSetMeasureFunc(root_child0, _simulate_wrapping_text); YGNodeInsertChild(root, root_child0, 0); @@ -376,7 +374,7 @@ TEST(YogaTest, measure_flex_direction_row_no_padding) { const YGNodeRef root_child0 = YGNodeNewWithConfig(config); // YGNodeSetMeasureFunc(root_child0, _simulate_wrapping_text); - root_child0->setMeasureFunc(_simulate_wrapping_text); + YGNodeSetMeasureFunc(root_child0, _simulate_wrapping_text); YGNodeInsertChild(root, root_child0, 0); const YGNodeRef root_child1 = YGNodeNewWithConfig(config); @@ -416,7 +414,7 @@ TEST(YogaTest, measure_flex_direction_row_no_padding_align_items_flexstart) { YGNodeStyleSetAlignItems(root, YGAlignFlexStart); const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - root_child0->setMeasureFunc(_simulate_wrapping_text); + YGNodeSetMeasureFunc(root_child0, _simulate_wrapping_text); YGNodeInsertChild(root, root_child0, 0); const YGNodeRef root_child1 = YGNodeNewWithConfig(config); @@ -455,7 +453,7 @@ TEST(YogaTest, measure_with_fixed_size) { YGNodeStyleSetHeight(root, 50); const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - root_child0->setMeasureFunc(_simulate_wrapping_text); + YGNodeSetMeasureFunc(root_child0, _simulate_wrapping_text); YGNodeStyleSetWidth(root_child0, 10); YGNodeStyleSetHeight(root_child0, 10); YGNodeInsertChild(root, root_child0, 0); @@ -496,7 +494,7 @@ TEST(YogaTest, measure_with_flex_shrink) { YGNodeStyleSetHeight(root, 50); const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - root_child0->setMeasureFunc(_simulate_wrapping_text); + YGNodeSetMeasureFunc(root_child0, _simulate_wrapping_text); YGNodeStyleSetFlexShrink(root_child0, 1); YGNodeInsertChild(root, root_child0, 0); @@ -535,7 +533,7 @@ TEST(YogaTest, measure_no_padding) { YGNodeStyleSetHeight(root, 50); const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - root_child0->setMeasureFunc(_simulate_wrapping_text); + YGNodeSetMeasureFunc(root_child0, _simulate_wrapping_text); YGNodeStyleSetFlexShrink(root_child0, 1); YGNodeInsertChild(root, root_child0, 0); @@ -568,7 +566,7 @@ TEST(YogaTest, measure_no_padding) { #if GTEST_HAS_DEATH_TEST TEST(YogaDeathTest, cannot_add_child_to_node_with_measure_func) { const YGNodeRef root = YGNodeNew(); - root->setMeasureFunc(_measure); + YGNodeSetMeasureFunc(root, _measure); const YGNodeRef root_child0 = YGNodeNew(); #if defined(__cpp_exceptions) @@ -585,9 +583,10 @@ TEST(YogaDeathTest, cannot_add_nonnull_measure_func_to_non_leaf_node) { const YGNodeRef root_child0 = YGNodeNew(); YGNodeInsertChild(root, root_child0, 0); #if defined(__cpp_exceptions) - ASSERT_THROW(root->setMeasureFunc(_measure), std::logic_error); + ASSERT_THROW(YGNodeSetMeasureFunc(root, _measure), std::logic_error); #else // !defined(__cpp_exceptions) - ASSERT_DEATH(root->setMeasureFunc(_measure), "Cannot set measure function.*"); + ASSERT_DEATH( + YGNodeSetMeasureFunc(root, _measure), "Cannot set measure function.*"); #endif // defined(__cpp_exceptions) YGNodeFreeRecursive(root); } @@ -597,8 +596,8 @@ TEST(YogaDeathTest, cannot_add_nonnull_measure_func_to_non_leaf_node) { TEST(YogaTest, can_nullify_measure_func_on_any_node) { const YGNodeRef root = YGNodeNew(); YGNodeInsertChild(root, YGNodeNew(), 0); - root->setMeasureFunc(nullptr); - ASSERT_TRUE(!root->hasMeasureFunc()); + YGNodeSetMeasureFunc(root, nullptr); + ASSERT_TRUE(!YGNodeHasMeasureFunc(root)); YGNodeFreeRecursive(root); } @@ -611,7 +610,7 @@ TEST(YogaTest, cant_call_negative_measure) { YGNodeStyleSetHeight(root, 10); const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - root_child0->setMeasureFunc(_measure_assert_negative); + YGNodeSetMeasureFunc(root_child0, _measure_assert_negative); YGNodeStyleSetMargin(root_child0, YGEdgeTop, 20); YGNodeInsertChild(root, root_child0, 0); @@ -630,7 +629,7 @@ TEST(YogaTest, cant_call_negative_measure_horizontal) { YGNodeStyleSetHeight(root, 20); const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - root_child0->setMeasureFunc(_measure_assert_negative); + YGNodeSetMeasureFunc(root_child0, _measure_assert_negative); YGNodeStyleSetMargin(root_child0, YGEdgeStart, 20); YGNodeInsertChild(root, root_child0, 0); @@ -674,7 +673,7 @@ TEST(YogaTest, percent_with_text_node) { YGNodeInsertChild(root, root_child0, 0); const YGNodeRef root_child1 = YGNodeNewWithConfig(config); - root_child1->setMeasureFunc(_measure_90_10); + YGNodeSetMeasureFunc(root_child1, _measure_90_10); YGNodeStyleSetMaxWidthPercent(root_child1, 50); YGNodeStyleSetPaddingPercent(root_child1, YGEdgeTop, 50); YGNodeInsertChild(root, root_child1, 1); @@ -713,28 +712,28 @@ TEST(YogaTest, percent_margin_with_measure_func) { YGNodeStyleSetWidth(root_child0, 100); YGNodeStyleSetHeight(root_child0, 100); YGNodeStyleSetMargin(root_child0, YGEdgeTop, 0); - root_child0->setMeasureFunc(_measure_100_100); + YGNodeSetMeasureFunc(root_child0, _measure_100_100); YGNodeInsertChild(root, root_child0, 0); const YGNodeRef root_child1 = YGNodeNewWithConfig(config); YGNodeStyleSetWidth(root_child1, 100); YGNodeStyleSetHeight(root_child1, 100); YGNodeStyleSetMargin(root_child1, YGEdgeTop, 100); - root_child1->setMeasureFunc(_measure_100_100); + YGNodeSetMeasureFunc(root_child1, _measure_100_100); YGNodeInsertChild(root, root_child1, 1); const YGNodeRef root_child2 = YGNodeNewWithConfig(config); YGNodeStyleSetWidth(root_child2, 100); YGNodeStyleSetHeight(root_child2, 100); YGNodeStyleSetMarginPercent(root_child2, YGEdgeTop, 10); - root_child2->setMeasureFunc(_measure_100_100); + YGNodeSetMeasureFunc(root_child2, _measure_100_100); YGNodeInsertChild(root, root_child2, 2); const YGNodeRef root_child3 = YGNodeNewWithConfig(config); YGNodeStyleSetWidth(root_child3, 100); YGNodeStyleSetHeight(root_child3, 100); YGNodeStyleSetMarginPercent(root_child3, YGEdgeTop, 20); - root_child3->setMeasureFunc(_measure_100_100); + YGNodeSetMeasureFunc(root_child3, _measure_100_100); YGNodeInsertChild(root, root_child3, 3); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); @@ -783,24 +782,24 @@ TEST(YogaTest, percent_padding_with_measure_func) { YGNodeStyleSetWidth(root_child0, 100); YGNodeStyleSetHeight(root_child0, 100); YGNodeStyleSetPadding(root_child0, YGEdgeTop, 0); - root_child0->setMeasureFunc(_measure_100_100); + YGNodeSetMeasureFunc(root_child0, _measure_100_100); YGNodeInsertChild(root, root_child0, 0); const YGNodeRef root_child1 = YGNodeNewWithConfig(config); YGNodeStyleSetWidth(root_child1, 100); YGNodeStyleSetHeight(root_child1, 100); YGNodeStyleSetPadding(root_child1, YGEdgeTop, 100); - root_child1->setMeasureFunc(_measure_100_100); + YGNodeSetMeasureFunc(root_child1, _measure_100_100); YGNodeInsertChild(root, root_child1, 1); const YGNodeRef root_child2 = YGNodeNewWithConfig(config); YGNodeStyleSetPaddingPercent(root_child2, YGEdgeTop, 10); - root_child2->setMeasureFunc(_measure_100_100); + YGNodeSetMeasureFunc(root_child2, _measure_100_100); YGNodeInsertChild(root, root_child2, 2); const YGNodeRef root_child3 = YGNodeNewWithConfig(config); YGNodeStyleSetPaddingPercent(root_child3, YGEdgeTop, 20); - root_child3->setMeasureFunc(_measure_100_100); + YGNodeSetMeasureFunc(root_child3, _measure_100_100); YGNodeInsertChild(root, root_child3, 3); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); @@ -849,26 +848,26 @@ TEST(YogaTest, percent_padding_and_percent_margin_with_measure_func) { YGNodeStyleSetWidth(root_child0, 100); YGNodeStyleSetHeight(root_child0, 100); YGNodeStyleSetPadding(root_child0, YGEdgeTop, 0); - root_child0->setMeasureFunc(_measure_100_100); + YGNodeSetMeasureFunc(root_child0, _measure_100_100); YGNodeInsertChild(root, root_child0, 0); const YGNodeRef root_child1 = YGNodeNewWithConfig(config); YGNodeStyleSetWidth(root_child1, 100); YGNodeStyleSetHeight(root_child1, 100); YGNodeStyleSetPadding(root_child1, YGEdgeTop, 100); - root_child1->setMeasureFunc(_measure_100_100); + YGNodeSetMeasureFunc(root_child1, _measure_100_100); YGNodeInsertChild(root, root_child1, 1); const YGNodeRef root_child2 = YGNodeNewWithConfig(config); YGNodeStyleSetPaddingPercent(root_child2, YGEdgeTop, 10); YGNodeStyleSetMarginPercent(root_child2, YGEdgeTop, 10); - root_child2->setMeasureFunc(_measure_100_100); + YGNodeSetMeasureFunc(root_child2, _measure_100_100); YGNodeInsertChild(root, root_child2, 2); const YGNodeRef root_child3 = YGNodeNewWithConfig(config); YGNodeStyleSetPaddingPercent(root_child3, YGEdgeTop, 20); YGNodeStyleSetMarginPercent(root_child3, YGEdgeTop, 20); - root_child3->setMeasureFunc(_measure_100_100); + YGNodeSetMeasureFunc(root_child3, _measure_100_100); YGNodeInsertChild(root, root_child3, 3); YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR); diff --git a/tests/YGNodeCallbackTest.cpp b/tests/YGNodeCallbackTest.cpp index 8c438414e0..9a59497563 100644 --- a/tests/YGNodeCallbackTest.cpp +++ b/tests/YGNodeCallbackTest.cpp @@ -6,34 +6,34 @@ */ #include -#include +#include #include +using namespace facebook::yoga; + inline bool operator==(const YGSize& lhs, const YGSize& rhs) { return lhs.width == rhs.width && lhs.height == rhs.height; } -void PrintTo(const YGSize&, std::ostream*); - -TEST(YGNode, hasMeasureFunc_initial) { - auto n = YGNode{}; +TEST(Node, hasMeasureFunc_initial) { + auto n = Node{}; ASSERT_FALSE(n.hasMeasureFunc()); } -TEST(YGNode, hasMeasureFunc_with_measure_fn) { - auto n = YGNode{}; - n.setMeasureFunc([](YGNode*, float, YGMeasureMode, float, YGMeasureMode) { +TEST(Node, hasMeasureFunc_with_measure_fn) { + auto n = Node{}; + n.setMeasureFunc([](YGNodeRef, float, YGMeasureMode, float, YGMeasureMode) { return YGSize{}; }); ASSERT_TRUE(n.hasMeasureFunc()); } -TEST(YGNode, measure_with_measure_fn) { - auto n = YGNode{}; +TEST(Node, measure_with_measure_fn) { + auto n = Node{}; n.setMeasureFunc( - [](YGNode*, float w, YGMeasureMode wm, float h, YGMeasureMode hm) { - return YGSize{w * wm, h / hm}; + [](YGNodeRef, float w, YGMeasureMode wm, float h, YGMeasureMode hm) { + return YGSize{w * static_cast(wm), h / static_cast(hm)}; }); ASSERT_EQ( @@ -41,10 +41,10 @@ TEST(YGNode, measure_with_measure_fn) { (YGSize{23, 12})); } -TEST(YGNode, measure_with_context_measure_fn) { - auto n = YGNode{}; +TEST(Node, measure_with_context_measure_fn) { + auto n = Node{}; n.setMeasureFunc( - [](YGNode*, float, YGMeasureMode, float, YGMeasureMode, void* ctx) { + [](YGNodeRef, float, YGMeasureMode, float, YGMeasureMode, void* ctx) { return *(YGSize*) ctx; }); @@ -54,15 +54,15 @@ TEST(YGNode, measure_with_context_measure_fn) { result); } -TEST(YGNode, switching_measure_fn_types) { - auto n = YGNode{}; +TEST(Node, switching_measure_fn_types) { + auto n = Node{}; n.setMeasureFunc( - [](YGNode*, float, YGMeasureMode, float, YGMeasureMode, void*) { + [](YGNodeRef, float, YGMeasureMode, float, YGMeasureMode, void*) { return YGSize{}; }); n.setMeasureFunc( - [](YGNode*, float w, YGMeasureMode wm, float h, YGMeasureMode hm) { - return YGSize{w * wm, h / hm}; + [](YGNodeRef, float w, YGMeasureMode wm, float h, YGMeasureMode hm) { + return YGSize{w * static_cast(wm), h / static_cast(hm)}; }); ASSERT_EQ( @@ -70,9 +70,9 @@ TEST(YGNode, switching_measure_fn_types) { (YGSize{23, 12})); } -TEST(YGNode, hasMeasureFunc_after_unset) { - auto n = YGNode{}; - n.setMeasureFunc([](YGNode*, float, YGMeasureMode, float, YGMeasureMode) { +TEST(Node, hasMeasureFunc_after_unset) { + auto n = Node{}; + n.setMeasureFunc([](YGNodeRef, float, YGMeasureMode, float, YGMeasureMode) { return YGSize{}; }); @@ -80,10 +80,10 @@ TEST(YGNode, hasMeasureFunc_after_unset) { ASSERT_FALSE(n.hasMeasureFunc()); } -TEST(YGNode, hasMeasureFunc_after_unset_context) { - auto n = YGNode{}; +TEST(Node, hasMeasureFunc_after_unset_context) { + auto n = Node{}; n.setMeasureFunc( - [](YGNode*, float, YGMeasureMode, float, YGMeasureMode, void*) { + [](YGNodeRef, float, YGMeasureMode, float, YGMeasureMode, void*) { return YGSize{}; }); @@ -91,27 +91,27 @@ TEST(YGNode, hasMeasureFunc_after_unset_context) { ASSERT_FALSE(n.hasMeasureFunc()); } -TEST(YGNode, hasBaselineFunc_initial) { - auto n = YGNode{}; +TEST(Node, hasBaselineFunc_initial) { + auto n = Node{}; ASSERT_FALSE(n.hasBaselineFunc()); } -TEST(YGNode, hasBaselineFunc_with_baseline_fn) { - auto n = YGNode{}; - n.setBaselineFunc([](YGNode*, float, float) { return 0.0f; }); +TEST(Node, hasBaselineFunc_with_baseline_fn) { + auto n = Node{}; + n.setBaselineFunc([](YGNodeRef, float, float) { return 0.0f; }); ASSERT_TRUE(n.hasBaselineFunc()); } -TEST(YGNode, baseline_with_baseline_fn) { - auto n = YGNode{}; - n.setBaselineFunc([](YGNode*, float w, float h) { return w + h; }); +TEST(Node, baseline_with_baseline_fn) { + auto n = Node{}; + n.setBaselineFunc([](YGNodeRef, float w, float h) { return w + h; }); ASSERT_EQ(n.baseline(1.25f, 2.5f, nullptr), 3.75f); } -TEST(YGNode, baseline_with_context_baseline_fn) { - auto n = YGNode{}; - n.setBaselineFunc([](YGNode*, float w, float h, void* ctx) { +TEST(Node, baseline_with_context_baseline_fn) { + auto n = Node{}; + n.setBaselineFunc([](YGNodeRef, float w, float h, void* ctx) { return w + h + *(float*) ctx; }); @@ -119,29 +119,25 @@ TEST(YGNode, baseline_with_context_baseline_fn) { ASSERT_EQ(n.baseline(1.25f, 2.5f, &ctx), -6.25f); } -TEST(YGNode, hasBaselineFunc_after_unset) { - auto n = YGNode{}; - n.setBaselineFunc([](YGNode*, float, float) { return 0.0f; }); +TEST(Node, hasBaselineFunc_after_unset) { + auto n = Node{}; + n.setBaselineFunc([](YGNodeRef, float, float) { return 0.0f; }); n.setBaselineFunc(nullptr); ASSERT_FALSE(n.hasBaselineFunc()); } -TEST(YGNode, hasBaselineFunc_after_unset_context) { - auto n = YGNode{}; - n.setBaselineFunc([](YGNode*, float, float, void*) { return 0.0f; }); +TEST(Node, hasBaselineFunc_after_unset_context) { + auto n = Node{}; + n.setBaselineFunc([](YGNodeRef, float, float, void*) { return 0.0f; }); n.setMeasureFunc(nullptr); ASSERT_FALSE(n.hasMeasureFunc()); } -TEST(YGNode, switching_baseline_fn_types) { - auto n = YGNode{}; - n.setBaselineFunc([](YGNode*, float, float, void*) { return 0.0f; }); - n.setBaselineFunc([](YGNode*, float, float) { return 1.0f; }); +TEST(Node, switching_baseline_fn_types) { + auto n = Node{}; + n.setBaselineFunc([](YGNodeRef, float, float, void*) { return 0.0f; }); + n.setBaselineFunc([](YGNodeRef, float, float) { return 1.0f; }); ASSERT_EQ(n.baseline(1, 2, nullptr), 1.0f); } - -void PrintTo(const YGSize& size, std::ostream* os) { - *os << "YGSize{" << size.width << ", " << size.height << "}"; -} diff --git a/tests/YGPersistenceTest.cpp b/tests/YGPersistenceTest.cpp index 6bf1e7dac1..a34b6979ec 100644 --- a/tests/YGPersistenceTest.cpp +++ b/tests/YGPersistenceTest.cpp @@ -7,10 +7,11 @@ #include #include -#include +#include #include "util/TestUtil.h" +using namespace facebook; using facebook::yoga::test::TestUtil; TEST(YogaTest, cloning_shared_root) { @@ -273,9 +274,10 @@ TEST(YogaTest, mixed_shared_and_owned_children) { YGNodeInsertChild(root1, root1_child0, 0); YGNodeInsertChild(root1, root1_child2, 1); - auto children = root1->getChildren(); - children.insert(children.begin() + 1, root0_child0); - root1->setChildren(children); + auto children = static_cast(root1)->getChildren(); + children.insert(children.begin() + 1, static_cast(root0_child0)); + static_cast(root1)->setChildren(children); + auto secondChild = YGNodeGetChild(root1, 1); ASSERT_EQ(secondChild, YGNodeGetChild(root0, 0)); ASSERT_EQ(YGNodeGetChild(secondChild, 0), YGNodeGetChild(root0_child0, 0)); diff --git a/tests/YGRoundingMeasureFuncTest.cpp b/tests/YGRoundingMeasureFuncTest.cpp index 745377d0dc..c5c3a3ab6b 100644 --- a/tests/YGRoundingMeasureFuncTest.cpp +++ b/tests/YGRoundingMeasureFuncTest.cpp @@ -6,7 +6,6 @@ */ #include -#include #include static YGSize _measureFloor( @@ -50,7 +49,7 @@ TEST(YogaTest, rounding_feature_with_custom_measure_func_floor) { const YGNodeRef root = YGNodeNewWithConfig(config); const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - root_child0->setMeasureFunc(_measureFloor); + YGNodeSetMeasureFunc(root_child0, _measureFloor); YGNodeInsertChild(root, root_child0, 0); YGConfigSetPointScaleFactor(config, 0.0f); @@ -98,7 +97,7 @@ TEST(YogaTest, rounding_feature_with_custom_measure_func_ceil) { const YGNodeRef root = YGNodeNewWithConfig(config); const YGNodeRef root_child0 = YGNodeNewWithConfig(config); - root_child0->setMeasureFunc(_measureCeil); + YGNodeSetMeasureFunc(root_child0, _measureCeil); YGNodeInsertChild(root, root_child0, 0); YGConfigSetPointScaleFactor(config, 1.0f); @@ -121,7 +120,7 @@ TEST( const YGNodeRef root_child0 = YGNodeNewWithConfig(config); YGNodeStyleSetPosition(root_child0, YGEdgeLeft, 73.625); - root_child0->setMeasureFunc(_measureFractial); + YGNodeSetMeasureFunc(root_child0, _measureFractial); YGNodeInsertChild(root, root_child0, 0); YGConfigSetPointScaleFactor(config, 2.0f); diff --git a/tests/YGStyleAccessorsTest.cpp b/tests/YGStyleAccessorsTest.cpp index 2e96af92e9..390743e38b 100644 --- a/tests/YGStyleAccessorsTest.cpp +++ b/tests/YGStyleAccessorsTest.cpp @@ -8,9 +8,8 @@ #include #include #include -#include -#include -#include +#include +#include #define ACCESSOR_TESTS_1(NAME, X) \ style.NAME() = X; \ @@ -31,14 +30,14 @@ #define ACCESSOR_TESTS_N(a, b, c, d, e, COUNT, ...) ACCESSOR_TESTS_##COUNT #define ACCESSOR_TESTS(...) ACCESSOR_TESTS_N(__VA_ARGS__, 5, 4, 3, 2, 1) -#define INDEX_ACCESSOR_TESTS_1(NAME, IDX, X) \ - { \ - auto style = YGStyle{}; \ - style.NAME()[IDX] = X; \ - ASSERT_EQ(style.NAME()[IDX], X); \ - auto asArray = decltype(std::declval().NAME()){X}; \ - style.NAME() = asArray; \ - ASSERT_EQ(static_cast(style.NAME()), asArray); \ +#define INDEX_ACCESSOR_TESTS_1(NAME, IDX, X) \ + { \ + auto style = Style{}; \ + style.NAME()[IDX] = X; \ + ASSERT_EQ(style.NAME()[IDX], X); \ + auto asArray = decltype(std::declval().NAME()){X}; \ + style.NAME() = asArray; \ + ASSERT_EQ(static_cast(style.NAME()), asArray); \ } #define INDEX_ACCESSOR_TESTS_2(NAME, IDX, X, Y) \ @@ -64,22 +63,20 @@ // test macro for up to 5 values. If more are needed, extend the macros above. #define ACCESSOR_TEST(NAME, DEFAULT_VAL, ...) \ - TEST(YGStyle, style_##NAME##_access) { \ - auto style = YGStyle{}; \ + TEST(Style, style_##NAME##_access) { \ + auto style = Style{}; \ ASSERT_EQ(style.NAME(), DEFAULT_VAL); \ ACCESSOR_TESTS(__VA_ARGS__)(NAME, __VA_ARGS__) \ } #define INDEX_ACCESSOR_TEST(NAME, DEFAULT_VAL, IDX, ...) \ - TEST(YGStyle, style_##NAME##_access) { \ - ASSERT_EQ(YGStyle{}.NAME()[IDX], DEFAULT_VAL); \ + TEST(Style, style_##NAME##_access) { \ + ASSERT_EQ(Style{}.NAME()[IDX], DEFAULT_VAL); \ INDEX_ACCESSOR_TESTS(__VA_ARGS__)(NAME, IDX, __VA_ARGS__) \ } namespace facebook::yoga { -using CompactValue = detail::CompactValue; - // TODO: MSVC doesn't like the macros #ifndef _MSC_VER @@ -157,24 +154,24 @@ ACCESSOR_TEST(display, YGDisplayFlex, YGDisplayNone, YGDisplayFlex) ACCESSOR_TEST( flex, - YGFloatOptional{}, - YGFloatOptional{123.45f}, - YGFloatOptional{-9.87f}, - YGFloatOptional{}) + FloatOptional{}, + FloatOptional{123.45f}, + FloatOptional{-9.87f}, + FloatOptional{}) ACCESSOR_TEST( flexGrow, - YGFloatOptional{}, - YGFloatOptional{123.45f}, - YGFloatOptional{-9.87f}, - YGFloatOptional{}) + FloatOptional{}, + FloatOptional{123.45f}, + FloatOptional{-9.87f}, + FloatOptional{}) ACCESSOR_TEST( flexShrink, - YGFloatOptional{}, - YGFloatOptional{123.45f}, - YGFloatOptional{-9.87f}, - YGFloatOptional{}) + FloatOptional{}, + FloatOptional{123.45f}, + FloatOptional{-9.87f}, + FloatOptional{}) ACCESSOR_TEST( flexBasis, @@ -246,11 +243,11 @@ INDEX_ACCESSOR_TEST( ACCESSOR_TEST( aspectRatio, - YGFloatOptional{}, - YGFloatOptional{-123.45f}, - YGFloatOptional{9876.5f}, - YGFloatOptional{0.0f}, - YGFloatOptional{}); + FloatOptional{}, + FloatOptional{-123.45f}, + FloatOptional{9876.5f}, + FloatOptional{0.0f}, + FloatOptional{}); #endif diff --git a/tests/YGStyleTest.cpp b/tests/YGStyleTest.cpp index 1204516784..5651dc31b3 100644 --- a/tests/YGStyleTest.cpp +++ b/tests/YGStyleTest.cpp @@ -6,16 +6,15 @@ */ #include -#include -#include +#include TEST(YogaTest, copy_style_same) { const YGNodeRef node0 = YGNodeNew(); const YGNodeRef node1 = YGNodeNew(); - ASSERT_FALSE(node0->isDirty()); + ASSERT_FALSE(YGNodeIsDirty(node0)); YGNodeCopyStyle(node0, node1); - ASSERT_FALSE(node0->isDirty()); + ASSERT_FALSE(YGNodeIsDirty(node0)); YGNodeFree(node0); YGNodeFree(node1); @@ -23,7 +22,7 @@ TEST(YogaTest, copy_style_same) { TEST(YogaTest, copy_style_modified) { const YGNodeRef node0 = YGNodeNew(); - ASSERT_FALSE(node0->isDirty()); + ASSERT_FALSE(YGNodeIsDirty(node0)); ASSERT_EQ(YGFlexDirectionColumn, YGNodeStyleGetFlexDirection(node0)); ASSERT_FALSE(YGNodeStyleGetMaxHeight(node0).unit != YGUnitUndefined); @@ -32,7 +31,7 @@ TEST(YogaTest, copy_style_modified) { YGNodeStyleSetMaxHeight(node1, 10); YGNodeCopyStyle(node0, node1); - ASSERT_TRUE(node0->isDirty()); + ASSERT_TRUE(YGNodeIsDirty(node0)); ASSERT_EQ(YGFlexDirectionRow, YGNodeStyleGetFlexDirection(node0)); ASSERT_FLOAT_EQ(10, YGNodeStyleGetMaxHeight(node0).value); @@ -45,14 +44,14 @@ TEST(YogaTest, copy_style_modified_same) { YGNodeStyleSetFlexDirection(node0, YGFlexDirectionRow); YGNodeStyleSetMaxHeight(node0, 10); YGNodeCalculateLayout(node0, YGUndefined, YGUndefined, YGDirectionLTR); - ASSERT_FALSE(node0->isDirty()); + ASSERT_FALSE(YGNodeIsDirty(node0)); const YGNodeRef node1 = YGNodeNew(); YGNodeStyleSetFlexDirection(node1, YGFlexDirectionRow); YGNodeStyleSetMaxHeight(node1, 10); YGNodeCopyStyle(node0, node1); - ASSERT_FALSE(node0->isDirty()); + ASSERT_FALSE(YGNodeIsDirty(node0)); YGNodeFree(node0); YGNodeFree(node1); diff --git a/tests/generated/YGConfigTest.cpp b/tests/generated/YGConfigTest.cpp index b13a75b75b..8665d50023 100644 --- a/tests/generated/YGConfigTest.cpp +++ b/tests/generated/YGConfigTest.cpp @@ -9,18 +9,20 @@ #include #include -#include -#include +#include +#include #include #include +using namespace facebook; + struct ConfigCloningTest : public ::testing::Test { - std::unique_ptr> config; + std::unique_ptr> config; void SetUp() override; void TearDown() override; - static YGNode clonedNode; + static yoga::Node clonedNode; static YGNodeRef cloneNode(YGNodeRef, YGNodeRef, int) { return &clonedNode; } static YGNodeRef doNotClone(YGNodeRef, YGNodeRef, int) { return nullptr; } }; @@ -28,7 +30,7 @@ struct ConfigCloningTest : public ::testing::Test { TEST_F(ConfigCloningTest, uses_values_provided_by_cloning_callback) { config->setCloneNodeCallback(cloneNode); - YGNode node{}, owner{}; + yoga::Node node{}, owner{}; auto clone = config->cloneNode(&node, &owner, 0, nullptr); ASSERT_EQ(clone, &clonedNode); @@ -39,7 +41,7 @@ TEST_F( falls_back_to_regular_cloning_if_callback_returns_null) { config->setCloneNodeCallback(doNotClone); - YGNode node{}, owner{}; + yoga::Node node{}, owner{}; auto clone = config->cloneNode(&node, &owner, 0, nullptr); ASSERT_NE(clone, nullptr); @@ -51,16 +53,16 @@ TEST_F(ConfigCloningTest, can_clone_with_context) { return (YGNodeRef) context; }); - YGNode node{}, owner{}, clone{}; + yoga::Node node{}, owner{}, clone{}; ASSERT_EQ(config->cloneNode(&node, &owner, 0, &clone), &clone); } void ConfigCloningTest::SetUp() { - config = {YGConfigNew(), YGConfigFree}; + config = {static_cast(YGConfigNew()), YGConfigFree}; } void ConfigCloningTest::TearDown() { config.reset(); } -YGNode ConfigCloningTest::clonedNode = {}; +yoga::Node ConfigCloningTest::clonedNode = {}; diff --git a/tests/util/TestUtil.cpp b/tests/util/TestUtil.cpp index 2ae34e0f84..16e3fd6a58 100644 --- a/tests/util/TestUtil.cpp +++ b/tests/util/TestUtil.cpp @@ -7,7 +7,7 @@ #include "TestUtil.h" -#include +#include #include namespace facebook::yoga::test { @@ -17,7 +17,7 @@ int nodeInstanceCount = 0; namespace { void yogaEventSubscriber( - const YGNode& /*node*/, + YGNodeConstRef /*node*/, Event::Type eventType, const Event::Data& /*eventData*/) { diff --git a/website-next/docusaurus.config.js b/website-next/docusaurus.config.js index dbcea9952c..b92e8423e0 100644 --- a/website-next/docusaurus.config.js +++ b/website-next/docusaurus.config.js @@ -13,7 +13,8 @@ const darkCodeTheme = require('prism-react-renderer/themes/dracula'); /** @type {import('@docusaurus/types').Config} */ const config = { title: 'Yoga', - tagline: 'Build flexible layouts on any platform with a highly optimized open source layout engine designed with speed, size, and ease of use in mind.', + tagline: + 'Build flexible layouts on any platform with a highly optimized open source layout engine designed with speed, size, and ease of use in mind.', favicon: 'img/favicon.png', url: 'https:/yogalayout.com', @@ -37,13 +38,11 @@ const config = { ({ docs: { sidebarPath: require.resolve('./sidebars.js'), - editUrl: - 'https://github.com/facebook/yoga/tree/main/website', + editUrl: 'https://github.com/facebook/yoga/tree/main/website', }, blog: { showReadingTime: true, - editUrl: - 'https://github.com/facebook/yoga/tree/main/website', + editUrl: 'https://github.com/facebook/yoga/tree/main/website', }, theme: { customCss: require.resolve('./src/css/custom.css'), diff --git a/website-next/package.json b/website-next/package.json index 78e748b79a..b98651354a 100644 --- a/website-next/package.json +++ b/website-next/package.json @@ -12,21 +12,26 @@ "serve": "docusaurus serve", "write-translations": "docusaurus write-translations", "write-heading-ids": "docusaurus write-heading-ids", - "typecheck": "tsc" + "typecheck": "tsc", + "lint": "eslint .", + "lint:fix": "eslint . --fix" }, "dependencies": { "@docusaurus/core": "2.4.1", "@docusaurus/preset-classic": "2.4.1", "@mdx-js/react": "^1.6.22", + "antd": "^3.6.5", "clsx": "^1.2.1", + "immutable": "^4.0.0", "prism-react-renderer": "^1.3.5", "react": "^17.0.2", - "react-dom": "^17.0.2" + "react-dom": "^17.0.2", + "react-syntax-highlighter": "^8.0.0", + "yoga-layout": "^2.0.0" }, "devDependencies": { "@docusaurus/module-type-aliases": "2.4.1", - "@tsconfig/docusaurus": "^1.0.5", - "typescript": "^4.7.4" + "@tsconfig/docusaurus": "^1.0.5" }, "browserslist": { "production": [ diff --git a/website-next/src/components/Playground/EditValue.tsx b/website-next/src/components/Playground/EditValue.tsx new file mode 100644 index 0000000000..3768879d92 --- /dev/null +++ b/website-next/src/components/Playground/EditValue.tsx @@ -0,0 +1,44 @@ +/** + * 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. + * + * @format + */ + +import React from 'react'; +import YogaEnumSelect from './YogaEnumSelect'; +import YogaPositionEditor from './YogaPositionEditor'; +import {Input} from 'antd'; + +type Props = { + property: string; + disabled?: boolean; + value?: T; + onChange: (property: string, value: T) => void; + placeholder?: string; +}; + +export default (props: Props) => { + if (YogaEnumSelect.availableProperties.indexOf(props.property) > -1) { + // @ts-ignore + return ; + } else if ( + YogaPositionEditor.availableProperties.indexOf(props.property) > -1 + ) { + // @ts-ignore + return ; + } else { + return ( + props.onChange(props.property, e.target.value)} + placeholder={props.placeholder || 'undefined'} + onFocus={e => e.target.select()} + value={Number.isNaN(props.value) ? '' : props.value} + /> + ); + } +}; diff --git a/website-next/src/components/Playground/Editor.css b/website-next/src/components/Playground/Editor.css new file mode 100644 index 0000000000..b9fa310bb4 --- /dev/null +++ b/website-next/src/components/Playground/Editor.css @@ -0,0 +1,63 @@ +/** + * 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. + */ + + .Editor { + display: flex; + flex-direction: column; + height: 100%; + border-top: 1px solid #E8E8E8; +} + +.Editor .field { + display: flex; +} + +.Editor .ant-btn { + width: 100%; +} + +.Editor h2 { + margin-bottom: 8px; + margin-top: 20px; + font-size: 12px; + font-weight: 700; + color: #444950; + text-transform: uppercase; +} + +.Editor h2:first-child { + margin-top: 0; +} + +.Editor .ant-tabs-nav .ant-tabs-tab { + margin-left: 16px; +} + +.Editor .EditorTabs { + flex-grow: 1; +} + +.Editor .ant-tabs { + display: flex; + flex-direction: column; +} + +.Editor .ant-tabs-bar { + margin-bottom: 0; +} + +.Editor .ant-tabs-tabpane { + overflow-y: auto; + min-height: 320px; + height: 100%; + max-height: 25vh; + padding: 15px; +} + +.Editor .EditorButtons { + padding: 15px; +} diff --git a/website-next/src/components/Playground/Editor.tsx b/website-next/src/components/Playground/Editor.tsx new file mode 100644 index 0000000000..c77a6ed74d --- /dev/null +++ b/website-next/src/components/Playground/Editor.tsx @@ -0,0 +1,369 @@ +/** + * 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. + * + * @format + */ + +import React, {Component} from 'react'; +import {Row, Col, Button, Tabs} from 'antd'; +import EditValue from './EditValue'; +import type {LayoutRecordType} from './LayoutRecord'; +import type {Direction} from 'yoga-layout/sync'; +import InfoText from './InfoText'; +import './Editor.css'; +const TabPane = Tabs.TabPane; + +type Props = { + node: LayoutRecordType; + onChangeLayout: (key: string, value: any) => void; + onChangeSetting: (key: string, value: any) => void; + direction: Direction; + selectedNodeIsRoot: boolean; + onRemove?: () => void; + onAdd?: () => void; +}; + +export default class Editor extends Component { + componentDidMount() { + document.addEventListener('keydown', this.onKeyDown); + } + + componentWillUnmount() { + document.removeEventListener('keydown', this.onKeyDown); + } + + onKeyDown = (e: KeyboardEvent) => { + if ( + (e.key === 'Delete' || e.key === 'Backspace') && + this.props.onRemove && + !(e.target instanceof HTMLInputElement) + ) { + this.props.onRemove(); + } + }; + + render() { + const {node, selectedNodeIsRoot} = this.props; + const disabled = !node; + + return ( +
+ {/* @ts-ignore */} + + {/* @ts-ignore */} + +

+ Direction + + Defines the direction of which text and items are laid out + +

+ +

+ Flex Direction + + Defines the direction of the main-axis + +

+ + + + +

+ Basis + + Default size of a node along the main axis + +

+ + + +

+ Grow + + The factor of remaining space should be given to this node + +

+ + + +

+ Shrink + + The shrink factor of this element if parent has no space + left + +

+ + +
+ +

+ Flex Wrap + + Wrapping behaviour when child nodes don't fit into a single line + +

+ +
+ {/* @ts-ignore */} + +

+ Justify Content + + Aligns child nodes along the main-axis + +

+ + +

+ Align Items + + Aligns child nodes along the cross-axis + +

+ + +

+ Align Self + + Override align items of parent + +

+ + +

+ Align Content + + Alignment of lines along the cross-axis when wrapping + +

+ +
+ {/* @ts-ignore */} + +

+ Width × Height + + Dimensions of the node + +

+ + + + + + + + +

+ Max-Width × Max-Height + + Maximum dimensions of the node + +

+ + + + + + + + +

+ Min-Width × Min-Height + + Minimum dimensions of the node + +

+ + + + + + + + + +

+ Aspect Ratio + + Width/Height aspect ratio of node + +

+ + + {['padding', 'border', 'margin'].map(property => ( + + ))} +

+ Position Type + + Relative position offsets the node from it's calculated + position. Absolute position removes the node from the flexbox + flow and positions it at the given position. + +

+ + + +
+
+ + + + + + + + + +
+ ); + } +} diff --git a/website-next/src/components/Playground/InfoText.css b/website-next/src/components/Playground/InfoText.css new file mode 100644 index 0000000000..3193f265d4 --- /dev/null +++ b/website-next/src/components/Playground/InfoText.css @@ -0,0 +1,22 @@ +/** + * 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. + */ + + .InfoText { + max-width: 230px; + line-height: 130%; +} + +.InfoText .docs-link { + margin-top: 0px; + font-size: 12px; + font-weight: 600; +} + +.InfoTextIcon { + margin-left: 5px; + opacity: 0.5; +} diff --git a/website-next/src/components/Playground/InfoText.tsx b/website-next/src/components/Playground/InfoText.tsx new file mode 100644 index 0000000000..4c5fd8641d --- /dev/null +++ b/website-next/src/components/Playground/InfoText.tsx @@ -0,0 +1,38 @@ +/** + * 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. + * + * @format + */ + +import React, {Component} from 'react'; +import {Popover, Icon} from 'antd'; +import Link from '@docusaurus/Link'; +import './InfoText.css'; + +type Props = { + children: any; + doclink: string; +}; + +export default class InfoText extends Component { + render() { + return ( + +

{this.props.children}

+ + DOCUMENTATION + + + } + trigger="hover"> + {/*@ts-ignore*/} + +
+ ); + } +} diff --git a/website-next/src/components/Playground/LayoutRecord.tsx b/website-next/src/components/Playground/LayoutRecord.tsx new file mode 100644 index 0000000000..764ab43884 --- /dev/null +++ b/website-next/src/components/Playground/LayoutRecord.tsx @@ -0,0 +1,80 @@ +/** + * 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. + * + * @format + */ + +import {Record, List} from 'immutable'; +import PositionRecord from './PositionRecord'; +import type {PositionRecordType} from './PositionRecord'; +import yoga from 'yoga-layout/sync'; + +import type { + Align, + Justify, + FlexDirection, + Wrap, + PositionType, +} from 'yoga-layout/sync'; + +export type LayoutRecordType = ReturnType; + +export type LayoutRecordFactory = Record.Factory<{ + width?: number | 'auto'; + height?: number | 'auto'; + minWidth?: number; + minHeight?: number; + maxWidth?: number; + maxHeight?: number; + justifyContent?: Justify; + padding: PositionRecordType; + border: PositionRecordType; + margin: PositionRecordType; + position: PositionRecordType; + positionType: PositionType; + alignItems?: Align; + alignSelf?: Align; + alignContent?: Align; + flexDirection?: FlexDirection; + flexBasis?: number | 'auto'; + flexGrow?: number; + flexShrink?: number; + flexWrap?: Wrap; + aspectRatio?: number | 'auto'; + children?: List; +}>; + +const r: LayoutRecordFactory = Record({ + width: 'auto', + height: 'auto', + justifyContent: yoga.JUSTIFY_FLEX_START, + alignItems: yoga.ALIGN_STRETCH, + alignSelf: yoga.ALIGN_AUTO, + alignContent: yoga.ALIGN_STRETCH, + flexDirection: yoga.FLEX_DIRECTION_ROW, + padding: PositionRecord(), + margin: PositionRecord(), + border: PositionRecord(), + position: PositionRecord({ + left: NaN, + top: NaN, + right: NaN, + bottom: NaN, + }), + positionType: yoga.POSITION_TYPE_RELATIVE, + flexWrap: yoga.WRAP_NO_WRAP, + flexBasis: 'auto', + flexGrow: 0, + flexShrink: 1, + children: List(), + aspectRatio: 'auto', + minWidth: NaN, + maxWidth: NaN, + minHeight: NaN, + maxHeight: NaN, +}); + +export default r; diff --git a/website-next/src/components/Playground/PositionGuide.css b/website-next/src/components/Playground/PositionGuide.css new file mode 100644 index 0000000000..fcb11eacab --- /dev/null +++ b/website-next/src/components/Playground/PositionGuide.css @@ -0,0 +1,16 @@ +/** + * 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. + */ + + .PositionGuide { + position: absolute; + pointer-events: none; + display: flex; + align-items: center; + justify-content: center; + font-size: 10px; + user-select: none; +} diff --git a/website-next/src/components/Playground/PositionGuide.tsx b/website-next/src/components/Playground/PositionGuide.tsx new file mode 100644 index 0000000000..b46c105f80 --- /dev/null +++ b/website-next/src/components/Playground/PositionGuide.tsx @@ -0,0 +1,159 @@ +/** + * 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. + * + * @format + */ + +import React, {Component} from 'react'; +import PositionRecord from './PositionRecord'; +import type {PositionRecordType} from './PositionRecord'; +import './PositionGuide.css'; + +type Props = { + inset?: boolean; + reverse?: boolean; + position: PositionRecordType; + offset: PositionRecordType; + color: string; +}; + +export default class PositionGuide extends Component { + static defaultProps = { + offset: PositionRecord({}), + }; + + render() { + const {position, offset, inset, color, reverse} = this.props; + let {top, left, right, bottom} = position; + let {top: oTop, left: oLeft, right: oRight, bottom: oBottom} = offset; + + if ( + typeof top !== 'number' || + typeof left !== 'number' || + typeof right !== 'number' || + typeof bottom !== 'number' || + typeof oTop !== 'number' || + typeof oLeft !== 'number' || + typeof oRight !== 'number' || + typeof oBottom !== 'number' + ) { + return null; + } + if (reverse) { + let temp1 = left; + left = right; + right = temp1; + temp1 = oLeft; + oLeft = oRight; + oRight = temp1; + } + + if (!top) { + top = 0; + } + if (!left) { + left = 0; + } + if (!right) { + right = 0; + } + if (!bottom) { + bottom = 0; + } + if (!oTop) { + oTop = 0; + } + if (!oLeft) { + oLeft = 0; + } + if (!oRight) { + oRight = 0; + } + if (!oBottom) { + oBottom = 0; + } + + if (!inset) { + if (typeof top === 'number' && typeof bottom === 'number') { + if (top < 0) { + bottom -= top; + top = 0; + } + if (bottom < 0) { + top -= bottom; + bottom = 0; + } + } + if (left < 0) { + right -= left; + left = 0; + } + if (right < 0) { + left -= right; + right = 0; + } + } + + return [ + top !== 0 ? ( +
+ {top} +
+ ) : null, + left !== 0 ? ( +
+ {left} +
+ ) : null, + right !== 0 ? ( +
+ {right} +
+ ) : null, + bottom !== 0 ? ( +
+ {bottom} +
+ ) : null, + ]; + } +} diff --git a/website-next/src/components/Playground/PositionRecord.tsx b/website-next/src/components/Playground/PositionRecord.tsx new file mode 100644 index 0000000000..439294e7ed --- /dev/null +++ b/website-next/src/components/Playground/PositionRecord.tsx @@ -0,0 +1,28 @@ +/** + * 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. + * + * @format + */ + +import {Record} from 'immutable'; + +export type PositionRecordType = ReturnType; + +export type PositionRecordFactory = Record.Factory<{ + top: string | number; + right: string | number; + bottom: string | number; + left: string | number; +}>; + +const r: PositionRecordFactory = Record({ + top: 0, + right: 0, + bottom: 0, + left: 0, +}); + +export default r; diff --git a/website-next/src/components/Playground/Sidebar.css b/website-next/src/components/Playground/Sidebar.css new file mode 100644 index 0000000000..d086825a74 --- /dev/null +++ b/website-next/src/components/Playground/Sidebar.css @@ -0,0 +1,22 @@ +/** + * 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. + */ + + .Sidebar { + position: absolute; + z-index: 3; + top: 0; + right: 0; + width: 350px; + background: white; + display: flex; + flex-direction: column; + margin: 25px; + max-height: calc(100% - 50px); + border-radius: 6px; + bottom: auto; + box-shadow: 3px 3px 15px rgba(0, 0, 0, 0.15); +} diff --git a/website-next/src/components/Playground/Sidebar.tsx b/website-next/src/components/Playground/Sidebar.tsx new file mode 100644 index 0000000000..f5f639451d --- /dev/null +++ b/website-next/src/components/Playground/Sidebar.tsx @@ -0,0 +1,26 @@ +/** + * 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. + * + * @format + */ + +import React, {Component} from 'react'; +import './Sidebar.css'; + +type Props = { + width?: number; + children: any; +}; + +export default class Sidebar extends Component { + render() { + return ( +
+ {this.props.children} +
+ ); + } +} diff --git a/website-next/src/components/Playground/YogaEnumSelect.css b/website-next/src/components/Playground/YogaEnumSelect.css new file mode 100644 index 0000000000..3e68d12aa8 --- /dev/null +++ b/website-next/src/components/Playground/YogaEnumSelect.css @@ -0,0 +1,25 @@ +/** + * 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. + */ + + .YogaEnumSelect { + display: flex; +} + +.YogaEnumSelect.ant-radio-group .ant-radio-button-wrapper { + flex-grow: 1; + flex-basis: 0; + text-align: center; +} + +.YogaEnumSelect .ant-btn { + flex-grow: 1; + flex-basis: 0; +} + +.YogaEnumSelect .ant-radio-button-wrapper { + white-space: nowrap; +} diff --git a/website-next/src/components/Playground/YogaEnumSelect.tsx b/website-next/src/components/Playground/YogaEnumSelect.tsx new file mode 100644 index 0000000000..31d2bb51b1 --- /dev/null +++ b/website-next/src/components/Playground/YogaEnumSelect.tsx @@ -0,0 +1,105 @@ +/** + * 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. + * + * @format + */ + +import React, {Component} from 'react'; +import Yoga from 'yoga-layout/sync'; +import {Radio, Menu, Dropdown, Button, Icon} from 'antd'; +import './YogaEnumSelect.css'; +const RadioButton = Radio.Button; +const RadioGroup = Radio.Group; + +const PROPERTY_LOOKUP = { + flexDirection: 'FLEX_DIRECTION', + direction: 'DIRECTION', + justifyContent: 'JUSTIFY', + alignSelf: 'ALIGN', + alignContent: 'ALIGN', + alignItems: 'ALIGN', + positionType: 'POSITION_TYPE', + flexWrap: 'WRAP', +}; + +type Property = keyof typeof PROPERTY_LOOKUP; + +type Props = { + property: Property; + disabled?: boolean; + value: string | number; + onChange: (property: Property, value: number) => void; +}; + +export default class YogaEnumSelect extends Component { + static availableProperties = Object.keys(PROPERTY_LOOKUP); + + values: Array<{key: string; value: number}>; + + constructor(props: Props) { + super(props); + + const property = PROPERTY_LOOKUP[props.property]; + + this.values = Object.keys(Yoga) + .map(key => ({key, value: Yoga[key]})) + .filter( + ({key}) => key.startsWith(property) && key !== `${property}_COUNT`, + ); + } + + handleMenuClick = ({key}: {key: string}) => { + this.props.onChange(this.props.property, Yoga[key]); + }; + + getTitle = (property: string, key: string): string => { + const replacer = new RegExp(`^${property}_`); + return key.replace(replacer, '').replace('_', ' ').toLowerCase(); + }; + + render() { + const property = PROPERTY_LOOKUP[this.props.property]; + const selected = this.values.find(({value}) => value === this.props.value); + + return this.values.length > 3 ? ( +
+ {/*@ts-ignore*/} + + {this.values.map(({key, value}) => ( + // @ts-ignore + + {this.getTitle(property, key)} + + ))} + + }> + + +
+ ) : ( + this.props.onChange(this.props.property, e.target.value)} + defaultValue="a" + className="YogaEnumSelect"> + {this.values.map(({key, value}) => ( + + {this.getTitle(property, key)} + + ))} + + ); + } +} diff --git a/website-next/src/components/Playground/YogaNode.css b/website-next/src/components/Playground/YogaNode.css new file mode 100644 index 0000000000..b22e2867bd --- /dev/null +++ b/website-next/src/components/Playground/YogaNode.css @@ -0,0 +1,57 @@ +/** + * 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. + */ + + .YogaNode { + background: white; + position: absolute; + transform: scale(1); + box-shadow: inset 0 0 0px 1px rgba(48, 56, 69, 0.2); + transition: 0.2s all, 0s outline, 0s box-shadow; + cursor: pointer; +} + +.YogaNode.hover { + background-color: #F0FFF9; +} + +.YogaNode .YogaNode { + background: rgba(255, 255, 255, 0.7); +} + +.YogaNode .YogaNode.hover{ + background: rgba(240, 255, 249, 0.7); +} + +.YogaNode:focus { + outline: 0; +} + +.YogaNode.focused { + box-shadow: 0 0 0 2px #68CFBB, 0 0 15px rgba(0, 0, 0, 0.2), + inset 0 0 0px 1px rgba(255, 255, 255, 0.2); + z-index: 2; +} + +.YogaNode.invisible { + transform: scale(0); +} + +.YogaNode .label { + user-select: none; + pointer-events: none; + position: absolute; + left: 0; + bottom: 0; + right: 0; + top: 0; + display: flex; + align-items: center; + justify-content: center; + font-size: 20px; + font-weight: 300; + letter-spacing: 1px; +} diff --git a/website-next/src/components/Playground/YogaNode.tsx b/website-next/src/components/Playground/YogaNode.tsx new file mode 100644 index 0000000000..da5322d64c --- /dev/null +++ b/website-next/src/components/Playground/YogaNode.tsx @@ -0,0 +1,301 @@ +/** + * 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. + * + * @format + */ + +import React, {Component} from 'react'; +import Yoga from 'yoga-layout/sync'; +import PositionGuide from './PositionGuide'; +import PositionRecord from './PositionRecord'; +import LayoutRecord from './LayoutRecord'; +import type {LayoutRecordType} from './LayoutRecord'; +import {Direction, Display, Edge, Node, Wrap} from 'yoga-layout/sync'; + +import './YogaNode.css'; + +type ComputedLayout = { + left: number; + top: number; + width: number; + height: number; + children: Array; + node: Node; +}; + +type Props = { + layoutDefinition: LayoutRecordType; + className?: string; + computedLayout?: ComputedLayout; + path: Array; + selectedNodePath?: Array; + direction?: Direction; + label?: string; + showGuides: boolean; + onClick?: (path: Array) => void; + onDoubleClick?: (path: Array) => void; +}; + +type State = { + visible?: boolean; + hovered: boolean; +}; + +export default class YogaNode extends Component { + node: Node; + _ref: HTMLDivElement; + + static defaultProps = { + path: [], + label: 'root', + showGuides: true, + }; + + state = { + hovered: false, + visible: false, + }; + computedLayout?: ComputedLayout; + rootNode?: Node; + + constructor(props: Props) { + super(props); + if (!props.computedLayout) { + // is root node + this.calculateLayout(props); + this.state = { + hovered: false, + visible: !props.computedLayout, + }; + } + } + + componentDidMount() { + setTimeout(() => this.setState({visible: true}), 200); + } + + componentWillReceiveProps(nextProps: Props) { + if ( + !nextProps.computedLayout && + (!this.props.layoutDefinition.equals(nextProps.layoutDefinition) || + this.props.direction !== nextProps.direction) + ) { + // is root node and the layout definition or settings changed + this.calculateLayout(nextProps); + } + } + + componentWillUnmount() { + if (this.rootNode) { + this.rootNode.freeRecursive(); + } + } + + onMouseMove = e => { + this.setState({hovered: e.target === this._ref}); + }; + + calculateLayout(props: Props) { + const root = this.createYogaNodes(props.layoutDefinition); + root.calculateLayout( + props.layoutDefinition.width, + props.layoutDefinition.height, + props.direction, + ); + this.computedLayout = this.getComputedLayout(root); + this.rootNode = root; + } + + createYogaNodes = (layoutDefinition: LayoutRecordType): Node => { + const root = Yoga.Node.create(); + + const defaultLayout = LayoutRecord({}); + [ + 'width', + 'height', + 'minWidth', + 'maxWidth', + 'minHeight', + 'maxHeight', + 'justifyContent', + 'alignItems', + 'alignSelf', + 'alignContent', + 'flexGrow', + 'flexShrink', + 'positionType', + 'aspectRatio', + 'flexWrap', + 'flexDirection', + ].forEach(key => { + try { + const value = + layoutDefinition[key] === '' + ? defaultLayout[key] + : layoutDefinition[key]; + root[`set${key[0].toUpperCase()}${key.substr(1)}`](value); + } catch (e) { + // Do nothing on failure + } + }); + + ['padding', 'margin', 'position', 'border'].forEach(key => { + ['top', 'right', 'bottom', 'left'].forEach(direction => { + try { + root[`set${key[0].toUpperCase()}${key.substr(1)}`]( + Yoga[`EDGE_${direction.toUpperCase()}`], + layoutDefinition[key][direction], + ); + } catch (e) { + // Do nothing on failure + } + }); + }); + + root.setDisplay(Display.Flex); + + (layoutDefinition.children || []) + .map(this.createYogaNodes) + .forEach((node, i) => { + root.insertChild(node, i); + }); + return root; + }; + + getComputedLayout = (node: Node): ComputedLayout => { + return { + ...node.getComputedLayout(), + node, + children: Array(node.getChildCount()).map((_, i) => + this.getComputedLayout(node.getChild(i)), + ), + }; + }; + + onClick = (e: React.MouseEvent) => { + const {onClick} = this.props; + if (onClick) { + e.stopPropagation(); + onClick(this.props.path); + } + }; + + onDoubleClick = (e: React.MouseEvent) => { + const {onDoubleClick} = this.props; + if (onDoubleClick) { + e.stopPropagation(); + onDoubleClick(this.props.path); + } + }; + + onMouseLeave = (_e: React.MouseEvent) => this.setState({hovered: false}); + + showPositionGuides({node}: ComputedLayout) { + const padding = PositionRecord({ + top: node.getComputedPadding(Edge.Top), + left: node.getComputedPadding(Edge.Left), + right: node.getComputedPadding(Edge.Right), + bottom: node.getComputedPadding(Edge.Bottom), + }); + const border = PositionRecord({ + top: node.getComputedBorder(Edge.Top), + left: node.getComputedBorder(Edge.Left), + right: node.getComputedBorder(Edge.Right), + bottom: node.getComputedBorder(Edge.Bottom), + }); + const margin = PositionRecord({ + top: node.getComputedMargin(Edge.Top), + left: node.getComputedMargin(Edge.Left), + right: node.getComputedMargin(Edge.Right), + bottom: node.getComputedMargin(Edge.Bottom), + }); + const position = PositionRecord({ + top: node.getPosition(Edge.Top).value, + left: node.getPosition(Edge.Left).value, + right: node.getPosition(Edge.Right).value, + bottom: node.getPosition(Edge.Bottom).value, + }); + + return [ + , + , + , + , + ]; + } + + render() { + const {layoutDefinition, className, path, selectedNodePath, label} = + this.props; + + const computedLayout: ComputedLayout = + this.props.computedLayout || this.computedLayout; + const {left, top, width, height, children} = computedLayout; + + const isFocused = selectedNodePath && selectedNodePath.length === 0; + + return ( +
{ + this._ref = ref; + }} + onClick={this.onClick}> + {label &&
{label}
} + {isFocused && + this.props.showGuides && + this.showPositionGuides(computedLayout)} + {(children || []).map((child: ComputedLayout, i) => ( + 0 && + selectedNodePath[0] === i + ? selectedNodePath.slice(1) + : null + } + path={path.concat(i)} + onClick={this.props.onClick} + onDoubleClick={this.props.onDoubleClick} + showGuides={this.props.showGuides} + /> + ))} +
+ ); + } +} diff --git a/website-next/src/components/Playground/YogaPositionEditor.css b/website-next/src/components/Playground/YogaPositionEditor.css new file mode 100644 index 0000000000..0280e95313 --- /dev/null +++ b/website-next/src/components/Playground/YogaPositionEditor.css @@ -0,0 +1,30 @@ +/** + * 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. + */ + + .YogaPositionEditor { + text-align: center; + margin-top: 20px; + margin-bottom: 20px; + width: 60%; + margin-left: auto; + margin-right: auto; +} + +.YogaPositionEditor input { + width: 55px; + text-align: center; +} + +.YogaPositionEditorRow { + display: flex; + justify-content: space-between; + align-items: center; + flex-direction: row; + font-size: 12px; + font-weight: 700; + color: #444950; +} diff --git a/website-next/src/components/Playground/YogaPositionEditor.tsx b/website-next/src/components/Playground/YogaPositionEditor.tsx new file mode 100644 index 0000000000..0d328d74a2 --- /dev/null +++ b/website-next/src/components/Playground/YogaPositionEditor.tsx @@ -0,0 +1,72 @@ +/** + * 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. + * + * @format + */ + +import React, {Component} from 'react'; +import {Input} from 'antd'; +import PositionRecord from './PositionRecord'; +import type {PositionRecordType} from './PositionRecord'; +import './YogaPositionEditor.css'; + +type Property = 'position' | 'margin' | 'padding' | 'border'; + +type Props = { + value: PositionRecordType; + property: Property; + disabled?: boolean; + onChange: (property: Property, value: PositionRecordType) => void; +}; + +export default class YogaPositionEditor extends Component { + static availableProperties = ['position', 'margin', 'padding', 'border']; + + static defaultProps = { + value: PositionRecord(), + }; + + render() { + const {onChange, value, property, disabled} = this.props; + return ( +
+ onChange(property, value.set('top', e.target.value))} + /> +
+ + onChange(property, value.set('left', e.target.value)) + } + /> + {property.toUpperCase()} + + onChange(property, value.set('right', e.target.value)) + } + /> +
+ + onChange(property, value.set('bottom', e.target.value)) + } + /> +
+ ); + } +} diff --git a/website-next/src/components/Playground/index.css b/website-next/src/components/Playground/index.css new file mode 100644 index 0000000000..d81174deb9 --- /dev/null +++ b/website-next/src/components/Playground/index.css @@ -0,0 +1,74 @@ +/** + * 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. + */ + + .PlaygroundContainer { + display: flex; + flex-direction: row; + flex-grow: 1; + width: 100%; +} + +.Playground { + display: flex; + flex-grow: 1; + position: relative; + width: 100%; + overflow: hidden; + background: linear-gradient(-90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px), + linear-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px), + linear-gradient(-90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px), + linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px), + linear-gradient( + transparent 4px, + #f5f5f5 4px, + #f5f5f5 97px, + transparent 97px + ), + linear-gradient(-90deg, #e5e5e5 1px, transparent 1px), + linear-gradient( + -90deg, + transparent 4px, + #f5f5f5 4px, + #f5f5f5 97px, + transparent 97px + ), + linear-gradient(#e5e5e5 1px, transparent 1px), #f5f5f5; + background-size: 10px 10px, 10px 10px, 100px 100px, 100px 100px, 100px 100px, + 100px 100px, 100px 100px, 100px 100px; +} + +.Playground > .YogaNode { + margin: auto; + position: static; + align-self: center; +} + +.Playground.standalone > .YogaNode { + transform: translateX(-175px); +} + +.Playground .Actions { + padding: 15px; +} + +.Playground .Actions .ant-btn { + width: 100%; +} + +.Playground .NoContent { + border-top: 1px solid #E8E8E8; + font-size: 18px; + padding: 30px 50px; + text-align: center; + color: #D9D9D9; + font-weight: 300; + line-height: 130%; +} + +.ant-modal-content { + overflow: hidden; +} diff --git a/website-next/src/components/Playground/index.tsx b/website-next/src/components/Playground/index.tsx new file mode 100644 index 0000000000..12171a5b2d --- /dev/null +++ b/website-next/src/components/Playground/index.tsx @@ -0,0 +1,304 @@ +/** + * 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. + * + * @format + */ + +import React, {Component} from 'react'; +import {Direction} from 'yoga-layout/sync'; +import YogaNode from './YogaNode'; +import Editor from './Editor'; +import {List, setIn} from 'immutable'; +import PositionRecord from './PositionRecord'; +import LayoutRecord from './LayoutRecord'; +import Sidebar from './Sidebar'; +import type {LayoutRecordType} from './LayoutRecord'; +import './index.css'; + +type Props = { + layoutDefinition: LayoutRecordType; + direction: Direction; + maxDepth: number; + maxChildren?: number; + minChildren?: number; + selectedNodePath?: Array; + showGuides: boolean; + className?: string; + height?: string | number; + persist?: boolean; + renderSidebar?: ( + layoutDefinition: LayoutRecordType, + onChange: () => any, + ) => any; +}; + +type State = { + selectedNodePath?: Array; + layoutDefinition: LayoutRecordType; + direction: Direction; +}; + +function getPath(path: Array): Array { + return path.reduce((acc, cv) => acc.concat('children', cv), []); +} + +export default class Playground extends Component { + _containerRef?: HTMLElement; + + static defaultProps = { + layoutDefinition: { + width: 500, + height: 500, + children: [ + {width: 100, height: 100}, + {width: 100, height: 100}, + {width: 100, height: 100}, + ], + }, + direction: Direction.LTR, + maxDepth: 3, + showGuides: true, + persist: false, + }; + + rehydrate = (node: LayoutRecordType): LayoutRecordType => { + let record = LayoutRecord(node); + record = record.set('padding', PositionRecord(record.padding)); + record = record.set('border', PositionRecord(record.border)); + record = record.set('margin', PositionRecord(record.margin)); + record = record.set('position', PositionRecord(record.position)); + record = record.set('children', List(record.children.map(this.rehydrate))); + return record; + }; + + state = { + selectedNodePath: this.props.selectedNodePath, + layoutDefinition: this.rehydrate(this.props.layoutDefinition), + direction: this.props.direction, + }; + + componentDidMount() { + document.addEventListener('keydown', this.onKeyDown); + + // rehydrate + if (window.location.search && window.location.search.length > 1) { + try { + const restoredState = JSON.parse( + atob(window.location.search.substr(1)), + ); + this.setState({layoutDefinition: this.rehydrate(restoredState)}); + } catch (e) { + window.history.replaceState( + {}, + null, + window.location.origin + window.location.pathname, + ); + } + } + } + + componentWillUnmount() { + document.removeEventListener('keydown', this.onKeyDown); + } + + onKeyDown = (e: KeyboardEvent) => { + if (e.key === 'Escape') { + this.hideSidePanes(); + } + }; + + onMouseDown = (e: React.MouseEvent) => { + if (e.target === this._containerRef) { + this.hideSidePanes(); + } + }; + + hideSidePanes() { + if (!this.props.renderSidebar) { + // only unselect if we don't have an external sidebar, otherwise the + // sidebar may rely on a certain node to be selected + this.setState({ + selectedNodePath: null, + }); + } + } + + onChangeLayout = (key: string, value: any) => { + const {selectedNodePath} = this.state; + if (selectedNodePath) { + this.modifyAtPath([...getPath(selectedNodePath), key], value); + } + }; + + onRemove = () => { + const {selectedNodePath, layoutDefinition} = this.state; + if (selectedNodePath) { + const index = selectedNodePath.pop(); + const path = getPath(selectedNodePath).concat('children'); + // @ts-ignore + const updatedChildren = layoutDefinition.getIn(path).delete(index); + this.modifyAtPath(path, updatedChildren); + this.setState({selectedNodePath: null}); + } + }; + + onAdd = () => { + const {selectedNodePath, layoutDefinition} = this.state; + if (selectedNodePath) { + const path = getPath(selectedNodePath).concat('children'); + const updatedChildren = layoutDefinition + .getIn(path) + // @ts-ignore + .push(LayoutRecord({width: 100, height: 100})); + this.modifyAtPath(path, updatedChildren); + } + }; + + modifyAtPath( + path: Array, + value: any, + selectedNodePath: Array = this.state.selectedNodePath, + ) { + const layoutDefinition = setIn(this.state.layoutDefinition, path, value); + this.setState({ + layoutDefinition, + selectedNodePath, + }); + + if (this.props.persist) { + window.history.replaceState( + {}, + null, + window.location.origin + + window.location.pathname + + '?' + + this.getHash(layoutDefinition), + ); + } + } + + getHash = ( + layoutDefinition: LayoutRecordType = this.state.layoutDefinition, + ): string => + btoa(JSON.stringify(this.removeUnchangedProperties(layoutDefinition))); + + removeUnchangedProperties = ( + node: LayoutRecordType, + ): {children?: unknown} => { + const untouchedLayout = LayoutRecord({}); + const untouchedPosition = PositionRecord({}); + const result: {children?: unknown} = {}; + if (!node.equals(untouchedLayout)) { + Object.keys(node.toJS()).forEach(key => { + if (key === 'children' && node.children.size > 0) { + result.children = node.children + .toJSON() + .map(this.removeUnchangedProperties); + } else if ( + node[key] instanceof PositionRecord && + !node[key].equals(untouchedPosition) + ) { + result[key] = {}; + Object.keys(untouchedPosition.toJS()).forEach(position => { + if (node[key][position] !== untouchedPosition[position]) { + result[key][position] = node[key][position]; + } + }); + } else if (node[key] !== untouchedLayout[key]) { + result[key] = node[key]; + } + }); + } + return result; + }; + + getChildrenCountForSelectedPath = (): number => { + const selectedNode: LayoutRecordType = ( + this.state.selectedNodePath || [] + ).reduce( + (node: LayoutRecordType, cv) => node.children.get(cv), + this.state.layoutDefinition, + ); + return selectedNode ? selectedNode.children.size : 0; + }; + + render() { + const {layoutDefinition, selectedNodePath, direction} = this.state; + const {height} = this.props; + + // @ts-ignore + const selectedNode: LayoutRecordType | null = selectedNodePath + ? layoutDefinition.getIn(getPath(selectedNodePath)) + : null; + + const playground = ( +
{ + this._containerRef = ref; + }}> + this.setState({selectedNodePath})} + onDoubleClick={this.onAdd} + direction={direction} + showGuides={this.props.showGuides} + /> + {!this.props.renderSidebar && ( + + {this.state.selectedNodePath ? ( + this.setState({[key]: value})} + direction={direction} + onRemove={ + selectedNodePath && selectedNodePath.length > 0 + ? this.onRemove + : undefined + } + onAdd={ + selectedNodePath && + selectedNodePath.length < this.props.maxDepth + ? this.onAdd + : undefined + } + /> + ) : ( +
+ Select a node to edit its properties +
+ )} +
+ )} +
+ ); + + if (this.props.renderSidebar) { + return ( +
+
+ {this.props.renderSidebar( + // @ts-ignore + layoutDefinition.getIn(getPath(selectedNodePath)), + this.onChangeLayout, + )} +
+ {playground} +
+ ); + } else { + return playground; + } + } +} diff --git a/website-next/src/pages/index.tsx b/website-next/src/pages/index.tsx index 82cb2f57a9..c011234c85 100644 --- a/website-next/src/pages/index.tsx +++ b/website-next/src/pages/index.tsx @@ -11,6 +11,7 @@ import Link from '@docusaurus/Link'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import Layout from '@theme/Layout'; import HomepageFeatures from '@site/src/components/HomepageFeatures'; +import BrowserOnly from '@docusaurus/BrowserOnly'; import styles from './index.module.css'; @@ -42,6 +43,12 @@ export default function Home(): JSX.Element {
+ + {() => { + const Playground = require('../components/Playground'); + return ; + }} +
); diff --git a/website/contents/getting-started/standalone.md b/website/contents/getting-started/standalone.md index da0fd20e67..d01bb26ca0 100644 --- a/website/contents/getting-started/standalone.md +++ b/website/contents/getting-started/standalone.md @@ -20,36 +20,37 @@ dependencies { The JavaScript bindings for Yoga can be used from node.js and within the browser. When using Yoga from node.js the native library is used, in browsers a pure JS -version is used (cross-compiled using [emscripten](http://kripken.github.io/emscripten-site/)). +version is used (cross-compiled using [emscripten](https://emscripten.org/)). ``` $> yarn add yoga-layout ``` -This is an example on how to use Yoga in JavaScript, for a full API reference, -have a look at the [flow-type definitions](https://github.com/facebook/yoga/blob/main/javascript/sources/entry-common.js#L123). +This is an example on how to use Yoga in JavaScript. For a full API reference, +have a look at the [TypeScript type definitions](https://github.com/facebook/yoga/blob/main/javascript/src/wrapAssembly.d.ts). ```js -import yoga, {Node} from 'yoga-layout'; +import {loadYoga} from 'yoga-layout'; -const root = Node.create(); +const Yoga = await loadYoga(); +const root = Yoga.Node.create(); root.setWidth(500); root.setHeight(300); -root.setJustifyContent(yoga.JUSTIFY_CENTER); -root.setFlexDirection(yoga.FLEX_DIRECTION_ROW); +root.setJustifyContent(Yoga.JUSTIFY_CENTER); +root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW); -const node1 = Node.create(); +const node1 = Yoga.Node.create(); node1.setWidth(100); node1.setHeight(100); -const node2 = Node.create(); +const node2 = Yoga.Node.create(); node2.setWidth(100); node2.setHeight(100); root.insertChild(node1, 0); root.insertChild(node2, 1); -root.calculateLayout(500, 300, yoga.DIRECTION_LTR); +root.calculateLayout(500, 300, Yoga.DIRECTION_LTR); console.log(root.getComputedLayout()); // {left: 0, top: 0, width: 500, height: 300} console.log(node1.getComputedLayout()); diff --git a/website/src/components/Playground/src/CodeComponentKit.js b/website/src/components/Playground/src/CodeComponentKit.js index 312a400e22..a03c9d9076 100644 --- a/website/src/components/Playground/src/CodeComponentKit.js +++ b/website/src/components/Playground/src/CodeComponentKit.js @@ -96,7 +96,9 @@ function getLayoutCode( }`, ); lines.push(indent + ` newWithView:{}`); - lines.push(indent + ` size:{${getValue(node.width)},${getValue(node.height)}}`); + lines.push( + indent + ` size:{${getValue(node.width)},${getValue(node.height)}}`, + ); const CKFlexboxComponentStyle = [ 'direction', diff --git a/website/src/components/Playground/src/CodeJavaScript.js b/website/src/components/Playground/src/CodeJavaScript.js index 6ed5754326..04d4306898 100644 --- a/website/src/components/Playground/src/CodeJavaScript.js +++ b/website/src/components/Playground/src/CodeJavaScript.js @@ -27,9 +27,11 @@ export const JSEnumLookup = { }; function getEnum(yogaEnum: string, value: string | number): string { - return `yoga.${Object.keys(yoga) - .filter(key => key.toLowerCase().startsWith(yogaEnum.toLowerCase())) - .find(key => yoga[key] === value) || value}`; + return `yoga.${ + Object.keys(yoga) + .filter(key => key.toLowerCase().startsWith(yogaEnum.toLowerCase())) + .find(key => yoga[key] === value) || value + }`; } function setProperty( diff --git a/website/src/components/Playground/src/LayoutRecord.js b/website/src/components/Playground/src/LayoutRecord.js index 3113a313a7..e8d9f13f0b 100644 --- a/website/src/components/Playground/src/LayoutRecord.js +++ b/website/src/components/Playground/src/LayoutRecord.js @@ -8,7 +8,6 @@ * @format */ - import {Record, List} from 'immutable'; import type {RecordOf} from 'immutable'; import PositionRecord from './PositionRecord'; diff --git a/website/src/components/Playground/src/YogaEnumSelect.js b/website/src/components/Playground/src/YogaEnumSelect.js index 828b9b4c24..73fccf13f0 100644 --- a/website/src/components/Playground/src/YogaEnumSelect.js +++ b/website/src/components/Playground/src/YogaEnumSelect.js @@ -57,10 +57,7 @@ export default class YogaEnumSelect extends Component { getTitle = (property: string, key: string): string => { const replacer = new RegExp(`^${property}_`); - return key - .replace(replacer, '') - .replace('_', ' ') - .toLowerCase(); + return key.replace(replacer, '').replace('_', ' ').toLowerCase(); }; render() { diff --git a/website/src/components/Playground/src/YogaNode.js b/website/src/components/Playground/src/YogaNode.js index 905ff505c9..b69001f9fd 100644 --- a/website/src/components/Playground/src/YogaNode.js +++ b/website/src/components/Playground/src/YogaNode.js @@ -244,13 +244,8 @@ export default class YogaNode extends Component { } render() { - const { - layoutDefinition, - className, - path, - selectedNodePath, - label, - } = this.props; + const {layoutDefinition, className, path, selectedNodePath, label} = + this.props; // $FlowFixMe const computedLayout: ComputedLayout = diff --git a/website/src/pages/index.js b/website/src/pages/index.js index d9f2301083..7be78130e8 100644 --- a/website/src/pages/index.js +++ b/website/src/pages/index.js @@ -137,10 +137,7 @@ const AboutSectionOne = () => (

ComponentKit

- +

React Native

diff --git a/yarn.lock b/yarn.lock index 6efd9aade4..6560c0fbd9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -154,12 +154,45 @@ "@jridgewell/gen-mapping" "^0.3.0" "@jridgewell/trace-mapping" "^0.3.9" -"@babel/cli@^7.20.7": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.20.7.tgz#8fc12e85c744a1a617680eacb488fab1fcd35b7c" - integrity sha512-WylgcELHB66WwQqItxNILsMlaTd8/SO6SgTTjMp4uCI7P4QyH1r3nqgFmO3BfM4AtfniHgFMH3EpYFj/zynBkQ== +"@ant-design/colors@^3.1.0": + version "3.2.2" + resolved "https://registry.yarnpkg.com/@ant-design/colors/-/colors-3.2.2.tgz#5ad43d619e911f3488ebac303d606e66a8423903" + integrity sha512-YKgNbG2dlzqMhA9NtI3/pbY16m3Yl/EeWBRa+lB1X1YaYxHrxNexiQYCLTWO/uDvAjLFMEDU+zR901waBtMtjQ== + dependencies: + tinycolor2 "^1.4.1" + +"@ant-design/create-react-context@^0.2.4": + version "0.2.6" + resolved "https://registry.yarnpkg.com/@ant-design/create-react-context/-/create-react-context-0.2.6.tgz#4833a1e4422e5bda5211965e6fed984659c6e4a1" + integrity sha512-pHUuaE50/WEek4w2Q+QYVieLPIGfXM+nUsGSsg8xO6oHBw7dfd14Ws/6q3/L6eZ60zjUiv3WUlSzpWyCOXLqbQ== + dependencies: + gud "^1.0.0" + warning "^4.0.3" + +"@ant-design/css-animation@^1.7.2": + version "1.7.3" + resolved "https://registry.yarnpkg.com/@ant-design/css-animation/-/css-animation-1.7.3.tgz#60a1c970014e86b28f940510d69e503e428f1136" + integrity sha512-LrX0OGZtW+W6iLnTAqnTaoIsRelYeuLZWsrmBJFUXDALQphPsN8cE5DCsmoSlL0QYb94BQxINiuS70Ar/8BNgA== + +"@ant-design/icons-react@~2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@ant-design/icons-react/-/icons-react-2.0.1.tgz#17a2513571ab317aca2927e58cea25dd31e536fb" + integrity sha512-r1QfoltMuruJZqdiKcbPim3d8LNsVPB733U0gZEUSxBLuqilwsW28K2rCTWSMTjmFX7Mfpf+v/wdiFe/XCqThw== dependencies: - "@jridgewell/trace-mapping" "^0.3.8" + "@ant-design/colors" "^3.1.0" + babel-runtime "^6.26.0" + +"@ant-design/icons@~2.1.1": + version "2.1.1" + resolved "https://registry.yarnpkg.com/@ant-design/icons/-/icons-2.1.1.tgz#7b9c08dffd4f5d41db667d9dbe5e0107d0bd9a4a" + integrity sha512-jCH+k2Vjlno4YWl6g535nHR09PwCEmTBKAG6VqF+rhkrSPRLfgpU2maagwbZPLjaHuU5Jd1DFQ2KJpQuI6uG8w== + +"@babel/cli@^7.21.4": + version "7.22.9" + resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.22.9.tgz#501b3614aeda7399371f6d5991404f069b059986" + integrity sha512-nb2O7AThqRo7/E53EGiuAkMaRbb7J5Qp3RvN+dmua1U+kydm0oznkhqbTEG15yk26G/C3yL6OdZjzgl+DMXVVA== + dependencies: + "@jridgewell/trace-mapping" "^0.3.17" commander "^4.0.1" convert-source-map "^1.1.0" fs-readdir-recursive "^1.1.0" @@ -184,7 +217,7 @@ dependencies: "@babel/highlight" "^7.22.5" -"@babel/compat-data@^7.17.7", "@babel/compat-data@^7.20.1", "@babel/compat-data@^7.20.5": +"@babel/compat-data@^7.17.7", "@babel/compat-data@^7.20.5": version "7.20.5" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.20.5.tgz#86f172690b093373a933223b4745deeb6049e733" integrity sha512-KZXo2t10+/jxmkhNXc7pZTqRvSOIvVv/+lJwHS+B2rErwOyjuVRh60yVpb7liQ1U5t7lLJ1bz+t8tSypUZdm0g== @@ -194,6 +227,11 @@ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.22.5.tgz#b1f6c86a02d85d2dd3368a2b67c09add8cd0c255" integrity sha512-4Jc/YuIaYqKnDDz892kPIledykKg12Aw1PYX5i/TY28anJtacvM1Rrr8wbieB9GfEJwlzqT0hUEao0CxEebiDA== +"@babel/compat-data@^7.22.6", "@babel/compat-data@^7.22.9": + version "7.22.9" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.22.9.tgz#71cdb00a1ce3a329ce4cbec3a44f9fef35669730" + integrity sha512-5UamI7xkUcJ3i9qVDS+KFDEK8/7oJ55/sJMB1Ge7IEapr7KfdfV/HErR+koZwOfd+SgtFKOKRhRakdg++DcJpQ== + "@babel/core@7.12.9": version "7.12.9" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.12.9.tgz#fd450c4ec10cdbb980e2928b7aa7a28484593fc8" @@ -216,7 +254,7 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.20.7": +"@babel/core@^7.11.6", "@babel/core@^7.12.3": version "7.20.7" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.20.7.tgz#37072f951bd4d28315445f66e0ec9f6ae0c8c35f" integrity sha512-t1ZjCluspe5DW24bn2Rr1CDb2v9rn/hROtg9a2tmd0+QYf4bsloYfLQzjG4qHPNMhWtKdGC33R5AxGR2Af2cBw== @@ -258,14 +296,26 @@ json5 "^2.2.2" semver "^6.3.0" -"@babel/eslint-parser@^7.19.1": - version "7.19.1" - resolved "https://registry.yarnpkg.com/@babel/eslint-parser/-/eslint-parser-7.19.1.tgz#4f68f6b0825489e00a24b41b6a1ae35414ecd2f4" - integrity sha512-AqNf2QWt1rtu2/1rLswy6CDP7H9Oh3mMhk177Y67Rg8d7RD9WfOLLv8CGn6tisFvS2htm86yIe1yLF6I1UDaGQ== +"@babel/core@^7.21.4": + version "7.22.9" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.22.9.tgz#bd96492c68822198f33e8a256061da3cf391f58f" + integrity sha512-G2EgeufBcYw27U4hhoIwFcgc1XU7TlXJ3mv04oOv1WCuo900U/anZSPzEqNjwdjgffkk2Gs0AN0dW1CKVLcG7w== dependencies: - "@nicolo-ribaudo/eslint-scope-5-internals" "5.1.1-v1" - eslint-visitor-keys "^2.1.0" - semver "^6.3.0" + "@ampproject/remapping" "^2.2.0" + "@babel/code-frame" "^7.22.5" + "@babel/generator" "^7.22.9" + "@babel/helper-compilation-targets" "^7.22.9" + "@babel/helper-module-transforms" "^7.22.9" + "@babel/helpers" "^7.22.6" + "@babel/parser" "^7.22.7" + "@babel/template" "^7.22.5" + "@babel/traverse" "^7.22.8" + "@babel/types" "^7.22.5" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.2.2" + semver "^6.3.1" "@babel/generator@^7.12.5", "@babel/generator@^7.18.7", "@babel/generator@^7.22.5": version "7.22.5" @@ -287,6 +337,16 @@ "@jridgewell/trace-mapping" "^0.3.17" jsesc "^2.5.1" +"@babel/generator@^7.22.7", "@babel/generator@^7.22.9": + version "7.22.9" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.22.9.tgz#572ecfa7a31002fa1de2a9d91621fd895da8493d" + integrity sha512-KtLMbmicyuK2Ak/FTCJVbDnkN1SlT8/kceFTiuDiiRUUSMnHMidxSCdG4ndkTOHHpoomWe/4xkvHkEOncwjYIw== + dependencies: + "@babel/types" "^7.22.5" + "@jridgewell/gen-mapping" "^0.3.2" + "@jridgewell/trace-mapping" "^0.3.17" + jsesc "^2.5.1" + "@babel/helper-annotate-as-pure@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.18.6.tgz#eaa49f6f80d5a33f9a5dd2276e6d6e451be0a6bb" @@ -301,14 +361,6 @@ dependencies: "@babel/types" "^7.22.5" -"@babel/helper-builder-binary-assignment-operator-visitor@^7.18.6": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.18.9.tgz#acd4edfd7a566d1d51ea975dff38fd52906981bb" - integrity sha512-yFQ0YCHoIqarl8BCRwBL8ulYUaZpz3bNsA7oFepAzee+8/+ImtADXNOmO5vJvsPff3qi+hvpkY/NYBTrBQgdNw== - dependencies: - "@babel/helper-explode-assignable-expression" "^7.18.6" - "@babel/types" "^7.18.9" - "@babel/helper-builder-binary-assignment-operator-visitor@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.22.5.tgz#a3f4758efdd0190d8927fcffd261755937c71878" @@ -316,7 +368,7 @@ dependencies: "@babel/types" "^7.22.5" -"@babel/helper-compilation-targets@^7.17.7", "@babel/helper-compilation-targets@^7.18.9", "@babel/helper-compilation-targets@^7.20.0", "@babel/helper-compilation-targets@^7.20.7": +"@babel/helper-compilation-targets@^7.17.7", "@babel/helper-compilation-targets@^7.20.7": version "7.20.7" resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.7.tgz#a6cd33e93629f5eb473b021aac05df62c4cd09bb" integrity sha512-4tGORmfQcrc+bvrjb5y3dG9Mx1IOZjsHqQVUz7XCNHO+iTmqxWnVg3KRygjGmpRLJGdQSKuvFinbIb0CnZwHAQ== @@ -338,7 +390,18 @@ lru-cache "^5.1.1" semver "^6.3.0" -"@babel/helper-create-class-features-plugin@^7.18.6", "@babel/helper-create-class-features-plugin@^7.20.5", "@babel/helper-create-class-features-plugin@^7.20.7", "@babel/helper-create-class-features-plugin@^7.21.0": +"@babel/helper-compilation-targets@^7.22.6", "@babel/helper-compilation-targets@^7.22.9": + version "7.22.9" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.9.tgz#f9d0a7aaaa7cd32a3f31c9316a69f5a9bcacb892" + integrity sha512-7qYrNM6HjpnPHJbopxmb8hSPoZ0gsX8IvUS32JGVoy+pU9e5N0nLr1VjJoR6kA4d9dmGLxNYOjeB8sUDal2WMw== + dependencies: + "@babel/compat-data" "^7.22.9" + "@babel/helper-validator-option" "^7.22.5" + browserslist "^4.21.9" + lru-cache "^5.1.1" + semver "^6.3.1" + +"@babel/helper-create-class-features-plugin@^7.21.0": version "7.21.8" resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.21.8.tgz#205b26330258625ef8869672ebca1e0dee5a0f02" integrity sha512-+THiN8MqiH2AczyuZrnrKL6cAxFRRQDKW9h1YkBvbgKmAm6mwiacig1qT73DHIWMGo40GRnsEfN3LA+E6NtmSw== @@ -368,7 +431,7 @@ "@babel/helper-split-export-declaration" "^7.22.5" semver "^6.3.0" -"@babel/helper-create-regexp-features-plugin@^7.18.6", "@babel/helper-create-regexp-features-plugin@^7.20.5": +"@babel/helper-create-regexp-features-plugin@^7.18.6": version "7.20.5" resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.20.5.tgz#5ea79b59962a09ec2acf20a963a01ab4d076ccca" integrity sha512-m68B1lkg3XDGX5yCvGO0kPx3v9WIYLnzjKfPcQiwntEQa5ZeRkPmo2X/ISJc8qxWGfwUr+kvZAeEzAwLec2r2w== @@ -385,10 +448,10 @@ regexpu-core "^5.3.1" semver "^6.3.0" -"@babel/helper-define-polyfill-provider@^0.3.3": - version "0.3.3" - resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.3.tgz#8612e55be5d51f0cd1f36b4a5a83924e89884b7a" - integrity sha512-z5aQKU4IzbqCC1XH0nAqfsFLMVSo22SBKUc0BxGrLkolTdPTructy0ToNnlO2zA4j9Q/7pjMZf0DSY+DSTYzww== +"@babel/helper-define-polyfill-provider@^0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.4.0.tgz#487053f103110f25b9755c5980e031e93ced24d8" + integrity sha512-RnanLx5ETe6aybRi1cO/edaRH+bNYWaryCEmjDDYyNr4wnSzyOp8T0dWipmqVHKEY3AbVKUom50AKSlj1zmKbg== dependencies: "@babel/helper-compilation-targets" "^7.17.7" "@babel/helper-plugin-utils" "^7.16.7" @@ -397,19 +460,18 @@ resolve "^1.14.2" semver "^6.1.2" -"@babel/helper-define-polyfill-provider@^0.4.0": - version "0.4.0" - resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.4.0.tgz#487053f103110f25b9755c5980e031e93ced24d8" - integrity sha512-RnanLx5ETe6aybRi1cO/edaRH+bNYWaryCEmjDDYyNr4wnSzyOp8T0dWipmqVHKEY3AbVKUom50AKSlj1zmKbg== +"@babel/helper-define-polyfill-provider@^0.4.1": + version "0.4.1" + resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.4.1.tgz#af1429c4a83ac316a6a8c2cc8ff45cb5d2998d3a" + integrity sha512-kX4oXixDxG197yhX+J3Wp+NpL2wuCFjWQAr6yX2jtCnflK9ulMI51ULFGIrWiX1jGfvAxdHp+XQCcP2bZGPs9A== dependencies: - "@babel/helper-compilation-targets" "^7.17.7" - "@babel/helper-plugin-utils" "^7.16.7" + "@babel/helper-compilation-targets" "^7.22.6" + "@babel/helper-plugin-utils" "^7.22.5" debug "^4.1.1" lodash.debounce "^4.0.8" resolve "^1.14.2" - semver "^6.1.2" -"@babel/helper-environment-visitor@^7.18.9", "@babel/helper-environment-visitor@^7.21.5": +"@babel/helper-environment-visitor@^7.21.5": version "7.21.5" resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.21.5.tgz#c769afefd41d171836f7cb63e295bedf689d48ba" integrity sha512-IYl4gZ3ETsWocUWgsFZLM5i1BYx9SoemminVEXadgLBa9TdeorzgLKm8wWLA6J1N/kT3Kch8XIk1laNzYoHKvQ== @@ -419,14 +481,7 @@ resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.5.tgz#f06dd41b7c1f44e1f8da6c4055b41ab3a09a7e98" integrity sha512-XGmhECfVA/5sAt+H+xpSg0mfrHq6FzNr9Oxh7PSEBBRUb/mL7Kz3NICXb194rCqAEdxkhPT1a88teizAFyvk8Q== -"@babel/helper-explode-assignable-expression@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.18.6.tgz#41f8228ef0a6f1a036b8dfdfec7ce94f9a6bc096" - integrity sha512-eyAYAsQmB80jNfg4baAtLeWAQHfHFiR483rzFK+BhETlGZaQC9bsfrugfXDCbRHLQbIA7U5NxhhOxN7p/dWIcg== - dependencies: - "@babel/types" "^7.18.6" - -"@babel/helper-function-name@^7.18.9", "@babel/helper-function-name@^7.19.0", "@babel/helper-function-name@^7.21.0": +"@babel/helper-function-name@^7.21.0": version "7.21.0" resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.21.0.tgz#d552829b10ea9f120969304023cd0645fa00b1b4" integrity sha512-HfK1aMRanKHpxemaY2gqBmL04iAPOPRj7DxtNbiDOrJK+gdwkiNRVpCpUJYbUT+aZyemKN8brqTOxzCaG6ExRg== @@ -470,7 +525,7 @@ dependencies: "@babel/types" "^7.22.5" -"@babel/helper-module-imports@^7.18.6", "@babel/helper-module-imports@^7.21.4": +"@babel/helper-module-imports@^7.21.4": version "7.21.4" resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.21.4.tgz#ac88b2f76093637489e718a90cec6cf8a9b029af" integrity sha512-orajc5T2PsRYUN3ZryCEFeMDYwyw09c/pZeaQEZPH0MpKzSvn3e0uXsDBu3k03VI+9DBiRo+l22BfKTpKwa/Wg== @@ -498,7 +553,7 @@ "@babel/traverse" "^7.22.5" "@babel/types" "^7.22.5" -"@babel/helper-module-transforms@^7.18.6", "@babel/helper-module-transforms@^7.19.6", "@babel/helper-module-transforms@^7.20.7", "@babel/helper-module-transforms@^7.21.5": +"@babel/helper-module-transforms@^7.20.7", "@babel/helper-module-transforms@^7.21.5": version "7.21.5" resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.21.5.tgz#d937c82e9af68d31ab49039136a222b17ac0b420" integrity sha512-bI2Z9zBGY2q5yMHoBvJ2a9iX3ZOAzJPm7Q8Yz6YeoUjU/Cvhmi2G4QyTNyPBqqXSgTjUxRg3L0xV45HvkNWWBw== @@ -512,6 +567,17 @@ "@babel/traverse" "^7.21.5" "@babel/types" "^7.21.5" +"@babel/helper-module-transforms@^7.22.9": + version "7.22.9" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.22.9.tgz#92dfcb1fbbb2bc62529024f72d942a8c97142129" + integrity sha512-t+WA2Xn5K+rTeGtC8jCsdAH52bjggG5TKRuRrAGNM/mjIbO4GxvlLMFOEz9wXY5I2XQ60PMFsAG2WIcG82dQMQ== + dependencies: + "@babel/helper-environment-visitor" "^7.22.5" + "@babel/helper-module-imports" "^7.22.5" + "@babel/helper-simple-access" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + "@babel/helper-validator-identifier" "^7.22.5" + "@babel/helper-optimise-call-expression@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.18.6.tgz#9369aa943ee7da47edab2cb4e838acf09d290ffe" @@ -531,7 +597,7 @@ resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz#2f75a831269d4f677de49986dff59927533cf375" integrity sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg== -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.16.7", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.18.9", "@babel/helper-plugin-utils@^7.19.0", "@babel/helper-plugin-utils@^7.20.2", "@babel/helper-plugin-utils@^7.21.5", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.16.7", "@babel/helper-plugin-utils@^7.18.6", "@babel/helper-plugin-utils@^7.20.2", "@babel/helper-plugin-utils@^7.21.5", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": version "7.21.5" resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.21.5.tgz#345f2377d05a720a4e5ecfa39cbf4474a4daed56" integrity sha512-0WDaIlXKOX/3KfBK/dwP1oQGiPh6rjMkT7HIRv7i5RR2VUMwrx5ZL0dwBkKx7+SW1zwNdgjHd34IMk5ZjTeHVg== @@ -541,16 +607,6 @@ resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz#dd7ee3735e8a313b9f7b05a773d892e88e6d7295" integrity sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg== -"@babel/helper-remap-async-to-generator@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.18.9.tgz#997458a0e3357080e54e1d79ec347f8a8cd28519" - integrity sha512-dI7q50YKd8BAv3VEfgg7PS7yD3Rtbi2J1XMXaalXO0W0164hYLnh8zpjRS0mte9MfVp/tltvr/cfdXPvJr1opA== - dependencies: - "@babel/helper-annotate-as-pure" "^7.18.6" - "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-wrap-function" "^7.18.9" - "@babel/types" "^7.18.9" - "@babel/helper-remap-async-to-generator@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.22.5.tgz#14a38141a7bf2165ad38da61d61cf27b43015da2" @@ -561,7 +617,7 @@ "@babel/helper-wrap-function" "^7.22.5" "@babel/types" "^7.22.5" -"@babel/helper-replace-supers@^7.18.6", "@babel/helper-replace-supers@^7.20.7", "@babel/helper-replace-supers@^7.21.5": +"@babel/helper-replace-supers@^7.21.5": version "7.21.5" resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.21.5.tgz#a6ad005ba1c7d9bc2973dfde05a1bba7065dde3c" integrity sha512-/y7vBgsr9Idu4M6MprbOVUfH3vs7tsIfnVWv/Ml2xgwvyH6LTngdfbf5AdsKwkJy4zgy1X/kuNrEKvhhK28Yrg== @@ -627,6 +683,13 @@ dependencies: "@babel/types" "^7.22.5" +"@babel/helper-split-export-declaration@^7.22.6": + version "7.22.6" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz#322c61b7310c0997fe4c323955667f18fcefb91c" + integrity sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g== + dependencies: + "@babel/types" "^7.22.5" + "@babel/helper-string-parser@^7.21.5": version "7.21.5" resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.21.5.tgz#2b3eea65443c6bdc31c22d037c65f6d323b6b2bd" @@ -657,16 +720,6 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.22.5.tgz#de52000a15a177413c8234fa3a8af4ee8102d0ac" integrity sha512-R3oB6xlIVKUnxNUxbmgq7pKjxpru24zlimpE8WK47fACIlM0II/Hm1RS8IaOI7NgCr6LNS+jl5l75m20npAziw== -"@babel/helper-wrap-function@^7.18.9": - version "7.20.5" - resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.20.5.tgz#75e2d84d499a0ab3b31c33bcfe59d6b8a45f62e3" - integrity sha512-bYMxIWK5mh+TgXGVqAtnu5Yn1un+v8DDZtqyzKRLUzrh70Eal2O3aZ7aPYiMADO4uKlkzOiRiZ6GX5q3qxvW9Q== - dependencies: - "@babel/helper-function-name" "^7.19.0" - "@babel/template" "^7.18.10" - "@babel/traverse" "^7.20.5" - "@babel/types" "^7.20.5" - "@babel/helper-wrap-function@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.22.5.tgz#44d205af19ed8d872b4eefb0d2fa65f45eb34f06" @@ -695,6 +748,15 @@ "@babel/traverse" "^7.20.7" "@babel/types" "^7.20.7" +"@babel/helpers@^7.22.6": + version "7.22.6" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.22.6.tgz#8e61d3395a4f0c5a8060f309fb008200969b5ecd" + integrity sha512-YjDs6y/fVOYFV8hAf1rxd1QvR9wJe1pDBZ2AREKq/SDayfPzgk0PBnVuTCE5X1acEpMMNOVUqoe+OwiZGJ+OaA== + dependencies: + "@babel/template" "^7.22.5" + "@babel/traverse" "^7.22.6" + "@babel/types" "^7.22.5" + "@babel/highlight@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.18.6.tgz#81158601e93e2563795adcbfbdf5d64be3f2ecdf" @@ -713,14 +775,14 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/node@^7.20.7": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/node/-/node-7.20.7.tgz#609be7f841893e24931b7910263babfde84040a9" - integrity sha512-AQt3gVcP+fpFuoFn4FmIW/+5JovvEoA9og4Y1LrRw0pv3jkl4tujZMMy3X/3ugjLrEy3k1aNywo3JIl3g+jVXQ== +"@babel/node@^7.21.4": + version "7.22.6" + resolved "https://registry.yarnpkg.com/@babel/node/-/node-7.22.6.tgz#a47b4f150f06bad1808823c4519690ded6c93911" + integrity sha512-Lt6v+RUQOTsEOXLv+KfjogLFkFfsLPPSoXZqmbngfVatkWjQPnFGHO0xjFRcN6XEvm3vsnZn+AWQiRpgZFsdIA== dependencies: - "@babel/register" "^7.18.9" + "@babel/register" "^7.22.5" commander "^4.0.1" - core-js "^3.26.0" + core-js "^3.30.2" node-environment-flags "^1.0.5" regenerator-runtime "^0.13.11" v8flags "^3.1.1" @@ -735,12 +797,10 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.5.tgz#721fd042f3ce1896238cf1b341c77eb7dee7dbea" integrity sha512-DFZMC9LJUG9PLOclRC32G63UXwzqS2koQC8dkx+PLdmt1xSePYpbT/NbsrJy8Q/muXz7o/h/d4A7Fuyixm559Q== -"@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.18.6.tgz#da5b8f9a580acdfbe53494dba45ea389fb09a4d2" - integrity sha512-Dgxsyg54Fx1d4Nge8UnvTrED63vrwOdPmyvPzlNN/boaliRP54pm3pGzZD1SJUwrBA+Cs/xdG8kXX6Mn/RfISQ== - dependencies: - "@babel/helper-plugin-utils" "^7.18.6" +"@babel/parser@^7.22.7": + version "7.22.7" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.7.tgz#df8cf085ce92ddbdbf668a7f186ce848c9036cae" + integrity sha512-7NF8pOkHP5o2vpmGgNGcfAeCvOYhGLyA3Z4eBQkT1RJlWu47n63bCs93QfJ2hIAFCil7L5P2IWhs1oToVgrL0Q== "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.22.5": version "7.22.5" @@ -749,15 +809,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.18.9": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.20.7.tgz#d9c85589258539a22a901033853101a6198d4ef1" - integrity sha512-sbr9+wNE5aXMBBFBICk01tt7sBf2Oc9ikRFEcem/ZORup9IMUdNhW7/wVLEbbtlWOsEubJet46mHAL2C8+2jKQ== - dependencies: - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/helper-skip-transparent-expression-wrappers" "^7.20.0" - "@babel/plugin-proposal-optional-chaining" "^7.20.7" - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.22.5.tgz#fef09f9499b1f1c930da8a0c419db42167d792ca" @@ -767,81 +818,6 @@ "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" "@babel/plugin-transform-optional-chaining" "^7.22.5" -"@babel/plugin-proposal-async-generator-functions@^7.20.1": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.20.7.tgz#bfb7276d2d573cb67ba379984a2334e262ba5326" - integrity sha512-xMbiLsn/8RK7Wq7VeVytytS2L6qE69bXPB10YCmMdDZbKF4okCqY74pI/jJQ/8U0b/F6NrT2+14b8/P9/3AMGA== - dependencies: - "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/helper-remap-async-to-generator" "^7.18.9" - "@babel/plugin-syntax-async-generators" "^7.8.4" - -"@babel/plugin-proposal-class-properties@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.18.6.tgz#b110f59741895f7ec21a6fff696ec46265c446a3" - integrity sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ== - dependencies: - "@babel/helper-create-class-features-plugin" "^7.18.6" - "@babel/helper-plugin-utils" "^7.18.6" - -"@babel/plugin-proposal-class-static-block@^7.18.6": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.20.7.tgz#92592e9029b13b15be0f7ce6a7aedc2879ca45a7" - integrity sha512-AveGOoi9DAjUYYuUAG//Ig69GlazLnoyzMw68VCDux+c1tsnnH/OkYcpz/5xzMkEFC6UxjR5Gw1c+iY2wOGVeQ== - dependencies: - "@babel/helper-create-class-features-plugin" "^7.20.7" - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/plugin-syntax-class-static-block" "^7.14.5" - -"@babel/plugin-proposal-dynamic-import@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.18.6.tgz#72bcf8d408799f547d759298c3c27c7e7faa4d94" - integrity sha512-1auuwmK+Rz13SJj36R+jqFPMJWyKEDd7lLSdOj4oJK0UTgGueSAtkrCvz9ewmgyU/P941Rv2fQwZJN8s6QruXw== - dependencies: - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/plugin-syntax-dynamic-import" "^7.8.3" - -"@babel/plugin-proposal-export-namespace-from@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.18.9.tgz#5f7313ab348cdb19d590145f9247540e94761203" - integrity sha512-k1NtHyOMvlDDFeb9G5PhUXuGj8m/wiwojgQVEhJ/fsVsMCpLyOP4h0uGEjYJKrRI+EVPlb5Jk+Gt9P97lOGwtA== - dependencies: - "@babel/helper-plugin-utils" "^7.18.9" - "@babel/plugin-syntax-export-namespace-from" "^7.8.3" - -"@babel/plugin-proposal-json-strings@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.18.6.tgz#7e8788c1811c393aff762817e7dbf1ebd0c05f0b" - integrity sha512-lr1peyn9kOdbYc0xr0OdHTZ5FMqS6Di+H0Fz2I/JwMzGmzJETNeOFq2pBySw6X/KFL5EWDjlJuMsUGRFb8fQgQ== - dependencies: - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/plugin-syntax-json-strings" "^7.8.3" - -"@babel/plugin-proposal-logical-assignment-operators@^7.18.9": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.20.7.tgz#dfbcaa8f7b4d37b51e8bfb46d94a5aea2bb89d83" - integrity sha512-y7C7cZgpMIjWlKE5T7eJwp+tnRYM89HmRvWM5EQuB5BoHEONjmQ8lSNmBUwOyy/GFRsohJED51YBF79hE1djug== - dependencies: - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" - -"@babel/plugin-proposal-nullish-coalescing-operator@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.18.6.tgz#fdd940a99a740e577d6c753ab6fbb43fdb9467e1" - integrity sha512-wQxQzxYeJqHcfppzBDnm1yAY0jSRkUXR2z8RePZYrKwMKgMlE8+Z6LUno+bd6LvbGh8Gltvy74+9pIYkr+XkKA== - dependencies: - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" - -"@babel/plugin-proposal-numeric-separator@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.18.6.tgz#899b14fbafe87f053d2c5ff05b36029c62e13c75" - integrity sha512-ozlZFogPqoLm8WBr5Z8UckIoE4YQ5KESVcNudyXOR8uqIkliTEgJ3RoketfG6pmzLdeZF0H/wjE9/cCEitBl7Q== - dependencies: - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/plugin-syntax-numeric-separator" "^7.10.4" - "@babel/plugin-proposal-object-rest-spread@7.12.1": version "7.12.1" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.12.1.tgz#def9bd03cea0f9b72283dac0ec22d289c7691069" @@ -851,58 +827,12 @@ "@babel/plugin-syntax-object-rest-spread" "^7.8.0" "@babel/plugin-transform-parameters" "^7.12.1" -"@babel/plugin-proposal-object-rest-spread@^7.20.2": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.20.7.tgz#aa662940ef425779c75534a5c41e9d936edc390a" - integrity sha512-d2S98yCiLxDVmBmE8UjGcfPvNEUbA1U5q5WxaWFUGRzJSVAZqm5W6MbPct0jxnegUZ0niLeNX+IOzEs7wYg9Dg== - dependencies: - "@babel/compat-data" "^7.20.5" - "@babel/helper-compilation-targets" "^7.20.7" - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/plugin-syntax-object-rest-spread" "^7.8.3" - "@babel/plugin-transform-parameters" "^7.20.7" - -"@babel/plugin-proposal-optional-catch-binding@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.18.6.tgz#f9400d0e6a3ea93ba9ef70b09e72dd6da638a2cb" - integrity sha512-Q40HEhs9DJQyaZfUjjn6vE8Cv4GmMHCYuMGIWUnlxH6400VGxOuwWsPt4FxXxJkC/5eOzgn0z21M9gMT4MOhbw== - dependencies: - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" - -"@babel/plugin-proposal-optional-chaining@^7.18.9", "@babel/plugin-proposal-optional-chaining@^7.20.7": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.20.7.tgz#49f2b372519ab31728cc14115bb0998b15bfda55" - integrity sha512-T+A7b1kfjtRM51ssoOfS1+wbyCVqorfyZhT99TvxxLMirPShD8CzKMRepMlCBGM5RpHMbn8s+5MMHnPstJH6mQ== - dependencies: - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/helper-skip-transparent-expression-wrappers" "^7.20.0" - "@babel/plugin-syntax-optional-chaining" "^7.8.3" - -"@babel/plugin-proposal-private-methods@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.18.6.tgz#5209de7d213457548a98436fa2882f52f4be6bea" - integrity sha512-nutsvktDItsNn4rpGItSNV2sz1XwS+nfU0Rg8aCx3W3NOKVzdMjJRu0O5OkgDp3ZGICSTbgRpxZoWsxoKRvbeA== - dependencies: - "@babel/helper-create-class-features-plugin" "^7.18.6" - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2": version "7.21.0-placeholder-for-preset-env.2" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz#7844f9289546efa9febac2de4cfe358a050bd703" integrity sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w== -"@babel/plugin-proposal-private-property-in-object@^7.18.6": - version "7.20.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.20.5.tgz#309c7668f2263f1c711aa399b5a9a6291eef6135" - integrity sha512-Vq7b9dUA12ByzB4EjQTPo25sFhY+08pQDBSZRtUAkj7lb7jahaHR5igera16QZ+3my1nYR4dKsNdYj5IjPHilQ== - dependencies: - "@babel/helper-annotate-as-pure" "^7.18.6" - "@babel/helper-create-class-features-plugin" "^7.20.5" - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/plugin-syntax-private-property-in-object" "^7.14.5" - -"@babel/plugin-proposal-unicode-property-regex@^7.18.6", "@babel/plugin-proposal-unicode-property-regex@^7.4.4": +"@babel/plugin-proposal-unicode-property-regex@^7.4.4": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.18.6.tgz#af613d2cd5e643643b65cded64207b15c85cb78e" integrity sha512-2BShG/d5yoZyXZfVePH91urL5wTG6ASZU9M4o03lKK8u8UW1y08OMttBSOADTcJrnPMpvDXRG3G8fyLh4ovs8w== @@ -952,13 +882,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-syntax-import-assertions@^7.20.0": - version "7.20.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.20.0.tgz#bb50e0d4bea0957235390641209394e87bdb9cc4" - integrity sha512-IUh1vakzNoWalR8ch/areW7qFopR2AEw03JlG7BbrDqmQ4X3q9uuipQwSGrUn7oGiemKjtSLDhNtQHzMHr1JdQ== - dependencies: - "@babel/helper-plugin-utils" "^7.19.0" - "@babel/plugin-syntax-import-assertions@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.22.5.tgz#07d252e2aa0bc6125567f742cd58619cb14dce98" @@ -1086,13 +1009,6 @@ "@babel/helper-create-regexp-features-plugin" "^7.18.6" "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-arrow-functions@^7.18.6": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.20.7.tgz#bea332b0e8b2dab3dafe55a163d8227531ab0551" - integrity sha512-3poA5E7dzDomxj9WXWwuD6A5F3kc7VXwIJO+E+J8qtDtS+pXPAhrgEyh+9GBwBgPq1Z+bB+/JD60lp5jsN7JPQ== - dependencies: - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/plugin-transform-arrow-functions@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.22.5.tgz#e5ba566d0c58a5b2ba2a8b795450641950b71958" @@ -1110,14 +1026,15 @@ "@babel/helper-remap-async-to-generator" "^7.22.5" "@babel/plugin-syntax-async-generators" "^7.8.4" -"@babel/plugin-transform-async-to-generator@^7.18.6": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.20.7.tgz#dfee18623c8cb31deb796aa3ca84dda9cea94354" - integrity sha512-Uo5gwHPT9vgnSXQxqGtpdufUiWp96gk7yiP4Mp5bm1QMkEmLXBO7PAGYbKoJ6DhAwiNkcHFBol/x5zZZkL/t0Q== +"@babel/plugin-transform-async-generator-functions@^7.22.7": + version "7.22.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-generator-functions/-/plugin-transform-async-generator-functions-7.22.7.tgz#053e76c0a903b72b573cb1ab7d6882174d460a1b" + integrity sha512-7HmE7pk/Fmke45TODvxvkxRMV9RazV+ZZzhOL9AG8G29TLrr3jkjwF7uJfxZ30EoXpO+LJkq4oA8NjO2DTnEDg== dependencies: - "@babel/helper-module-imports" "^7.18.6" - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/helper-remap-async-to-generator" "^7.18.9" + "@babel/helper-environment-visitor" "^7.22.5" + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-remap-async-to-generator" "^7.22.5" + "@babel/plugin-syntax-async-generators" "^7.8.4" "@babel/plugin-transform-async-to-generator@^7.22.5": version "7.22.5" @@ -1128,13 +1045,6 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/helper-remap-async-to-generator" "^7.22.5" -"@babel/plugin-transform-block-scoped-functions@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.18.6.tgz#9187bf4ba302635b9d70d986ad70f038726216a8" - integrity sha512-ExUcOqpPWnliRcPqves5HJcJOvHvIIWfuS4sroBUenPuMdmW+SMHDakmtS7qOo13sVppmUijqeTv7qqGsvURpQ== - dependencies: - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/plugin-transform-block-scoped-functions@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.22.5.tgz#27978075bfaeb9fa586d3cb63a3d30c1de580024" @@ -1142,13 +1052,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-block-scoping@^7.20.2": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.20.7.tgz#5cc9cc3f3976de7f632d3f20eab3abee299ed36e" - integrity sha512-C1njwSKnumUgtgc4j1LAWR48PkfwfHHRd8bWyolSCLShKnqA52VX1+B+GZhJteQlwZeSqYddCQh9Str816Jxtw== - dependencies: - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/plugin-transform-block-scoping@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.22.5.tgz#8bfc793b3a4b2742c0983fadc1480d843ecea31b" @@ -1173,21 +1076,6 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-class-static-block" "^7.14.5" -"@babel/plugin-transform-classes@^7.20.2": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.20.7.tgz#f438216f094f6bb31dc266ebfab8ff05aecad073" - integrity sha512-LWYbsiXTPKl+oBlXUGlwNlJZetXD5Am+CyBdqhPsDVjM9Jc8jwBJFrKhHf900Kfk2eZG1y9MAG3UNajol7A4VQ== - dependencies: - "@babel/helper-annotate-as-pure" "^7.18.6" - "@babel/helper-compilation-targets" "^7.20.7" - "@babel/helper-environment-visitor" "^7.18.9" - "@babel/helper-function-name" "^7.19.0" - "@babel/helper-optimise-call-expression" "^7.18.6" - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/helper-replace-supers" "^7.20.7" - "@babel/helper-split-export-declaration" "^7.18.6" - globals "^11.1.0" - "@babel/plugin-transform-classes@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.22.5.tgz#635d4e98da741fad814984639f4c0149eb0135e1" @@ -1203,13 +1091,20 @@ "@babel/helper-split-export-declaration" "^7.22.5" globals "^11.1.0" -"@babel/plugin-transform-computed-properties@^7.18.9": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.20.7.tgz#704cc2fd155d1c996551db8276d55b9d46e4d0aa" - integrity sha512-Lz7MvBK6DTjElHAmfu6bfANzKcxpyNPeYBGEafyA6E5HtRpjpZwU+u7Qrgz/2OR0z+5TvKYbPdphfSaAcZBrYQ== +"@babel/plugin-transform-classes@^7.22.6": + version "7.22.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.22.6.tgz#e04d7d804ed5b8501311293d1a0e6d43e94c3363" + integrity sha512-58EgM6nuPNG6Py4Z3zSuu0xWu2VfodiMi72Jt5Kj2FECmaYk1RrTXA45z6KBFsu9tRgwQDwIiY4FXTt+YsSFAQ== dependencies: - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/template" "^7.20.7" + "@babel/helper-annotate-as-pure" "^7.22.5" + "@babel/helper-compilation-targets" "^7.22.6" + "@babel/helper-environment-visitor" "^7.22.5" + "@babel/helper-function-name" "^7.22.5" + "@babel/helper-optimise-call-expression" "^7.22.5" + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-replace-supers" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + globals "^11.1.0" "@babel/plugin-transform-computed-properties@^7.22.5": version "7.22.5" @@ -1219,13 +1114,6 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/template" "^7.22.5" -"@babel/plugin-transform-destructuring@^7.20.2": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.20.7.tgz#8bda578f71620c7de7c93af590154ba331415454" - integrity sha512-Xwg403sRrZb81IVB79ZPqNQME23yhugYVqgTxAhT99h485F4f+GMELFhhOsscDUB7HCswepKeCKLn/GZvUKoBA== - dependencies: - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/plugin-transform-destructuring@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.22.5.tgz#d3aca7438f6c26c78cdd0b0ba920a336001b27cc" @@ -1233,14 +1121,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-dotall-regex@^7.18.6", "@babel/plugin-transform-dotall-regex@^7.4.4": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.18.6.tgz#b286b3e7aae6c7b861e45bed0a2fafd6b1a4fef8" - integrity sha512-6S3jpun1eEbAxq7TdjLotAsl4WpQI9DxfkycRcKrjhQYzU87qpXdknpBg/e+TdcMehqGnLFi7tnFUBR02Vq6wg== - dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.18.6" - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/plugin-transform-dotall-regex@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.22.5.tgz#dbb4f0e45766eb544e193fb00e65a1dd3b2a4165" @@ -1249,12 +1129,13 @@ "@babel/helper-create-regexp-features-plugin" "^7.22.5" "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-duplicate-keys@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.18.9.tgz#687f15ee3cdad6d85191eb2a372c4528eaa0ae0e" - integrity sha512-d2bmXCtZXYc59/0SanQKbiWINadaJXqtvIQIzd4+hNwkWBgyCd5F/2t1kXoUdvPMrxzPvhK6EMQRROxsue+mfw== +"@babel/plugin-transform-dotall-regex@^7.4.4": + version "7.18.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.18.6.tgz#b286b3e7aae6c7b861e45bed0a2fafd6b1a4fef8" + integrity sha512-6S3jpun1eEbAxq7TdjLotAsl4WpQI9DxfkycRcKrjhQYzU87qpXdknpBg/e+TdcMehqGnLFi7tnFUBR02Vq6wg== dependencies: - "@babel/helper-plugin-utils" "^7.18.9" + "@babel/helper-create-regexp-features-plugin" "^7.18.6" + "@babel/helper-plugin-utils" "^7.18.6" "@babel/plugin-transform-duplicate-keys@^7.22.5": version "7.22.5" @@ -1271,14 +1152,6 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-dynamic-import" "^7.8.3" -"@babel/plugin-transform-exponentiation-operator@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.18.6.tgz#421c705f4521888c65e91fdd1af951bfefd4dacd" - integrity sha512-wzEtc0+2c88FVR34aQmiz56dxEkxr2g8DQb/KfaFa1JYXOFVsbhvAonFN6PwVWj++fKmku8NP80plJ5Et4wqHw== - dependencies: - "@babel/helper-builder-binary-assignment-operator-visitor" "^7.18.6" - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/plugin-transform-exponentiation-operator@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.22.5.tgz#402432ad544a1f9a480da865fda26be653e48f6a" @@ -1295,13 +1168,6 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-export-namespace-from" "^7.8.3" -"@babel/plugin-transform-for-of@^7.18.8": - version "7.18.8" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.18.8.tgz#6ef8a50b244eb6a0bdbad0c7c61877e4e30097c1" - integrity sha512-yEfTRnjuskWYo0k1mHUqrVWaZwrdq8AYbfrpqULOJOaucGSp4mNMVps+YtA8byoevxS/urwU75vyhQIxcCgiBQ== - dependencies: - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/plugin-transform-for-of@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.22.5.tgz#ab1b8a200a8f990137aff9a084f8de4099ab173f" @@ -1309,15 +1175,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-function-name@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.18.9.tgz#cc354f8234e62968946c61a46d6365440fc764e0" - integrity sha512-WvIBoRPaJQ5yVHzcnJFor7oS5Ls0PYixlTYE63lCj2RtdQEl15M68FXQlxnG6wdraJIXRdR7KI+hQ7q/9QjrCQ== - dependencies: - "@babel/helper-compilation-targets" "^7.18.9" - "@babel/helper-function-name" "^7.18.9" - "@babel/helper-plugin-utils" "^7.18.9" - "@babel/plugin-transform-function-name@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.22.5.tgz#935189af68b01898e0d6d99658db6b164205c143" @@ -1335,13 +1192,6 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-json-strings" "^7.8.3" -"@babel/plugin-transform-literals@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.18.9.tgz#72796fdbef80e56fba3c6a699d54f0de557444bc" - integrity sha512-IFQDSRoTPnrAIrI5zoZv73IFeZu2dhu6irxQjY9rNjTT53VmKg9fenjvoiOWOkJ6mm4jKVPtdMzBY98Fp4Z4cg== - dependencies: - "@babel/helper-plugin-utils" "^7.18.9" - "@babel/plugin-transform-literals@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.22.5.tgz#e9341f4b5a167952576e23db8d435849b1dd7920" @@ -1357,13 +1207,6 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" -"@babel/plugin-transform-member-expression-literals@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.18.6.tgz#ac9fdc1a118620ac49b7e7a5d2dc177a1bfee88e" - integrity sha512-qSF1ihLGO3q+/g48k85tUjD033C29TNTVB2paCwZPVmOsjn9pClvYYrM2VeJpBY2bcNkuny0YUyTNRyRxJ54KA== - dependencies: - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/plugin-transform-member-expression-literals@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.22.5.tgz#4fcc9050eded981a468347dd374539ed3e058def" @@ -1371,14 +1214,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-modules-amd@^7.19.6": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.20.7.tgz#1e5cfeb4e5f9b392e86f85698896336b442f8760" - integrity sha512-+1IVLD+dHOzRZWNFFSoyPZz4ffsVmOP+OhhjeahLKpU97v/52LcCb9RabRl5eHM1/HAuH5Dl0q9Pyzrq1v2otQ== - dependencies: - "@babel/helper-module-transforms" "^7.20.7" - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/plugin-transform-modules-amd@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.22.5.tgz#4e045f55dcf98afd00f85691a68fc0780704f526" @@ -1387,7 +1222,7 @@ "@babel/helper-module-transforms" "^7.22.5" "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-modules-commonjs@^7.19.6", "@babel/plugin-transform-modules-commonjs@^7.21.5": +"@babel/plugin-transform-modules-commonjs@^7.21.5": version "7.21.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.21.5.tgz#d69fb947eed51af91de82e4708f676864e5e47bc" integrity sha512-OVryBEgKUbtqMoB7eG2rs6UFexJi6Zj6FDXx+esBLPTCxCNxAY9o+8Di7IsUGJ+AVhp5ncK0fxWUBd0/1gPhrQ== @@ -1405,16 +1240,6 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/helper-simple-access" "^7.22.5" -"@babel/plugin-transform-modules-systemjs@^7.19.6": - version "7.19.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.19.6.tgz#59e2a84064b5736a4471b1aa7b13d4431d327e0d" - integrity sha512-fqGLBepcc3kErfR9R3DnVpURmckXP7gj7bAlrTQyBxrigFqszZCkFkcoxzCp2v32XmwXLvbw+8Yq9/b+QqksjQ== - dependencies: - "@babel/helper-hoist-variables" "^7.18.6" - "@babel/helper-module-transforms" "^7.19.6" - "@babel/helper-plugin-utils" "^7.19.0" - "@babel/helper-validator-identifier" "^7.19.1" - "@babel/plugin-transform-modules-systemjs@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.22.5.tgz#18c31410b5e579a0092638f95c896c2a98a5d496" @@ -1425,14 +1250,6 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/helper-validator-identifier" "^7.22.5" -"@babel/plugin-transform-modules-umd@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.18.6.tgz#81d3832d6034b75b54e62821ba58f28ed0aab4b9" - integrity sha512-dcegErExVeXcRqNtkRU/z8WlBLnvD4MRnHgNs3MytRO1Mn1sHRyhbcpYbVMGclAqOjdW+9cfkdZno9dFdfKLfQ== - dependencies: - "@babel/helper-module-transforms" "^7.18.6" - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/plugin-transform-modules-umd@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.22.5.tgz#4694ae40a87b1745e3775b6a7fe96400315d4f98" @@ -1441,14 +1258,6 @@ "@babel/helper-module-transforms" "^7.22.5" "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-named-capturing-groups-regex@^7.19.1": - version "7.20.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.20.5.tgz#626298dd62ea51d452c3be58b285d23195ba69a8" - integrity sha512-mOW4tTzi5iTLnw+78iEq3gr8Aoq4WNRGpmSlrogqaiCBoR1HFhpU4JkpQFOHfeYx3ReVIFWOQJS4aZBRvuZ6mA== - dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.20.5" - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/plugin-transform-named-capturing-groups-regex@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.22.5.tgz#67fe18ee8ce02d57c855185e27e3dc959b2e991f" @@ -1457,13 +1266,6 @@ "@babel/helper-create-regexp-features-plugin" "^7.22.5" "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-new-target@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.18.6.tgz#d128f376ae200477f37c4ddfcc722a8a1b3246a8" - integrity sha512-DjwFA/9Iu3Z+vrAn+8pBUGcjhxKguSMlsFqeCKbhb9BAV756v0krzVK04CRDi/4aqmk8BsHb4a/gFcaA5joXRw== - dependencies: - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/plugin-transform-new-target@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.22.5.tgz#1b248acea54ce44ea06dfd37247ba089fcf9758d" @@ -1498,14 +1300,6 @@ "@babel/plugin-syntax-object-rest-spread" "^7.8.3" "@babel/plugin-transform-parameters" "^7.22.5" -"@babel/plugin-transform-object-super@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.18.6.tgz#fb3c6ccdd15939b6ff7939944b51971ddc35912c" - integrity sha512-uvGz6zk+pZoS1aTZrOvrbj6Pp/kK2mp45t2B+bTDre2UgsZZ8EZLSJtUg7m/no0zOJUWgFONpB7Zv9W2tSaFlA== - dependencies: - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/helper-replace-supers" "^7.18.6" - "@babel/plugin-transform-object-super@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.22.5.tgz#794a8d2fcb5d0835af722173c1a9d704f44e218c" @@ -1531,6 +1325,15 @@ "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" "@babel/plugin-syntax-optional-chaining" "^7.8.3" +"@babel/plugin-transform-optional-chaining@^7.22.6": + version "7.22.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.22.6.tgz#4bacfe37001fe1901117672875e931d439811564" + integrity sha512-Vd5HiWml0mDVtcLHIoEU5sw6HOUW/Zk0acLs/SAeuLzkGNOPc9DB4nkUajemhCmTIz3eiaKREZn2hQQqF79YTg== + dependencies: + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" + "@babel/plugin-syntax-optional-chaining" "^7.8.3" + "@babel/plugin-transform-parameters@^7.12.1", "@babel/plugin-transform-parameters@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.22.5.tgz#c3542dd3c39b42c8069936e48717a8d179d63a18" @@ -1538,13 +1341,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-parameters@^7.20.1", "@babel/plugin-transform-parameters@^7.20.7": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.20.7.tgz#0ee349e9d1bc96e78e3b37a7af423a4078a7083f" - integrity sha512-WiWBIkeHKVOSYPO0pWkxGPfKeWrCJyD3NJ53+Lrp/QMSZbsVPovrVl2aWZ19D/LTVnaDv5Ap7GJ/B2CTOZdrfA== - dependencies: - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/plugin-transform-private-methods@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-private-methods/-/plugin-transform-private-methods-7.22.5.tgz#21c8af791f76674420a147ae62e9935d790f8722" @@ -1563,13 +1359,6 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-private-property-in-object" "^7.14.5" -"@babel/plugin-transform-property-literals@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.18.6.tgz#e22498903a483448e94e032e9bbb9c5ccbfc93a3" - integrity sha512-cYcs6qlgafTud3PAzrrRNbQtfpQ8+y/+M5tKmksS9+M1ckbH6kzY8MrexEM9mcA6JDsukE19iIRvAyYl463sMg== - dependencies: - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/plugin-transform-property-literals@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.22.5.tgz#b5ddabd73a4f7f26cd0e20f5db48290b88732766" @@ -1617,14 +1406,6 @@ "@babel/helper-annotate-as-pure" "^7.22.5" "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-regenerator@^7.18.6": - version "7.20.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.20.5.tgz#57cda588c7ffb7f4f8483cc83bdcea02a907f04d" - integrity sha512-kW/oO7HPBtntbsahzQ0qSE3tFvkFwnbozz3NWFhLGqH75vLEg+sCGngLlhVkePlCs3Jv0dBBHDzCHxNiFAQKCQ== - dependencies: - "@babel/helper-plugin-utils" "^7.20.2" - regenerator-transform "^0.15.1" - "@babel/plugin-transform-regenerator@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.22.5.tgz#cd8a68b228a5f75fa01420e8cc2fc400f0fc32aa" @@ -1633,13 +1414,6 @@ "@babel/helper-plugin-utils" "^7.22.5" regenerator-transform "^0.15.1" -"@babel/plugin-transform-reserved-words@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.18.6.tgz#b1abd8ebf8edaa5f7fe6bbb8d2133d23b6a6f76a" - integrity sha512-oX/4MyMoypzHjFrT1CdivfKZ+XvIPMFXwwxHp/r0Ddy2Vuomt4HDFGmft1TAY2yiTKiNSsh3kjBAzcM8kSdsjA== - dependencies: - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/plugin-transform-reserved-words@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.22.5.tgz#832cd35b81c287c4bcd09ce03e22199641f964fb" @@ -1659,13 +1433,6 @@ babel-plugin-polyfill-regenerator "^0.5.0" semver "^6.3.0" -"@babel/plugin-transform-shorthand-properties@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.18.6.tgz#6d6df7983d67b195289be24909e3f12a8f664dc9" - integrity sha512-eCLXXJqv8okzg86ywZJbRn19YJHU4XUa55oz2wbHhaQVn/MM+XhukiT7SYqp/7o00dg52Rj51Ny+Ecw4oyoygw== - dependencies: - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/plugin-transform-shorthand-properties@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.22.5.tgz#6e277654be82b5559fc4b9f58088507c24f0c624" @@ -1673,14 +1440,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-spread@^7.19.0": - version "7.20.7" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.20.7.tgz#c2d83e0b99d3bf83e07b11995ee24bf7ca09401e" - integrity sha512-ewBbHQ+1U/VnH1fxltbJqDeWBU1oNLG8Dj11uIv3xVf7nrQu0bPGe5Rf716r7K5Qz+SqtAOVswoVunoiBtGhxw== - dependencies: - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/helper-skip-transparent-expression-wrappers" "^7.20.0" - "@babel/plugin-transform-spread@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.22.5.tgz#6487fd29f229c95e284ba6c98d65eafb893fea6b" @@ -1689,13 +1448,6 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/helper-skip-transparent-expression-wrappers" "^7.22.5" -"@babel/plugin-transform-sticky-regex@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.18.6.tgz#c6706eb2b1524028e317720339583ad0f444adcc" - integrity sha512-kfiDrDQ+PBsQDO85yj1icueWMfGfJFKN1KCkndygtu/C9+XUfydLC8Iv5UYJqRwy4zk8EcplRxEOeLyjq1gm6Q== - dependencies: - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/plugin-transform-sticky-regex@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.22.5.tgz#295aba1595bfc8197abd02eae5fc288c0deb26aa" @@ -1703,13 +1455,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-template-literals@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.18.9.tgz#04ec6f10acdaa81846689d63fae117dd9c243a5e" - integrity sha512-S8cOWfT82gTezpYOiVaGHrCbhlHgKhQt8XH5ES46P2XWmX92yisoZywf5km75wv5sYcXDUCLMmMxOLCtthDgMA== - dependencies: - "@babel/helper-plugin-utils" "^7.18.9" - "@babel/plugin-transform-template-literals@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.22.5.tgz#8f38cf291e5f7a8e60e9f733193f0bcc10909bff" @@ -1717,13 +1462,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-typeof-symbol@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.18.9.tgz#c8cea68263e45addcd6afc9091429f80925762c0" - integrity sha512-SRfwTtF11G2aemAZWivL7PD+C9z52v9EvMqH9BuYbabyPuKUvSWks3oCg6041pT925L4zVFqaVBeECwsmlguEw== - dependencies: - "@babel/helper-plugin-utils" "^7.18.9" - "@babel/plugin-transform-typeof-symbol@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.22.5.tgz#5e2ba478da4b603af8673ff7c54f75a97b716b34" @@ -1751,13 +1489,6 @@ "@babel/helper-plugin-utils" "^7.22.5" "@babel/plugin-syntax-typescript" "^7.22.5" -"@babel/plugin-transform-unicode-escapes@^7.18.10": - version "7.18.10" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.18.10.tgz#1ecfb0eda83d09bbcb77c09970c2dd55832aa246" - integrity sha512-kKAdAI+YzPgGY/ftStBFXTI1LZFju38rYThnfMykS+IXy8BVx+res7s2fxf1l8I35DV2T97ezo6+SGrXz6B3iQ== - dependencies: - "@babel/helper-plugin-utils" "^7.18.9" - "@babel/plugin-transform-unicode-escapes@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.22.5.tgz#ce0c248522b1cb22c7c992d88301a5ead70e806c" @@ -1773,14 +1504,6 @@ "@babel/helper-create-regexp-features-plugin" "^7.22.5" "@babel/helper-plugin-utils" "^7.22.5" -"@babel/plugin-transform-unicode-regex@^7.18.6": - version "7.18.6" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.18.6.tgz#194317225d8c201bbae103364ffe9e2cea36cdca" - integrity sha512-gE7A6Lt7YLnNOL3Pb9BNeZvi+d8l7tcRrG4+pwJjK9hD2xX4mEvjlQW60G9EEmfXVYRPv9VRQcyegIVHCql/AA== - dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.18.6" - "@babel/helper-plugin-utils" "^7.18.6" - "@babel/plugin-transform-unicode-regex@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.22.5.tgz#ce7e7bb3ef208c4ff67e02a22816656256d7a183" @@ -1883,38 +1606,26 @@ core-js-compat "^3.30.2" semver "^6.3.0" -"@babel/preset-env@^7.20.2": - version "7.20.2" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.20.2.tgz#9b1642aa47bb9f43a86f9630011780dab7f86506" - integrity sha512-1G0efQEWR1EHkKvKHqbG+IN/QdgwfByUpM5V5QroDzGV2t3S/WXNQd693cHiHTlCFMpr9B6FkPFXDA2lQcKoDg== +"@babel/preset-env@^7.21.4": + version "7.22.9" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.22.9.tgz#57f17108eb5dfd4c5c25a44c1977eba1df310ac7" + integrity sha512-wNi5H/Emkhll/bqPjsjQorSykrlfY5OWakd6AulLvMEytpKasMVUpVy8RL4qBIBs5Ac6/5i0/Rv0b/Fg6Eag/g== dependencies: - "@babel/compat-data" "^7.20.1" - "@babel/helper-compilation-targets" "^7.20.0" - "@babel/helper-plugin-utils" "^7.20.2" - "@babel/helper-validator-option" "^7.18.6" - "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression" "^7.18.6" - "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.18.9" - "@babel/plugin-proposal-async-generator-functions" "^7.20.1" - "@babel/plugin-proposal-class-properties" "^7.18.6" - "@babel/plugin-proposal-class-static-block" "^7.18.6" - "@babel/plugin-proposal-dynamic-import" "^7.18.6" - "@babel/plugin-proposal-export-namespace-from" "^7.18.9" - "@babel/plugin-proposal-json-strings" "^7.18.6" - "@babel/plugin-proposal-logical-assignment-operators" "^7.18.9" - "@babel/plugin-proposal-nullish-coalescing-operator" "^7.18.6" - "@babel/plugin-proposal-numeric-separator" "^7.18.6" - "@babel/plugin-proposal-object-rest-spread" "^7.20.2" - "@babel/plugin-proposal-optional-catch-binding" "^7.18.6" - "@babel/plugin-proposal-optional-chaining" "^7.18.9" - "@babel/plugin-proposal-private-methods" "^7.18.6" - "@babel/plugin-proposal-private-property-in-object" "^7.18.6" - "@babel/plugin-proposal-unicode-property-regex" "^7.18.6" + "@babel/compat-data" "^7.22.9" + "@babel/helper-compilation-targets" "^7.22.9" + "@babel/helper-plugin-utils" "^7.22.5" + "@babel/helper-validator-option" "^7.22.5" + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression" "^7.22.5" + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.22.5" + "@babel/plugin-proposal-private-property-in-object" "7.21.0-placeholder-for-preset-env.2" "@babel/plugin-syntax-async-generators" "^7.8.4" "@babel/plugin-syntax-class-properties" "^7.12.13" "@babel/plugin-syntax-class-static-block" "^7.14.5" "@babel/plugin-syntax-dynamic-import" "^7.8.3" "@babel/plugin-syntax-export-namespace-from" "^7.8.3" - "@babel/plugin-syntax-import-assertions" "^7.20.0" + "@babel/plugin-syntax-import-assertions" "^7.22.5" + "@babel/plugin-syntax-import-attributes" "^7.22.5" + "@babel/plugin-syntax-import-meta" "^7.10.4" "@babel/plugin-syntax-json-strings" "^7.8.3" "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" @@ -1924,45 +1635,62 @@ "@babel/plugin-syntax-optional-chaining" "^7.8.3" "@babel/plugin-syntax-private-property-in-object" "^7.14.5" "@babel/plugin-syntax-top-level-await" "^7.14.5" - "@babel/plugin-transform-arrow-functions" "^7.18.6" - "@babel/plugin-transform-async-to-generator" "^7.18.6" - "@babel/plugin-transform-block-scoped-functions" "^7.18.6" - "@babel/plugin-transform-block-scoping" "^7.20.2" - "@babel/plugin-transform-classes" "^7.20.2" - "@babel/plugin-transform-computed-properties" "^7.18.9" - "@babel/plugin-transform-destructuring" "^7.20.2" - "@babel/plugin-transform-dotall-regex" "^7.18.6" - "@babel/plugin-transform-duplicate-keys" "^7.18.9" - "@babel/plugin-transform-exponentiation-operator" "^7.18.6" - "@babel/plugin-transform-for-of" "^7.18.8" - "@babel/plugin-transform-function-name" "^7.18.9" - "@babel/plugin-transform-literals" "^7.18.9" - "@babel/plugin-transform-member-expression-literals" "^7.18.6" - "@babel/plugin-transform-modules-amd" "^7.19.6" - "@babel/plugin-transform-modules-commonjs" "^7.19.6" - "@babel/plugin-transform-modules-systemjs" "^7.19.6" - "@babel/plugin-transform-modules-umd" "^7.18.6" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.19.1" - "@babel/plugin-transform-new-target" "^7.18.6" - "@babel/plugin-transform-object-super" "^7.18.6" - "@babel/plugin-transform-parameters" "^7.20.1" - "@babel/plugin-transform-property-literals" "^7.18.6" - "@babel/plugin-transform-regenerator" "^7.18.6" - "@babel/plugin-transform-reserved-words" "^7.18.6" - "@babel/plugin-transform-shorthand-properties" "^7.18.6" - "@babel/plugin-transform-spread" "^7.19.0" - "@babel/plugin-transform-sticky-regex" "^7.18.6" - "@babel/plugin-transform-template-literals" "^7.18.9" - "@babel/plugin-transform-typeof-symbol" "^7.18.9" - "@babel/plugin-transform-unicode-escapes" "^7.18.10" - "@babel/plugin-transform-unicode-regex" "^7.18.6" + "@babel/plugin-syntax-unicode-sets-regex" "^7.18.6" + "@babel/plugin-transform-arrow-functions" "^7.22.5" + "@babel/plugin-transform-async-generator-functions" "^7.22.7" + "@babel/plugin-transform-async-to-generator" "^7.22.5" + "@babel/plugin-transform-block-scoped-functions" "^7.22.5" + "@babel/plugin-transform-block-scoping" "^7.22.5" + "@babel/plugin-transform-class-properties" "^7.22.5" + "@babel/plugin-transform-class-static-block" "^7.22.5" + "@babel/plugin-transform-classes" "^7.22.6" + "@babel/plugin-transform-computed-properties" "^7.22.5" + "@babel/plugin-transform-destructuring" "^7.22.5" + "@babel/plugin-transform-dotall-regex" "^7.22.5" + "@babel/plugin-transform-duplicate-keys" "^7.22.5" + "@babel/plugin-transform-dynamic-import" "^7.22.5" + "@babel/plugin-transform-exponentiation-operator" "^7.22.5" + "@babel/plugin-transform-export-namespace-from" "^7.22.5" + "@babel/plugin-transform-for-of" "^7.22.5" + "@babel/plugin-transform-function-name" "^7.22.5" + "@babel/plugin-transform-json-strings" "^7.22.5" + "@babel/plugin-transform-literals" "^7.22.5" + "@babel/plugin-transform-logical-assignment-operators" "^7.22.5" + "@babel/plugin-transform-member-expression-literals" "^7.22.5" + "@babel/plugin-transform-modules-amd" "^7.22.5" + "@babel/plugin-transform-modules-commonjs" "^7.22.5" + "@babel/plugin-transform-modules-systemjs" "^7.22.5" + "@babel/plugin-transform-modules-umd" "^7.22.5" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.22.5" + "@babel/plugin-transform-new-target" "^7.22.5" + "@babel/plugin-transform-nullish-coalescing-operator" "^7.22.5" + "@babel/plugin-transform-numeric-separator" "^7.22.5" + "@babel/plugin-transform-object-rest-spread" "^7.22.5" + "@babel/plugin-transform-object-super" "^7.22.5" + "@babel/plugin-transform-optional-catch-binding" "^7.22.5" + "@babel/plugin-transform-optional-chaining" "^7.22.6" + "@babel/plugin-transform-parameters" "^7.22.5" + "@babel/plugin-transform-private-methods" "^7.22.5" + "@babel/plugin-transform-private-property-in-object" "^7.22.5" + "@babel/plugin-transform-property-literals" "^7.22.5" + "@babel/plugin-transform-regenerator" "^7.22.5" + "@babel/plugin-transform-reserved-words" "^7.22.5" + "@babel/plugin-transform-shorthand-properties" "^7.22.5" + "@babel/plugin-transform-spread" "^7.22.5" + "@babel/plugin-transform-sticky-regex" "^7.22.5" + "@babel/plugin-transform-template-literals" "^7.22.5" + "@babel/plugin-transform-typeof-symbol" "^7.22.5" + "@babel/plugin-transform-unicode-escapes" "^7.22.5" + "@babel/plugin-transform-unicode-property-regex" "^7.22.5" + "@babel/plugin-transform-unicode-regex" "^7.22.5" + "@babel/plugin-transform-unicode-sets-regex" "^7.22.5" "@babel/preset-modules" "^0.1.5" - "@babel/types" "^7.20.2" - babel-plugin-polyfill-corejs2 "^0.3.3" - babel-plugin-polyfill-corejs3 "^0.6.0" - babel-plugin-polyfill-regenerator "^0.4.1" - core-js-compat "^3.25.1" - semver "^6.3.0" + "@babel/types" "^7.22.5" + babel-plugin-polyfill-corejs2 "^0.4.4" + babel-plugin-polyfill-corejs3 "^0.8.2" + babel-plugin-polyfill-regenerator "^0.5.1" + core-js-compat "^3.31.0" + semver "^6.3.1" "@babel/preset-modules@^0.1.5": version "0.1.5" @@ -2009,10 +1737,10 @@ "@babel/plugin-transform-modules-commonjs" "^7.21.5" "@babel/plugin-transform-typescript" "^7.21.3" -"@babel/register@^7.18.9": - version "7.21.0" - resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.21.0.tgz#c97bf56c2472e063774f31d344c592ebdcefa132" - integrity sha512-9nKsPmYDi5DidAqJaQooxIhsLJiNMkGr8ypQ8Uic7cIox7UCDsM7HuUGxdGT7mSDTYbqzIdsOWzfBton/YJrMw== +"@babel/register@^7.22.5": + version "7.22.5" + resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.22.5.tgz#e4d8d0f615ea3233a27b5c6ada6750ee59559939" + integrity sha512-vV6pm/4CijSQ8Y47RH5SopXzursN35RQINfGJkmOlcpAtGuf94miFvIPhCKGQN7WGIcsgG1BHEX2KVdTYwTwUQ== dependencies: clone-deep "^4.0.1" find-cache-dir "^2.0.0" @@ -2056,7 +1784,7 @@ "@babel/parser" "^7.22.5" "@babel/types" "^7.22.5" -"@babel/template@^7.18.10", "@babel/template@^7.20.7", "@babel/template@^7.3.3": +"@babel/template@^7.20.7", "@babel/template@^7.3.3": version "7.20.7" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.20.7.tgz#a15090c2839a83b02aa996c0b4994005841fd5a8" integrity sha512-8SegXApWe6VoNw0r9JHpSteLKTpTiLZ4rMlGIm9JQ18KiCtyQiAMEazujAHrUS5flrcqYZa75ukev3P6QmUwUw== @@ -2081,7 +1809,7 @@ debug "^4.1.0" globals "^11.1.0" -"@babel/traverse@^7.20.5", "@babel/traverse@^7.20.7", "@babel/traverse@^7.21.5", "@babel/traverse@^7.7.2": +"@babel/traverse@^7.20.7", "@babel/traverse@^7.21.5", "@babel/traverse@^7.7.2": version "7.21.5" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.21.5.tgz#ad22361d352a5154b498299d523cf72998a4b133" integrity sha512-AhQoI3YjWi6u/y/ntv7k48mcrCXmus0t79J9qPNlk/lAsFlCiJ047RmbfMOawySTHtywXhbXgpx/8nXMYd+oFw== @@ -2097,7 +1825,23 @@ debug "^4.1.0" globals "^11.1.0" -"@babel/types@^7.0.0", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.20.0", "@babel/types@^7.20.2", "@babel/types@^7.20.5", "@babel/types@^7.20.7", "@babel/types@^7.21.0", "@babel/types@^7.21.4", "@babel/types@^7.21.5", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": +"@babel/traverse@^7.22.6", "@babel/traverse@^7.22.8": + version "7.22.8" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.22.8.tgz#4d4451d31bc34efeae01eac222b514a77aa4000e" + integrity sha512-y6LPR+wpM2I3qJrsheCTwhIinzkETbplIgPBbwvqPKc+uljeA5gP+3nP8irdYt1mjQaDnlIcG+dw8OjAco4GXw== + dependencies: + "@babel/code-frame" "^7.22.5" + "@babel/generator" "^7.22.7" + "@babel/helper-environment-visitor" "^7.22.5" + "@babel/helper-function-name" "^7.22.5" + "@babel/helper-hoist-variables" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + "@babel/parser" "^7.22.7" + "@babel/types" "^7.22.5" + debug "^4.1.0" + globals "^11.1.0" + +"@babel/types@^7.0.0", "@babel/types@^7.18.6", "@babel/types@^7.20.0", "@babel/types@^7.20.7", "@babel/types@^7.21.0", "@babel/types@^7.21.4", "@babel/types@^7.21.5", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": version "7.21.5" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.21.5.tgz#18dfbd47c39d3904d5db3d3dc2cc80bedb60e5b6" integrity sha512-m4AfNvVF2mVC/F7fDEdH2El3HzUg9It/XsCxZiOTTA3m3qYfcSVSbTfM6Q9xG+hYDniZssYhlXKKUMD5m8tF4Q== @@ -2891,7 +2635,7 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" -"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.15", "@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.8", "@jridgewell/trace-mapping@^0.3.9": +"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.15", "@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.9": version "0.3.18" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz#25783b2086daf6ff1dcb53c9249ae480e4dd4cd6" integrity sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA== @@ -2944,12 +2688,10 @@ resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.3.tgz#323d72dd25103d0c4fbdce89dadf574a787b1f9b" integrity sha512-s88O1aVtXftvp5bCPB7WnmXc5IwOZZ7YPuwNPt+GtOOXpPvad1LfbmjYv+qII7zP6RU2QGnqve27dnLycEnyEQ== -"@nicolo-ribaudo/eslint-scope-5-internals@5.1.1-v1": - version "5.1.1-v1" - resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz#dbf733a965ca47b1973177dc0bb6c889edcfb129" - integrity sha512-54/JRvkLIzzDWshCWfuhadfrfZVPiElY8Fcgmg1HroEly/EDSszzhBAsarCux+D/kOslTRquNzuyGSmUSTTHGg== - dependencies: - eslint-scope "5.1.1" +"@nicolo-ribaudo/semver-v6@^6.3.3": + version "6.3.3" + resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/semver-v6/-/semver-v6-6.3.3.tgz#ea6d23ade78a325f7a52750aab1526b02b628c29" + integrity sha512-3Yc1fUTs69MG/uZbJlLSI3JISMn2UV2rg+1D/vROUqZyh3l6iYHCs7GMp+M40ZD7yOdDbYjJcU1oTJhrc+dGKg== "@nodelib/fs.scandir@2.1.5": version "2.1.5" @@ -3469,6 +3211,13 @@ "@types/history" "^4.7.11" "@types/react" "*" +"@types/react-slick@^0.23.4": + version "0.23.10" + resolved "https://registry.yarnpkg.com/@types/react-slick/-/react-slick-0.23.10.tgz#56126e6e4e95cdce7771535b2811c2c1931a7caa" + integrity sha512-ZiqdencANDZy6sWOWJ54LDvebuXFEhDlHtXU9FFipQR2BcYU2QJxZhvJPW6YK7cocibUiNn+YvDTbt1HtCIBVA== + dependencies: + "@types/react" "*" + "@types/react@*": version "18.2.12" resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.12.tgz#95d584338610b78bb9ba0415e3180fb03debdf97" @@ -3807,6 +3556,13 @@ acorn@^8.0.4, acorn@^8.4.1, acorn@^8.7.1, acorn@^8.8.0, acorn@^8.8.2: resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a" integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw== +add-dom-event-listener@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/add-dom-event-listener/-/add-dom-event-listener-1.1.0.tgz#6a92db3a0dd0abc254e095c0f1dc14acbbaae310" + integrity sha512-WCxx1ixHT0GQU9hb0KI/mhgRQhnU+U3GvwY6ZvVjYq8rsihIGoaIOUbY0yMPBxLH5MDtr0kz3fisWGNcbWW7Jw== + dependencies: + object-assign "4.x" + address@^1.0.1, address@^1.1.2: version "1.2.2" resolved "https://registry.yarnpkg.com/address/-/address-1.2.2.tgz#2b5248dac5485a6390532c6a517fda2e3faac89e" @@ -3944,6 +3700,66 @@ ansicolors@~0.3.2: resolved "https://registry.yarnpkg.com/ansicolors/-/ansicolors-0.3.2.tgz#665597de86a9ffe3aa9bfbe6cae5c6ea426b4979" integrity sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg== +antd@^3.6.5: + version "3.26.20" + resolved "https://registry.yarnpkg.com/antd/-/antd-3.26.20.tgz#f3f570efaaa5950a144942f21eb2aaaa088e9407" + integrity sha512-VIous4ofZfxFtd9K1h9MpRX2sDDpj3QcOFi3YgIc9B/uyDli/GlLb8SWKfQfJaMkaxwatIv503dag2Tog+hiEg== + dependencies: + "@ant-design/create-react-context" "^0.2.4" + "@ant-design/icons" "~2.1.1" + "@ant-design/icons-react" "~2.0.1" + "@types/react-slick" "^0.23.4" + array-tree-filter "^2.1.0" + babel-runtime "6.x" + classnames "~2.2.6" + copy-to-clipboard "^3.2.0" + css-animation "^1.5.0" + dom-closest "^0.2.0" + enquire.js "^2.1.6" + is-mobile "^2.1.0" + lodash "^4.17.13" + moment "^2.24.0" + omit.js "^1.0.2" + prop-types "^15.7.2" + raf "^3.4.1" + rc-animate "^2.10.2" + rc-calendar "~9.15.7" + rc-cascader "~0.17.4" + rc-checkbox "~2.1.6" + rc-collapse "~1.11.3" + rc-dialog "~7.6.0" + rc-drawer "~3.1.1" + rc-dropdown "~2.4.1" + rc-editor-mention "^1.1.13" + rc-form "^2.4.10" + rc-input-number "~4.5.0" + rc-mentions "~0.4.0" + rc-menu "~7.5.1" + rc-notification "~3.3.1" + rc-pagination "~1.20.11" + rc-progress "~2.5.0" + rc-rate "~2.5.0" + rc-resize-observer "^0.1.0" + rc-select "~9.2.0" + rc-slider "~8.7.1" + rc-steps "~3.5.0" + rc-switch "~1.9.0" + rc-table "~6.10.5" + rc-tabs "~9.7.0" + rc-time-picker "~3.7.1" + rc-tooltip "~3.7.3" + rc-tree "~2.1.0" + rc-tree-select "~2.9.1" + rc-trigger "^2.6.2" + rc-upload "~2.9.1" + rc-util "^4.16.1" + react-lazy-load "^3.0.13" + react-lifecycles-compat "^3.0.4" + react-slick "~0.25.2" + resize-observer-polyfill "^1.5.1" + shallowequal "^1.1.0" + warning "~4.0.3" + anymatch@^3.0.3, anymatch@~3.1.2: version "3.1.3" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" @@ -4036,6 +3852,11 @@ array-slice@^1.0.0: resolved "https://registry.yarnpkg.com/array-slice/-/array-slice-1.1.0.tgz#e368ea15f89bc7069f7ffb89aec3a6c7d4ac22d4" integrity sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w== +array-tree-filter@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-tree-filter/-/array-tree-filter-2.1.0.tgz#873ac00fec83749f255ac8dd083814b4f6329190" + integrity sha512-4ROwICNlNw/Hqa9v+rk5h22KjmzB1JGTMVKP2AKJBOCgb0yL0ASf0+YvCcLNNwquOHNX48jkeZIJ3a+oOQqKcw== + array-union@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" @@ -4090,6 +3911,11 @@ async-settle@^2.0.0: dependencies: async-done "^2.0.0" +async-validator@~1.11.3: + version "1.11.5" + resolved "https://registry.yarnpkg.com/async-validator/-/async-validator-1.11.5.tgz#9d43cf49ef6bb76be5442388d19fb9a6e47597ea" + integrity sha512-XNtCsMAeAH1pdLMEg1z8/Bb3a8cdCbui9QbJATRFHHHW5kT6+NPI3zSVQUXgikTFITzsg+kYY5NTWhM2Orwt9w== + async@^3.2.3: version "3.2.4" resolved "https://registry.yarnpkg.com/async/-/async-3.2.4.tgz#2d22e00f8cddeb5fde5dd33522b56d1cf569a81c" @@ -4190,15 +4016,6 @@ babel-plugin-jest-hoist@^29.2.0: "@types/babel__core" "^7.1.14" "@types/babel__traverse" "^7.0.6" -babel-plugin-polyfill-corejs2@^0.3.3: - version "0.3.3" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.3.tgz#5d1bd3836d0a19e1b84bbf2d9640ccb6f951c122" - integrity sha512-8hOdmFYFSZhqg2C/JgLUQ+t52o5nirNwaWM2B9LWteozwIvM14VSwdsCAUET10qT+kmySAlseadmfeeSWFCy+Q== - dependencies: - "@babel/compat-data" "^7.17.7" - "@babel/helper-define-polyfill-provider" "^0.3.3" - semver "^6.1.1" - babel-plugin-polyfill-corejs2@^0.4.3: version "0.4.3" resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.3.tgz#75044d90ba5043a5fb559ac98496f62f3eb668fd" @@ -4208,13 +4025,14 @@ babel-plugin-polyfill-corejs2@^0.4.3: "@babel/helper-define-polyfill-provider" "^0.4.0" semver "^6.1.1" -babel-plugin-polyfill-corejs3@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.6.0.tgz#56ad88237137eade485a71b52f72dbed57c6230a" - integrity sha512-+eHqR6OPcBhJOGgsIar7xoAB1GcSwVUA3XjAd7HJNzOXT4wv6/H7KIdA/Nc60cvUlDbKApmqNvD1B1bzOt4nyA== +babel-plugin-polyfill-corejs2@^0.4.4: + version "0.4.4" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.4.tgz#9f9a0e1cd9d645cc246a5e094db5c3aa913ccd2b" + integrity sha512-9WeK9snM1BfxB38goUEv2FLnA6ja07UMfazFHzCXUb3NyDZAwfXvQiURQ6guTTMeHcOsdknULm1PDhs4uWtKyA== dependencies: - "@babel/helper-define-polyfill-provider" "^0.3.3" - core-js-compat "^3.25.1" + "@babel/compat-data" "^7.22.6" + "@babel/helper-define-polyfill-provider" "^0.4.1" + "@nicolo-ribaudo/semver-v6" "^6.3.3" babel-plugin-polyfill-corejs3@^0.8.1: version "0.8.1" @@ -4224,12 +4042,13 @@ babel-plugin-polyfill-corejs3@^0.8.1: "@babel/helper-define-polyfill-provider" "^0.4.0" core-js-compat "^3.30.1" -babel-plugin-polyfill-regenerator@^0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.4.1.tgz#390f91c38d90473592ed43351e801a9d3e0fd747" - integrity sha512-NtQGmyQDXjQqQ+IzRkBVwEOz9lQ4zxAQZgoAYEtU9dJjnl1Oc98qnN7jcp+bE7O7aYzVpavXE3/VKXNzUbh7aw== +babel-plugin-polyfill-corejs3@^0.8.2: + version "0.8.2" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.8.2.tgz#d406c5738d298cd9c66f64a94cf8d5904ce4cc5e" + integrity sha512-Cid+Jv1BrY9ReW9lIfNlNpsI53N+FN7gE+f73zLAUbr9C52W4gKLWSByx47pfDJsEysojKArqOtOKZSVIIUTuQ== dependencies: - "@babel/helper-define-polyfill-provider" "^0.3.3" + "@babel/helper-define-polyfill-provider" "^0.4.1" + core-js-compat "^3.31.0" babel-plugin-polyfill-regenerator@^0.5.0: version "0.5.0" @@ -4238,6 +4057,13 @@ babel-plugin-polyfill-regenerator@^0.5.0: dependencies: "@babel/helper-define-polyfill-provider" "^0.4.0" +babel-plugin-polyfill-regenerator@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.5.1.tgz#ace7a5eced6dff7d5060c335c52064778216afd3" + integrity sha512-L8OyySuI6OSQ5hFy9O+7zFjyr4WhAfRjLIOkhQGYl+emwJkd/S4XXT1JpfrgR1jrQ1NcGiOh+yAdGlF8pnC3Jw== + dependencies: + "@babel/helper-define-polyfill-provider" "^0.4.1" + babel-preset-current-node-syntax@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz#b4399239b89b2a011f9ddbe3e4f401fc40cff73b" @@ -4264,6 +4090,14 @@ babel-preset-jest@^29.2.0: babel-plugin-jest-hoist "^29.2.0" babel-preset-current-node-syntax "^1.0.0" +babel-runtime@6.x, babel-runtime@^6.18.0, babel-runtime@^6.23.0, babel-runtime@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" + integrity sha512-ITKNuq2wKlW1fJg9sSW52eepoYgZBggvOAHC0u/CYu/qxQ9EVzThCgR69BnSXLHjy2f7SY5zaQ4yt7H9ZVxY2g== + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.11.0" + bach@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/bach/-/bach-1.2.0.tgz#4b3ce96bf27134f79a1b414a51c14e34c3bd9880" @@ -4421,6 +4255,16 @@ browserslist@^4.21.3, browserslist@^4.21.4: node-releases "^2.0.6" update-browserslist-db "^1.0.9" +browserslist@^4.21.9: + version "4.21.9" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.9.tgz#e11bdd3c313d7e2a9e87e8b4b0c7872b13897635" + integrity sha512-M0MFoZzbUrRU4KNfCrDLnvyE7gub+peetoTid3TBIqtunaDJyXlwhakT+/VkvSXcfIzFfK/nkCs4nmyTmxdNSg== + dependencies: + caniuse-lite "^1.0.30001503" + electron-to-chromium "^1.4.431" + node-releases "^2.0.12" + update-browserslist-db "^1.0.11" + bser@2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" @@ -4512,6 +4356,11 @@ caniuse-lite@^1.0.30001400: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001441.tgz#987437b266260b640a23cd18fbddb509d7f69f3e" integrity sha512-OyxRR4Vof59I3yGWXws6i908EtGbMzVUi3ganaZQHmydk1iwDhRnvaPG2WaR0KcqrDFKrxVZHULT396LEPhXfg== +caniuse-lite@^1.0.30001503: + version "1.0.30001515" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001515.tgz#418aefeed9d024cd3129bfae0ccc782d4cb8f12b" + integrity sha512-eEFDwUOZbE24sb+Ecsx3+OvNETqjWIdabMy52oOkIgcUtAsQifjUG9q4U9dgTHJM2mfk4uEPxc0+xuFdJ629QA== + cardinal@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/cardinal/-/cardinal-2.1.1.tgz#7cc1055d822d212954d07b085dea251cc7bc5505" @@ -4636,6 +4485,16 @@ clang-format@^1.8.0: glob "^7.0.0" resolve "^1.1.6" +classnames@2.x, classnames@^2.2.0, classnames@^2.2.1, classnames@^2.2.3, classnames@^2.2.5, classnames@^2.2.6: + version "2.3.2" + resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.3.2.tgz#351d813bf0137fcc6a76a16b88208d2560a0d924" + integrity sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw== + +classnames@~2.2.6: + version "2.2.6" + resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.2.6.tgz#43935bffdd291f326dad0a205309b38d00f650ce" + integrity sha512-JR/iSQOSt+LQIWwrwEzJ9uk0xfN3mTVYMwt1Ir5mUcSN6pU+V4zQFFaJsclJbPuAUQH+yfWef6tm7l1quW3C8Q== + clean-css@^5.2.2, clean-css@^5.3.0: version "5.3.2" resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-5.3.2.tgz#70ecc7d4d4114921f5d298349ff86a31a9975224" @@ -4667,6 +4526,15 @@ cli-table3@^0.6.0, cli-table3@^0.6.2: optionalDependencies: "@colors/colors" "1.5.0" +clipboard@^2.0.0: + version "2.0.11" + resolved "https://registry.yarnpkg.com/clipboard/-/clipboard-2.0.11.tgz#62180360b97dd668b6b3a84ec226975762a70be5" + integrity sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw== + dependencies: + good-listener "^1.2.2" + select "^1.1.2" + tiny-emitter "^2.0.0" + cliui@^7.0.2: version "7.0.4" resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" @@ -4814,6 +4682,18 @@ commondir@^1.0.1: resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" integrity sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg== +component-classes@1.x, component-classes@^1.2.5, component-classes@^1.2.6: + version "1.2.6" + resolved "https://registry.yarnpkg.com/component-classes/-/component-classes-1.2.6.tgz#c642394c3618a4d8b0b8919efccbbd930e5cd691" + integrity sha512-hPFGULxdwugu1QWW3SvVOCUHLzO34+a2J6Wqy0c5ASQkfi9/8nZcBB0ZohaEbXOQlCflMAEMmEWk7u7BVs4koA== + dependencies: + component-indexof "0.0.3" + +component-indexof@0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/component-indexof/-/component-indexof-0.0.3.tgz#11d091312239eb8f32c8f25ae9cb002ffe8d3c24" + integrity sha512-puDQKvx/64HZXb4hBwIcvQLaLgux8o1CbWl39s41hrIIZDl1lJiD5jc22gj3RBeGK0ovxALDYpIbyjqDUUl0rw== + compressible@~2.0.16: version "2.0.18" resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.18.tgz#af53cca6b070d4c3c0750fbd77286a6d7cc46fba" @@ -4903,6 +4783,13 @@ copy-text-to-clipboard@^3.0.1: resolved "https://registry.yarnpkg.com/copy-text-to-clipboard/-/copy-text-to-clipboard-3.1.0.tgz#6bf40deef0a51ac6858efb0d76ded2c6d6a15059" integrity sha512-PFM6BnjLnOON/lB3ta/Jg7Ywsv+l9kQGD4TWDCSlRBGmqnnTM5MrDkhAFgw+8HZt0wW6Q2BBE4cmy9sq+s9Qng== +copy-to-clipboard@^3.2.0: + version "3.3.3" + resolved "https://registry.yarnpkg.com/copy-to-clipboard/-/copy-to-clipboard-3.3.3.tgz#55ac43a1db8ae639a4bd99511c148cdd1b83a1b0" + integrity sha512-2KV8NhB5JqC3ky0r9PMCAZKbUHSwtEo4CwCs0KXgruG43gX5PMqDEBbVU4OUzw2MuAWUfsuFmWvEKG5QRfSnJA== + dependencies: + toggle-selection "^1.0.6" + copy-webpack-plugin@^11.0.0: version "11.0.0" resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-11.0.0.tgz#96d4dbdb5f73d02dd72d0528d1958721ab72e04a" @@ -4915,13 +4802,6 @@ copy-webpack-plugin@^11.0.0: schema-utils "^4.0.0" serialize-javascript "^6.0.0" -core-js-compat@^3.25.1: - version "3.26.1" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.26.1.tgz#0e710b09ebf689d719545ac36e49041850f943df" - integrity sha512-622/KzTudvXCDLRw70iHW4KKs1aGpcRcowGWyYJr2DEBfRrd6hNJybxSWJFuZYD4ma86xhrwDDHxmDaIq4EA8A== - dependencies: - browserslist "^4.21.4" - core-js-compat@^3.30.1, core-js-compat@^3.30.2: version "3.31.0" resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.31.0.tgz#4030847c0766cc0e803dcdfb30055d7ef2064bf1" @@ -4929,20 +4809,37 @@ core-js-compat@^3.30.1, core-js-compat@^3.30.2: dependencies: browserslist "^4.21.5" +core-js-compat@^3.31.0: + version "3.31.1" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.31.1.tgz#5084ad1a46858df50ff89ace152441a63ba7aae0" + integrity sha512-wIDWd2s5/5aJSdpOJHfSibxNODxoGoWOBHt8JSPB41NOE94M7kuTPZCYLOlTtuoXTsBPKobpJ6T+y0SSy5L9SA== + dependencies: + browserslist "^4.21.9" + core-js-pure@^3.30.2: version "3.31.0" resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.31.0.tgz#052fd9e82fbaaf86457f5db1fadcd06f15966ff2" integrity sha512-/AnE9Y4OsJZicCzIe97JP5XoPKQJfTuEG43aEVLFJGOJpyqELod+pE6LEl63DfG1Mp8wX97LDaDpy1GmLEUxlg== +core-js@^1.0.0: + version "1.2.7" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" + integrity sha512-ZiPp9pZlgxpWRu0M+YWbm6+aQ84XEfH1JRXvfOc/fILWI0VKhLC2LX13X1NYq4fULzLMq7Hfh43CSo2/aIaUPA== + +core-js@^2.4.0: + version "2.6.12" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec" + integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== + core-js@^3.23.3: version "3.31.0" resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.31.0.tgz#4471dd33e366c79d8c0977ed2d940821719db344" integrity sha512-NIp2TQSGfR6ba5aalZD+ZQ1fSxGhDo/s1w0nx3RYzf2pnJxt7YynxFlFScP6eV7+GZsKO95NSjGxyJsU3DZgeQ== -core-js@^3.26.0: - version "3.30.2" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.30.2.tgz#6528abfda65e5ad728143ea23f7a14f0dcf503fc" - integrity sha512-uBJiDmwqsbJCWHAwjrx3cvjbMXP7xD72Dmsn5LOJpiRmE3WbBbN5rCqQ2Qh6Ek6/eOrjlWngEynBWo4VxerQhg== +core-js@^3.30.2: + version "3.31.1" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.31.1.tgz#f2b0eea9be9da0def2c5fece71064a7e5d687653" + integrity sha512-2sKLtfq1eFST7l7v62zaqXacPc7uG8ZAya8ogijLhTtaKNcpzpB4TMoTw2Si+8GYKRwFPMMtUT0263QFWFfqyQ== core-util-is@~1.0.0: version "1.0.3" @@ -4981,6 +4878,14 @@ cosmiconfig@^8.2.0: parse-json "^5.0.0" path-type "^4.0.0" +create-react-class@^15.5.3: + version "15.7.0" + resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.7.0.tgz#7499d7ca2e69bb51d13faf59bd04f0c65a1d6c1e" + integrity sha512-QZv4sFWG9S5RUvkTYWbflxeZX+JG7Cz0Tn33rQBJ+WFQTqTfUTjMjiv9tnfXazjsO5r0KhPs+AqCjyrQX6h2ng== + dependencies: + loose-envify "^1.3.1" + object-assign "^4.1.1" + create-require@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" @@ -5007,6 +4912,14 @@ crypto-random-string@^2.0.0: resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-2.0.0.tgz#ef2a7a966ec11083388369baa02ebead229b30d5" integrity sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA== +css-animation@1.x, css-animation@^1.3.2, css-animation@^1.5.0: + version "1.6.1" + resolved "https://registry.yarnpkg.com/css-animation/-/css-animation-1.6.1.tgz#162064a3b0d51f958b7ff37b3d6d4de18e17039e" + integrity sha512-/48+/BaEaHRY6kNQ2OIPzKf9A6g8WjZYjhiNDNuIVbsm5tXCGIAsHDjB4Xu1C4vXJtUWZo26O68OQkDpNBaPog== + dependencies: + babel-runtime "6.x" + component-classes "^1.2.5" + css-declaration-sorter@^6.3.1: version "6.4.0" resolved "https://registry.yarnpkg.com/css-declaration-sorter/-/css-declaration-sorter-6.4.0.tgz#630618adc21724484b3e9505bce812def44000ad" @@ -5244,6 +5157,11 @@ del@^6.1.1: rimraf "^3.0.2" slash "^3.0.0" +delegate@^3.1.2: + version "3.2.0" + resolved "https://registry.yarnpkg.com/delegate/-/delegate-3.2.0.tgz#b66b71c3158522e8ab5744f720d8ca0c2af59166" + integrity sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw== + depd@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" @@ -5333,6 +5251,18 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" +dom-align@^1.7.0: + version "1.12.4" + resolved "https://registry.yarnpkg.com/dom-align/-/dom-align-1.12.4.tgz#3503992eb2a7cfcb2ed3b2a6d21e0b9c00d54511" + integrity sha512-R8LUSEay/68zE5c8/3BDxiTEvgb4xZTF0RKmAHfiEVN3klfIpXfi2/QCoiWPccVQ0J/ZGdz9OjzL4uJEP/MRAw== + +dom-closest@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/dom-closest/-/dom-closest-0.2.0.tgz#ebd9f91d1bf22e8d6f477876bbcd3ec90216c0cf" + integrity sha512-6neTn1BtJlTSt+XSISXpnOsF1uni1CHsP/tmzZMGWxasYFHsBOqrHPnzmneqEgKhpagnfnfSfbvRRW0xFsBHAA== + dependencies: + dom-matches ">=1.0.1" + dom-converter@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/dom-converter/-/dom-converter-0.2.0.tgz#6721a9daee2e293682955b6afe416771627bb768" @@ -5340,6 +5270,16 @@ dom-converter@^0.2.0: dependencies: utila "~0.4" +dom-matches@>=1.0.1: + version "2.0.0" + resolved "https://registry.yarnpkg.com/dom-matches/-/dom-matches-2.0.0.tgz#d2728b416a87533980eb089b848d253cf23a758c" + integrity sha512-2VI856xEDCLXi19W+4BechR5/oIS6bKCKqcf16GR8Pg7dGLJ/eBOWVbCmQx2ISvYH6wTNx5Ef7JTOw1dRGRx6A== + +dom-scroll-into-view@1.x, dom-scroll-into-view@^1.2.0, dom-scroll-into-view@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/dom-scroll-into-view/-/dom-scroll-into-view-1.2.1.tgz#e8f36732dd089b0201a88d7815dc3f88e6d66c7e" + integrity sha512-LwNVg3GJOprWDO+QhLL1Z9MMgWe/KAFLxVWKzjRTxNSPn8/LLDIfmuG71YHznXCqaqTjvHJDYO1MEAgX6XCNbQ== + dom-serializer@^1.0.1: version "1.4.1" resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-1.4.1.tgz#de5d41b1aea290215dc45a6dae8adcf1d32e2d30" @@ -5410,6 +5350,15 @@ dot-prop@^5.2.0: dependencies: is-obj "^2.0.0" +draft-js@^0.10.0, draft-js@~0.10.0: + version "0.10.5" + resolved "https://registry.yarnpkg.com/draft-js/-/draft-js-0.10.5.tgz#bfa9beb018fe0533dbb08d6675c371a6b08fa742" + integrity sha512-LE6jSCV9nkPhfVX2ggcRLA4FKs6zWq9ceuO/88BpXdNCS7mjRTgs0NsV6piUCJX9YxMsB9An33wnkMmU2sD2Zg== + dependencies: + fbjs "^0.8.15" + immutable "~3.7.4" + object-assign "^4.1.0" + duplexer3@^0.1.4: version "0.1.5" resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.5.tgz#0b5e4d7bad5de8901ea4440624c8e1d20099217e" @@ -5440,6 +5389,11 @@ electron-to-chromium@^1.4.428: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.428.tgz#c31fc88e854f49d8305cdabf6ec934ff1588a902" integrity sha512-L7uUknyY286of0AYC8CKfgWstD0Smk2DvHDi9F0GWQhSH90Bzi7iDrmCbZKz75tYJxeGSAc7TYeKpmbjMDoh1w== +electron-to-chromium@^1.4.431: + version "1.4.459" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.459.tgz#25a23370f4ae8aaa8f77aaf00133aa4994f4148e" + integrity sha512-XXRS5NFv8nCrBL74Rm3qhJjA2VCsRFx0OjHKBMPI0otij56aun8UWiKTDABmd5/7GTR021pA4wivs+Ri6XCElg== + emittery@^0.13.1: version "0.13.1" resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" @@ -5470,6 +5424,13 @@ encodeurl@~1.0.2: resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== +encoding@^0.1.11: + version "0.1.13" + resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.13.tgz#56574afdd791f54a8e9b2785c0582a2d26210fa9" + integrity sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A== + dependencies: + iconv-lite "^0.6.2" + end-of-stream@^1.1.0, end-of-stream@^1.4.4: version "1.4.4" resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" @@ -5485,6 +5446,11 @@ enhanced-resolve@^5.14.1: graceful-fs "^4.2.4" tapable "^2.2.0" +enquire.js@^2.1.6: + version "2.1.6" + resolved "https://registry.yarnpkg.com/enquire.js/-/enquire.js-2.1.6.tgz#3e8780c9b8b835084c3f60e166dbc3c2a3c89814" + integrity sha512-/KujNpO+PT63F7Hlpu4h3pE3TokKRHN26JYmQpPyjkRD/N57R7bPDNojMXdi7uveAKjYB7yQnartCxZnFWr0Xw== + entities@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/entities/-/entities-2.2.0.tgz#098dc90ebb83d8dffa089d55256b351d34c4da55" @@ -5678,7 +5644,7 @@ eslint-utils@^3.0.0: dependencies: eslint-visitor-keys "^2.0.0" -eslint-visitor-keys@^2.0.0, eslint-visitor-keys@^2.1.0: +eslint-visitor-keys@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== @@ -5799,6 +5765,11 @@ eventemitter3@^4.0.0: resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== +eventlistener@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/eventlistener/-/eventlistener-0.0.1.tgz#ed2baabb852227af2bcf889152c72c63ca532eb8" + integrity sha512-hXZ5N9hmp3n7ovmVgG+2vIO6KcjSU10/d0A1Ixcf0i29dxCwAGTNGrSJCfLmlvmgQD8FYzyp//S8+Hpq4Nd7uA== + events@^3.2.0: version "3.3.0" resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" @@ -5941,6 +5912,13 @@ fastq@^1.6.0: dependencies: reusify "^1.0.4" +fault@^1.0.2: + version "1.0.4" + resolved "https://registry.yarnpkg.com/fault/-/fault-1.0.4.tgz#eafcfc0a6d214fc94601e170df29954a4f842f13" + integrity sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA== + dependencies: + format "^0.2.0" + faye-websocket@^0.11.3: version "0.11.4" resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.11.4.tgz#7f0d9275cfdd86a1c963dc8b65fcc451edcbb1da" @@ -5967,6 +5945,19 @@ fbjs-css-vars@^1.0.0: resolved "https://registry.yarnpkg.com/fbjs-css-vars/-/fbjs-css-vars-1.0.2.tgz#216551136ae02fe255932c3ec8775f18e2c078b8" integrity sha512-b2XGFAFdWZWg0phtAWLHCk836A1Xann+I+Dgd3Gk64MHKZO44FfoD1KxyvbSh0qZsIoXQGGlVztIY+oitJPpRQ== +fbjs@^0.8.15: + version "0.8.18" + resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.18.tgz#9835e0addb9aca2eff53295cd79ca1cfc7c9662a" + integrity sha512-EQaWFK+fEPSoibjNy8IxUtaFOMXcWsY0JaVrQoZR9zC8N2Ygf9iDITPWjUTVIax95b6I742JFLqASHfsag/vKA== + dependencies: + core-js "^1.0.0" + isomorphic-fetch "^2.1.1" + loose-envify "^1.0.0" + object-assign "^4.1.0" + promise "^7.1.1" + setimmediate "^1.0.5" + ua-parser-js "^0.7.30" + fbjs@^3.0.0, fbjs@^3.0.1: version "3.0.5" resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-3.0.5.tgz#aa0edb7d5caa6340011790bd9249dbef8a81128d" @@ -6132,6 +6123,11 @@ fork-ts-checker-webpack-plugin@^6.5.0: semver "^7.3.2" tapable "^1.0.0" +format@^0.2.0: + version "0.2.2" + resolved "https://registry.yarnpkg.com/format/-/format-0.2.2.tgz#d6170107e9efdc4ed30c9dc39016df942b5cb58b" + integrity sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww== + forwarded@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" @@ -6390,6 +6386,13 @@ globby@^13.1.1: merge2 "^1.4.1" slash "^4.0.0" +good-listener@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/good-listener/-/good-listener-1.2.2.tgz#d53b30cdf9313dffb7dc9a0d477096aa6d145c50" + integrity sha512-goW1b+d9q/HIwbVYZzZ6SsTr4IgE+WA44A0GmPIQstuOrgsFcT7VEJ48nmr9GaRtNu0XTKacFLGnBPAM6Afouw== + dependencies: + delegate "^3.1.2" + gopd@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" @@ -6439,6 +6442,11 @@ gray-matter@^4.0.3: section-matter "^1.0.0" strip-bom-string "^1.0.0" +gud@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/gud/-/gud-1.0.0.tgz#a489581b17e6a70beca9abe3ae57de7a499852c0" + integrity sha512-zGEOVKFM5sVPPrYs7J5/hYEw2Pof8KCyOwyhG8sAF26mCAeUFAcYPu1mwB7hhpIP29zOIBaDqwuHdLp0jvZXjw== + gzip-size@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/gzip-size/-/gzip-size-6.0.0.tgz#065367fd50c239c0671cbcbad5be3e2eeb10e462" @@ -6446,6 +6454,11 @@ gzip-size@^6.0.0: dependencies: duplexer "^0.1.2" +hammerjs@^2.0.8: + version "2.0.8" + resolved "https://registry.yarnpkg.com/hammerjs/-/hammerjs-2.0.8.tgz#04ef77862cff2bb79d30f7692095930222bf60f1" + integrity sha512-tSQXBXS/MWQOn/RKckawJ61vvsDpCom87JgxiYdGwHdOa0ht0vzUWDlfioofFCRU0L+6NGDt6XzbgoJvZkMeRQ== + handle-thing@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-2.0.1.tgz#857f79ce359580c340d43081cc648970d0bb234e" @@ -6559,6 +6572,16 @@ hast-util-to-parse5@^6.0.0: xtend "^4.0.0" zwitch "^1.0.0" +hastscript@^5.0.0: + version "5.1.2" + resolved "https://registry.yarnpkg.com/hastscript/-/hastscript-5.1.2.tgz#bde2c2e56d04c62dd24e8c5df288d050a355fb8a" + integrity sha512-WlztFuK+Lrvi3EggsqOkQ52rKbxkXL3RwB6t5lwoa8QLMemoWfBuL43eDrwOamJyR7uKQKdmKYaBH1NZBiIRrQ== + dependencies: + comma-separated-tokens "^1.0.0" + hast-util-parse-selector "^2.0.0" + property-information "^5.0.0" + space-separated-tokens "^1.0.0" + hastscript@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/hastscript/-/hastscript-6.0.0.tgz#e8768d7eac56c3fdeac8a92830d58e811e5bf640" @@ -6575,6 +6598,11 @@ he@^1.2.0: resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== +highlight.js@~9.12.0: + version "9.12.0" + resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.12.0.tgz#e6d9dbe57cbefe60751f02af336195870c90c01e" + integrity sha512-qNnYpBDO/FQwYVur1+sQBQw7v0cxso1nOYLklqWh6af8ROwwTVoII5+kf/BVa8354WL4ad6rURHYGUXCbD9mMg== + history@^4.9.0: version "4.10.1" resolved "https://registry.yarnpkg.com/history/-/history-4.10.1.tgz#33371a65e3a83b267434e2b3f3b1b4c58aad4cf3" @@ -6587,7 +6615,12 @@ history@^4.9.0: tiny-warning "^1.0.0" value-equal "^1.0.1" -hoist-non-react-statics@^3.1.0: +hoist-non-react-statics@^2.3.1: + version "2.5.5" + resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz#c5903cf409c0dfd908f388e619d86b9c1174cb47" + integrity sha512-rqcy4pJo55FTTLWt+bU8ukscqHeE/e9KWvsOW2b/a3afxQZhwkQdT1rPPCJ0rYXdj4vNcasY8zHTH+jF/qStxw== + +hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.0: version "3.3.2" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw== @@ -6743,6 +6776,13 @@ iconv-lite@0.4.24: dependencies: safer-buffer ">= 2.1.2 < 3" +iconv-lite@^0.6.2: + version "0.6.3" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" + integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw== + dependencies: + safer-buffer ">= 2.1.2 < 3.0.0" + icss-utils@^5.0.0, icss-utils@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-5.1.0.tgz#c6be6858abd013d768e98366ae47e25d5887b1ae" @@ -6765,6 +6805,21 @@ immer@^9.0.7: resolved "https://registry.yarnpkg.com/immer/-/immer-9.0.21.tgz#1e025ea31a40f24fb064f1fef23e931496330176" integrity sha512-bc4NBHqOqSfRW7POMkHd51LvClaeMXpm8dx0e8oE2GORbq5aRK7Bxl4FyzVLdGtLmvLKL7BTDBG5ACQm4HWjTA== +immutable@^3.7.4: + version "3.8.2" + resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.8.2.tgz#c2439951455bb39913daf281376f1530e104adf3" + integrity sha512-15gZoQ38eYjEjxkorfbcgBKBL6R7T459OuK+CpcWt7O3KF4uPCx2tD0uFETlUDIyo+1789crbMhTvQBSR5yBMg== + +immutable@^4.0.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.3.0.tgz#eb1738f14ffb39fd068b1dbe1296117484dd34be" + integrity sha512-0AOCmOip+xgJwEVTQj1EfiDDOkPmuyllDuTuEX+DDXUgapLAsBIfkg3sxCYyCEA8mQqZrrxPUGjcOQ2JS3WLkg== + +immutable@~3.7.4: + version "3.7.6" + resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.7.6.tgz#13b4d3cb12befa15482a26fe1b2ebae640071e4b" + integrity sha512-AizQPcaofEtO11RZhPPHBOJRdo/20MKQF9mBLnVkBoyHi1/zXK8fzVdnEpSV9gxqtnh6Qomfp3F0xT5qP/vThw== + import-fresh@^3.0.0, import-fresh@^3.1.0, import-fresh@^3.2.1, import-fresh@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" @@ -7007,6 +7062,11 @@ is-installed-globally@^0.4.0: global-dirs "^3.0.0" is-path-inside "^3.0.2" +is-mobile@^2.1.0: + version "2.2.2" + resolved "https://registry.yarnpkg.com/is-mobile/-/is-mobile-2.2.2.tgz#f6c9c5d50ee01254ce05e739bdd835f1ed4e9954" + integrity sha512-wW/SXnYJkTjs++tVK5b6kVITZpAZPtUrt9SF80vvxGiF/Oywal+COk1jlRkiVq15RFNEQKQY31TkV24/1T5cVg== + is-negative-zero@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.2.tgz#7bf6f03a28003b8b3965de3ac26f664d765f3150" @@ -7096,6 +7156,11 @@ is-shared-array-buffer@^1.0.2: dependencies: call-bind "^1.0.2" +is-stream@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + integrity sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ== + is-stream@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" @@ -7185,6 +7250,14 @@ isobject@^3.0.0, isobject@^3.0.1: resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" integrity sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg== +isomorphic-fetch@^2.1.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz#611ae1acf14f5e81f729507472819fe9733558a9" + integrity sha512-9c4TNAKYXM5PRyVcwUZrF3W09nQ+sO7+jydgs4ZGW9dhsLG2VOlISJABombdQqQRXCwuYG3sYV/puGf5rp0qmA== + dependencies: + node-fetch "^1.0.1" + whatwg-fetch ">=0.10.0" + istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz#189e7909d0a39fa5a3dfad5b03f71947770191d3" @@ -7688,6 +7761,13 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== +json2mq@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/json2mq/-/json2mq-0.2.0.tgz#b637bd3ba9eabe122c83e9720483aeb10d2c904a" + integrity sha512-SzoRg7ux5DWTII9J2qkrZrqV1gt+rTaoufMxEzXbS26Uid0NwaJd123HcoB80TgubEppxxIGdNxCx50fEoEWQA== + dependencies: + string-convert "^0.2.0" + json5@^2.1.2, json5@^2.2.2: version "2.2.3" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" @@ -7879,7 +7959,7 @@ lodash.curry@^4.0.1: resolved "https://registry.yarnpkg.com/lodash.curry/-/lodash.curry-4.1.1.tgz#248e36072ede906501d75966200a86dab8b23170" integrity sha512-/u14pXGviLaweY5JI0IUzgzF2J6Ne8INyzAZjImcryjgkZ+ebruBxy2/JaOOkTqScddcYtakjhSaeemV8lR0tA== -lodash.debounce@^4.0.8: +lodash.debounce@^4.0.0, lodash.debounce@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow== @@ -7909,12 +7989,17 @@ lodash.merge@^4.6.2: resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== +lodash.throttle@^4.0.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4" + integrity sha512-wIkUCfVKpVsWo3JSZlc+8MB5it+2AN5W8J7YVMST30UrvcQNZ1Okbj+rbVniijTWE6FGYy4XJq/rHkas8qJMLQ== + lodash.uniq@4.5.0, lodash.uniq@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ== -lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21: +lodash@^4.16.5, lodash@^4.17.13, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4, lodash@^4.17.5: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -7943,6 +8028,14 @@ lowercase-keys@^2.0.0: resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479" integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA== +lowlight@~1.9.1: + version "1.9.2" + resolved "https://registry.yarnpkg.com/lowlight/-/lowlight-1.9.2.tgz#0b9127e3cec2c3021b7795dd81005c709a42fdd1" + integrity sha512-Ek18ElVCf/wF/jEm1b92gTnigh94CtBNWiZ2ad+vTgW7cTmQxUY3I98BjHK68gZAJEWmybGBZgx9qv3QxLQB/Q== + dependencies: + fault "^1.0.2" + highlight.js "~9.12.0" + lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" @@ -8142,6 +8235,16 @@ mini-css-extract-plugin@^2.6.1: dependencies: schema-utils "^4.0.0" +mini-store@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/mini-store/-/mini-store-2.0.0.tgz#0843c048d6942ce55e3e78b1b67fc063022b5488" + integrity sha512-EG0CuwpQmX+XL4QVS0kxNwHW5ftSbhygu1qxQH0pipugjnPkbvkalCdQbEihMwtQY6d3MTN+MS0q+aurs+RfLQ== + dependencies: + hoist-non-react-statics "^2.3.1" + prop-types "^15.6.0" + react-lifecycles-compat "^3.0.4" + shallowequal "^1.0.2" + minimalistic-assert@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" @@ -8193,6 +8296,11 @@ mkdirp@^1.0.3: resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== +moment@2.x, moment@^2.24.0: + version "2.29.4" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108" + integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== + mrmime@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/mrmime/-/mrmime-1.0.1.tgz#5f90c825fad4bdd41dc914eff5d1a8cfdaf24f27" @@ -8221,6 +8329,11 @@ multicast-dns@^7.2.5: dns-packet "^5.2.2" thunky "^1.0.2" +mutationobserver-shim@^0.3.2: + version "0.3.7" + resolved "https://registry.yarnpkg.com/mutationobserver-shim/-/mutationobserver-shim-0.3.7.tgz#8bf633b0c0b0291a1107255ed32c13088a8c5bf3" + integrity sha512-oRIDTyZQU96nAiz2AQyngwx1e89iApl2hN5AOYwyxLUB47UYsU3Wv9lJWqH5y/QdiYkc5HQLi23ZNB3fELdHcQ== + nanoid@^3.3.6: version "3.3.6" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c" @@ -8274,6 +8387,14 @@ node-environment-flags@^1.0.5: object.getownpropertydescriptors "^2.0.3" semver "^5.7.0" +node-fetch@^1.0.1: + version "1.7.3" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" + integrity sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ== + dependencies: + encoding "^0.1.11" + is-stream "^1.0.1" + node-fetch@^2.6.11: version "2.6.11" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.11.tgz#cde7fc71deef3131ef80a738919f999e6edfff25" @@ -8354,7 +8475,7 @@ nth-check@^2.0.1: dependencies: boolbase "^1.0.0" -object-assign@^4.1.0, object-assign@^4.1.1: +object-assign@4.x, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== @@ -8413,6 +8534,13 @@ obuf@^1.0.0, obuf@^1.1.2: resolved "https://registry.yarnpkg.com/obuf/-/obuf-1.1.2.tgz#09bea3343d41859ebd446292d11c9d4db619084e" integrity sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg== +omit.js@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/omit.js/-/omit.js-1.0.2.tgz#91a14f0eba84066dfa015bf30e474c47f30bc858" + integrity sha512-/QPc6G2NS+8d4L/cQhbk6Yit1WTB6Us2g84A7A/1+w9d/eRGHyEqC5kkQtHVoHZ5NFWGG7tUGgrhVZwgZanKrQ== + dependencies: + babel-runtime "^6.23.0" + on-finished@2.4.1: version "2.4.1" resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" @@ -8550,6 +8678,18 @@ parent-module@^1.0.0: dependencies: callsites "^3.0.0" +parse-entities@^1.1.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/parse-entities/-/parse-entities-1.2.2.tgz#c31bf0f653b6661354f8973559cb86dd1d5edf50" + integrity sha512-NzfpbxW/NPrzZ/yYSoQxyqUZMZXIdCfE0OIN4ESsnptHJECoUk3FZktxNuzQf4tjt5UEopnxpYJbvYuxIFDdsg== + dependencies: + character-entities "^1.0.0" + character-entities-legacy "^1.0.0" + character-reference-invalid "^1.0.0" + is-alphanumerical "^1.0.0" + is-decimal "^1.0.0" + is-hexadecimal "^1.0.0" + parse-entities@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/parse-entities/-/parse-entities-2.0.0.tgz#53c6eb5b9314a1f4ec99fa0fdf7ce01ecda0cbe8" @@ -8667,6 +8807,11 @@ path-type@^4.0.0: resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== +performance-now@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" + integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow== + picocolors@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" @@ -9047,11 +9192,18 @@ prism-react-renderer@^1.3.5: resolved "https://registry.yarnpkg.com/prism-react-renderer/-/prism-react-renderer-1.3.5.tgz#786bb69aa6f73c32ba1ee813fbe17a0115435085" integrity sha512-IJ+MSwBWKG+SM3b2SUfdrhC+gu01QkV2KmRQgREThBfSQRoufqRfxfHUxpG1WcaFjP+kojcFyO9Qqtpgt3qLCg== -prismjs@^1.28.0: +prismjs@^1.28.0, prismjs@^1.8.4: version "1.29.0" resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.29.0.tgz#f113555a8fa9b57c35e637bba27509dcf802dd12" integrity sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q== +prismjs@~1.17.0: + version "1.17.1" + resolved "https://registry.yarnpkg.com/prismjs/-/prismjs-1.17.1.tgz#e669fcbd4cdd873c35102881c33b14d0d68519be" + integrity sha512-PrEDJAFdUGbOP6xK/UsfkC5ghJsPJviKgnQOoxaDbBjwc8op68Quupwt1DeAFoG8GImPhiKXAvvsH7wDSLsu1Q== + optionalDependencies: + clipboard "^2.0.0" + process-nextick-args@^2.0.0, process-nextick-args@~2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" @@ -9072,7 +9224,7 @@ prompts@^2.0.1, prompts@^2.4.0, prompts@^2.4.2: kleur "^3.0.3" sisteransi "^1.0.5" -prop-types@^15.6.2, prop-types@^15.7.2: +prop-types@15.x, prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.5.6, prop-types@^15.5.7, prop-types@^15.5.8, prop-types@^15.5.9, prop-types@^15.6.0, prop-types@^15.6.2, prop-types@^15.7.2: version "15.8.1" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5" integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg== @@ -9145,6 +9297,13 @@ queue@6.0.2: dependencies: inherits "~2.0.3" +raf@^3.4.0, raf@^3.4.1: + version "3.4.1" + resolved "https://registry.yarnpkg.com/raf/-/raf-3.4.1.tgz#0742e99a4a6552f445d73e3ee0328af0ff1ede39" + integrity sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA== + dependencies: + performance-now "^2.1.0" + randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" @@ -9172,6 +9331,434 @@ raw-body@2.5.1: iconv-lite "0.4.24" unpipe "1.0.0" +rc-align@^2.4.0, rc-align@^2.4.1: + version "2.4.5" + resolved "https://registry.yarnpkg.com/rc-align/-/rc-align-2.4.5.tgz#c941a586f59d1017f23a428f0b468663fb7102ab" + integrity sha512-nv9wYUYdfyfK+qskThf4BQUSIadeI/dCsfaMZfNEoxm9HwOIioQ+LyqmMK6jWHAZQgOzMLaqawhuBXlF63vgjw== + dependencies: + babel-runtime "^6.26.0" + dom-align "^1.7.0" + prop-types "^15.5.8" + rc-util "^4.0.4" + +rc-animate@2.x, rc-animate@^2.10.1, rc-animate@^2.10.2, rc-animate@^2.3.0, rc-animate@^2.6.0, rc-animate@^2.8.2: + version "2.11.1" + resolved "https://registry.yarnpkg.com/rc-animate/-/rc-animate-2.11.1.tgz#2666eeb6f1f2a495a13b2af09e236712278fdb2c" + integrity sha512-1NyuCGFJG/0Y+9RKh5y/i/AalUCA51opyyS/jO2seELpgymZm2u9QV3xwODwEuzkmeQ1BDPxMLmYLcTJedPlkQ== + dependencies: + babel-runtime "6.x" + classnames "^2.2.6" + css-animation "^1.3.2" + prop-types "15.x" + raf "^3.4.0" + rc-util "^4.15.3" + react-lifecycles-compat "^3.0.4" + +rc-animate@^3.0.0-rc.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/rc-animate/-/rc-animate-3.1.1.tgz#defdd863f56816c222534e4dc68feddecd081386" + integrity sha512-8wg2Zg3EETy0k/9kYuis30NJNQg1D6/WSQwnCiz6SvyxQXNet/rVraRz3bPngwY6rcU2nlRvoShiYOorXyF7Sg== + dependencies: + "@ant-design/css-animation" "^1.7.2" + classnames "^2.2.6" + raf "^3.4.0" + rc-util "^4.15.3" + +rc-calendar@~9.15.7: + version "9.15.11" + resolved "https://registry.yarnpkg.com/rc-calendar/-/rc-calendar-9.15.11.tgz#ce1e5ea8e4d77435be66a8c77db12f1f0f9a345f" + integrity sha512-qv0VXfAAnysMWJigxaP6se4bJHvr17D9qsLbi8BOpdgEocsS0RkgY1IUiFaOVYKJDy/EyLC447O02sV/y5YYBg== + dependencies: + babel-runtime "6.x" + classnames "2.x" + moment "2.x" + prop-types "^15.5.8" + rc-trigger "^2.2.0" + rc-util "^4.1.1" + react-lifecycles-compat "^3.0.4" + +rc-cascader@~0.17.4: + version "0.17.5" + resolved "https://registry.yarnpkg.com/rc-cascader/-/rc-cascader-0.17.5.tgz#4fde91d23b7608c420263c38eee9c0687f80f7dc" + integrity sha512-WYMVcxU0+Lj+xLr4YYH0+yXODumvNXDcVEs5i7L1mtpWwYkubPV/zbQpn+jGKFCIW/hOhjkU4J1db8/P/UKE7A== + dependencies: + array-tree-filter "^2.1.0" + prop-types "^15.5.8" + rc-trigger "^2.2.0" + rc-util "^4.0.4" + react-lifecycles-compat "^3.0.4" + shallow-equal "^1.0.0" + warning "^4.0.1" + +rc-checkbox@~2.1.6: + version "2.1.8" + resolved "https://registry.yarnpkg.com/rc-checkbox/-/rc-checkbox-2.1.8.tgz#eedd9ef9c2f3af5b3b8e5cde5254aa89ad1a880a" + integrity sha512-6qOgh0/by0nVNASx6LZnhRTy17Etcgav+IrI7kL9V9kcDZ/g7K14JFlqrtJ3NjDq/Kyn+BPI1st1XvbkhfaJeg== + dependencies: + babel-runtime "^6.23.0" + classnames "2.x" + prop-types "15.x" + react-lifecycles-compat "^3.0.4" + +rc-collapse@~1.11.3: + version "1.11.8" + resolved "https://registry.yarnpkg.com/rc-collapse/-/rc-collapse-1.11.8.tgz#66a40089d469519e9424009ab1c927e214041d80" + integrity sha512-8EhfPyScTYljkbRuIoHniSwZagD5UPpZ3CToYgoNYWC85L2qCbPYF7+OaC713FOrIkp6NbfNqXsITNxmDAmxog== + dependencies: + classnames "2.x" + css-animation "1.x" + prop-types "^15.5.6" + rc-animate "2.x" + react-is "^16.7.0" + react-lifecycles-compat "^3.0.4" + shallowequal "^1.1.0" + +rc-dialog@~7.6.0: + version "7.6.1" + resolved "https://registry.yarnpkg.com/rc-dialog/-/rc-dialog-7.6.1.tgz#11545ccc0b945934fa76079726e0d853e52d705f" + integrity sha512-KUKf+2eZ4YL+lnXMG3hR4ZtIhC9glfH27NtTVz3gcoDIPAf3uUvaXVRNoDCiSi+OGKLyIb/b6EoidFh6nQC5Wg== + dependencies: + babel-runtime "6.x" + rc-animate "2.x" + rc-util "^4.16.1" + +rc-drawer@~3.1.1: + version "3.1.3" + resolved "https://registry.yarnpkg.com/rc-drawer/-/rc-drawer-3.1.3.tgz#cbcb04d4c07f0b66f2ece11d847f4a1bd80ea0b7" + integrity sha512-2z+RdxmzXyZde/1OhVMfDR1e/GBswFeWSZ7FS3Fdd0qhgVdpV1wSzILzzxRaT481ItB5hOV+e8pZT07vdJE8kg== + dependencies: + classnames "^2.2.6" + rc-util "^4.16.1" + react-lifecycles-compat "^3.0.4" + +rc-dropdown@~2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/rc-dropdown/-/rc-dropdown-2.4.1.tgz#aaef6eb3a5152cdd9982895c2a78d9b5f046cdec" + integrity sha512-p0XYn0wrOpAZ2fUGE6YJ6U8JBNc5ASijznZ6dkojdaEfQJAeZtV9KMEewhxkVlxGSbbdXe10ptjBlTEW9vEwEg== + dependencies: + babel-runtime "^6.26.0" + classnames "^2.2.6" + prop-types "^15.5.8" + rc-trigger "^2.5.1" + react-lifecycles-compat "^3.0.2" + +rc-editor-core@~0.8.3: + version "0.8.10" + resolved "https://registry.yarnpkg.com/rc-editor-core/-/rc-editor-core-0.8.10.tgz#6f215bc5df9c33ffa9f6c5b30ca73a7dabe8ab7c" + integrity sha512-T3aHpeMCIYA1sdAI7ynHHjXy5fqp83uPlD68ovZ0oClTSc3tbHmyCxXlA+Ti4YgmcpCYv7avF6a+TIbAka53kw== + dependencies: + babel-runtime "^6.26.0" + classnames "^2.2.5" + draft-js "^0.10.0" + immutable "^3.7.4" + lodash "^4.16.5" + prop-types "^15.5.8" + setimmediate "^1.0.5" + +rc-editor-mention@^1.1.13: + version "1.1.13" + resolved "https://registry.yarnpkg.com/rc-editor-mention/-/rc-editor-mention-1.1.13.tgz#9f1cab1065f86b01523840321790c2ab12ac5e8b" + integrity sha512-3AOmGir91Fi2ogfRRaXLtqlNuIwQpvla7oUnGHS1+3eo7b+fUp5IlKcagqtwUBB5oDNofoySXkLBxzWvSYNp/Q== + dependencies: + babel-runtime "^6.23.0" + classnames "^2.2.5" + dom-scroll-into-view "^1.2.0" + draft-js "~0.10.0" + immutable "~3.7.4" + prop-types "^15.5.8" + rc-animate "^2.3.0" + rc-editor-core "~0.8.3" + +rc-form@^2.4.10: + version "2.4.12" + resolved "https://registry.yarnpkg.com/rc-form/-/rc-form-2.4.12.tgz#4ee8711e90a2584baa7ac276de96bee0d9b0f5f1" + integrity sha512-sHfyWRrnjCHkeCYfYAGop2GQBUC6CKMPcJF9h/gL/vTmZB/RN6fNOGKjXrXjFbwFwKXUWBoPtIDDDmXQW9xNdw== + dependencies: + async-validator "~1.11.3" + babel-runtime "6.x" + create-react-class "^15.5.3" + dom-scroll-into-view "1.x" + hoist-non-react-statics "^3.3.0" + lodash "^4.17.4" + rc-util "^4.15.3" + react-is "^16.13.1" + warning "^4.0.3" + +rc-hammerjs@~0.6.0: + version "0.6.10" + resolved "https://registry.yarnpkg.com/rc-hammerjs/-/rc-hammerjs-0.6.10.tgz#1831a3bd8f2199700bfcc5ad6b20a35630aeb5e0" + integrity sha512-Vgh9qIudyN5CHRop4M+v+xUniQBFWXKrsJxQRVtJOi2xgRrCeI52/bkpaL5HWwUhqTK9Ayq0n7lYTItT6ld5rg== + dependencies: + babel-runtime "6.x" + hammerjs "^2.0.8" + prop-types "^15.5.9" + +rc-input-number@~4.5.0: + version "4.5.9" + resolved "https://registry.yarnpkg.com/rc-input-number/-/rc-input-number-4.5.9.tgz#1cbf735e24fe23c4eb9a4301031720b95f2a3e3d" + integrity sha512-wAT4EBpLDW4+27c935k4F1JLk+gnhyGBkpzBmtkNvIHLG8yTndZSJ2bFfSYfkA6C82IxmAztXs3ffCeUd/rkbg== + dependencies: + babel-runtime "6.x" + classnames "^2.2.0" + prop-types "^15.5.7" + rc-util "^4.5.1" + rmc-feedback "^2.0.0" + +rc-mentions@~0.4.0: + version "0.4.2" + resolved "https://registry.yarnpkg.com/rc-mentions/-/rc-mentions-0.4.2.tgz#c18ab701efb9e4b75b3851a0c0d2dd698640e246" + integrity sha512-DTZurQzacLXOfVuiHydGzqkq7cFMHXF18l2jZ9PhWUn2cqvOSY3W4osN0Pq29AOMOBpcxdZCzgc7Lb0r/bgkDw== + dependencies: + "@ant-design/create-react-context" "^0.2.4" + classnames "^2.2.6" + rc-menu "^7.4.22" + rc-trigger "^2.6.2" + rc-util "^4.6.0" + react-lifecycles-compat "^3.0.4" + +rc-menu@^7.3.0, rc-menu@^7.4.22, rc-menu@~7.5.1: + version "7.5.5" + resolved "https://registry.yarnpkg.com/rc-menu/-/rc-menu-7.5.5.tgz#78cdc817d86fc353a1430b864d3d96c7489600ca" + integrity sha512-4YJXJgrpUGEA1rMftXN7bDhrV5rPB8oBJoHqT+GVXtIWCanfQxEnM3fmhHQhatL59JoAFMZhJaNzhJIk4FUWCQ== + dependencies: + classnames "2.x" + dom-scroll-into-view "1.x" + mini-store "^2.0.0" + mutationobserver-shim "^0.3.2" + rc-animate "^2.10.1" + rc-trigger "^2.3.0" + rc-util "^4.13.0" + resize-observer-polyfill "^1.5.0" + shallowequal "^1.1.0" + +rc-notification@~3.3.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/rc-notification/-/rc-notification-3.3.1.tgz#0baa3e70f8d40ab015ce8fa78c260c490fc7beb4" + integrity sha512-U5+f4BmBVfMSf3OHSLyRagsJ74yKwlrQAtbbL5ijoA0F2C60BufwnOcHG18tVprd7iaIjzZt1TKMmQSYSvgrig== + dependencies: + babel-runtime "6.x" + classnames "2.x" + prop-types "^15.5.8" + rc-animate "2.x" + rc-util "^4.0.4" + +rc-pagination@~1.20.11: + version "1.20.15" + resolved "https://registry.yarnpkg.com/rc-pagination/-/rc-pagination-1.20.15.tgz#ccb4cd0e9bd4e47f72f29ea432c0350bf7b3d807" + integrity sha512-/Xr4/3GOa1DtL8iCYl7qRUroEMrRDhZiiuHwcVFfSiwa9LYloMlUWcOJsnr8LN6A7rLPdm3/CHStUNeYd+2pKw== + dependencies: + babel-runtime "6.x" + classnames "^2.2.6" + prop-types "^15.5.7" + react-lifecycles-compat "^3.0.4" + +rc-progress@~2.5.0: + version "2.5.3" + resolved "https://registry.yarnpkg.com/rc-progress/-/rc-progress-2.5.3.tgz#00f01b95bdbe1856d3a5f82242051902e8b7a8e7" + integrity sha512-K2fa4CnqGehLZoMrdmBeZ86ONSTVcdk5FlqetbwJ3R/+42XfqhwQVOjWp2MH4P7XSQOMAGcNOy1SFfCP3415sg== + dependencies: + babel-runtime "6.x" + prop-types "^15.5.8" + +rc-rate@~2.5.0: + version "2.5.1" + resolved "https://registry.yarnpkg.com/rc-rate/-/rc-rate-2.5.1.tgz#55fc5fd23ea9dcc72250b9a889803479f4842961" + integrity sha512-3iJkNJT8xlHklPCdeZtUZmJmRVUbr6AHRlfSsztfYTXVlHrv2TcPn3XkHsH+12j812WVB7gvilS2j3+ffjUHXg== + dependencies: + classnames "^2.2.5" + prop-types "^15.5.8" + rc-util "^4.3.0" + react-lifecycles-compat "^3.0.4" + +rc-resize-observer@^0.1.0: + version "0.1.3" + resolved "https://registry.yarnpkg.com/rc-resize-observer/-/rc-resize-observer-0.1.3.tgz#097191f9c3ab186ed907b553ba6ef565df11c249" + integrity sha512-uzOQEwx83xdQSFOkOAM7x7GHIQKYnrDV4dWxtCxyG1BS1pkfJ4EvDeMfsvAJHSYkQXVBu+sgRHGbRtLG3qiuUg== + dependencies: + classnames "^2.2.1" + rc-util "^4.13.0" + resize-observer-polyfill "^1.5.1" + +rc-select@~9.2.0: + version "9.2.3" + resolved "https://registry.yarnpkg.com/rc-select/-/rc-select-9.2.3.tgz#64340e2d6ef64e8bc3cfc6f468ffd28625589ac2" + integrity sha512-WhswxOMWiNnkXRbxyrj0kiIvyCfo/BaRPaYbsDetSIAU2yEDwKHF798blCP5u86KLOBKBvtxWLFCkSsQw1so5w== + dependencies: + babel-runtime "^6.23.0" + classnames "2.x" + component-classes "1.x" + dom-scroll-into-view "1.x" + prop-types "^15.5.8" + raf "^3.4.0" + rc-animate "2.x" + rc-menu "^7.3.0" + rc-trigger "^2.5.4" + rc-util "^4.0.4" + react-lifecycles-compat "^3.0.2" + warning "^4.0.2" + +rc-slider@~8.7.1: + version "8.7.1" + resolved "https://registry.yarnpkg.com/rc-slider/-/rc-slider-8.7.1.tgz#9ed07362dc93489a38e654b21b8122ad70fd3c42" + integrity sha512-WMT5mRFUEcrLWwTxsyS8jYmlaMsTVCZIGENLikHsNv+tE8ThU2lCoPfi/xFNUfJFNFSBFP3MwPez9ZsJmNp13g== + dependencies: + babel-runtime "6.x" + classnames "^2.2.5" + prop-types "^15.5.4" + rc-tooltip "^3.7.0" + rc-util "^4.0.4" + react-lifecycles-compat "^3.0.4" + shallowequal "^1.1.0" + warning "^4.0.3" + +rc-steps@~3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/rc-steps/-/rc-steps-3.5.0.tgz#36b2a7f1f49907b0d90363884b18623caf9fb600" + integrity sha512-2Vkkrpa7PZbg7qPsqTNzVDov4u78cmxofjjnIHiGB9+9rqKS8oTLPzbW2uiWDr3Lk+yGwh8rbpGO1E6VAgBCOg== + dependencies: + babel-runtime "^6.23.0" + classnames "^2.2.3" + lodash "^4.17.5" + prop-types "^15.5.7" + +rc-switch@~1.9.0: + version "1.9.2" + resolved "https://registry.yarnpkg.com/rc-switch/-/rc-switch-1.9.2.tgz#7921c766411fe9a6426510c3429022d6ba4dfde2" + integrity sha512-qaK7mY4FLDKy99Hq3A1tf8CcqfzKtHp9LPX8WTnZ0MzdHCTneSARb1XD7Eqeu8BactasYGsi2bF9p18Q+/5JEw== + dependencies: + classnames "^2.2.1" + prop-types "^15.5.6" + react-lifecycles-compat "^3.0.4" + +rc-table@~6.10.5: + version "6.10.15" + resolved "https://registry.yarnpkg.com/rc-table/-/rc-table-6.10.15.tgz#181f4c70c4fd74f657ee8f23196e7eb08a0365ca" + integrity sha512-LAr0M/gqt+irOjvPNBLApmQ0CUHNOfKsEBhu1uIuB3OlN1ynA9z+sdoTQyNd9+8NSl0MYnQOOfhtLChAY7nU0A== + dependencies: + classnames "^2.2.5" + component-classes "^1.2.6" + lodash "^4.17.5" + mini-store "^2.0.0" + prop-types "^15.5.8" + rc-util "^4.13.0" + react-lifecycles-compat "^3.0.2" + shallowequal "^1.0.2" + +rc-tabs@~9.7.0: + version "9.7.0" + resolved "https://registry.yarnpkg.com/rc-tabs/-/rc-tabs-9.7.0.tgz#ae09695bef5963d6e64e7bc10521c76dfdd8448b" + integrity sha512-kvmgp8/MfLzFZ06hWHignqomFQ5nF7BqKr5O1FfhE4VKsGrep52YSF/1MvS5oe0NPcI9XGNS2p751C5v6cYDpQ== + dependencies: + "@ant-design/create-react-context" "^0.2.4" + babel-runtime "6.x" + classnames "2.x" + lodash "^4.17.5" + prop-types "15.x" + raf "^3.4.1" + rc-hammerjs "~0.6.0" + rc-util "^4.0.4" + react-lifecycles-compat "^3.0.4" + resize-observer-polyfill "^1.5.1" + warning "^4.0.3" + +rc-time-picker@~3.7.1: + version "3.7.3" + resolved "https://registry.yarnpkg.com/rc-time-picker/-/rc-time-picker-3.7.3.tgz#65a8de904093250ae9c82b02a4905e0f995e23e2" + integrity sha512-Lv1Mvzp9fRXhXEnRLO4nW6GLNxUkfAZ3RsiIBsWjGjXXvMNjdr4BX/ayElHAFK0DoJqOhm7c5tjmIYpEOwcUXg== + dependencies: + classnames "2.x" + moment "2.x" + prop-types "^15.5.8" + raf "^3.4.1" + rc-trigger "^2.2.0" + react-lifecycles-compat "^3.0.4" + +rc-tooltip@^3.7.0, rc-tooltip@~3.7.3: + version "3.7.3" + resolved "https://registry.yarnpkg.com/rc-tooltip/-/rc-tooltip-3.7.3.tgz#280aec6afcaa44e8dff0480fbaff9e87fc00aecc" + integrity sha512-dE2ibukxxkrde7wH9W8ozHKUO4aQnPZ6qBHtrTH9LoO836PjDdiaWO73fgPB05VfJs9FbZdmGPVEbXCeOP99Ww== + dependencies: + babel-runtime "6.x" + prop-types "^15.5.8" + rc-trigger "^2.2.2" + +rc-tree-select@~2.9.1: + version "2.9.4" + resolved "https://registry.yarnpkg.com/rc-tree-select/-/rc-tree-select-2.9.4.tgz#6aa794e1f0e65c66c406aa0a2a0e74fd0a557b09" + integrity sha512-0HQkXAN4XbfBW20CZYh3G+V+VMrjX42XRtDCpyv6PDUm5vikC0Ob682ZBCVS97Ww2a5Hf6Ajmu0ahWEdIEpwhg== + dependencies: + classnames "^2.2.1" + dom-scroll-into-view "^1.2.1" + prop-types "^15.5.8" + raf "^3.4.0" + rc-animate "^2.8.2" + rc-tree "~2.1.0" + rc-trigger "^3.0.0" + rc-util "^4.5.0" + react-lifecycles-compat "^3.0.4" + shallowequal "^1.0.2" + warning "^4.0.1" + +rc-tree@~2.1.0: + version "2.1.4" + resolved "https://registry.yarnpkg.com/rc-tree/-/rc-tree-2.1.4.tgz#ef759f3e799a21b43c1ecf9c794ea1c14e70b59b" + integrity sha512-Xey794Iavgs8YldFlXcZLOhfcIhlX5Oz/yfKufknBXf2AlZCOkc7aHqSM9uTF7fBPtTGPhPxNEfOqHfY7b7xng== + dependencies: + "@ant-design/create-react-context" "^0.2.4" + classnames "2.x" + prop-types "^15.5.8" + rc-animate "^2.6.0" + rc-util "^4.5.1" + react-lifecycles-compat "^3.0.4" + warning "^4.0.3" + +rc-trigger@^2.2.0, rc-trigger@^2.2.2, rc-trigger@^2.3.0, rc-trigger@^2.5.1, rc-trigger@^2.5.4, rc-trigger@^2.6.2: + version "2.6.5" + resolved "https://registry.yarnpkg.com/rc-trigger/-/rc-trigger-2.6.5.tgz#140a857cf28bd0fa01b9aecb1e26a50a700e9885" + integrity sha512-m6Cts9hLeZWsTvWnuMm7oElhf+03GOjOLfTuU0QmdB9ZrW7jR2IpI5rpNM7i9MvAAlMAmTx5Zr7g3uu/aMvZAw== + dependencies: + babel-runtime "6.x" + classnames "^2.2.6" + prop-types "15.x" + rc-align "^2.4.0" + rc-animate "2.x" + rc-util "^4.4.0" + react-lifecycles-compat "^3.0.4" + +rc-trigger@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/rc-trigger/-/rc-trigger-3.0.0.tgz#f6d9b1da8a26b2b2d1d912a06876c1a486f5980f" + integrity sha512-hQxbbJpo23E2QnYczfq3Ec5J5tVl2mUDhkqxrEsQAqk16HfADQg+iKNWzEYXyERSncdxfnzYuaBgy764mNRzTA== + dependencies: + babel-runtime "6.x" + classnames "^2.2.6" + prop-types "15.x" + raf "^3.4.0" + rc-align "^2.4.1" + rc-animate "^3.0.0-rc.1" + rc-util "^4.15.7" + +rc-upload@~2.9.1: + version "2.9.4" + resolved "https://registry.yarnpkg.com/rc-upload/-/rc-upload-2.9.4.tgz#8e34a73a468d7907fe31982c38100e4593857d32" + integrity sha512-WXt0HGxXyzLrPV6iec/96Rbl/6dyrAW8pKuY6wwD7yFYwfU5bjgKjv7vC8KNMJ6wzitFrZjnoiogNL3dF9dj3Q== + dependencies: + babel-runtime "6.x" + classnames "^2.2.5" + prop-types "^15.5.7" + warning "4.x" + +rc-util@^4.0.4, rc-util@^4.1.1, rc-util@^4.13.0, rc-util@^4.15.3, rc-util@^4.15.7, rc-util@^4.16.1, rc-util@^4.3.0, rc-util@^4.4.0, rc-util@^4.5.0, rc-util@^4.5.1, rc-util@^4.6.0: + version "4.21.1" + resolved "https://registry.yarnpkg.com/rc-util/-/rc-util-4.21.1.tgz#88602d0c3185020aa1053d9a1e70eac161becb05" + integrity sha512-Z+vlkSQVc1l8O2UjR3WQ+XdWlhj5q9BMQNLk2iOBch75CqPfrJyGtcWMcnhRlNuDu0Ndtt4kLVO8JI8BrABobg== + dependencies: + add-dom-event-listener "^1.1.0" + prop-types "^15.5.10" + react-is "^16.12.0" + react-lifecycles-compat "^3.0.4" + shallowequal "^1.1.0" + rc@1.2.8, rc@^1.2.8: version "1.2.8" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" @@ -9252,7 +9839,7 @@ react-helmet-async@*, react-helmet-async@^1.3.0: react-fast-compare "^3.2.0" shallowequal "^1.1.0" -react-is@^16.13.1, react-is@^16.6.0, react-is@^16.7.0: +react-is@^16.12.0, react-is@^16.13.1, react-is@^16.6.0, react-is@^16.7.0: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== @@ -9272,7 +9859,17 @@ react-json-view@^1.21.3: react-lifecycles-compat "^3.0.4" react-textarea-autosize "^8.3.2" -react-lifecycles-compat@^3.0.4: +react-lazy-load@^3.0.13: + version "3.1.14" + resolved "https://registry.yarnpkg.com/react-lazy-load/-/react-lazy-load-3.1.14.tgz#536047d295f578614540a5b417b70b1155f36d9a" + integrity sha512-7tsOItf2HmEwhEWMaA/a2XlShuya7rBxqWAR0TPMO1XSf6ybxSDI2bMV8M6vtWkveX9TlSpb0qLB7NMMpDHVDQ== + dependencies: + eventlistener "0.0.1" + lodash.debounce "^4.0.0" + lodash.throttle "^4.0.0" + prop-types "^15.5.8" + +react-lifecycles-compat@^3.0.2, react-lifecycles-compat@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362" integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA== @@ -9319,6 +9916,28 @@ react-router@5.3.4, react-router@^5.3.3: tiny-invariant "^1.0.2" tiny-warning "^1.0.0" +react-slick@~0.25.2: + version "0.25.2" + resolved "https://registry.yarnpkg.com/react-slick/-/react-slick-0.25.2.tgz#56331b67d47d8bcfe2dceb6acab1c8fd5bd1f6bc" + integrity sha512-8MNH/NFX/R7zF6W/w+FS5VXNyDusF+XDW1OU0SzODEU7wqYB+ZTGAiNJ++zVNAVqCAHdyCybScaUB+FCZOmBBw== + dependencies: + classnames "^2.2.5" + enquire.js "^2.1.6" + json2mq "^0.2.0" + lodash.debounce "^4.0.8" + resize-observer-polyfill "^1.5.0" + +react-syntax-highlighter@^8.0.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/react-syntax-highlighter/-/react-syntax-highlighter-8.1.0.tgz#59103ff17a828a27ed7c8f035ae2558f09b6b78c" + integrity sha512-G2bkZxmF3VOa4atEdXIDSfwwCqjw6ZQX5znfTaHcErA1WqHIS0o6DaSCDKFPVaOMXQEB9Hf1UySYQvuJmV8CXg== + dependencies: + babel-runtime "^6.18.0" + highlight.js "~9.12.0" + lowlight "~1.9.1" + prismjs "^1.8.4" + refractor "^2.4.1" + react-textarea-autosize@^8.3.2: version "8.4.1" resolved "https://registry.yarnpkg.com/react-textarea-autosize/-/react-textarea-autosize-8.4.1.tgz#bcfc5462727014b808b14ee916c01e275e8a8335" @@ -9391,6 +10010,15 @@ redeyed@~2.1.0: dependencies: esprima "~4.0.0" +refractor@^2.4.1: + version "2.10.1" + resolved "https://registry.yarnpkg.com/refractor/-/refractor-2.10.1.tgz#166c32f114ed16fd96190ad21d5193d3afc7d34e" + integrity sha512-Xh9o7hQiQlDbxo5/XkOX6H+x/q8rmlmZKr97Ie1Q8ZM32IRRd3B/UxuA/yXDW79DBSXGWxm2yRTbcTVmAciJRw== + dependencies: + hastscript "^5.0.0" + parse-entities "^1.1.2" + prismjs "~1.17.0" + regenerate-unicode-properties@^10.1.0: version "10.1.0" resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.0.tgz#7c3192cab6dd24e21cb4461e5ddd7dd24fa8374c" @@ -9403,6 +10031,11 @@ regenerate@^1.4.2: resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.2.tgz#b9346d8827e8f5a32f7ba29637d398b69014848a" integrity sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A== +regenerator-runtime@^0.11.0: + version "0.11.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" + integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== + regenerator-runtime@^0.13.11: version "0.13.11" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz#f6dca3e7ceec20590d07ada785636a90cdca17f9" @@ -9577,6 +10210,11 @@ requires-port@^1.0.0: resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ== +resize-observer-polyfill@^1.5.0, resize-observer-polyfill@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464" + integrity sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg== + resolve-cwd@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" @@ -9653,6 +10291,14 @@ rimraf@^3.0.2: dependencies: glob "^7.1.3" +rmc-feedback@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/rmc-feedback/-/rmc-feedback-2.0.0.tgz#cbc6cb3ae63c7a635eef0e25e4fbaf5ac366eeaa" + integrity sha512-5PWOGOW7VXks/l3JzlOU9NIxRpuaSS8d9zA3UULUCuTKnpwBHNvv1jSJzxgbbCQeYzROWUpgKI4za3X4C/mKmQ== + dependencies: + babel-runtime "6.x" + classnames "^2.2.5" + rtl-detect@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/rtl-detect/-/rtl-detect-1.0.4.tgz#40ae0ea7302a150b96bc75af7d749607392ecac6" @@ -9718,7 +10364,7 @@ safe-regex-test@^1.0.0: get-intrinsic "^1.1.3" is-regex "^1.1.4" -"safer-buffer@>= 2.1.2 < 3": +"safer-buffer@>= 2.1.2 < 3", "safer-buffer@>= 2.1.2 < 3.0.0": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== @@ -9786,6 +10432,11 @@ select-hose@^2.0.0: resolved "https://registry.yarnpkg.com/select-hose/-/select-hose-2.0.0.tgz#625d8658f865af43ec962bfc376a37359a4994ca" integrity sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg== +select@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/select/-/select-1.1.2.tgz#0e7350acdec80b1108528786ec1d4418d11b396d" + integrity sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA== + selfsigned@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/selfsigned/-/selfsigned-2.1.1.tgz#18a7613d714c0cd3385c48af0075abf3f266af61" @@ -9801,26 +10452,26 @@ semver-diff@^3.1.1: semver "^6.3.0" semver@^5.4.1, semver@^5.6.0, semver@^5.7.0: - version "5.7.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" - integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== + version "5.7.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" + integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== -semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" - integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== +semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0, semver@^6.3.1: + version "6.3.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.0.0, semver@^7.3.5, semver@^7.3.7, semver@~7.3.0: - version "7.3.8" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798" - integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A== +semver@^7.0.0, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.3.8: + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== dependencies: lru-cache "^6.0.0" -semver@^7.3.2, semver@^7.3.4, semver@^7.3.8: - version "7.5.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.1.tgz#c90c4d631cf74720e46b21c1d37ea07edfab91ec" - integrity sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw== +semver@~7.3.0: + version "7.3.8" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798" + integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A== dependencies: lru-cache "^6.0.0" @@ -9909,7 +10560,12 @@ shallow-clone@^3.0.0: dependencies: kind-of "^6.0.2" -shallowequal@^1.1.0: +shallow-equal@^1.0.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/shallow-equal/-/shallow-equal-1.2.1.tgz#4c16abfa56043aa20d050324efa68940b0da79da" + integrity sha512-S4vJDjHHMBaiZuT9NPb616CSmLf618jawtv3sufLl6ivK8WocjAo58cXwbRV1cgqxH0Qbv+iUt6m05eqEa2IRA== + +shallowequal@^1.0.2, shallowequal@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.1.0.tgz#188d521de95b9087404fd4dcb68b13df0ae4e7f8" integrity sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ== @@ -10108,6 +10764,11 @@ stream-exhaust@^1.0.1, stream-exhaust@^1.0.2: resolved "https://registry.yarnpkg.com/stream-exhaust/-/stream-exhaust-1.0.2.tgz#acdac8da59ef2bc1e17a2c0ccf6c320d120e555d" integrity sha512-b/qaq/GlBK5xaq1yrK9/zFcyRSTNxmcZwFLGSTG0mXgZl/4Z6GgiyYOXOvY7N3eEvFRAG1bkDRz5EPGSvPYQlw== +string-convert@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/string-convert/-/string-convert-0.2.1.tgz#6982cc3049fbb4cd85f8b24568b9d9bf39eeff97" + integrity sha512-u/1tdPl4yQnPBjnVrmdLo9gtuLvELKsAoRapekWggdiQNvvvum+jYF329d84NAa660KQw7pB2n36KrIKVoXa3A== + string-length@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a" @@ -10352,6 +11013,11 @@ thunky@^1.0.2: resolved "https://registry.yarnpkg.com/thunky/-/thunky-1.1.0.tgz#5abaf714a9405db0504732bbccd2cedd9ef9537d" integrity sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA== +tiny-emitter@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz#1d1a56edfc51c43e863cbb5382a72330e3555423" + integrity sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q== + tiny-invariant@^1.0.2: version "1.3.1" resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.3.1.tgz#8560808c916ef02ecfd55e66090df23a4b7aa642" @@ -10362,6 +11028,11 @@ tiny-warning@^1.0.0: resolved "https://registry.yarnpkg.com/tiny-warning/-/tiny-warning-1.0.3.tgz#94a30db453df4c643d0fd566060d60a875d84754" integrity sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA== +tinycolor2@^1.4.1: + version "1.6.0" + resolved "https://registry.yarnpkg.com/tinycolor2/-/tinycolor2-1.6.0.tgz#f98007460169b0263b97072c5ae92484ce02d09e" + integrity sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw== + tmpl@1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" @@ -10384,6 +11055,11 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" +toggle-selection@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/toggle-selection/-/toggle-selection-1.0.6.tgz#6e45b1263f2017fa0acc7d89d78b15b8bf77da32" + integrity sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ== + toidentifier@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" @@ -10516,10 +11192,10 @@ typescript@5.0.4: resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b" integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw== -typescript@^4.7.4: - version "4.9.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" - integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== +ua-parser-js@^0.7.30: + version "0.7.35" + resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.35.tgz#8bda4827be4f0b1dda91699a29499575a1f1d307" + integrity sha512-veRf7dawaj9xaWEu9HoTVn5Pggtc/qj+kqTOFvNiN1l0YdxwC1kvel57UCjThjGa3BHBihE8/UJAHI+uQHmd/g== ua-parser-js@^1.0.35: version "1.0.35" @@ -10880,6 +11556,13 @@ walker@^1.0.8: dependencies: makeerror "1.0.12" +warning@4.x, warning@^4.0.1, warning@^4.0.2, warning@^4.0.3, warning@~4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/warning/-/warning-4.0.3.tgz#16e9e077eb8a86d6af7d64aa1e05fd85b4678ca3" + integrity sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w== + dependencies: + loose-envify "^1.0.0" + watchpack@^2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.0.tgz#fa33032374962c78113f93c7f2fb4c54c9862a5d" @@ -11043,6 +11726,11 @@ websocket-extensions@>=0.1.1: resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.4.tgz#7f8473bc839dfd87608adb95d7eb075211578a42" integrity sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg== +whatwg-fetch@>=0.10.0: + version "3.6.2" + resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz#dced24f37f2624ed0281725d51d0e2e3fe677f8c" + integrity sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA== + whatwg-url@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" diff --git a/yoga/Utils.cpp b/yoga/Utils.cpp deleted file mode 100644 index 7cc94022b6..0000000000 --- a/yoga/Utils.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#include "Utils.h" -#include - -using namespace facebook; - -YGFlexDirection YGFlexDirectionCross( - const YGFlexDirection flexDirection, - const YGDirection direction) { - return YGFlexDirectionIsColumn(flexDirection) - ? YGResolveFlexDirection(YGFlexDirectionRow, direction) - : YGFlexDirectionColumn; -} - -float YGFloatMax(const float a, const float b) { - if (!yoga::isUndefined(a) && !yoga::isUndefined(b)) { - return fmaxf(a, b); - } - return yoga::isUndefined(a) ? b : a; -} - -float YGFloatMin(const float a, const float b) { - if (!yoga::isUndefined(a) && !yoga::isUndefined(b)) { - return fminf(a, b); - } - - return yoga::isUndefined(a) ? b : a; -} - -bool YGValueEqual(const YGValue& a, const YGValue& b) { - if (a.unit != b.unit) { - return false; - } - - if (a.unit == YGUnitUndefined || - (yoga::isUndefined(a.value) && yoga::isUndefined(b.value))) { - return true; - } - - return fabs(a.value - b.value) < 0.0001f; -} - -bool YGFloatsEqual(const float a, const float b) { - if (!yoga::isUndefined(a) && !yoga::isUndefined(b)) { - return fabs(a - b) < 0.0001f; - } - return yoga::isUndefined(a) && yoga::isUndefined(b); -} - -bool YGDoubleEqual(const double a, const double b) { - if (!yoga::isUndefined(a) && !yoga::isUndefined(b)) { - return fabs(a - b) < 0.0001; - } - return yoga::isUndefined(a) && yoga::isUndefined(b); -} - -float YGFloatSanitize(const float val) { - return yoga::isUndefined(val) ? 0 : val; -} - -YGFloatOptional YGFloatOptionalMax(YGFloatOptional op1, YGFloatOptional op2) { - if (op1 >= op2) { - return op1; - } - if (op2 > op1) { - return op2; - } - return op1.isUndefined() ? op2 : op1; -} - -void yoga::throwLogicalErrorWithMessage(const char* message) { -#if defined(__cpp_exceptions) - throw std::logic_error(message); -#else // !defined(__cpp_exceptions) - std::terminate(); -#endif // defined(__cpp_exceptions) -} diff --git a/yoga/Utils.h b/yoga/Utils.h deleted file mode 100644 index 376c4fb55c..0000000000 --- a/yoga/Utils.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include "YGNode.h" -#include "Yoga-internal.h" -#include "CompactValue.h" - -// This struct is an helper model to hold the data for step 4 of flexbox algo, -// which is collecting the flex items in a line. -// -// - itemsOnLine: Number of items which can fit in a line considering the -// available Inner dimension, the flex items computed flexbasis and their -// margin. It may be different than the difference between start and end -// indicates because we skip over absolute-positioned items. -// -// - sizeConsumedOnCurrentLine: It is accumulation of the dimensions and margin -// of all the children on the current line. This will be used in order to -// either set the dimensions of the node if none already exist or to compute -// the remaining space left for the flexible children. -// -// - totalFlexGrowFactors: total flex grow factors of flex items which are to be -// laid in the current line -// -// - totalFlexShrinkFactors: total flex shrink factors of flex items which are -// to be laid in the current line -// -// - endOfLineIndex: Its the end index of the last flex item which was examined -// and it may or may not be part of the current line(as it may be absolutely -// positioned or including it may have caused to overshoot availableInnerDim) -// -// - relativeChildren: Maintain a vector of the child nodes that can shrink -// and/or grow. - -struct YGCollectFlexItemsRowValues { - uint32_t itemsOnLine; - float sizeConsumedOnCurrentLine; - float totalFlexGrowFactors; - float totalFlexShrinkScaledFactors; - uint32_t endOfLineIndex; - std::vector relativeChildren; - float remainingFreeSpace; - // The size of the mainDim for the row after considering size, padding, margin - // and border of flex items. This is used to calculate maxLineDim after going - // through all the rows to decide on the main axis size of owner. - float mainDim; - // The size of the crossDim for the row after considering size, padding, - // margin and border of flex items. Used for calculating containers crossSize. - float crossDim; -}; - -bool YGValueEqual(const YGValue& a, const YGValue& b); -inline bool YGValueEqual( - facebook::yoga::detail::CompactValue a, - facebook::yoga::detail::CompactValue b) { - return YGValueEqual((YGValue) a, (YGValue) b); -} - -// This custom float equality function returns true if either absolute -// difference between two floats is less than 0.0001f or both are undefined. -bool YGFloatsEqual(const float a, const float b); - -bool YGDoubleEqual(const double a, const double b); - -float YGFloatMax(const float a, const float b); - -YGFloatOptional YGFloatOptionalMax( - const YGFloatOptional op1, - const YGFloatOptional op2); - -float YGFloatMin(const float a, const float b); - -// This custom float comparison function compares the array of float with -// YGFloatsEqual, as the default float comparison operator will not work(Look -// at the comments of YGFloatsEqual function). -template -bool YGFloatArrayEqual( - const std::array& val1, - const std::array& val2) { - bool areEqual = true; - for (std::size_t i = 0; i < size && areEqual; ++i) { - areEqual = YGFloatsEqual(val1[i], val2[i]); - } - return areEqual; -} - -// This function returns 0 if YGFloatIsUndefined(val) is true and val otherwise -float YGFloatSanitize(const float val); - -YGFlexDirection YGFlexDirectionCross( - const YGFlexDirection flexDirection, - const YGDirection direction); - -inline bool YGFlexDirectionIsRow(const YGFlexDirection flexDirection) { - return flexDirection == YGFlexDirectionRow || - flexDirection == YGFlexDirectionRowReverse; -} - -inline YGFloatOptional YGResolveValue( - const YGValue value, - const float ownerSize) { - switch (value.unit) { - case YGUnitPoint: - return YGFloatOptional{value.value}; - case YGUnitPercent: - return YGFloatOptional{value.value * ownerSize * 0.01f}; - default: - return YGFloatOptional{}; - } -} - -inline YGFloatOptional YGResolveValue( - facebook::yoga::detail::CompactValue value, - float ownerSize) { - return YGResolveValue((YGValue) value, ownerSize); -} - -inline bool YGFlexDirectionIsColumn(const YGFlexDirection flexDirection) { - return flexDirection == YGFlexDirectionColumn || - flexDirection == YGFlexDirectionColumnReverse; -} - -inline YGFlexDirection YGResolveFlexDirection( - const YGFlexDirection flexDirection, - const YGDirection direction) { - if (direction == YGDirectionRTL) { - if (flexDirection == YGFlexDirectionRow) { - return YGFlexDirectionRowReverse; - } else if (flexDirection == YGFlexDirectionRowReverse) { - return YGFlexDirectionRow; - } - } - - return flexDirection; -} - -inline YGFloatOptional YGResolveValueMargin( - facebook::yoga::detail::CompactValue value, - const float ownerSize) { - return value.isAuto() ? YGFloatOptional{0} : YGResolveValue(value, ownerSize); -} diff --git a/yoga/YGEnums.cpp b/yoga/YGEnums.cpp index e8ace4b38e..f7220eff72 100644 --- a/yoga/YGEnums.cpp +++ b/yoga/YGEnums.cpp @@ -107,8 +107,6 @@ const char* YGExperimentalFeatureToString(const YGExperimentalFeature value) { return "web-flex-basis"; case YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge: return "absolute-percentage-against-padding-edge"; - case YGExperimentalFeatureFixJNILocalRefOverflows: - return "fix-jnilocal-ref-overflows"; } return "unknown"; } diff --git a/yoga/YGEnums.h b/yoga/YGEnums.h index a502d39b16..7abe5d92ec 100644 --- a/yoga/YGEnums.h +++ b/yoga/YGEnums.h @@ -65,8 +65,7 @@ YG_DEFINE_ENUM_FLAG_OPERATORS(YGErrata) YG_ENUM_SEQ_DECL( YGExperimentalFeature, YGExperimentalFeatureWebFlexBasis, - YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge, - YGExperimentalFeatureFixJNILocalRefOverflows) + YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge) YG_ENUM_SEQ_DECL( YGFlexDirection, diff --git a/yoga/YGFloatOptional.h b/yoga/YGFloatOptional.h deleted file mode 100644 index 4aa9e76e29..0000000000 --- a/yoga/YGFloatOptional.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include -#include -#include "Yoga-internal.h" - -struct YGFloatOptional { -private: - float value_ = std::numeric_limits::quiet_NaN(); - -public: - explicit constexpr YGFloatOptional(float value) : value_(value) {} - constexpr YGFloatOptional() = default; - - // returns the wrapped value, or a value x with YGIsUndefined(x) == true - constexpr float unwrap() const { return value_; } - - bool isUndefined() const { return std::isnan(value_); } -}; - -// operators take YGFloatOptional by value, as it is a 32bit value - -inline bool operator==(YGFloatOptional lhs, YGFloatOptional rhs) { - return lhs.unwrap() == rhs.unwrap() || - (lhs.isUndefined() && rhs.isUndefined()); -} -inline bool operator!=(YGFloatOptional lhs, YGFloatOptional rhs) { - return !(lhs == rhs); -} - -inline bool operator==(YGFloatOptional lhs, float rhs) { - return lhs == YGFloatOptional{rhs}; -} -inline bool operator!=(YGFloatOptional lhs, float rhs) { - return !(lhs == rhs); -} - -inline bool operator==(float lhs, YGFloatOptional rhs) { - return rhs == lhs; -} -inline bool operator!=(float lhs, YGFloatOptional rhs) { - return !(lhs == rhs); -} - -inline YGFloatOptional operator+(YGFloatOptional lhs, YGFloatOptional rhs) { - return YGFloatOptional{lhs.unwrap() + rhs.unwrap()}; -} - -inline bool operator>(YGFloatOptional lhs, YGFloatOptional rhs) { - return lhs.unwrap() > rhs.unwrap(); -} - -inline bool operator<(YGFloatOptional lhs, YGFloatOptional rhs) { - return lhs.unwrap() < rhs.unwrap(); -} - -inline bool operator>=(YGFloatOptional lhs, YGFloatOptional rhs) { - return lhs > rhs || lhs == rhs; -} - -inline bool operator<=(YGFloatOptional lhs, YGFloatOptional rhs) { - return lhs < rhs || lhs == rhs; -} diff --git a/yoga/Yoga-internal.h b/yoga/Yoga-internal.h index c16c2ad577..b10cf5d246 100644 --- a/yoga/Yoga-internal.h +++ b/yoga/Yoga-internal.h @@ -8,16 +8,11 @@ #pragma once #include -#include #include #include #include -#include "CompactValue.h" - -using YGVector = std::vector; - YG_EXTERN_C_BEGIN void YGNodeCalculateLayoutWithContext( @@ -32,124 +27,3 @@ void YGNodeCalculateLayoutWithContext( void YGNodeDeallocate(YGNodeRef node); YG_EXTERN_C_END - -namespace facebook::yoga { - -inline bool isUndefined(float value) { - return std::isnan(value); -} - -inline bool isUndefined(double value) { - return std::isnan(value); -} - -void throwLogicalErrorWithMessage(const char* message); - -} // namespace facebook::yoga - -extern const std::array trailing; -extern const std::array leading; -extern const YGValue YGValueUndefined; -extern const YGValue YGValueAuto; -extern const YGValue YGValueZero; - -struct YGCachedMeasurement { - float availableWidth; - float availableHeight; - YGMeasureMode widthMeasureMode; - YGMeasureMode heightMeasureMode; - - float computedWidth; - float computedHeight; - - YGCachedMeasurement() - : availableWidth(-1), - availableHeight(-1), - widthMeasureMode(YGMeasureModeUndefined), - heightMeasureMode(YGMeasureModeUndefined), - computedWidth(-1), - computedHeight(-1) {} - - bool operator==(YGCachedMeasurement measurement) const { - using namespace facebook; - - bool isEqual = widthMeasureMode == measurement.widthMeasureMode && - heightMeasureMode == measurement.heightMeasureMode; - - if (!yoga::isUndefined(availableWidth) || - !yoga::isUndefined(measurement.availableWidth)) { - isEqual = isEqual && availableWidth == measurement.availableWidth; - } - if (!yoga::isUndefined(availableHeight) || - !yoga::isUndefined(measurement.availableHeight)) { - isEqual = isEqual && availableHeight == measurement.availableHeight; - } - if (!yoga::isUndefined(computedWidth) || - !yoga::isUndefined(measurement.computedWidth)) { - isEqual = isEqual && computedWidth == measurement.computedWidth; - } - if (!yoga::isUndefined(computedHeight) || - !yoga::isUndefined(measurement.computedHeight)) { - isEqual = isEqual && computedHeight == measurement.computedHeight; - } - - return isEqual; - } -}; - -// This value was chosen based on empirical data: -// 98% of analyzed layouts require less than 8 entries. -#define YG_MAX_CACHED_RESULT_COUNT 8 - -namespace facebook::yoga::detail { - -template -class Values { -private: - std::array values_; - -public: - Values() = default; - Values(const Values& other) = default; - - explicit Values(const YGValue& defaultValue) noexcept { - values_.fill(defaultValue); - } - - const CompactValue& operator[](size_t i) const noexcept { return values_[i]; } - CompactValue& operator[](size_t i) noexcept { return values_[i]; } - - template - YGValue get() const noexcept { - return std::get(values_); - } - - template - void set(YGValue& value) noexcept { - std::get(values_) = value; - } - - template - void set(YGValue&& value) noexcept { - set(value); - } - - bool operator==(const Values& other) const noexcept { - for (size_t i = 0; i < Size; ++i) { - if (values_[i] != other.values_[i]) { - return false; - } - } - return true; - } - - Values& operator=(const Values& other) = default; -}; - -} // namespace facebook::yoga::detail - -static const float kDefaultFlexGrow = 0.0f; -static const float kDefaultFlexShrink = 0.0f; -static const float kWebDefaultFlexShrink = 1.0f; - -extern bool YGFloatsEqual(const float a, const float b); diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index ab0aa82526..02e5ac488c 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -5,23 +5,28 @@ * LICENSE file in the root directory of this source tree. */ -#include -#include #include #include +#include +#include +#include #include #include - -#include "log.h" -#include "Utils.h" -#include "YGNode.h" -#include "YGNodePrint.h" -#include "Yoga-internal.h" -#include "event/event.h" - +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace facebook; using namespace facebook::yoga; -using detail::Log; #ifdef ANDROID static int YGAndroidLog( @@ -98,99 +103,96 @@ static int YGDefaultLog( #undef YG_UNUSED #endif -static inline bool YGDoubleIsUndefined(const double value) { - return facebook::yoga::isUndefined(value); -} - YOGA_EXPORT bool YGFloatIsUndefined(const float value) { - return facebook::yoga::isUndefined(value); + return yoga::isUndefined(value); } YOGA_EXPORT void* YGNodeGetContext(YGNodeRef node) { - return node->getContext(); + return static_cast(node)->getContext(); } YOGA_EXPORT void YGNodeSetContext(YGNodeRef node, void* context) { - return node->setContext(context); + return static_cast(node)->setContext(context); } YOGA_EXPORT YGConfigRef YGNodeGetConfig(YGNodeRef node) { - return node->getConfig(); + return static_cast(node)->getConfig(); } YOGA_EXPORT void YGNodeSetConfig(YGNodeRef node, YGConfigRef config) { - node->setConfig(config); + static_cast(node)->setConfig(static_cast(config)); } YOGA_EXPORT bool YGNodeHasMeasureFunc(YGNodeRef node) { - return node->hasMeasureFunc(); + return static_cast(node)->hasMeasureFunc(); } YOGA_EXPORT void YGNodeSetMeasureFunc( YGNodeRef node, YGMeasureFunc measureFunc) { - node->setMeasureFunc(measureFunc); + static_cast(node)->setMeasureFunc(measureFunc); } YOGA_EXPORT bool YGNodeHasBaselineFunc(YGNodeRef node) { - return node->hasBaselineFunc(); + return static_cast(node)->hasBaselineFunc(); } YOGA_EXPORT void YGNodeSetBaselineFunc( YGNodeRef node, YGBaselineFunc baselineFunc) { - node->setBaselineFunc(baselineFunc); + static_cast(node)->setBaselineFunc(baselineFunc); } YOGA_EXPORT YGDirtiedFunc YGNodeGetDirtiedFunc(YGNodeRef node) { - return node->getDirtied(); + return static_cast(node)->getDirtied(); } YOGA_EXPORT void YGNodeSetDirtiedFunc( YGNodeRef node, YGDirtiedFunc dirtiedFunc) { - node->setDirtiedFunc(dirtiedFunc); + static_cast(node)->setDirtiedFunc(dirtiedFunc); } YOGA_EXPORT void YGNodeSetPrintFunc(YGNodeRef node, YGPrintFunc printFunc) { - node->setPrintFunc(printFunc); + static_cast(node)->setPrintFunc(printFunc); } YOGA_EXPORT bool YGNodeGetHasNewLayout(YGNodeRef node) { - return node->getHasNewLayout(); + return static_cast(node)->getHasNewLayout(); } YOGA_EXPORT void YGConfigSetPrintTreeFlag(YGConfigRef config, bool enabled) { - config->setShouldPrintTree(enabled); + static_cast(config)->setShouldPrintTree(enabled); } YOGA_EXPORT void YGNodeSetHasNewLayout(YGNodeRef node, bool hasNewLayout) { - node->setHasNewLayout(hasNewLayout); + static_cast(node)->setHasNewLayout(hasNewLayout); } YOGA_EXPORT YGNodeType YGNodeGetNodeType(YGNodeRef node) { - return node->getNodeType(); + return static_cast(node)->getNodeType(); } YOGA_EXPORT void YGNodeSetNodeType(YGNodeRef node, YGNodeType nodeType) { - return node->setNodeType(nodeType); + return static_cast(node)->setNodeType(nodeType); } YOGA_EXPORT bool YGNodeIsDirty(YGNodeRef node) { - return node->isDirty(); + return static_cast(node)->isDirty(); } YOGA_EXPORT void YGNodeMarkDirtyAndPropagateToDescendants( const YGNodeRef node) { - return node->markDirtyAndPropagateDownwards(); + return static_cast(node)->markDirtyAndPropagateDownwards(); } int32_t gConfigInstanceCount = 0; YOGA_EXPORT WIN_EXPORT YGNodeRef YGNodeNewWithConfig(const YGConfigRef config) { - const YGNodeRef node = new YGNode{config}; - YGAssert(config != nullptr, "Tried to construct YGNode with null config"); - YGAssertWithConfig( + auto* node = new yoga::Node{static_cast(config)}; + yoga::assertFatal( + config != nullptr, "Tried to construct YGNode with null config"); + yoga::assertFatalWithConfig( config, node != nullptr, "Could not allocate memory for node"); Event::publish(node, {config}); @@ -206,9 +208,10 @@ YOGA_EXPORT YGNodeRef YGNodeNew(void) { return YGNodeNewWithConfig(YGConfigGetDefault()); } -YOGA_EXPORT YGNodeRef YGNodeClone(YGNodeRef oldNode) { - YGNodeRef node = new YGNode(*oldNode); - YGAssertWithConfig( +YOGA_EXPORT YGNodeRef YGNodeClone(YGNodeRef oldNodeRef) { + auto oldNode = static_cast(oldNodeRef); + auto node = new yoga::Node(*oldNode); + yoga::assertFatalWithConfig( oldNode->getConfig(), node != nullptr, "Could not allocate memory for node"); @@ -217,15 +220,17 @@ YOGA_EXPORT YGNodeRef YGNodeClone(YGNodeRef oldNode) { return node; } -YOGA_EXPORT void YGNodeFree(const YGNodeRef node) { - if (YGNodeRef owner = node->getOwner()) { +YOGA_EXPORT void YGNodeFree(const YGNodeRef nodeRef) { + auto node = static_cast(nodeRef); + + if (auto owner = node->getOwner()) { owner->removeChild(node); node->setOwner(nullptr); } const uint32_t childCount = YGNodeGetChildCount(node); for (uint32_t i = 0; i < childCount; i++) { - const YGNodeRef child = YGNodeGetChild(node, i); + auto child = node->getChild(i); child->setOwner(nullptr); } @@ -234,16 +239,18 @@ YOGA_EXPORT void YGNodeFree(const YGNodeRef node) { } YOGA_EXPORT void YGNodeDeallocate(const YGNodeRef node) { - Event::publish(node, {node->getConfig()}); - delete node; + Event::publish(node, {YGNodeGetConfig(node)}); + delete static_cast(node); } YOGA_EXPORT void YGNodeFreeRecursiveWithCleanupFunc( - const YGNodeRef root, + const YGNodeRef rootRef, YGNodeCleanupFunc cleanup) { + const auto root = static_cast(rootRef); + uint32_t skipped = 0; while (YGNodeGetChildCount(root) > skipped) { - const YGNodeRef child = YGNodeGetChild(root, skipped); + const auto child = root->getChild(skipped); if (child->getOwner() != root) { // Don't free shared nodes that we don't own. skipped += 1; @@ -263,7 +270,7 @@ YOGA_EXPORT void YGNodeFreeRecursive(const YGNodeRef root) { } YOGA_EXPORT void YGNodeReset(YGNodeRef node) { - node->reset(); + static_cast(node)->reset(); } YOGA_EXPORT int32_t YGConfigGetInstanceCount(void) { @@ -272,26 +279,23 @@ YOGA_EXPORT int32_t YGConfigGetInstanceCount(void) { YOGA_EXPORT YGConfigRef YGConfigNew(void) { #ifdef ANDROID - const YGConfigRef config = new YGConfig(YGAndroidLog); + const YGConfigRef config = new yoga::Config(YGAndroidLog); #else - const YGConfigRef config = new YGConfig(YGDefaultLog); + const YGConfigRef config = new yoga::Config(YGDefaultLog); #endif gConfigInstanceCount++; return config; } YOGA_EXPORT void YGConfigFree(const YGConfigRef config) { - delete config; + delete static_cast(config); gConfigInstanceCount--; } -void YGConfigCopy(const YGConfigRef dest, const YGConfigRef src) { - memcpy(dest, src, sizeof(YGConfig)); -} - YOGA_EXPORT void YGNodeSetIsReferenceBaseline( - YGNodeRef node, + YGNodeRef nodeRef, bool isReferenceBaseline) { + auto node = static_cast(nodeRef); if (node->isReferenceBaseline() != isReferenceBaseline) { node->setIsReferenceBaseline(isReferenceBaseline); node->markDirtyAndPropagate(); @@ -299,19 +303,22 @@ YOGA_EXPORT void YGNodeSetIsReferenceBaseline( } YOGA_EXPORT bool YGNodeIsReferenceBaseline(YGNodeRef node) { - return node->isReferenceBaseline(); + return static_cast(node)->isReferenceBaseline(); } YOGA_EXPORT void YGNodeInsertChild( - const YGNodeRef owner, - const YGNodeRef child, + const YGNodeRef ownerRef, + const YGNodeRef childRef, const uint32_t index) { - YGAssertWithNode( + auto owner = static_cast(ownerRef); + auto child = static_cast(childRef); + + yoga::assertFatalWithNode( owner, child->getOwner() == nullptr, "Child already has a owner, it must be removed first."); - YGAssertWithNode( + yoga::assertFatalWithNode( owner, !owner->hasMeasureFunc(), "Cannot add child: Nodes with measure functions cannot have children."); @@ -322,16 +329,22 @@ YOGA_EXPORT void YGNodeInsertChild( } YOGA_EXPORT void YGNodeSwapChild( - const YGNodeRef owner, - const YGNodeRef child, + const YGNodeRef ownerRef, + const YGNodeRef childRef, const uint32_t index) { + auto owner = static_cast(ownerRef); + auto child = static_cast(childRef); + owner->replaceChild(child, index); child->setOwner(owner); } YOGA_EXPORT void YGNodeRemoveChild( - const YGNodeRef owner, - const YGNodeRef excludedChild) { + const YGNodeRef ownerRef, + const YGNodeRef excludedChildRef) { + auto owner = static_cast(ownerRef); + auto excludedChild = static_cast(excludedChildRef); + if (YGNodeGetChildCount(owner) == 0) { // This is an empty set. Nothing to remove. return; @@ -350,19 +363,21 @@ YOGA_EXPORT void YGNodeRemoveChild( } } -YOGA_EXPORT void YGNodeRemoveAllChildren(const YGNodeRef owner) { +YOGA_EXPORT void YGNodeRemoveAllChildren(const YGNodeRef ownerRef) { + auto owner = static_cast(ownerRef); + const uint32_t childCount = YGNodeGetChildCount(owner); if (childCount == 0) { // This is an empty set already. Nothing to do. return; } - const YGNodeRef firstChild = YGNodeGetChild(owner, 0); + auto* firstChild = owner->getChild(0); if (firstChild->getOwner() == owner) { // If the first child has this node as its owner, we assume that this child // set is unique. for (uint32_t i = 0; i < childCount; i++) { - const YGNodeRef oldChild = YGNodeGetChild(owner, i); - oldChild->setLayout(YGNode().getLayout()); // layout is no longer valid + yoga::Node* oldChild = owner->getChild(i); + oldChild->setLayout({}); // layout is no longer valid oldChild->setOwner(nullptr); } owner->clearChildren(); @@ -371,42 +386,45 @@ YOGA_EXPORT void YGNodeRemoveAllChildren(const YGNodeRef owner) { } // Otherwise, we are not the owner of the child set. We don't have to do // anything to clear it. - owner->setChildren(YGVector()); + owner->setChildren({}); owner->markDirtyAndPropagate(); } YOGA_EXPORT void YGNodeSetChildren( - const YGNodeRef owner, - const YGNodeRef* children, + const YGNodeRef ownerRef, + const YGNodeRef* childrenRefs, const uint32_t count) { + auto owner = static_cast(ownerRef); + auto children = reinterpret_cast(childrenRefs); + if (!owner) { return; } - const YGVector childrenVector = {children, children + count}; + const std::vector childrenVector = {children, children + count}; if (childrenVector.size() == 0) { if (YGNodeGetChildCount(owner) > 0) { - for (YGNodeRef const child : owner->getChildren()) { - child->setLayout(YGLayout()); + for (auto* child : owner->getChildren()) { + child->setLayout({}); child->setOwner(nullptr); } - owner->setChildren(YGVector()); + owner->setChildren({}); owner->markDirtyAndPropagate(); } } else { if (YGNodeGetChildCount(owner) > 0) { - for (YGNodeRef const oldChild : owner->getChildren()) { + for (auto* oldChild : owner->getChildren()) { // Our new children may have nodes in common with the old children. We // don't reset these common nodes. if (std::find(childrenVector.begin(), childrenVector.end(), oldChild) == childrenVector.end()) { - oldChild->setLayout(YGLayout()); + oldChild->setLayout({}); oldChild->setOwner(nullptr); } } } owner->setChildren(childrenVector); - for (YGNodeRef child : childrenVector) { + for (yoga::Node* child : childrenVector) { child->setOwner(owner); } owner->markDirtyAndPropagate(); @@ -414,27 +432,32 @@ YOGA_EXPORT void YGNodeSetChildren( } YOGA_EXPORT YGNodeRef -YGNodeGetChild(const YGNodeRef node, const uint32_t index) { +YGNodeGetChild(const YGNodeRef nodeRef, const uint32_t index) { + auto node = static_cast(nodeRef); + if (index < node->getChildren().size()) { return node->getChild(index); } return nullptr; } -YOGA_EXPORT uint32_t YGNodeGetChildCount(const YGNodeRef node) { - return static_cast(node->getChildren().size()); +YOGA_EXPORT uint32_t YGNodeGetChildCount(const YGNodeConstRef node) { + return static_cast( + static_cast(node)->getChildren().size()); } YOGA_EXPORT YGNodeRef YGNodeGetOwner(const YGNodeRef node) { - return node->getOwner(); + return static_cast(node)->getOwner(); } YOGA_EXPORT YGNodeRef YGNodeGetParent(const YGNodeRef node) { - return node->getOwner(); + return static_cast(node)->getOwner(); } -YOGA_EXPORT void YGNodeMarkDirty(const YGNodeRef node) { - YGAssertWithNode( +YOGA_EXPORT void YGNodeMarkDirty(const YGNodeRef nodeRef) { + auto node = static_cast(nodeRef); + + yoga::assertFatalWithNode( node, node->hasMeasureFunc(), "Only leaf nodes with custom measure functions " @@ -444,24 +467,29 @@ YOGA_EXPORT void YGNodeMarkDirty(const YGNodeRef node) { } YOGA_EXPORT void YGNodeCopyStyle( - const YGNodeRef dstNode, - const YGNodeRef srcNode) { + const YGNodeRef dstNodeRef, + const YGNodeRef srcNodeRef) { + auto dstNode = static_cast(dstNodeRef); + auto srcNode = static_cast(srcNodeRef); + if (!(dstNode->getStyle() == srcNode->getStyle())) { dstNode->setStyle(srcNode->getStyle()); dstNode->markDirtyAndPropagate(); } } -YOGA_EXPORT float YGNodeStyleGetFlexGrow(const YGNodeConstRef node) { +YOGA_EXPORT float YGNodeStyleGetFlexGrow(const YGNodeConstRef nodeRef) { + auto node = static_cast(nodeRef); return node->getStyle().flexGrow().isUndefined() - ? kDefaultFlexGrow + ? Style::DefaultFlexGrow : node->getStyle().flexGrow().unwrap(); } -YOGA_EXPORT float YGNodeStyleGetFlexShrink(const YGNodeConstRef node) { +YOGA_EXPORT float YGNodeStyleGetFlexShrink(const YGNodeConstRef nodeRef) { + auto node = static_cast(nodeRef); return node->getStyle().flexShrink().isUndefined() - ? (node->getConfig()->useWebDefaults() ? kWebDefaultFlexShrink - : kDefaultFlexShrink) + ? (node->getConfig()->useWebDefaults() ? Style::WebDefaultFlexShrink + : Style::DefaultFlexShrink) : node->getStyle().flexShrink().unwrap(); } @@ -469,7 +497,7 @@ namespace { template void updateStyle( - YGNode* node, + yoga::Node* node, T value, NeedsUpdate&& needsUpdate, Update&& update) { @@ -480,26 +508,25 @@ void updateStyle( } template -void updateStyle(YGNode* node, Ref (YGStyle::*prop)(), T value) { +void updateStyle(YGNodeRef node, Ref (Style::*prop)(), T value) { updateStyle( - node, + static_cast(node), value, - [prop](YGStyle& s, T x) { return (s.*prop)() != x; }, - [prop](YGStyle& s, T x) { (s.*prop)() = x; }); + [prop](Style& s, T x) { return (s.*prop)() != x; }, + [prop](Style& s, T x) { (s.*prop)() = x; }); } template void updateIndexedStyleProp( - YGNode* node, - Ref (YGStyle::*prop)(), + YGNodeRef node, + Ref (Style::*prop)(), Idx idx, - detail::CompactValue value) { - using detail::CompactValue; + CompactValue value) { updateStyle( - node, + static_cast(node), value, - [idx, prop](YGStyle& s, CompactValue x) { return (s.*prop)()[idx] != x; }, - [idx, prop](YGStyle& s, CompactValue x) { (s.*prop)()[idx] = x; }); + [idx, prop](Style& s, CompactValue x) { return (s.*prop)()[idx] != x; }, + [idx, prop](Style& s, CompactValue x) { (s.*prop)()[idx] = x; }); } } // namespace @@ -509,134 +536,136 @@ void updateIndexedStyleProp( // overload like clang and GCC. For the purposes of updateStyle(), we can help // MSVC by specifying that return type explicitly. In combination with // decltype, MSVC will prefer the non-const version. -#define MSVC_HINT(PROP) decltype(YGStyle{}.PROP()) +#define MSVC_HINT(PROP) decltype(Style{}.PROP()) YOGA_EXPORT void YGNodeStyleSetDirection( const YGNodeRef node, const YGDirection value) { - updateStyle(node, &YGStyle::direction, value); + updateStyle(node, &Style::direction, value); } YOGA_EXPORT YGDirection YGNodeStyleGetDirection(const YGNodeConstRef node) { - return node->getStyle().direction(); + return static_cast(node)->getStyle().direction(); } YOGA_EXPORT void YGNodeStyleSetFlexDirection( const YGNodeRef node, const YGFlexDirection flexDirection) { updateStyle( - node, &YGStyle::flexDirection, flexDirection); + node, &Style::flexDirection, flexDirection); } YOGA_EXPORT YGFlexDirection YGNodeStyleGetFlexDirection(const YGNodeConstRef node) { - return node->getStyle().flexDirection(); + return static_cast(node)->getStyle().flexDirection(); } YOGA_EXPORT void YGNodeStyleSetJustifyContent( const YGNodeRef node, const YGJustify justifyContent) { updateStyle( - node, &YGStyle::justifyContent, justifyContent); + node, &Style::justifyContent, justifyContent); } YOGA_EXPORT YGJustify YGNodeStyleGetJustifyContent(const YGNodeConstRef node) { - return node->getStyle().justifyContent(); + return static_cast(node)->getStyle().justifyContent(); } YOGA_EXPORT void YGNodeStyleSetAlignContent( const YGNodeRef node, const YGAlign alignContent) { updateStyle( - node, &YGStyle::alignContent, alignContent); + node, &Style::alignContent, alignContent); } YOGA_EXPORT YGAlign YGNodeStyleGetAlignContent(const YGNodeConstRef node) { - return node->getStyle().alignContent(); + return static_cast(node)->getStyle().alignContent(); } YOGA_EXPORT void YGNodeStyleSetAlignItems( const YGNodeRef node, const YGAlign alignItems) { - updateStyle(node, &YGStyle::alignItems, alignItems); + updateStyle(node, &Style::alignItems, alignItems); } YOGA_EXPORT YGAlign YGNodeStyleGetAlignItems(const YGNodeConstRef node) { - return node->getStyle().alignItems(); + return static_cast(node)->getStyle().alignItems(); } YOGA_EXPORT void YGNodeStyleSetAlignSelf( const YGNodeRef node, const YGAlign alignSelf) { - updateStyle(node, &YGStyle::alignSelf, alignSelf); + updateStyle(node, &Style::alignSelf, alignSelf); } YOGA_EXPORT YGAlign YGNodeStyleGetAlignSelf(const YGNodeConstRef node) { - return node->getStyle().alignSelf(); + return static_cast(node)->getStyle().alignSelf(); } YOGA_EXPORT void YGNodeStyleSetPositionType( const YGNodeRef node, const YGPositionType positionType) { updateStyle( - node, &YGStyle::positionType, positionType); + node, &Style::positionType, positionType); } YOGA_EXPORT YGPositionType YGNodeStyleGetPositionType(const YGNodeConstRef node) { - return node->getStyle().positionType(); + return static_cast(node)->getStyle().positionType(); } YOGA_EXPORT void YGNodeStyleSetFlexWrap( const YGNodeRef node, const YGWrap flexWrap) { - updateStyle(node, &YGStyle::flexWrap, flexWrap); + updateStyle(node, &Style::flexWrap, flexWrap); } YOGA_EXPORT YGWrap YGNodeStyleGetFlexWrap(const YGNodeConstRef node) { - return node->getStyle().flexWrap(); + return static_cast(node)->getStyle().flexWrap(); } YOGA_EXPORT void YGNodeStyleSetOverflow( const YGNodeRef node, const YGOverflow overflow) { - updateStyle(node, &YGStyle::overflow, overflow); + updateStyle(node, &Style::overflow, overflow); } YOGA_EXPORT YGOverflow YGNodeStyleGetOverflow(const YGNodeConstRef node) { - return node->getStyle().overflow(); + return static_cast(node)->getStyle().overflow(); } YOGA_EXPORT void YGNodeStyleSetDisplay( const YGNodeRef node, const YGDisplay display) { - updateStyle(node, &YGStyle::display, display); + updateStyle(node, &Style::display, display); } YOGA_EXPORT YGDisplay YGNodeStyleGetDisplay(const YGNodeConstRef node) { - return node->getStyle().display(); + return static_cast(node)->getStyle().display(); } -// TODO(T26792433): Change the API to accept YGFloatOptional. +// TODO(T26792433): Change the API to accept FloatOptional. YOGA_EXPORT void YGNodeStyleSetFlex(const YGNodeRef node, const float flex) { - updateStyle(node, &YGStyle::flex, YGFloatOptional{flex}); + updateStyle(node, &Style::flex, FloatOptional{flex}); } -// TODO(T26792433): Change the API to accept YGFloatOptional. -YOGA_EXPORT float YGNodeStyleGetFlex(const YGNodeConstRef node) { +// TODO(T26792433): Change the API to accept FloatOptional. +YOGA_EXPORT float YGNodeStyleGetFlex(const YGNodeConstRef nodeRef) { + auto node = static_cast(nodeRef); return node->getStyle().flex().isUndefined() ? YGUndefined : node->getStyle().flex().unwrap(); } -// TODO(T26792433): Change the API to accept YGFloatOptional. +// TODO(T26792433): Change the API to accept FloatOptional. YOGA_EXPORT void YGNodeStyleSetFlexGrow( const YGNodeRef node, const float flexGrow) { updateStyle( - node, &YGStyle::flexGrow, YGFloatOptional{flexGrow}); + node, &Style::flexGrow, FloatOptional{flexGrow}); } -// TODO(T26792433): Change the API to accept YGFloatOptional. +// TODO(T26792433): Change the API to accept FloatOptional. YOGA_EXPORT void YGNodeStyleSetFlexShrink( const YGNodeRef node, const float flexShrink) { updateStyle( - node, &YGStyle::flexShrink, YGFloatOptional{flexShrink}); + node, &Style::flexShrink, FloatOptional{flexShrink}); } YOGA_EXPORT YGValue YGNodeStyleGetFlexBasis(const YGNodeConstRef node) { - YGValue flexBasis = node->getStyle().flexBasis(); + YGValue flexBasis = + static_cast(node)->getStyle().flexBasis(); if (flexBasis.unit == YGUnitUndefined || flexBasis.unit == YGUnitAuto) { // TODO(T26792433): Get rid off the use of YGUndefined at client side flexBasis.value = YGUndefined; @@ -647,103 +676,100 @@ YOGA_EXPORT YGValue YGNodeStyleGetFlexBasis(const YGNodeConstRef node) { YOGA_EXPORT void YGNodeStyleSetFlexBasis( const YGNodeRef node, const float flexBasis) { - auto value = detail::CompactValue::ofMaybe(flexBasis); - updateStyle(node, &YGStyle::flexBasis, value); + auto value = CompactValue::ofMaybe(flexBasis); + updateStyle(node, &Style::flexBasis, value); } YOGA_EXPORT void YGNodeStyleSetFlexBasisPercent( const YGNodeRef node, const float flexBasisPercent) { - auto value = detail::CompactValue::ofMaybe(flexBasisPercent); - updateStyle(node, &YGStyle::flexBasis, value); + auto value = CompactValue::ofMaybe(flexBasisPercent); + updateStyle(node, &Style::flexBasis, value); } YOGA_EXPORT void YGNodeStyleSetFlexBasisAuto(const YGNodeRef node) { updateStyle( - node, &YGStyle::flexBasis, detail::CompactValue::ofAuto()); + node, &Style::flexBasis, CompactValue::ofAuto()); } YOGA_EXPORT void YGNodeStyleSetPosition( YGNodeRef node, YGEdge edge, float points) { - auto value = detail::CompactValue::ofMaybe(points); + auto value = CompactValue::ofMaybe(points); updateIndexedStyleProp( - node, &YGStyle::position, edge, value); + node, &Style::position, edge, value); } YOGA_EXPORT void YGNodeStyleSetPositionPercent( YGNodeRef node, YGEdge edge, float percent) { - auto value = detail::CompactValue::ofMaybe(percent); + auto value = CompactValue::ofMaybe(percent); updateIndexedStyleProp( - node, &YGStyle::position, edge, value); + node, &Style::position, edge, value); } YOGA_EXPORT YGValue YGNodeStyleGetPosition(YGNodeConstRef node, YGEdge edge) { - return node->getStyle().position()[edge]; + return static_cast(node)->getStyle().position()[edge]; } YOGA_EXPORT void YGNodeStyleSetMargin( YGNodeRef node, YGEdge edge, float points) { - auto value = detail::CompactValue::ofMaybe(points); - updateIndexedStyleProp( - node, &YGStyle::margin, edge, value); + auto value = CompactValue::ofMaybe(points); + updateIndexedStyleProp(node, &Style::margin, edge, value); } YOGA_EXPORT void YGNodeStyleSetMarginPercent( YGNodeRef node, YGEdge edge, float percent) { - auto value = detail::CompactValue::ofMaybe(percent); - updateIndexedStyleProp( - node, &YGStyle::margin, edge, value); + auto value = CompactValue::ofMaybe(percent); + updateIndexedStyleProp(node, &Style::margin, edge, value); } YOGA_EXPORT void YGNodeStyleSetMarginAuto(YGNodeRef node, YGEdge edge) { updateIndexedStyleProp( - node, &YGStyle::margin, edge, detail::CompactValue::ofAuto()); + node, &Style::margin, edge, CompactValue::ofAuto()); } YOGA_EXPORT YGValue YGNodeStyleGetMargin(YGNodeConstRef node, YGEdge edge) { - return node->getStyle().margin()[edge]; + return static_cast(node)->getStyle().margin()[edge]; } YOGA_EXPORT void YGNodeStyleSetPadding( YGNodeRef node, YGEdge edge, float points) { - auto value = detail::CompactValue::ofMaybe(points); + auto value = CompactValue::ofMaybe(points); updateIndexedStyleProp( - node, &YGStyle::padding, edge, value); + node, &Style::padding, edge, value); } YOGA_EXPORT void YGNodeStyleSetPaddingPercent( YGNodeRef node, YGEdge edge, float percent) { - auto value = detail::CompactValue::ofMaybe(percent); + auto value = CompactValue::ofMaybe(percent); updateIndexedStyleProp( - node, &YGStyle::padding, edge, value); + node, &Style::padding, edge, value); } YOGA_EXPORT YGValue YGNodeStyleGetPadding(YGNodeConstRef node, YGEdge edge) { - return node->getStyle().padding()[edge]; + return static_cast(node)->getStyle().padding()[edge]; } -// TODO(T26792433): Change the API to accept YGFloatOptional. +// TODO(T26792433): Change the API to accept FloatOptional. YOGA_EXPORT void YGNodeStyleSetBorder( const YGNodeRef node, const YGEdge edge, const float border) { - auto value = detail::CompactValue::ofMaybe(border); - updateIndexedStyleProp( - node, &YGStyle::border, edge, value); + auto value = CompactValue::ofMaybe(border); + updateIndexedStyleProp(node, &Style::border, edge, value); } YOGA_EXPORT float YGNodeStyleGetBorder( const YGNodeConstRef node, const YGEdge edge) { - auto border = node->getStyle().border()[edge]; + auto border = static_cast(node)->getStyle().border()[edge]; if (border.isUndefined() || border.isAuto()) { // TODO(T26792433): Rather than returning YGUndefined, change the api to - // return YGFloatOptional. + // return FloatOptional. return YGUndefined; } @@ -754,17 +780,18 @@ YOGA_EXPORT void YGNodeStyleSetGap( const YGNodeRef node, const YGGutter gutter, const float gapLength) { - auto length = detail::CompactValue::ofMaybe(gapLength); - updateIndexedStyleProp(node, &YGStyle::gap, gutter, length); + auto length = CompactValue::ofMaybe(gapLength); + updateIndexedStyleProp(node, &Style::gap, gutter, length); } YOGA_EXPORT float YGNodeStyleGetGap( const YGNodeConstRef node, const YGGutter gutter) { - auto gapLength = node->getStyle().gap()[gutter]; + auto gapLength = + static_cast(node)->getStyle().gap()[gutter]; if (gapLength.isUndefined() || gapLength.isAuto()) { // TODO(T26792433): Rather than returning YGUndefined, change the api to - // return YGFloatOptional. + // return FloatOptional. return YGUndefined; } @@ -773,143 +800,151 @@ YOGA_EXPORT float YGNodeStyleGetGap( // Yoga specific properties, not compatible with flexbox specification -// TODO(T26792433): Change the API to accept YGFloatOptional. +// TODO(T26792433): Change the API to accept FloatOptional. YOGA_EXPORT float YGNodeStyleGetAspectRatio(const YGNodeConstRef node) { - const YGFloatOptional op = node->getStyle().aspectRatio(); + const FloatOptional op = + static_cast(node)->getStyle().aspectRatio(); return op.isUndefined() ? YGUndefined : op.unwrap(); } -// TODO(T26792433): Change the API to accept YGFloatOptional. +// TODO(T26792433): Change the API to accept FloatOptional. YOGA_EXPORT void YGNodeStyleSetAspectRatio( const YGNodeRef node, const float aspectRatio) { updateStyle( - node, &YGStyle::aspectRatio, YGFloatOptional{aspectRatio}); + node, &Style::aspectRatio, FloatOptional{aspectRatio}); } YOGA_EXPORT void YGNodeStyleSetWidth(YGNodeRef node, float points) { - auto value = detail::CompactValue::ofMaybe(points); + auto value = CompactValue::ofMaybe(points); updateIndexedStyleProp( - node, &YGStyle::dimensions, YGDimensionWidth, value); + node, &Style::dimensions, YGDimensionWidth, value); } YOGA_EXPORT void YGNodeStyleSetWidthPercent(YGNodeRef node, float percent) { - auto value = detail::CompactValue::ofMaybe(percent); + auto value = CompactValue::ofMaybe(percent); updateIndexedStyleProp( - node, &YGStyle::dimensions, YGDimensionWidth, value); + node, &Style::dimensions, YGDimensionWidth, value); } YOGA_EXPORT void YGNodeStyleSetWidthAuto(YGNodeRef node) { updateIndexedStyleProp( - node, - &YGStyle::dimensions, - YGDimensionWidth, - detail::CompactValue::ofAuto()); + node, &Style::dimensions, YGDimensionWidth, CompactValue::ofAuto()); } YOGA_EXPORT YGValue YGNodeStyleGetWidth(YGNodeConstRef node) { - return node->getStyle().dimensions()[YGDimensionWidth]; + return static_cast(node) + ->getStyle() + .dimensions()[YGDimensionWidth]; } YOGA_EXPORT void YGNodeStyleSetHeight(YGNodeRef node, float points) { - auto value = detail::CompactValue::ofMaybe(points); + auto value = CompactValue::ofMaybe(points); updateIndexedStyleProp( - node, &YGStyle::dimensions, YGDimensionHeight, value); + node, &Style::dimensions, YGDimensionHeight, value); } YOGA_EXPORT void YGNodeStyleSetHeightPercent(YGNodeRef node, float percent) { - auto value = detail::CompactValue::ofMaybe(percent); + auto value = CompactValue::ofMaybe(percent); updateIndexedStyleProp( - node, &YGStyle::dimensions, YGDimensionHeight, value); + node, &Style::dimensions, YGDimensionHeight, value); } YOGA_EXPORT void YGNodeStyleSetHeightAuto(YGNodeRef node) { updateIndexedStyleProp( - node, - &YGStyle::dimensions, - YGDimensionHeight, - detail::CompactValue::ofAuto()); + node, &Style::dimensions, YGDimensionHeight, CompactValue::ofAuto()); } YOGA_EXPORT YGValue YGNodeStyleGetHeight(YGNodeConstRef node) { - return node->getStyle().dimensions()[YGDimensionHeight]; + return static_cast(node) + ->getStyle() + .dimensions()[YGDimensionHeight]; } YOGA_EXPORT void YGNodeStyleSetMinWidth( const YGNodeRef node, const float minWidth) { - auto value = detail::CompactValue::ofMaybe(minWidth); + auto value = CompactValue::ofMaybe(minWidth); updateIndexedStyleProp( - node, &YGStyle::minDimensions, YGDimensionWidth, value); + node, &Style::minDimensions, YGDimensionWidth, value); } YOGA_EXPORT void YGNodeStyleSetMinWidthPercent( const YGNodeRef node, const float minWidth) { - auto value = detail::CompactValue::ofMaybe(minWidth); + auto value = CompactValue::ofMaybe(minWidth); updateIndexedStyleProp( - node, &YGStyle::minDimensions, YGDimensionWidth, value); + node, &Style::minDimensions, YGDimensionWidth, value); } YOGA_EXPORT YGValue YGNodeStyleGetMinWidth(const YGNodeConstRef node) { - return node->getStyle().minDimensions()[YGDimensionWidth]; + return static_cast(node) + ->getStyle() + .minDimensions()[YGDimensionWidth]; } YOGA_EXPORT void YGNodeStyleSetMinHeight( const YGNodeRef node, const float minHeight) { - auto value = detail::CompactValue::ofMaybe(minHeight); + auto value = CompactValue::ofMaybe(minHeight); updateIndexedStyleProp( - node, &YGStyle::minDimensions, YGDimensionHeight, value); + node, &Style::minDimensions, YGDimensionHeight, value); } YOGA_EXPORT void YGNodeStyleSetMinHeightPercent( const YGNodeRef node, const float minHeight) { - auto value = detail::CompactValue::ofMaybe(minHeight); + auto value = CompactValue::ofMaybe(minHeight); updateIndexedStyleProp( - node, &YGStyle::minDimensions, YGDimensionHeight, value); + node, &Style::minDimensions, YGDimensionHeight, value); } YOGA_EXPORT YGValue YGNodeStyleGetMinHeight(const YGNodeConstRef node) { - return node->getStyle().minDimensions()[YGDimensionHeight]; + return static_cast(node) + ->getStyle() + .minDimensions()[YGDimensionHeight]; } YOGA_EXPORT void YGNodeStyleSetMaxWidth( const YGNodeRef node, const float maxWidth) { - auto value = detail::CompactValue::ofMaybe(maxWidth); + auto value = CompactValue::ofMaybe(maxWidth); updateIndexedStyleProp( - node, &YGStyle::maxDimensions, YGDimensionWidth, value); + node, &Style::maxDimensions, YGDimensionWidth, value); } YOGA_EXPORT void YGNodeStyleSetMaxWidthPercent( const YGNodeRef node, const float maxWidth) { - auto value = detail::CompactValue::ofMaybe(maxWidth); + auto value = CompactValue::ofMaybe(maxWidth); updateIndexedStyleProp( - node, &YGStyle::maxDimensions, YGDimensionWidth, value); + node, &Style::maxDimensions, YGDimensionWidth, value); } YOGA_EXPORT YGValue YGNodeStyleGetMaxWidth(const YGNodeConstRef node) { - return node->getStyle().maxDimensions()[YGDimensionWidth]; + return static_cast(node) + ->getStyle() + .maxDimensions()[YGDimensionWidth]; } YOGA_EXPORT void YGNodeStyleSetMaxHeight( const YGNodeRef node, const float maxHeight) { - auto value = detail::CompactValue::ofMaybe(maxHeight); + auto value = CompactValue::ofMaybe(maxHeight); updateIndexedStyleProp( - node, &YGStyle::maxDimensions, YGDimensionHeight, value); + node, &Style::maxDimensions, YGDimensionHeight, value); } YOGA_EXPORT void YGNodeStyleSetMaxHeightPercent( const YGNodeRef node, const float maxHeight) { - auto value = detail::CompactValue::ofMaybe(maxHeight); + auto value = CompactValue::ofMaybe(maxHeight); updateIndexedStyleProp( - node, &YGStyle::maxDimensions, YGDimensionHeight, value); + node, &Style::maxDimensions, YGDimensionHeight, value); } YOGA_EXPORT YGValue YGNodeStyleGetMaxHeight(const YGNodeConstRef node) { - return node->getStyle().maxDimensions()[YGDimensionHeight]; + return static_cast(node) + ->getStyle() + .maxDimensions()[YGDimensionHeight]; } -#define YG_NODE_LAYOUT_PROPERTY_IMPL(type, name, instanceName) \ - YOGA_EXPORT type YGNodeLayoutGet##name(const YGNodeRef node) { \ - return node->getLayout().instanceName; \ +#define YG_NODE_LAYOUT_PROPERTY_IMPL(type, name, instanceName) \ + YOGA_EXPORT type YGNodeLayoutGet##name(const YGNodeRef node) { \ + return static_cast(node)->getLayout().instanceName; \ } #define YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(type, name, instanceName) \ YOGA_EXPORT type YGNodeLayoutGet##name( \ - const YGNodeRef node, const YGEdge edge) { \ - YGAssertWithNode( \ + const YGNodeRef nodeRef, const YGEdge edge) { \ + auto node = static_cast(nodeRef); \ + yoga::assertFatalWithNode( \ node, \ edge <= YGEdgeEnd, \ "Cannot get layout properties of multi-edge shorthands"); \ @@ -949,7 +984,7 @@ YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(float, Padding, padding) std::atomic gCurrentGenerationCount(0); bool YGLayoutNodeInternal( - const YGNodeRef node, + yoga::Node* const node, const float availableWidth, const float availableHeight, const YGDirection ownerDirection, @@ -966,26 +1001,16 @@ bool YGLayoutNodeInternal( const uint32_t generationCount); #ifdef DEBUG -static void YGNodePrintInternal( - const YGNodeRef node, - const YGPrintOptions options) { - std::string str; - facebook::yoga::YGNodeToString(str, node, options, 0); - Log::log(node, YGLogLevelDebug, nullptr, str.c_str()); -} - YOGA_EXPORT void YGNodePrint( - const YGNodeRef node, + const YGNodeRef nodeRef, const YGPrintOptions options) { - YGNodePrintInternal(node, options); + const auto node = static_cast(nodeRef); + std::string str; + yoga::nodeToString(str, node, options, 0); + yoga::log(node, YGLogLevelDebug, nullptr, str.c_str()); } #endif -const std::array leading = { - {YGEdgeTop, YGEdgeBottom, YGEdgeLeft, YGEdgeRight}}; - -const std::array trailing = { - {YGEdgeBottom, YGEdgeTop, YGEdgeRight, YGEdgeLeft}}; static const std::array pos = {{ YGEdgeTop, YGEdgeBottom, @@ -997,7 +1022,7 @@ static const std::array dim = { {YGDimensionHeight, YGDimensionHeight, YGDimensionWidth, YGDimensionWidth}}; static inline float YGNodePaddingAndBorderForAxis( - const YGNodeConstRef node, + const yoga::Node* const node, const YGFlexDirection axis, const float widthSize) { return (node->getLeadingPaddingAndBorder(axis, widthSize) + @@ -1005,18 +1030,19 @@ static inline float YGNodePaddingAndBorderForAxis( .unwrap(); } -static inline YGAlign YGNodeAlignItem(const YGNode* node, const YGNode* child) { +static inline YGAlign YGNodeAlignItem( + const yoga::Node* node, + const yoga::Node* child) { const YGAlign align = child->getStyle().alignSelf() == YGAlignAuto ? node->getStyle().alignItems() : child->getStyle().alignSelf(); - if (align == YGAlignBaseline && - YGFlexDirectionIsColumn(node->getStyle().flexDirection())) { + if (align == YGAlignBaseline && isColumn(node->getStyle().flexDirection())) { return YGAlignFlexStart; } return align; } -static float YGBaseline(const YGNodeRef node, void* layoutContext) { +static float YGBaseline(yoga::Node* node, void* layoutContext) { if (node->hasBaselineFunc()) { Event::publish(node); @@ -1028,17 +1054,17 @@ static float YGBaseline(const YGNodeRef node, void* layoutContext) { Event::publish(node); - YGAssertWithNode( + yoga::assertFatalWithNode( node, - !YGFloatIsUndefined(baseline), + !yoga::isUndefined(baseline), "Expect custom baseline function to not return NaN"); return baseline; } - YGNodeRef baselineChild = nullptr; + yoga::Node* baselineChild = nullptr; const uint32_t childCount = YGNodeGetChildCount(node); for (uint32_t i = 0; i < childCount; i++) { - const YGNodeRef child = YGNodeGetChild(node, i); + auto child = node->getChild(i); if (child->getLineIndex() > 0) { break; } @@ -1064,8 +1090,8 @@ static float YGBaseline(const YGNodeRef node, void* layoutContext) { return baseline + baselineChild->getLayout().position[YGEdgeTop]; } -static bool YGIsBaselineLayout(const YGNodeRef node) { - if (YGFlexDirectionIsColumn(node->getStyle().flexDirection())) { +static bool YGIsBaselineLayout(const yoga::Node* node) { + if (isColumn(node->getStyle().flexDirection())) { return false; } if (node->getStyle().alignItems() == YGAlignBaseline) { @@ -1073,7 +1099,7 @@ static bool YGIsBaselineLayout(const YGNodeRef node) { } const uint32_t childCount = YGNodeGetChildCount(node); for (uint32_t i = 0; i < childCount; i++) { - const YGNodeRef child = YGNodeGetChild(node, i); + auto child = node->getChild(i); if (child->getStyle().positionType() != YGPositionTypeAbsolute && child->getStyle().alignSelf() == YGAlignBaseline) { return true; @@ -1084,7 +1110,7 @@ static bool YGIsBaselineLayout(const YGNodeRef node) { } static inline float YGNodeDimWithMargin( - const YGNodeRef node, + const yoga::Node* const node, const YGFlexDirection axis, const float widthSize) { return node->getLayout().measuredDimensions[dim[axis]] + @@ -1094,11 +1120,11 @@ static inline float YGNodeDimWithMargin( } static inline bool YGNodeIsStyleDimDefined( - const YGNodeRef node, + const yoga::Node* const node, const YGFlexDirection axis, const float ownerSize) { bool isUndefined = - YGFloatIsUndefined(node->getResolvedDimension(dim[axis]).value); + yoga::isUndefined(node->getResolvedDimension(dim[axis]).value); return !( node->getResolvedDimension(dim[axis]).unit == YGUnitAuto || node->getResolvedDimension(dim[axis]).unit == YGUnitUndefined || @@ -1107,41 +1133,41 @@ static inline bool YGNodeIsStyleDimDefined( (node->getResolvedDimension(dim[axis]).unit == YGUnitPercent && !isUndefined && (node->getResolvedDimension(dim[axis]).value < 0.0f || - YGFloatIsUndefined(ownerSize)))); + yoga::isUndefined(ownerSize)))); } static inline bool YGNodeIsLayoutDimDefined( - const YGNodeRef node, + const yoga::Node* const node, const YGFlexDirection axis) { const float value = node->getLayout().measuredDimensions[dim[axis]]; - return !YGFloatIsUndefined(value) && value >= 0.0f; + return !yoga::isUndefined(value) && value >= 0.0f; } -static YGFloatOptional YGNodeBoundAxisWithinMinAndMax( - const YGNodeConstRef node, +static FloatOptional YGNodeBoundAxisWithinMinAndMax( + const yoga::Node* const node, const YGFlexDirection axis, - const YGFloatOptional value, + const FloatOptional value, const float axisSize) { - YGFloatOptional min; - YGFloatOptional max; + FloatOptional min; + FloatOptional max; - if (YGFlexDirectionIsColumn(axis)) { - min = YGResolveValue( + if (isColumn(axis)) { + min = yoga::resolveValue( node->getStyle().minDimensions()[YGDimensionHeight], axisSize); - max = YGResolveValue( + max = yoga::resolveValue( node->getStyle().maxDimensions()[YGDimensionHeight], axisSize); - } else if (YGFlexDirectionIsRow(axis)) { - min = YGResolveValue( + } else if (isRow(axis)) { + min = yoga::resolveValue( node->getStyle().minDimensions()[YGDimensionWidth], axisSize); - max = YGResolveValue( + max = yoga::resolveValue( node->getStyle().maxDimensions()[YGDimensionWidth], axisSize); } - if (max >= YGFloatOptional{0} && value > max) { + if (max >= FloatOptional{0} && value > max) { return max; } - if (min >= YGFloatOptional{0} && value < min) { + if (min >= FloatOptional{0} && value < min) { return min; } @@ -1151,40 +1177,39 @@ static YGFloatOptional YGNodeBoundAxisWithinMinAndMax( // Like YGNodeBoundAxisWithinMinAndMax but also ensures that the value doesn't // go below the padding and border amount. static inline float YGNodeBoundAxis( - const YGNodeRef node, + const yoga::Node* const node, const YGFlexDirection axis, const float value, const float axisSize, const float widthSize) { - return YGFloatMax( - YGNodeBoundAxisWithinMinAndMax( - node, axis, YGFloatOptional{value}, axisSize) + return yoga::maxOrDefined( + YGNodeBoundAxisWithinMinAndMax(node, axis, FloatOptional{value}, axisSize) .unwrap(), YGNodePaddingAndBorderForAxis(node, axis, widthSize)); } static void YGNodeSetChildTrailingPosition( - const YGNodeRef node, - const YGNodeRef child, + const yoga::Node* const node, + yoga::Node* const child, const YGFlexDirection axis) { const float size = child->getLayout().measuredDimensions[dim[axis]]; child->setLayoutPosition( node->getLayout().measuredDimensions[dim[axis]] - size - child->getLayout().position[pos[axis]], - trailing[axis]); + trailingEdge(axis)); } static void YGConstrainMaxSizeForMode( - const YGNodeConstRef node, + const yoga::Node* const node, const enum YGFlexDirection axis, const float ownerAxisSize, const float ownerWidth, YGMeasureMode* mode, float* size) { - const YGFloatOptional maxSize = - YGResolveValue( + const FloatOptional maxSize = + yoga::resolveValue( node->getStyle().maxDimensions()[dim[axis]], ownerAxisSize) + - YGFloatOptional(node->getMarginForAxis(axis, ownerWidth)); + FloatOptional(node->getMarginForAxis(axis, ownerWidth)); switch (*mode) { case YGMeasureModeExactly: case YGMeasureModeAtMost: @@ -1202,8 +1227,8 @@ static void YGConstrainMaxSizeForMode( } static void YGNodeComputeFlexBasisForChild( - const YGNodeRef node, - const YGNodeRef child, + const yoga::Node* const node, + yoga::Node* const child, const float width, const YGMeasureMode widthMode, const float height, @@ -1217,8 +1242,8 @@ static void YGNodeComputeFlexBasisForChild( const uint32_t depth, const uint32_t generationCount) { const YGFlexDirection mainAxis = - YGResolveFlexDirection(node->getStyle().flexDirection(), direction); - const bool isMainAxisRow = YGFlexDirectionIsRow(mainAxis); + resolveDirection(node->getStyle().flexDirection(), direction); + const bool isMainAxisRow = isRow(mainAxis); const float mainAxisSize = isMainAxisRow ? width : height; const float mainAxisownerSize = isMainAxisRow ? ownerWidth : ownerHeight; @@ -1227,39 +1252,39 @@ static void YGNodeComputeFlexBasisForChild( YGMeasureMode childWidthMeasureMode; YGMeasureMode childHeightMeasureMode; - const YGFloatOptional resolvedFlexBasis = - YGResolveValue(child->resolveFlexBasisPtr(), mainAxisownerSize); + const FloatOptional resolvedFlexBasis = + yoga::resolveValue(child->resolveFlexBasisPtr(), mainAxisownerSize); const bool isRowStyleDimDefined = YGNodeIsStyleDimDefined(child, YGFlexDirectionRow, ownerWidth); const bool isColumnStyleDimDefined = YGNodeIsStyleDimDefined(child, YGFlexDirectionColumn, ownerHeight); - if (!resolvedFlexBasis.isUndefined() && !YGFloatIsUndefined(mainAxisSize)) { + if (!resolvedFlexBasis.isUndefined() && !yoga::isUndefined(mainAxisSize)) { if (child->getLayout().computedFlexBasis.isUndefined() || (child->getConfig()->isExperimentalFeatureEnabled( YGExperimentalFeatureWebFlexBasis) && child->getLayout().computedFlexBasisGeneration != generationCount)) { - const YGFloatOptional paddingAndBorder = YGFloatOptional( + const FloatOptional paddingAndBorder = FloatOptional( YGNodePaddingAndBorderForAxis(child, mainAxis, ownerWidth)); child->setLayoutComputedFlexBasis( - YGFloatOptionalMax(resolvedFlexBasis, paddingAndBorder)); + yoga::maxOrDefined(resolvedFlexBasis, paddingAndBorder)); } } else if (isMainAxisRow && isRowStyleDimDefined) { // The width is definite, so use that as the flex basis. - const YGFloatOptional paddingAndBorder = YGFloatOptional( + const FloatOptional paddingAndBorder = FloatOptional( YGNodePaddingAndBorderForAxis(child, YGFlexDirectionRow, ownerWidth)); - child->setLayoutComputedFlexBasis(YGFloatOptionalMax( - YGResolveValue( + child->setLayoutComputedFlexBasis(yoga::maxOrDefined( + yoga::resolveValue( child->getResolvedDimensions()[YGDimensionWidth], ownerWidth), paddingAndBorder)); } else if (!isMainAxisRow && isColumnStyleDimDefined) { // The height is definite, so use that as the flex basis. - const YGFloatOptional paddingAndBorder = - YGFloatOptional(YGNodePaddingAndBorderForAxis( + const FloatOptional paddingAndBorder = + FloatOptional(YGNodePaddingAndBorderForAxis( child, YGFlexDirectionColumn, ownerWidth)); - child->setLayoutComputedFlexBasis(YGFloatOptionalMax( - YGResolveValue( + child->setLayoutComputedFlexBasis(yoga::maxOrDefined( + yoga::resolveValue( child->getResolvedDimensions()[YGDimensionHeight], ownerHeight), paddingAndBorder)); } else { @@ -1277,7 +1302,7 @@ static void YGNodeComputeFlexBasisForChild( if (isRowStyleDimDefined) { childWidth = - YGResolveValue( + yoga::resolveValue( child->getResolvedDimensions()[YGDimensionWidth], ownerWidth) .unwrap() + marginRow; @@ -1285,7 +1310,7 @@ static void YGNodeComputeFlexBasisForChild( } if (isColumnStyleDimDefined) { childHeight = - YGResolveValue( + yoga::resolveValue( child->getResolvedDimensions()[YGDimensionHeight], ownerHeight) .unwrap() + marginColumn; @@ -1296,7 +1321,7 @@ static void YGNodeComputeFlexBasisForChild( // major browsers appear to implement the following logic. if ((!isMainAxisRow && node->getStyle().overflow() == YGOverflowScroll) || node->getStyle().overflow() != YGOverflowScroll) { - if (YGFloatIsUndefined(childWidth) && !YGFloatIsUndefined(width)) { + if (yoga::isUndefined(childWidth) && !yoga::isUndefined(width)) { childWidth = width; childWidthMeasureMode = YGMeasureModeAtMost; } @@ -1304,7 +1329,7 @@ static void YGNodeComputeFlexBasisForChild( if ((isMainAxisRow && node->getStyle().overflow() == YGOverflowScroll) || node->getStyle().overflow() != YGOverflowScroll) { - if (YGFloatIsUndefined(childHeight) && !YGFloatIsUndefined(height)) { + if (yoga::isUndefined(childHeight) && !yoga::isUndefined(height)) { childHeight = height; childHeightMeasureMode = YGMeasureModeAtMost; } @@ -1328,7 +1353,7 @@ static void YGNodeComputeFlexBasisForChild( // the cross axis to be measured exactly with the available inner width const bool hasExactWidth = - !YGFloatIsUndefined(width) && widthMode == YGMeasureModeExactly; + !yoga::isUndefined(width) && widthMode == YGMeasureModeExactly; const bool childWidthStretch = YGNodeAlignItem(node, child) == YGAlignStretch && childWidthMeasureMode != YGMeasureModeExactly; @@ -1344,7 +1369,7 @@ static void YGNodeComputeFlexBasisForChild( } const bool hasExactHeight = - !YGFloatIsUndefined(height) && heightMode == YGMeasureModeExactly; + !yoga::isUndefined(height) && heightMode == YGMeasureModeExactly; const bool childHeightStretch = YGNodeAlignItem(node, child) == YGAlignStretch && childHeightMeasureMode != YGMeasureModeExactly; @@ -1393,7 +1418,7 @@ static void YGNodeComputeFlexBasisForChild( depth, generationCount); - child->setLayoutComputedFlexBasis(YGFloatOptional(YGFloatMax( + child->setLayoutComputedFlexBasis(FloatOptional(yoga::maxOrDefined( child->getLayout().measuredDimensions[dim[mainAxis]], YGNodePaddingAndBorderForAxis(child, mainAxis, ownerWidth)))); } @@ -1401,8 +1426,8 @@ static void YGNodeComputeFlexBasisForChild( } static void YGNodeAbsoluteLayoutChild( - const YGNodeRef node, - const YGNodeRef child, + const yoga::Node* const node, + yoga::Node* const child, const float width, const YGMeasureMode widthMode, const float height, @@ -1413,9 +1438,9 @@ static void YGNodeAbsoluteLayoutChild( const uint32_t depth, const uint32_t generationCount) { const YGFlexDirection mainAxis = - YGResolveFlexDirection(node->getStyle().flexDirection(), direction); - const YGFlexDirection crossAxis = YGFlexDirectionCross(mainAxis, direction); - const bool isMainAxisRow = YGFlexDirectionIsRow(mainAxis); + resolveDirection(node->getStyle().flexDirection(), direction); + const YGFlexDirection crossAxis = resolveCrossDirection(mainAxis, direction); + const bool isMainAxisRow = isRow(mainAxis); float childWidth = YGUndefined; float childHeight = YGUndefined; @@ -1427,9 +1452,9 @@ static void YGNodeAbsoluteLayoutChild( child->getMarginForAxis(YGFlexDirectionColumn, width).unwrap(); if (YGNodeIsStyleDimDefined(child, YGFlexDirectionRow, width)) { - childWidth = - YGResolveValue(child->getResolvedDimensions()[YGDimensionWidth], width) - .unwrap() + + childWidth = yoga::resolveValue( + child->getResolvedDimensions()[YGDimensionWidth], width) + .unwrap() + marginRow; } else { // If the child doesn't have a specified width, compute the width based on @@ -1448,7 +1473,7 @@ static void YGNodeAbsoluteLayoutChild( } if (YGNodeIsStyleDimDefined(child, YGFlexDirectionColumn, height)) { - childHeight = YGResolveValue( + childHeight = yoga::resolveValue( child->getResolvedDimensions()[YGDimensionHeight], height) .unwrap() + marginColumn; @@ -1472,12 +1497,12 @@ static void YGNodeAbsoluteLayoutChild( // ratio calculation. One dimension being the anchor and the other being // flexible. const auto& childStyle = child->getStyle(); - if (YGFloatIsUndefined(childWidth) ^ YGFloatIsUndefined(childHeight)) { + if (yoga::isUndefined(childWidth) ^ yoga::isUndefined(childHeight)) { if (!childStyle.aspectRatio().isUndefined()) { - if (YGFloatIsUndefined(childWidth)) { + if (yoga::isUndefined(childWidth)) { childWidth = marginRow + (childHeight - marginColumn) * childStyle.aspectRatio().unwrap(); - } else if (YGFloatIsUndefined(childHeight)) { + } else if (yoga::isUndefined(childHeight)) { childHeight = marginColumn + (childWidth - marginRow) / childStyle.aspectRatio().unwrap(); } @@ -1485,11 +1510,11 @@ static void YGNodeAbsoluteLayoutChild( } // If we're still missing one or the other dimension, measure the content. - if (YGFloatIsUndefined(childWidth) || YGFloatIsUndefined(childHeight)) { - childWidthMeasureMode = YGFloatIsUndefined(childWidth) + if (yoga::isUndefined(childWidth) || yoga::isUndefined(childHeight)) { + childWidthMeasureMode = yoga::isUndefined(childWidth) ? YGMeasureModeUndefined : YGMeasureModeExactly; - childHeightMeasureMode = YGFloatIsUndefined(childHeight) + childHeightMeasureMode = yoga::isUndefined(childHeight) ? YGMeasureModeUndefined : YGMeasureModeExactly; @@ -1497,8 +1522,8 @@ static void YGNodeAbsoluteLayoutChild( // child to that size as well. This allows text within the absolute child to // wrap to the size of its owner. This is the same behavior as many browsers // implement. - if (!isMainAxisRow && YGFloatIsUndefined(childWidth) && - widthMode != YGMeasureModeUndefined && !YGFloatIsUndefined(width) && + if (!isMainAxisRow && yoga::isUndefined(childWidth) && + widthMode != YGMeasureModeUndefined && !yoga::isUndefined(width) && width > 0) { childWidth = width; childWidthMeasureMode = YGMeasureModeAtMost; @@ -1553,7 +1578,7 @@ static void YGNodeAbsoluteLayoutChild( .unwrap() - child->getTrailingPosition(mainAxis, isMainAxisRow ? width : height) .unwrap(), - leading[mainAxis]); + leadingEdge(mainAxis)); } else if ( !child->isLeadingPositionDefined(mainAxis) && node->getStyle().justifyContent() == YGJustifyCenter) { @@ -1561,14 +1586,14 @@ static void YGNodeAbsoluteLayoutChild( (node->getLayout().measuredDimensions[dim[mainAxis]] - child->getLayout().measuredDimensions[dim[mainAxis]]) / 2.0f, - leading[mainAxis]); + leadingEdge(mainAxis)); } else if ( !child->isLeadingPositionDefined(mainAxis) && node->getStyle().justifyContent() == YGJustifyFlexEnd) { child->setLayoutPosition( (node->getLayout().measuredDimensions[dim[mainAxis]] - child->getLayout().measuredDimensions[dim[mainAxis]]), - leading[mainAxis]); + leadingEdge(mainAxis)); } else if ( node->getConfig()->isExperimentalFeatureEnabled( YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge) && @@ -1583,7 +1608,7 @@ static void YGNodeAbsoluteLayoutChild( mainAxis, node->getLayout().measuredDimensions[dim[mainAxis]]) .unwrap(), - leading[mainAxis]); + leadingEdge(mainAxis)); } if (child->isTrailingPosDefined(crossAxis) && @@ -1597,7 +1622,7 @@ static void YGNodeAbsoluteLayoutChild( child ->getTrailingPosition(crossAxis, isMainAxisRow ? height : width) .unwrap(), - leading[crossAxis]); + leadingEdge(crossAxis)); } else if ( !child->isLeadingPositionDefined(crossAxis) && @@ -1606,7 +1631,7 @@ static void YGNodeAbsoluteLayoutChild( (node->getLayout().measuredDimensions[dim[crossAxis]] - child->getLayout().measuredDimensions[dim[crossAxis]]) / 2.0f, - leading[crossAxis]); + leadingEdge(crossAxis)); } else if ( !child->isLeadingPositionDefined(crossAxis) && ((YGNodeAlignItem(node, child) == YGAlignFlexEnd) ^ @@ -1614,7 +1639,7 @@ static void YGNodeAbsoluteLayoutChild( child->setLayoutPosition( (node->getLayout().measuredDimensions[dim[crossAxis]] - child->getLayout().measuredDimensions[dim[crossAxis]]), - leading[crossAxis]); + leadingEdge(crossAxis)); } else if ( node->getConfig()->isExperimentalFeatureEnabled( YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge) && @@ -1630,12 +1655,12 @@ static void YGNodeAbsoluteLayoutChild( crossAxis, node->getLayout().measuredDimensions[dim[crossAxis]]) .unwrap(), - leading[crossAxis]); + leadingEdge(crossAxis)); } } static void YGNodeWithMeasureFuncSetMeasuredDimensions( - const YGNodeRef node, + yoga::Node* const node, float availableWidth, float availableHeight, const YGMeasureMode widthMeasureMode, @@ -1645,7 +1670,7 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions( LayoutData& layoutMarkerData, void* const layoutContext, const LayoutPassReason reason) { - YGAssertWithNode( + yoga::assertFatalWithNode( node, node->hasMeasureFunc(), "Expected node to have custom measure function"); @@ -1665,12 +1690,12 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions( padding[YGEdgeBottom] + border[YGEdgeTop] + border[YGEdgeBottom]; // We want to make sure we don't call measure with negative size - const float innerWidth = YGFloatIsUndefined(availableWidth) + const float innerWidth = yoga::isUndefined(availableWidth) ? availableWidth - : YGFloatMax(0, availableWidth - paddingAndBorderAxisRow); - const float innerHeight = YGFloatIsUndefined(availableHeight) + : yoga::maxOrDefined(0, availableWidth - paddingAndBorderAxisRow); + const float innerHeight = yoga::isUndefined(availableHeight) ? availableHeight - : YGFloatMax(0, availableHeight - paddingAndBorderAxisColumn); + : yoga::maxOrDefined(0, availableHeight - paddingAndBorderAxisColumn); if (widthMeasureMode == YGMeasureModeExactly && heightMeasureMode == YGMeasureModeExactly) { @@ -1742,7 +1767,7 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions( // For nodes with no children, use the available values if they were provided, // or the minimum size as indicated by the padding and border sizes. static void YGNodeEmptyContainerSetMeasuredDimensions( - const YGNodeRef node, + yoga::Node* const node, const float availableWidth, const float availableHeight, const YGMeasureMode widthMeasureMode, @@ -1775,16 +1800,16 @@ static void YGNodeEmptyContainerSetMeasuredDimensions( } static bool YGNodeFixedSizeSetMeasuredDimensions( - const YGNodeRef node, + yoga::Node* const node, const float availableWidth, const float availableHeight, const YGMeasureMode widthMeasureMode, const YGMeasureMode heightMeasureMode, const float ownerWidth, const float ownerHeight) { - if ((!YGFloatIsUndefined(availableWidth) && + if ((!yoga::isUndefined(availableWidth) && widthMeasureMode == YGMeasureModeAtMost && availableWidth <= 0.0f) || - (!YGFloatIsUndefined(availableHeight) && + (!yoga::isUndefined(availableHeight) && heightMeasureMode == YGMeasureModeAtMost && availableHeight <= 0.0f) || (widthMeasureMode == YGMeasureModeExactly && heightMeasureMode == YGMeasureModeExactly)) { @@ -1792,7 +1817,7 @@ static bool YGNodeFixedSizeSetMeasuredDimensions( YGNodeBoundAxis( node, YGFlexDirectionRow, - YGFloatIsUndefined(availableWidth) || + yoga::isUndefined(availableWidth) || (widthMeasureMode == YGMeasureModeAtMost && availableWidth < 0.0f) ? 0.0f @@ -1805,7 +1830,7 @@ static bool YGNodeFixedSizeSetMeasuredDimensions( YGNodeBoundAxis( node, YGFlexDirectionColumn, - YGFloatIsUndefined(availableHeight) || + yoga::isUndefined(availableHeight) || (heightMeasureMode == YGMeasureModeAtMost && availableHeight < 0.0f) ? 0.0f @@ -1820,7 +1845,7 @@ static bool YGNodeFixedSizeSetMeasuredDimensions( } static void YGZeroOutLayoutRecursively( - const YGNodeRef node, + yoga::Node* const node, void* layoutContext) { node->getLayout() = {}; node->setLayoutDimension(0, 0); @@ -1832,7 +1857,7 @@ static void YGZeroOutLayoutRecursively( } static float YGNodeCalculateAvailableInnerDim( - const YGNodeConstRef node, + const yoga::Node* const node, const YGDimension dimension, const float availableDim, const float paddingAndBorder, @@ -1840,30 +1865,30 @@ static float YGNodeCalculateAvailableInnerDim( float availableInnerDim = availableDim - paddingAndBorder; // Max dimension overrides predefined dimension value; Min dimension in turn // overrides both of the above - if (!YGFloatIsUndefined(availableInnerDim)) { + if (!yoga::isUndefined(availableInnerDim)) { // We want to make sure our available height does not violate min and max // constraints - const YGFloatOptional minDimensionOptional = - YGResolveValue(node->getStyle().minDimensions()[dimension], ownerDim); + const FloatOptional minDimensionOptional = yoga::resolveValue( + node->getStyle().minDimensions()[dimension], ownerDim); const float minInnerDim = minDimensionOptional.isUndefined() ? 0.0f : minDimensionOptional.unwrap() - paddingAndBorder; - const YGFloatOptional maxDimensionOptional = - YGResolveValue(node->getStyle().maxDimensions()[dimension], ownerDim); + const FloatOptional maxDimensionOptional = yoga::resolveValue( + node->getStyle().maxDimensions()[dimension], ownerDim); const float maxInnerDim = maxDimensionOptional.isUndefined() ? FLT_MAX : maxDimensionOptional.unwrap() - paddingAndBorder; - availableInnerDim = - YGFloatMax(YGFloatMin(availableInnerDim, maxInnerDim), minInnerDim); + availableInnerDim = yoga::maxOrDefined( + yoga::minOrDefined(availableInnerDim, maxInnerDim), minInnerDim); } return availableInnerDim; } static float YGNodeComputeFlexBasisForChildren( - const YGNodeRef node, + yoga::Node* const node, const float availableInnerWidth, const float availableInnerHeight, YGMeasureMode widthMeasureMode, @@ -1878,9 +1903,9 @@ static float YGNodeComputeFlexBasisForChildren( const uint32_t generationCount) { float totalOuterFlexBasis = 0.0f; YGNodeRef singleFlexChild = nullptr; - const YGVector& children = node->getChildren(); + const auto& children = node->getChildren(); YGMeasureMode measureModeMainDim = - YGFlexDirectionIsRow(mainAxis) ? widthMeasureMode : heightMeasureMode; + isRow(mainAxis) ? widthMeasureMode : heightMeasureMode; // If there is only one child with flexGrow + flexShrink it means we can set // the computedFlexBasis to 0 instead of measuring and shrinking / flexing the // child to exactly match the remaining space @@ -1888,8 +1913,8 @@ static float YGNodeComputeFlexBasisForChildren( for (auto child : children) { if (child->isNodeFlexible()) { if (singleFlexChild != nullptr || - YGFloatsEqual(child->resolveFlexGrow(), 0.0f) || - YGFloatsEqual(child->resolveFlexShrink(), 0.0f)) { + yoga::inexactEquals(child->resolveFlexGrow(), 0.0f) || + yoga::inexactEquals(child->resolveFlexShrink(), 0.0f)) { // There is already a flexible child, or this flexible child doesn't // have flexGrow and flexShrink, abort singleFlexChild = nullptr; @@ -1912,12 +1937,10 @@ static float YGNodeComputeFlexBasisForChildren( if (performLayout) { // Set the initial position (relative to the owner). const YGDirection childDirection = child->resolveDirection(direction); - const float mainDim = YGFlexDirectionIsRow(mainAxis) - ? availableInnerWidth - : availableInnerHeight; - const float crossDim = YGFlexDirectionIsRow(mainAxis) - ? availableInnerHeight - : availableInnerWidth; + const float mainDim = + isRow(mainAxis) ? availableInnerWidth : availableInnerHeight; + const float crossDim = + isRow(mainAxis) ? availableInnerHeight : availableInnerWidth; child->setPosition( childDirection, mainDim, crossDim, availableInnerWidth); } @@ -1927,7 +1950,7 @@ static float YGNodeComputeFlexBasisForChildren( } if (child == singleFlexChild) { child->setLayoutComputedFlexBasisGeneration(generationCount); - child->setLayoutComputedFlexBasis(YGFloatOptional(0)); + child->setLayoutComputedFlexBasis(FloatOptional(0)); } else { YGNodeComputeFlexBasisForChild( node, @@ -1959,19 +1982,19 @@ static float YGNodeComputeFlexBasisForChildren( // computedFlexBasis properly computed(To do this use // YGNodeComputeFlexBasisForChildren function). This function calculates // YGCollectFlexItemsRowMeasurement -static YGCollectFlexItemsRowValues YGCalculateCollectFlexItemsRowValues( - const YGNodeRef& node, +static CollectFlexItemsRowValues YGCalculateCollectFlexItemsRowValues( + yoga::Node* const node, const YGDirection ownerDirection, const float mainAxisownerSize, const float availableInnerWidth, const float availableInnerMainDim, const uint32_t startOfLineIndex, const uint32_t lineCount) { - YGCollectFlexItemsRowValues flexAlgoRowMeasurement = {}; + CollectFlexItemsRowValues flexAlgoRowMeasurement = {}; flexAlgoRowMeasurement.relativeChildren.reserve(node->getChildren().size()); float sizeConsumedOnCurrentLineIncludingMinConstraint = 0; - const YGFlexDirection mainAxis = YGResolveFlexDirection( + const YGFlexDirection mainAxis = resolveDirection( node->getStyle().flexDirection(), node->resolveDirection(ownerDirection)); const bool isNodeFlexWrap = node->getStyle().flexWrap() != YGWrapNoWrap; const float gap = node->getGapForAxis(mainAxis, availableInnerWidth).unwrap(); @@ -1979,7 +2002,7 @@ static YGCollectFlexItemsRowValues YGCalculateCollectFlexItemsRowValues( // Add items to the current line until it's full or we run out of items. uint32_t endOfLineIndex = startOfLineIndex; for (; endOfLineIndex < node->getChildren().size(); endOfLineIndex++) { - const YGNodeRef child = node->getChild(endOfLineIndex); + auto child = node->getChild(endOfLineIndex); if (child->getStyle().display() == YGDisplayNone || child->getStyle().positionType() == YGPositionTypeAbsolute) { continue; @@ -2051,8 +2074,8 @@ static YGCollectFlexItemsRowValues YGCalculateCollectFlexItemsRowValues( // function the child nodes would have proper size. Prior using this function // please ensure that YGDistributeFreeSpaceFirstPass is called. static float YGDistributeFreeSpaceSecondPass( - YGCollectFlexItemsRowValues& collectedFlexItemsValues, - const YGNodeRef node, + CollectFlexItemsRowValues& collectedFlexItemsValues, + yoga::Node* const node, const YGFlexDirection mainAxis, const YGFlexDirection crossAxis, const float mainAxisownerSize, @@ -2072,7 +2095,7 @@ static float YGDistributeFreeSpaceSecondPass( float flexShrinkScaledFactor = 0; float flexGrowFactor = 0; float deltaFreeSpace = 0; - const bool isMainAxisRow = YGFlexDirectionIsRow(mainAxis); + const bool isMainAxisRow = isRow(mainAxis); const bool isNodeFlexWrap = node->getStyle().flexWrap() != YGWrapNoWrap; for (auto currentRelativeChild : collectedFlexItemsValues.relativeChildren) { @@ -2084,7 +2107,7 @@ static float YGDistributeFreeSpaceSecondPass( .unwrap(); float updatedMainSize = childFlexBasis; - if (!YGFloatIsUndefined(collectedFlexItemsValues.remainingFreeSpace) && + if (!yoga::isUndefined(collectedFlexItemsValues.remainingFreeSpace) && collectedFlexItemsValues.remainingFreeSpace < 0) { flexShrinkScaledFactor = -currentRelativeChild->resolveFlexShrink() * childFlexBasis; @@ -2092,7 +2115,7 @@ static float YGDistributeFreeSpaceSecondPass( if (flexShrinkScaledFactor != 0) { float childSize; - if (!YGFloatIsUndefined( + if (!yoga::isUndefined( collectedFlexItemsValues.totalFlexShrinkScaledFactors) && collectedFlexItemsValues.totalFlexShrinkScaledFactors == 0) { childSize = childFlexBasis + flexShrinkScaledFactor; @@ -2111,12 +2134,12 @@ static float YGDistributeFreeSpaceSecondPass( availableInnerWidth); } } else if ( - !YGFloatIsUndefined(collectedFlexItemsValues.remainingFreeSpace) && + !yoga::isUndefined(collectedFlexItemsValues.remainingFreeSpace) && collectedFlexItemsValues.remainingFreeSpace > 0) { flexGrowFactor = currentRelativeChild->resolveFlexGrow(); // Is this child able to grow? - if (!YGFloatIsUndefined(flexGrowFactor) && flexGrowFactor != 0) { + if (!yoga::isUndefined(flexGrowFactor) && flexGrowFactor != 0) { updatedMainSize = YGNodeBoundAxis( currentRelativeChild, mainAxis, @@ -2152,7 +2175,7 @@ static float YGDistributeFreeSpaceSecondPass( childCrossSize += marginCross; } else if ( - !YGFloatIsUndefined(availableInnerCrossDim) && + !yoga::isUndefined(availableInnerCrossDim) && !YGNodeIsStyleDimDefined( currentRelativeChild, crossAxis, availableInnerCrossDim) && measureModeCrossDim == YGMeasureModeExactly && @@ -2167,12 +2190,12 @@ static float YGDistributeFreeSpaceSecondPass( } else if (!YGNodeIsStyleDimDefined( currentRelativeChild, crossAxis, availableInnerCrossDim)) { childCrossSize = availableInnerCrossDim; - childCrossMeasureMode = YGFloatIsUndefined(childCrossSize) + childCrossMeasureMode = yoga::isUndefined(childCrossSize) ? YGMeasureModeUndefined : YGMeasureModeAtMost; } else { childCrossSize = - YGResolveValue( + yoga::resolveValue( currentRelativeChild->getResolvedDimension(dim[crossAxis]), availableInnerCrossDim) .unwrap() + @@ -2182,7 +2205,7 @@ static float YGDistributeFreeSpaceSecondPass( YGUnitPercent && measureModeCrossDim != YGMeasureModeExactly; childCrossMeasureMode = - YGFloatIsUndefined(childCrossSize) || isLoosePercentageMeasurement + yoga::isUndefined(childCrossSize) || isLoosePercentageMeasurement ? YGMeasureModeUndefined : YGMeasureModeExactly; } @@ -2249,7 +2272,7 @@ static float YGDistributeFreeSpaceSecondPass( // whose min and max constraints are triggered, those flex item's clamped size // is removed from the remaingfreespace. static void YGDistributeFreeSpaceFirstPass( - YGCollectFlexItemsRowValues& collectedFlexItemsValues, + CollectFlexItemsRowValues& collectedFlexItemsValues, const YGFlexDirection mainAxis, const float mainAxisownerSize, const float availableInnerMainDim, @@ -2274,7 +2297,7 @@ static void YGDistributeFreeSpaceFirstPass( -currentRelativeChild->resolveFlexShrink() * childFlexBasis; // Is this child able to shrink? - if (!YGFloatIsUndefined(flexShrinkScaledFactor) && + if (!yoga::isUndefined(flexShrinkScaledFactor) && flexShrinkScaledFactor != 0) { baseMainSize = childFlexBasis + collectedFlexItemsValues.remainingFreeSpace / @@ -2286,8 +2309,8 @@ static void YGDistributeFreeSpaceFirstPass( baseMainSize, availableInnerMainDim, availableInnerWidth); - if (!YGFloatIsUndefined(baseMainSize) && - !YGFloatIsUndefined(boundMainSize) && + if (!yoga::isUndefined(baseMainSize) && + !yoga::isUndefined(boundMainSize) && baseMainSize != boundMainSize) { // By excluding this item's size and flex factor from remaining, this // item's min/max constraints should also trigger in the second pass @@ -2300,12 +2323,12 @@ static void YGDistributeFreeSpaceFirstPass( } } } else if ( - !YGFloatIsUndefined(collectedFlexItemsValues.remainingFreeSpace) && + !yoga::isUndefined(collectedFlexItemsValues.remainingFreeSpace) && collectedFlexItemsValues.remainingFreeSpace > 0) { flexGrowFactor = currentRelativeChild->resolveFlexGrow(); // Is this child able to grow? - if (!YGFloatIsUndefined(flexGrowFactor) && flexGrowFactor != 0) { + if (!yoga::isUndefined(flexGrowFactor) && flexGrowFactor != 0) { baseMainSize = childFlexBasis + collectedFlexItemsValues.remainingFreeSpace / collectedFlexItemsValues.totalFlexGrowFactors * flexGrowFactor; @@ -2316,8 +2339,8 @@ static void YGDistributeFreeSpaceFirstPass( availableInnerMainDim, availableInnerWidth); - if (!YGFloatIsUndefined(baseMainSize) && - !YGFloatIsUndefined(boundMainSize) && + if (!yoga::isUndefined(baseMainSize) && + !yoga::isUndefined(boundMainSize) && baseMainSize != boundMainSize) { // By excluding this item's size and flex factor from remaining, this // item's min/max constraints should also trigger in the second pass @@ -2355,8 +2378,8 @@ static void YGDistributeFreeSpaceFirstPass( // assigned to them. // static void YGResolveFlexibleLength( - const YGNodeRef node, - YGCollectFlexItemsRowValues& collectedFlexItemsValues, + yoga::Node* const node, + CollectFlexItemsRowValues& collectedFlexItemsValues, const YGFlexDirection mainAxis, const YGFlexDirection crossAxis, const float mainAxisownerSize, @@ -2406,8 +2429,8 @@ static void YGResolveFlexibleLength( } static void YGJustifyMainAxis( - const YGNodeRef node, - YGCollectFlexItemsRowValues& collectedFlexItemsValues, + yoga::Node* const node, + CollectFlexItemsRowValues& collectedFlexItemsValues, const uint32_t startOfLineIndex, const YGFlexDirection mainAxis, const YGFlexDirection crossAxis, @@ -2431,7 +2454,8 @@ static void YGJustifyMainAxis( if (measureModeMainDim == YGMeasureModeAtMost && collectedFlexItemsValues.remainingFreeSpace > 0) { if (!style.minDimensions()[dim[mainAxis]].isUndefined() && - !YGResolveValue(style.minDimensions()[dim[mainAxis]], mainAxisownerSize) + !yoga::resolveValue( + style.minDimensions()[dim[mainAxis]], mainAxisownerSize) .isUndefined()) { // This condition makes sure that if the size of main dimension(after // considering child nodes main dim, leading and trailing padding etc) @@ -2441,14 +2465,14 @@ static void YGJustifyMainAxis( // `minAvailableMainDim` denotes minimum available space in which child // can be laid out, it will exclude space consumed by padding and border. const float minAvailableMainDim = - YGResolveValue( + yoga::resolveValue( style.minDimensions()[dim[mainAxis]], mainAxisownerSize) .unwrap() - leadingPaddingAndBorderMain - trailingPaddingAndBorderMain; const float occupiedSpaceByChildNodes = availableInnerMainDim - collectedFlexItemsValues.remainingFreeSpace; - collectedFlexItemsValues.remainingFreeSpace = - YGFloatMax(0, minAvailableMainDim - occupiedSpaceByChildNodes); + collectedFlexItemsValues.remainingFreeSpace = yoga::maxOrDefined( + 0, minAvailableMainDim - occupiedSpaceByChildNodes); } else { collectedFlexItemsValues.remainingFreeSpace = 0; } @@ -2458,7 +2482,7 @@ static void YGJustifyMainAxis( for (uint32_t i = startOfLineIndex; i < collectedFlexItemsValues.endOfLineIndex; i++) { - const YGNodeRef child = node->getChild(i); + auto child = node->getChild(i); if (child->getStyle().positionType() != YGPositionTypeAbsolute) { if (child->marginLeadingValue(mainAxis).unit == YGUnitAuto) { numberOfAutoMarginsOnCurrentLine++; @@ -2487,7 +2511,8 @@ static void YGJustifyMainAxis( case YGJustifySpaceBetween: if (collectedFlexItemsValues.itemsOnLine > 1) { betweenMainDim += - YGFloatMax(collectedFlexItemsValues.remainingFreeSpace, 0) / + yoga::maxOrDefined( + collectedFlexItemsValues.remainingFreeSpace, 0) / (collectedFlexItemsValues.itemsOnLine - 1); } break; @@ -2518,9 +2543,9 @@ static void YGJustifyMainAxis( for (uint32_t i = startOfLineIndex; i < collectedFlexItemsValues.endOfLineIndex; i++) { - const YGNodeRef child = node->getChild(i); - const YGStyle& childStyle = child->getStyle(); - const YGLayout childLayout = child->getLayout(); + const auto child = node->getChild(i); + const Style& childStyle = child->getStyle(); + const LayoutResults& childLayout = child->getLayout(); const bool isLastChild = i == collectedFlexItemsValues.endOfLineIndex - 1; // remove the gap if it is the last element of the line if (isLastChild) { @@ -2598,14 +2623,14 @@ static void YGJustifyMainAxis( ascent; maxAscentForCurrentLine = - YGFloatMax(maxAscentForCurrentLine, ascent); + yoga::maxOrDefined(maxAscentForCurrentLine, ascent); maxDescentForCurrentLine = - YGFloatMax(maxDescentForCurrentLine, descent); + yoga::maxOrDefined(maxDescentForCurrentLine, descent); } else { // The cross dimension is the max of the elements dimension since // there can only be one element in that cross dimension in the case // when the items are not baseline aligned - collectedFlexItemsValues.crossDim = YGFloatMax( + collectedFlexItemsValues.crossDim = yoga::maxOrDefined( collectedFlexItemsValues.crossDim, YGNodeDimWithMargin(child, crossAxis, availableInnerWidth)); } @@ -2692,7 +2717,7 @@ static void YGJustifyMainAxis( // mode of YGMeasureModeUndefined in that dimension. // static void YGNodelayoutImpl( - const YGNodeRef node, + yoga::Node* const node, const float availableWidth, const float availableHeight, const YGDirection ownerDirection, @@ -2707,16 +2732,16 @@ static void YGNodelayoutImpl( const uint32_t depth, const uint32_t generationCount, const LayoutPassReason reason) { - YGAssertWithNode( + yoga::assertFatalWithNode( node, - YGFloatIsUndefined(availableWidth) + yoga::isUndefined(availableWidth) ? widthMeasureMode == YGMeasureModeUndefined : true, "availableWidth is indefinite so widthMeasureMode must be " "YGMeasureModeUndefined"); - YGAssertWithNode( + yoga::assertFatalWithNode( node, - YGFloatIsUndefined(availableHeight) + yoga::isUndefined(availableHeight) ? heightMeasureMode == YGMeasureModeUndefined : true, "availableHeight is indefinite so heightMeasureMode must be " @@ -2729,9 +2754,9 @@ static void YGNodelayoutImpl( node->setLayoutDirection(direction); const YGFlexDirection flexRowDirection = - YGResolveFlexDirection(YGFlexDirectionRow, direction); + resolveDirection(YGFlexDirectionRow, direction); const YGFlexDirection flexColumnDirection = - YGResolveFlexDirection(YGFlexDirectionColumn, direction); + resolveDirection(YGFlexDirectionColumn, direction); const YGEdge startEdge = direction == YGDirectionLTR ? YGEdgeLeft : YGEdgeRight; @@ -2821,9 +2846,9 @@ static void YGNodelayoutImpl( // STEP 1: CALCULATE VALUES FOR REMAINDER OF ALGORITHM const YGFlexDirection mainAxis = - YGResolveFlexDirection(node->getStyle().flexDirection(), direction); - const YGFlexDirection crossAxis = YGFlexDirectionCross(mainAxis, direction); - const bool isMainAxisRow = YGFlexDirectionIsRow(mainAxis); + resolveDirection(node->getStyle().flexDirection(), direction); + const YGFlexDirection crossAxis = resolveCrossDirection(mainAxis, direction); + const bool isMainAxisRow = isRow(mainAxis); const bool isNodeFlexWrap = node->getStyle().flexWrap() != YGWrapNoWrap; const float mainAxisownerSize = isMainAxisRow ? ownerWidth : ownerHeight; @@ -2918,7 +2943,7 @@ static void YGNodelayoutImpl( // Max main dimension of all the lines. float maxLineMainDim = 0; - YGCollectFlexItemsRowValues collectedFlexItemsValues; + CollectFlexItemsRowValues collectedFlexItemsValues; for (; endOfLineIndex < childCount; lineCount++, startOfLineIndex = endOfLineIndex) { collectedFlexItemsValues = YGCalculateCollectFlexItemsRowValues( @@ -2948,17 +2973,19 @@ static void YGNodelayoutImpl( const auto& minDimensions = node->getStyle().minDimensions(); const auto& maxDimensions = node->getStyle().maxDimensions(); const float minInnerWidth = - YGResolveValue(minDimensions[YGDimensionWidth], ownerWidth).unwrap() - + yoga::resolveValue(minDimensions[YGDimensionWidth], ownerWidth) + .unwrap() - paddingAndBorderAxisRow; const float maxInnerWidth = - YGResolveValue(maxDimensions[YGDimensionWidth], ownerWidth).unwrap() - + yoga::resolveValue(maxDimensions[YGDimensionWidth], ownerWidth) + .unwrap() - paddingAndBorderAxisRow; const float minInnerHeight = - YGResolveValue(minDimensions[YGDimensionHeight], ownerHeight) + yoga::resolveValue(minDimensions[YGDimensionHeight], ownerHeight) .unwrap() - paddingAndBorderAxisColumn; const float maxInnerHeight = - YGResolveValue(maxDimensions[YGDimensionHeight], ownerHeight) + yoga::resolveValue(maxDimensions[YGDimensionHeight], ownerHeight) .unwrap() - paddingAndBorderAxisColumn; @@ -2967,12 +2994,12 @@ static void YGNodelayoutImpl( const float maxInnerMainDim = isMainAxisRow ? maxInnerWidth : maxInnerHeight; - if (!YGFloatIsUndefined(minInnerMainDim) && + if (!yoga::isUndefined(minInnerMainDim) && collectedFlexItemsValues.sizeConsumedOnCurrentLine < minInnerMainDim) { availableInnerMainDim = minInnerMainDim; } else if ( - !YGFloatIsUndefined(maxInnerMainDim) && + !yoga::isUndefined(maxInnerMainDim) && collectedFlexItemsValues.sizeConsumedOnCurrentLine > maxInnerMainDim) { availableInnerMainDim = maxInnerMainDim; @@ -2981,10 +3008,10 @@ static void YGNodelayoutImpl( node->hasErrata(YGErrataStretchFlexBasis); if (!useLegacyStretchBehaviour && - ((!YGFloatIsUndefined( + ((!yoga::isUndefined( collectedFlexItemsValues.totalFlexGrowFactors) && collectedFlexItemsValues.totalFlexGrowFactors == 0) || - (!YGFloatIsUndefined(node->resolveFlexGrow()) && + (!yoga::isUndefined(node->resolveFlexGrow()) && node->resolveFlexGrow() == 0))) { // If we don't have any children to flex or we can't flex the node // itself, space we've used is all space we need. Root node also @@ -2997,7 +3024,7 @@ static void YGNodelayoutImpl( } } - if (!sizeBasedOnContent && !YGFloatIsUndefined(availableInnerMainDim)) { + if (!sizeBasedOnContent && !yoga::isUndefined(availableInnerMainDim)) { collectedFlexItemsValues.remainingFreeSpace = availableInnerMainDim - collectedFlexItemsValues.sizeConsumedOnCurrentLine; } else if (collectedFlexItemsValues.sizeConsumedOnCurrentLine < 0) { @@ -3090,7 +3117,7 @@ static void YGNodelayoutImpl( // We can skip child alignment if we're just measuring the container. if (performLayout) { for (uint32_t i = startOfLineIndex; i < endOfLineIndex; i++) { - const YGNodeRef child = node->getChild(i); + const auto child = node->getChild(i); if (child->getStyle().display() == YGDisplayNone) { continue; } @@ -3112,7 +3139,7 @@ static void YGNodelayoutImpl( // If leading position is not defined or calculations result in Nan, // default to border + margin if (!isChildLeadingPosDefined || - YGFloatIsUndefined(child->getLayout().position[pos[crossAxis]])) { + yoga::isUndefined(child->getLayout().position[pos[crossAxis]])) { child->setLayoutPosition( node->getLeadingBorder(crossAxis) + child->getLeadingMargin(crossAxis, availableInnerWidth) @@ -3178,12 +3205,12 @@ static void YGNodelayoutImpl( auto crossAxisDoesNotGrow = alignContent != YGAlignStretch && isNodeFlexWrap; const YGMeasureMode childWidthMeasureMode = - YGFloatIsUndefined(childWidth) || + yoga::isUndefined(childWidth) || (!isMainAxisRow && crossAxisDoesNotGrow) ? YGMeasureModeUndefined : YGMeasureModeExactly; const YGMeasureMode childHeightMeasureMode = - YGFloatIsUndefined(childHeight) || + yoga::isUndefined(childHeight) || (isMainAxisRow && crossAxisDoesNotGrow) ? YGMeasureModeUndefined : YGMeasureModeExactly; @@ -3211,13 +3238,14 @@ static void YGNodelayoutImpl( if (child->marginLeadingValue(crossAxis).unit == YGUnitAuto && child->marginTrailingValue(crossAxis).unit == YGUnitAuto) { - leadingCrossDim += YGFloatMax(0.0f, remainingCrossDim / 2); + leadingCrossDim += + yoga::maxOrDefined(0.0f, remainingCrossDim / 2); } else if ( child->marginTrailingValue(crossAxis).unit == YGUnitAuto) { // No-Op } else if ( child->marginLeadingValue(crossAxis).unit == YGUnitAuto) { - leadingCrossDim += YGFloatMax(0.0f, remainingCrossDim); + leadingCrossDim += yoga::maxOrDefined(0.0f, remainingCrossDim); } else if (alignItem == YGAlignFlexStart) { // No-Op } else if (alignItem == YGAlignCenter) { @@ -3238,7 +3266,7 @@ static void YGNodelayoutImpl( const float appliedCrossGap = lineCount != 0 ? crossAxisGap : 0.0f; totalLineCrossDim += collectedFlexItemsValues.crossDim + appliedCrossGap; maxLineMainDim = - YGFloatMax(maxLineMainDim, collectedFlexItemsValues.mainDim); + yoga::maxOrDefined(maxLineMainDim, collectedFlexItemsValues.mainDim); } // STEP 8: MULTI-LINE CONTENT ALIGNMENT @@ -3246,7 +3274,7 @@ static void YGNodelayoutImpl( if (performLayout && (isNodeFlexWrap || YGIsBaselineLayout(node))) { float crossDimLead = 0; float currentLead = leadingPaddingAndBorderCross; - if (!YGFloatIsUndefined(availableInnerCrossDim)) { + if (!yoga::isUndefined(availableInnerCrossDim)) { const float remainingAlignContentDim = availableInnerCrossDim - totalLineCrossDim; switch (node->getStyle().alignContent()) { @@ -3292,7 +3320,7 @@ static void YGNodelayoutImpl( float maxAscentForCurrentLine = 0; float maxDescentForCurrentLine = 0; for (ii = startIndex; ii < childCount; ii++) { - const YGNodeRef child = node->getChild(ii); + const auto child = node->getChild(ii); if (child->getStyle().display() == YGDisplayNone) { continue; } @@ -3301,7 +3329,7 @@ static void YGNodelayoutImpl( break; } if (YGNodeIsLayoutDimDefined(child, crossAxis)) { - lineHeight = YGFloatMax( + lineHeight = yoga::maxOrDefined( lineHeight, child->getLayout().measuredDimensions[dim[crossAxis]] + child->getMarginForAxis(crossAxis, availableInnerWidth) @@ -3321,10 +3349,10 @@ static void YGNodelayoutImpl( .unwrap() - ascent; maxAscentForCurrentLine = - YGFloatMax(maxAscentForCurrentLine, ascent); + yoga::maxOrDefined(maxAscentForCurrentLine, ascent); maxDescentForCurrentLine = - YGFloatMax(maxDescentForCurrentLine, descent); - lineHeight = YGFloatMax( + yoga::maxOrDefined(maxDescentForCurrentLine, descent); + lineHeight = yoga::maxOrDefined( lineHeight, maxAscentForCurrentLine + maxDescentForCurrentLine); } } @@ -3335,7 +3363,7 @@ static void YGNodelayoutImpl( if (performLayout) { for (ii = startIndex; ii < endIndex; ii++) { - const YGNodeRef child = node->getChild(ii); + const auto child = node->getChild(ii); if (child->getStyle().display() == YGDisplayNone) { continue; } @@ -3392,11 +3420,11 @@ static void YGNodelayoutImpl( .unwrap()) : lineHeight; - if (!(YGFloatsEqual( + if (!(yoga::inexactEquals( childWidth, child->getLayout() .measuredDimensions[YGDimensionWidth]) && - YGFloatsEqual( + yoga::inexactEquals( childHeight, child->getLayout() .measuredDimensions[YGDimensionHeight]))) { @@ -3480,13 +3508,13 @@ static void YGNodelayoutImpl( measureModeMainDim == YGMeasureModeAtMost && node->getStyle().overflow() == YGOverflowScroll) { node->setLayoutMeasuredDimension( - YGFloatMax( - YGFloatMin( + yoga::maxOrDefined( + yoga::minOrDefined( availableInnerMainDim + paddingAndBorderAxisMain, YGNodeBoundAxisWithinMinAndMax( node, mainAxis, - YGFloatOptional{maxLineMainDim}, + FloatOptional{maxLineMainDim}, mainAxisownerSize) .unwrap()), paddingAndBorderAxisMain), @@ -3511,13 +3539,13 @@ static void YGNodelayoutImpl( measureModeCrossDim == YGMeasureModeAtMost && node->getStyle().overflow() == YGOverflowScroll) { node->setLayoutMeasuredDimension( - YGFloatMax( - YGFloatMin( + yoga::maxOrDefined( + yoga::minOrDefined( availableInnerCrossDim + paddingAndBorderAxisCross, YGNodeBoundAxisWithinMinAndMax( node, crossAxis, - YGFloatOptional{ + FloatOptional{ totalLineCrossDim + paddingAndBorderAxisCross}, crossAxisownerSize) .unwrap()), @@ -3529,7 +3557,7 @@ static void YGNodelayoutImpl( // positions on wrap-reverse. if (performLayout && node->getStyle().flexWrap() == YGWrapWrapReverse) { for (uint32_t i = 0; i < childCount; i++) { - const YGNodeRef child = YGNodeGetChild(node, i); + const auto child = node->getChild(i); if (child->getStyle().positionType() != YGPositionTypeAbsolute) { child->setLayoutPosition( node->getLayout().measuredDimensions[dim[crossAxis]] - @@ -3578,7 +3606,7 @@ static void YGNodelayoutImpl( // Set trailing position if necessary. if (needsMainTrailingPos || needsCrossTrailingPos) { for (uint32_t i = 0; i < childCount; i++) { - const YGNodeRef child = node->getChild(i); + const auto child = node->getChild(i); if (child->getStyle().display() == YGDisplayNone) { continue; } @@ -3629,7 +3657,7 @@ static inline bool YGMeasureModeSizeIsExactAndMatchesOldMeasuredSize( float size, float lastComputedSize) { return sizeMode == YGMeasureModeExactly && - YGFloatsEqual(size, lastComputedSize); + yoga::inexactEquals(size, lastComputedSize); } static inline bool YGMeasureModeOldSizeIsUnspecifiedAndStillFits( @@ -3639,7 +3667,7 @@ static inline bool YGMeasureModeOldSizeIsUnspecifiedAndStillFits( float lastComputedSize) { return sizeMode == YGMeasureModeAtMost && lastSizeMode == YGMeasureModeUndefined && - (size >= lastComputedSize || YGFloatsEqual(size, lastComputedSize)); + (size >= lastComputedSize || yoga::inexactEquals(size, lastComputedSize)); } static inline bool YGMeasureModeNewMeasureSizeIsStricterAndStillValid( @@ -3649,10 +3677,10 @@ static inline bool YGMeasureModeNewMeasureSizeIsStricterAndStillValid( float lastSize, float lastComputedSize) { return lastSizeMode == YGMeasureModeAtMost && - sizeMode == YGMeasureModeAtMost && !YGFloatIsUndefined(lastSize) && - !YGFloatIsUndefined(size) && !YGFloatIsUndefined(lastComputedSize) && + sizeMode == YGMeasureModeAtMost && !yoga::isUndefined(lastSize) && + !yoga::isUndefined(size) && !yoga::isUndefined(lastComputedSize) && lastSize > size && - (lastComputedSize <= size || YGFloatsEqual(size, lastComputedSize)); + (lastComputedSize <= size || yoga::inexactEquals(size, lastComputedSize)); } YOGA_EXPORT float YGRoundValueToPixelGrid( @@ -3682,10 +3710,10 @@ YOGA_EXPORT float YGRoundValueToPixelGrid( // - Finding the `floor`: -2.2 - fractial2 = -2.2 - 0.8 = -3 ++fractial; } - if (YGDoubleEqual(fractial, 0)) { + if (yoga::inexactEquals(fractial, 0)) { // First we check if the value is already rounded scaledValue = scaledValue - fractial; - } else if (YGDoubleEqual(fractial, 1.0)) { + } else if (yoga::inexactEquals(fractial, 1.0)) { scaledValue = scaledValue - fractial + 1.0; } else if (forceCeil) { // Next we check if we need to use forced rounding @@ -3695,13 +3723,12 @@ YOGA_EXPORT float YGRoundValueToPixelGrid( } else { // Finally we just round the value scaledValue = scaledValue - fractial + - (!YGDoubleIsUndefined(fractial) && - (fractial > 0.5 || YGDoubleEqual(fractial, 0.5)) + (!yoga::isUndefined(fractial) && + (fractial > 0.5 || yoga::inexactEquals(fractial, 0.5)) ? 1.0 : 0.0); } - return (YGDoubleIsUndefined(scaledValue) || - YGDoubleIsUndefined(pointScaleFactor)) + return (yoga::isUndefined(scaledValue) || yoga::isUndefined(pointScaleFactor)) ? YGUndefined : (float) (scaledValue / pointScaleFactor); } @@ -3720,33 +3747,33 @@ YOGA_EXPORT bool YGNodeCanUseCachedMeasurement( const float marginRow, const float marginColumn, const YGConfigRef config) { - if ((!YGFloatIsUndefined(lastComputedHeight) && lastComputedHeight < 0) || - (!YGFloatIsUndefined(lastComputedWidth) && lastComputedWidth < 0)) { + if ((!yoga::isUndefined(lastComputedHeight) && lastComputedHeight < 0) || + (!yoga::isUndefined(lastComputedWidth) && lastComputedWidth < 0)) { return false; } bool useRoundedComparison = - config != nullptr && config->getPointScaleFactor() != 0; + config != nullptr && YGConfigGetPointScaleFactor(config) != 0; const float effectiveWidth = useRoundedComparison ? YGRoundValueToPixelGrid( - width, config->getPointScaleFactor(), false, false) + width, YGConfigGetPointScaleFactor(config), false, false) : width; const float effectiveHeight = useRoundedComparison ? YGRoundValueToPixelGrid( - height, config->getPointScaleFactor(), false, false) + height, YGConfigGetPointScaleFactor(config), false, false) : height; const float effectiveLastWidth = useRoundedComparison ? YGRoundValueToPixelGrid( - lastWidth, config->getPointScaleFactor(), false, false) + lastWidth, YGConfigGetPointScaleFactor(config), false, false) : lastWidth; const float effectiveLastHeight = useRoundedComparison ? YGRoundValueToPixelGrid( - lastHeight, config->getPointScaleFactor(), false, false) + lastHeight, YGConfigGetPointScaleFactor(config), false, false) : lastHeight; const bool hasSameWidthSpec = lastWidthMode == widthMode && - YGFloatsEqual(effectiveLastWidth, effectiveWidth); + yoga::inexactEquals(effectiveLastWidth, effectiveWidth); const bool hasSameHeightSpec = lastHeightMode == heightMode && - YGFloatsEqual(effectiveLastHeight, effectiveHeight); + yoga::inexactEquals(effectiveLastHeight, effectiveHeight); const bool widthIsCompatible = hasSameWidthSpec || @@ -3789,7 +3816,7 @@ YOGA_EXPORT bool YGNodeCanUseCachedMeasurement( // Return parameter is true if layout was performed, false if skipped // bool YGLayoutNodeInternal( - const YGNodeRef node, + yoga::Node* const node, const float availableWidth, const float availableHeight, const YGDirection ownerDirection, @@ -3804,7 +3831,7 @@ bool YGLayoutNodeInternal( void* const layoutContext, uint32_t depth, const uint32_t generationCount) { - YGLayout* layout = &node->getLayout(); + LayoutResults* layout = &node->getLayout(); depth++; @@ -3823,7 +3850,7 @@ bool YGLayoutNodeInternal( layout->cachedLayout.computedHeight = -1; } - YGCachedMeasurement* cachedResults = nullptr; + CachedMeasurement* cachedResults = nullptr; // Determine whether the results are already cached. We maintain a separate // cache for layouts and measurements. A layout operation modifies the @@ -3878,17 +3905,19 @@ bool YGLayoutNodeInternal( } } } else if (performLayout) { - if (YGFloatsEqual(layout->cachedLayout.availableWidth, availableWidth) && - YGFloatsEqual(layout->cachedLayout.availableHeight, availableHeight) && + if (yoga::inexactEquals( + layout->cachedLayout.availableWidth, availableWidth) && + yoga::inexactEquals( + layout->cachedLayout.availableHeight, availableHeight) && layout->cachedLayout.widthMeasureMode == widthMeasureMode && layout->cachedLayout.heightMeasureMode == heightMeasureMode) { cachedResults = &layout->cachedLayout; } } else { for (uint32_t i = 0; i < layout->nextCachedMeasurementsIndex; i++) { - if (YGFloatsEqual( + if (yoga::inexactEquals( layout->cachedMeasurements[i].availableWidth, availableWidth) && - YGFloatsEqual( + yoga::inexactEquals( layout->cachedMeasurements[i].availableHeight, availableHeight) && layout->cachedMeasurements[i].widthMeasureMode == widthMeasureMode && layout->cachedMeasurements[i].heightMeasureMode == @@ -3908,7 +3937,7 @@ bool YGLayoutNodeInternal( : layoutMarkerData.cachedMeasures) += 1; if (gPrintChanges && gPrintSkips) { - Log::log( + yoga::log( node, YGLogLevelVerbose, nullptr, @@ -3916,7 +3945,7 @@ bool YGLayoutNodeInternal( YGSpacer(depth), depth); node->print(layoutContext); - Log::log( + yoga::log( node, YGLogLevelVerbose, nullptr, @@ -3931,7 +3960,7 @@ bool YGLayoutNodeInternal( } } else { if (gPrintChanges) { - Log::log( + yoga::log( node, YGLogLevelVerbose, nullptr, @@ -3940,7 +3969,7 @@ bool YGLayoutNodeInternal( depth, needToVisitNode ? "*" : ""); node->print(layoutContext); - Log::log( + yoga::log( node, YGLogLevelVerbose, nullptr, @@ -3970,7 +3999,7 @@ bool YGLayoutNodeInternal( reason); if (gPrintChanges) { - Log::log( + yoga::log( node, YGLogLevelVerbose, nullptr, @@ -3979,7 +4008,7 @@ bool YGLayoutNodeInternal( depth, needToVisitNode ? "*" : ""); node->print(layoutContext); - Log::log( + yoga::log( node, YGLogLevelVerbose, nullptr, @@ -3999,14 +4028,16 @@ bool YGLayoutNodeInternal( layoutMarkerData.maxMeasureCache = layout->nextCachedMeasurementsIndex + 1; } - if (layout->nextCachedMeasurementsIndex == YG_MAX_CACHED_RESULT_COUNT) { + if (layout->nextCachedMeasurementsIndex == + LayoutResults::MaxCachedMeasurements) { if (gPrintChanges) { - Log::log(node, YGLogLevelVerbose, nullptr, "Out of cache entries!\n"); + yoga::log( + node, YGLogLevelVerbose, nullptr, "Out of cache entries!\n"); } layout->nextCachedMeasurementsIndex = 0; } - YGCachedMeasurement* newCacheEntry; + CachedMeasurement* newCacheEntry; if (performLayout) { // Use the single layout cache entry. newCacheEntry = &layout->cachedLayout; @@ -4059,7 +4090,7 @@ bool YGLayoutNodeInternal( YOGA_EXPORT void YGConfigSetPointScaleFactor( const YGConfigRef config, const float pixelsInPoint) { - YGAssertWithConfig( + yoga::assertFatalWithConfig( config, pixelsInPoint >= 0.0f, "Scale factor should not be less than zero"); @@ -4067,18 +4098,18 @@ YOGA_EXPORT void YGConfigSetPointScaleFactor( // We store points for Pixel as we will use it for rounding if (pixelsInPoint == 0.0f) { // Zero is used to skip rounding - config->setPointScaleFactor(0.0f); + static_cast(config)->setPointScaleFactor(0.0f); } else { - config->setPointScaleFactor(pixelsInPoint); + static_cast(config)->setPointScaleFactor(pixelsInPoint); } } YOGA_EXPORT float YGConfigGetPointScaleFactor(const YGConfigRef config) { - return config->getPointScaleFactor(); + return static_cast(config)->getPointScaleFactor(); } static void YGRoundToPixelGrid( - const YGNodeRef node, + yoga::Node* const node, const double pointScaleFactor, const double absoluteLeft, const double absoluteTop) { @@ -4114,11 +4145,11 @@ static void YGRoundToPixelGrid( // whole number, we don't have any fraction To verify if the result is close // to whole number we want to check both floor and ceil numbers const bool hasFractionalWidth = - !YGDoubleEqual(fmod(nodeWidth * pointScaleFactor, 1.0), 0) && - !YGDoubleEqual(fmod(nodeWidth * pointScaleFactor, 1.0), 1.0); + !yoga::inexactEquals(fmod(nodeWidth * pointScaleFactor, 1.0), 0) && + !yoga::inexactEquals(fmod(nodeWidth * pointScaleFactor, 1.0), 1.0); const bool hasFractionalHeight = - !YGDoubleEqual(fmod(nodeHeight * pointScaleFactor, 1.0), 0) && - !YGDoubleEqual(fmod(nodeHeight * pointScaleFactor, 1.0), 1.0); + !yoga::inexactEquals(fmod(nodeHeight * pointScaleFactor, 1.0), 0) && + !yoga::inexactEquals(fmod(nodeHeight * pointScaleFactor, 1.0), 1.0); node->setLayoutDimension( YGRoundValueToPixelGrid( @@ -4143,23 +4174,21 @@ static void YGRoundToPixelGrid( const uint32_t childCount = YGNodeGetChildCount(node); for (uint32_t i = 0; i < childCount; i++) { YGRoundToPixelGrid( - YGNodeGetChild(node, i), - pointScaleFactor, - absoluteNodeLeft, - absoluteNodeTop); + node->getChild(i), pointScaleFactor, absoluteNodeLeft, absoluteNodeTop); } } YOGA_EXPORT void YGNodeCalculateLayoutWithContext( - const YGNodeRef node, + const YGNodeRef nodeRef, const float ownerWidth, const float ownerHeight, const YGDirection ownerDirection, void* layoutContext) { - - Event::publish(node, {layoutContext}); + Event::publish(nodeRef, {layoutContext}); LayoutData markerData = {}; + const auto node = static_cast(nodeRef); + // Increment the generation count. This will force the recursive routine to // visit all dirty nodes at least once. Subsequent visits will be skipped if // the input parameters don't change. @@ -4170,40 +4199,40 @@ YOGA_EXPORT void YGNodeCalculateLayoutWithContext( const auto& maxDimensions = node->getStyle().maxDimensions(); if (YGNodeIsStyleDimDefined(node, YGFlexDirectionRow, ownerWidth)) { width = - (YGResolveValue( + (yoga::resolveValue( node->getResolvedDimension(dim[YGFlexDirectionRow]), ownerWidth) + node->getMarginForAxis(YGFlexDirectionRow, ownerWidth)) .unwrap(); widthMeasureMode = YGMeasureModeExactly; - } else if (!YGResolveValue(maxDimensions[YGDimensionWidth], ownerWidth) + } else if (!yoga::resolveValue(maxDimensions[YGDimensionWidth], ownerWidth) .isUndefined()) { - width = - YGResolveValue(maxDimensions[YGDimensionWidth], ownerWidth).unwrap(); + width = yoga::resolveValue(maxDimensions[YGDimensionWidth], ownerWidth) + .unwrap(); widthMeasureMode = YGMeasureModeAtMost; } else { width = ownerWidth; - widthMeasureMode = YGFloatIsUndefined(width) ? YGMeasureModeUndefined - : YGMeasureModeExactly; + widthMeasureMode = yoga::isUndefined(width) ? YGMeasureModeUndefined + : YGMeasureModeExactly; } float height = YGUndefined; YGMeasureMode heightMeasureMode = YGMeasureModeUndefined; if (YGNodeIsStyleDimDefined(node, YGFlexDirectionColumn, ownerHeight)) { - height = (YGResolveValue( + height = (yoga::resolveValue( node->getResolvedDimension(dim[YGFlexDirectionColumn]), ownerHeight) + node->getMarginForAxis(YGFlexDirectionColumn, ownerWidth)) .unwrap(); heightMeasureMode = YGMeasureModeExactly; - } else if (!YGResolveValue(maxDimensions[YGDimensionHeight], ownerHeight) + } else if (!yoga::resolveValue(maxDimensions[YGDimensionHeight], ownerHeight) .isUndefined()) { - height = - YGResolveValue(maxDimensions[YGDimensionHeight], ownerHeight).unwrap(); + height = yoga::resolveValue(maxDimensions[YGDimensionHeight], ownerHeight) + .unwrap(); heightMeasureMode = YGMeasureModeAtMost; } else { height = ownerHeight; - heightMeasureMode = YGFloatIsUndefined(height) ? YGMeasureModeUndefined - : YGMeasureModeExactly; + heightMeasureMode = yoga::isUndefined(height) ? YGMeasureModeUndefined + : YGMeasureModeExactly; } if (YGLayoutNodeInternal( node, @@ -4249,99 +4278,75 @@ YOGA_EXPORT void YGNodeCalculateLayout( YOGA_EXPORT void YGConfigSetLogger(const YGConfigRef config, YGLogger logger) { if (logger != nullptr) { - config->setLogger(logger); + static_cast(config)->setLogger(logger); } else { #ifdef ANDROID - config->setLogger(&YGAndroidLog); + static_cast(config)->setLogger(&YGAndroidLog); #else - config->setLogger(&YGDefaultLog); + static_cast(config)->setLogger(&YGDefaultLog); #endif } } -void YGAssert(const bool condition, const char* message) { - if (!condition) { - Log::log(YGNodeRef{nullptr}, YGLogLevelFatal, nullptr, "%s\n", message); - throwLogicalErrorWithMessage(message); - } -} - -void YGAssertWithNode( - const YGNodeRef node, - const bool condition, - const char* message) { - if (!condition) { - Log::log(node, YGLogLevelFatal, nullptr, "%s\n", message); - throwLogicalErrorWithMessage(message); - } -} - -void YGAssertWithConfig( - const YGConfigRef config, - const bool condition, - const char* message) { - if (!condition) { - Log::log(config, YGLogLevelFatal, nullptr, "%s\n", message); - throwLogicalErrorWithMessage(message); - } -} - YOGA_EXPORT void YGConfigSetExperimentalFeatureEnabled( const YGConfigRef config, const YGExperimentalFeature feature, const bool enabled) { - config->setExperimentalFeatureEnabled(feature, enabled); + static_cast(config)->setExperimentalFeatureEnabled( + feature, enabled); } YOGA_EXPORT bool YGConfigIsExperimentalFeatureEnabled( const YGConfigRef config, const YGExperimentalFeature feature) { - return config->isExperimentalFeatureEnabled(feature); + return static_cast(config)->isExperimentalFeatureEnabled( + feature); } YOGA_EXPORT void YGConfigSetUseWebDefaults( const YGConfigRef config, const bool enabled) { - config->setUseWebDefaults(enabled); + static_cast(config)->setUseWebDefaults(enabled); } YOGA_EXPORT bool YGConfigGetUseLegacyStretchBehaviour( const YGConfigRef config) { - return config->hasErrata(YGErrataStretchFlexBasis); + return static_cast(config)->hasErrata( + YGErrataStretchFlexBasis); } YOGA_EXPORT void YGConfigSetUseLegacyStretchBehaviour( const YGConfigRef config, const bool useLegacyStretchBehaviour) { if (useLegacyStretchBehaviour) { - config->addErrata(YGErrataStretchFlexBasis); + static_cast(config)->addErrata(YGErrataStretchFlexBasis); } else { - config->removeErrata(YGErrataStretchFlexBasis); + static_cast(config)->removeErrata(YGErrataStretchFlexBasis); } } bool YGConfigGetUseWebDefaults(const YGConfigRef config) { - return config->useWebDefaults(); + return static_cast(config)->useWebDefaults(); } YOGA_EXPORT void YGConfigSetContext(const YGConfigRef config, void* context) { - config->setContext(context); + static_cast(config)->setContext(context); } YOGA_EXPORT void* YGConfigGetContext(const YGConfigRef config) { - return config->getContext(); + return static_cast(config)->getContext(); } YOGA_EXPORT void YGConfigSetErrata(YGConfigRef config, YGErrata errata) { - config->setErrata(errata); + static_cast(config)->setErrata(errata); } YOGA_EXPORT YGErrata YGConfigGetErrata(YGConfigRef config) { - return config->getErrata(); + return static_cast(config)->getErrata(); } YOGA_EXPORT void YGConfigSetCloneNodeFunc( const YGConfigRef config, const YGCloneNodeFunc callback) { - config->setCloneNodeCallback(callback); + static_cast(config)->setCloneNodeCallback(callback); } diff --git a/yoga/Yoga.h b/yoga/Yoga.h index de07aeac8b..8f797f887b 100644 --- a/yoga/Yoga.h +++ b/yoga/Yoga.h @@ -7,16 +7,9 @@ #pragma once -#include -#include #include -#include -#include -#include - -#ifndef __cplusplus #include -#endif +#include #include #include @@ -79,7 +72,7 @@ WIN_EXPORT void YGNodeRemoveAllChildren(YGNodeRef node); WIN_EXPORT YGNodeRef YGNodeGetChild(YGNodeRef node, uint32_t index); WIN_EXPORT YGNodeRef YGNodeGetOwner(YGNodeRef node); WIN_EXPORT YGNodeRef YGNodeGetParent(YGNodeRef node); -WIN_EXPORT uint32_t YGNodeGetChildCount(YGNodeRef node); +WIN_EXPORT uint32_t YGNodeGetChildCount(YGNodeConstRef node); WIN_EXPORT void YGNodeSetChildren( YGNodeRef owner, const YGNodeRef* children, @@ -303,15 +296,6 @@ WIN_EXPORT float YGNodeLayoutGetBorder(YGNodeRef node, YGEdge edge); WIN_EXPORT float YGNodeLayoutGetPadding(YGNodeRef node, YGEdge edge); WIN_EXPORT void YGConfigSetLogger(YGConfigRef config, YGLogger logger); -WIN_EXPORT void YGAssert(bool condition, const char* message); -WIN_EXPORT void YGAssertWithNode( - YGNodeRef node, - bool condition, - const char* message); -WIN_EXPORT void YGAssertWithConfig( - YGConfigRef config, - bool condition, - const char* message); // Set this to number of pixels in 1 point to round calculation results If you // want to avoid rounding - set PointScaleFactor to 0 WIN_EXPORT void YGConfigSetPointScaleFactor( @@ -343,7 +327,6 @@ void YGConfigSetUseLegacyStretchBehaviour( // YGConfig WIN_EXPORT YGConfigRef YGConfigNew(void); WIN_EXPORT void YGConfigFree(YGConfigRef config); -WIN_EXPORT void YGConfigCopy(YGConfigRef dest, YGConfigRef src); WIN_EXPORT int32_t YGConfigGetInstanceCount(void); WIN_EXPORT void YGConfigSetExperimentalFeatureEnabled( diff --git a/yoga/algorithm/CollectFlexItemsRowValues.h b/yoga/algorithm/CollectFlexItemsRowValues.h new file mode 100644 index 0000000000..58a3916ac3 --- /dev/null +++ b/yoga/algorithm/CollectFlexItemsRowValues.h @@ -0,0 +1,58 @@ +/* + * 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. + */ + +#pragma once + +#include +#include + +namespace facebook::yoga { + +// This struct is an helper model to hold the data for step 4 of flexbox algo, +// which is collecting the flex items in a line. +// +// - itemsOnLine: Number of items which can fit in a line considering the +// available Inner dimension, the flex items computed flexbasis and their +// margin. It may be different than the difference between start and end +// indicates because we skip over absolute-positioned items. +// +// - sizeConsumedOnCurrentLine: It is accumulation of the dimensions and margin +// of all the children on the current line. This will be used in order to +// either set the dimensions of the node if none already exist or to compute +// the remaining space left for the flexible children. +// +// - totalFlexGrowFactors: total flex grow factors of flex items which are to be +// laid in the current line +// +// - totalFlexShrinkFactors: total flex shrink factors of flex items which are +// to be laid in the current line +// +// - endOfLineIndex: Its the end index of the last flex item which was examined +// and it may or may not be part of the current line(as it may be absolutely +// positioned or including it may have caused to overshoot availableInnerDim) +// +// - relativeChildren: Maintain a vector of the child nodes that can shrink +// and/or grow. + +struct CollectFlexItemsRowValues { + uint32_t itemsOnLine; + float sizeConsumedOnCurrentLine; + float totalFlexGrowFactors; + float totalFlexShrinkScaledFactors; + uint32_t endOfLineIndex; + std::vector relativeChildren; + float remainingFreeSpace; + // The size of the mainDim for the row after considering size, padding, margin + // and border of flex items. This is used to calculate maxLineDim after going + // through all the rows to decide on the main axis size of owner. + float mainDim; + // The size of the crossDim for the row after considering size, padding, + // margin and border of flex items. Used for calculating containers crossSize. + float crossDim; +}; + +} // namespace facebook::yoga diff --git a/yoga/algorithm/FlexDirection.h b/yoga/algorithm/FlexDirection.h new file mode 100644 index 0000000000..b6e01190d7 --- /dev/null +++ b/yoga/algorithm/FlexDirection.h @@ -0,0 +1,78 @@ +/* + * 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. + */ + +#pragma once + +#include + +#include + +namespace facebook::yoga { + +inline bool isRow(const YGFlexDirection flexDirection) { + return flexDirection == YGFlexDirectionRow || + flexDirection == YGFlexDirectionRowReverse; +} + +inline bool isColumn(const YGFlexDirection flexDirection) { + return flexDirection == YGFlexDirectionColumn || + flexDirection == YGFlexDirectionColumnReverse; +} + +inline YGFlexDirection resolveDirection( + const YGFlexDirection flexDirection, + const YGDirection direction) { + if (direction == YGDirectionRTL) { + if (flexDirection == YGFlexDirectionRow) { + return YGFlexDirectionRowReverse; + } else if (flexDirection == YGFlexDirectionRowReverse) { + return YGFlexDirectionRow; + } + } + + return flexDirection; +} + +inline YGFlexDirection resolveCrossDirection( + const YGFlexDirection flexDirection, + const YGDirection direction) { + return isColumn(flexDirection) + ? resolveDirection(YGFlexDirectionRow, direction) + : YGFlexDirectionColumn; +} + +inline YGEdge leadingEdge(const YGFlexDirection flexDirection) { + switch (flexDirection) { + case YGFlexDirectionColumn: + return YGEdgeTop; + case YGFlexDirectionColumnReverse: + return YGEdgeBottom; + case YGFlexDirectionRow: + return YGEdgeLeft; + case YGFlexDirectionRowReverse: + return YGEdgeRight; + } + + fatalWithMessage("Invalid YGFlexDirection"); +} + +inline YGEdge trailingEdge(const YGFlexDirection flexDirection) { + switch (flexDirection) { + case YGFlexDirectionColumn: + return YGEdgeBottom; + case YGFlexDirectionColumnReverse: + return YGEdgeTop; + case YGFlexDirectionRow: + return YGEdgeRight; + case YGFlexDirectionRowReverse: + return YGEdgeLeft; + } + + fatalWithMessage("Invalid YGFlexDirection"); +} + +} // namespace facebook::yoga diff --git a/yoga/algorithm/ResolveValue.h b/yoga/algorithm/ResolveValue.h new file mode 100644 index 0000000000..af04025d4c --- /dev/null +++ b/yoga/algorithm/ResolveValue.h @@ -0,0 +1,32 @@ +/* + * 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. + */ + +#pragma once + +#include + +#include +#include + +namespace facebook::yoga { + +inline FloatOptional resolveValue(const YGValue value, const float ownerSize) { + switch (value.unit) { + case YGUnitPoint: + return FloatOptional{value.value}; + case YGUnitPercent: + return FloatOptional{value.value * ownerSize * 0.01f}; + default: + return FloatOptional{}; + } +} + +inline FloatOptional resolveValue(CompactValue value, float ownerSize) { + return resolveValue((YGValue) value, ownerSize); +} + +} // namespace facebook::yoga diff --git a/yoga/bits/EnumBitset.h b/yoga/bits/EnumBitset.h new file mode 100644 index 0000000000..3dff663f8f --- /dev/null +++ b/yoga/bits/EnumBitset.h @@ -0,0 +1,19 @@ +/* + * 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. + */ + +#pragma once + +#include +#include + +namespace facebook::yoga { + +// std::bitset with one bit for each option defined in YG_ENUM_SEQ_DECL +template +using EnumBitset = std::bitset()>; + +} // namespace facebook::yoga diff --git a/yoga/BitUtils.h b/yoga/bits/NumericBitfield.h similarity index 64% rename from yoga/BitUtils.h rename to yoga/bits/NumericBitfield.h index 7c91550585..af3fc6927d 100644 --- a/yoga/BitUtils.h +++ b/yoga/bits/NumericBitfield.h @@ -13,11 +13,7 @@ #include -namespace facebook::yoga::detail { - -// std::bitset with one bit for each option defined in YG_ENUM_SEQ_DECL -template -using EnumBitset = std::bitset()>; +namespace facebook::yoga::details { constexpr size_t log2ceilFn(size_t n) { return n < 1 ? 0 : (1 + log2ceilFn(n / 2)); @@ -27,30 +23,37 @@ constexpr int mask(size_t bitWidth, size_t index) { return ((1 << bitWidth) - 1) << index; } +} // namespace facebook::yoga::details + +namespace facebook::yoga { + // The number of bits necessary to represent enums defined with YG_ENUM_SEQ_DECL template -constexpr size_t bitWidthFn() { +constexpr size_t minimumBitCount() { static_assert( enums::count() > 0, "Enums must have at least one entries"); - return log2ceilFn(enums::count() - 1); + return details::log2ceilFn(enums::count() - 1); } template constexpr Enum getEnumData(int flags, size_t index) { - return static_cast((flags & mask(bitWidthFn(), index)) >> index); + return static_cast( + (flags & details::mask(minimumBitCount(), index)) >> index); } template void setEnumData(uint32_t& flags, size_t index, int newValue) { - flags = (flags & ~mask(bitWidthFn(), index)) | - ((newValue << index) & (mask(bitWidthFn(), index))); + flags = (flags & ~details::mask(minimumBitCount(), index)) | + ((newValue << index) & (details::mask(minimumBitCount(), index))); } template void setEnumData(uint8_t& flags, size_t index, int newValue) { - flags = (flags & ~static_cast(mask(bitWidthFn(), index))) | + flags = + (flags & + ~static_cast(details::mask(minimumBitCount(), index))) | ((newValue << index) & - (static_cast(mask(bitWidthFn(), index)))); + (static_cast(details::mask(minimumBitCount(), index)))); } constexpr bool getBooleanData(int flags, size_t index) { @@ -65,4 +68,4 @@ inline void setBooleanData(uint8_t& flags, size_t index, bool value) { } } -} // namespace facebook::yoga::detail +} // namespace facebook::yoga diff --git a/yoga/YGConfig.cpp b/yoga/config/Config.cpp similarity index 56% rename from yoga/YGConfig.cpp rename to yoga/config/Config.cpp index 93c16c69bf..d8809cf5a2 100644 --- a/yoga/YGConfig.cpp +++ b/yoga/config/Config.cpp @@ -5,133 +5,129 @@ * LICENSE file in the root directory of this source tree. */ -#include "YGConfig.h" - -using namespace facebook::yoga; +#include namespace facebook::yoga { -bool configUpdateInvalidatesLayout(YGConfigRef a, YGConfigRef b) { + +bool configUpdateInvalidatesLayout(Config* a, Config* b) { return a->getErrata() != b->getErrata() || a->getEnabledExperiments() != b->getEnabledExperiments() || a->getPointScaleFactor() != b->getPointScaleFactor() || a->useWebDefaults() != b->useWebDefaults(); } -} // namespace facebook::yoga -YGConfig::YGConfig(YGLogger logger) : cloneNodeCallback_{nullptr} { +Config::Config(YGLogger logger) : cloneNodeCallback_{nullptr} { setLogger(logger); } -void YGConfig::setUseWebDefaults(bool useWebDefaults) { +void Config::setUseWebDefaults(bool useWebDefaults) { flags_.useWebDefaults = useWebDefaults; } -bool YGConfig::useWebDefaults() const { +bool Config::useWebDefaults() const { return flags_.useWebDefaults; } -void YGConfig::setShouldPrintTree(bool printTree) { +void Config::setShouldPrintTree(bool printTree) { flags_.printTree = printTree; } -bool YGConfig::shouldPrintTree() const { +bool Config::shouldPrintTree() const { return flags_.printTree; } -void YGConfig::setExperimentalFeatureEnabled( +void Config::setExperimentalFeatureEnabled( YGExperimentalFeature feature, bool enabled) { experimentalFeatures_.set(feature, enabled); } -bool YGConfig::isExperimentalFeatureEnabled( - YGExperimentalFeature feature) const { +bool Config::isExperimentalFeatureEnabled(YGExperimentalFeature feature) const { return experimentalFeatures_.test(feature); } -ExperimentalFeatureSet YGConfig::getEnabledExperiments() const { +EnumBitset Config::getEnabledExperiments() const { return experimentalFeatures_; } -void YGConfig::setErrata(YGErrata errata) { +void Config::setErrata(YGErrata errata) { errata_ = errata; } -void YGConfig::addErrata(YGErrata errata) { +void Config::addErrata(YGErrata errata) { errata_ |= errata; } -void YGConfig::removeErrata(YGErrata errata) { +void Config::removeErrata(YGErrata errata) { errata_ &= (~errata); } -YGErrata YGConfig::getErrata() const { +YGErrata Config::getErrata() const { return errata_; } -bool YGConfig::hasErrata(YGErrata errata) const { +bool Config::hasErrata(YGErrata errata) const { return (errata_ & errata) != YGErrataNone; } -void YGConfig::setPointScaleFactor(float pointScaleFactor) { +void Config::setPointScaleFactor(float pointScaleFactor) { pointScaleFactor_ = pointScaleFactor; } -float YGConfig::getPointScaleFactor() const { +float Config::getPointScaleFactor() const { return pointScaleFactor_; } -void YGConfig::setContext(void* context) { +void Config::setContext(void* context) { context_ = context; } -void* YGConfig::getContext() const { +void* Config::getContext() const { return context_; } -void YGConfig::setLogger(YGLogger logger) { +void Config::setLogger(YGLogger logger) { logger_.noContext = logger; flags_.loggerUsesContext = false; } -void YGConfig::setLogger(LogWithContextFn logger) { +void Config::setLogger(LogWithContextFn logger) { logger_.withContext = logger; flags_.loggerUsesContext = true; } -void YGConfig::setLogger(std::nullptr_t) { +void Config::setLogger(std::nullptr_t) { setLogger(YGLogger{nullptr}); } -void YGConfig::log( - YGConfig* config, - YGNode* node, +void Config::log( + YGNodeRef node, YGLogLevel logLevel, void* logContext, const char* format, - va_list args) const { + va_list args) { if (flags_.loggerUsesContext) { - logger_.withContext(config, node, logLevel, logContext, format, args); + logger_.withContext(this, node, logLevel, logContext, format, args); } else { - logger_.noContext(config, node, logLevel, format, args); + logger_.noContext(this, node, logLevel, format, args); } } -void YGConfig::setCloneNodeCallback(YGCloneNodeFunc cloneNode) { +void Config::setCloneNodeCallback(YGCloneNodeFunc cloneNode) { cloneNodeCallback_.noContext = cloneNode; flags_.cloneNodeUsesContext = false; } -void YGConfig::setCloneNodeCallback(CloneWithContextFn cloneNode) { +void Config::setCloneNodeCallback(CloneWithContextFn cloneNode) { cloneNodeCallback_.withContext = cloneNode; flags_.cloneNodeUsesContext = true; } -void YGConfig::setCloneNodeCallback(std::nullptr_t) { +void Config::setCloneNodeCallback(std::nullptr_t) { setCloneNodeCallback(YGCloneNodeFunc{nullptr}); } -YGNodeRef YGConfig::cloneNode( +YGNodeRef Config::cloneNode( YGNodeRef node, YGNodeRef owner, int childIndex, @@ -147,3 +143,5 @@ YGNodeRef YGConfig::cloneNode( } return clone; } + +} // namespace facebook::yoga diff --git a/yoga/YGConfig.h b/yoga/config/Config.h similarity index 73% rename from yoga/YGConfig.h rename to yoga/config/Config.h index 391e250080..ebf3f77f79 100644 --- a/yoga/YGConfig.h +++ b/yoga/config/Config.h @@ -8,15 +8,18 @@ #pragma once #include +#include -#include "BitUtils.h" -#include "Yoga-internal.h" +// Tag struct used to form the opaque YGConfigRef for the public C API +struct YGConfig {}; namespace facebook::yoga { +class Config; + // Whether moving a node from config "a" to config "b" should dirty previously // calculated layout results. -bool configUpdateInvalidatesLayout(YGConfigRef a, YGConfigRef b); +bool configUpdateInvalidatesLayout(Config* a, Config* b); // Internal variants of log functions, currently used only by JNI bindings. // TODO: Reconcile this with the public API @@ -33,13 +36,10 @@ using CloneWithContextFn = YGNodeRef (*)( int childIndex, void* cloneContext); -using ExperimentalFeatureSet = - facebook::yoga::detail::EnumBitset; - #pragma pack(push) #pragma pack(1) // Packed structure of <32-bit options to miminize size per node. -struct YGConfigFlags { +struct ConfigFlags { bool useWebDefaults : 1; bool printTree : 1; bool cloneNodeUsesContext : 1; @@ -47,10 +47,9 @@ struct YGConfigFlags { }; #pragma pack(pop) -} // namespace facebook::yoga - -struct YOGA_EXPORT YGConfig { - YGConfig(YGLogger logger); +class YOGA_EXPORT Config : public ::YGConfig { +public: + Config(YGLogger logger); void setUseWebDefaults(bool useWebDefaults); bool useWebDefaults() const; @@ -62,7 +61,7 @@ struct YOGA_EXPORT YGConfig { YGExperimentalFeature feature, bool enabled); bool isExperimentalFeatureEnabled(YGExperimentalFeature feature) const; - facebook::yoga::ExperimentalFeatureSet getEnabledExperiments() const; + EnumBitset getEnabledExperiments() const; void setErrata(YGErrata errata); void addErrata(YGErrata errata); @@ -77,12 +76,12 @@ struct YOGA_EXPORT YGConfig { void* getContext() const; void setLogger(YGLogger logger); - void setLogger(facebook::yoga::LogWithContextFn logger); + void setLogger(LogWithContextFn logger); void setLogger(std::nullptr_t); - void log(YGConfig*, YGNode*, YGLogLevel, void*, const char*, va_list) const; + void log(YGNodeRef, YGLogLevel, void*, const char*, va_list); void setCloneNodeCallback(YGCloneNodeFunc cloneNode); - void setCloneNodeCallback(facebook::yoga::CloneWithContextFn cloneNode); + void setCloneNodeCallback(CloneWithContextFn cloneNode); void setCloneNodeCallback(std::nullptr_t); YGNodeRef cloneNode( YGNodeRef node, @@ -92,17 +91,19 @@ struct YOGA_EXPORT YGConfig { private: union { - facebook::yoga::CloneWithContextFn withContext; + CloneWithContextFn withContext; YGCloneNodeFunc noContext; } cloneNodeCallback_; union { - facebook::yoga::LogWithContextFn withContext; + LogWithContextFn withContext; YGLogger noContext; } logger_; - facebook::yoga::YGConfigFlags flags_{}; - facebook::yoga::ExperimentalFeatureSet experimentalFeatures_{}; + ConfigFlags flags_{}; + EnumBitset experimentalFeatures_{}; YGErrata errata_ = YGErrataNone; float pointScaleFactor_ = 1.0f; void* context_ = nullptr; }; + +} // namespace facebook::yoga diff --git a/yoga/debug/AssertFatal.cpp b/yoga/debug/AssertFatal.cpp new file mode 100644 index 0000000000..e079777c77 --- /dev/null +++ b/yoga/debug/AssertFatal.cpp @@ -0,0 +1,65 @@ +/* + * 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. + */ + +#include + +#include +#include + +namespace facebook::yoga { + +[[noreturn]] void fatalWithMessage(const char* message) { +#if defined(__cpp_exceptions) + throw std::logic_error(message); +#else + std::terminate(); +#endif +} + +void assertFatal(const bool condition, const char* message) { + if (!condition) { + yoga::log( + static_cast(nullptr), + YGLogLevelFatal, + nullptr, + "%s\n", + message); + fatalWithMessage(message); + } +} + +void assertFatalWithNode( + const YGNodeRef node, + const bool condition, + const char* message) { + if (!condition) { + yoga::log( + static_cast(node), + YGLogLevelFatal, + nullptr, + "%s\n", + message); + fatalWithMessage(message); + } +} + +void assertFatalWithConfig( + const YGConfigRef config, + const bool condition, + const char* message) { + if (!condition) { + yoga::log( + static_cast(config), + YGLogLevelFatal, + nullptr, + "%s\n", + message); + fatalWithMessage(message); + } +} + +} // namespace facebook::yoga diff --git a/yoga/debug/AssertFatal.h b/yoga/debug/AssertFatal.h new file mode 100644 index 0000000000..461eb8ed44 --- /dev/null +++ b/yoga/debug/AssertFatal.h @@ -0,0 +1,25 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include + +namespace facebook::yoga { + +[[noreturn]] void fatalWithMessage(const char* message); + +void assertFatal(bool condition, const char* message); +void assertFatalWithNode(YGNodeRef node, bool condition, const char* message); +void assertFatalWithConfig( + YGConfigRef config, + bool condition, + const char* message); + +} // namespace facebook::yoga diff --git a/yoga/log.cpp b/yoga/debug/Log.cpp similarity index 65% rename from yoga/log.cpp rename to yoga/debug/Log.cpp index 51040592a2..f3d704aa71 100644 --- a/yoga/log.cpp +++ b/yoga/debug/Log.cpp @@ -5,30 +5,28 @@ * LICENSE file in the root directory of this source tree. */ -#include +#include -#include "log.h" -#include "YGConfig.h" -#include "YGNode.h" - -namespace facebook::yoga::detail { +namespace facebook::yoga { namespace { void vlog( - YGConfig* config, - YGNode* node, + yoga::Config* config, + yoga::Node* node, YGLogLevel level, void* context, const char* format, va_list args) { - YGConfig* logConfig = config != nullptr ? config : YGConfigGetDefault(); - logConfig->log(logConfig, node, level, context, format, args); + yoga::Config* logConfig = config != nullptr + ? config + : static_cast(YGConfigGetDefault()); + logConfig->log(node, level, context, format, args); } } // namespace -YOGA_EXPORT void Log::log( - YGNode* node, +void log( + yoga::Node* node, YGLogLevel level, void* context, const char* format, @@ -45,8 +43,8 @@ YOGA_EXPORT void Log::log( va_end(args); } -void Log::log( - YGConfig* config, +void log( + yoga::Config* config, YGLogLevel level, void* context, const char* format, @@ -57,4 +55,4 @@ void Log::log( va_end(args); } -} // namespace facebook::yoga::detail +} // namespace facebook::yoga diff --git a/yoga/debug/Log.h b/yoga/debug/Log.h new file mode 100644 index 0000000000..dd4db2f4d1 --- /dev/null +++ b/yoga/debug/Log.h @@ -0,0 +1,30 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include + +namespace facebook::yoga { + +void log( + yoga::Node* node, + YGLogLevel level, + void*, + const char* message, + ...) noexcept; + +void log( + yoga::Config* config, + YGLogLevel level, + void*, + const char* format, + ...) noexcept; + +} // namespace facebook::yoga diff --git a/yoga/YGNodePrint.cpp b/yoga/debug/NodeToString.cpp similarity index 69% rename from yoga/YGNodePrint.cpp rename to yoga/debug/NodeToString.cpp index 7aa50f07d0..756f480098 100644 --- a/yoga/YGNodePrint.cpp +++ b/yoga/debug/NodeToString.cpp @@ -11,26 +11,24 @@ #include -#include "YGNodePrint.h" -#include "YGNode.h" -#include "Yoga-internal.h" -#include "Utils.h" +#include +#include namespace facebook::yoga { -typedef std::string string; -static void indent(string& base, uint32_t level) { +static void indent(std::string& base, uint32_t level) { for (uint32_t i = 0; i < level; ++i) { base.append(" "); } } -static bool areFourValuesEqual(const YGStyle::Edges& four) { - return YGValueEqual(four[0], four[1]) && YGValueEqual(four[0], four[2]) && - YGValueEqual(four[0], four[3]); +static bool areFourValuesEqual(const Style::Edges& four) { + return yoga::inexactEquals(four[0], four[1]) && + yoga::inexactEquals(four[0], four[2]) && + yoga::inexactEquals(four[0], four[3]); } -static void appendFormattedString(string& str, const char* fmt, ...) { +static void appendFormattedString(std::string& str, const char* fmt, ...) { va_list args; va_start(args, fmt); va_list argsCopy; @@ -39,28 +37,28 @@ static void appendFormattedString(string& str, const char* fmt, ...) { va_end(args); vsnprintf(buf.data(), buf.size(), fmt, argsCopy); va_end(argsCopy); - string result = string(buf.begin(), buf.end() - 1); + std::string result = std::string(buf.begin(), buf.end() - 1); str.append(result); } static void appendFloatOptionalIfDefined( - string& base, - const string key, - const YGFloatOptional num) { + std::string& base, + const std::string key, + const FloatOptional num) { if (!num.isUndefined()) { appendFormattedString(base, "%s: %g; ", key.c_str(), num.unwrap()); } } static void appendNumberIfNotUndefined( - string& base, - const string key, + std::string& base, + const std::string key, const YGValue number) { if (number.unit != YGUnitUndefined) { if (number.unit == YGUnitAuto) { base.append(key + ": auto; "); } else { - string unit = number.unit == YGUnitPoint ? "px" : "%%"; + std::string unit = number.unit == YGUnitPoint ? "px" : "%%"; appendFormattedString( base, "%s: %g%s; ", key.c_str(), number.value, unit.c_str()); } @@ -68,8 +66,8 @@ static void appendNumberIfNotUndefined( } static void appendNumberIfNotAuto( - string& base, - const string& key, + std::string& base, + const std::string& key, const YGValue number) { if (number.unit != YGUnitAuto) { appendNumberIfNotUndefined(base, key, number); @@ -77,49 +75,49 @@ static void appendNumberIfNotAuto( } static void appendNumberIfNotZero( - string& base, - const string& str, + std::string& base, + const std::string& str, const YGValue number) { if (number.unit == YGUnitAuto) { base.append(str + ": auto; "); - } else if (!YGFloatsEqual(number.value, 0)) { + } else if (!yoga::inexactEquals(number.value, 0)) { appendNumberIfNotUndefined(base, str, number); } } static void appendEdges( - string& base, - const string& key, - const YGStyle::Edges& edges) { + std::string& base, + const std::string& key, + const Style::Edges& edges) { if (areFourValuesEqual(edges)) { - auto edgeValue = YGNode::computeEdgeValueForColumn( - edges, YGEdgeLeft, detail::CompactValue::ofZero()); + auto edgeValue = yoga::Node::computeEdgeValueForColumn( + edges, YGEdgeLeft, CompactValue::ofZero()); appendNumberIfNotZero(base, key, edgeValue); } else { for (int edge = YGEdgeLeft; edge != YGEdgeAll; ++edge) { - string str = key + "-" + YGEdgeToString(static_cast(edge)); + std::string str = key + "-" + YGEdgeToString(static_cast(edge)); appendNumberIfNotZero(base, str, edges[edge]); } } } static void appendEdgeIfNotUndefined( - string& base, - const string& str, - const YGStyle::Edges& edges, + std::string& base, + const std::string& str, + const Style::Edges& edges, const YGEdge edge) { // TODO: this doesn't take RTL / YGEdgeStart / YGEdgeEnd into account auto value = (edge == YGEdgeLeft || edge == YGEdgeRight) - ? YGNode::computeEdgeValueForRow( - edges, edge, edge, detail::CompactValue::ofUndefined()) - : YGNode::computeEdgeValueForColumn( - edges, edge, detail::CompactValue::ofUndefined()); + ? yoga::Node::computeEdgeValueForRow( + edges, edge, edge, CompactValue::ofUndefined()) + : yoga::Node::computeEdgeValueForColumn( + edges, edge, CompactValue::ofUndefined()); appendNumberIfNotUndefined(base, str, value); } -void YGNodeToString( +void nodeToString( std::string& str, - YGNodeRef node, + yoga::Node* node, YGPrintOptions options, uint32_t level) { indent(str, level); @@ -141,27 +139,27 @@ void YGNodeToString( if (options & YGPrintOptionsStyle) { appendFormattedString(str, "style=\""); const auto& style = node->getStyle(); - if (style.flexDirection() != YGNode().getStyle().flexDirection()) { + if (style.flexDirection() != yoga::Node{}.getStyle().flexDirection()) { appendFormattedString( str, "flex-direction: %s; ", YGFlexDirectionToString(style.flexDirection())); } - if (style.justifyContent() != YGNode().getStyle().justifyContent()) { + if (style.justifyContent() != yoga::Node{}.getStyle().justifyContent()) { appendFormattedString( str, "justify-content: %s; ", YGJustifyToString(style.justifyContent())); } - if (style.alignItems() != YGNode().getStyle().alignItems()) { + if (style.alignItems() != yoga::Node{}.getStyle().alignItems()) { appendFormattedString( str, "align-items: %s; ", YGAlignToString(style.alignItems())); } - if (style.alignContent() != YGNode().getStyle().alignContent()) { + if (style.alignContent() != yoga::Node{}.getStyle().alignContent()) { appendFormattedString( str, "align-content: %s; ", YGAlignToString(style.alignContent())); } - if (style.alignSelf() != YGNode().getStyle().alignSelf()) { + if (style.alignSelf() != yoga::Node{}.getStyle().alignSelf()) { appendFormattedString( str, "align-self: %s; ", YGAlignToString(style.alignSelf())); } @@ -170,17 +168,17 @@ void YGNodeToString( appendNumberIfNotAuto(str, "flex-basis", style.flexBasis()); appendFloatOptionalIfDefined(str, "flex", style.flex()); - if (style.flexWrap() != YGNode().getStyle().flexWrap()) { + if (style.flexWrap() != yoga::Node{}.getStyle().flexWrap()) { appendFormattedString( str, "flex-wrap: %s; ", YGWrapToString(style.flexWrap())); } - if (style.overflow() != YGNode().getStyle().overflow()) { + if (style.overflow() != yoga::Node{}.getStyle().overflow()) { appendFormattedString( str, "overflow: %s; ", YGOverflowToString(style.overflow())); } - if (style.display() != YGNode().getStyle().display()) { + if (style.display() != yoga::Node{}.getStyle().display()) { appendFormattedString( str, "display: %s; ", YGDisplayToString(style.display())); } @@ -188,17 +186,16 @@ void YGNodeToString( appendEdges(str, "padding", style.padding()); appendEdges(str, "border", style.border()); - if (YGNode::computeColumnGap( - style.gap(), detail::CompactValue::ofUndefined()) != - YGNode::computeColumnGap( - YGNode().getStyle().gap(), detail::CompactValue::ofUndefined())) { + if (yoga::Node::computeColumnGap( + style.gap(), CompactValue::ofUndefined()) != + yoga::Node::computeColumnGap( + yoga::Node{}.getStyle().gap(), CompactValue::ofUndefined())) { appendNumberIfNotUndefined( str, "column-gap", style.gap()[YGGutterColumn]); } - if (YGNode::computeRowGap( - style.gap(), detail::CompactValue::ofUndefined()) != - YGNode::computeRowGap( - YGNode().getStyle().gap(), detail::CompactValue::ofUndefined())) { + if (yoga::Node::computeRowGap(style.gap(), CompactValue::ofUndefined()) != + yoga::Node::computeRowGap( + yoga::Node{}.getStyle().gap(), CompactValue::ofUndefined())) { appendNumberIfNotUndefined(str, "row-gap", style.gap()[YGGutterRow]); } @@ -213,7 +210,7 @@ void YGNodeToString( appendNumberIfNotAuto( str, "min-height", style.minDimensions()[YGDimensionHeight]); - if (style.positionType() != YGNode().getStyle().positionType()) { + if (style.positionType() != yoga::Node{}.getStyle().positionType()) { appendFormattedString( str, "position: %s; ", YGPositionTypeToString(style.positionType())); } @@ -234,7 +231,7 @@ void YGNodeToString( if (options & YGPrintOptionsChildren && childCount > 0) { for (uint32_t i = 0; i < childCount; i++) { appendFormattedString(str, "\n"); - YGNodeToString(str, YGNodeGetChild(node, i), options, level + 1); + nodeToString(str, node->getChild(i), options, level + 1); } appendFormattedString(str, "\n"); indent(str, level); diff --git a/yoga/YGNodePrint.h b/yoga/debug/NodeToString.h similarity index 85% rename from yoga/YGNodePrint.h rename to yoga/debug/NodeToString.h index 7648f83c7b..c00439b33a 100644 --- a/yoga/YGNodePrint.h +++ b/yoga/debug/NodeToString.h @@ -12,12 +12,13 @@ #include #include +#include namespace facebook::yoga { -void YGNodeToString( +void nodeToString( std::string& str, - YGNodeRef node, + yoga::Node* node, YGPrintOptions options, uint32_t level); diff --git a/yoga/event/event.cpp b/yoga/event/event.cpp index ee47331d85..b47e1fab7f 100644 --- a/yoga/event/event.cpp +++ b/yoga/event/event.cpp @@ -73,7 +73,10 @@ void Event::subscribe(std::function&& subscriber) { push(new Node{std::move(subscriber)}); } -void Event::publish(const YGNode& node, Type eventType, const Data& eventData) { +void Event::publish( + YGNodeConstRef node, + Type eventType, + const Data& eventData) { for (auto subscriber = subscribers.load(std::memory_order_relaxed); subscriber != nullptr; subscriber = subscriber->next) { diff --git a/yoga/event/event.h b/yoga/event/event.h index 4c34fa66d6..3798e4663e 100644 --- a/yoga/event/event.h +++ b/yoga/event/event.h @@ -7,15 +7,13 @@ #pragma once +#include + #include #include #include -#include #include -struct YGConfig; -struct YGNode; - namespace facebook::yoga { enum struct LayoutType : int { @@ -63,7 +61,7 @@ struct YOGA_EXPORT Event { NodeBaselineEnd, }; class Data; - using Subscriber = void(const YGNode&, Type, Data); + using Subscriber = void(YGNodeConstRef, Type, Data); using Subscribers = std::vector>; template @@ -87,27 +85,22 @@ struct YOGA_EXPORT Event { static void subscribe(std::function&& subscriber); template - static void publish(const YGNode& node, const TypedData& eventData = {}) { + static void publish(YGNodeConstRef node, const TypedData& eventData = {}) { publish(node, E, Data{eventData}); } - template - static void publish(const YGNode* node, const TypedData& eventData = {}) { - publish(*node, eventData); - } - private: - static void publish(const YGNode&, Type, const Data&); + static void publish(YGNodeConstRef, Type, const Data&); }; template <> struct Event::TypedData { - YGConfig* config; + YGConfigRef config; }; template <> struct Event::TypedData { - YGConfig* config; + YGConfigRef config; }; template <> diff --git a/yoga/log.h b/yoga/log.h deleted file mode 100644 index 070a164da3..0000000000 --- a/yoga/log.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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. - */ - -#pragma once - -#include - -struct YGNode; -struct YGConfig; - -namespace facebook::yoga::detail { - -struct Log { - static void log( - YGNode* node, - YGLogLevel level, - void*, - const char* message, - ...) noexcept; - - static void log( - YGConfig* config, - YGLogLevel level, - void*, - const char* format, - ...) noexcept; -}; - -} // namespace facebook::yoga::detail diff --git a/yoga/module.modulemap b/yoga/module.modulemap new file mode 100644 index 0000000000..91c6db2934 --- /dev/null +++ b/yoga/module.modulemap @@ -0,0 +1,16 @@ +/* + * 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. + */ + +module yoga [system] { + module core { + header "YGEnums.h" + header "YGMacros.h" + header "YGValue.h" + header "Yoga.h" + export * + } +} diff --git a/yoga/node/CachedMeasurement.h b/yoga/node/CachedMeasurement.h new file mode 100644 index 0000000000..b2695bf1a2 --- /dev/null +++ b/yoga/node/CachedMeasurement.h @@ -0,0 +1,51 @@ +/* + * 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. + */ + +#pragma once + +#include + +#include +#include + +namespace facebook::yoga { + +struct CachedMeasurement { + float availableWidth{-1}; + float availableHeight{-1}; + YGMeasureMode widthMeasureMode{YGMeasureModeUndefined}; + YGMeasureMode heightMeasureMode{YGMeasureModeUndefined}; + + float computedWidth{-1}; + float computedHeight{-1}; + + bool operator==(CachedMeasurement measurement) const { + bool isEqual = widthMeasureMode == measurement.widthMeasureMode && + heightMeasureMode == measurement.heightMeasureMode; + + if (!yoga::isUndefined(availableWidth) || + !yoga::isUndefined(measurement.availableWidth)) { + isEqual = isEqual && availableWidth == measurement.availableWidth; + } + if (!yoga::isUndefined(availableHeight) || + !yoga::isUndefined(measurement.availableHeight)) { + isEqual = isEqual && availableHeight == measurement.availableHeight; + } + if (!yoga::isUndefined(computedWidth) || + !yoga::isUndefined(measurement.computedWidth)) { + isEqual = isEqual && computedWidth == measurement.computedWidth; + } + if (!yoga::isUndefined(computedHeight) || + !yoga::isUndefined(measurement.computedHeight)) { + isEqual = isEqual && computedHeight == measurement.computedHeight; + } + + return isEqual; + } +}; + +} // namespace facebook::yoga diff --git a/yoga/YGLayout.cpp b/yoga/node/LayoutResults.cpp similarity index 63% rename from yoga/YGLayout.cpp rename to yoga/node/LayoutResults.cpp index 9aadcd4aec..fb8b8527c5 100644 --- a/yoga/YGLayout.cpp +++ b/yoga/node/LayoutResults.cpp @@ -5,17 +5,19 @@ * LICENSE file in the root directory of this source tree. */ -#include "YGLayout.h" -#include "Utils.h" +#include -using namespace facebook; +#include +#include -bool YGLayout::operator==(YGLayout layout) const { - bool isEqual = YGFloatArrayEqual(position, layout.position) && - YGFloatArrayEqual(dimensions, layout.dimensions) && - YGFloatArrayEqual(margin, layout.margin) && - YGFloatArrayEqual(border, layout.border) && - YGFloatArrayEqual(padding, layout.padding) && +namespace facebook::yoga { + +bool LayoutResults::operator==(LayoutResults layout) const { + bool isEqual = yoga::inexactEquals(position, layout.position) && + yoga::inexactEquals(dimensions, layout.dimensions) && + yoga::inexactEquals(margin, layout.margin) && + yoga::inexactEquals(border, layout.border) && + yoga::inexactEquals(padding, layout.padding) && direction() == layout.direction() && hadOverflow() == layout.hadOverflow() && lastOwnerDirection == layout.lastOwnerDirection && @@ -23,7 +25,8 @@ bool YGLayout::operator==(YGLayout layout) const { cachedLayout == layout.cachedLayout && computedFlexBasis == layout.computedFlexBasis; - for (uint32_t i = 0; i < YG_MAX_CACHED_RESULT_COUNT && isEqual; ++i) { + for (uint32_t i = 0; i < LayoutResults::MaxCachedMeasurements && isEqual; + ++i) { isEqual = isEqual && cachedMeasurements[i] == layout.cachedMeasurements[i]; } @@ -40,3 +43,5 @@ bool YGLayout::operator==(YGLayout layout) const { return isEqual; } + +} // namespace facebook::yoga diff --git a/yoga/YGLayout.h b/yoga/node/LayoutResults.h similarity index 52% rename from yoga/YGLayout.h rename to yoga/node/LayoutResults.h index 166eabb64d..95b4a21bf8 100644 --- a/yoga/YGLayout.h +++ b/yoga/node/LayoutResults.h @@ -7,11 +7,19 @@ #pragma once -#include "BitUtils.h" -#include "YGFloatOptional.h" -#include "Yoga-internal.h" +#include + +#include +#include +#include + +namespace facebook::yoga { + +struct LayoutResults { + // This value was chosen based on empirical data: + // 98% of analyzed layouts require less than 8 entries. + static constexpr int32_t MaxCachedMeasurements = 8; -struct YGLayout { std::array position = {}; std::array dimensions = {{YGUndefined, YGUndefined}}; std::array margin = {}; @@ -21,12 +29,12 @@ struct YGLayout { private: static constexpr size_t directionOffset = 0; static constexpr size_t hadOverflowOffset = - directionOffset + facebook::yoga::detail::bitWidthFn(); + directionOffset + minimumBitCount(); uint8_t flags = 0; public: uint32_t computedFlexBasisGeneration = 0; - YGFloatOptional computedFlexBasis = {}; + FloatOptional computedFlexBasis = {}; // Instead of recomputing the entire layout every single time, we cache some // information to break early when nothing changed @@ -34,30 +42,26 @@ struct YGLayout { YGDirection lastOwnerDirection = YGDirectionInherit; uint32_t nextCachedMeasurementsIndex = 0; - std::array - cachedMeasurements = {}; + std::array cachedMeasurements = {}; std::array measuredDimensions = {{YGUndefined, YGUndefined}}; - YGCachedMeasurement cachedLayout = YGCachedMeasurement(); + CachedMeasurement cachedLayout{}; YGDirection direction() const { - return facebook::yoga::detail::getEnumData( - flags, directionOffset); + return getEnumData(flags, directionOffset); } void setDirection(YGDirection direction) { - facebook::yoga::detail::setEnumData( - flags, directionOffset, direction); + setEnumData(flags, directionOffset, direction); } - bool hadOverflow() const { - return facebook::yoga::detail::getBooleanData(flags, hadOverflowOffset); - } + bool hadOverflow() const { return getBooleanData(flags, hadOverflowOffset); } void setHadOverflow(bool hadOverflow) { - facebook::yoga::detail::setBooleanData( - flags, hadOverflowOffset, hadOverflow); + setBooleanData(flags, hadOverflowOffset, hadOverflow); } - bool operator==(YGLayout layout) const; - bool operator!=(YGLayout layout) const { return !(*this == layout); } + bool operator==(LayoutResults layout) const; + bool operator!=(LayoutResults layout) const { return !(*this == layout); } }; + +} // namespace facebook::yoga diff --git a/yoga/YGNode.cpp b/yoga/node/Node.cpp similarity index 58% rename from yoga/YGNode.cpp rename to yoga/node/Node.cpp index cd323b5412..d561d31477 100644 --- a/yoga/YGNode.cpp +++ b/yoga/node/Node.cpp @@ -5,17 +5,20 @@ * LICENSE file in the root directory of this source tree. */ -#include "YGNode.h" #include #include -#include "Utils.h" -using namespace facebook; -using facebook::yoga::detail::CompactValue; +#include +#include +#include +#include +#include -YGNode::YGNode(const YGConfigRef config) : config_{config} { - YGAssert( - config != nullptr, "Attempting to construct YGNode with null config"); +namespace facebook::yoga { + +Node::Node(yoga::Config* config) : config_{config} { + yoga::assertFatal( + config != nullptr, "Attempting to construct Node with null config"); flags_.hasNewLayout = true; if (config->useWebDefaults()) { @@ -23,7 +26,7 @@ YGNode::YGNode(const YGConfigRef config) : config_{config} { } } -YGNode::YGNode(YGNode&& node) { +Node::Node(Node&& node) { context_ = node.context_; flags_ = node.flags_; measure_ = node.measure_; @@ -42,7 +45,7 @@ YGNode::YGNode(YGNode&& node) { } } -void YGNode::print(void* printContext) { +void Node::print(void* printContext) { if (print_.noContext != nullptr) { if (flags_.printUsesContext) { print_.withContext(this, printContext); @@ -52,8 +55,8 @@ void YGNode::print(void* printContext) { } } -CompactValue YGNode::computeEdgeValueForRow( - const YGStyle::Edges& edges, +CompactValue Node::computeEdgeValueForRow( + const Style::Edges& edges, YGEdge rowEdge, YGEdge edge, CompactValue defaultValue) { @@ -70,8 +73,8 @@ CompactValue YGNode::computeEdgeValueForRow( } } -CompactValue YGNode::computeEdgeValueForColumn( - const YGStyle::Edges& edges, +CompactValue Node::computeEdgeValueForColumn( + const Style::Edges& edges, YGEdge edge, CompactValue defaultValue) { if (!edges[edge].isUndefined()) { @@ -85,8 +88,8 @@ CompactValue YGNode::computeEdgeValueForColumn( } } -CompactValue YGNode::computeRowGap( - const YGStyle::Gutters& gutters, +CompactValue Node::computeRowGap( + const Style::Gutters& gutters, CompactValue defaultValue) { if (!gutters[YGGutterRow].isUndefined()) { return gutters[YGGutterRow]; @@ -97,8 +100,8 @@ CompactValue YGNode::computeRowGap( } } -CompactValue YGNode::computeColumnGap( - const YGStyle::Gutters& gutters, +CompactValue Node::computeColumnGap( + const Style::Gutters& gutters, CompactValue defaultValue) { if (!gutters[YGGutterColumn].isUndefined()) { return gutters[YGGutterColumn]; @@ -109,96 +112,105 @@ CompactValue YGNode::computeColumnGap( } } -YGFloatOptional YGNode::getLeadingPosition( +FloatOptional Node::getLeadingPosition( const YGFlexDirection axis, const float axisSize) const { - auto leadingPosition = YGFlexDirectionIsRow(axis) + auto leadingPosition = isRow(axis) ? computeEdgeValueForRow( style_.position(), YGEdgeStart, - leading[axis], + leadingEdge(axis), CompactValue::ofZero()) : computeEdgeValueForColumn( - style_.position(), leading[axis], CompactValue::ofZero()); - return YGResolveValue(leadingPosition, axisSize); + style_.position(), leadingEdge(axis), CompactValue::ofZero()); + return yoga::resolveValue(leadingPosition, axisSize); } -YGFloatOptional YGNode::getTrailingPosition( +FloatOptional Node::getTrailingPosition( const YGFlexDirection axis, const float axisSize) const { - auto trailingPosition = YGFlexDirectionIsRow(axis) + auto trailingPosition = isRow(axis) ? computeEdgeValueForRow( style_.position(), YGEdgeEnd, - trailing[axis], + trailingEdge(axis), CompactValue::ofZero()) : computeEdgeValueForColumn( - style_.position(), trailing[axis], CompactValue::ofZero()); - return YGResolveValue(trailingPosition, axisSize); + style_.position(), trailingEdge(axis), CompactValue::ofZero()); + return yoga::resolveValue(trailingPosition, axisSize); } -bool YGNode::isLeadingPositionDefined(const YGFlexDirection axis) const { - auto leadingPosition = YGFlexDirectionIsRow(axis) +bool Node::isLeadingPositionDefined(const YGFlexDirection axis) const { + auto leadingPosition = isRow(axis) ? computeEdgeValueForRow( style_.position(), YGEdgeStart, - leading[axis], + leadingEdge(axis), CompactValue::ofUndefined()) : computeEdgeValueForColumn( - style_.position(), leading[axis], CompactValue::ofUndefined()); + style_.position(), leadingEdge(axis), CompactValue::ofUndefined()); return !leadingPosition.isUndefined(); } -bool YGNode::isTrailingPosDefined(const YGFlexDirection axis) const { - auto trailingPosition = YGFlexDirectionIsRow(axis) +bool Node::isTrailingPosDefined(const YGFlexDirection axis) const { + auto trailingPosition = isRow(axis) ? computeEdgeValueForRow( style_.position(), YGEdgeEnd, - trailing[axis], + trailingEdge(axis), CompactValue::ofUndefined()) : computeEdgeValueForColumn( - style_.position(), trailing[axis], CompactValue::ofUndefined()); + style_.position(), trailingEdge(axis), CompactValue::ofUndefined()); return !trailingPosition.isUndefined(); } -YGFloatOptional YGNode::getLeadingMargin( +FloatOptional Node::getLeadingMargin( const YGFlexDirection axis, const float widthSize) const { - auto leadingMargin = YGFlexDirectionIsRow(axis) + auto leadingMargin = isRow(axis) ? computeEdgeValueForRow( - style_.margin(), YGEdgeStart, leading[axis], CompactValue::ofZero()) + style_.margin(), + YGEdgeStart, + leadingEdge(axis), + CompactValue::ofZero()) : computeEdgeValueForColumn( - style_.margin(), leading[axis], CompactValue::ofZero()); - return YGResolveValueMargin(leadingMargin, widthSize); + style_.margin(), leadingEdge(axis), CompactValue::ofZero()); + return leadingMargin.isAuto() ? FloatOptional{0} + : yoga::resolveValue(leadingMargin, widthSize); } -YGFloatOptional YGNode::getTrailingMargin( +FloatOptional Node::getTrailingMargin( const YGFlexDirection axis, const float widthSize) const { - auto trailingMargin = YGFlexDirectionIsRow(axis) + auto trailingMargin = isRow(axis) ? computeEdgeValueForRow( - style_.margin(), YGEdgeEnd, trailing[axis], CompactValue::ofZero()) + style_.margin(), + YGEdgeEnd, + trailingEdge(axis), + CompactValue::ofZero()) : computeEdgeValueForColumn( - style_.margin(), trailing[axis], CompactValue::ofZero()); - return YGResolveValueMargin(trailingMargin, widthSize); + style_.margin(), trailingEdge(axis), CompactValue::ofZero()); + return trailingMargin.isAuto() + ? FloatOptional{0} + : yoga::resolveValue(trailingMargin, widthSize); } -YGFloatOptional YGNode::getMarginForAxis( +FloatOptional Node::getMarginForAxis( const YGFlexDirection axis, const float widthSize) const { return getLeadingMargin(axis, widthSize) + getTrailingMargin(axis, widthSize); } -YGFloatOptional YGNode::getGapForAxis( +FloatOptional Node::getGapForAxis( const YGFlexDirection axis, const float widthSize) const { - auto gap = YGFlexDirectionIsRow(axis) + auto gap = isRow(axis) ? computeColumnGap(style_.gap(), CompactValue::ofZero()) : computeRowGap(style_.gap(), CompactValue::ofZero()); - return YGResolveValue(gap, widthSize); + return yoga::resolveValue(gap, widthSize); } -YGSize YGNode::measure( +YGSize Node::measure( float width, YGMeasureMode widthMode, float height, @@ -210,7 +222,7 @@ YGSize YGNode::measure( : measure_.noContext(this, width, widthMode, height, heightMode); } -float YGNode::baseline(float width, float height, void* layoutContext) { +float Node::baseline(float width, float height, void* layoutContext) { return flags_.baselineUsesContext ? baseline_.withContext(this, width, height, layoutContext) : baseline_.noContext(this, width, height); @@ -218,13 +230,13 @@ float YGNode::baseline(float width, float height, void* layoutContext) { // Setters -void YGNode::setMeasureFunc(decltype(YGNode::measure_) measureFunc) { +void Node::setMeasureFunc(decltype(Node::measure_) measureFunc) { if (measureFunc.noContext == nullptr) { // TODO: t18095186 Move nodeType to opt-in function and mark appropriate // places in Litho setNodeType(YGNodeTypeDefault); } else { - YGAssertWithNode( + yoga::assertFatalWithNode( this, children_.size() == 0, "Cannot set measure function: Nodes with measure functions cannot have " @@ -237,38 +249,39 @@ void YGNode::setMeasureFunc(decltype(YGNode::measure_) measureFunc) { measure_ = measureFunc; } -void YGNode::setMeasureFunc(YGMeasureFunc measureFunc) { +void Node::setMeasureFunc(YGMeasureFunc measureFunc) { flags_.measureUsesContext = false; - decltype(YGNode::measure_) m; + decltype(Node::measure_) m; m.noContext = measureFunc; setMeasureFunc(m); } -YOGA_EXPORT void YGNode::setMeasureFunc(MeasureWithContextFn measureFunc) { +YOGA_EXPORT void Node::setMeasureFunc(MeasureWithContextFn measureFunc) { flags_.measureUsesContext = true; - decltype(YGNode::measure_) m; + decltype(Node::measure_) m; m.withContext = measureFunc; setMeasureFunc(m); } -void YGNode::replaceChild(YGNodeRef child, uint32_t index) { +void Node::replaceChild(Node* child, uint32_t index) { children_[index] = child; } -void YGNode::replaceChild(YGNodeRef oldChild, YGNodeRef newChild) { +void Node::replaceChild(Node* oldChild, Node* newChild) { std::replace(children_.begin(), children_.end(), oldChild, newChild); } -void YGNode::insertChild(YGNodeRef child, uint32_t index) { +void Node::insertChild(Node* child, uint32_t index) { children_.insert(children_.begin() + index, child); } -void YGNode::setConfig(YGConfigRef config) { - YGAssert(config != nullptr, "Attempting to set a null config on a YGNode"); - YGAssertWithConfig( +void Node::setConfig(yoga::Config* config) { + yoga::assertFatal( + config != nullptr, "Attempting to set a null config on a Node"); + yoga::assertFatalWithConfig( config, config->useWebDefaults() == config_->useWebDefaults(), - "UseWebDefaults may not be changed after constructing a YGNode"); + "UseWebDefaults may not be changed after constructing a Node"); if (yoga::configUpdateInvalidatesLayout(config_, config)) { markDirtyAndPropagate(); @@ -277,7 +290,7 @@ void YGNode::setConfig(YGConfigRef config) { config_ = config; } -void YGNode::setDirty(bool isDirty) { +void Node::setDirty(bool isDirty) { if (isDirty == flags_.isDirty) { return; } @@ -287,8 +300,8 @@ void YGNode::setDirty(bool isDirty) { } } -bool YGNode::removeChild(YGNodeRef child) { - std::vector::iterator p = +bool Node::removeChild(Node* child) { + std::vector::iterator p = std::find(children_.begin(), children_.end(), child); if (p != children_.end()) { children_.erase(p); @@ -297,73 +310,72 @@ bool YGNode::removeChild(YGNodeRef child) { return false; } -void YGNode::removeChild(uint32_t index) { +void Node::removeChild(uint32_t index) { children_.erase(children_.begin() + index); } -void YGNode::setLayoutDirection(YGDirection direction) { +void Node::setLayoutDirection(YGDirection direction) { layout_.setDirection(direction); } -void YGNode::setLayoutMargin(float margin, int index) { +void Node::setLayoutMargin(float margin, int index) { layout_.margin[index] = margin; } -void YGNode::setLayoutBorder(float border, int index) { +void Node::setLayoutBorder(float border, int index) { layout_.border[index] = border; } -void YGNode::setLayoutPadding(float padding, int index) { +void Node::setLayoutPadding(float padding, int index) { layout_.padding[index] = padding; } -void YGNode::setLayoutLastOwnerDirection(YGDirection direction) { +void Node::setLayoutLastOwnerDirection(YGDirection direction) { layout_.lastOwnerDirection = direction; } -void YGNode::setLayoutComputedFlexBasis( - const YGFloatOptional computedFlexBasis) { +void Node::setLayoutComputedFlexBasis(const FloatOptional computedFlexBasis) { layout_.computedFlexBasis = computedFlexBasis; } -void YGNode::setLayoutPosition(float position, int index) { +void Node::setLayoutPosition(float position, int index) { layout_.position[index] = position; } -void YGNode::setLayoutComputedFlexBasisGeneration( +void Node::setLayoutComputedFlexBasisGeneration( uint32_t computedFlexBasisGeneration) { layout_.computedFlexBasisGeneration = computedFlexBasisGeneration; } -void YGNode::setLayoutMeasuredDimension(float measuredDimension, int index) { +void Node::setLayoutMeasuredDimension(float measuredDimension, int index) { layout_.measuredDimensions[index] = measuredDimension; } -void YGNode::setLayoutHadOverflow(bool hadOverflow) { +void Node::setLayoutHadOverflow(bool hadOverflow) { layout_.setHadOverflow(hadOverflow); } -void YGNode::setLayoutDimension(float dimension, int index) { +void Node::setLayoutDimension(float dimension, int index) { layout_.dimensions[index] = dimension; } // If both left and right are defined, then use left. Otherwise return +left or // -right depending on which is defined. -YGFloatOptional YGNode::relativePosition( +FloatOptional Node::relativePosition( const YGFlexDirection axis, const float axisSize) const { if (isLeadingPositionDefined(axis)) { return getLeadingPosition(axis, axisSize); } - YGFloatOptional trailingPosition = getTrailingPosition(axis, axisSize); + FloatOptional trailingPosition = getTrailingPosition(axis, axisSize); if (!trailingPosition.isUndefined()) { - trailingPosition = YGFloatOptional{-1 * trailingPosition.unwrap()}; + trailingPosition = FloatOptional{-1 * trailingPosition.unwrap()}; } return trailingPosition; } -void YGNode::setPosition( +void Node::setPosition( const YGDirection direction, const float mainSize, const float crossSize, @@ -373,52 +385,51 @@ void YGNode::setPosition( const YGDirection directionRespectingRoot = owner_ != nullptr ? direction : YGDirectionLTR; const YGFlexDirection mainAxis = - YGResolveFlexDirection(style_.flexDirection(), directionRespectingRoot); + yoga::resolveDirection(style_.flexDirection(), directionRespectingRoot); const YGFlexDirection crossAxis = - YGFlexDirectionCross(mainAxis, directionRespectingRoot); + yoga::resolveCrossDirection(mainAxis, directionRespectingRoot); // Here we should check for `YGPositionTypeStatic` and in this case zero inset // properties (left, right, top, bottom, begin, end). // https://www.w3.org/TR/css-position-3/#valdef-position-static - const YGFloatOptional relativePositionMain = + const FloatOptional relativePositionMain = relativePosition(mainAxis, mainSize); - const YGFloatOptional relativePositionCross = + const FloatOptional relativePositionCross = relativePosition(crossAxis, crossSize); setLayoutPosition( (getLeadingMargin(mainAxis, ownerWidth) + relativePositionMain).unwrap(), - leading[mainAxis]); + leadingEdge(mainAxis)); setLayoutPosition( (getTrailingMargin(mainAxis, ownerWidth) + relativePositionMain).unwrap(), - trailing[mainAxis]); + trailingEdge(mainAxis)); setLayoutPosition( (getLeadingMargin(crossAxis, ownerWidth) + relativePositionCross) .unwrap(), - leading[crossAxis]); + leadingEdge(crossAxis)); setLayoutPosition( (getTrailingMargin(crossAxis, ownerWidth) + relativePositionCross) .unwrap(), - trailing[crossAxis]); + trailingEdge(crossAxis)); } -YGValue YGNode::marginLeadingValue(const YGFlexDirection axis) const { - if (YGFlexDirectionIsRow(axis) && - !style_.margin()[YGEdgeStart].isUndefined()) { +YGValue Node::marginLeadingValue(const YGFlexDirection axis) const { + if (isRow(axis) && !style_.margin()[YGEdgeStart].isUndefined()) { return style_.margin()[YGEdgeStart]; } else { - return style_.margin()[leading[axis]]; + return style_.margin()[leadingEdge(axis)]; } } -YGValue YGNode::marginTrailingValue(const YGFlexDirection axis) const { - if (YGFlexDirectionIsRow(axis) && !style_.margin()[YGEdgeEnd].isUndefined()) { +YGValue Node::marginTrailingValue(const YGFlexDirection axis) const { + if (isRow(axis) && !style_.margin()[YGEdgeEnd].isUndefined()) { return style_.margin()[YGEdgeEnd]; } else { - return style_.margin()[trailing[axis]]; + return style_.margin()[trailingEdge(axis)]; } } -YGValue YGNode::resolveFlexBasisPtr() const { +YGValue Node::resolveFlexBasisPtr() const { YGValue flexBasis = style_.flexBasis(); if (flexBasis.unit != YGUnitAuto && flexBasis.unit != YGUnitUndefined) { return flexBasis; @@ -429,12 +440,13 @@ YGValue YGNode::resolveFlexBasisPtr() const { return YGValueAuto; } -void YGNode::resolveDimension() { +void Node::resolveDimension() { using namespace yoga; - const YGStyle& style = getStyle(); + const Style& style = getStyle(); for (auto dim : {YGDimensionWidth, YGDimensionHeight}) { if (!style.maxDimensions()[dim].isUndefined() && - YGValueEqual(style.maxDimensions()[dim], style.minDimensions()[dim])) { + yoga::inexactEquals( + style.maxDimensions()[dim], style.minDimensions()[dim])) { resolvedDimensions_[dim] = style.maxDimensions()[dim]; } else { resolvedDimensions_[dim] = style.dimensions()[dim]; @@ -442,7 +454,7 @@ void YGNode::resolveDimension() { } } -YGDirection YGNode::resolveDirection(const YGDirection ownerDirection) { +YGDirection Node::resolveDirection(const YGDirection ownerDirection) { if (style_.direction() == YGDirectionInherit) { return ownerDirection > YGDirectionInherit ? ownerDirection : YGDirectionLTR; @@ -451,35 +463,35 @@ YGDirection YGNode::resolveDirection(const YGDirection ownerDirection) { } } -YOGA_EXPORT void YGNode::clearChildren() { +YOGA_EXPORT void Node::clearChildren() { children_.clear(); children_.shrink_to_fit(); } // Other Methods -void YGNode::cloneChildrenIfNeeded(void* cloneContext) { - iterChildrenAfterCloningIfNeeded([](YGNodeRef, void*) {}, cloneContext); +void Node::cloneChildrenIfNeeded(void* cloneContext) { + iterChildrenAfterCloningIfNeeded([](Node*, void*) {}, cloneContext); } -void YGNode::markDirtyAndPropagate() { +void Node::markDirtyAndPropagate() { if (!flags_.isDirty) { setDirty(true); - setLayoutComputedFlexBasis(YGFloatOptional()); + setLayoutComputedFlexBasis(FloatOptional()); if (owner_) { owner_->markDirtyAndPropagate(); } } } -void YGNode::markDirtyAndPropagateDownwards() { +void Node::markDirtyAndPropagateDownwards() { flags_.isDirty = true; - for_each(children_.begin(), children_.end(), [](YGNodeRef childNode) { + for_each(children_.begin(), children_.end(), [](Node* childNode) { childNode->markDirtyAndPropagateDownwards(); }); } -float YGNode::resolveFlexGrow() const { +float Node::resolveFlexGrow() const { // Root nodes flexGrow should always be 0 if (owner_ == nullptr) { return 0.0; @@ -490,10 +502,10 @@ float YGNode::resolveFlexGrow() const { if (!style_.flex().isUndefined() && style_.flex().unwrap() > 0.0f) { return style_.flex().unwrap(); } - return kDefaultFlexGrow; + return Style::DefaultFlexGrow; } -float YGNode::resolveFlexShrink() const { +float Node::resolveFlexShrink() const { if (owner_ == nullptr) { return 0.0; } @@ -504,81 +516,93 @@ float YGNode::resolveFlexShrink() const { style_.flex().unwrap() < 0.0f) { return -style_.flex().unwrap(); } - return config_->useWebDefaults() ? kWebDefaultFlexShrink : kDefaultFlexShrink; + return config_->useWebDefaults() ? Style::WebDefaultFlexShrink + : Style::DefaultFlexShrink; } -bool YGNode::isNodeFlexible() { +bool Node::isNodeFlexible() { return ( (style_.positionType() != YGPositionTypeAbsolute) && (resolveFlexGrow() != 0 || resolveFlexShrink() != 0)); } -float YGNode::getLeadingBorder(const YGFlexDirection axis) const { - YGValue leadingBorder = YGFlexDirectionIsRow(axis) +float Node::getLeadingBorder(const YGFlexDirection axis) const { + YGValue leadingBorder = isRow(axis) ? computeEdgeValueForRow( - style_.border(), YGEdgeStart, leading[axis], CompactValue::ofZero()) + style_.border(), + YGEdgeStart, + leadingEdge(axis), + CompactValue::ofZero()) : computeEdgeValueForColumn( - style_.border(), leading[axis], CompactValue::ofZero()); + style_.border(), leadingEdge(axis), CompactValue::ofZero()); return fmaxf(leadingBorder.value, 0.0f); } -float YGNode::getTrailingBorder(const YGFlexDirection axis) const { - YGValue trailingBorder = YGFlexDirectionIsRow(axis) +float Node::getTrailingBorder(const YGFlexDirection axis) const { + YGValue trailingBorder = isRow(axis) ? computeEdgeValueForRow( - style_.border(), YGEdgeEnd, trailing[axis], CompactValue::ofZero()) + style_.border(), + YGEdgeEnd, + trailingEdge(axis), + CompactValue::ofZero()) : computeEdgeValueForColumn( - style_.border(), trailing[axis], CompactValue::ofZero()); + style_.border(), trailingEdge(axis), CompactValue::ofZero()); return fmaxf(trailingBorder.value, 0.0f); } -YGFloatOptional YGNode::getLeadingPadding( +FloatOptional Node::getLeadingPadding( const YGFlexDirection axis, const float widthSize) const { - auto leadingPadding = YGFlexDirectionIsRow(axis) + auto leadingPadding = isRow(axis) ? computeEdgeValueForRow( style_.padding(), YGEdgeStart, - leading[axis], + leadingEdge(axis), CompactValue::ofZero()) : computeEdgeValueForColumn( - style_.padding(), leading[axis], CompactValue::ofZero()); - return YGFloatOptionalMax( - YGResolveValue(leadingPadding, widthSize), YGFloatOptional(0.0f)); + style_.padding(), leadingEdge(axis), CompactValue::ofZero()); + return yoga::maxOrDefined( + yoga::resolveValue(leadingPadding, widthSize), FloatOptional(0.0f)); } -YGFloatOptional YGNode::getTrailingPadding( +FloatOptional Node::getTrailingPadding( const YGFlexDirection axis, const float widthSize) const { - auto trailingPadding = YGFlexDirectionIsRow(axis) + auto trailingPadding = isRow(axis) ? computeEdgeValueForRow( - style_.padding(), YGEdgeEnd, trailing[axis], CompactValue::ofZero()) + style_.padding(), + YGEdgeEnd, + trailingEdge(axis), + CompactValue::ofZero()) : computeEdgeValueForColumn( - style_.padding(), trailing[axis], CompactValue::ofZero()); - return YGFloatOptionalMax( - YGResolveValue(trailingPadding, widthSize), YGFloatOptional(0.0f)); + style_.padding(), trailingEdge(axis), CompactValue::ofZero()); + return yoga::maxOrDefined( + yoga::resolveValue(trailingPadding, widthSize), FloatOptional(0.0f)); } -YGFloatOptional YGNode::getLeadingPaddingAndBorder( +FloatOptional Node::getLeadingPaddingAndBorder( const YGFlexDirection axis, const float widthSize) const { return getLeadingPadding(axis, widthSize) + - YGFloatOptional(getLeadingBorder(axis)); + FloatOptional(getLeadingBorder(axis)); } -YGFloatOptional YGNode::getTrailingPaddingAndBorder( +FloatOptional Node::getTrailingPaddingAndBorder( const YGFlexDirection axis, const float widthSize) const { return getTrailingPadding(axis, widthSize) + - YGFloatOptional(getTrailingBorder(axis)); + FloatOptional(getTrailingBorder(axis)); } -void YGNode::reset() { - YGAssertWithNode( +void Node::reset() { + yoga::assertFatalWithNode( this, children_.size() == 0, "Cannot reset a node which still has children attached"); - YGAssertWithNode( + yoga::assertFatalWithNode( this, owner_ == nullptr, "Cannot reset a node still attached to a owner"); - *this = YGNode{getConfig()}; + *this = Node{getConfig()}; } + +} // namespace facebook::yoga diff --git a/yoga/YGNode.h b/yoga/node/Node.h similarity index 72% rename from yoga/YGNode.h rename to yoga/node/Node.h index e3c202f2b9..5401d90b6b 100644 --- a/yoga/YGNode.h +++ b/yoga/node/Node.h @@ -9,17 +9,21 @@ #include #include -#include "CompactValue.h" -#include "YGConfig.h" -#include "YGLayout.h" -#include "YGStyle.h" -#include "Yoga-internal.h" +#include -YGConfigRef YGConfigGetDefault(); +#include +#include +#include +#include + +// Tag struct used to form the opaque YGNodeRef for the public C API +struct YGNode {}; + +namespace facebook::yoga { #pragma pack(push) #pragma pack(1) -struct YGNodeFlags { +struct NodeFlags { bool hasNewLayout : 1; bool isReferenceBaseline : 1; bool isDirty : 1; @@ -30,7 +34,8 @@ struct YGNodeFlags { }; #pragma pack(pop) -struct YOGA_EXPORT YGNode { +class YOGA_EXPORT Node : public ::YGNode { +public: using MeasureWithContextFn = YGSize (*)(YGNode*, float, YGMeasureMode, float, YGMeasureMode, void*); using BaselineWithContextFn = float (*)(YGNode*, float, float, void*); @@ -38,7 +43,7 @@ struct YOGA_EXPORT YGNode { private: void* context_ = nullptr; - YGNodeFlags flags_ = {}; + NodeFlags flags_ = {}; union { YGMeasureFunc noContext; MeasureWithContextFn withContext; @@ -52,16 +57,16 @@ struct YOGA_EXPORT YGNode { PrintWithContextFn withContext; } print_ = {nullptr}; YGDirtiedFunc dirtied_ = nullptr; - YGStyle style_ = {}; - YGLayout layout_ = {}; + Style style_ = {}; + LayoutResults layout_ = {}; uint32_t lineIndex_ = 0; - YGNodeRef owner_ = nullptr; - YGVector children_ = {}; - YGConfigRef config_; + Node* owner_ = nullptr; + std::vector children_ = {}; + Config* config_; std::array resolvedDimensions_ = { {YGValueUndefined, YGValueUndefined}}; - YGFloatOptional relativePosition( + FloatOptional relativePosition( const YGFlexDirection axis, const float axisSize) const; @@ -78,24 +83,24 @@ struct YOGA_EXPORT YGNode { // them (potentially incorrect) or ignore them (danger of leaks). Only ever // use this after checking that there are no children. // DO NOT CHANGE THE VISIBILITY OF THIS METHOD! - YGNode& operator=(YGNode&&) = default; - - using CompactValue = facebook::yoga::detail::CompactValue; + Node& operator=(Node&&) = default; public: - YGNode() : YGNode{YGConfigGetDefault()} { flags_.hasNewLayout = true; } - explicit YGNode(const YGConfigRef config); - ~YGNode() = default; // cleanup of owner/children relationships in YGNodeFree + Node() : Node{static_cast(YGConfigGetDefault())} { + flags_.hasNewLayout = true; + } + explicit Node(Config* config); + ~Node() = default; // cleanup of owner/children relationships in YGNodeFree - YGNode(YGNode&&); + Node(Node&&); // Does not expose true value semantics, as children are not cloned eagerly. // Should we remove this? - YGNode(const YGNode& node) = default; + Node(const Node& node) = default; // assignment means potential leaks of existing children, or alternatively // freeing unowned memory, double free, or freeing stack memory. - YGNode& operator=(const YGNode&) = delete; + Node& operator=(const Node&) = delete; // Getters void* getContext() const { return context_; } @@ -123,38 +128,39 @@ struct YOGA_EXPORT YGNode { YGDirtiedFunc getDirtied() const { return dirtied_; } // For Performance reasons passing as reference. - YGStyle& getStyle() { return style_; } + Style& getStyle() { return style_; } - const YGStyle& getStyle() const { return style_; } + const Style& getStyle() const { return style_; } // For Performance reasons passing as reference. - YGLayout& getLayout() { return layout_; } + LayoutResults& getLayout() { return layout_; } - const YGLayout& getLayout() const { return layout_; } + const LayoutResults& getLayout() const { return layout_; } uint32_t getLineIndex() const { return lineIndex_; } bool isReferenceBaseline() { return flags_.isReferenceBaseline; } - // returns the YGNodeRef that owns this YGNode. An owner is used to identify - // the YogaTree that a YGNode belongs to. This method will return the parent - // of the YGNode when a YGNode only belongs to one YogaTree or nullptr when - // the YGNode is shared between two or more YogaTrees. - YGNodeRef getOwner() const { return owner_; } + // returns the Node that owns this Node. An owner is used to identify + // the YogaTree that a Node belongs to. This method will return the parent + // of the Node when a Node only belongs to one YogaTree or nullptr when + // the Node is shared between two or more YogaTrees. + Node* getOwner() const { return owner_; } // Deprecated, use getOwner() instead. - YGNodeRef getParent() const { return getOwner(); } + Node* getParent() const { return getOwner(); } - const YGVector& getChildren() const { return children_; } + const std::vector& getChildren() const { return children_; } // Applies a callback to all children, after cloning them if they are not // owned. template void iterChildrenAfterCloningIfNeeded(T callback, void* cloneContext) { int i = 0; - for (YGNodeRef& child : children_) { + for (Node*& child : children_) { if (child->getOwner() != this) { - child = config_->cloneNode(child, this, i, cloneContext); + child = static_cast( + config_->cloneNode(child, this, i, cloneContext)); child->setOwner(this); } i += 1; @@ -163,9 +169,9 @@ struct YOGA_EXPORT YGNode { } } - YGNodeRef getChild(uint32_t index) const { return children_.at(index); } + Node* getChild(uint32_t index) const { return children_.at(index); } - YGConfigRef getConfig() const { return config_; } + Config* getConfig() const { return config_; } bool isDirty() const { return flags_.isDirty; } @@ -178,59 +184,58 @@ struct YOGA_EXPORT YGNode { } static CompactValue computeEdgeValueForColumn( - const YGStyle::Edges& edges, + const Style::Edges& edges, YGEdge edge, CompactValue defaultValue); static CompactValue computeEdgeValueForRow( - const YGStyle::Edges& edges, + const Style::Edges& edges, YGEdge rowEdge, YGEdge edge, CompactValue defaultValue); static CompactValue computeRowGap( - const YGStyle::Gutters& gutters, + const Style::Gutters& gutters, CompactValue defaultValue); static CompactValue computeColumnGap( - const YGStyle::Gutters& gutters, + const Style::Gutters& gutters, CompactValue defaultValue); // Methods related to positions, margin, padding and border - YGFloatOptional getLeadingPosition( + FloatOptional getLeadingPosition( const YGFlexDirection axis, const float axisSize) const; bool isLeadingPositionDefined(const YGFlexDirection axis) const; bool isTrailingPosDefined(const YGFlexDirection axis) const; - YGFloatOptional getTrailingPosition( + FloatOptional getTrailingPosition( const YGFlexDirection axis, const float axisSize) const; - YGFloatOptional getLeadingMargin( + FloatOptional getLeadingMargin( const YGFlexDirection axis, const float widthSize) const; - YGFloatOptional getTrailingMargin( + FloatOptional getTrailingMargin( const YGFlexDirection axis, const float widthSize) const; float getLeadingBorder(const YGFlexDirection flexDirection) const; float getTrailingBorder(const YGFlexDirection flexDirection) const; - YGFloatOptional getLeadingPadding( - const YGFlexDirection axis, - const float widthSize) const; - YGFloatOptional getTrailingPadding( + FloatOptional getLeadingPadding( const YGFlexDirection axis, const float widthSize) const; - YGFloatOptional getLeadingPaddingAndBorder( + FloatOptional getTrailingPadding( const YGFlexDirection axis, const float widthSize) const; - YGFloatOptional getTrailingPaddingAndBorder( + FloatOptional getLeadingPaddingAndBorder( const YGFlexDirection axis, const float widthSize) const; - YGFloatOptional getMarginForAxis( + FloatOptional getTrailingPaddingAndBorder( const YGFlexDirection axis, const float widthSize) const; - YGFloatOptional getGapForAxis( + FloatOptional getMarginForAxis( const YGFlexDirection axis, const float widthSize) const; + FloatOptional getGapForAxis(const YGFlexDirection axis, const float widthSize) + const; // Setters void setContext(void* context) { context_ = context; } @@ -273,9 +278,9 @@ struct YOGA_EXPORT YGNode { void setDirtiedFunc(YGDirtiedFunc dirtiedFunc) { dirtied_ = dirtiedFunc; } - void setStyle(const YGStyle& style) { style_ = style; } + void setStyle(const Style& style) { style_ = style; } - void setLayout(const YGLayout& layout) { layout_ = layout; } + void setLayout(const LayoutResults& layout) { layout_ = layout; } void setLineIndex(uint32_t lineIndex) { lineIndex_ = lineIndex; } @@ -283,17 +288,17 @@ struct YOGA_EXPORT YGNode { flags_.isReferenceBaseline = isReferenceBaseline; } - void setOwner(YGNodeRef owner) { owner_ = owner; } + void setOwner(Node* owner) { owner_ = owner; } - void setChildren(const YGVector& children) { children_ = children; } + void setChildren(const std::vector& children) { children_ = children; } // TODO: rvalue override for setChildren - void setConfig(YGConfigRef config); + void setConfig(Config* config); void setDirty(bool isDirty); void setLayoutLastOwnerDirection(YGDirection direction); - void setLayoutComputedFlexBasis(const YGFloatOptional computedFlexBasis); + void setLayoutComputedFlexBasis(const FloatOptional computedFlexBasis); void setLayoutComputedFlexBasisGeneration( uint32_t computedFlexBasisGeneration); void setLayoutMeasuredDimension(float measuredDimension, int index); @@ -319,11 +324,11 @@ struct YOGA_EXPORT YGNode { YGDirection resolveDirection(const YGDirection ownerDirection); void clearChildren(); /// Replaces the occurrences of oldChild with newChild - void replaceChild(YGNodeRef oldChild, YGNodeRef newChild); - void replaceChild(YGNodeRef child, uint32_t index); - void insertChild(YGNodeRef child, uint32_t index); + void replaceChild(Node* oldChild, Node* newChild); + void replaceChild(Node* child, uint32_t index); + void insertChild(Node* child, uint32_t index); /// Removes the first occurrence of child - bool removeChild(YGNodeRef child); + bool removeChild(Node* child); void removeChild(uint32_t index); void cloneChildrenIfNeeded(void*); @@ -333,3 +338,5 @@ struct YOGA_EXPORT YGNode { bool isNodeFlexible(); void reset(); }; + +} // namespace facebook::yoga diff --git a/yoga/numeric/Comparison.h b/yoga/numeric/Comparison.h new file mode 100644 index 0000000000..aa9f933efd --- /dev/null +++ b/yoga/numeric/Comparison.h @@ -0,0 +1,92 @@ +/* + * 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. + */ + +#pragma once + +#include + +#include +#include +#include + +namespace facebook::yoga { + +template +inline bool isUndefined(FloatT value) { + return std::isnan(value); +} + +inline float maxOrDefined(const float a, const float b) { + if (!yoga::isUndefined(a) && !yoga::isUndefined(b)) { + return fmaxf(a, b); + } + return yoga::isUndefined(a) ? b : a; +} + +inline float minOrDefined(const float a, const float b) { + if (!yoga::isUndefined(a) && !yoga::isUndefined(b)) { + return fminf(a, b); + } + + return yoga::isUndefined(a) ? b : a; +} + +inline FloatOptional maxOrDefined(FloatOptional op1, FloatOptional op2) { + if (op1 >= op2) { + return op1; + } + if (op2 > op1) { + return op2; + } + return op1.isUndefined() ? op2 : op1; +} + +// Custom equality functions using a hardcoded epsilon of 0.0001f, or returning +// true if both floats are NaN. +inline bool inexactEquals(const float a, const float b) { + if (!yoga::isUndefined(a) && !yoga::isUndefined(b)) { + return fabs(a - b) < 0.0001f; + } + return yoga::isUndefined(a) && yoga::isUndefined(b); +} + +inline bool inexactEquals(const double a, const double b) { + if (!yoga::isUndefined(a) && !yoga::isUndefined(b)) { + return fabs(a - b) < 0.0001; + } + return yoga::isUndefined(a) && yoga::isUndefined(b); +} + +inline bool inexactEquals(const YGValue& a, const YGValue& b) { + if (a.unit != b.unit) { + return false; + } + + if (a.unit == YGUnitUndefined || + (yoga::isUndefined(a.value) && yoga::isUndefined(b.value))) { + return true; + } + + return fabs(a.value - b.value) < 0.0001f; +} + +inline bool inexactEquals(CompactValue a, CompactValue b) { + return inexactEquals((YGValue) a, (YGValue) b); +} + +template +bool inexactEquals( + const std::array& val1, + const std::array& val2) { + bool areEqual = true; + for (std::size_t i = 0; i < Size && areEqual; ++i) { + areEqual = inexactEquals(val1[i], val2[i]); + } + return areEqual; +} + +} // namespace facebook::yoga diff --git a/yoga/numeric/FloatOptional.h b/yoga/numeric/FloatOptional.h new file mode 100644 index 0000000000..a36befe609 --- /dev/null +++ b/yoga/numeric/FloatOptional.h @@ -0,0 +1,73 @@ +/* + * 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. + */ + +#pragma once + +#include +#include + +namespace facebook::yoga { + +struct FloatOptional { +private: + float value_ = std::numeric_limits::quiet_NaN(); + +public: + explicit constexpr FloatOptional(float value) : value_(value) {} + constexpr FloatOptional() = default; + + // returns the wrapped value, or a value x with YGIsUndefined(x) == true + constexpr float unwrap() const { return value_; } + + bool isUndefined() const { return std::isnan(value_); } +}; + +// operators take FloatOptional by value, as it is a 32bit value + +inline bool operator==(FloatOptional lhs, FloatOptional rhs) { + return lhs.unwrap() == rhs.unwrap() || + (lhs.isUndefined() && rhs.isUndefined()); +} +inline bool operator!=(FloatOptional lhs, FloatOptional rhs) { + return !(lhs == rhs); +} + +inline bool operator==(FloatOptional lhs, float rhs) { + return lhs == FloatOptional{rhs}; +} +inline bool operator!=(FloatOptional lhs, float rhs) { + return !(lhs == rhs); +} + +inline bool operator==(float lhs, FloatOptional rhs) { + return rhs == lhs; +} +inline bool operator!=(float lhs, FloatOptional rhs) { + return !(lhs == rhs); +} + +inline FloatOptional operator+(FloatOptional lhs, FloatOptional rhs) { + return FloatOptional{lhs.unwrap() + rhs.unwrap()}; +} + +inline bool operator>(FloatOptional lhs, FloatOptional rhs) { + return lhs.unwrap() > rhs.unwrap(); +} + +inline bool operator<(FloatOptional lhs, FloatOptional rhs) { + return lhs.unwrap() < rhs.unwrap(); +} + +inline bool operator>=(FloatOptional lhs, FloatOptional rhs) { + return lhs > rhs || lhs == rhs; +} + +inline bool operator<=(FloatOptional lhs, FloatOptional rhs) { + return lhs < rhs || lhs == rhs; +} + +} // namespace facebook::yoga diff --git a/yoga/CompactValue.h b/yoga/style/CompactValue.h similarity index 98% rename from yoga/CompactValue.h rename to yoga/style/CompactValue.h index 9d49450011..498b984a70 100644 --- a/yoga/CompactValue.h +++ b/yoga/style/CompactValue.h @@ -38,7 +38,7 @@ static_assert( #define VISIBLE_FOR_TESTING private: #endif -namespace facebook::yoga::detail { +namespace facebook::yoga { // This class stores YGValue in 32 bits. // - The value does not matter for Undefined and Auto. NaNs are used for their @@ -207,4 +207,4 @@ constexpr bool operator!=(CompactValue a, CompactValue b) noexcept { return !(a == b); } -} // namespace facebook::yoga::detail +} // namespace facebook::yoga diff --git a/yoga/YGStyle.cpp b/yoga/style/Style.cpp similarity index 89% rename from yoga/YGStyle.cpp rename to yoga/style/Style.cpp index 37153f2e92..fc26834702 100644 --- a/yoga/YGStyle.cpp +++ b/yoga/style/Style.cpp @@ -5,11 +5,13 @@ * LICENSE file in the root directory of this source tree. */ -#include "YGStyle.h" -#include "Utils.h" +#include +#include + +namespace facebook::yoga { // Yoga specific properties, not compatible with flexbox specification -bool operator==(const YGStyle& lhs, const YGStyle& rhs) { +bool operator==(const Style& lhs, const Style& rhs) { bool areNonFloatValuesEqual = lhs.direction() == rhs.direction() && lhs.flexDirection() == rhs.flexDirection() && lhs.justifyContent() == rhs.justifyContent() && @@ -19,7 +21,7 @@ bool operator==(const YGStyle& lhs, const YGStyle& rhs) { lhs.positionType() == rhs.positionType() && lhs.flexWrap() == rhs.flexWrap() && lhs.overflow() == rhs.overflow() && lhs.display() == rhs.display() && - YGValueEqual(lhs.flexBasis(), rhs.flexBasis()) && + yoga::inexactEquals(lhs.flexBasis(), rhs.flexBasis()) && lhs.margin() == rhs.margin() && lhs.position() == rhs.position() && lhs.padding() == rhs.padding() && lhs.border() == rhs.border() && lhs.gap() == rhs.gap() && lhs.dimensions() == rhs.dimensions() && @@ -54,3 +56,5 @@ bool operator==(const YGStyle& lhs, const YGStyle& rhs) { return areNonFloatValuesEqual; } + +} // namespace facebook::yoga diff --git a/yoga/YGStyle.h b/yoga/style/Style.h similarity index 52% rename from yoga/YGStyle.h rename to yoga/style/Style.h index 4f182d0691..7b3ca9dd2d 100644 --- a/yoga/YGStyle.h +++ b/yoga/style/Style.h @@ -14,38 +14,39 @@ #include -#include "CompactValue.h" -#include "YGFloatOptional.h" -#include "Yoga-internal.h" -#include "BitUtils.h" +#include +#include +#include -class YOGA_EXPORT YGStyle { +namespace facebook::yoga { + +class YOGA_EXPORT Style { template - using Values = - facebook::yoga::detail::Values()>; - using CompactValue = facebook::yoga::detail::CompactValue; + using Values = std::array()>; public: using Dimensions = Values; using Edges = Values; using Gutters = Values; + static constexpr float DefaultFlexGrow = 0.0f; + static constexpr float DefaultFlexShrink = 0.0f; + static constexpr float WebDefaultFlexShrink = 1.0f; + template struct BitfieldRef { - YGStyle& style; + Style& style; size_t offset; - operator T() const { - return facebook::yoga::detail::getEnumData(style.flags, offset); - } + operator T() const { return getEnumData(style.flags, offset); } BitfieldRef& operator=(T x) { - facebook::yoga::detail::setEnumData(style.flags, offset, x); + setEnumData(style.flags, offset, x); return *this; } }; - template + template struct Ref { - YGStyle& style; + Style& style; operator T() const { return style.*Prop; } Ref& operator=(T value) { style.*Prop = value; @@ -53,10 +54,10 @@ class YOGA_EXPORT YGStyle { } }; - template YGStyle::*Prop> + template Style::*Prop> struct IdxRef { struct Ref { - YGStyle& style; + Style& style; Idx idx; operator CompactValue() const { return (style.*Prop)[idx]; } operator YGValue() const { return (style.*Prop)[idx]; } @@ -66,7 +67,7 @@ class YOGA_EXPORT YGStyle { } }; - YGStyle& style; + Style& style; IdxRef& operator=(const Values& values) { style.*Prop = values; return *this; @@ -76,163 +77,155 @@ class YOGA_EXPORT YGStyle { CompactValue operator[](Idx idx) const { return (style.*Prop)[idx]; } }; - YGStyle() { + Style() { alignContent() = YGAlignFlexStart; alignItems() = YGAlignStretch; } - ~YGStyle() = default; + ~Style() = default; private: static constexpr size_t directionOffset = 0; static constexpr size_t flexdirectionOffset = - directionOffset + facebook::yoga::detail::bitWidthFn(); - static constexpr size_t justifyContentOffset = flexdirectionOffset + - facebook::yoga::detail::bitWidthFn(); + directionOffset + minimumBitCount(); + static constexpr size_t justifyContentOffset = + flexdirectionOffset + minimumBitCount(); static constexpr size_t alignContentOffset = - justifyContentOffset + facebook::yoga::detail::bitWidthFn(); + justifyContentOffset + minimumBitCount(); static constexpr size_t alignItemsOffset = - alignContentOffset + facebook::yoga::detail::bitWidthFn(); + alignContentOffset + minimumBitCount(); static constexpr size_t alignSelfOffset = - alignItemsOffset + facebook::yoga::detail::bitWidthFn(); + alignItemsOffset + minimumBitCount(); static constexpr size_t positionTypeOffset = - alignSelfOffset + facebook::yoga::detail::bitWidthFn(); + alignSelfOffset + minimumBitCount(); static constexpr size_t flexWrapOffset = - positionTypeOffset + facebook::yoga::detail::bitWidthFn(); + positionTypeOffset + minimumBitCount(); static constexpr size_t overflowOffset = - flexWrapOffset + facebook::yoga::detail::bitWidthFn(); + flexWrapOffset + minimumBitCount(); static constexpr size_t displayOffset = - overflowOffset + facebook::yoga::detail::bitWidthFn(); + overflowOffset + minimumBitCount(); uint32_t flags = 0; - YGFloatOptional flex_ = {}; - YGFloatOptional flexGrow_ = {}; - YGFloatOptional flexShrink_ = {}; + FloatOptional flex_ = {}; + FloatOptional flexGrow_ = {}; + FloatOptional flexShrink_ = {}; CompactValue flexBasis_ = CompactValue::ofAuto(); Edges margin_ = {}; Edges position_ = {}; Edges padding_ = {}; Edges border_ = {}; Gutters gap_ = {}; - Dimensions dimensions_{CompactValue::ofAuto()}; + Dimensions dimensions_{CompactValue::ofAuto(), CompactValue::ofAuto()}; Dimensions minDimensions_ = {}; Dimensions maxDimensions_ = {}; // Yoga specific properties, not compatible with flexbox specification - YGFloatOptional aspectRatio_ = {}; + FloatOptional aspectRatio_ = {}; public: // for library users needing a type using ValueRepr = std::remove_reference::type; YGDirection direction() const { - return facebook::yoga::detail::getEnumData( - flags, directionOffset); + return getEnumData(flags, directionOffset); } BitfieldRef direction() { return {*this, directionOffset}; } YGFlexDirection flexDirection() const { - return facebook::yoga::detail::getEnumData( - flags, flexdirectionOffset); + return getEnumData(flags, flexdirectionOffset); } BitfieldRef flexDirection() { return {*this, flexdirectionOffset}; } YGJustify justifyContent() const { - return facebook::yoga::detail::getEnumData( - flags, justifyContentOffset); + return getEnumData(flags, justifyContentOffset); } BitfieldRef justifyContent() { return {*this, justifyContentOffset}; } YGAlign alignContent() const { - return facebook::yoga::detail::getEnumData( - flags, alignContentOffset); + return getEnumData(flags, alignContentOffset); } BitfieldRef alignContent() { return {*this, alignContentOffset}; } YGAlign alignItems() const { - return facebook::yoga::detail::getEnumData( - flags, alignItemsOffset); + return getEnumData(flags, alignItemsOffset); } BitfieldRef alignItems() { return {*this, alignItemsOffset}; } YGAlign alignSelf() const { - return facebook::yoga::detail::getEnumData(flags, alignSelfOffset); + return getEnumData(flags, alignSelfOffset); } BitfieldRef alignSelf() { return {*this, alignSelfOffset}; } YGPositionType positionType() const { - return facebook::yoga::detail::getEnumData( - flags, positionTypeOffset); + return getEnumData(flags, positionTypeOffset); } BitfieldRef positionType() { return {*this, positionTypeOffset}; } - YGWrap flexWrap() const { - return facebook::yoga::detail::getEnumData(flags, flexWrapOffset); - } + YGWrap flexWrap() const { return getEnumData(flags, flexWrapOffset); } BitfieldRef flexWrap() { return {*this, flexWrapOffset}; } YGOverflow overflow() const { - return facebook::yoga::detail::getEnumData( - flags, overflowOffset); + return getEnumData(flags, overflowOffset); } BitfieldRef overflow() { return {*this, overflowOffset}; } YGDisplay display() const { - return facebook::yoga::detail::getEnumData(flags, displayOffset); + return getEnumData(flags, displayOffset); } BitfieldRef display() { return {*this, displayOffset}; } - YGFloatOptional flex() const { return flex_; } - Ref flex() { return {*this}; } + FloatOptional flex() const { return flex_; } + Ref flex() { return {*this}; } - YGFloatOptional flexGrow() const { return flexGrow_; } - Ref flexGrow() { return {*this}; } + FloatOptional flexGrow() const { return flexGrow_; } + Ref flexGrow() { return {*this}; } - YGFloatOptional flexShrink() const { return flexShrink_; } - Ref flexShrink() { return {*this}; } + FloatOptional flexShrink() const { return flexShrink_; } + Ref flexShrink() { return {*this}; } CompactValue flexBasis() const { return flexBasis_; } - Ref flexBasis() { return {*this}; } + Ref flexBasis() { return {*this}; } const Edges& margin() const { return margin_; } - IdxRef margin() { return {*this}; } + IdxRef margin() { return {*this}; } const Edges& position() const { return position_; } - IdxRef position() { return {*this}; } + IdxRef position() { return {*this}; } const Edges& padding() const { return padding_; } - IdxRef padding() { return {*this}; } + IdxRef padding() { return {*this}; } const Edges& border() const { return border_; } - IdxRef border() { return {*this}; } + IdxRef border() { return {*this}; } const Gutters& gap() const { return gap_; } - IdxRef gap() { return {*this}; } + IdxRef gap() { return {*this}; } const Dimensions& dimensions() const { return dimensions_; } - IdxRef dimensions() { return {*this}; } + IdxRef dimensions() { return {*this}; } const Dimensions& minDimensions() const { return minDimensions_; } - IdxRef minDimensions() { + IdxRef minDimensions() { return {*this}; } const Dimensions& maxDimensions() const { return maxDimensions_; } - IdxRef maxDimensions() { + IdxRef maxDimensions() { return {*this}; } // Yoga specific properties, not compatible with flexbox specification - YGFloatOptional aspectRatio() const { return aspectRatio_; } - Ref aspectRatio() { return {*this}; } + FloatOptional aspectRatio() const { return aspectRatio_; } + Ref aspectRatio() { return {*this}; } }; -YOGA_EXPORT bool operator==(const YGStyle& lhs, const YGStyle& rhs); -YOGA_EXPORT inline bool operator!=(const YGStyle& lhs, const YGStyle& rhs) { +YOGA_EXPORT bool operator==(const Style& lhs, const Style& rhs); +YOGA_EXPORT inline bool operator!=(const Style& lhs, const Style& rhs) { return !(lhs == rhs); } +} // namespace facebook::yoga