├── .gitignore ├── .gitmodules ├── CODE_OF_CONDUCT.md ├── LICENSE ├── Makefile ├── README.md ├── bindings ├── Config.cc ├── Config.hh ├── Layout.hh ├── Node.cc ├── Node.hh └── embind.cc ├── package.json ├── rollup.config.js ├── src ├── index.d.ts └── index.js └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | node_modules 3 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "yoga"] 2 | path = yoga 3 | url = git@github.com:facebook/yoga.git 4 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at rick@button.dev. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Rick Button 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | OUTPUT_FILENAME="yoga.mjs" 2 | 3 | CC=emcc 4 | 5 | all: cpp js 6 | 7 | cpp: dir 8 | $(CC) yoga/yoga/*.cpp bindings/*.cc \ 9 | --bind -Os --memory-init-file 0 --llvm-lto 1 \ 10 | -Iyoga \ 11 | -fno-exceptions \ 12 | -s WASM=1 \ 13 | -s WASM_ASYNC_COMPILATION=0 \ 14 | -s EXPORTED_RUNTIME_METHODS=[] \ 15 | -s DISABLE_EXCEPTION_CATCHING=1 \ 16 | -s AGGRESSIVE_VARIABLE_ELIMINATION=1 \ 17 | -s NO_EXIT_RUNTIME=1 \ 18 | -s ASSERTIONS=0 \ 19 | -s ALLOW_MEMORY_GROWTH=1 \ 20 | -s MODULARIZE=1 \ 21 | -s "DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=['memcpy','memset','malloc','free','strlen']" \ 22 | -o build/$(OUTPUT_FILENAME) 23 | 24 | js: dir 25 | yarn rollup -c rollup.config.js 26 | 27 | clean: 28 | rm -rf build 29 | 30 | dir: 31 | mkdir -p build 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # yoga-wasm 2 | 3 | `yoga-wasm` is a build of Facebook's [Yoga](https://github.com/facebook/yoga) 4 | Flexbox layout engine, for JavaScript and WebAssembly. 5 | 6 | It is a drop in replacement for the [`yoga-layout`](https://www.npmjs.com/package/yoga-layout) NPM package. 7 | 8 | ## Installation 9 | 10 | ```bash 11 | # npm 12 | npm install --save yoga-wasm 13 | 14 | # yarn 15 | yarn add yoga-wasm 16 | ``` 17 | 18 | ## Usage 19 | 20 | You should be able to use `yoga-wasm` in the same way you would normally use `yoga-layout`: 21 | 22 | ```js 23 | import * as yoga from "yoga-wasm"; 24 | 25 | const node = yoga.Node.create(); 26 | 27 | node.setMaxWidth(100); 28 | 29 | node.calculateLayout(100, 100, yoga.DIRECTION_LTR); 30 | ``` 31 | 32 | ## Prior Art 33 | 34 | [`yoga-dom`](https://github.com/vincentriemer/yoga-dom) is another attempt to port Yoga to JS with WebAssembly. I leaned heavily on 35 | [viankakrisna](https://github.com/viankakrisna)'s `embind` bindings when porting the latest version of Yoga's bindings from `nbind` to `embind`. 36 | 37 | ## Contributing 38 | 39 | Open a PR or file an issue! 40 | -------------------------------------------------------------------------------- /bindings/Config.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "./Config.hh" 4 | 5 | /* static */ Config* Config::create(void) { 6 | return new Config(); 7 | } 8 | 9 | /* static */ void Config::destroy(Config* node) { 10 | delete node; 11 | } 12 | 13 | Config::Config(void) : m_config(YGConfigNew()) {} 14 | 15 | Config::~Config(void) { 16 | YGConfigFree(m_config); 17 | } 18 | 19 | void Config::setExperimentalFeatureEnabled(int feature, bool enabled) { 20 | YGConfigSetExperimentalFeatureEnabled( 21 | m_config, static_cast(feature), enabled); 22 | } 23 | 24 | void Config::setPointScaleFactor(float pixelsInPoint) { 25 | YGConfigSetPointScaleFactor(m_config, pixelsInPoint); 26 | } 27 | 28 | bool Config::isExperimentalFeatureEnabled(int feature) const { 29 | return YGConfigIsExperimentalFeatureEnabled( 30 | m_config, static_cast(feature)); 31 | } 32 | -------------------------------------------------------------------------------- /bindings/Config.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class Config { 6 | 7 | friend class Node; 8 | 9 | public: 10 | static Config* create(void); 11 | 12 | static void destroy(Config* config); 13 | 14 | private: 15 | Config(void); 16 | 17 | public: 18 | ~Config(void); 19 | 20 | public: // Prevent accidental copy 21 | Config(Config const&) = delete; 22 | 23 | Config const& operator=(Config const&) = delete; 24 | 25 | public: // Setters 26 | void setExperimentalFeatureEnabled(int feature, bool enabled); 27 | void setPointScaleFactor(float pixelsInPoint); 28 | 29 | public: // Getters 30 | bool isExperimentalFeatureEnabled(int feature) const; 31 | 32 | private: 33 | YGConfigRef m_config; 34 | }; 35 | -------------------------------------------------------------------------------- /bindings/Layout.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct Layout { 4 | double left; 5 | double right; 6 | 7 | double top; 8 | double bottom; 9 | 10 | double width; 11 | double height; 12 | }; 13 | -------------------------------------------------------------------------------- /bindings/Node.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include "./Node.hh" 6 | #include "./Layout.hh" 7 | #include "./Config.hh" 8 | 9 | static YGSize globalMeasureFunc( 10 | YGNodeRef nodeRef, 11 | float width, 12 | YGMeasureMode widthMode, 13 | float height, 14 | YGMeasureMode heightMode) { 15 | Node const& node = *reinterpret_cast(YGNodeGetContext(nodeRef)); 16 | 17 | return node.callMeasureFunc(width, widthMode, height, heightMode); 18 | } 19 | 20 | static void globalDirtiedFunc(YGNodeRef nodeRef) { 21 | Node const& node = *reinterpret_cast(YGNodeGetContext(nodeRef)); 22 | 23 | node.callDirtiedFunc(); 24 | } 25 | 26 | /* static */ Node* Node::createDefault(void) { 27 | return new Node(nullptr); 28 | } 29 | 30 | /* static */ Node* Node::createWithConfig(Config* config) { 31 | return new Node(config); 32 | } 33 | 34 | /* static */ void Node::destroy(Node* node) { 35 | delete node; 36 | } 37 | 38 | /* static */ Node* Node::fromYGNode(YGNodeRef nodeRef) { 39 | return reinterpret_cast(YGNodeGetContext(nodeRef)); 40 | } 41 | 42 | Node::Node(Config* config) 43 | : m_node( 44 | config != nullptr ? YGNodeNewWithConfig(config->m_config) 45 | : YGNodeNew()), 46 | m_measureFunc(nullptr), 47 | m_dirtiedFunc(nullptr) { 48 | YGNodeSetContext(m_node, reinterpret_cast(this)); 49 | } 50 | 51 | Node::~Node(void) { 52 | YGNodeFree(m_node); 53 | } 54 | 55 | void Node::reset(void) { 56 | m_measureFunc.reset(nullptr); 57 | m_dirtiedFunc.reset(nullptr); 58 | 59 | YGNodeReset(m_node); 60 | } 61 | 62 | void Node::copyStyle(Node const& other) { 63 | YGNodeCopyStyle(m_node, other.m_node); 64 | } 65 | 66 | void Node::setPositionType(int positionType) { 67 | YGNodeStyleSetPositionType(m_node, static_cast(positionType)); 68 | } 69 | 70 | void Node::setPosition(int edge, double position) { 71 | YGNodeStyleSetPosition(m_node, static_cast(edge), position); 72 | } 73 | 74 | void Node::setPositionPercent(int edge, double position) { 75 | YGNodeStyleSetPositionPercent(m_node, static_cast(edge), position); 76 | } 77 | 78 | void Node::setAlignContent(int alignContent) { 79 | YGNodeStyleSetAlignContent(m_node, static_cast(alignContent)); 80 | } 81 | 82 | void Node::setAlignItems(int alignItems) { 83 | YGNodeStyleSetAlignItems(m_node, static_cast(alignItems)); 84 | } 85 | 86 | void Node::setAlignSelf(int alignSelf) { 87 | YGNodeStyleSetAlignSelf(m_node, static_cast(alignSelf)); 88 | } 89 | 90 | void Node::setFlexDirection(int flexDirection) { 91 | YGNodeStyleSetFlexDirection( 92 | m_node, static_cast(flexDirection)); 93 | } 94 | 95 | void Node::setFlexWrap(int flexWrap) { 96 | YGNodeStyleSetFlexWrap(m_node, static_cast(flexWrap)); 97 | } 98 | 99 | void Node::setJustifyContent(int justifyContent) { 100 | YGNodeStyleSetJustifyContent(m_node, static_cast(justifyContent)); 101 | } 102 | 103 | void Node::setMargin(int edge, double margin) { 104 | YGNodeStyleSetMargin(m_node, static_cast(edge), margin); 105 | } 106 | 107 | void Node::setMarginPercent(int edge, double margin) { 108 | YGNodeStyleSetMarginPercent(m_node, static_cast(edge), margin); 109 | } 110 | 111 | void Node::setMarginAuto(int edge) { 112 | YGNodeStyleSetMarginAuto(m_node, static_cast(edge)); 113 | } 114 | 115 | void Node::setOverflow(int overflow) { 116 | YGNodeStyleSetOverflow(m_node, static_cast(overflow)); 117 | } 118 | 119 | void Node::setDisplay(int display) { 120 | YGNodeStyleSetDisplay(m_node, static_cast(display)); 121 | } 122 | 123 | void Node::setFlex(double flex) { 124 | YGNodeStyleSetFlex(m_node, flex); 125 | } 126 | 127 | void Node::setFlexBasis(double flexBasis) { 128 | YGNodeStyleSetFlexBasis(m_node, flexBasis); 129 | } 130 | 131 | void Node::setFlexBasisPercent(double flexBasis) { 132 | YGNodeStyleSetFlexBasisPercent(m_node, flexBasis); 133 | } 134 | 135 | void Node::setFlexGrow(double flexGrow) { 136 | YGNodeStyleSetFlexGrow(m_node, flexGrow); 137 | } 138 | 139 | void Node::setFlexShrink(double flexShrink) { 140 | YGNodeStyleSetFlexShrink(m_node, flexShrink); 141 | } 142 | 143 | void Node::setWidth(double width) { 144 | YGNodeStyleSetWidth(m_node, width); 145 | } 146 | 147 | void Node::setWidthPercent(double width) { 148 | YGNodeStyleSetWidthPercent(m_node, width); 149 | } 150 | 151 | void Node::setWidthAuto() { 152 | YGNodeStyleSetWidthAuto(m_node); 153 | } 154 | 155 | void Node::setHeight(double height) { 156 | YGNodeStyleSetHeight(m_node, height); 157 | } 158 | 159 | void Node::setHeightPercent(double height) { 160 | YGNodeStyleSetHeightPercent(m_node, height); 161 | } 162 | 163 | void Node::setHeightAuto() { 164 | YGNodeStyleSetHeightAuto(m_node); 165 | } 166 | 167 | void Node::setMinWidth(double minWidth) { 168 | YGNodeStyleSetMinWidth(m_node, minWidth); 169 | } 170 | 171 | void Node::setMinWidthPercent(double minWidth) { 172 | YGNodeStyleSetMinWidthPercent(m_node, minWidth); 173 | } 174 | 175 | void Node::setMinHeight(double minHeight) { 176 | YGNodeStyleSetMinHeight(m_node, minHeight); 177 | } 178 | 179 | void Node::setMinHeightPercent(double minHeight) { 180 | YGNodeStyleSetMinHeightPercent(m_node, minHeight); 181 | } 182 | 183 | void Node::setMaxWidth(double maxWidth) { 184 | YGNodeStyleSetMaxWidth(m_node, maxWidth); 185 | } 186 | 187 | void Node::setMaxWidthPercent(double maxWidth) { 188 | YGNodeStyleSetMaxWidthPercent(m_node, maxWidth); 189 | } 190 | 191 | void Node::setMaxHeight(double maxHeight) { 192 | YGNodeStyleSetMaxHeight(m_node, maxHeight); 193 | } 194 | 195 | void Node::setMaxHeightPercent(double maxHeight) { 196 | YGNodeStyleSetMaxHeightPercent(m_node, maxHeight); 197 | } 198 | 199 | void Node::setAspectRatio(double aspectRatio) { 200 | YGNodeStyleSetAspectRatio(m_node, aspectRatio); 201 | } 202 | 203 | void Node::setBorder(int edge, double border) { 204 | YGNodeStyleSetBorder(m_node, static_cast(edge), border); 205 | } 206 | 207 | void Node::setPadding(int edge, double padding) { 208 | YGNodeStyleSetPadding(m_node, static_cast(edge), padding); 209 | } 210 | 211 | void Node::setPaddingPercent(int edge, double padding) { 212 | YGNodeStyleSetPaddingPercent(m_node, static_cast(edge), padding); 213 | } 214 | 215 | void Node::setIsReferenceBaseline(bool isReferenceBaseline) { 216 | YGNodeSetIsReferenceBaseline(m_node, isReferenceBaseline); 217 | } 218 | 219 | int Node::getPositionType(void) const { 220 | return YGNodeStyleGetPositionType(m_node); 221 | } 222 | 223 | YGValue Node::getPosition(int edge) const { 224 | return YGNodeStyleGetPosition(m_node, static_cast(edge)); 225 | } 226 | 227 | int Node::getAlignContent(void) const { 228 | return YGNodeStyleGetAlignContent(m_node); 229 | } 230 | 231 | int Node::getAlignItems(void) const { 232 | return YGNodeStyleGetAlignItems(m_node); 233 | } 234 | 235 | int Node::getAlignSelf(void) const { 236 | return YGNodeStyleGetAlignSelf(m_node); 237 | } 238 | 239 | int Node::getFlexDirection(void) const { 240 | return YGNodeStyleGetFlexDirection(m_node); 241 | } 242 | 243 | int Node::getFlexWrap(void) const { 244 | return YGNodeStyleGetFlexWrap(m_node); 245 | } 246 | 247 | int Node::getJustifyContent(void) const { 248 | return YGNodeStyleGetJustifyContent(m_node); 249 | } 250 | 251 | YGValue Node::getMargin(int edge) const { 252 | return YGNodeStyleGetMargin(m_node, static_cast(edge)); 253 | } 254 | 255 | int Node::getOverflow(void) const { 256 | return YGNodeStyleGetOverflow(m_node); 257 | } 258 | 259 | int Node::getDisplay(void) const { 260 | return YGNodeStyleGetDisplay(m_node); 261 | } 262 | 263 | YGValue Node::getFlexBasis(void) const { 264 | return YGNodeStyleGetFlexBasis(m_node); 265 | } 266 | 267 | double Node::getFlexGrow(void) const { 268 | return YGNodeStyleGetFlexGrow(m_node); 269 | } 270 | 271 | double Node::getFlexShrink(void) const { 272 | return YGNodeStyleGetFlexShrink(m_node); 273 | } 274 | 275 | YGValue Node::getWidth(void) const { 276 | return YGNodeStyleGetWidth(m_node); 277 | } 278 | 279 | YGValue Node::getHeight(void) const { 280 | return YGNodeStyleGetHeight(m_node); 281 | } 282 | 283 | YGValue Node::getMinWidth(void) const { 284 | return YGNodeStyleGetMinWidth(m_node); 285 | } 286 | 287 | YGValue Node::getMinHeight(void) const { 288 | return YGNodeStyleGetMinHeight(m_node); 289 | } 290 | 291 | YGValue Node::getMaxWidth(void) const { 292 | return YGNodeStyleGetMaxWidth(m_node); 293 | } 294 | 295 | YGValue Node::getMaxHeight(void) const { 296 | return YGNodeStyleGetMaxHeight(m_node); 297 | } 298 | 299 | double Node::getAspectRatio(void) const { 300 | return YGNodeStyleGetAspectRatio(m_node); 301 | } 302 | 303 | double Node::getBorder(int edge) const { 304 | return YGNodeStyleGetBorder(m_node, static_cast(edge)); 305 | } 306 | 307 | YGValue Node::getPadding(int edge) const { 308 | return YGNodeStyleGetPadding(m_node, static_cast(edge)); 309 | } 310 | 311 | bool Node::isReferenceBaseline() { 312 | return YGNodeIsReferenceBaseline(m_node); 313 | } 314 | 315 | void Node::insertChild(Node* child, unsigned index) { 316 | YGNodeInsertChild(m_node, child->m_node, index); 317 | } 318 | 319 | void Node::removeChild(Node* child) { 320 | YGNodeRemoveChild(m_node, child->m_node); 321 | } 322 | 323 | unsigned Node::getChildCount(void) const { 324 | return YGNodeGetChildCount(m_node); 325 | } 326 | 327 | Node* Node::getParent(void) { 328 | auto nodePtr = YGNodeGetParent(m_node); 329 | 330 | if (nodePtr == nullptr) 331 | return nullptr; 332 | 333 | return Node::fromYGNode(nodePtr); 334 | } 335 | 336 | Node* Node::getChild(unsigned index) { 337 | auto nodePtr = YGNodeGetChild(m_node, index); 338 | 339 | if (nodePtr == nullptr) 340 | return nullptr; 341 | 342 | return Node::fromYGNode(nodePtr); 343 | } 344 | 345 | void Node::setMeasureFunc(MeasureCallback *measureFunc) { 346 | m_measureFunc.reset(measureFunc); 347 | 348 | YGNodeSetMeasureFunc(m_node, &globalMeasureFunc); 349 | } 350 | 351 | void Node::unsetMeasureFunc(void) { 352 | m_measureFunc.reset(nullptr); 353 | 354 | YGNodeSetMeasureFunc(m_node, nullptr); 355 | } 356 | 357 | YGSize Node::callMeasureFunc( 358 | double width, 359 | YGMeasureMode widthMode, 360 | double height, 361 | YGMeasureMode heightMode) const { 362 | return m_measureFunc->measure(width, widthMode, height, heightMode); 363 | } 364 | 365 | void Node::setDirtiedFunc(DirtiedCallback *dirtiedFunc) { 366 | m_dirtiedFunc.reset(dirtiedFunc); 367 | 368 | YGNodeSetDirtiedFunc(m_node, &globalDirtiedFunc); 369 | } 370 | 371 | void Node::unsetDirtiedFunc(void) { 372 | m_dirtiedFunc.reset(nullptr); 373 | 374 | YGNodeSetDirtiedFunc(m_node, nullptr); 375 | } 376 | 377 | void Node::callDirtiedFunc(void) const { 378 | m_dirtiedFunc->dirtied(); 379 | } 380 | 381 | void Node::markDirty(void) { 382 | YGNodeMarkDirty(m_node); 383 | } 384 | 385 | bool Node::isDirty(void) const { 386 | return YGNodeIsDirty(m_node); 387 | } 388 | 389 | void Node::calculateLayout(double width, double height, int direction) { 390 | YGNodeCalculateLayout( 391 | m_node, width, height, static_cast(direction)); 392 | } 393 | 394 | double Node::getComputedLeft(void) const { 395 | return YGNodeLayoutGetLeft(m_node); 396 | } 397 | 398 | double Node::getComputedRight(void) const { 399 | return YGNodeLayoutGetRight(m_node); 400 | } 401 | 402 | double Node::getComputedTop(void) const { 403 | return YGNodeLayoutGetTop(m_node); 404 | } 405 | 406 | double Node::getComputedBottom(void) const { 407 | return YGNodeLayoutGetBottom(m_node); 408 | } 409 | 410 | double Node::getComputedWidth(void) const { 411 | return YGNodeLayoutGetWidth(m_node); 412 | } 413 | 414 | double Node::getComputedHeight(void) const { 415 | return YGNodeLayoutGetHeight(m_node); 416 | } 417 | 418 | Layout Node::getComputedLayout(void) const { 419 | Layout layout; 420 | 421 | layout.left = YGNodeLayoutGetLeft(m_node); 422 | layout.right = YGNodeLayoutGetRight(m_node); 423 | 424 | layout.top = YGNodeLayoutGetTop(m_node); 425 | layout.bottom = YGNodeLayoutGetBottom(m_node); 426 | 427 | layout.width = YGNodeLayoutGetWidth(m_node); 428 | layout.height = YGNodeLayoutGetHeight(m_node); 429 | 430 | return layout; 431 | } 432 | 433 | double Node::getComputedMargin(int edge) const { 434 | return YGNodeLayoutGetMargin(m_node, static_cast(edge)); 435 | } 436 | 437 | double Node::getComputedBorder(int edge) const { 438 | return YGNodeLayoutGetBorder(m_node, static_cast(edge)); 439 | } 440 | 441 | double Node::getComputedPadding(int edge) const { 442 | return YGNodeLayoutGetPadding(m_node, static_cast(edge)); 443 | } 444 | -------------------------------------------------------------------------------- /bindings/Node.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include 8 | 9 | #include "./Layout.hh" 10 | #include "./Config.hh" 11 | 12 | struct MeasureCallback 13 | { 14 | virtual YGSize measure(float width, 15 | YGMeasureMode widthMode, 16 | float height, 17 | YGMeasureMode heightMode) = 0; 18 | }; 19 | 20 | struct MeasureCallbackWrapper : public emscripten::wrapper 21 | { 22 | EMSCRIPTEN_WRAPPER(MeasureCallbackWrapper); 23 | YGSize measure(float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode) 24 | { 25 | return call("measure", width, widthMode, height, heightMode); 26 | } 27 | }; 28 | 29 | struct DirtiedCallback 30 | { 31 | virtual void dirtied() = 0; 32 | }; 33 | 34 | struct DirtiedCallbackWrapper : public emscripten::wrapper 35 | { 36 | EMSCRIPTEN_WRAPPER(DirtiedCallbackWrapper); 37 | void dirtied() 38 | { 39 | return call("dirtied"); 40 | } 41 | }; 42 | 43 | class Node { 44 | 45 | public: 46 | static Node* createDefault(void); 47 | static Node* createWithConfig(Config* config); 48 | 49 | static void destroy(Node* node); 50 | 51 | public: 52 | static Node* fromYGNode(YGNodeRef nodeRef); 53 | 54 | private: 55 | Node(Config* config); 56 | 57 | public: 58 | ~Node(void); 59 | 60 | public: // Prevent accidental copy 61 | Node(Node const&) = delete; 62 | 63 | Node const& operator=(Node const&) = delete; 64 | 65 | public: 66 | void reset(void); 67 | 68 | public: // Style setters 69 | void copyStyle(Node const& other); 70 | 71 | void setPositionType(int positionType); 72 | void setPosition(int edge, double position); 73 | void setPositionPercent(int edge, double position); 74 | 75 | void setAlignContent(int alignContent); 76 | void setAlignItems(int alignItems); 77 | void setAlignSelf(int alignSelf); 78 | void setFlexDirection(int flexDirection); 79 | void setFlexWrap(int flexWrap); 80 | void setJustifyContent(int justifyContent); 81 | 82 | void setMargin(int edge, double margin); 83 | void setMarginPercent(int edge, double margin); 84 | void setMarginAuto(int edge); 85 | 86 | void setOverflow(int overflow); 87 | void setDisplay(int display); 88 | 89 | void setFlex(double flex); 90 | void setFlexBasis(double flexBasis); 91 | void setFlexBasisPercent(double flexBasis); 92 | void setFlexBasisAuto(); 93 | void setFlexGrow(double flexGrow); 94 | void setFlexShrink(double flexShrink); 95 | 96 | void setWidth(double width); 97 | void setWidthPercent(double width); 98 | void setWidthAuto(); 99 | void setHeight(double height); 100 | void setHeightPercent(double height); 101 | void setHeightAuto(); 102 | 103 | void setMinWidth(double minWidth); 104 | void setMinWidthPercent(double minWidth); 105 | void setMinHeight(double minHeight); 106 | void setMinHeightPercent(double minHeight); 107 | 108 | void setMaxWidth(double maxWidth); 109 | void setMaxWidthPercent(double maxWidth); 110 | void setMaxHeight(double maxHeight); 111 | void setMaxHeightPercent(double maxHeight); 112 | 113 | void setAspectRatio(double aspectRatio); 114 | 115 | void setBorder(int edge, double border); 116 | 117 | void setPadding(int edge, double padding); 118 | void setPaddingPercent(int edge, double padding); 119 | 120 | public: // Style getters 121 | int getPositionType(void) const; 122 | YGValue getPosition(int edge) const; 123 | 124 | int getAlignContent(void) const; 125 | int getAlignItems(void) const; 126 | int getAlignSelf(void) const; 127 | int getFlexDirection(void) const; 128 | int getFlexWrap(void) const; 129 | int getJustifyContent(void) const; 130 | 131 | YGValue getMargin(int edge) const; 132 | 133 | int getOverflow(void) const; 134 | int getDisplay(void) const; 135 | 136 | YGValue getFlexBasis(void) const; 137 | double getFlexGrow(void) const; 138 | double getFlexShrink(void) const; 139 | 140 | YGValue getWidth(void) const; 141 | YGValue getHeight(void) const; 142 | 143 | YGValue getMinWidth(void) const; 144 | YGValue getMinHeight(void) const; 145 | 146 | YGValue getMaxWidth(void) const; 147 | YGValue getMaxHeight(void) const; 148 | 149 | double getAspectRatio(void) const; 150 | 151 | double getBorder(int edge) const; 152 | 153 | YGValue getPadding(int edge) const; 154 | 155 | public: // Tree hierarchy mutators 156 | void insertChild(Node* child, unsigned index); 157 | void removeChild(Node* child); 158 | 159 | public: // Tree hierarchy inspectors 160 | unsigned getChildCount(void) const; 161 | 162 | // The following functions cannot be const because they could discard const 163 | // qualifiers (ex: constNode->getChild(0)->getParent() wouldn't be const) 164 | 165 | Node* getParent(void); 166 | Node* getChild(unsigned index); 167 | 168 | public: // Measure func mutators 169 | void setMeasureFunc(MeasureCallback *measureFunc); 170 | void unsetMeasureFunc(void); 171 | 172 | public: // Measure func inspectors 173 | YGSize callMeasureFunc( 174 | double width, 175 | YGMeasureMode widthMode, 176 | double height, 177 | YGMeasureMode heightMode) const; 178 | 179 | public: // Dirtied func mutators 180 | void setDirtiedFunc(DirtiedCallback *dirtiedFunc); 181 | void unsetDirtiedFunc(void); 182 | 183 | public: // Dirtied func inspectors 184 | void callDirtiedFunc(void) const; 185 | 186 | public: // Dirtiness accessors 187 | void markDirty(void); 188 | bool isDirty(void) const; 189 | 190 | public: // Layout mutators 191 | void calculateLayout(double width, double height, int direction); 192 | 193 | public: // Layout inspectors 194 | double getComputedLeft(void) const; 195 | double getComputedRight(void) const; 196 | 197 | double getComputedTop(void) const; 198 | double getComputedBottom(void) const; 199 | 200 | double getComputedWidth(void) const; 201 | double getComputedHeight(void) const; 202 | 203 | Layout getComputedLayout(void) const; 204 | 205 | double getComputedMargin(int edge) const; 206 | double getComputedBorder(int edge) const; 207 | double getComputedPadding(int edge) const; 208 | 209 | public: 210 | void setIsReferenceBaseline(bool isReferenceBaseline); 211 | bool isReferenceBaseline(); 212 | 213 | YGNodeRef m_node; 214 | 215 | std::unique_ptr m_measureFunc; 216 | std::unique_ptr m_dirtiedFunc; 217 | }; 218 | -------------------------------------------------------------------------------- /bindings/embind.cc: -------------------------------------------------------------------------------- 1 | #include "./Config.hh" 2 | #include "./Layout.hh" 3 | #include "./Node.hh" 4 | 5 | #include 6 | 7 | #include 8 | 9 | using namespace emscripten; 10 | 11 | EMSCRIPTEN_BINDINGS(Config) { 12 | class_("Config") 13 | .constructor<>(&Config::create, allow_raw_pointers()) 14 | .class_function<>("create", &Config::create, allow_raw_pointers()) 15 | .function("setExperimentalFeatureEnabled", &Config::setExperimentalFeatureEnabled) 16 | .function("setPointScaleFactor", &Config::setPointScaleFactor) 17 | .function("isExperimentalFeatureEnabled", &Config::isExperimentalFeatureEnabled) 18 | 19 | ; 20 | } 21 | 22 | EMSCRIPTEN_BINDINGS(Layout) { 23 | value_object("Layout") 24 | .field("left", &Layout::left) 25 | .field("right", &Layout::right) 26 | .field("top", &Layout::top) 27 | .field("bottom", &Layout::bottom) 28 | .field("width", &Layout::width) 29 | .field("height", &Layout::height) 30 | ; 31 | } 32 | 33 | EMSCRIPTEN_BINDINGS(Node) { 34 | class_("MeasureCallback") 35 | .function("measure", &MeasureCallback::measure, pure_virtual()) 36 | .allow_subclass("MeasureCallbackWrapper") 37 | ; 38 | class_("DirtiedCallback") 39 | .function("dirtied", &DirtiedCallback::dirtied, pure_virtual()) 40 | .allow_subclass("DirtiedCallbackWrapper") 41 | ; 42 | 43 | value_object("Size") 44 | .field("width", &YGSize::width) 45 | .field("height", &YGSize::height) 46 | ; 47 | 48 | value_object("Value") 49 | .field("value", &YGValue::value) 50 | .field("unit", &YGValue::unit) 51 | ; 52 | 53 | class_("Node") 54 | .constructor<>(&Node::createDefault, allow_raw_pointers()) 55 | 56 | .class_function<>("createDefault", &Node::createDefault, allow_raw_pointers()) 57 | .class_function<>("createWithConfig", &Node::createWithConfig, allow_raw_pointers()) 58 | .class_function<>("destroy", &Node::destroy, allow_raw_pointers()) 59 | .function("reset", &Node::reset) 60 | 61 | .function("copyStyle", &Node::copyStyle) 62 | 63 | .function("setPositionType", &Node::setPositionType) 64 | .function("setPosition", &Node::setPosition) 65 | .function("setPositionPercent", &Node::setPositionPercent) 66 | 67 | .function("setAlignContent", &Node::setAlignContent) 68 | .function("setAlignItems", &Node::setAlignItems) 69 | .function("setAlignSelf", &Node::setAlignSelf) 70 | .function("setFlexDirection", &Node::setFlexDirection) 71 | .function("setFlexWrap", &Node::setFlexWrap) 72 | .function("setJustifyContent", &Node::setJustifyContent) 73 | 74 | .function("setMargin", &Node::setMargin) 75 | .function("setMarginPercent", &Node::setMarginPercent) 76 | .function("setMarginAuto", &Node::setMarginAuto) 77 | 78 | .function("setOverflow", &Node::setOverflow) 79 | .function("setDisplay", &Node::setDisplay) 80 | 81 | .function("setFlex", &Node::setFlex) 82 | .function("setFlexBasis", &Node::setFlexBasis) 83 | .function("setFlexBasisPercent", &Node::setFlexBasisPercent) 84 | .function("setFlexGrow", &Node::setFlexGrow) 85 | .function("setFlexShrink", &Node::setFlexShrink) 86 | 87 | .function("setWidth", &Node::setWidth) 88 | .function("setWidthPercent", &Node::setWidthPercent) 89 | .function("setWidthAuto", &Node::setWidthAuto) 90 | .function("setHeight", &Node::setHeight) 91 | .function("setHeightPercent", &Node::setHeightPercent) 92 | .function("setHeightAuto", &Node::setHeightAuto) 93 | 94 | .function("setMinWidth", &Node::setMinWidth) 95 | .function("setMinWidthPercent", &Node::setMinWidthPercent) 96 | .function("setMinHeight", &Node::setMinHeight) 97 | .function("setMinHeightPercent", &Node::setMinHeightPercent) 98 | 99 | .function("setMaxWidth", &Node::setMaxWidth) 100 | .function("setMaxWidthPercent", &Node::setMaxWidthPercent) 101 | .function("setMaxHeight", &Node::setMaxHeight) 102 | .function("setMaxHeightPercent", &Node::setMaxHeightPercent) 103 | 104 | .function("setAspectRatio", &Node::setAspectRatio) 105 | 106 | .function("setBorder", &Node::setBorder) 107 | 108 | .function("setPadding", &Node::setPadding) 109 | .function("setPaddingPercent", &Node::setPaddingPercent) 110 | 111 | .function("getPositionType", &Node::getPositionType) 112 | .function("getPosition", &Node::getPosition) 113 | 114 | .function("getAlignContent", &Node::getAlignContent) 115 | .function("getAlignItems", &Node::getAlignItems) 116 | .function("getAlignSelf", &Node::getAlignSelf) 117 | .function("getFlexDirection", &Node::getFlexDirection) 118 | .function("getFlexWrap", &Node::getFlexWrap) 119 | .function("getJustifyContent", &Node::getJustifyContent) 120 | 121 | .function("getMargin", &Node::getMargin) 122 | 123 | .function("getFlexBasis", &Node::getFlexBasis) 124 | .function("getFlexGrow", &Node::getFlexGrow) 125 | .function("getFlexShrink", &Node::getFlexShrink) 126 | 127 | .function("getWidth", &Node::getWidth) 128 | .function("getHeight", &Node::getHeight) 129 | 130 | .function("getMinWidth", &Node::getMinWidth) 131 | .function("getMinHeight", &Node::getMinHeight) 132 | 133 | .function("getMaxWidth", &Node::getMaxWidth) 134 | .function("getMaxHeight", &Node::getMaxHeight) 135 | 136 | .function("getAspectRatio", &Node::getAspectRatio) 137 | 138 | .function("getBorder", &Node::getBorder) 139 | 140 | .function("getOverflow", &Node::getOverflow) 141 | .function("getDisplay", &Node::getDisplay) 142 | 143 | .function("getPadding", &Node::getPadding) 144 | 145 | .function("insertChild", &Node::insertChild, allow_raw_pointers()) 146 | .function("removeChild", &Node::removeChild, allow_raw_pointers()) 147 | 148 | .function("getChildCount", &Node::getChildCount) 149 | 150 | .function("getParent", &Node::getParent, allow_raw_pointers()) 151 | .function("getChild", &Node::getChild, allow_raw_pointers()) 152 | 153 | .function("isReferenceBaseline", &Node::isReferenceBaseline) 154 | .function("setIsReferenceBaseline", &Node::setIsReferenceBaseline) 155 | 156 | .function("setMeasureFunc", &Node::setMeasureFunc, allow_raw_pointers()) 157 | .function("unsetMeasureFunc", &Node::unsetMeasureFunc) 158 | 159 | .function("setDirtiedFunc", &Node::setDirtiedFunc, allow_raw_pointers()) 160 | .function("unsetDirtiedFunc", &Node::unsetDirtiedFunc) 161 | 162 | .function("markDirty", &Node::markDirty) 163 | .function("isDirty", &Node::isDirty) 164 | 165 | .function("calculateLayout", &Node::calculateLayout) 166 | 167 | .function("getComputedLeft", &Node::getComputedLeft) 168 | .function("getComputedRight", &Node::getComputedRight) 169 | 170 | .function("getComputedTop", &Node::getComputedTop) 171 | .function("getComputedBottom", &Node::getComputedBottom) 172 | 173 | .function("getComputedWidth", &Node::getComputedWidth) 174 | .function("getComputedHeight", &Node::getComputedHeight) 175 | 176 | .function("getComputedLayout", &Node::getComputedLayout) 177 | 178 | .function("getComputedMargin", &Node::getComputedMargin) 179 | .function("getComputedBorder", &Node::getComputedBorder) 180 | .function("getComputedPadding", &Node::getComputedPadding) 181 | ; 182 | } 183 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "yoga-wasm", 3 | "version": "0.0.2", 4 | "description": "The Yoga layout engine, but in WebAssembly", 5 | "keywords": [ 6 | "wasm", 7 | "webassembly", 8 | "yoga", 9 | "yoga-layout", 10 | "flexbox" 11 | ], 12 | "homepage": "https://github.com/rickbutton/yoga-wasm", 13 | "main": "build/index.cjs.js", 14 | "module": "build/index.esm.js", 15 | "types": "build/index.cjs.d.ts", 16 | "files": [ 17 | "build" 18 | ], 19 | "author": "Rick Button (https://button.dev)", 20 | "license": "MIT", 21 | "devDependencies": { 22 | "@rollup/plugin-commonjs": "^11.0.2", 23 | "@rollup/plugin-sucrase": "^3.0.0", 24 | "rollup": "^2.3.4", 25 | "rollup-plugin-copy": "^3.3.0" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | import sucrase from "@rollup/plugin-sucrase"; 2 | import commonjs from "@rollup/plugin-commonjs"; 3 | import copy from "rollup-plugin-copy"; 4 | 5 | export default { 6 | input: "src/index.js", 7 | output: [ 8 | { 9 | file: "build/index.cjs.js", 10 | format: "cjs", 11 | }, 12 | { 13 | file: "build/index.esm.js", 14 | format: "esm" 15 | }, 16 | ], 17 | plugins: [ 18 | sucrase({ 19 | transforms: ["flow"], 20 | }), 21 | commonjs(), 22 | copy({ 23 | targets:[ 24 | { src: "src/index.d.ts", dest: "build/", rename: "index.cjs.d.ts" }, 25 | { src: "src/index.d.ts", dest: "build/", rename: "index.esm.d.ts" }, 26 | ], 27 | }), 28 | ], 29 | } 30 | -------------------------------------------------------------------------------- /src/index.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for yoga-layout 1.9 2 | // Project: https://github.com/facebook/yoga#readme 3 | // Definitions by: tnobody 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 5 | // TypeScript Version: 2.1 6 | 7 | export const ALIGN_AUTO: 0; 8 | export const ALIGN_COUNT: 8; 9 | export const ALIGN_FLEX_START: 1; 10 | export const ALIGN_CENTER: 2; 11 | export const ALIGN_FLEX_END: 3; 12 | export const ALIGN_STRETCH: 4; 13 | export const ALIGN_BASELINE: 5; 14 | export const ALIGN_SPACE_BETWEEN: 6; 15 | export const ALIGN_SPACE_AROUND: 7; 16 | export const DIMENSION_COUNT: 2; 17 | export const DIMENSION_WIDTH: 0; 18 | export const DIMENSION_HEIGHT: 1; 19 | export const DIRECTION_COUNT: 3; 20 | export const DIRECTION_INHERIT: 0; 21 | export const DIRECTION_LTR: 1; 22 | export const DIRECTION_RTL: 2; 23 | export const DISPLAY_COUNT: 2; 24 | export const DISPLAY_FLEX: 0; 25 | export const DISPLAY_NONE: 1; 26 | export const EDGE_COUNT: 9; 27 | export const EDGE_LEFT: 0; 28 | export const EDGE_TOP: 1; 29 | export const EDGE_RIGHT: 2; 30 | export const EDGE_BOTTOM: 3; 31 | export const EDGE_START: 4; 32 | export const EDGE_END: 5; 33 | export const EDGE_HORIZONTAL: 6; 34 | export const EDGE_VERTICAL: 7; 35 | export const EDGE_ALL: 8; 36 | export const EXPERIMENTAL_FEATURE_COUNT: 1; 37 | export const EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS: 0; 38 | export const FLEX_DIRECTION_COUNT: 4; 39 | export const FLEX_DIRECTION_COLUMN: 0; 40 | export const FLEX_DIRECTION_COLUMN_REVERSE: 1; 41 | export const FLEX_DIRECTION_ROW: 2; 42 | export const FLEX_DIRECTION_ROW_REVERSE: 3; 43 | export const JUSTIFY_COUNT: 6; 44 | export const JUSTIFY_FLEX_START: 0; 45 | export const JUSTIFY_CENTER: 1; 46 | export const JUSTIFY_FLEX_END: 2; 47 | export const JUSTIFY_SPACE_BETWEEN: 3; 48 | export const JUSTIFY_SPACE_AROUND: 4; 49 | export const JUSTIFY_SPACE_EVENLY: 5; 50 | export const LOG_LEVEL_COUNT: 6; 51 | export const LOG_LEVEL_ERROR: 0; 52 | export const LOG_LEVEL_WARN: 1; 53 | export const LOG_LEVEL_INFO: 2; 54 | export const LOG_LEVEL_DEBUG: 3; 55 | export const LOG_LEVEL_VERBOSE: 4; 56 | export const LOG_LEVEL_FATAL: 5; 57 | export const MEASURE_MODE_COUNT: 3; 58 | export const MEASURE_MODE_UNDEFINED: 0; 59 | export const MEASURE_MODE_EXACTLY: 1; 60 | export const MEASURE_MODE_AT_MOST: 2; 61 | export const NODE_TYPE_COUNT: 2; 62 | export const NODE_TYPE_DEFAULT: 0; 63 | export const NODE_TYPE_TEXT: 1; 64 | export const OVERFLOW_COUNT: 3; 65 | export const OVERFLOW_VISIBLE: 0; 66 | export const OVERFLOW_HIDDEN: 1; 67 | export const OVERFLOW_SCROLL: 2; 68 | export const POSITION_TYPE_COUNT: 2; 69 | export const POSITION_TYPE_RELATIVE: 0; 70 | export const POSITION_TYPE_ABSOLUTE: 1; 71 | export const PRINT_OPTIONS_COUNT: 3; 72 | export const PRINT_OPTIONS_LAYOUT: 1; 73 | export const PRINT_OPTIONS_STYLE: 2; 74 | export const PRINT_OPTIONS_CHILDREN: 4; 75 | export const UNIT_COUNT: 4; 76 | export const UNIT_UNDEFINED: 0; 77 | export const UNIT_POINT: 1; 78 | export const UNIT_PERCENT: 2; 79 | export const UNIT_AUTO: 3; 80 | export const WRAP_COUNT: 3; 81 | export const WRAP_NO_WRAP: 0; 82 | export const WRAP_WRAP: 1; 83 | export const WRAP_WRAP_REVERSE: 2; 84 | 85 | export type YogaJustifyContent = 86 | | typeof JUSTIFY_CENTER 87 | | typeof JUSTIFY_FLEX_END 88 | | typeof JUSTIFY_FLEX_START 89 | | typeof JUSTIFY_SPACE_AROUND 90 | | typeof JUSTIFY_SPACE_BETWEEN 91 | | typeof JUSTIFY_SPACE_EVENLY; 92 | 93 | export type YogaAlign = 94 | | typeof ALIGN_AUTO 95 | | typeof ALIGN_BASELINE 96 | | typeof ALIGN_CENTER 97 | | typeof ALIGN_FLEX_END 98 | | typeof ALIGN_FLEX_START 99 | | typeof ALIGN_SPACE_AROUND 100 | | typeof ALIGN_SPACE_BETWEEN 101 | | typeof ALIGN_STRETCH; 102 | 103 | export type YogaFlexDirection = 104 | | typeof FLEX_DIRECTION_COLUMN 105 | | typeof FLEX_DIRECTION_COLUMN_REVERSE 106 | | typeof FLEX_DIRECTION_COUNT 107 | | typeof FLEX_DIRECTION_ROW 108 | | typeof FLEX_DIRECTION_ROW_REVERSE; 109 | 110 | export type YogaDirection = 111 | | typeof DIRECTION_INHERIT 112 | | typeof DIRECTION_LTR 113 | | typeof DIRECTION_RTL; 114 | 115 | export type YogaFlexWrap = 116 | | typeof WRAP_NO_WRAP 117 | | typeof WRAP_WRAP 118 | | typeof WRAP_WRAP_REVERSE; 119 | 120 | export type YogaEdge = 121 | | typeof EDGE_LEFT 122 | | typeof EDGE_TOP 123 | | typeof EDGE_RIGHT 124 | | typeof EDGE_BOTTOM 125 | | typeof EDGE_START 126 | | typeof EDGE_END 127 | | typeof EDGE_HORIZONTAL 128 | | typeof EDGE_VERTICAL 129 | | typeof EDGE_ALL; 130 | 131 | export type YogaDisplay = 132 | | typeof DISPLAY_FLEX 133 | | typeof DISPLAY_NONE; 134 | 135 | export type YogaUnit = 136 | | typeof UNIT_AUTO 137 | | typeof UNIT_PERCENT 138 | | typeof UNIT_POINT 139 | | typeof UNIT_UNDEFINED; 140 | 141 | export type YogaOverflow = 142 | | typeof OVERFLOW_HIDDEN 143 | | typeof OVERFLOW_SCROLL 144 | | typeof OVERFLOW_VISIBLE; 145 | 146 | export type YogaPositionType = 147 | | typeof POSITION_TYPE_ABSOLUTE 148 | | typeof POSITION_TYPE_RELATIVE; 149 | 150 | export type YogaExperimentalFeature = typeof EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS; 151 | 152 | export class Node { 153 | private constructor(); 154 | 155 | static create(config?: Config): Node; 156 | static createDefault(): Node; 157 | static createWithConfig(config: Config): Node; 158 | static destroy(node: Node): Node; 159 | 160 | calculateLayout( 161 | width?: number, 162 | height?: number, 163 | direction?: YogaDirection, 164 | ): void; 165 | copyStyle(node: Node): void; 166 | free(): void; 167 | freeRecursive(): void; 168 | getAlignContent(): YogaAlign; 169 | getAlignItems(): YogaAlign; 170 | getAlignSelf(): YogaAlign; 171 | getAspectRatio(): number; 172 | getBorder(edge: YogaEdge): number; 173 | getChild(index: number): Node; 174 | getChildCount(): number; 175 | getComputedBorder(edge: YogaEdge): number; 176 | getComputedBottom(): number; 177 | getComputedHeight(): number; 178 | getComputedLayout(): Layout; 179 | getComputedLeft(): number; 180 | getComputedMargin(edge: YogaEdge): number; 181 | getComputedPadding(edge: YogaEdge): number; 182 | getComputedRight(): number; 183 | getComputedTop(): number; 184 | getComputedWidth(): number; 185 | getDisplay(): YogaDisplay; 186 | getFlexBasis(): number; 187 | getFlexDirection(): YogaFlexDirection; 188 | getFlexGrow(): number; 189 | getFlexShrink(): number; 190 | getFlexWrap(): YogaFlexWrap; 191 | getHeight(): Value; 192 | getJustifyContent(): YogaJustifyContent; 193 | getMargin(edge: YogaEdge): Value; 194 | getMaxHeight(): Value; 195 | getMaxWidth(): Value; 196 | getMinHeight(): Value; 197 | getMinWidth(): Value; 198 | getOverflow(): YogaOverflow; 199 | getPadding(edge: YogaEdge): Value; 200 | getParent(): Node | null; 201 | getPosition(edge: YogaEdge): Value; 202 | getPositionType(): YogaPositionType; 203 | getWidth(): Value; 204 | insertChild(child: Node, index: number): void; 205 | isDirty(): boolean; 206 | markDirty(): void; 207 | removeChild(child: Node): void; 208 | reset(): void; 209 | setAlignContent(alignContent: YogaAlign): void; 210 | setAlignItems(alignItems: YogaAlign): void; 211 | setAlignSelf(alignSelf: YogaAlign): void; 212 | setAspectRatio(aspectRatio: number): void; 213 | setBorder(edge: YogaEdge, borderWidth: number): void; 214 | setDisplay(display: YogaDisplay): void; 215 | setFlex(flex: number): void; 216 | setFlexBasis(flexBasis: number | string): void; 217 | setFlexBasisPercent(flexBasis: number): void; 218 | setFlexDirection(flexDirection: YogaFlexDirection): void; 219 | setFlexGrow(flexGrow: number): void; 220 | setFlexShrink(flexShrink: number): void; 221 | setFlexWrap(flexWrap: YogaFlexWrap): void; 222 | setHeight(height: number | string): void; 223 | setHeightAuto(): void; 224 | setHeightPercent(height: number): void; 225 | setJustifyContent(justifyContent: YogaJustifyContent): void; 226 | setMargin(edge: YogaEdge, margin: number): void; 227 | setMarginAuto(edge: YogaEdge): void; 228 | setMarginPercent(edge: YogaEdge, margin: number): void; 229 | setMaxHeight(maxHeight: number | string): void; 230 | setMaxHeightPercent(maxHeight: number): void; 231 | setMaxWidth(maxWidth: number | string): void; 232 | setMaxWidthPercent(maxWidth: number): void; 233 | setMeasureFunc(measureFunc: (() => any) | null): void; 234 | setMinHeight(minHeight: number | string): void; 235 | setMinHeightPercent(minHeight: number): void; 236 | setMinWidth(minWidth: number | string): void; 237 | setMinWidthPercent(minWidth: number): void; 238 | setOverflow(overflow: YogaOverflow): void; 239 | setPadding(edge: YogaEdge, padding: number | string): void; 240 | setPaddingPercent(edge: YogaEdge, padding: number): void; 241 | setPosition(edge: YogaEdge, position: number | string): void; 242 | setPositionPercent(edge: YogaEdge, position: number): void; 243 | setPositionType(positionType: YogaPositionType): void; 244 | setWidth(width: number | string): void; 245 | setWidthAuto(): void; 246 | setWidthPercent(width: number): void; 247 | unsetMeasureFun(): void; 248 | } 249 | 250 | export class Config { 251 | private constructor(); 252 | 253 | static create(): Config; 254 | static destroy(config: Config): any; 255 | 256 | isExperimentalFeatureEnabled(feature: YogaExperimentalFeature): boolean; 257 | setExperimentalFeatureEnabled( 258 | feature: YogaExperimentalFeature, 259 | enabled: boolean, 260 | ): void; 261 | setPointScaleFactor(factor: number): void; 262 | } 263 | 264 | export class Layout { 265 | readonly left: number; 266 | readonly right: number; 267 | readonly top: number; 268 | readonly bottom: number; 269 | readonly width: number; 270 | readonly height: number; 271 | constructor( 272 | left: number, 273 | right: number, 274 | top: number, 275 | bottom: number, 276 | width: number, 277 | height: number, 278 | ); 279 | } 280 | 281 | export class Size { 282 | readonly width: number; 283 | readonly height: number; 284 | 285 | constructor(width: number, height: number); 286 | } 287 | 288 | export class Value { 289 | readonly unit: YogaUnit | number; 290 | readonly value: number; 291 | 292 | constructor(unit: YogaUnit | number, value: number); 293 | } 294 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import Yoga from "../build/yoga"; 2 | import entry from "../yoga/javascript/sources/entry-common"; 3 | 4 | const mod = Yoga(); 5 | 6 | function bind(name, proto) { 7 | return proto; 8 | } 9 | 10 | export default entry(bind, mod); 11 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | "@nodelib/fs.scandir@2.1.3": 6 | version "2.1.3" 7 | resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz#3a582bdb53804c6ba6d146579c46e52130cf4a3b" 8 | integrity sha512-eGmwYQn3gxo4r7jdQnkrrN6bY478C3P+a/y72IJukF8LjB6ZHeB3c+Ehacj3sYeSmUXGlnA67/PmbM9CVwL7Dw== 9 | dependencies: 10 | "@nodelib/fs.stat" "2.0.3" 11 | run-parallel "^1.1.9" 12 | 13 | "@nodelib/fs.stat@2.0.3", "@nodelib/fs.stat@^2.0.2": 14 | version "2.0.3" 15 | resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.3.tgz#34dc5f4cabbc720f4e60f75a747e7ecd6c175bd3" 16 | integrity sha512-bQBFruR2TAwoevBEd/NWMoAAtNGzTRgdrqnYCc7dhzfoNvqPzLyqlEQnzZ3kVnNrSp25iyxE00/3h2fqGAGArA== 17 | 18 | "@nodelib/fs.walk@^1.2.3": 19 | version "1.2.4" 20 | resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.4.tgz#011b9202a70a6366e436ca5c065844528ab04976" 21 | integrity sha512-1V9XOY4rDW0rehzbrcqAmHnz8e7SKvX27gh8Gt2WgB0+pdzdiLV83p72kZPU+jvMbS1qU5mauP2iOvO8rhmurQ== 22 | dependencies: 23 | "@nodelib/fs.scandir" "2.1.3" 24 | fastq "^1.6.0" 25 | 26 | "@rollup/plugin-commonjs@^11.0.2": 27 | version "11.0.2" 28 | resolved "https://registry.yarnpkg.com/@rollup/plugin-commonjs/-/plugin-commonjs-11.0.2.tgz#837cc6950752327cb90177b608f0928a4e60b582" 29 | integrity sha512-MPYGZr0qdbV5zZj8/2AuomVpnRVXRU5XKXb3HVniwRoRCreGlf5kOE081isNWeiLIi6IYkwTX9zE0/c7V8g81g== 30 | dependencies: 31 | "@rollup/pluginutils" "^3.0.0" 32 | estree-walker "^1.0.1" 33 | is-reference "^1.1.2" 34 | magic-string "^0.25.2" 35 | resolve "^1.11.0" 36 | 37 | "@rollup/plugin-sucrase@^3.0.0": 38 | version "3.0.0" 39 | resolved "https://registry.yarnpkg.com/@rollup/plugin-sucrase/-/plugin-sucrase-3.0.0.tgz#e46735dd9d938fce28413cd27470fe364b3cb2dd" 40 | integrity sha512-sUQkoAXdw+bnd/cNZHGy5yQKW6OYYU7QlYBGhReI95uZljxO8t1LlbqCO2viIMV/u9pcCjgi8N9PcApcrJCA8Q== 41 | dependencies: 42 | "@rollup/pluginutils" "^3.0.1" 43 | sucrase "^3.10.1" 44 | 45 | "@rollup/pluginutils@^3.0.0", "@rollup/pluginutils@^3.0.1": 46 | version "3.0.8" 47 | resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.0.8.tgz#4e94d128d94b90699e517ef045422960d18c8fde" 48 | integrity sha512-rYGeAc4sxcZ+kPG/Tw4/fwJODC3IXHYDH4qusdN/b6aLw5LPUbzpecYbEJh4sVQGPFJxd2dBU4kc1H3oy9/bnw== 49 | dependencies: 50 | estree-walker "^1.0.1" 51 | 52 | "@types/estree@0.0.39": 53 | version "0.0.39" 54 | resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" 55 | integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== 56 | 57 | "@types/events@*": 58 | version "3.0.0" 59 | resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7" 60 | integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g== 61 | 62 | "@types/fs-extra@^8.0.1": 63 | version "8.1.0" 64 | resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-8.1.0.tgz#1114834b53c3914806cd03b3304b37b3bd221a4d" 65 | integrity sha512-UoOfVEzAUpeSPmjm7h1uk5MH6KZma2z2O7a75onTGjnNvAvMVrPzPL/vBbT65iIGHWj6rokwfmYcmxmlSf2uwg== 66 | dependencies: 67 | "@types/node" "*" 68 | 69 | "@types/glob@^7.1.1": 70 | version "7.1.1" 71 | resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.1.tgz#aa59a1c6e3fbc421e07ccd31a944c30eba521575" 72 | integrity sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w== 73 | dependencies: 74 | "@types/events" "*" 75 | "@types/minimatch" "*" 76 | "@types/node" "*" 77 | 78 | "@types/minimatch@*": 79 | version "3.0.3" 80 | resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" 81 | integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== 82 | 83 | "@types/node@*": 84 | version "13.11.0" 85 | resolved "https://registry.yarnpkg.com/@types/node/-/node-13.11.0.tgz#390ea202539c61c8fa6ba4428b57e05bc36dc47b" 86 | integrity sha512-uM4mnmsIIPK/yeO+42F2RQhGUIs39K2RFmugcJANppXe6J1nvH87PvzPZYpza7Xhhs8Yn9yIAVdLZ84z61+0xQ== 87 | 88 | any-promise@^1.0.0: 89 | version "1.3.0" 90 | resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" 91 | integrity sha1-q8av7tzqUugJzcA3au0845Y10X8= 92 | 93 | array-union@^2.1.0: 94 | version "2.1.0" 95 | resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" 96 | integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== 97 | 98 | balanced-match@^1.0.0: 99 | version "1.0.0" 100 | resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" 101 | integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= 102 | 103 | brace-expansion@^1.1.7: 104 | version "1.1.11" 105 | resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" 106 | integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== 107 | dependencies: 108 | balanced-match "^1.0.0" 109 | concat-map "0.0.1" 110 | 111 | braces@^3.0.1: 112 | version "3.0.2" 113 | resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" 114 | integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== 115 | dependencies: 116 | fill-range "^7.0.1" 117 | 118 | colorette@^1.1.0: 119 | version "1.1.0" 120 | resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.1.0.tgz#1f943e5a357fac10b4e0f5aaef3b14cdc1af6ec7" 121 | integrity sha512-6S062WDQUXi6hOfkO/sBPVwE5ASXY4G2+b4atvhJfSsuUUhIaUKlkjLe9692Ipyt5/a+IPF5aVTu3V5gvXq5cg== 122 | 123 | commander@^4.0.0: 124 | version "4.1.1" 125 | resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" 126 | integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== 127 | 128 | concat-map@0.0.1: 129 | version "0.0.1" 130 | resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" 131 | integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= 132 | 133 | dir-glob@^3.0.1: 134 | version "3.0.1" 135 | resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" 136 | integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== 137 | dependencies: 138 | path-type "^4.0.0" 139 | 140 | estree-walker@^1.0.1: 141 | version "1.0.1" 142 | resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-1.0.1.tgz#31bc5d612c96b704106b477e6dd5d8aa138cb700" 143 | integrity sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg== 144 | 145 | fast-glob@^3.0.3: 146 | version "3.2.2" 147 | resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.2.tgz#ade1a9d91148965d4bf7c51f72e1ca662d32e63d" 148 | integrity sha512-UDV82o4uQyljznxwMxyVRJgZZt3O5wENYojjzbaGEGZgeOxkLFf+V4cnUD+krzb2F72E18RhamkMZ7AdeggF7A== 149 | dependencies: 150 | "@nodelib/fs.stat" "^2.0.2" 151 | "@nodelib/fs.walk" "^1.2.3" 152 | glob-parent "^5.1.0" 153 | merge2 "^1.3.0" 154 | micromatch "^4.0.2" 155 | picomatch "^2.2.1" 156 | 157 | fastq@^1.6.0: 158 | version "1.7.0" 159 | resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.7.0.tgz#fcd79a08c5bd7ec5b55cd3f5c4720db551929801" 160 | integrity sha512-YOadQRnHd5q6PogvAR/x62BGituF2ufiEA6s8aavQANw5YKHERI4AREboX6KotzP8oX2klxYF2wcV/7bn1clfQ== 161 | dependencies: 162 | reusify "^1.0.4" 163 | 164 | fill-range@^7.0.1: 165 | version "7.0.1" 166 | resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" 167 | integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== 168 | dependencies: 169 | to-regex-range "^5.0.1" 170 | 171 | fs-extra@^8.1.0: 172 | version "8.1.0" 173 | resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" 174 | integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== 175 | dependencies: 176 | graceful-fs "^4.2.0" 177 | jsonfile "^4.0.0" 178 | universalify "^0.1.0" 179 | 180 | fs.realpath@^1.0.0: 181 | version "1.0.0" 182 | resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" 183 | integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= 184 | 185 | fsevents@~2.1.2: 186 | version "2.1.2" 187 | resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.2.tgz#4c0a1fb34bc68e543b4b82a9ec392bfbda840805" 188 | integrity sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA== 189 | 190 | glob-parent@^5.1.0: 191 | version "5.1.1" 192 | resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.1.tgz#b6c1ef417c4e5663ea498f1c45afac6916bbc229" 193 | integrity sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ== 194 | dependencies: 195 | is-glob "^4.0.1" 196 | 197 | glob@7.1.6, glob@^7.1.3: 198 | version "7.1.6" 199 | resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" 200 | integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== 201 | dependencies: 202 | fs.realpath "^1.0.0" 203 | inflight "^1.0.4" 204 | inherits "2" 205 | minimatch "^3.0.4" 206 | once "^1.3.0" 207 | path-is-absolute "^1.0.0" 208 | 209 | globby@10.0.1: 210 | version "10.0.1" 211 | resolved "https://registry.yarnpkg.com/globby/-/globby-10.0.1.tgz#4782c34cb75dd683351335c5829cc3420e606b22" 212 | integrity sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A== 213 | dependencies: 214 | "@types/glob" "^7.1.1" 215 | array-union "^2.1.0" 216 | dir-glob "^3.0.1" 217 | fast-glob "^3.0.3" 218 | glob "^7.1.3" 219 | ignore "^5.1.1" 220 | merge2 "^1.2.3" 221 | slash "^3.0.0" 222 | 223 | graceful-fs@^4.1.6, graceful-fs@^4.2.0: 224 | version "4.2.3" 225 | resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" 226 | integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== 227 | 228 | ignore@^5.1.1: 229 | version "5.1.4" 230 | resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.4.tgz#84b7b3dbe64552b6ef0eca99f6743dbec6d97adf" 231 | integrity sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A== 232 | 233 | inflight@^1.0.4: 234 | version "1.0.6" 235 | resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" 236 | integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= 237 | dependencies: 238 | once "^1.3.0" 239 | wrappy "1" 240 | 241 | inherits@2: 242 | version "2.0.4" 243 | resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" 244 | integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== 245 | 246 | is-extglob@^2.1.1: 247 | version "2.1.1" 248 | resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" 249 | integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= 250 | 251 | is-glob@^4.0.1: 252 | version "4.0.1" 253 | resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" 254 | integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== 255 | dependencies: 256 | is-extglob "^2.1.1" 257 | 258 | is-number@^7.0.0: 259 | version "7.0.0" 260 | resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" 261 | integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== 262 | 263 | is-plain-object@^3.0.0: 264 | version "3.0.0" 265 | resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-3.0.0.tgz#47bfc5da1b5d50d64110806c199359482e75a928" 266 | integrity sha512-tZIpofR+P05k8Aocp7UI/2UTa9lTJSebCXpFFoR9aibpokDj/uXBsJ8luUu0tTVYKkMU6URDUuOfJZ7koewXvg== 267 | dependencies: 268 | isobject "^4.0.0" 269 | 270 | is-reference@^1.1.2: 271 | version "1.1.4" 272 | resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.1.4.tgz#3f95849886ddb70256a3e6d062b1a68c13c51427" 273 | integrity sha512-uJA/CDPO3Tao3GTrxYn6AwkM4nUPJiGGYu5+cB8qbC7WGFlrKZbiRo7SFKxUAEpFUfiHofWCXBUNhvYJMh+6zw== 274 | dependencies: 275 | "@types/estree" "0.0.39" 276 | 277 | isobject@^4.0.0: 278 | version "4.0.0" 279 | resolved "https://registry.yarnpkg.com/isobject/-/isobject-4.0.0.tgz#3f1c9155e73b192022a80819bacd0343711697b0" 280 | integrity sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA== 281 | 282 | jsonfile@^4.0.0: 283 | version "4.0.0" 284 | resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" 285 | integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= 286 | optionalDependencies: 287 | graceful-fs "^4.1.6" 288 | 289 | lines-and-columns@^1.1.6: 290 | version "1.1.6" 291 | resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" 292 | integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= 293 | 294 | magic-string@^0.25.2: 295 | version "0.25.7" 296 | resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051" 297 | integrity sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA== 298 | dependencies: 299 | sourcemap-codec "^1.4.4" 300 | 301 | merge2@^1.2.3, merge2@^1.3.0: 302 | version "1.3.0" 303 | resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.3.0.tgz#5b366ee83b2f1582c48f87e47cf1a9352103ca81" 304 | integrity sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw== 305 | 306 | micromatch@^4.0.2: 307 | version "4.0.2" 308 | resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259" 309 | integrity sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q== 310 | dependencies: 311 | braces "^3.0.1" 312 | picomatch "^2.0.5" 313 | 314 | minimatch@^3.0.4: 315 | version "3.0.4" 316 | resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" 317 | integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== 318 | dependencies: 319 | brace-expansion "^1.1.7" 320 | 321 | mz@^2.7.0: 322 | version "2.7.0" 323 | resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" 324 | integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== 325 | dependencies: 326 | any-promise "^1.0.0" 327 | object-assign "^4.0.1" 328 | thenify-all "^1.0.0" 329 | 330 | node-modules-regexp@^1.0.0: 331 | version "1.0.0" 332 | resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" 333 | integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= 334 | 335 | object-assign@^4.0.1: 336 | version "4.1.1" 337 | resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" 338 | integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= 339 | 340 | once@^1.3.0: 341 | version "1.4.0" 342 | resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" 343 | integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= 344 | dependencies: 345 | wrappy "1" 346 | 347 | path-is-absolute@^1.0.0: 348 | version "1.0.1" 349 | resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" 350 | integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= 351 | 352 | path-parse@^1.0.6: 353 | version "1.0.6" 354 | resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" 355 | integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== 356 | 357 | path-type@^4.0.0: 358 | version "4.0.0" 359 | resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" 360 | integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== 361 | 362 | picomatch@^2.0.5, picomatch@^2.2.1: 363 | version "2.2.2" 364 | resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" 365 | integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== 366 | 367 | pirates@^4.0.1: 368 | version "4.0.1" 369 | resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" 370 | integrity sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA== 371 | dependencies: 372 | node-modules-regexp "^1.0.0" 373 | 374 | resolve@^1.11.0: 375 | version "1.15.1" 376 | resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.15.1.tgz#27bdcdeffeaf2d6244b95bb0f9f4b4653451f3e8" 377 | integrity sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w== 378 | dependencies: 379 | path-parse "^1.0.6" 380 | 381 | reusify@^1.0.4: 382 | version "1.0.4" 383 | resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" 384 | integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== 385 | 386 | rollup-plugin-copy@^3.3.0: 387 | version "3.3.0" 388 | resolved "https://registry.yarnpkg.com/rollup-plugin-copy/-/rollup-plugin-copy-3.3.0.tgz#5ba230047f86b9f703a29288f242948a5580e7b9" 389 | integrity sha512-euDjCUSBXZa06nqnwCNADbkAcYDfzwowfZQkto9K/TFhiH+QG7I4PUsEMwM9tDgomGWJc//z7KLW8t+tZwxADA== 390 | dependencies: 391 | "@types/fs-extra" "^8.0.1" 392 | colorette "^1.1.0" 393 | fs-extra "^8.1.0" 394 | globby "10.0.1" 395 | is-plain-object "^3.0.0" 396 | 397 | rollup@^2.3.4: 398 | version "2.3.4" 399 | resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.3.4.tgz#979e461f8cab1a71aec2d37ce2a434052ae70223" 400 | integrity sha512-8U9x54RCVhrUEV1zon4Pp8kokg1HM0fwzf5vkwe2/rOfyTClarx5e27kFlaoZ7ofJiazWkNQ+dgdG4HuZxkQ9A== 401 | optionalDependencies: 402 | fsevents "~2.1.2" 403 | 404 | run-parallel@^1.1.9: 405 | version "1.1.9" 406 | resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.9.tgz#c9dd3a7cf9f4b2c4b6244e173a6ed866e61dd679" 407 | integrity sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q== 408 | 409 | slash@^3.0.0: 410 | version "3.0.0" 411 | resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" 412 | integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== 413 | 414 | sourcemap-codec@^1.4.4: 415 | version "1.4.8" 416 | resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" 417 | integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA== 418 | 419 | sucrase@^3.10.1: 420 | version "3.13.0" 421 | resolved "https://registry.yarnpkg.com/sucrase/-/sucrase-3.13.0.tgz#68eb000dea32dd2ec84b91de97c76dcb83a1a2ff" 422 | integrity sha512-koXmWc8Iq8q7quNJ9v/TuDIRBeGul1D+QL36PnfzFvYFoQbWcYpSmpJElpSM+eCa0nFthyQqgCGrEKAepnFMtQ== 423 | dependencies: 424 | commander "^4.0.0" 425 | glob "7.1.6" 426 | lines-and-columns "^1.1.6" 427 | mz "^2.7.0" 428 | pirates "^4.0.1" 429 | ts-interface-checker "^0.1.9" 430 | 431 | thenify-all@^1.0.0: 432 | version "1.6.0" 433 | resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" 434 | integrity sha1-GhkY1ALY/D+Y+/I02wvMjMEOlyY= 435 | dependencies: 436 | thenify ">= 3.1.0 < 4" 437 | 438 | "thenify@>= 3.1.0 < 4": 439 | version "3.3.0" 440 | resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.0.tgz#e69e38a1babe969b0108207978b9f62b88604839" 441 | integrity sha1-5p44obq+lpsBCCB5eLn2K4hgSDk= 442 | dependencies: 443 | any-promise "^1.0.0" 444 | 445 | to-regex-range@^5.0.1: 446 | version "5.0.1" 447 | resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" 448 | integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== 449 | dependencies: 450 | is-number "^7.0.0" 451 | 452 | ts-interface-checker@^0.1.9: 453 | version "0.1.10" 454 | resolved "https://registry.yarnpkg.com/ts-interface-checker/-/ts-interface-checker-0.1.10.tgz#b68a49e37e90a05797e590f08494dd528bf383cf" 455 | integrity sha512-UJYuKET7ez7ry0CnvfY6fPIUIZDw+UI3qvTUQeS2MyI4TgEeWAUBqy185LeaHcdJ9zG2dgFpPJU/AecXU0Afug== 456 | 457 | universalify@^0.1.0: 458 | version "0.1.2" 459 | resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" 460 | integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== 461 | 462 | wrappy@1: 463 | version "1.0.2" 464 | resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" 465 | integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= 466 | --------------------------------------------------------------------------------