mirror of
https://github.com/oven-sh/bun
synced 2026-02-15 21:32:05 +00:00
Changes from background composer bc-10f5dd76-2ef4-41da-a295-47c3ceb3b16e
This commit is contained in:
@@ -1,186 +0,0 @@
|
||||
# Native Yoga Bindings Implementation Summary
|
||||
|
||||
## Completed Phases
|
||||
|
||||
### Phase 1: Project Foundation & Build System Setup ✅
|
||||
1. **Created Core C++ Binding Files:**
|
||||
- `src/bun.js/bindings/JSYogaConfig.h` & `.cpp`
|
||||
- `src/bun.js/bindings/JSYogaNode.h` & `.cpp`
|
||||
- `src/bun.js/bindings/JSYogaPrototype.h` & `.cpp`
|
||||
- `src/bun.js/bindings/JSYogaConstructor.h` & `.cpp`
|
||||
- `src/bun.js/bindings/JSYogaNodeImpl.cpp` (implementation helpers)
|
||||
- `src/bun.js/bindings/JSYogaExports.cpp` (Zig interop)
|
||||
|
||||
2. **Updated Build System:**
|
||||
- Added all new C++ files to `cmake/sources/CxxSources.txt`
|
||||
|
||||
3. **Defined Garbage Collection IsoSubspaces:**
|
||||
- Added declarations to `DOMClientIsoSubspaces.h`
|
||||
- Added declarations to `DOMIsoSubspaces.h`
|
||||
- Implemented subspace templates in each class
|
||||
|
||||
### Phase 2: Implement `Yoga.Config` Class ✅
|
||||
Fully implemented all Config methods:
|
||||
- `constructor()` / `Config.create()`
|
||||
- `setUseWebDefaults(enabled?: boolean)`
|
||||
- `useWebDefaults()` (legacy)
|
||||
- `setExperimentalFeatureEnabled(feature: number, enabled: boolean)`
|
||||
- `isExperimentalFeatureEnabled(feature: number)`
|
||||
- `setPointScaleFactor(factor: number)`
|
||||
- `getPointScaleFactor()`
|
||||
- `setErrata(errata: number)`
|
||||
- `isNodeUsed()`
|
||||
- `free()`
|
||||
|
||||
### Phase 3: Implement `Yoga.Node` Class ✅
|
||||
Implemented the complete Node API:
|
||||
|
||||
#### Core Methods:
|
||||
- `constructor(config?: Config)` / `Node.create(config?: Config)`
|
||||
- `reset()`
|
||||
- `free()`
|
||||
- `markDirty()` / `isDirty()`
|
||||
- `calculateLayout(width?, height?, direction?)`
|
||||
- `getComputedLayout()`
|
||||
|
||||
#### Style Setters (with full value type support):
|
||||
- `setWidth/Height/MinWidth/MinHeight/MaxWidth/MaxHeight(value)`
|
||||
- Supports: number, "auto", "50%", "max-content", "fit-content", "stretch", {unit, value}, undefined/null
|
||||
- `setMargin/Padding/Position(edge, value)`
|
||||
- Supports: number, "auto", "50%", {unit, value}, undefined/null
|
||||
- `setFlexBasis(value)`
|
||||
- `setGap(gutter, gap)`
|
||||
|
||||
#### Style Getters (return {unit, value} objects):
|
||||
- `getWidth/Height/MinWidth/MinHeight/MaxWidth/MaxHeight()`
|
||||
- `getMargin/Padding/Position(edge)`
|
||||
- `getFlexBasis()`
|
||||
|
||||
#### Layout Properties:
|
||||
- `setFlexDirection(direction)`
|
||||
- `setJustifyContent(justify)`
|
||||
- `setAlignItems/Self/Content(align)`
|
||||
- `setFlexWrap(wrap)`
|
||||
- `setPositionType(type)`
|
||||
- `setDisplay(display)`
|
||||
- `setOverflow(overflow)`
|
||||
- `setFlex/FlexGrow/FlexShrink(value)`
|
||||
- `setAspectRatio(ratio)`
|
||||
|
||||
#### Hierarchy Operations:
|
||||
- `insertChild(child, index)`
|
||||
- `removeChild(child)`
|
||||
- `getChildCount()`
|
||||
- `getChild(index)`
|
||||
- `getParent()`
|
||||
|
||||
#### Callbacks:
|
||||
- `setMeasureFunc(callback)` - Custom measurement for leaf nodes
|
||||
- `setDirtiedFunc(callback)` - Notification when node becomes dirty
|
||||
|
||||
## Test Coverage
|
||||
Created comprehensive test files:
|
||||
- `test/js/bun/yoga-config.test.js` - Tests all Config functionality
|
||||
- `test/js/bun/yoga-node.test.js` - Tests complete Node API
|
||||
|
||||
## Key Implementation Details
|
||||
|
||||
### Value Parsing System
|
||||
Created a flexible `parseYogaValue` helper that handles all value types:
|
||||
- Numbers (treated as points)
|
||||
- Strings: "auto", percentages ("50%"), special values
|
||||
- Objects: {unit, value} format
|
||||
- undefined/null (resets to undefined)
|
||||
|
||||
### Memory Management
|
||||
- Proper GC integration with JavaScriptCore
|
||||
- Automatic cleanup in destructors
|
||||
- Manual `free()` methods for early cleanup
|
||||
- Context storage on Yoga nodes for JS wrapper lookup
|
||||
|
||||
### Callback System
|
||||
- Measure functions receive (width, widthMode, height, heightMode)
|
||||
- Dirtied functions receive the node as `this`
|
||||
- Proper exception handling in C++ callbacks
|
||||
|
||||
## Phase 4: Expose Constants to JavaScript ✅
|
||||
|
||||
### Implementation Details
|
||||
Created `JSYogaConstants` class that exposes all Yoga enums as JavaScript constants:
|
||||
- **Files Created:**
|
||||
- `src/bun.js/bindings/JSYogaConstants.h` & `.cpp` - Constants object implementation
|
||||
- `test/js/bun/yoga-constants.test.js` - Test coverage for all constants
|
||||
|
||||
### Constants Exposed
|
||||
All Yoga enum values are exposed as numeric constants on the Yoga object:
|
||||
- Alignment: `ALIGN_AUTO`, `ALIGN_FLEX_START`, `ALIGN_CENTER`, etc.
|
||||
- Direction: `DIRECTION_INHERIT`, `DIRECTION_LTR`, `DIRECTION_RTL`
|
||||
- Display: `DISPLAY_FLEX`, `DISPLAY_NONE`
|
||||
- Edge: `EDGE_LEFT`, `EDGE_TOP`, `EDGE_RIGHT`, etc.
|
||||
- Experimental Features: `EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS`, etc.
|
||||
- Flex Direction: `FLEX_DIRECTION_ROW`, `FLEX_DIRECTION_COLUMN`, etc.
|
||||
- Gutter: `GUTTER_ROW`, `GUTTER_COLUMN`, `GUTTER_ALL`
|
||||
- Justify: `JUSTIFY_CENTER`, `JUSTIFY_SPACE_BETWEEN`, etc.
|
||||
- Measure Mode: `MEASURE_MODE_UNDEFINED`, `MEASURE_MODE_EXACTLY`, etc.
|
||||
- Node Type: `NODE_TYPE_DEFAULT`, `NODE_TYPE_TEXT`
|
||||
- Overflow: `OVERFLOW_VISIBLE`, `OVERFLOW_HIDDEN`, `OVERFLOW_SCROLL`
|
||||
- Position Type: `POSITION_TYPE_STATIC`, `POSITION_TYPE_RELATIVE`, `POSITION_TYPE_ABSOLUTE`
|
||||
- Unit: `UNIT_UNDEFINED`, `UNIT_POINT`, `UNIT_PERCENT`, `UNIT_AUTO`
|
||||
- Wrap: `WRAP_NO_WRAP`, `WRAP_WRAP`, `WRAP_WRAP_REVERSE`
|
||||
- Errata: `ERRATA_NONE`, `ERRATA_STRETCH_FLEX_BASIS`, etc.
|
||||
|
||||
## Phase 5: Zig Integration & JavaScript Module ✅
|
||||
|
||||
### Implementation Details
|
||||
Created integration points for exposing Yoga to JavaScript:
|
||||
- **Files Created:**
|
||||
- `src/bun.js/bindings/JSYogaModule.h` & `.cpp` - Main module object that combines Config, Node, and constants
|
||||
- `src/bun.js/bindings/yoga.zig` - Zig bindings for module creation and global registration
|
||||
- `src/js/builtins/YogaModule.ts` - TypeScript module for ES module imports
|
||||
- `src/bun.js/bindings/GlobalYoga.cpp` - Helper to expose Yoga as a global
|
||||
|
||||
### Module Structure
|
||||
The `JSYogaModule` serves as the main entry point and contains:
|
||||
- `Config` constructor function
|
||||
- `Node` constructor function
|
||||
- All constants as direct properties
|
||||
|
||||
### Integration Points
|
||||
1. **Zig Bindings (`yoga.zig`):**
|
||||
- `Yoga.create()` - Creates the Yoga module object
|
||||
- `Yoga.load()` - Registers Yoga as `globalThis.Yoga`
|
||||
- Exports `Bun__createYogaModule` for C++ interop
|
||||
|
||||
2. **JavaScript Module (`YogaModule.ts`):**
|
||||
- Re-exports all components for ES module usage
|
||||
- Allows `import Yoga from 'yoga-layout'` syntax
|
||||
- Maintains compatibility with existing yoga-layout API
|
||||
|
||||
3. **Global Exposure (`GlobalYoga.cpp`):**
|
||||
- `Bun__exposeYogaGlobal()` - Exposes Yoga as a global variable
|
||||
- Called during Bun initialization to make Yoga available everywhere
|
||||
|
||||
### Build System Updates
|
||||
All new files have been added to `cmake/sources/CxxSources.txt` for compilation.
|
||||
|
||||
## Current Status
|
||||
Phases 1-5 are complete, providing:
|
||||
- Fully functional native Yoga implementation
|
||||
- Complete Config and Node classes with all methods
|
||||
- All Yoga constants exposed to JavaScript
|
||||
- Zig integration for module loading
|
||||
- JavaScript module for ES imports
|
||||
- Global exposure mechanism
|
||||
|
||||
The implementation is 100% API-compatible with yoga-layout WASM.
|
||||
|
||||
## Next Steps
|
||||
The remaining phases to implement would be:
|
||||
- Phase 6: Testing Suite (comprehensive tests for all functionality)
|
||||
- Phase 7: WASM Compatibility Mode (optional fallback mechanism)
|
||||
|
||||
## Notes
|
||||
- The implementation assumes Yoga is vendored at the standard location
|
||||
- All methods are 100% API-compatible with yoga-layout WASM
|
||||
- Performance should be significantly better than WASM due to direct C++ calls
|
||||
- The module can be accessed via `globalThis.Yoga`, `require('yoga-layout')`, or `import Yoga from 'yoga-layout'`
|
||||
@@ -1,28 +0,0 @@
|
||||
#include "root.h"
|
||||
#include "ZigGlobalObject.h"
|
||||
#include "JSYogaModule.h"
|
||||
#include <JavaScriptCore/JSCInlines.h>
|
||||
|
||||
namespace Bun {
|
||||
|
||||
// This function would be called to expose Yoga as a global variable
|
||||
extern "C" void Bun__exposeYogaGlobal(Zig::GlobalObject* globalObject)
|
||||
{
|
||||
JSC::VM& vm = globalObject->vm();
|
||||
auto scope = DECLARE_CATCH_SCOPE(vm);
|
||||
|
||||
// Create the Yoga module
|
||||
JSC::JSValue yogaModule = Bun__createYogaModule(globalObject);
|
||||
|
||||
// Expose it as globalThis.Yoga
|
||||
globalObject->putDirect(
|
||||
vm,
|
||||
JSC::Identifier::fromString(vm, "Yoga"_s),
|
||||
yogaModule,
|
||||
JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly
|
||||
);
|
||||
|
||||
RETURN_IF_EXCEPTION(scope, void());
|
||||
}
|
||||
|
||||
} // namespace Bun
|
||||
@@ -107,13 +107,13 @@ static JSC_DECLARE_HOST_FUNCTION(jsYogaNodeProtoFuncSetMeasureFunc);
|
||||
static JSC_DECLARE_HOST_FUNCTION(jsYogaNodeProtoFuncSetDirtiedFunc);
|
||||
|
||||
// External implementations
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncSetWidth);
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncSetHeight);
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncSetMargin);
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncInsertChild);
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncGetChild);
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncGetParent);
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncSetMeasureFunc);
|
||||
JSC_DECLARE_HOST_FUNCTION(jsYogaNodeProtoFuncSetWidth);
|
||||
JSC_DECLARE_HOST_FUNCTION(jsYogaNodeProtoFuncSetHeight);
|
||||
JSC_DECLARE_HOST_FUNCTION(jsYogaNodeProtoFuncSetMargin);
|
||||
JSC_DECLARE_HOST_FUNCTION(jsYogaNodeProtoFuncInsertChild);
|
||||
JSC_DECLARE_HOST_FUNCTION(jsYogaNodeProtoFuncGetChild);
|
||||
JSC_DECLARE_HOST_FUNCTION(jsYogaNodeProtoFuncGetParent);
|
||||
JSC_DECLARE_HOST_FUNCTION(jsYogaNodeProtoFuncSetMeasureFunc);
|
||||
|
||||
// Hash table for Node prototype properties
|
||||
static const JSC::HashTableValue JSYogaNodePrototypeTableValues[] = {
|
||||
@@ -499,117 +499,6 @@ JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncFree, (JSC::JSGlobalObject* globalOb
|
||||
return JSC::JSValue::encode(JSC::jsUndefined());
|
||||
}
|
||||
|
||||
// Min/Max Width/Height setters
|
||||
JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncSetMinWidth, (JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame))
|
||||
{
|
||||
// Forward to parseYogaValue implementation
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncSetMinWidth);
|
||||
return jsYogaNodeProtoFuncSetMinWidth(globalObject, callFrame);
|
||||
}
|
||||
|
||||
JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncSetMinHeight, (JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame))
|
||||
{
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncSetMinHeight);
|
||||
return jsYogaNodeProtoFuncSetMinHeight(globalObject, callFrame);
|
||||
}
|
||||
|
||||
JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncSetMaxWidth, (JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame))
|
||||
{
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncSetMaxWidth);
|
||||
return jsYogaNodeProtoFuncSetMaxWidth(globalObject, callFrame);
|
||||
}
|
||||
|
||||
JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncSetMaxHeight, (JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame))
|
||||
{
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncSetMaxHeight);
|
||||
return jsYogaNodeProtoFuncSetMaxHeight(globalObject, callFrame);
|
||||
}
|
||||
|
||||
// Style setters
|
||||
JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncSetFlexBasis, (JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame))
|
||||
{
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncSetFlexBasis);
|
||||
return jsYogaNodeProtoFuncSetFlexBasis(globalObject, callFrame);
|
||||
}
|
||||
|
||||
JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncSetPadding, (JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame))
|
||||
{
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncSetPadding);
|
||||
return jsYogaNodeProtoFuncSetPadding(globalObject, callFrame);
|
||||
}
|
||||
|
||||
JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncSetPosition, (JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame))
|
||||
{
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncSetPosition);
|
||||
return jsYogaNodeProtoFuncSetPosition(globalObject, callFrame);
|
||||
}
|
||||
|
||||
JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncSetGap, (JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame))
|
||||
{
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncSetGap);
|
||||
return jsYogaNodeProtoFuncSetGap(globalObject, callFrame);
|
||||
}
|
||||
|
||||
// Style getters
|
||||
JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncGetWidth, (JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame))
|
||||
{
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncGetWidth);
|
||||
return jsYogaNodeProtoFuncGetWidth(globalObject, callFrame);
|
||||
}
|
||||
|
||||
JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncGetHeight, (JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame))
|
||||
{
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncGetHeight);
|
||||
return jsYogaNodeProtoFuncGetHeight(globalObject, callFrame);
|
||||
}
|
||||
|
||||
JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncGetMinWidth, (JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame))
|
||||
{
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncGetMinWidth);
|
||||
return jsYogaNodeProtoFuncGetMinWidth(globalObject, callFrame);
|
||||
}
|
||||
|
||||
JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncGetMinHeight, (JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame))
|
||||
{
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncGetMinHeight);
|
||||
return jsYogaNodeProtoFuncGetMinHeight(globalObject, callFrame);
|
||||
}
|
||||
|
||||
JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncGetMaxWidth, (JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame))
|
||||
{
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncGetMaxWidth);
|
||||
return jsYogaNodeProtoFuncGetMaxWidth(globalObject, callFrame);
|
||||
}
|
||||
|
||||
JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncGetMaxHeight, (JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame))
|
||||
{
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncGetMaxHeight);
|
||||
return jsYogaNodeProtoFuncGetMaxHeight(globalObject, callFrame);
|
||||
}
|
||||
|
||||
JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncGetFlexBasis, (JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame))
|
||||
{
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncGetFlexBasis);
|
||||
return jsYogaNodeProtoFuncGetFlexBasis(globalObject, callFrame);
|
||||
}
|
||||
|
||||
JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncGetMargin, (JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame))
|
||||
{
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncGetMargin);
|
||||
return jsYogaNodeProtoFuncGetMargin(globalObject, callFrame);
|
||||
}
|
||||
|
||||
JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncGetPadding, (JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame))
|
||||
{
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncGetPadding);
|
||||
return jsYogaNodeProtoFuncGetPadding(globalObject, callFrame);
|
||||
}
|
||||
|
||||
JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncGetPosition, (JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame))
|
||||
{
|
||||
extern JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncGetPosition);
|
||||
return jsYogaNodeProtoFuncGetPosition(globalObject, callFrame);
|
||||
}
|
||||
|
||||
// Layout property setters (simple enum setters)
|
||||
JSC_DEFINE_HOST_FUNCTION(jsYogaNodeProtoFuncSetFlexDirection, (JSC::JSGlobalObject* globalObject, JSC::CallFrame* callFrame))
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
const std = @import("std");
|
||||
const bun = @import("root").bun;
|
||||
const JSC = bun.JSC;
|
||||
const JSValue = JSC.JSValue;
|
||||
const JSGlobalObject = JSC.JSGlobalObject;
|
||||
|
||||
// External C function from JSYogaModule.cpp
|
||||
extern fn Bun__createYogaModule(globalObject: *JSGlobalObject) JSValue;
|
||||
|
||||
pub const Yoga = struct {
|
||||
/// Create the Yoga module object
|
||||
pub fn create(globalObject: *JSGlobalObject) JSValue {
|
||||
return Bun__createYogaModule(globalObject);
|
||||
}
|
||||
|
||||
/// Register Yoga as a global module
|
||||
pub fn load(globalObject: *JSGlobalObject) void {
|
||||
const yoga_module = create(globalObject);
|
||||
|
||||
// Make it available as globalThis.Yoga
|
||||
const global_this = globalObject.getGlobalThis();
|
||||
global_this.put(
|
||||
globalObject,
|
||||
JSC.ZigString.static("Yoga"),
|
||||
yoga_module,
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
comptime {
|
||||
// Ensure the external function is linked
|
||||
_ = &Bun__createYogaModule;
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
// Native Yoga layout engine bindings
|
||||
// Compatible with yoga-layout API
|
||||
|
||||
// The native Yoga object is exposed globally
|
||||
const YogaNative = globalThis.Yoga;
|
||||
|
||||
// Re-export everything from the native module
|
||||
export const Config = YogaNative.Config;
|
||||
export const Node = YogaNative.Node;
|
||||
|
||||
// Export all constants
|
||||
export const ALIGN_AUTO = YogaNative.ALIGN_AUTO;
|
||||
export const ALIGN_FLEX_START = YogaNative.ALIGN_FLEX_START;
|
||||
export const ALIGN_CENTER = YogaNative.ALIGN_CENTER;
|
||||
export const ALIGN_FLEX_END = YogaNative.ALIGN_FLEX_END;
|
||||
export const ALIGN_STRETCH = YogaNative.ALIGN_STRETCH;
|
||||
export const ALIGN_BASELINE = YogaNative.ALIGN_BASELINE;
|
||||
export const ALIGN_SPACE_BETWEEN = YogaNative.ALIGN_SPACE_BETWEEN;
|
||||
export const ALIGN_SPACE_AROUND = YogaNative.ALIGN_SPACE_AROUND;
|
||||
export const ALIGN_SPACE_EVENLY = YogaNative.ALIGN_SPACE_EVENLY;
|
||||
|
||||
export const DIRECTION_INHERIT = YogaNative.DIRECTION_INHERIT;
|
||||
export const DIRECTION_LTR = YogaNative.DIRECTION_LTR;
|
||||
export const DIRECTION_RTL = YogaNative.DIRECTION_RTL;
|
||||
|
||||
export const DISPLAY_FLEX = YogaNative.DISPLAY_FLEX;
|
||||
export const DISPLAY_NONE = YogaNative.DISPLAY_NONE;
|
||||
|
||||
export const EDGE_LEFT = YogaNative.EDGE_LEFT;
|
||||
export const EDGE_TOP = YogaNative.EDGE_TOP;
|
||||
export const EDGE_RIGHT = YogaNative.EDGE_RIGHT;
|
||||
export const EDGE_BOTTOM = YogaNative.EDGE_BOTTOM;
|
||||
export const EDGE_START = YogaNative.EDGE_START;
|
||||
export const EDGE_END = YogaNative.EDGE_END;
|
||||
export const EDGE_HORIZONTAL = YogaNative.EDGE_HORIZONTAL;
|
||||
export const EDGE_VERTICAL = YogaNative.EDGE_VERTICAL;
|
||||
export const EDGE_ALL = YogaNative.EDGE_ALL;
|
||||
|
||||
export const EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS = YogaNative.EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS;
|
||||
export const EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE = YogaNative.EXPERIMENTAL_FEATURE_ABSOLUTE_PERCENTAGE_AGAINST_PADDING_EDGE;
|
||||
export const EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN = YogaNative.EXPERIMENTAL_FEATURE_FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN;
|
||||
|
||||
export const FLEX_DIRECTION_COLUMN = YogaNative.FLEX_DIRECTION_COLUMN;
|
||||
export const FLEX_DIRECTION_COLUMN_REVERSE = YogaNative.FLEX_DIRECTION_COLUMN_REVERSE;
|
||||
export const FLEX_DIRECTION_ROW = YogaNative.FLEX_DIRECTION_ROW;
|
||||
export const FLEX_DIRECTION_ROW_REVERSE = YogaNative.FLEX_DIRECTION_ROW_REVERSE;
|
||||
|
||||
export const GUTTER_COLUMN = YogaNative.GUTTER_COLUMN;
|
||||
export const GUTTER_ROW = YogaNative.GUTTER_ROW;
|
||||
export const GUTTER_ALL = YogaNative.GUTTER_ALL;
|
||||
|
||||
export const JUSTIFY_FLEX_START = YogaNative.JUSTIFY_FLEX_START;
|
||||
export const JUSTIFY_CENTER = YogaNative.JUSTIFY_CENTER;
|
||||
export const JUSTIFY_FLEX_END = YogaNative.JUSTIFY_FLEX_END;
|
||||
export const JUSTIFY_SPACE_BETWEEN = YogaNative.JUSTIFY_SPACE_BETWEEN;
|
||||
export const JUSTIFY_SPACE_AROUND = YogaNative.JUSTIFY_SPACE_AROUND;
|
||||
export const JUSTIFY_SPACE_EVENLY = YogaNative.JUSTIFY_SPACE_EVENLY;
|
||||
|
||||
export const MEASURE_MODE_UNDEFINED = YogaNative.MEASURE_MODE_UNDEFINED;
|
||||
export const MEASURE_MODE_EXACTLY = YogaNative.MEASURE_MODE_EXACTLY;
|
||||
export const MEASURE_MODE_AT_MOST = YogaNative.MEASURE_MODE_AT_MOST;
|
||||
|
||||
export const NODE_TYPE_DEFAULT = YogaNative.NODE_TYPE_DEFAULT;
|
||||
export const NODE_TYPE_TEXT = YogaNative.NODE_TYPE_TEXT;
|
||||
|
||||
export const OVERFLOW_VISIBLE = YogaNative.OVERFLOW_VISIBLE;
|
||||
export const OVERFLOW_HIDDEN = YogaNative.OVERFLOW_HIDDEN;
|
||||
export const OVERFLOW_SCROLL = YogaNative.OVERFLOW_SCROLL;
|
||||
|
||||
export const POSITION_TYPE_STATIC = YogaNative.POSITION_TYPE_STATIC;
|
||||
export const POSITION_TYPE_RELATIVE = YogaNative.POSITION_TYPE_RELATIVE;
|
||||
export const POSITION_TYPE_ABSOLUTE = YogaNative.POSITION_TYPE_ABSOLUTE;
|
||||
|
||||
export const UNIT_UNDEFINED = YogaNative.UNIT_UNDEFINED;
|
||||
export const UNIT_POINT = YogaNative.UNIT_POINT;
|
||||
export const UNIT_PERCENT = YogaNative.UNIT_PERCENT;
|
||||
export const UNIT_AUTO = YogaNative.UNIT_AUTO;
|
||||
|
||||
export const WRAP_NO_WRAP = YogaNative.WRAP_NO_WRAP;
|
||||
export const WRAP_WRAP = YogaNative.WRAP_WRAP;
|
||||
export const WRAP_WRAP_REVERSE = YogaNative.WRAP_WRAP_REVERSE;
|
||||
|
||||
export const ERRATA_NONE = YogaNative.ERRATA_NONE;
|
||||
export const ERRATA_STRETCH_FLEX_BASIS = YogaNative.ERRATA_STRETCH_FLEX_BASIS;
|
||||
export const ERRATA_ABSOLUTE_POSITIONING_INCORRECT = YogaNative.ERRATA_ABSOLUTE_POSITIONING_INCORRECT;
|
||||
export const ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE = YogaNative.ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE;
|
||||
export const ERRATA_ALL = YogaNative.ERRATA_ALL;
|
||||
export const ERRATA_CLASSIC = YogaNative.ERRATA_CLASSIC;
|
||||
|
||||
// Default export for compatibility
|
||||
export default YogaNative;
|
||||
Reference in New Issue
Block a user