Files
yoga/dist/css-layout.min.js

2 lines
7.5 KiB
JavaScript
Raw Normal View History

!function(a,b){"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?module.exports=b():a.computeLayout=b()}(this,function(){var a=function(){function a(a){return a.charAt(0).toUpperCase()+a.slice(1)}function b(b,c,d,e){for(var f=0;f<e.length;++f){var g=e[f],h=c+a(g)+d;if(h in b.style)return b.style[h];if(h=c+d,h in b.style)return b.style[h]}return 0}function c(a){return a.layout={width:void 0,height:void 0,top:0,left:0,right:0,bottom:0},a.style||(a.style={}),(!a.children||a.style.measure)&&(a.children=[]),a.children.forEach(c),a}function d(a){var b=a.layout;return delete a.layout,a.children&&a.children.length>0?b.children=a.children.map(d):delete a.children,delete b.right,delete b.bottom,delete b.direction,b}function e(b,c,d,e){for(var f=0;f<e.length;++f){var g=e[f],h=c+a(g)+d;if(h in b.style&&b.style[h]>=0)return b.style[h];if(h=c+d,h in b.style&&b.style[h]>=0)return b.style[h]}return 0}function f(a){return void 0===a}function g(a){return a===Y||a===Z}function h(a){return a===$||a===_}function i(a){var b=[ka[a]];return g(a)&&b.unshift("start"),b}function j(a){var b=[la[a]];return g(a)&&b.unshift("end"),b}function k(a,c){return b(a,"margin","",c)}function l(a,b){return k(a,i(b))}function m(a,b){return k(a,j(b))}function n(a,b){return e(a,"padding","",b)}function o(a,b){return n(a,i(b))}function p(a,b){return n(a,j(b))}function q(a,b){return e(a,"border","Width",b)}function r(a,b){return q(a,i(b))}function s(a,b){return q(a,j(b))}function t(a,b){return o(a,b)+r(a,b)}function u(a,b){return p(a,b)+s(a,b)}function v(a,b){return r(a,b)+s(a,b)}function w(a,b){return l(a,b)+m(a,b)}function x(a,b){return t(a,b)+u(a,b)}function y(a){return"justifyContent"in a.style?a.style.justifyContent:"flex-start"}function z(a){return"alignContent"in a.style?a.style.alignContent:"flex-start"}function A(a,b){return"alignSelf"in b.style?b.style.alignSelf:"alignItems"in a.style?a.style.alignItems:"stretch"}function B(a,b){if(b===X){if(a===Y)return Z;if(a===Z)return Y}return a}function C(a,b){var c;return c="direction"in a.style?a.style.direction:V,c===V&&(c=void 0===b?W:b),c}function D(a){return"flexDirection"in a.style?a.style.flexDirection:$}function E(a,b){return h(a)?B(Y,b):$}function F(a){return"position"in a.style?a.style.position:"relative"}function G(a){return a.style.flex}function H(a){return F(a)===ia&&G(a)>0}function I(a){return"wrap"===a.style.flexWrap}function J(a,b){return a.layout[na[b]]+w(a,b)}function K(a,b){return!f(a.style[na[b]])&&a.style[na[b]]>=0}function L(a,b){return!f(a.style[b])}function M(a){return"measure"in a.style}function N(a,b){return b in a.style?a.style[b]:0}function O(a,b,c){var d={row:a.style.minWidth,"row-reverse":a.style.minWidth,column:a.style.minHeight,"column-reverse":a.style.minHeight}[b],e={row:a.style.maxWidth,"row-reverse":a.style.maxWidth,column:a.style.maxHeight,"column-reverse":a.style.maxHeight}[b],g=c;return!f(e)&&e>=0&&g>e&&(g=e),!f(d)&&d>=0&&d>g&&(g=d),g}function P(a,b){return a>b?a:b}function Q(a,b){f(a.layout[na[b]])&&K(a,b)&&(a.layout[na[b]]=P(O(a,b,a.style[na[b]]),x(a,b)))}function R(a,b,c){b.layout[la[c]]=a.layout[na[c]]-b.layout[na[c]]-b.layout[ma[c]]}function S(a,b){return ka[b]in a.style?N(a,ka[b]):-N(a,la[b])}function T(a,b,c){var d=C(a,c),e=B(D(a),d),h=E(e,d),i=B(Y,d);if(Q(a,e),Q(a,h),a.layout.direction=d,a.layout[ka[e]]+=l(a,e)+S(a,e),a.layout[la[e]]+=m(a,e)+S(a,e),a.layout[ka[h]]+=l(a,h)+S(a,h),a.layout[la[h]]+=m(a,h)+S(a,h),M(a)){var j=U;j=K(a,i)?a.style.width:f(a.layout[na[i]])?b-w(a,i):a.layout[na[i]],j-=x(a,i);var k=!K(a,i)&&f(a.layout[na[i]]),n=!K(a,$)&&f(a.layout[na[$]]);if(k||n){var o=a.style.measure(j);k&&(a.layout.width=o.width+x(a,i)),n&&(a.layout.height=o.height+x(a,$))}if(0===a.children.length)return}var p,q,s,V;for(p=0;p<a.children.length;++p)if(s=a.children[p],A(a,s)!==ha||F(s)!==ia||f(a.layout[na[h]])||K(s,h)){if(F(s)===ja)for(q=0;2>q;q++)V=0!==q?Y:$,!f(a.layout[na[V]])&&!K(s,V)&&L(s,ka[V])&&L(s,la[V])&&(s.layout[na[V]]=P(O(s,V,a.layout[na[V]]-x(a,V)-w(s,V)-N(s,ka[V])-N(s,la[V])),x(s,V)))}else s.layout[na[h]]=P(O(s,h,a.layout[na[h]]-x(a,h)-w(s,h
//# sourceMappingURL=css-layout.min.js.map