troika-3d-ui
Advanced tools
Comparing version 0.47.1 to 0.47.2
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.47.2](https://github.com/protectwise/troika/compare/v0.47.1...v0.47.2) (2023-05-15) | ||
**Note:** Version bump only for package troika-3d-ui | ||
## [0.47.1](https://github.com/protectwise/troika/compare/v0.47.0...v0.47.1) (2022-12-15) | ||
@@ -8,0 +16,0 @@ |
@@ -1,56 +0,56 @@ | ||
'use strict';(function(n,z){"object"===typeof exports&&"undefined"!==typeof module?z(exports,require("troika-flex-layout"),require("troika-core"),require("three"),require("troika-3d"),require("troika-3d-text"),require("troika-three-utils"),require("object-path")):"function"===typeof define&&define.amd?define("exports troika-flex-layout troika-core three troika-3d troika-3d-text troika-three-utils object-path".split(" "),z):(n="undefined"!==typeof globalThis?globalThis:n||self,z(n.troika_3d_ui={}, | ||
n.troika_flex_layout,n.troika_core,n.THREE,n.troika_3d,n.troika_3d_text,n.troika_three_utils,n.objectPath))})(this,function(n,z,E,e,t,J,K,v){function w(a,b,c){let d;for(;a&&"inherit"===(d=a[b]);)a=a.parentFlexNode,d=void 0;void 0===d&&(d=c);return d}function F(a,b){let c;for(;a&&"string"===typeof(c=a.fontSize);)if("inherit"===c)a=a.parentFlexNode,c=void 0;else{if(/%$/.test(c)){let d=parseFloat(c)/100;c=F(a.parentFlexNode,b);void 0!==c&&(c*=d)}else console.warn(`Unknown fontSize: ${c}`),c=void 0;break}void 0=== | ||
c&&(c=b);return c}function ea(a){a=t.createDerivedMaterial(a,{defines:{TROIKA_UI_BLOCK:""},extensions:{derivatives:!0},uniforms:{uTroikaBlockSize:{value:new e.Vector2},uTroikaClipRect:{value:new e.Vector4(0,0,0,0)},uTroikaCornerRadii:{value:new e.Vector4(0,0,0,0)},uTroikaBorderWidth:{value:new e.Vector4(0,0,0,0)}},vertexDefs:"\nuniform vec2 uTroikaBlockSize;\nuniform vec4 uTroikaClipRect;\nvarying vec2 vTroikaPosInBlock;\n",vertexTransform:"\nvec2 xy = position.xy * uTroikaBlockSize;\nxy.y *= -1.0;\nxy = clamp(xy, uTroikaClipRect.xy, uTroikaClipRect.zw);\nvTroikaPosInBlock = xy;\nxy.y *= -1.0;\nposition.xy = xy;\n", | ||
'use strict';(function(n,B){"object"===typeof exports&&"undefined"!==typeof module?B(exports,require("troika-flex-layout"),require("troika-core"),require("three"),require("troika-3d"),require("troika-3d-text"),require("troika-three-utils"),require("object-path")):"function"===typeof define&&define.amd?define("exports troika-flex-layout troika-core three troika-3d troika-3d-text troika-three-utils object-path".split(" "),B):(n="undefined"!==typeof globalThis?globalThis:n||self,B(n.troika_3d_ui={}, | ||
n.troika_flex_layout,n.troika_core,n.THREE,n.troika_3d,n.troika_3d_text,n.troika_three_utils,n.objectPath))})(this,function(n,B,C,e,r,G,H,t){function w(a,b,c){let d;for(;a&&"inherit"===(d=a[b]);)a=a.parentFlexNode,d=void 0;void 0===d&&(d=c);return d}function y(a,b){let c;for(;a&&"string"===typeof(c=a.fontSize);)if("inherit"===c)a=a.parentFlexNode,c=void 0;else{if(/%$/.test(c)){let d=parseFloat(c)/100;c=y(a.parentFlexNode,b);void 0!==c&&(c*=d)}else console.warn(`Unknown fontSize: ${c}`),c=void 0;break}void 0=== | ||
c&&(c=b);return c}function ca(a){a=r.createDerivedMaterial(a,{defines:{TROIKA_UI_BLOCK:""},extensions:{derivatives:!0},uniforms:{uTroikaBlockSize:{value:new e.Vector2},uTroikaClipRect:{value:new e.Vector4(0,0,0,0)},uTroikaCornerRadii:{value:new e.Vector4(0,0,0,0)},uTroikaBorderWidth:{value:new e.Vector4(0,0,0,0)}},vertexDefs:"\nuniform vec2 uTroikaBlockSize;\nuniform vec4 uTroikaClipRect;\nvarying vec2 vTroikaPosInBlock;\n",vertexTransform:"\nvec2 xy = position.xy * uTroikaBlockSize;\nxy.y *= -1.0;\nxy = clamp(xy, uTroikaClipRect.xy, uTroikaClipRect.zw);\nvTroikaPosInBlock = xy;\nxy.y *= -1.0;\nposition.xy = xy;\n", | ||
fragmentDefs:"\nuniform vec2 uTroikaBlockSize;\nuniform vec4 uTroikaCornerRadii;\nuniform vec4 uTroikaBorderWidth;\nvarying vec2 vTroikaPosInBlock;\nconst vec4 NO_BORDER = vec4(0.,0.,0.,0.);\n\nfloat troikaEllipseRadiusAtAngle(in float angle, in float rx, in float ry) {\n if (rx == ry) {return rx;}\n float _cos = cos(angle);\n float _sin = sin(angle);\n return 1.0 / sqrt((_cos*_cos)/(rx*rx) + (_sin*_sin)/(ry*ry));\n}\n\nvoid troikaGetCurveDists(\n in vec2 pos, in vec2 radCenter, in float outerR, in float xBorder, in float yBorder, \n out float dOuter, out float dInner\n) {\n vec2 adjPos = pos - radCenter;\n float angle = atan(adjPos.y, adjPos.x);\n dOuter = troikaEllipseRadiusAtAngle(angle, outerR, outerR) - length(adjPos);\n dInner = uTroikaBorderWidth == NO_BORDER ? dInner : \n troikaEllipseRadiusAtAngle(angle, max(0.0, outerR - xBorder), max(0.0, outerR - yBorder)) - length(adjPos);\n}\n\nfloat troikaGetAlphaMultiplier() {\n // Short aliases\n vec2 dim = uTroikaBlockSize;\n vec4 rad = uTroikaCornerRadii;\n vec4 bdr = uTroikaBorderWidth;\n vec2 pos = vTroikaPosInBlock;\n\n float dOuter;\n float dInner;\n bool isOnCurve = true;\n bool isBorder = uTroikaBorderWidth != NO_BORDER;\n\n // Top left\n if (pos.x < rad[0] && pos.y < rad[0]) {\n troikaGetCurveDists(pos, vec2(rad[0], rad[0]), rad[0], bdr[3], bdr[0], dOuter, dInner);\n }\n // Top Right\n else if (pos.x > dim.x - rad[1] && pos.y < rad[1]) {\n troikaGetCurveDists(pos, vec2(dim.x - rad[1], rad[1]), rad[1], bdr[1], bdr[0], dOuter, dInner);\n }\n // Bottom Right\n else if (pos.x > dim.x - rad[2] && pos.y > dim.y - rad[2]) {\n troikaGetCurveDists(pos, vec2(dim.x - rad[2], dim.y - rad[2]), rad[2], bdr[1], bdr[2], dOuter, dInner);\n }\n // Bottom Left\n else if (pos.x < rad[3] && pos.y > dim.y - rad[3]) {\n troikaGetCurveDists(pos, vec2(rad[3], dim.y - rad[3]), rad[3], bdr[3], bdr[2], dOuter, dInner);\n }\n // Not on a curve, use closest side\n else {\n isOnCurve = false;\n dOuter = min(min(pos.x, pos.y), min(dim.x - pos.x, dim.y - pos.y));\n dInner = isBorder ? min(min(pos.x - bdr[3], pos.y - bdr[0]), min(dim.x - pos.x - bdr[1], dim.y - pos.y - bdr[2])) : dInner;\n }\n\n float alpha;\n #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300\n float aa = length(fwidth(pos)) * 0.5;\n alpha = isOnCurve ? smoothstep(-aa, aa, dOuter) : 1.0;\n alpha = isBorder ? min(alpha, (dOuter == dInner) ? 0.0 : smoothstep(aa, -aa, dInner)) : alpha;\n return alpha;\n #else\n alpha = step(0.0, dOuter);\n alpha = isBorder ? min(alpha, step(0.0, -dInner)) : alpha;\n #endif\n return alpha;\n}\n", | ||
fragmentColorTransform:"\nfloat troikaAlphaMult = troikaGetAlphaMultiplier();\nif (troikaAlphaMult == 0.0) {\n discard;\n} else {\n gl_FragColor.a *= troikaAlphaMult;\n}\n"});Object.defineProperty(a,"shadowSide",{get(){return this.side},set(){}});a.transparent=!0;return a}function fa(a){if(!a._didScroll){let c=a.currentTarget,{deltaX:d,deltaY:f,deltaMode:r}=a.nativeEvent;var b=1===r?F(c,16)*w(c,"lineHeight",1.2):F(c,16)/12;d*=b;f*=b;b=Math.max(0,Math.min(c.scrollWidth-c.clientWidth,c.scrollLeft+ | ||
d));let g=Math.max(0,Math.min(c.scrollHeight-c.clientHeight,c.scrollTop+f)),h=Math.abs;if(b!==c.scrollLeft&&h(d)>h(f)||g!==c.scrollTop&&h(f)>h(d))c.scrollLeft=b,c.scrollTop=g,c.afterUpdate(),c.requestRender(),a._didScroll=!0;a.preventDefault()}}function N(a){if(!a._didScroll&&!a.defaultPrevented){let d=a.currentTarget,f=a.ray.clone().applyMatrix4(K.invertMatrix4(d.threeObject.matrixWorld,O)).intersectPlane(ha.setComponents(0,0,1,0),new e.Vector3);var b=d._prevDragPos;if(f&&b&&"drag"===a.type){var c= | ||
f.x-b.x;b=f.y-b.y;if(c||b)if(c=Math.max(0,Math.min(d.scrollWidth-d.clientWidth,d.scrollLeft+c)),b=Math.max(0,Math.min(d.scrollHeight-d.clientHeight,d.scrollTop+b)),c!==d.scrollLeft||b!==d.scrollTop)d.scrollLeft=c,d.scrollTop=b,d.afterUpdate(),d.requestRender(),a._didScroll=!0}d._prevDragPos=f}}function L(a){return"string"===typeof a||"number"===typeof a}function ia(a){a.updateMatrices&&a.updateMatrices()}function ja(a,b,c,d,f,r){d=6*a%1;r=[c,-c*d*b+c,f=-c*b+c,f,c*d*b+f,c];return[r[d=6*a|0],r[(4+d)% | ||
6],r[(2+d)%6]]}var P=v&&"object"===typeof v&&"default"in v?v:{"default":v};let {assign:ka,createClassExtender:la}=E.utils;v=la("flexNode",a=>{class b extends a{constructor(a){super(a);this.needsFlexLayout=this.isFlexNode=!0;for(this._flexStyles={id:this.$facadeId};a&&!a.isFlexNode;)a=a.parent;a?(this.parentFlexNode=a,this.flexNodeDepth=a.flexNodeDepth+1):this.flexNodeDepth=0}afterUpdate(){null!=this.offsetWidth&&(this._checkOverscroll(),this._updateClipRect());super.afterUpdate();this.needsFlexLayout&& | ||
fragmentColorTransform:"\nfloat troikaAlphaMult = troikaGetAlphaMultiplier();\nif (troikaAlphaMult == 0.0) {\n discard;\n} else {\n gl_FragColor.a *= troikaAlphaMult;\n}\n"});Object.defineProperty(a,"shadowSide",{get(){return this.side},set(){}});a.transparent=!0;return a}function da(a){if(!a._didScroll){let c=a.currentTarget,{deltaX:d,deltaY:f,deltaMode:q}=a.nativeEvent;var b=1===q?y(c,16)*w(c,"lineHeight",1.2):y(c,16)/12;d*=b;f*=b;b=Math.max(0,Math.min(c.scrollWidth-c.clientWidth,c.scrollLeft+ | ||
d));let g=Math.max(0,Math.min(c.scrollHeight-c.clientHeight,c.scrollTop+f)),h=Math.abs;if(b!==c.scrollLeft&&h(d)>h(f)||g!==c.scrollTop&&h(f)>h(d))c.scrollLeft=b,c.scrollTop=g,c.afterUpdate(),c.requestRender(),a._didScroll=!0;a.preventDefault()}}function L(a){if(!a._didScroll&&!a.defaultPrevented){let d=a.currentTarget,f=a.ray.clone().applyMatrix4(H.invertMatrix4(d.threeObject.matrixWorld,M)).intersectPlane(ea.setComponents(0,0,1,0),new e.Vector3);var b=d._prevDragPos;if(f&&b&&"drag"===a.type){var c= | ||
f.x-b.x;b=f.y-b.y;if(c||b)if(c=Math.max(0,Math.min(d.scrollWidth-d.clientWidth,d.scrollLeft+c)),b=Math.max(0,Math.min(d.scrollHeight-d.clientHeight,d.scrollTop+b)),c!==d.scrollLeft||b!==d.scrollTop)d.scrollLeft=c,d.scrollTop=b,d.afterUpdate(),d.requestRender(),a._didScroll=!0}d._prevDragPos=f}}function I(a){return"string"===typeof a||"number"===typeof a}function fa(a){a.updateMatrices&&a.updateMatrices()}function ha(a,b,c,d,f,q){d=6*a%1;q=[c,-c*d*b+c,f=-c*b+c,f,c*d*b+f,c];return[q[d=6*a|0],q[(4+d)% | ||
6],q[(2+d)%6]]}var N=t&&"object"===typeof t&&"default"in t?t:{"default":t};let {assign:ia,createClassExtender:ja}=C.utils;t=ja("flexNode",a=>{class b extends a{constructor(a){super(a);this.needsFlexLayout=this.isFlexNode=!0;for(this._flexStyles={id:this.$facadeId};a&&!a.isFlexNode;)a=a.parent;a?(this.parentFlexNode=a,this.flexNodeDepth=a.flexNodeDepth+1):this.flexNodeDepth=0}afterUpdate(){null!=this.offsetWidth&&(this._checkOverscroll(),this._updateClipRect());super.afterUpdate();this.needsFlexLayout&& | ||
(this.parentFlexNode?(this.notifyWorld("needsFlexLayout"),this.needsFlexLayout=!1):this._performRootLayout())}destructor(){this.parentFlexNode&&this.notifyWorld("needsFlexLayout");super.destructor()}onNotifyWorld(a,d,b){if("needsFlexLayout"!==d||this.parentFlexNode)super.onNotifyWorld(a,d,b);else this.needsFlexLayout=!0,this._rootLayoutReq||(this._rootLayoutReq=setTimeout(this._performRootLayout.bind(this),0))}_performRootLayout(){this._hasActiveFlexRequest||(this._hasActiveFlexRequest=!0,this.needsFlexLayout= | ||
!1,clearTimeout(this._rootLayoutReq),delete this._rootLayoutReq,this.traverse(a=>{if(a.isFlexNode){const c=a.parentFlexNode;c&&(c._flexStyles.children||(c._flexStyles.children=[])).push(a._flexStyles);a._flexStyles.children=null}}),z.requestFlexLayout(this._flexStyles,a=>{this.isDestroying||(this._applyRootLayoutResults(a),this._hasActiveFlexRequest=!1,this.afterUpdate(),this.requestRender())}))}_applyRootLayoutResults(a){this.traverse(c=>{if(c.isFlexNode){var b=a[c.$facadeId];if(b){const {left:a, | ||
top:d,width:f,height:k}=b,{borderWidth:e,padding:C}=c;c.offsetLeft=a;c.offsetTop=d;c.offsetWidth=f;c.offsetHeight=k;c.clientLeft=e[3]+C[3];c.clientTop=e[0]+C[0];c.clientWidth=f-e[1]-e[3]-C[1]-C[3];c.clientHeight=k-e[0]-e[2]-C[0]-C[2];c.scrollHeight=c.scrollWidth=0;if(b=c.parentFlexNode){let c=a+f-b.clientLeft,g=d+k-b.clientTop;c>b.scrollWidth&&(Math.abs(c-b.clientWidth)<c/1E4&&(c=b.clientWidth),b.scrollWidth=c);g>b.scrollHeight&&(Math.abs(g-b.clientHeight)<g/1E4&&(g=b.clientHeight),b.scrollHeight= | ||
!1,clearTimeout(this._rootLayoutReq),delete this._rootLayoutReq,this.traverse(a=>{if(a.isFlexNode){const c=a.parentFlexNode;c&&(c._flexStyles.children||(c._flexStyles.children=[])).push(a._flexStyles);a._flexStyles.children=null}}),B.requestFlexLayout(this._flexStyles,a=>{this.isDestroying||(this._applyRootLayoutResults(a),this._hasActiveFlexRequest=!1,this.afterUpdate(),this.requestRender())}))}_applyRootLayoutResults(a){this.traverse(c=>{if(c.isFlexNode){var b=a[c.$facadeId];if(b){const {left:a, | ||
top:d,width:f,height:k}=b,{borderWidth:e,padding:u}=c;c.offsetLeft=a;c.offsetTop=d;c.offsetWidth=f;c.offsetHeight=k;c.clientLeft=e[3]+u[3];c.clientTop=e[0]+u[0];c.clientWidth=f-e[1]-e[3]-u[1]-u[3];c.clientHeight=k-e[0]-e[2]-u[0]-u[2];c.scrollHeight=c.scrollWidth=0;if(b=c.parentFlexNode){let c=a+f-b.clientLeft,g=d+k-b.clientTop;c>b.scrollWidth&&(Math.abs(c-b.clientWidth)<c/1E4&&(c=b.clientWidth),b.scrollWidth=c);g>b.scrollHeight&&(Math.abs(g-b.clientHeight)<g/1E4&&(g=b.clientHeight),b.scrollHeight= | ||
g)}if(c.onAfterFlexLayoutApplied)c.onAfterFlexLayoutApplied()}}})}_checkOverscroll(){const {scrollLeft:a,scrollTop:b}=this;if(a||b){const c=Math.max(0,this.scrollWidth-this.clientWidth),d=Math.max(0,this.scrollHeight-this.clientHeight);c<a&&(this.scrollLeft=c);d<b&&(this.scrollTop=d)}}_updateClipRect(){const {offsetWidth:a,offsetHeight:b,parentFlexNode:f}=this;let e,g;if(f&&"absolute"!==this.position){var h=this.offsetLeft-f.scrollLeft;var k=this.offsetTop-f.scrollTop;const a="visible"!==f.overflow; | ||
e=Math.max(a?f.clientLeft:-Infinity,f.clipLeft)-h;g=Math.max(a?f.clientTop:-Infinity,f.clipTop)-k;h=Math.min(a?f.clientLeft+f.clientWidth:Infinity,f.clipRight)-h;k=Math.min(a?f.clientTop+f.clientHeight:Infinity,f.clipBottom)-k}else e=g=-Infinity,h=k=Infinity;this.clipLeft=e;this.clipTop=g;this.clipRight=h;this.clipBottom=k;this.isFullyClipped=e>=a||g>=b||0>=h||0>=k||e===h||g===k}}ka(b.prototype,{offsetLeft:null,offsetTop:null,offsetWidth:null,offsetHeight:null,clientLeft:null,clientTop:null,clientWidth:null, | ||
e=Math.max(a?f.clientLeft:-Infinity,f.clipLeft)-h;g=Math.max(a?f.clientTop:-Infinity,f.clipTop)-k;h=Math.min(a?f.clientLeft+f.clientWidth:Infinity,f.clipRight)-h;k=Math.min(a?f.clientTop+f.clientHeight:Infinity,f.clipBottom)-k}else e=g=-Infinity,h=k=Infinity;this.clipLeft=e;this.clipTop=g;this.clipRight=h;this.clipBottom=k;this.isFullyClipped=e>=a||g>=b||0>=h||0>=k||e===h||g===k}}ia(b.prototype,{offsetLeft:null,offsetTop:null,offsetWidth:null,offsetHeight:null,clientLeft:null,clientTop:null,clientWidth:null, | ||
clientHeight:null,scrollLeft:0,scrollTop:0,scrollWidth:null,scrollHeight:null,clipLeft:null,clipTop:null,clipRight:null,clipBottom:null,isFullyClipped:!1,overflow:"visible"});"width height minWidth minHeight maxWidth maxHeight aspectRatio flexDirection flex flexWrap flexBasis flexGrow flexShrink alignContent alignItems alignSelf justifyContent position left right top bottom".split(" ").forEach(a=>{Object.defineProperty(b.prototype,a,{get(){return this._flexStyles[a]},set(c){c!==this._flexStyles[a]&& | ||
(this._flexStyles[a]=c,this.needsFlexLayout=!0)},configurable:!0})});["margin","padding","borderWidth"].forEach(a=>{const c=`_priv_${a}`,f="borderWidth"===a?"border":a,e=f+"Top",g=f+"Right",h=f+"Bottom",k=f+"Left";Object.defineProperty(b.prototype,a,{get(){return this[c]||(this[c]=Object.freeze([0,0,0,0]))},set(b){let d,f,r;if(Array.isArray(b)){var p=b.length;d=b[0]||0;f=(1<p?b[1]:b[0])||0;r=(2<p?b[2]:b[0])||0;b=(3<p?b[3]:1<p?b[1]:b[0])||0}else d=f=r=b;p=this[a];if(d!==p[0]||f!==p[1]||r!==p[2]||b!== | ||
p[3])this[c]=Object.freeze([d,f,r,b]),p=this._flexStyles,p[e]=d,p[g]=f,p[h]=r,p[k]=b,this.needsFlexLayout=!0}})});return b});let Q="font fontSize textAlign textIndent lineHeight letterSpacing whiteSpace overflowWrap color".split(" "),R="text textIndent font fontSize lineHeight letterSpacing whiteSpace overflowWrap".split(" "),ma=()=>{};class x extends J.Text3DFacade{constructor(a){super(a);a=this.threeObject;a._actuallySync=a.sync;a.sync=ma}afterUpdate(){let {offsetLeft:a,offsetTop:b,offsetWidth:c}= | ||
this;if(null!==c){var d=this.parentFlexNode;this.x=a-d.scrollLeft;this.y=-(b-d.scrollTop);d=this.clipRect||(this.clipRect=[0,0,0,0]);d[0]=this.clipLeft;d[1]=-this.clipBottom;d[2]=this.clipRight;d[3]=-this.clipTop;this.threeObject.visible=!this.isFullyClipped}d=this._flexStyles;for(let a=0,b=R.length;a<b;a++){let b=R[a];("text"===b?this.text:w(this,b))!==d[b]&&(d[b]=this[b],this.needsFlexLayout=!0)}super.afterUpdate()}onAfterFlexLayoutApplied(){this.threeObject.maxWidth=this.offsetWidth;this.threeObject._actuallySync(this._afterSync)}getBoundingSphere(){return null}} | ||
x=v(x);Q.forEach(a=>{x.prototype[a]="inherit"});Object.defineProperty(x.prototype,"maxWidth",{value:Infinity,enumerable:!0,writable:!0});var na=x;let oa=(new e.PlaneGeometry(1,1)).translate(.5,-.5,0),S=new e.MeshBasicMaterial({color:0}),pa=Object.freeze(new e.Vector2),T=Object.freeze(new e.Vector4(0,0,0,0)),qa={customDepthMaterial:{get(){return this.material.getDepthMaterial()}},customDistanceMaterial:{get(){return this.material.getDistanceMaterial()}}},U=new Map;class V extends t.Instanceable3DFacade{constructor(a){super(a); | ||
this._colorObj=new e.Color;this.size=pa;this.borderWidth=this.borderRadius=T;this.color=0;this.isBorder=!1;this.material=S}afterUpdate(){let {material:a,depthOffset:b,castShadow:c,receiveShadow:d,color:f,renderOrder:r}=this;a||(a=S);let g=`${a.id}|${r}|${b}|${c}|${d}`;if(g!==this._prevMeshKey){let b=U.get(g);if(!b){let f=ea(a);f.polygonOffset=!!this.depthOffset;f.polygonOffsetFactor=f.polygonOffsetUnits=this.depthOffset||0;a.addEventListener("dispose",function C(){a.removeEventListener("dispose", | ||
C);f.dispose()});b=new e.Mesh(oa,f);b._instanceKey=g;b.castShadow=c;b.receiveShadow=d;b.renderOrder=r;Object.defineProperties(b,qa);U.set(g,b)}this.instancedThreeObject=b;this._prevMeshKey=g}this.setInstanceUniform("uTroikaBlockSize",this.size);this.setInstanceUniform("uTroikaCornerRadii",this.borderRadius);this.setInstanceUniform("uTroikaClipRect",this.clipRect);this.setInstanceUniform("uTroikaBorderWidth",this.isBorder?this.borderWidth:T);f!==this._lastColor&&(this._lastColor=f,this.setInstanceUniform("diffuse", | ||
new e.Color(f)));super.afterUpdate()}getBoundingSphere(){return null}}let W;class X extends t.Object3DFacade{constructor(a){let b=new e.Mesh(W||(W=(new e.CylinderGeometry(.5,.5,1,8)).translate(0,-.5,0)),new e.MeshBasicMaterial({color:16777215,transparent:!0,opacity:0}));super(a,b);this.length=this.girth=0}afterUpdate(){this.scaleX=this.scaleZ=this.girth;this.scaleY=this.length;this.rotateZ=this.horizontal?Math.PI/2:0;this.threeObject.material.opacity=this.opacity;super.afterUpdate()}}let M=new WeakMap, | ||
Y={opacity:{duration:300}};class ra extends t.ParentFacade{constructor(a){super(a);this._onOver=a=>{this.hovering=!0;this.afterUpdate()};this._onOut=a=>{this.hovering=!1;this.afterUpdate()}}set target(a){let b=M.get(this);a!==b&&(b&&(b.removeEventListener("mouseover",this._onOver),b.removeEventListener("mouseout",this._onOut)),a&&(a.addEventListener("mouseover",this._onOver),a.addEventListener("mouseout",this._onOut)),M.set(this,a))}get target(){return M.get(this)}describeChildren(){let {target:a}= | ||
this,b=this._childArr||(this._childArr=[]);b.length=0;if(a){let {offsetWidth:d,offsetHeight:f,scrollHeight:e,scrollWidth:g,clientWidth:h,clientHeight:k}=a,m=a.getComputedFontSize();if(g>h){var c=this._hDef||(this._hDef={key:"h",facade:X,horizontal:!0,transition:Y});c.girth=Math.min(m/4,f/10);c.length=Math.max(h*h/g,m);c.x=a.clientLeft+a.scrollLeft/(g-h)*(h-c.length);c.y=-f;c.opacity=this.hovering?.5:0;c.renderOrder=this.renderOrder;b.push(c)}e>k&&(c=this._vDef||(this._vDef={key:"v",facade:X,transition:Y}), | ||
c.girth=Math.min(m/4,d/10),c.length=Math.max(k*k/e,m),c.x=d,c.y=-(a.clientTop+a.scrollTop/(e-k)*(k-c.length)),c.opacity=this.hovering?.5:0,c.renderOrder=this.renderOrder,b.push(c))}return b}destructor(){this.target=null;super.destructor()}}let Z=new e.Mesh((new e.PlaneGeometry(1,1)).translate(.5,-.5,0)),O=new e.Matrix4,A=new e.Vector4(0,0,0,0),sa=Object.freeze(new e.Vector4(0,0,0,0)),ha=new e.Plane,ta={get(){return!this._priv_hidden&&!this.$facade.isFullyClipped},set(a){this._priv_hidden=!a}};class G extends t.Group3DFacade{constructor(a){super(a); | ||
Object.defineProperty(this.threeObject,"visible",ta);this.layers=new t.Group3DFacade(this);this.layers.children=[null,null,null];this._sizeVec2=Object.freeze(new e.Vector2);this._borderRadiiVec4=this._borderWidthVec4=this._clipRectVec4=sa;(this._geomBoundingSphere=new e.Sphere).version=0;this._wasFullyClipped=!0}updateChildren(a){this.isFullyClipped&&this._wasFullyClipped||super.updateChildren(a)}updateMatrices(){super.updateMatrices();this.layers.traverse(ia)}afterUpdate(){let {layers:a,backgroundColor:b, | ||
backgroundMaterial:c,borderWidth:d,borderColor:f,borderMaterial:r,text:g,offsetLeft:h,offsetTop:k,offsetWidth:m,offsetHeight:n,parentFlexNode:t,flexNodeDepth:q,isFullyClipped:p,_wasFullyClipped:v,_borderWidthVec4:z,_clipRectVec4:x,_sizeVec2:D}=this;var y=!(!m||!n),u=y&&!p&&(null!=b||null!=c),l=y&&!p&&(null!=f||null!=r)&&0<Math.max(...d);y=y&&("scroll"===this.overflow||"auto"===this.overflow)&&(this.scrollHeight>this.clientHeight||this.scrollWidth>this.clientWidth);if(null!==m){if(t){var B="absolute"=== | ||
this.position;this.x=h-(B?0:t.scrollLeft);this.y=-(k-(B?0:t.scrollTop))}if(m!==D.x||n!==D.y)D=this._sizeVec2=Object.freeze(new e.Vector2(m,n)),B=this._geomBoundingSphere,B.radius=Math.sqrt(m*m/4+n*n/4),B.center.set(m/2,-n/2,0),B.version++}if(!p||!v){B=u||l?this._normalizeBorderRadius():null;A.fromArray(d);A.equals(z)||(z=this._borderWidthVec4=Object.freeze(A.clone()));A.set(Math.max(this.clipLeft,0),Math.max(this.clipTop,0),Math.min(this.clipRight,m),Math.min(this.clipBottom,n));A.equals(x)||(x=this._clipRectVec4= | ||
Object.freeze(A.clone()));let e=null;u&&(e=this._bgLayerDef||(this._bgLayerDef={key:"bg",facade:V}),e.size=D,e.color=b,e.borderRadius=B,e.material=c,e.clipRect=x,e.depthOffset=-q,e.renderOrder=q,e.castShadow=this.castShadow,e.receiveShadow=this.receiveShadow);a.children[0]=e;u=null;l&&(u=this._borderLayerDef||(this._borderLayerDef={key:"border",facade:V,isBorder:!0}),u.size=D,u.color=f,u.borderWidth=z,u.borderRadius=B,u.material=r,u.clipRect=x,u.depthOffset=-q-1,u.renderOrder=q+1,u.castShadow=this.castShadow, | ||
u.receiveShadow=this.receiveShadow);a.children[1]=u;l=null;y&&(l=this._scrollbarsDef||(this._scrollbarsDef={key:"sb",facade:ra,target:this}),l.renderOrder=q+2);a.children[2]=l;!g&&L(this.children)&&(g=""+this.children);if(g)l=this._textChildDef||(this._textChildDef={key:"text",facade:na}),l.text=g,l.font=w(this,"font"),l.fontSize=this.getComputedFontSize(),l.textAlign=w(this,"textAlign"),l.textIndent=w(this,"textIndent"),l.lineHeight=w(this,"lineHeight","normal"),l.letterSpacing=w(this,"letterSpacing", | ||
(this._flexStyles[a]=c,this.needsFlexLayout=!0)},configurable:!0})});["margin","padding","borderWidth"].forEach(a=>{const c=`_priv_${a}`,f="borderWidth"===a?"border":a,e=f+"Top",g=f+"Right",h=f+"Bottom",k=f+"Left";Object.defineProperty(b.prototype,a,{get(){return this[c]||(this[c]=Object.freeze([0,0,0,0]))},set(b){let d,f,q;if(Array.isArray(b)){var m=b.length;d=b[0]||0;f=(1<m?b[1]:b[0])||0;q=(2<m?b[2]:b[0])||0;b=(3<m?b[3]:1<m?b[1]:b[0])||0}else d=f=q=b;m=this[a];if(d!==m[0]||f!==m[1]||q!==m[2]||b!== | ||
m[3])this[c]=Object.freeze([d,f,q,b]),m=this._flexStyles,m[e]=d,m[g]=f,m[h]=q,m[k]=b,this.needsFlexLayout=!0}})});return b});let O="font fontSize textAlign textIndent lineHeight letterSpacing whiteSpace overflowWrap color".split(" "),P="text textIndent font fontSize lineHeight letterSpacing whiteSpace overflowWrap".split(" "),ka=()=>{};class la extends G.Text3DFacade{constructor(a){super(a);a=this.threeObject;a._actuallySync=a.sync;a.sync=ka}afterUpdate(){let {offsetLeft:a,offsetTop:b,offsetWidth:c}= | ||
this;if(null!==c){var d=this.parentFlexNode;this.x=a-d.scrollLeft;this.y=-(b-d.scrollTop);d=this.clipRect||(this.clipRect=[0,0,0,0]);d[0]=this.clipLeft;d[1]=-this.clipBottom;d[2]=this.clipRight;d[3]=-this.clipTop;this.threeObject.visible=!this.isFullyClipped}d=this._flexStyles;for(let a=0,b=P.length;a<b;a++){let b=P[a];("text"===b?this.text:w(this,b))!==d[b]&&(d[b]=this[b],this.needsFlexLayout=!0)}super.afterUpdate()}onAfterFlexLayoutApplied(){this.threeObject.maxWidth=this.offsetWidth;this.threeObject._actuallySync(this._afterSync)}getBoundingSphere(){return null}} | ||
let J=t(la);O.forEach(a=>{J.prototype[a]="inherit"});Object.defineProperty(J.prototype,"maxWidth",{value:Infinity,enumerable:!0,writable:!0});let ma=(new e.PlaneGeometry(1,1)).translate(.5,-.5,0),Q=new e.MeshBasicMaterial({color:0}),na=Object.freeze(new e.Vector2),R=Object.freeze(new e.Vector4(0,0,0,0)),oa={customDepthMaterial:{get(){return this.material.getDepthMaterial()}},customDistanceMaterial:{get(){return this.material.getDistanceMaterial()}}},S=new Map;class T extends r.Instanceable3DFacade{constructor(a){super(a); | ||
this._colorObj=new e.Color;this.size=na;this.borderWidth=this.borderRadius=R;this.color=0;this.isBorder=!1;this.material=Q}afterUpdate(){let {material:a,depthOffset:b,castShadow:c,receiveShadow:d,color:f,renderOrder:q}=this;a||(a=Q);let g=`${a.id}|${q}|${b}|${c}|${d}`;if(g!==this._prevMeshKey){let b=S.get(g);if(!b){let f=ca(a);f.polygonOffset=!!this.depthOffset;f.polygonOffsetFactor=f.polygonOffsetUnits=this.depthOffset||0;a.addEventListener("dispose",function u(){a.removeEventListener("dispose", | ||
u);f.dispose()});b=new e.Mesh(ma,f);b._instanceKey=g;b.castShadow=c;b.receiveShadow=d;b.renderOrder=q;Object.defineProperties(b,oa);S.set(g,b)}this.instancedThreeObject=b;this._prevMeshKey=g}this.setInstanceUniform("uTroikaBlockSize",this.size);this.setInstanceUniform("uTroikaCornerRadii",this.borderRadius);this.setInstanceUniform("uTroikaClipRect",this.clipRect);this.setInstanceUniform("uTroikaBorderWidth",this.isBorder?this.borderWidth:R);f!==this._lastColor&&(this._lastColor=f,this.setInstanceUniform("diffuse", | ||
new e.Color(f)));super.afterUpdate()}getBoundingSphere(){return null}}let U;class V extends r.Object3DFacade{constructor(a){let b=new e.Mesh(U||(U=(new e.CylinderGeometry(.5,.5,1,8)).translate(0,-.5,0)),new e.MeshBasicMaterial({color:16777215,transparent:!0,opacity:0}));super(a,b);this.length=this.girth=0}afterUpdate(){this.scaleX=this.scaleZ=this.girth;this.scaleY=this.length;this.rotateZ=this.horizontal?Math.PI/2:0;this.threeObject.material.opacity=this.opacity;super.afterUpdate()}}let K=new WeakMap, | ||
W={opacity:{duration:300}};class pa extends r.ParentFacade{constructor(a){super(a);this._onOver=a=>{this.hovering=!0;this.afterUpdate()};this._onOut=a=>{this.hovering=!1;this.afterUpdate()}}set target(a){let b=K.get(this);a!==b&&(b&&(b.removeEventListener("mouseover",this._onOver),b.removeEventListener("mouseout",this._onOut)),a&&(a.addEventListener("mouseover",this._onOver),a.addEventListener("mouseout",this._onOut)),K.set(this,a))}get target(){return K.get(this)}describeChildren(){let {target:a}= | ||
this,b=this._childArr||(this._childArr=[]);b.length=0;if(a){let {offsetWidth:d,offsetHeight:f,scrollHeight:e,scrollWidth:g,clientWidth:h,clientHeight:k}=a,m=a.getComputedFontSize();if(g>h){var c=this._hDef||(this._hDef={key:"h",facade:V,horizontal:!0,transition:W});c.girth=Math.min(m/4,f/10);c.length=Math.max(h*h/g,m);c.x=a.clientLeft+a.scrollLeft/(g-h)*(h-c.length);c.y=-f;c.opacity=this.hovering?.5:0;c.renderOrder=this.renderOrder;b.push(c)}e>k&&(c=this._vDef||(this._vDef={key:"v",facade:V,transition:W}), | ||
c.girth=Math.min(m/4,d/10),c.length=Math.max(k*k/e,m),c.x=d,c.y=-(a.clientTop+a.scrollTop/(e-k)*(k-c.length)),c.opacity=this.hovering?.5:0,c.renderOrder=this.renderOrder,b.push(c))}return b}destructor(){this.target=null;super.destructor()}}let X=new e.Mesh((new e.PlaneGeometry(1,1)).translate(.5,-.5,0)),M=new e.Matrix4,z=new e.Vector4(0,0,0,0),qa=Object.freeze(new e.Vector4(0,0,0,0)),ea=new e.Plane,ra={get(){return!this._priv_hidden&&!this.$facade.isFullyClipped},set(a){this._priv_hidden=!a}};class sa extends r.Group3DFacade{constructor(a){super(a); | ||
Object.defineProperty(this.threeObject,"visible",ra);this.layers=new r.Group3DFacade(this);this.layers.children=[null,null,null];this._sizeVec2=Object.freeze(new e.Vector2);this._borderRadiiVec4=this._borderWidthVec4=this._clipRectVec4=qa;(this._geomBoundingSphere=new e.Sphere).version=0;this._wasFullyClipped=!0}updateChildren(a){this.isFullyClipped&&this._wasFullyClipped||super.updateChildren(a)}updateMatrices(){super.updateMatrices();this.layers.traverse(fa)}afterUpdate(){let {layers:a,backgroundColor:b, | ||
backgroundMaterial:c,borderWidth:d,borderColor:f,borderMaterial:q,text:g,offsetLeft:h,offsetTop:k,offsetWidth:n,offsetHeight:u,parentFlexNode:r,flexNodeDepth:p,isFullyClipped:t,_wasFullyClipped:B,_borderWidthVec4:C,_clipRectVec4:y,_sizeVec2:D}=this;var x=!(!n||!u),v=x&&!t&&(null!=b||null!=c),l=x&&!t&&(null!=f||null!=q)&&0<Math.max(...d);x=x&&("scroll"===this.overflow||"auto"===this.overflow)&&(this.scrollHeight>this.clientHeight||this.scrollWidth>this.clientWidth);if(null!==n){if(r){var A="absolute"=== | ||
this.position;this.x=h-(A?0:r.scrollLeft);this.y=-(k-(A?0:r.scrollTop))}if(n!==D.x||u!==D.y)D=this._sizeVec2=Object.freeze(new e.Vector2(n,u)),A=this._geomBoundingSphere,A.radius=Math.sqrt(n*n/4+u*u/4),A.center.set(n/2,-u/2,0),A.version++}if(!t||!B){A=v||l?this._normalizeBorderRadius():null;z.fromArray(d);z.equals(C)||(C=this._borderWidthVec4=Object.freeze(z.clone()));z.set(Math.max(this.clipLeft,0),Math.max(this.clipTop,0),Math.min(this.clipRight,n),Math.min(this.clipBottom,u));z.equals(y)||(y=this._clipRectVec4= | ||
Object.freeze(z.clone()));let e=null;v&&(e=this._bgLayerDef||(this._bgLayerDef={key:"bg",facade:T}),e.size=D,e.color=b,e.borderRadius=A,e.material=c,e.clipRect=y,e.depthOffset=-p,e.renderOrder=p,e.castShadow=this.castShadow,e.receiveShadow=this.receiveShadow);a.children[0]=e;v=null;l&&(v=this._borderLayerDef||(this._borderLayerDef={key:"border",facade:T,isBorder:!0}),v.size=D,v.color=f,v.borderWidth=C,v.borderRadius=A,v.material=q,v.clipRect=y,v.depthOffset=-p-1,v.renderOrder=p+1,v.castShadow=this.castShadow, | ||
v.receiveShadow=this.receiveShadow);a.children[1]=v;l=null;x&&(l=this._scrollbarsDef||(this._scrollbarsDef={key:"sb",facade:pa,target:this}),l.renderOrder=p+2);a.children[2]=l;!g&&I(this.children)&&(g=""+this.children);if(g)l=this._textChildDef||(this._textChildDef={key:"text",facade:J}),l.text=g,l.font=w(this,"font"),l.fontSize=this.getComputedFontSize(),l.textAlign=w(this,"textAlign"),l.textIndent=w(this,"textIndent"),l.lineHeight=w(this,"lineHeight","normal"),l.letterSpacing=w(this,"letterSpacing", | ||
0),l.whiteSpace=w(this,"whiteSpace"),l.overflowWrap=w(this,"overflowWrap"),l.color=w(this,"color"),l.colorRanges=this.colorRanges,l.outlineWidth=this.textOutlineWidth||0,l.outlineColor=this.textOutlineColor,l.outlineOpacity=this.textOutlineOpacity,l.outlineBlur=this.textOutlineBlur||0,l.outlineOffsetX=this.textOutlineOffsetX||0,l.outlineOffsetY=this.textOutlineOffsetY||0,l.strokeWidth=this.textStrokeWidth||0,l.strokeColor=this.textStrokeColor,l.strokeOpacity=this.textStrokeOpacity,l.fillOpacity=this.textFillOpacity, | ||
l.material=this.textMaterial,l.depthOffset=-q-1,l.renderOrder=q+1,l.castShadow=this.castShadow,l.receiveShadow=this.receiveShadow,this._actualChildren=l;else{l=this.children;if(Array.isArray(l))for(let a=0,b=l.length;a<b;a++)if(L(l[a])){for(l=l.slice();a<b;a++)L(l[a])&&(l[a]={facade:ua,text:""+l[a],textMaterial:this.textMaterial});break}this._actualChildren=l}}y!==this._couldScroll&&(this._couldScroll=y,this[`${y?"add":"remove"}EventListener`]("wheel",fa),this[`${y?"add":"remove"}EventListener`]("dragstart", | ||
N),this[`${y?"add":"remove"}EventListener`]("drag",N));super.afterUpdate();p&&v||a.afterUpdate();this._wasFullyClipped=p}describeChildren(){return this._actualChildren}getComputedFontSize(){return F(this,16)}_normalizeBorderRadius(){let {borderRadius:a,offsetWidth:b=0,offsetHeight:c=0,_borderRadiiVec4:d}=this,f,e,g;if(Array.isArray(a)){var h=a.length;f=a[0]||0;e=(1<h?a[1]:a[0])||0;g=(2<h?a[2]:a[0])||0;h=(3<h?a[3]:1<h?a[1]:a[0])||0}else f=e=g=h=a||0;if(0!==f||0!==e||0!==g||0!==h){var k=Math.min(b, | ||
c);"string"===typeof f&&/%$/.test(f)&&(f=parseInt(f,10)/100*k);"string"===typeof e&&/%$/.test(e)&&(e=parseInt(e,10)/100*k);"string"===typeof h&&/%$/.test(h)&&(h=parseInt(h,10)/100*k);"string"===typeof g&&/%$/.test(g)&&(g=parseInt(g,10)/100*k);k=Math.min(b/(f+e),c/(e+g),b/(g+h),c/(h+f));1>k&&(f*=k,e*=k,h*=k,g*=k)}A.set(f,e,g,h);A.equals(d)||(d=this._borderRadiiVec4=Object.freeze(A.clone()));return d}_getGeometryBoundingSphere(){return this._geomBoundingSphere.radius&&!this.isFullyClipped?this._geomBoundingSphere: | ||
null}raycast(a){let {offsetWidth:b,offsetHeight:c,clipTop:d,clipRight:f,clipBottom:e,clipLeft:g}=this,h=null;b&&c&&(Z.matrixWorld.multiplyMatrices(this.threeObject.matrixWorld,O.makeScale(b,c,1)),h=this._raycastObject(Z,a))&&(h=h.filter(a=>{let k=a.uv.x*b;a=(1-a.uv.y)*c;return k>g&&k<f&&a>d&&a<e}),h.forEach(a=>{a.distance=parseFloat(a.distance.toFixed(12));a.distanceBias=-this.flexNodeDepth}));return h&&h.length?h:null}destructor(){this.layers.destructor();super.destructor()}}let ua=G=v(G);Q.forEach(a=> | ||
{G.prototype[a]="inherit"});var m=G;let va=(new e.PlaneGeometry(1,1)).translate(.5,-.5,0),wa=new e.MeshBasicMaterial,xa=new e.TextureLoader;class ya extends t.Object3DFacade{constructor(a,b){b=new e.Mesh(va,wa.clone());b.visible=!1;super(a,b)}afterUpdate(){let {offsetLeft:a,offsetTop:b,offsetWidth:c,offsetHeight:d,src:f,threeObject:e}=this,g=e.material,h=!(!c||!d);if(h){this.x=a;this.y=-b;this.scaleX=c;this.scaleY=d;let f=this.flexNodeDepth;g.polygonOffset=!!f;g.polygonOffsetFactor=g.polygonOffsetUnits= | ||
-f||0;e.renderOrder=f}f!==this._lastSrc&&(xa.load(f,a=>{g.map&&g.map.dispose();g.map=a;this.aspectRatio=a.image.width/a.image.height;this.afterUpdate();this.requestRender()}),this._lastSrc=f);e.visible=!!(h&&g.map&&g.map.image.complete);super.afterUpdate()}destructor(){let a=this.threeObject.material.map;a&&a.dispose();super.destructor()}}J=v(ya);class aa extends m{constructor(a){super(a);this.font="https://fonts.gstatic.com/s/materialicons/v36/flUhRq6tzZclQEJ-Vdg-IuiaDsNa.woff"}set icon(a){this.text= | ||
a}set size(a){this.fontSize=a}}class za extends aa{constructor(a){super(a);this.justifyContent="center";this.fontSize="150%";this.onClick=a=>{this.onUpdate(!this.value)}}afterUpdate(){this.icon=this.value?"check_box":"check_box_outline_blank";super.afterUpdate()}}class Aa extends m{constructor(a){super(a);this.children={facade:m,borderRadius:"10%",backgroundColor:3355545,height:"100%",padding:[0,.02],alignItems:"center",justifyContent:"center",pointerStates:{hover:{backgroundColor:6710988}}}}afterUpdate(){this.children.text= | ||
this.label||"Missing label";super.afterUpdate()}}let q=new e.Color,H=new e.Plane,ba=(new e.CylinderGeometry(.5,.5,1,45)).translate(0,.5,0).rotateX(Math.PI/2).rotateZ(Math.PI/2),ca=K.createDerivedMaterial(new e.MeshBasicMaterial({side:2}),{uniforms:{maxValue:{value:1}},vertexDefs:"\nvarying vec3 vPos;\n",vertexMainIntro:"\nvPos = position;\n",fragmentDefs:"\nuniform float maxValue;\nvarying vec3 vPos;\n\n// From https://github.com/hughsk/glsl-hsv2rgb\nvec3 hsv2rgb(vec3 c) {\n vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\n\n", | ||
fragmentColorTransform:"\nfloat angle = atan(vPos.y, vPos.x) / PI2;\nfloat radius = length(vPos.xy) * 2.0;\nfloat value = vPos.z * maxValue;\nvec3 hsv = vec3(angle, radius, value);\nvec3 rgb = hsv2rgb(hsv);\ngl_FragColor.xyz = rgb;\n"});class Ba extends t.Object3DFacade{constructor(a){super(a,new e.Mesh(ba,ca.clone()));this.maxValue=1}afterUpdate(){this.threeObject.material.uniforms.maxValue.value=this.maxValue;super.afterUpdate()}}class Ca extends t.Object3DFacade{constructor(a){let b=ca.clone(); | ||
b.transparent=!0;b.opacity=.5;b.side=e.BackSide;super(a,new e.Mesh(ba,b))}}class Da extends t.Object3DFacade{constructor(a){var b=(new e.SphereGeometry(.05,16,12)).translate(0,0,.5);let c=(new e.CylinderGeometry(.005,.005,.5,6)).translate(0,.25,0).rotateX(Math.PI/2),d=new e.MeshBasicMaterial;b=new e.Mesh(b,d);b.add(new e.Mesh(c,new e.MeshBasicMaterial({color:13421772})));super(a,b)}afterUpdate(){this.threeObject.material.color.set(this.color);super.afterUpdate()}}class Ea extends t.Object3DFacade{constructor(a){let b= | ||
K.createDerivedMaterial(new e.MeshBasicMaterial({transparent:!0,color:16777215,polygonOffset:!0,polygonOffsetFactor:1}),{vertexDefs:"varying vec2 vUV;",vertexMainIntro:"vUV = uv;",fragmentDefs:"varying vec2 vUV;",fragmentColorTransform:"\n float dist = min(min(vUV.x, 1.0 - vUV.x), min(vUV.y, 1.0 - vUV.y));\n gl_FragColor.w *= 1.0 - 0.5 * smoothstep(0.0, 0.1, dist);\n "});super(a,new e.Mesh(new e.PlaneGeometry,b))}afterUpdate(){this.threeObject.material.opacity=this.opacity;super.afterUpdate()}} | ||
class Fa extends t.Group3DFacade{constructor(a){super(a);this.cylinderHeight=.5;this.cylinderDiameter=.75;this.rotateX=-Math.PI/4;a=a=>{var b=a.currentTarget.threeObject,d=a.ray;H.normal.set(0,0,-1);H.constant=1;H.applyMatrix4(b.matrixWorld);var f=d.intersectPlane(H,new e.Vector3);if(f){b.worldToLocal(f);d=2*f.x;f=2*f.y;for(b=Math.atan2(f,d)/Math.PI/2;0>b;)b+=1;d=Math.min(1,Math.sqrt(d*d+f*f));f=this._getHSV();f[0]=b;f[1]=d;this._updateHSV(f,a.shiftKey)}};this.onWheel=a=>{let b=this._getHSV();b[2]= | ||
Math.max(0,Math.min(1,b[2]+a.nativeEvent.deltaY/100));this._updateHSV(b,!1)};this.children=[this.cylinderDef={key:"disc",facade:Ba,onMouseDown:a,onDragStart:a,onDrag:a},this.cylinderBgDef={facade:Ca,renderOrder:9},this.planeDef={facade:Ea,renderOrder:10,opacity:.3,pointerStates:{hover:{opacity:.4}},transition:{opacity:!0},onDragStart:a=>{this._dragData={plane:(new e.Plane).setFromNormalAndCoplanarPoint((new e.Vector3(0,1,0)).transformDirection(this.threeObject.matrixWorld),a.intersection.point)}}, | ||
onDrag:a=>{var {plane:b}=this._dragData;b=a.ray.intersectPlane(b,new e.Vector3);this.threeObject.worldToLocal(b);let d=this._getHSV();d[2]=Math.max(0,Math.min(1,b.z/this.cylinderHeight));this._updateHSV(d,a.shiftKey)},onDragEnd:a=>{this._dragData=null}},this.stickDef={facade:Da}]}_getHSV(){var a=[0,0,0];if(null!=this.value){q.set(this.value);{a=q.r;var b=q.g,c=q.b;let f,e;let g,h,k=Math.max(a,b,c);var d=k-Math.min(a,b,c);0===d?h=g=0:(h=d/k,f=(k-a)/6/d+.5,e=(k-b)/6/d+.5,d=(k-c)/6/d+.5,a===k?g=d-e: | ||
b===k?g=1/3+f-d:c===k&&(g=2/3+e-f),0>g?g+=1:1<g&&--g);a=[g,h,k]}}return a}_updateHSV(a,b){a=ja(...a);q.setRGB(...a);b&&(q.r=Math.round(5*q.r)/5,q.g=Math.round(5*q.g)/5,q.b=Math.round(5*q.b)/5);this.onChange(q.getHex())}afterUpdate(){let {stickDef:a,cylinderDef:b,cylinderBgDef:c,planeDef:d,cylinderHeight:f,cylinderDiameter:e}=this,g=this._getHSV(),h=g[0]*Math.PI*2,k=g[1]/2*e,m=Math.sin(h)*k;a.x=Math.cos(h)*k;a.y=m;a.z=g[2]*f;a.color=this.value;b.maxValue=g[2];b.scale=e;b.scaleZ=g[2]*f+1E-5;c.scale= | ||
e;c.scaleZ=f;d.z=g[2]*f;super.afterUpdate()}}let Ga=["mousedown","wheel"];class da extends m{constructor(a){super(a);this.popupContent=null;this._popupCt={key:"popup",facade:E.ParentFacade};this._onCloserEvent=a=>{a:{for(a=a.target;a;){if(a===this){a=!0;break a}a=a.parent}a=!1}a||this.closePopup()};this.openPopup=()=>{this.isPopupOpen||(this.isPopupOpen=!0,this.afterUpdate())};this.closePopup=()=>{this.isPopupOpen&&(this.isPopupOpen=!1,this.afterUpdate())}}getPopupContent(){return this.popupContent}set children(a){this._children= | ||
[this._popupCt].concat(a)}get children(){return this._children}_toggleCloseListeners(a){let b=this.getSceneFacade();b&&Ga.forEach(c=>{b[(a?"add":"remove")+"EventListener"](c,this._onCloserEvent)})}afterUpdate(){let {isPopupOpen:a}=this;a!==this._wasPopupOpen&&(this._wasPopupOpen=a,this._toggleCloseListeners(a));this._popupCt.children=a?this.getPopupContent():null;super.afterUpdate()}destructor(){this._toggleCloseListeners(!1);super.destructor()}}let I=new e.Color;class Ha extends da{constructor(a){super(a); | ||
this.flexDirection="row";this.alignItems="center";this.children=[this.swatchDef={facade:m,borderRadius:"10%",backgroundColor:null,height:"100%",width:"25%",onClick:this.openPopup},this.labelDef={facade:m,padding:.01}];this.popupContent=this.pickerDef={key:"picker",facade:Fa,visible:!1,onChange:this._onColorChange.bind(this),animation:{from:{scale:1E-10},to:{scale:1},duration:500,easing:"easeOutExpo"}}}_onColorChange(a){this.onUpdate(a)}afterUpdate(){let {swatchDef:a,labelDef:b,pickerDef:c,value:d, | ||
offsetWidth:f,offsetHeight:e}=this;var g=null!=d;g&&I.set(d);a.backgroundColor=g?I.getHex():null;b.text=g?"#"+I.getHexString().toUpperCase():"(choose color)";f&&e&&(c.visible=!0,c.value=I.getHex(),g=7*e,c.scale=c.animation.to.scale=g,c.x=f+.75*g,c.y=-g/2-e);super.afterUpdate()}}class Ia extends m{constructor(a){super(a);this.flexDirection="row";this.minHeight=.01;this.backgroundColor=6710886;this.children=this._valChild={key:"slider",facade:m,backgroundColor:16777215,width:"0%"};this.onMouseDown= | ||
this.onDragStart=this.onDrag=a=>{var b=this.min||0,d=this.max||0;d!==b&&a.intersection&&a.intersection.facade===this&&(b+=a.intersection.uv.x*(d-b),d=this.step||.001,b=Math.round(b/d)*d,b=+b.toFixed((d+"").replace(/^-?\d+\.?/,"").length),this.onChange(b),a.stopPropagation())}}afterUpdate(){let a=this.value||0,b=Math.min(this.min||0,a),c=Math.max(this.max||0,a);this._valChild.width=b===c?0:`${(a-b)/(c-b)*100}%`;super.afterUpdate()}}class Ja extends m{constructor(a){super(a);this.min=this.value=0;this.max= | ||
1;this.step=.1;this.flexDirection="row";this.alignItems="center";this.children=[this._sliderChild={key:"slider",facade:Ia,flex:1,minWidth:.2,height:"100%",margin:[0,.01,0,0]},this._textChild={key:"text",facade:m,width:.05,text:"0"}]}afterUpdate(){this._textChild.text=this.value+"";let a=this._sliderChild;a.value=this.value||0;a.min=this.min||0;a.max=this.max||0;a.step=this.step;a.onChange=this.onUpdate;super.afterUpdate()}}class Ka extends da{constructor(a){super(a);this.position="relative";this.dropdownConfig= | ||
null;this._onItemClick=a=>{this.onUpdate(a.target.value);this.closePopup()};this.children=[this._btnChild={key:"btn",facade:m,flexDirection:"row",alignItems:"center",justifyContent:"space-between",borderRadius:"10%",backgroundColor:3355545,height:"100%",padding:[0,.02],overflow:"hidden",pointerStates:{hover:{backgroundColor:6710988}},onClick:this.openPopup,children:["",{facade:aa,icon:"keyboard_arrow_down"}]}];this.popupContent={key:"menu",facade:m,position:"absolute",top:"100%",left:0,width:"100%", | ||
backgroundColor:3355443,z:.01,maxHeight:.5,overflow:"scroll",flexDirection:"column",children:this._menuListDef={facade:E.ListFacade,data:null,template:{key:(a,c)=>c,facade:m,width:"100%",overflow:"hidden",whiteSpace:"nowrap",padding:.01,text:a=>a.label,value:a=>a.value,onClick:a=>this._onItemClick,backgroundColor:a=>a.selected?6710886:null,pointerStates:{hover:{backgroundColor:4473924}}}},animation:{from:{scale:.01},to:{scale:1},duration:300,easing:"easeOutExpo"}}}afterUpdate(){let a=null,b=this.options.reduce((b, | ||
d)=>{if(d){const c={};d&&"object"===typeof d?(c.value=d.value,c.label="string"===typeof d.label?d.label:`${d.value}`):(c.value=d,c.label=d+"");c.value===this.value&&(c.selected=!0,a=c);b.push(c)}return b},[]);this._btnChild.children[0]=a?a.label:"[Select...]";Object.assign(this.popupContent,this.dropdownConfig);this._menuListDef.data=b;super.afterUpdate()}}let La={boolean:za,button:Aa,color:Ha,number:Ja,select:Ka};class Ma extends m{constructor(a){super(a);this.flexDirection="row";this.fontSize=.02; | ||
this.itemHeight=.04;this.padding=[0,.02];this.backgroundColor=4473924;this.borderRadius=.01;this.alignItems="flex-start";this.data={}}_onItemUpdate(a,b){P["default"].set(this.data,a.path,b);this.onUpdate(this.data)}describeChildren(){return[{facade:m,flexDirection:"column",margin:[0,.03,0,0],children:(this.items||[]).map((a,b)=>a?{facade:m,text:"button"===a.type?null:a.label||a.path,height:a.height||this.itemHeight,margin:[b?0:.02,0,.02],flexDirection:"row",alignItems:"center"}:null)},{facade:m,flexDirection:"column", | ||
minWidth:.2,children:(this.items||[]).map((a,b)=>{if(!a)return null;let c=a&&La[a.type];return c?E.utils.assign({key:a.path||b,facade:c,height:a.height||this.itemHeight,margin:[b?0:.02,0,.02],value:P["default"].get(this.data,a.path)},a,{onUpdate:b=>{a.onUpdate&&a.onUpdate.call(a,b);this._onItemUpdate(a,b)}}):{facade:m,text:`Unknown Type: ${a.type}`}})}]}}n.DatGuiFacade=Ma;n.UIBlock3DFacade=m;n.UIImage3DFacade=J;n.extendAsFlexNode=v;Object.defineProperty(n,"__esModule",{value:!0})}) | ||
l.material=this.textMaterial,l.depthOffset=-p-1,l.renderOrder=p+1,l.castShadow=this.castShadow,l.receiveShadow=this.receiveShadow,this._actualChildren=l;else{l=this.children;if(Array.isArray(l))for(let a=0,b=l.length;a<b;a++)if(I(l[a])){for(l=l.slice();a<b;a++)I(l[a])&&(l[a]={facade:m,text:""+l[a],textMaterial:this.textMaterial});break}this._actualChildren=l}}x!==this._couldScroll&&(this._couldScroll=x,this[`${x?"add":"remove"}EventListener`]("wheel",da),this[`${x?"add":"remove"}EventListener`]("dragstart", | ||
L),this[`${x?"add":"remove"}EventListener`]("drag",L));super.afterUpdate();t&&B||a.afterUpdate();this._wasFullyClipped=t}describeChildren(){return this._actualChildren}getComputedFontSize(){return y(this,16)}_normalizeBorderRadius(){let {borderRadius:a,offsetWidth:b=0,offsetHeight:c=0,_borderRadiiVec4:d}=this,f,e,g;if(Array.isArray(a)){var h=a.length;f=a[0]||0;e=(1<h?a[1]:a[0])||0;g=(2<h?a[2]:a[0])||0;h=(3<h?a[3]:1<h?a[1]:a[0])||0}else f=e=g=h=a||0;if(0!==f||0!==e||0!==g||0!==h){var k=Math.min(b, | ||
c);"string"===typeof f&&/%$/.test(f)&&(f=parseInt(f,10)/100*k);"string"===typeof e&&/%$/.test(e)&&(e=parseInt(e,10)/100*k);"string"===typeof h&&/%$/.test(h)&&(h=parseInt(h,10)/100*k);"string"===typeof g&&/%$/.test(g)&&(g=parseInt(g,10)/100*k);k=Math.min(b/(f+e),c/(e+g),b/(g+h),c/(h+f));1>k&&(f*=k,e*=k,h*=k,g*=k)}z.set(f,e,g,h);z.equals(d)||(d=this._borderRadiiVec4=Object.freeze(z.clone()));return d}_getGeometryBoundingSphere(){return this._geomBoundingSphere.radius&&!this.isFullyClipped?this._geomBoundingSphere: | ||
null}raycast(a){let {offsetWidth:b,offsetHeight:c,clipTop:d,clipRight:f,clipBottom:e,clipLeft:g}=this,h=null;b&&c&&(X.matrixWorld.multiplyMatrices(this.threeObject.matrixWorld,M.makeScale(b,c,1)),h=this._raycastObject(X,a))&&(h=h.filter(a=>{let k=a.uv.x*b;a=(1-a.uv.y)*c;return k>g&&k<f&&a>d&&a<e}),h.forEach(a=>{a.distance=parseFloat(a.distance.toFixed(12));a.distanceBias=-this.flexNodeDepth}));return h&&h.length?h:null}destructor(){this.layers.destructor();super.destructor()}}let m=t(sa);O.forEach(a=> | ||
{m.prototype[a]="inherit"});let ta=(new e.PlaneGeometry(1,1)).translate(.5,-.5,0),ua=new e.MeshBasicMaterial,va=new e.TextureLoader;class wa extends r.Object3DFacade{constructor(a,b){b=new e.Mesh(ta,ua.clone());b.visible=!1;super(a,b)}afterUpdate(){let {offsetLeft:a,offsetTop:b,offsetWidth:c,offsetHeight:d,src:f,threeObject:e}=this,g=e.material,h=!(!c||!d);if(h){this.x=a;this.y=-b;this.scaleX=c;this.scaleY=d;let f=this.flexNodeDepth;g.polygonOffset=!!f;g.polygonOffsetFactor=g.polygonOffsetUnits=-f|| | ||
0;e.renderOrder=f}f!==this._lastSrc&&(va.load(f,a=>{g.map&&g.map.dispose();g.map=a;this.aspectRatio=a.image.width/a.image.height;this.afterUpdate();this.requestRender()}),this._lastSrc=f);e.visible=!!(h&&g.map&&g.map.image.complete);super.afterUpdate()}destructor(){let a=this.threeObject.material.map;a&&a.dispose();super.destructor()}}G=t(wa);class Y extends m{constructor(a){super(a);this.font="https://fonts.gstatic.com/s/materialicons/v36/flUhRq6tzZclQEJ-Vdg-IuiaDsNa.woff"}set icon(a){this.text= | ||
a}set size(a){this.fontSize=a}}class xa extends Y{constructor(a){super(a);this.justifyContent="center";this.fontSize="150%";this.onClick=a=>{this.onUpdate(!this.value)}}afterUpdate(){this.icon=this.value?"check_box":"check_box_outline_blank";super.afterUpdate()}}class ya extends m{constructor(a){super(a);this.children={facade:m,borderRadius:"10%",backgroundColor:3355545,height:"100%",padding:[0,.02],alignItems:"center",justifyContent:"center",pointerStates:{hover:{backgroundColor:6710988}}}}afterUpdate(){this.children.text= | ||
this.label||"Missing label";super.afterUpdate()}}let p=new e.Color,E=new e.Plane,Z=(new e.CylinderGeometry(.5,.5,1,45)).translate(0,.5,0).rotateX(Math.PI/2).rotateZ(Math.PI/2),aa=H.createDerivedMaterial(new e.MeshBasicMaterial({side:2}),{uniforms:{maxValue:{value:1}},vertexDefs:"\nvarying vec3 vPos;\n",vertexMainIntro:"\nvPos = position;\n",fragmentDefs:"\nuniform float maxValue;\nvarying vec3 vPos;\n\n// From https://github.com/hughsk/glsl-hsv2rgb\nvec3 hsv2rgb(vec3 c) {\n vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\n\n", | ||
fragmentColorTransform:"\nfloat angle = atan(vPos.y, vPos.x) / PI2;\nfloat radius = length(vPos.xy) * 2.0;\nfloat value = vPos.z * maxValue;\nvec3 hsv = vec3(angle, radius, value);\nvec3 rgb = hsv2rgb(hsv);\ngl_FragColor.xyz = rgb;\n"});class za extends r.Object3DFacade{constructor(a){super(a,new e.Mesh(Z,aa.clone()));this.maxValue=1}afterUpdate(){this.threeObject.material.uniforms.maxValue.value=this.maxValue;super.afterUpdate()}}class Aa extends r.Object3DFacade{constructor(a){let b=aa.clone(); | ||
b.transparent=!0;b.opacity=.5;b.side=e.BackSide;super(a,new e.Mesh(Z,b))}}class Ba extends r.Object3DFacade{constructor(a){var b=(new e.SphereGeometry(.05,16,12)).translate(0,0,.5);let c=(new e.CylinderGeometry(.005,.005,.5,6)).translate(0,.25,0).rotateX(Math.PI/2),d=new e.MeshBasicMaterial;b=new e.Mesh(b,d);b.add(new e.Mesh(c,new e.MeshBasicMaterial({color:13421772})));super(a,b)}afterUpdate(){this.threeObject.material.color.set(this.color);super.afterUpdate()}}class Ca extends r.Object3DFacade{constructor(a){let b= | ||
H.createDerivedMaterial(new e.MeshBasicMaterial({transparent:!0,color:16777215,polygonOffset:!0,polygonOffsetFactor:1}),{vertexDefs:"varying vec2 vUV;",vertexMainIntro:"vUV = uv;",fragmentDefs:"varying vec2 vUV;",fragmentColorTransform:"\n float dist = min(min(vUV.x, 1.0 - vUV.x), min(vUV.y, 1.0 - vUV.y));\n gl_FragColor.w *= 1.0 - 0.5 * smoothstep(0.0, 0.1, dist);\n "});super(a,new e.Mesh(new e.PlaneGeometry,b))}afterUpdate(){this.threeObject.material.opacity=this.opacity;super.afterUpdate()}} | ||
class Da extends r.Group3DFacade{constructor(a){super(a);this.cylinderHeight=.5;this.cylinderDiameter=.75;this.rotateX=-Math.PI/4;a=a=>{var b=a.currentTarget.threeObject,d=a.ray;E.normal.set(0,0,-1);E.constant=1;E.applyMatrix4(b.matrixWorld);var f=d.intersectPlane(E,new e.Vector3);if(f){b.worldToLocal(f);d=2*f.x;f=2*f.y;for(b=Math.atan2(f,d)/Math.PI/2;0>b;)b+=1;d=Math.min(1,Math.sqrt(d*d+f*f));f=this._getHSV();f[0]=b;f[1]=d;this._updateHSV(f,a.shiftKey)}};this.onWheel=a=>{let b=this._getHSV();b[2]= | ||
Math.max(0,Math.min(1,b[2]+a.nativeEvent.deltaY/100));this._updateHSV(b,!1)};this.children=[this.cylinderDef={key:"disc",facade:za,onMouseDown:a,onDragStart:a,onDrag:a},this.cylinderBgDef={facade:Aa,renderOrder:9},this.planeDef={facade:Ca,renderOrder:10,opacity:.3,pointerStates:{hover:{opacity:.4}},transition:{opacity:!0},onDragStart:a=>{this._dragData={plane:(new e.Plane).setFromNormalAndCoplanarPoint((new e.Vector3(0,1,0)).transformDirection(this.threeObject.matrixWorld),a.intersection.point)}}, | ||
onDrag:a=>{var {plane:b}=this._dragData;b=a.ray.intersectPlane(b,new e.Vector3);this.threeObject.worldToLocal(b);let d=this._getHSV();d[2]=Math.max(0,Math.min(1,b.z/this.cylinderHeight));this._updateHSV(d,a.shiftKey)},onDragEnd:a=>{this._dragData=null}},this.stickDef={facade:Ba}]}_getHSV(){var a=[0,0,0];if(null!=this.value){p.set(this.value);{a=p.r;var b=p.g,c=p.b;let f,e;let g,h,k=Math.max(a,b,c);var d=k-Math.min(a,b,c);0===d?h=g=0:(h=d/k,f=(k-a)/6/d+.5,e=(k-b)/6/d+.5,d=(k-c)/6/d+.5,a===k?g=d-e: | ||
b===k?g=1/3+f-d:c===k&&(g=2/3+e-f),0>g?g+=1:1<g&&--g);a=[g,h,k]}}return a}_updateHSV(a,b){a=ha(...a);p.setRGB(...a);b&&(p.r=Math.round(5*p.r)/5,p.g=Math.round(5*p.g)/5,p.b=Math.round(5*p.b)/5);this.onChange(p.getHex())}afterUpdate(){let {stickDef:a,cylinderDef:b,cylinderBgDef:c,planeDef:d,cylinderHeight:f,cylinderDiameter:e}=this,g=this._getHSV(),h=g[0]*Math.PI*2,k=g[1]/2*e,m=Math.sin(h)*k;a.x=Math.cos(h)*k;a.y=m;a.z=g[2]*f;a.color=this.value;b.maxValue=g[2];b.scale=e;b.scaleZ=g[2]*f+1E-5;c.scale= | ||
e;c.scaleZ=f;d.z=g[2]*f;super.afterUpdate()}}let Ea=["mousedown","wheel"];class ba extends m{constructor(a){super(a);this.popupContent=null;this._popupCt={key:"popup",facade:C.ParentFacade};this._onCloserEvent=a=>{a:{for(a=a.target;a;){if(a===this){a=!0;break a}a=a.parent}a=!1}a||this.closePopup()};this.openPopup=()=>{this.isPopupOpen||(this.isPopupOpen=!0,this.afterUpdate())};this.closePopup=()=>{this.isPopupOpen&&(this.isPopupOpen=!1,this.afterUpdate())}}getPopupContent(){return this.popupContent}set children(a){this._children= | ||
[this._popupCt].concat(a)}get children(){return this._children}_toggleCloseListeners(a){let b=this.getSceneFacade();b&&Ea.forEach(c=>{b[(a?"add":"remove")+"EventListener"](c,this._onCloserEvent)})}afterUpdate(){let {isPopupOpen:a}=this;a!==this._wasPopupOpen&&(this._wasPopupOpen=a,this._toggleCloseListeners(a));this._popupCt.children=a?this.getPopupContent():null;super.afterUpdate()}destructor(){this._toggleCloseListeners(!1);super.destructor()}}let F=new e.Color;class Fa extends ba{constructor(a){super(a); | ||
this.flexDirection="row";this.alignItems="center";this.children=[this.swatchDef={facade:m,borderRadius:"10%",backgroundColor:null,height:"100%",width:"25%",onClick:this.openPopup},this.labelDef={facade:m,padding:.01}];this.popupContent=this.pickerDef={key:"picker",facade:Da,visible:!1,onChange:this._onColorChange.bind(this),animation:{from:{scale:1E-10},to:{scale:1},duration:500,easing:"easeOutExpo"}}}_onColorChange(a){this.onUpdate(a)}afterUpdate(){let {swatchDef:a,labelDef:b,pickerDef:c,value:d, | ||
offsetWidth:f,offsetHeight:e}=this;var g=null!=d;g&&F.set(d);a.backgroundColor=g?F.getHex():null;b.text=g?"#"+F.getHexString().toUpperCase():"(choose color)";f&&e&&(c.visible=!0,c.value=F.getHex(),g=7*e,c.scale=c.animation.to.scale=g,c.x=f+.75*g,c.y=-g/2-e);super.afterUpdate()}}class Ga extends m{constructor(a){super(a);this.flexDirection="row";this.minHeight=.01;this.backgroundColor=6710886;this.children=this._valChild={key:"slider",facade:m,backgroundColor:16777215,width:"0%"};this.onMouseDown= | ||
this.onDragStart=this.onDrag=a=>{var b=this.min||0,d=this.max||0;d!==b&&a.intersection&&a.intersection.facade===this&&(b+=a.intersection.uv.x*(d-b),d=this.step||.001,b=Math.round(b/d)*d,b=+b.toFixed((d+"").replace(/^-?\d+\.?/,"").length),this.onChange(b),a.stopPropagation())}}afterUpdate(){let a=this.value||0,b=Math.min(this.min||0,a),c=Math.max(this.max||0,a);this._valChild.width=b===c?0:`${(a-b)/(c-b)*100}%`;super.afterUpdate()}}class Ha extends m{constructor(a){super(a);this.min=this.value=0;this.max= | ||
1;this.step=.1;this.flexDirection="row";this.alignItems="center";this.children=[this._sliderChild={key:"slider",facade:Ga,flex:1,minWidth:.2,height:"100%",margin:[0,.01,0,0]},this._textChild={key:"text",facade:m,width:.05,text:"0"}]}afterUpdate(){this._textChild.text=this.value+"";let a=this._sliderChild;a.value=this.value||0;a.min=this.min||0;a.max=this.max||0;a.step=this.step;a.onChange=this.onUpdate;super.afterUpdate()}}class Ia extends ba{constructor(a){super(a);this.position="relative";this.dropdownConfig= | ||
null;this._onItemClick=a=>{this.onUpdate(a.target.value);this.closePopup()};this.children=[this._btnChild={key:"btn",facade:m,flexDirection:"row",alignItems:"center",justifyContent:"space-between",borderRadius:"10%",backgroundColor:3355545,height:"100%",padding:[0,.02],overflow:"hidden",pointerStates:{hover:{backgroundColor:6710988}},onClick:this.openPopup,children:["",{facade:Y,icon:"keyboard_arrow_down"}]}];this.popupContent={key:"menu",facade:m,position:"absolute",top:"100%",left:0,width:"100%", | ||
backgroundColor:3355443,z:.01,maxHeight:.5,overflow:"scroll",flexDirection:"column",children:this._menuListDef={facade:C.ListFacade,data:null,template:{key:(a,c)=>c,facade:m,width:"100%",overflow:"hidden",whiteSpace:"nowrap",padding:.01,text:a=>a.label,value:a=>a.value,onClick:a=>this._onItemClick,backgroundColor:a=>a.selected?6710886:null,pointerStates:{hover:{backgroundColor:4473924}}}},animation:{from:{scale:.01},to:{scale:1},duration:300,easing:"easeOutExpo"}}}afterUpdate(){let a=null,b=this.options.reduce((b, | ||
d)=>{if(d){const c={};d&&"object"===typeof d?(c.value=d.value,c.label="string"===typeof d.label?d.label:`${d.value}`):(c.value=d,c.label=d+"");c.value===this.value&&(c.selected=!0,a=c);b.push(c)}return b},[]);this._btnChild.children[0]=a?a.label:"[Select...]";Object.assign(this.popupContent,this.dropdownConfig);this._menuListDef.data=b;super.afterUpdate()}}let Ja={boolean:xa,button:ya,color:Fa,number:Ha,select:Ia};class Ka extends m{constructor(a){super(a);this.flexDirection="row";this.fontSize=.02; | ||
this.itemHeight=.04;this.padding=[0,.02];this.backgroundColor=4473924;this.borderRadius=.01;this.alignItems="flex-start";this.data={}}_onItemUpdate(a,b){N["default"].set(this.data,a.path,b);this.onUpdate(this.data)}describeChildren(){return[{facade:m,flexDirection:"column",margin:[0,.03,0,0],children:(this.items||[]).map((a,b)=>a?{facade:m,text:"button"===a.type?null:a.label||a.path,height:a.height||this.itemHeight,margin:[b?0:.02,0,.02],flexDirection:"row",alignItems:"center"}:null)},{facade:m,flexDirection:"column", | ||
minWidth:.2,children:(this.items||[]).map((a,b)=>{if(!a)return null;let c=a&&Ja[a.type];return c?C.utils.assign({key:a.path||b,facade:c,height:a.height||this.itemHeight,margin:[b?0:.02,0,.02],value:N["default"].get(this.data,a.path)},a,{onUpdate:b=>{a.onUpdate&&a.onUpdate.call(a,b);this._onItemUpdate(a,b)}}):{facade:m,text:`Unknown Type: ${a.type}`}})}]}}n.DatGuiFacade=Ka;n.UIBlock3DFacade=m;n.UIImage3DFacade=G;n.extendAsFlexNode=t;Object.defineProperty(n,"__esModule",{value:!0})}) |
{ | ||
"name": "troika-3d-ui", | ||
"version": "0.47.1", | ||
"version": "0.47.2", | ||
"description": "Troika 3D User Interface Toolkit", | ||
@@ -18,7 +18,7 @@ "author": "Jason Johnston <jason.johnston@protectwise.com>", | ||
"object-path": "^0.11.4", | ||
"troika-3d": "^0.47.0", | ||
"troika-3d-text": "^0.47.1", | ||
"troika-core": "^0.47.0", | ||
"troika-flex-layout": "^0.47.1", | ||
"troika-three-utils": "^0.47.0" | ||
"troika-3d": "^0.47.2", | ||
"troika-3d-text": "^0.47.2", | ||
"troika-core": "^0.47.2", | ||
"troika-flex-layout": "^0.47.2", | ||
"troika-three-utils": "^0.47.2" | ||
}, | ||
@@ -28,3 +28,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "c6c71dca91c9e3de1cba26ec063c3ebfc5414664" | ||
"gitHead": "27cb013dd98d1b3e47d42dcc2787313949525572" | ||
} |
@@ -32,3 +32,3 @@ import { Mesh, Vector2, Vector3, Vector4, PlaneGeometry, Sphere, Matrix4, Plane } from 'three' | ||
*/ | ||
class UIBlock3DFacade extends Group3DFacade { | ||
class UIBlock3DFacadeBase extends Group3DFacade { | ||
constructor(parent) { | ||
@@ -235,3 +235,3 @@ super(parent) | ||
children[i] = { | ||
facade: UIBlock3DFacade$FlexNode, | ||
facade: UIBlock3DFacade, | ||
text: '' + children[i], | ||
@@ -381,3 +381,3 @@ textMaterial: this.textMaterial | ||
// Extend as FlexNode | ||
const UIBlock3DFacade$FlexNode = UIBlock3DFacade = extendAsFlexNode(UIBlock3DFacade) | ||
const UIBlock3DFacade = extendAsFlexNode(UIBlock3DFacadeBase) | ||
@@ -384,0 +384,0 @@ INHERITABLES.forEach(prop => { |
@@ -13,3 +13,3 @@ import { extendAsFlexNode } from '../flex-layout/FlexNode.js' | ||
*/ | ||
class UITextNode3DFacade extends Text3DFacade { | ||
class UITextNode3DFacadeBase extends Text3DFacade { | ||
constructor (props) { | ||
@@ -76,3 +76,3 @@ super(props) | ||
// Extend as FlexNode | ||
UITextNode3DFacade = extendAsFlexNode(UITextNode3DFacade) | ||
const UITextNode3DFacade = extendAsFlexNode(UITextNode3DFacadeBase) | ||
@@ -79,0 +79,0 @@ INHERITABLES.forEach(prop => { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
261510
6240
Updatedtroika-3d@^0.47.2
Updatedtroika-3d-text@^0.47.2
Updatedtroika-core@^0.47.2
Updatedtroika-flex-layout@^0.47.2
Updatedtroika-three-utils@^0.47.2