troika-core
Advanced tools
Comparing version 0.34.0 to 0.35.0
@@ -0,0 +0,0 @@ import Facade from '../../src/facade/Facade.js' |
@@ -0,0 +0,0 @@ import Facade from '../../src/facade/Facade.js' |
@@ -0,0 +0,0 @@ import {_assign, assign, assignIf, forOwn, getIdForObject, createClassExtender, isReactElement} from '../src/utils.js' |
@@ -6,2 +6,13 @@ # Change Log | ||
# [0.35.0](https://github.com/protectwise/troika/compare/v0.34.2...v0.35.0) (2020-11-16) | ||
### Features | ||
* initial support for spring physics-based transitions ([5e05bc8](https://github.com/protectwise/troika/commit/5e05bc8b0f2d0dd7af1f5f59f41c60929ac45ae2)) | ||
# [0.34.0](https://github.com/protectwise/troika/compare/v0.33.1...v0.34.0) (2020-10-19) | ||
@@ -8,0 +19,0 @@ |
@@ -1,58 +0,57 @@ | ||
'use strict';(function(p,C){"object"===typeof exports&&"undefined"!==typeof module?C(exports,require("troika-animation"),require("react"),require("prop-types")):"function"===typeof define&&define.amd?define(["exports","troika-animation","react","prop-types"],C):(p="undefined"!==typeof globalThis?globalThis:p||self,C(p.troika_core={},p.troika_animation,p.React,p.PropTypes))})(this,function(p,C,u,D){function P(c){return c&&"object"===typeof c&&"default"in c?c:{"default":c}}function Q(){for(var c=arguments, | ||
a=arguments[0],e=1,b=arguments.length;e<b;e++){var d=c[e];if(d)for(var l in d)d.hasOwnProperty(l)&&(a[l]=d[l])}return a}function R(){for(var c=arguments,a=arguments[0],e=1,b=arguments.length;e<b;e++){var d=c[e];if(d)for(var l in d)d.hasOwnProperty(l)&&!a.hasOwnProperty(l)&&(a[l]=d[l])}return a}function S(c,a){if(a)for(var e in a)a.hasOwnProperty(e)&&(c[e]&&"object"===typeof c[e]&&"object"===typeof a[e]?S(c[e],a[e]):c[e]=a[e])}function G(c,a){var e=new WeakMap;return function(b){var d=e.get(b);d|| | ||
(d=a(b),e.set(b,d));return d}}function T(c){return(c=c.$$typeof)&&c.toString&&"Symbol(react.element)"===c.toString()||!1}function da(c,a){return"paused"===c?void 0:Infinity===a?"Infinity":a}function ea(c,a){return c.time-a.time}function H(c){return"onDoubleClick"===c?"dblclick":c.replace(/^on/,"").toLowerCase()}function fa(){function c(b,d,e,c){try{b.call(d,e,c)}catch(f){console.error(f)}}var a=this,e=Object.create(null);this.addListenerForFacade=function(b,d,c){d=e[d]||(e[d]={count:0,byFacadeId:Object.create(null)}); | ||
b=b.$facadeId;var a=d.byFacadeId[b];a?Array.isArray(a)?-1===a.indexOf(c)&&(d.count++,a.push(c)):a!==c&&(d.count++,d.byFacadeId[b]=[a,c]):(d.count++,d.byFacadeId[b]=c)};this.removeListenerForFacade=function(b,d,c){d=e[d];b=b.$facadeId;var a=d&&d.byFacadeId[b];a===c?(d.count--,delete d.byFacadeId[b]):Array.isArray(a)&&(c=a.indexOf(c),-1<c&&(d.count--,1===a.length?delete d.byFacadeId[b]:a.splice(c,1)))};this.removeAllListenersForFacade=function(b){b=b.$facadeId;for(var d in e){var c=e[d].byFacadeId[b]; | ||
c&&(e[d].count-=Array.isArray(c)?c.length:1,delete e[d].byFacadeId[b])}};this.hasFacadeListenersOfType=function(b,d){return e[d]?!!e[d].byFacadeId[b.$facadeId]:!1};this.hasAnyListenersOfType=function(b){return e[b]?0<e[b].count:!1};this.findBubblingEventTarget=function(b,d){for(;b;){if(a.hasFacadeListenersOfType(b,d))return b;b=b.parent}return null};this.forEachFacadeListenerOfType=function(b,d,a,g){d=e[d];b=b.$facadeId;if(d=d&&d.byFacadeId[b])if(Array.isArray(d))for(var l=0;l<d.length;l++)c(a,g, | ||
d[l],b);else c(a,g,d,b)};this.forEachListenerOfType=function(b,d,a){if((b=e[b])&&0<b.count)for(var g in b.byFacadeId){var l=b.byFacadeId[g];if(Array.isArray(l))for(var h=0;h<l.length;h++)c(d,a,l[h],g);else c(d,a,l,g)}};this.dispatchEventOnFacade=function(b,d){function c(b){b.call(e,d)}var e=b;for(d.target=b;e&&!d.propagationStopped;)if(d.currentTarget=e,a.forEachFacadeListenerOfType(e,d.type,c,null),d.bubbles)e=e.parent;else break}}function I(c){return"touchend"===c.type||"touchcancel"===c.type}function ha(c){c.stopPropagation(); | ||
c.preventDefault()}var r=P(u);u=P(D);var x=Object.assign||Q;D=function(){var c=new WeakMap,a=0;return function(e){var b=c.get(e);b||c.set(e,b="$id"+ ++a);return b}}();D=Object.freeze({__proto__:null,assign:x,_assign:Q,assignIf:R,assignDeep:S,forOwn:function(c,a,e){for(var b in c)c.hasOwnProperty(b)&&a.call(e,c[b],b,c)},getIdForObject:D,memoize:function(c){var a,e,b;return function(){var d=arguments,l=!a||this!==e||arguments.length!==a.length;if(!l)for(var g=0,f=arguments.length;g<f;g++)if(d[g]!== | ||
a[g]){l=!0;break}l&&(a=Array.prototype.slice.call(arguments),e=this,b=c.apply(this,arguments));return b}},createClassExtender:G,isReactElement:T});var k=function(c){this.$facadeId="facade"+ia++;this.parent=c};k.prototype.update=function(c){c&&"object"===typeof c&&(x(this,c),this.afterUpdate(),this.notifyWorld("needsRender"))};k.prototype.afterUpdate=function(){var c=this.ref;c!==this._lastRef&&("function"===typeof this._lastRef&&this._lastRef.call(null,null),"function"===typeof c?(c.call(null,this), | ||
this._lastRef=c):this._lastRef=null)};k.prototype.notifyWorld=function(c,a){if(this.parent)this.parent.onNotifyWorld(this,c,a)};k.prototype.onNotifyWorld=function(c,a,e){var b=this._notifiableParent;if(b)b.onNotifyWorld.call(b,c,a,e);else{b=this.parent;for(var d=k.prototype.onNotifyWorld;b;){if(b.onNotifyWorld!==d){this._notifiableParent=b;b.onNotifyWorld(c,a,e);break}b=b.parent}}};k.prototype.traverse=function(c){c(this)};k.prototype.forEachChild=function(c){};k.prototype.addEventListener=function(c, | ||
a){this.notifyWorld("addEventListener",{type:c,handler:a})};k.prototype.removeEventListener=function(c,a){this.notifyWorld("removeEventListener",{type:c,handler:a})};k.prototype.dispatchEvent=function(c){this.notifyWorld("dispatchEvent",c)};k.prototype.destructor=function(){this.parent&&this.notifyWorld("removeAllEventListeners");"function"===typeof this.ref&&this.ref.call(null,null);this.parent=this._notifiableParent=null};x(k.prototype,{ref:null,_lastRef:null,_notifiableParent:null});var ia=0,ja= | ||
{key:1,facade:1,transition:1,animation:1};k.isSpecialDescriptorProperty=function(c){return ja.hasOwnProperty(c)};k.defineEventProperty=function(c,a,e){var b=a+"\u27a4handler";Object.defineProperty(c.prototype,a,{get:function(){return this[b]},set:function(d){var c=this[b];(d||null)!==(c||null)&&("function"===typeof c&&this.removeEventListener(e,c),"function"===typeof d&&this.addEventListener(e,d),this[b]=d)}})};var U=[null],V=G("animatable",function(c){function a(b,d){if(!e.prototype.hasOwnProperty(b)){for(var a= | ||
b+"\u27a4anim:actualValue",g=b+"\u27a4anim:actuallySet",f=b+"\u27a4anim:hasBeenSet",h=b+"\u27a4anim:tween",m,v,L=c.prototype;L;){var J=Object.getOwnPropertyDescriptor(L,b);if(J){v=J.set;m=J.get;if(v&&!m||m&&!v)throw Error("Animatable: property "+b+" has a custom "+(v?"setter":"getter")+" but no "+(v?"getter":"setter")+". Animatable properties must have both.");break}L=Object.getPrototypeOf(L)}var n=v?function(b){v.call(this,b);this[f]||(this[f]=!0)}:function(b){this[a]=b;this[f]||(this[f]=!0)};Object.defineProperty(e.prototype, | ||
g,{value:n});Object.defineProperty(e.prototype,b,{get:function(){return m?m.call(this):this[f]?this[a]:c.prototype[b]},set:function(d){if(!this.animation$animatingProps||!this.animation$animatingProps[b]){var c=this.animation$runner,a=this.transition;if(a&&a[b]&&this[f]&&a.hasOwnProperty(b)){a=a[b];var e=this[h],g=!1;e?d!==e.toValue&&(c.stop(e),g=!0):d!==this[b]&&(g=!0);g&&(e=this[h]=new C.Tween(n.bind(this),this[b],d,a.duration||750,a.delay||0,a.easing||"easeOutCubic",1,"forward",a.interpolate|| | ||
"number"),c.start(e))}else n.call(this,d),(d=this[h])&&c.stop(d),this[h]=null}}})}d.hasOwnProperty(b)&&(d[b+"\u27a4anim:actualValue"]=d[b],d[b+"\u27a4anim:hasBeenSet"]=!0,delete d[b])}var e=function(b){function d(){for(var c=this,d=[],a=arguments.length;a--;)d[a]=arguments[a];b.apply(this,d);this.animation$runner=new C.Runner;this.animation$runner.onTick=function(){c.afterUpdate();c.notifyWorld("needsRender")}}b&&(d.__proto__=b);d.prototype=Object.create(b&&b.prototype);d.prototype.constructor=d; | ||
var c={transition:{configurable:!0},animation:{configurable:!0}};c.transition.set=function(b){if(b)for(var c in b)b.hasOwnProperty(c)&&a(c,this);this.transition$descriptor=b};c.transition.get=function(){return this.transition$descriptor};c.animation.set=function(b){if(this.animation$descriptor!==b){this.animation$descriptor=b;var c=this.animation$tweens||null,d=this.animation$tweens=b?Object.create(null):null,e=this.animation$runner,g=!1;b&&!Array.isArray(b)&&(U[0]=b,b=U);if(b)for(var l=0,J=b.length;l< | ||
J;l++){var n=b[l];if(n){var t=JSON.stringify(n,da);if(c&&t in c){var q=c[t];n.paused?e.pause(q):e.start(q);d[t]=q}else{g=0;var k=750,p="linear",r=1;q=[];var u="forward",w;for(w in n)if(n.hasOwnProperty(w))switch(w){case "duration":k=n[w];break;case "delay":g=n[w];break;case "easing":p=n[w];break;case "iterations":r=n[w];break;case "direction":u=n[w];break;default:var z="from"===w?0:"to"===w?100:parseFloat(w);if(!isNaN(z)&&0<=z&&100>=z){q.push({time:z/100,props:n[w]});for(var y in n[w])n[w].hasOwnProperty(y)&& | ||
(a(y,this),z=y+"\u27a4anim:tween",this[z]&&(e.stop(this[z]),this[z]=null))}}if(q.length){q.sort(ea);0<q[0].time&&q.unshift(R({time:0},q[0]));z=[];for(var x=1,B=q.length;x<B;x++){var D=q[x],A=D.props,E;for(E in A)if(A.hasOwnProperty(E)){for(var F=null,G=x;G--;)if(E in q[G].props){F=q[G];break}F&&(F=new C.Tween(this[E+"\u27a4anim:actuallySet"].bind(this),F.props[E],A[E],(D.time-F.time)*k,F.time*k,"linear",1,"forward",n.interpolate&&n.interpolate[E]||"number"),F.$$property=E,z.push(F))}}t=d[t]=new C.MultiTween(z, | ||
k,g,p,r,u);n.paused||e.start(t);if(0===g){n=q[0].props;for(var H in n)if(n.hasOwnProperty(H))this[H+"\u27a4anim:actuallySet"](n[H])}}g=!0}}}if(c)for(var K in c)d&&d[K]||(b=c[K],b.gotoEnd(),e.stop(b),g=!0);if(g)if(d){c=this.animation$animatingProps=Object.create(null);for(var I in d)for(e=d[I].tweens,K=e.length;K--;)c[e[K].$$property]=!0}else this.animation$animatingProps=null}};c.animation.get=function(){return this.animation$descriptor};d.prototype.destructor=function(){var c=this,d=this.animation$runner; | ||
if(this.exitAnimation&&!this.parent.isDestroying){d.stopAll();this.animation=this.exitAnimation;this.exitAnimation=this.transition=null;var a=d.onTick;d.onTick=function(){c.parent&&!c.parent.isDestroying?a():(d.onDone=null,c.destructor())};d.onDone=function(){c.notifyWorld("needsRender");c.destructor()}}else d.destructor(),b.prototype.destructor.call(this)};Object.defineProperties(d.prototype,c);return d}(c);return e}),W=G("pointerStates",function(c){function a(b,d){var a=b+"\u27a4pntr:hasBeenSet"; | ||
d[a]||(d[b+"\u27a4pntr:baseValue"]=d[b],delete d[b],d[a]=!0);if(!m.prototype.hasOwnProperty(b)){h[b]=1;var e=b+"\u27a4pntr:baseValue",g=b+"\u27a4pntr:appliedValue";Object.defineProperty(m.prototype,b,{get:function(){a:{var d=c.prototype;if(b in d)for(;d;){var a=Object.getOwnPropertyDescriptor(d,b);if(a&&a.get){d=a.get;break a}d=Object.getPrototypeOf(d)}d=null}return d?d.call(this):g in this?this[g]:this[e]},set:function(b){this[e]=b}})}}function e(b,d,a){a:{var e=c.prototype;if(d in e)for(;e;){var g= | ||
Object.getOwnPropertyDescriptor(e,d);if(g&&g.set){e=g.set;break a}e=Object.getPrototypeOf(e)}e=null}e?e.call(b,a):b[d+"\u27a4pntr:appliedValue"]=a}function b(b){b.currentTarget["\u27a4pntr:isHovering"]=!0;f(b)}function d(b){b.currentTarget["\u27a4pntr:isHovering"]=b.currentTarget["\u27a4pntr:isActive"]=!1;f(b)}function l(b){b.currentTarget["\u27a4pntr:isActive"]=!0;f(b)}function g(b){b.currentTarget["\u27a4pntr:isActive"]=!1;f(b)}function f(b){b=b.currentTarget;for(var d=b.parent;d&&d.shouldUpdateChildren();)d.isPointerStateAware&& | ||
(b=d),d=d.parent;b.afterUpdate();b.notifyWorld("needsRender")}var h=Object.create(null),m=function(c){function f(a){c.call(this,a);this.addEventListener("mouseover",b);this.addEventListener("mouseout",d);this.addEventListener("mousedown",l);this.addEventListener("mouseup",g)}c&&(f.__proto__=c);f.prototype=Object.create(c&&c.prototype);f.prototype.constructor=f;f.prototype.afterUpdate=function(){this._applyPointerStates();c.prototype.afterUpdate.call(this)};f.prototype._applyPointerStates=function(){var b= | ||
this.pointerStates,d=b&&this["\u27a4pntr:isHovering"]&&b.hover||null,c=b&&this["\u27a4pntr:isActive"]&&b.active||null;b=this["\u27a4pntr:lastAppliedValues"]||h;if(d=this["\u27a4pntr:lastAppliedValues"]=d||c?x(Object.create(null),d,c):null)for(var g in d)a(g,this),e(this,g,d[g]);if(b)for(var l in b)d&&l in d||e(this,l,this[l+"\u27a4pntr:baseValue"])};return f}(c);Object.defineProperty(m.prototype,"isPointerStateAware",{value:!0});return m}),ka=function(c){function a(a){c.call(this,a);this._orderedItemKeys= | ||
[]}c&&(a.__proto__=c);a.prototype=Object.create(c&&c.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){var a=this.data,b=this.template,d=a&&a.length&&Array.isArray(a);if("production"!==process.env.NODE_ENV){if(a&&!Array.isArray(a))throw Error('ListFacade "data" must be an array.');if(!b||"object"!==typeof b)throw Error('ListFacade "template" must be an object.');if(!b||"function"!==typeof b.key)throw Error('ListFacade template must define a "key" function.');if(!b||"function"!== | ||
typeof b.facade)throw Error('ListFacade template must define a "facade".');}if(this.shouldUpdateChildren()){var l=this._itemsDict||null,g=this._itemsDict=d?Object.create(null):null,f=this._orderedItemKeys;if(d){f.length=a.length;d=0;for(var h=a.length;d<h;d++){var m=a[d],v=b.key(m,d,a),k=b.facade;if("production"!==process.env.NODE_ENV){if(null==v)throw Error('ListFacade template "key" function must return a key.');g[v]&&console.warn("Duplicate key in list: "+v)}for(;g[v];)v+="|dupe";var p="function"=== | ||
typeof b.transition?b.transition(m,d,a):b.transition,n="function"===typeof b.animation?b.animation(m,d,a):b.animation,t="function"===typeof b.exitAnimation?b.exitAnimation(m,d,a):b.exitAnimation;if(p||n||t)k=V(k);t=b.pointerStates;if("function"===t?t(m,d,a):t)k=W(k);(t=l&&l[v])&&t.constructor===k?k=t:(t&&t.destructor(),k=new k(this));k.transition=p;k.animation=n;for(var q in b)b.hasOwnProperty(q)&&!c.isSpecialDescriptorProperty(q)&&(k[q]="function"===typeof b[q]?b[q](m,d,a):b[q]);k.afterUpdate(); | ||
g[v]=k;f[d]=v}}if(l)for(var r in l)g&&g[r]||l[r].destructor()}c.prototype.afterUpdate.call(this)};a.prototype.shouldUpdateChildren=function(){return!0};a.prototype.traverse=function(c,b){c.call(b,this);for(var d=this._orderedItemKeys,a=this._itemsDict,e=0,f=d.length;e<f;e++)a[d[e]].traverse(c,b)};a.prototype.forEachChild=function(c,b){for(var d=this._orderedItemKeys,a=this._itemsDict,e=0,f=d.length;e<f;e++)c.call(b,a[d[e]],d[e])};a.prototype.destructor=function(){this.isDestroying=!0;var a=this._itemsDict; | ||
if(a)for(var b in a)a[b].destructor();c.prototype.destructor.call(this)};return a}(k),X=[null],M=function(c){function a(a){c.call(this,a);this.children=null;this._orderedChildKeys=[]}c&&(a.__proto__=c);a.prototype=Object.create(c&&c.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){this.shouldUpdateChildren()&&this.updateChildren(this.describeChildren());c.prototype.afterUpdate.call(this)};a.prototype.describeChildren=function(){return this.children};a.prototype.shouldUpdateChildren= | ||
function(){return!0};a.prototype.updateChildren=function(a){var b=this._childrenDict||null,d=this._childrenDict=null,e=this._orderedChildKeys;e.length=0;if(a){Array.isArray(a)||(X[0]=a,a=X);for(var g=0,f=a.length;g<f;g++){var h=a[g];if(h){d||(d=this._childrenDict=Object.create(null));var m=T(h),k=m?h.props:h;m=m?h.type:h.facade;h=h.key;if(!h){var p=0;do h="auto:"+m.name+":"+p++;while(d[h])}if("production"!==process.env.NODE_ENV&&"function"!==typeof m)throw Error('All scene objects must have a "facade" property pointing to a class/constructor'); | ||
if(d[h])for(console.warn("Duplicate key in children: "+h);d[h];)h+="|dupe";p=k.transition;var r=k.animation;if(p||r||k.exitAnimation)m=V(m);k.pointerStates&&(m=W(m));var n=b&&b[h];n&&n.constructor===m?m=n:(n&&n.destructor(),m=new m(this));m.transition=p;m.animation=r;for(var t in k)k.hasOwnProperty(t)&&!c.isSpecialDescriptorProperty(t)&&(m[t]=k[t]);d[h]=m;e.push(h);m.afterUpdate()}}}if(b)for(var q in b)d&&d[q]||b[q].destructor()};a.prototype.getChildByKey=function(a){var b=this._childrenDict;return b&& | ||
b[a]||null};a.prototype.traverse=function(a,b){a.call(b,this);for(var d=this._orderedChildKeys,c=this._childrenDict,e=0,f=d.length;e<f;e++)c[d[e]].traverse(a,b)};a.prototype.forEachChild=function(a,b){for(var d=this._orderedChildKeys,c=this._childrenDict,e=0,f=d.length;e<f;e++)a.call(b,c[d[e]],d[e])};a.prototype.destructor=function(){this.isDestroying=!0;var a=this._childrenDict;if(a)for(var b in a)a[b].destructor();c.prototype.destructor.call(this)};return a}(k),y="onMouseOver onMouseOut onMouseMove onDragStart onDrag onDragEnter onDragOver onDragLeave".split(" "), | ||
A="onMouseDown onMouseUp onClick onDoubleClick onDrop onDragEnd onWheel".split(" "),Y=A.map(H),Z=y.map(H);y=y.concat(A);var aa=Z.concat(Y),N=function(c){function a(){c.apply(this,arguments)}c&&(a.__proto__=c);a.prototype=Object.create(c&&c.prototype);a.prototype.constructor=a;a.prototype.interceptsPointerEvents=function(a){if(!1===this.pointerEvents)return!1;if(this.pointerEvents)return!0;for(var b=0,d=aa.length;b<d;b++)if(a.hasFacadeListenersOfType(this,aa[b]))return!0};return a}(M);Object.defineProperty(N.prototype, | ||
"isPointerEventTarget",{value:!0});y.forEach(function(c){k.defineEventProperty(N,c,H(c))});var la={},ma=["mousemove","mouseout","touchmove"],na="mousedown mouseup click dblclick wheel touchstart touchend touchcancel".split(" "),ba=["mouseup","touchend","touchcancel"],oa={touchstart:"mousedown",touchend:"mouseup",touchcancel:"mouseup"},pa="clientX clientY screenX screenY pageX pageY".split(" "),B=function(c,a,e,b,d){var l=this,g;for(g in c)"function"!==typeof c[g]&&(this[g]=c[g]);this.target=e;this.relatedTarget= | ||
b;this.type=a;this.nativeEvent=c;x(this,d);if(c.touches){var f=I(c)?c.changedTouches:c.touches;1===f.length&&pa.forEach(function(b){l[b]=f[0][b]})}};B.prototype.preventDefault=function(){this.defaultPrevented=!0;this.nativeEvent.preventDefault()};B.prototype.stopPropagation=function(){this.propagationStopped=!0;this.nativeEvent.stopPropagation()};y=function(c){function a(b){c.call(this,null);this.width=this.height=1;this._element=b;this._htmlOverlays=Object.create(null);this.eventRegistry=new fa; | ||
'use strict';(function(v,A){"object"===typeof exports&&"undefined"!==typeof module?A(exports,require("troika-animation"),require("react"),require("prop-types")):"function"===typeof define&&define.amd?define(["exports","troika-animation","react","prop-types"],A):(v=v||self,A(v.troika_core={},v.troika_animation,v.React,v.PropTypes))})(this,function(v,A,k,q){function P(){for(var c=arguments,a=arguments[0],e=1,b=arguments.length;e<b;e++){var d=c[e];if(d)for(var g in d)d.hasOwnProperty(g)&&(a[g]=d[g])}return a} | ||
function Q(){for(var c=arguments,a=arguments[0],e=1,b=arguments.length;e<b;e++){var d=c[e];if(d)for(var g in d)d.hasOwnProperty(g)&&!a.hasOwnProperty(g)&&(a[g]=d[g])}return a}function R(c,a){if(a)for(var e in a)a.hasOwnProperty(e)&&(c[e]&&"object"===typeof c[e]&&"object"===typeof a[e]?R(c[e],a[e]):c[e]=a[e])}function F(c,a){var e=new WeakMap;return function(b){var d=e.get(b);d||(d=a(b),e.set(b,d));return d}}function S(c){return(c=c.$$typeof)&&c.toString&&"Symbol(react.element)"===c.toString()||!1} | ||
function ca(c,a){return"paused"===c?void 0:Infinity===a?"Infinity":a}function da(c,a){return c.time-a.time}function G(c){return"onDoubleClick"===c?"dblclick":c.replace(/^on/,"").toLowerCase()}function ea(){function c(b,d,e,a){try{b.call(d,e,a)}catch(f){console.error(f)}}var a=this,e=Object.create(null);this.addListenerForFacade=function(b,d,a){d=e[d]||(e[d]={count:0,byFacadeId:Object.create(null)});b=b.$facadeId;var c=d.byFacadeId[b];c?Array.isArray(c)?-1===c.indexOf(a)&&(d.count++,c.push(a)):c!== | ||
a&&(d.count++,d.byFacadeId[b]=[c,a]):(d.count++,d.byFacadeId[b]=a)};this.removeListenerForFacade=function(b,d,a){d=e[d];b=b.$facadeId;var c=d&&d.byFacadeId[b];c===a?(d.count--,delete d.byFacadeId[b]):Array.isArray(c)&&(a=c.indexOf(a),-1<a&&(d.count--,1===c.length?delete d.byFacadeId[b]:c.splice(a,1)))};this.removeAllListenersForFacade=function(b){b=b.$facadeId;for(var d in e){var a=e[d].byFacadeId[b];a&&(e[d].count-=Array.isArray(a)?a.length:1,delete e[d].byFacadeId[b])}};this.hasFacadeListenersOfType= | ||
function(b,d){return e[d]?!!e[d].byFacadeId[b.$facadeId]:!1};this.hasAnyListenersOfType=function(b){return e[b]?0<e[b].count:!1};this.findBubblingEventTarget=function(b,d){for(;b;){if(a.hasFacadeListenersOfType(b,d))return b;b=b.parent}return null};this.forEachFacadeListenerOfType=function(b,d,a,l){d=e[d];b=b.$facadeId;if(d=d&&d.byFacadeId[b])if(Array.isArray(d))for(var g=0;g<d.length;g++)c(a,l,d[g],b);else c(a,l,d,b)};this.forEachListenerOfType=function(b,d,a){if((b=e[b])&&0<b.count)for(var l in b.byFacadeId){var g= | ||
b.byFacadeId[l];if(Array.isArray(g))for(var h=0;h<g.length;h++)c(d,a,g[h],l);else c(d,a,g,l)}};this.dispatchEventOnFacade=function(b,d){function c(b){b.call(e,d)}var e=b;for(d.target=b;e&&!d.propagationStopped;)if(d.currentTarget=e,a.forEachFacadeListenerOfType(e,d.type,c,null),d.bubbles)e=e.parent;else break}}function H(c){return"touchend"===c.type||"touchcancel"===c.type}function fa(c){c.stopPropagation();c.preventDefault()}k=k&&Object.prototype.hasOwnProperty.call(k,"default")?k["default"]:k;q= | ||
q&&Object.prototype.hasOwnProperty.call(q,"default")?q["default"]:q;var x=Object.assign||P,I=function(){var c=new WeakMap,a=0;return function(e){var b=c.get(e);b||c.set(e,b="$id"+ ++a);return b}}();I=Object.freeze({__proto__:null,assign:x,_assign:P,assignIf:Q,assignDeep:R,forOwn:function(c,a,e){for(var b in c)c.hasOwnProperty(b)&&a.call(e,c[b],b,c)},getIdForObject:I,memoize:function(c){var a,e,b;return function(){var d=arguments,g=!a||this!==e||arguments.length!==a.length;if(!g)for(var l=0,f=arguments.length;l< | ||
f;l++)if(d[l]!==a[l]){g=!0;break}g&&(a=Array.prototype.slice.call(arguments),e=this,b=c.apply(this,arguments));return b}},createClassExtender:F,isReactElement:S});var p=function(c){this.$facadeId="facade"+ha++;this.parent=c};p.prototype.update=function(c){c&&"object"===typeof c&&(x(this,c),this.afterUpdate(),this.notifyWorld("needsRender"))};p.prototype.afterUpdate=function(){var c=this.ref;c!==this._lastRef&&("function"===typeof this._lastRef&&this._lastRef.call(null,null),"function"===typeof c? | ||
(c.call(null,this),this._lastRef=c):this._lastRef=null)};p.prototype.notifyWorld=function(c,a){if(this.parent)this.parent.onNotifyWorld(this,c,a)};p.prototype.onNotifyWorld=function(c,a,e){var b=this._notifiableParent;if(b)b.onNotifyWorld.call(b,c,a,e);else{b=this.parent;for(var d=p.prototype.onNotifyWorld;b;){if(b.onNotifyWorld!==d){this._notifiableParent=b;b.onNotifyWorld(c,a,e);break}b=b.parent}}};p.prototype.traverse=function(c){c(this)};p.prototype.forEachChild=function(c){};p.prototype.addEventListener= | ||
function(c,a){this.notifyWorld("addEventListener",{type:c,handler:a})};p.prototype.removeEventListener=function(c,a){this.notifyWorld("removeEventListener",{type:c,handler:a})};p.prototype.dispatchEvent=function(c){this.notifyWorld("dispatchEvent",c)};p.prototype.destructor=function(){this.parent&&this.notifyWorld("removeAllEventListeners");"function"===typeof this.ref&&this.ref.call(null,null);this.parent=this._notifiableParent=null};x(p.prototype,{ref:null,_lastRef:null,_notifiableParent:null}); | ||
var ha=0,ia={key:1,facade:1,transition:1,animation:1};p.isSpecialDescriptorProperty=function(c){return ia.hasOwnProperty(c)};p.defineEventProperty=function(c,a,e){var b=a+"\u27a4handler";Object.defineProperty(c.prototype,a,{get:function(){return this[b]},set:function(d){var a=this[b];(d||null)!==(a||null)&&("function"===typeof a&&this.removeEventListener(e,a),"function"===typeof d&&this.addEventListener(e,d),this[b]=d)}})};var T=[null],U=F("animatable",function(c){function a(b,d){if(!e.prototype.hasOwnProperty(b)){for(var a= | ||
b+"\u27a4anim:actualValue",l=b+"\u27a4anim:actuallySet",f=b+"\u27a4anim:hasBeenSet",h=b+"\u27a4anim:tween",m,u,L=c.prototype;L;){var J=Object.getOwnPropertyDescriptor(L,b);if(J){u=J.set;m=J.get;if(u&&!m||m&&!u)throw Error("Animatable: property "+b+" has a custom "+(u?"setter":"getter")+" but no "+(u?"getter":"setter")+". Animatable properties must have both.");break}L=Object.getPrototypeOf(L)}var n=u?function(b){u.call(this,b);this[f]||(this[f]=!0)}:function(b){this[a]=b;this[f]||(this[f]=!0)};Object.defineProperty(e.prototype, | ||
l,{value:n});Object.defineProperty(e.prototype,b,{get:function(){return m?m.call(this):this[f]?this[a]:c.prototype[b]},set:function(a){var d=this;if(!this.animation$animatingProps||!this.animation$animatingProps[b]){var e=this.animation$runner,c=this.transition;if(c&&c[b]&&this[f]&&c.hasOwnProperty(b)){c=c[b];var l="spring"===c?"default":c.spring,g=this[h],u=!1;g?a!==g.toValue&&(l&&g.isSpring?g.toValue=a:(e.stop(g),u=!0)):a!==this[b]&&(u=!0);u&&(g=this[h]=l?new A.SpringTween(n.bind(this),this[b], | ||
a,l,0,c.delay||0):new A.Tween(n.bind(this),this[b],a,c.duration||750,c.delay||0,c.easing||"easeOutCubic",1,"forward",c.interpolate||"number"),g.onDone=function(){g=d[h]=null},e.start(g))}else n.call(this,a),(a=this[h])&&e.stop(a),this[h]=null}}})}d.hasOwnProperty(b)&&(d[b+"\u27a4anim:actualValue"]=d[b],d[b+"\u27a4anim:hasBeenSet"]=!0,delete d[b])}var e=function(b){function d(){for(var a=this,c=[],d=arguments.length;d--;)c[d]=arguments[d];b.apply(this,c);this.animation$runner=new A.Runner;this.animation$runner.onTick= | ||
function(){a.afterUpdate();a.notifyWorld("needsRender")}}b&&(d.__proto__=b);d.prototype=Object.create(b&&b.prototype);d.prototype.constructor=d;var c={transition:{configurable:!0},animation:{configurable:!0}};c.transition.set=function(b){if(b)for(var d in b)b.hasOwnProperty(d)&&a(d,this);this.transition$descriptor=b};c.transition.get=function(){return this.transition$descriptor};c.animation.set=function(b){if(this.animation$descriptor!==b){this.animation$descriptor=b;var d=this.animation$tweens|| | ||
null,c=this.animation$tweens=b?Object.create(null):null,e=this.animation$runner,g=!1;b&&!Array.isArray(b)&&(T[0]=b,b=T);if(b)for(var l=0,J=b.length;l<J;l++){var n=b[l];if(n){var t=JSON.stringify(n,ca);if(d&&t in d){var r=d[t];n.paused?e.pause(r):e.start(r);c[t]=r}else{g=0;var k=750,p="linear",q=1;r=[];var v="forward",w;for(w in n)if(n.hasOwnProperty(w))switch(w){case "duration":k=n[w];break;case "delay":g=n[w];break;case "easing":p=n[w];break;case "iterations":q=n[w];break;case "direction":v=n[w]; | ||
break;default:var z="from"===w?0:"to"===w?100:parseFloat(w);if(!isNaN(z)&&0<=z&&100>=z){r.push({time:z/100,props:n[w]});for(var y in n[w])n[w].hasOwnProperty(y)&&(a(y,this),z=y+"\u27a4anim:tween",this[z]&&(e.stop(this[z]),this[z]=null))}}if(r.length){r.sort(da);0<r[0].time&&r.unshift(Q({time:0},r[0]));z=[];for(var x=1,B=r.length;x<B;x++){var E=r[x],F=E.props,C;for(C in F)if(F.hasOwnProperty(C)){for(var D=null,G=x;G--;)if(C in r[G].props){D=r[G];break}D&&(D=new A.Tween(this[C+"\u27a4anim:actuallySet"].bind(this), | ||
D.props[C],F[C],(E.time-D.time)*k,D.time*k,"linear",1,"forward",n.interpolate&&n.interpolate[C]||"number"),D.$$property=C,z.push(D))}}t=c[t]=new A.MultiTween(z,k,g,p,q,v);n.paused||e.start(t);if(0===g){n=r[0].props;for(var H in n)if(n.hasOwnProperty(H))this[H+"\u27a4anim:actuallySet"](n[H])}}g=!0}}}if(d)for(var K in d)c&&c[K]||(b=d[K],b.gotoEnd(),e.stop(b),g=!0);if(g)if(c){d=this.animation$animatingProps=Object.create(null);for(var I in c)for(e=c[I].tweens,K=e.length;K--;)d[e[K].$$property]=!0}else this.animation$animatingProps= | ||
null}};c.animation.get=function(){return this.animation$descriptor};d.prototype.destructor=function(){var d=this,a=this.animation$runner;if(this.exitAnimation&&!this.parent.isDestroying){a.stopAll();this.animation=this.exitAnimation;this.exitAnimation=this.transition=null;var c=a.onTick;a.onTick=function(){d.parent&&!d.parent.isDestroying?c():(a.onDone=null,d.destructor())};a.onDone=function(){d.notifyWorld("needsRender");d.destructor()}}else a.destructor(),b.prototype.destructor.call(this)};Object.defineProperties(d.prototype, | ||
c);return d}(c);return e}),V=F("pointerStates",function(c){function a(b,d){var a=b+"\u27a4pntr:hasBeenSet";d[a]||(d[b+"\u27a4pntr:baseValue"]=d[b],delete d[b],d[a]=!0);if(!m.prototype.hasOwnProperty(b)){h[b]=1;var e=b+"\u27a4pntr:baseValue",g=b+"\u27a4pntr:appliedValue";Object.defineProperty(m.prototype,b,{get:function(){a:{var d=c.prototype;if(b in d)for(;d;){var a=Object.getOwnPropertyDescriptor(d,b);if(a&&a.get){d=a.get;break a}d=Object.getPrototypeOf(d)}d=null}return d?d.call(this):g in this? | ||
this[g]:this[e]},set:function(b){this[e]=b}})}}function e(b,d,a){a:{var e=c.prototype;if(d in e)for(;e;){var g=Object.getOwnPropertyDescriptor(e,d);if(g&&g.set){e=g.set;break a}e=Object.getPrototypeOf(e)}e=null}e?e.call(b,a):b[d+"\u27a4pntr:appliedValue"]=a}function b(b){b.currentTarget["\u27a4pntr:isHovering"]=!0;f(b)}function d(b){b.currentTarget["\u27a4pntr:isHovering"]=b.currentTarget["\u27a4pntr:isActive"]=!1;f(b)}function g(b){b.currentTarget["\u27a4pntr:isActive"]=!0;f(b)}function l(b){b.currentTarget["\u27a4pntr:isActive"]= | ||
!1;f(b)}function f(b){b=b.currentTarget;for(var d=b.parent;d&&d.shouldUpdateChildren();)d.isPointerStateAware&&(b=d),d=d.parent;b.afterUpdate();b.notifyWorld("needsRender")}var h=Object.create(null),m=function(c){function f(a){c.call(this,a);this.addEventListener("mouseover",b);this.addEventListener("mouseout",d);this.addEventListener("mousedown",g);this.addEventListener("mouseup",l)}c&&(f.__proto__=c);f.prototype=Object.create(c&&c.prototype);f.prototype.constructor=f;f.prototype.afterUpdate=function(){this._applyPointerStates(); | ||
c.prototype.afterUpdate.call(this)};f.prototype._applyPointerStates=function(){var b=this.pointerStates,d=b&&this["\u27a4pntr:isHovering"]&&b.hover||null,c=b&&this["\u27a4pntr:isActive"]&&b.active||null;b=this["\u27a4pntr:lastAppliedValues"]||h;if(d=this["\u27a4pntr:lastAppliedValues"]=d||c?x(Object.create(null),d,c):null)for(var g in d)a(g,this),e(this,g,d[g]);if(b)for(var l in b)d&&l in d||e(this,l,this[l+"\u27a4pntr:baseValue"])};return f}(c);Object.defineProperty(m.prototype,"isPointerStateAware", | ||
{value:!0});return m}),ja=function(c){function a(a){c.call(this,a);this._orderedItemKeys=[]}c&&(a.__proto__=c);a.prototype=Object.create(c&&c.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){var a=this.data,b=this.template,d=a&&a.length&&Array.isArray(a);if("production"!==process.env.NODE_ENV){if(a&&!Array.isArray(a))throw Error('ListFacade "data" must be an array.');if(!b||"object"!==typeof b)throw Error('ListFacade "template" must be an object.');if(!b||"function"!==typeof b.key)throw Error('ListFacade template must define a "key" function.'); | ||
if(!b||"function"!==typeof b.facade)throw Error('ListFacade template must define a "facade".');}if(this.shouldUpdateChildren()){var g=this._itemsDict||null,l=this._itemsDict=d?Object.create(null):null,f=this._orderedItemKeys;if(d){f.length=a.length;d=0;for(var h=a.length;d<h;d++){var m=a[d],u=b.key(m,d,a),k=b.facade;if("production"!==process.env.NODE_ENV){if(null==u)throw Error('ListFacade template "key" function must return a key.');l[u]&&console.warn("Duplicate key in list: "+u)}for(;l[u];)u+="|dupe"; | ||
var p="function"===typeof b.transition?b.transition(m,d,a):b.transition,n="function"===typeof b.animation?b.animation(m,d,a):b.animation,t="function"===typeof b.exitAnimation?b.exitAnimation(m,d,a):b.exitAnimation;if(p||n||t)k=U(k);t=b.pointerStates;if("function"===t?t(m,d,a):t)k=V(k);(t=g&&g[u])&&t.constructor===k?k=t:(t&&t.destructor(),k=new k(this));k.transition=p;k.animation=n;for(var r in b)b.hasOwnProperty(r)&&!c.isSpecialDescriptorProperty(r)&&(k[r]="function"===typeof b[r]?b[r](m,d,a):b[r]); | ||
k.afterUpdate();l[u]=k;f[d]=u}}if(g)for(var q in g)l&&l[q]||g[q].destructor()}c.prototype.afterUpdate.call(this)};a.prototype.shouldUpdateChildren=function(){return!0};a.prototype.traverse=function(a,b){a.call(b,this);for(var d=this._orderedItemKeys,c=this._itemsDict,e=0,f=d.length;e<f;e++)c[d[e]].traverse(a,b)};a.prototype.forEachChild=function(a,b){for(var d=this._orderedItemKeys,c=this._itemsDict,e=0,f=d.length;e<f;e++)a.call(b,c[d[e]],d[e])};a.prototype.destructor=function(){this.isDestroying= | ||
!0;var a=this._itemsDict;if(a)for(var b in a)a[b].destructor();c.prototype.destructor.call(this)};return a}(p),W=[null],M=function(c){function a(a){c.call(this,a);this.children=null;this._orderedChildKeys=[]}c&&(a.__proto__=c);a.prototype=Object.create(c&&c.prototype);a.prototype.constructor=a;a.prototype.afterUpdate=function(){this.shouldUpdateChildren()&&this.updateChildren(this.describeChildren());c.prototype.afterUpdate.call(this)};a.prototype.describeChildren=function(){return this.children}; | ||
a.prototype.shouldUpdateChildren=function(){return!0};a.prototype.updateChildren=function(a){var b=this._childrenDict||null,d=this._childrenDict=null,e=this._orderedChildKeys;e.length=0;if(a){Array.isArray(a)||(W[0]=a,a=W);for(var l=0,f=a.length;l<f;l++){var h=a[l];if(h){d||(d=this._childrenDict=Object.create(null));var m=S(h),k=m?h.props:h;m=m?h.type:h.facade;h=h.key;if(!h){var p=0;do h="auto:"+m.name+":"+p++;while(d[h])}if("production"!==process.env.NODE_ENV&&"function"!==typeof m)throw Error('All scene objects must have a "facade" property pointing to a class/constructor'); | ||
if(d[h])for(console.warn("Duplicate key in children: "+h);d[h];)h+="|dupe";p=k.transition;var q=k.animation;if(p||q||k.exitAnimation)m=U(m);k.pointerStates&&(m=V(m));var n=b&&b[h];n&&n.constructor===m?m=n:(n&&n.destructor(),m=new m(this));m.transition=p;m.animation=q;for(var t in k)k.hasOwnProperty(t)&&!c.isSpecialDescriptorProperty(t)&&(m[t]=k[t]);d[h]=m;e.push(h);m.afterUpdate()}}}if(b)for(var r in b)d&&d[r]||b[r].destructor()};a.prototype.getChildByKey=function(a){var b=this._childrenDict;return b&& | ||
b[a]||null};a.prototype.traverse=function(a,b){a.call(b,this);for(var d=this._orderedChildKeys,c=this._childrenDict,e=0,f=d.length;e<f;e++)c[d[e]].traverse(a,b)};a.prototype.forEachChild=function(a,b){for(var d=this._orderedChildKeys,c=this._childrenDict,e=0,f=d.length;e<f;e++)a.call(b,c[d[e]],d[e])};a.prototype.destructor=function(){this.isDestroying=!0;var a=this._childrenDict;if(a)for(var b in a)a[b].destructor();c.prototype.destructor.call(this)};return a}(p),y="onMouseOver onMouseOut onMouseMove onDragStart onDrag onDragEnter onDragOver onDragLeave".split(" "), | ||
E="onMouseDown onMouseUp onClick onDoubleClick onDrop onDragEnd onWheel".split(" "),X=E.map(G),Y=y.map(G);y=y.concat(E);var Z=Y.concat(X),N=function(c){function a(){c.apply(this,arguments)}c&&(a.__proto__=c);a.prototype=Object.create(c&&c.prototype);a.prototype.constructor=a;a.prototype.interceptsPointerEvents=function(a){if(!1===this.pointerEvents)return!1;if(this.pointerEvents)return!0;for(var b=0,d=Z.length;b<d;b++)if(a.hasFacadeListenersOfType(this,Z[b]))return!0};return a}(M);Object.defineProperty(N.prototype, | ||
"isPointerEventTarget",{value:!0});y.forEach(function(c){p.defineEventProperty(N,c,G(c))});var ka={},la=["mousemove","mouseout","touchmove"],ma="mousedown mouseup click dblclick wheel touchstart touchend touchcancel".split(" "),aa=["mouseup","touchend","touchcancel"],na={touchstart:"mousedown",touchend:"mouseup",touchcancel:"mouseup"},oa="clientX clientY screenX screenY pageX pageY".split(" "),B=function(c,a,e,b,d){var g=this,l;for(l in c)"function"!==typeof c[l]&&(this[l]=c[l]);this.target=e;this.relatedTarget= | ||
b;this.type=a;this.nativeEvent=c;x(this,d);if(c.touches){var f=H(c)?c.changedTouches:c.touches;1===f.length&&oa.forEach(function(b){g[b]=f[0][b]})}};B.prototype.preventDefault=function(){this.defaultPrevented=!0;this.nativeEvent.preventDefault()};B.prototype.stopPropagation=function(){this.propagationStopped=!0;this.nativeEvent.stopPropagation()};y=function(c){function a(b){c.call(this,null);this.width=this.height=1;this._element=b;this._htmlOverlays=Object.create(null);this.eventRegistry=new ea; | ||
this._onPointerMotionEvent=this._onPointerMotionEvent.bind(this);this._onPointerActionEvent=this._onPointerActionEvent.bind(this);this._onDropEvent=this._onDropEvent.bind(this);this._togglePointerListeners(!0)}c&&(a.__proto__=c);a.prototype=Object.create(c&&c.prototype);a.prototype.constructor=a;var e={renderingScheduler:{configurable:!0}};a.prototype.afterUpdate=function(){this._queueRender();c.prototype.afterUpdate.call(this)};a.prototype.onNotifyWorld=function(b,a,c){(a=this._notifyWorldHandlers[a])&& | ||
a.call(this,b,c)};a.prototype._isContinuousRender=function(){return this.continuousRender};e.renderingScheduler.set=function(b){b=b||window;if(b!==this.renderingScheduler){var a=this._nextFrameTimer;a&&(this.renderingScheduler.cancelAnimationFrame(a),this._nextFrameTimer=null);this._renderingScheduler=b}};e.renderingScheduler.get=function(){return this._renderingScheduler||window};a.prototype._queueRender=function(){var b=this;if(!this._nextFrameTimer){var a=this._nextFrameHandler||(this._nextFrameHandler= | ||
function(){for(var a=[],d=arguments.length;d--;)a[d]=arguments[d];d=b.onStatsUpdate;var c=b.onBeforeRender,e=b.onAfterRender,k=d&&Date.now();c&&c(b);b.doRender.apply(b,a);d&&(a=Date.now(),d({"Render CPU Time (ms)":a-k,"Time Between Frames (ms)":b._lastFrameTime?a-b._lastFrameTime:"?",FPS:b._lastFrameTime?Math.round(1E3/(a-b._lastFrameTime)):"?"}),b._lastFrameTime=a);b._doRenderHtmlItems();e&&e(b);b._nextFrameTimer=null;b._isContinuousRender()&&b._queueRender()});this._nextFrameTimer=this.renderingScheduler.requestAnimationFrame(a)}}; | ||
a.prototype.doRender=function(){};a.prototype.getFacadeUserSpaceXYZ=function(b){};a.prototype._doRenderHtmlItems=function(){if(this.renderHtmlItems){var b=[],a=this._htmlOverlays,c;for(c in a){var e=a[c],f=this.getFacadeUserSpaceXYZ(e);0<=f.z&&(f.key=e.$facadeId,f.html=e.html,f.exact=e.exact,b.push(f))}this.renderHtmlItems(b)}};a.prototype._normalizePointerEvent=function(b){};a.prototype._onPointerMotionEvent=function(b){this._normalizePointerEvent(b);var a=this._getPointerEventState(b);if(Z.some(this.eventRegistry.hasAnyListenersOfType)){var c= | ||
"mouseout"===b.type||I(b)?null:this._findHoverTarget(b),e=a.hoveredFacade,f=a.hoveredFacade=c&&c.facade,h=a.dragInfo;h&&(h.dragStartFired||(this._firePointerEvent("dragstart",h.dragStartEvent,h.draggedFacade,null,c),h.dragStartFired=!0),this._firePointerEvent("drag",b,h.draggedFacade,null,c));f!==e&&(e&&(this._firePointerEvent("mouseout",b,e,f,c),h&&this._firePointerEvent("dragleave",b,e,f,c)),f&&(this._firePointerEvent("mouseover",b,f,e,c),h&&this._firePointerEvent("dragenter",b,f,e,c)));f&&(this._firePointerEvent("mousemove", | ||
b,f,null,c),h&&this._firePointerEvent("dragover",b,f,null,c))}(c=a.tapInfo)&&"touchmove"===b.type&&(b=b.changedTouches[0])&&10<Math.sqrt(Math.pow(b.clientX-c.x,2)+Math.pow(b.clientY-c.y,2))&&(a.tapInfo=null)};a.prototype._onPointerActionEvent=function(b){this._normalizePointerEvent(b);-1<ba.indexOf(b.type)&&this._onDropEvent(b);"touchstart"===b.type&&(1===b.touches.length&&this._onPointerMotionEvent(b),this._enableContextMenu(!1));var a=this.eventRegistry;if(a.hasAnyListenersOfType("dragstart")|| | ||
Y.some(a.hasAnyListenersOfType)){var c=this._findHoverTarget(b),e=c&&c.facade;if(e){var f=this._getPointerEventState(b);this._firePointerEvent(oa[b.type]||b.type,b,e,null,c);if(a.findBubblingEventTarget(e,"click")||a.findBubblingEventTarget(e,"dblclick")){var h=f.tapInfo;"touchstart"===b.type&&1===b.touches.length?f.tapInfo={facade:e,x:b.touches[0].clientX,y:b.touches[0].clientY,startTime:Date.now(),isDblClick:h&&300>Date.now()-h.startTime}:h&&h.facade===e&&"touchend"===b.type&&0===b.touches.length&& | ||
1===b.changedTouches.length&&300>Date.now()-h.startTime&&(this._firePointerEvent("click",b,e,null,c),h.isDblClick&&this._firePointerEvent("dblclick",b,e,null,c))}if("mousedown"===b.type||"touchstart"===b.type)if(a=a.findBubblingEventTarget(e,"dragstart"))c=new B(b,"dragstart",a,null,{intersection:c}),f.dragInfo={draggedFacade:a,dragStartFired:!1,dragStartEvent:c},this._toggleDropListeners(!0)}b.preventDefault()}I(b)&&(1===b.changedTouches.length&&this._onPointerMotionEvent(b),this._enableContextMenu(!0))}; | ||
a.prototype.doRender=function(){};a.prototype.getFacadeUserSpaceXYZ=function(b){};a.prototype._doRenderHtmlItems=function(){if(this.renderHtmlItems){var b=[],a=this._htmlOverlays,c;for(c in a){var e=a[c],f=this.getFacadeUserSpaceXYZ(e);0<=f.z&&(f.key=e.$facadeId,f.html=e.html,f.exact=e.exact,b.push(f))}this.renderHtmlItems(b)}};a.prototype._normalizePointerEvent=function(b){};a.prototype._onPointerMotionEvent=function(b){this._normalizePointerEvent(b);var a=this._getPointerEventState(b);if(Y.some(this.eventRegistry.hasAnyListenersOfType)){var c= | ||
"mouseout"===b.type||H(b)?null:this._findHoverTarget(b),e=a.hoveredFacade,f=a.hoveredFacade=c&&c.facade,h=a.dragInfo;h&&(h.dragStartFired||(this._firePointerEvent("dragstart",h.dragStartEvent,h.draggedFacade,null,c),h.dragStartFired=!0),this._firePointerEvent("drag",b,h.draggedFacade,null,c));f!==e&&(e&&(this._firePointerEvent("mouseout",b,e,f,c),h&&this._firePointerEvent("dragleave",b,e,f,c)),f&&(this._firePointerEvent("mouseover",b,f,e,c),h&&this._firePointerEvent("dragenter",b,f,e,c)));f&&(this._firePointerEvent("mousemove", | ||
b,f,null,c),h&&this._firePointerEvent("dragover",b,f,null,c))}(c=a.tapInfo)&&"touchmove"===b.type&&(b=b.changedTouches[0])&&10<Math.sqrt(Math.pow(b.clientX-c.x,2)+Math.pow(b.clientY-c.y,2))&&(a.tapInfo=null)};a.prototype._onPointerActionEvent=function(b){this._normalizePointerEvent(b);-1<aa.indexOf(b.type)&&this._onDropEvent(b);"touchstart"===b.type&&(1===b.touches.length&&this._onPointerMotionEvent(b),this._enableContextMenu(!1));var a=this.eventRegistry;if(a.hasAnyListenersOfType("dragstart")|| | ||
X.some(a.hasAnyListenersOfType)){var c=this._findHoverTarget(b),e=c&&c.facade;if(e){var f=this._getPointerEventState(b);this._firePointerEvent(na[b.type]||b.type,b,e,null,c);if(a.findBubblingEventTarget(e,"click")||a.findBubblingEventTarget(e,"dblclick")){var h=f.tapInfo;"touchstart"===b.type&&1===b.touches.length?f.tapInfo={facade:e,x:b.touches[0].clientX,y:b.touches[0].clientY,startTime:Date.now(),isDblClick:h&&300>Date.now()-h.startTime}:h&&h.facade===e&&"touchend"===b.type&&0===b.touches.length&& | ||
1===b.changedTouches.length&&300>Date.now()-h.startTime&&(this._firePointerEvent("click",b,e,null,c),h.isDblClick&&this._firePointerEvent("dblclick",b,e,null,c))}if("mousedown"===b.type||"touchstart"===b.type)if(a=a.findBubblingEventTarget(e,"dragstart"))c=new B(b,"dragstart",a,null,{intersection:c}),f.dragInfo={draggedFacade:a,dragStartFired:!1,dragStartEvent:c},this._toggleDropListeners(!0)}b.preventDefault()}H(b)&&(1===b.changedTouches.length&&this._onPointerMotionEvent(b),this._enableContextMenu(!0))}; | ||
a.prototype._onDropEvent=function(b){var a=this._getPointerEventState(b),c=a.dragInfo;if(c){this._normalizePointerEvent(b);var e=this._findHoverTarget(b),f=e&&e.facade;f&&this._firePointerEvent("drop",b,f,null,e);this._firePointerEvent("dragend",b,c.draggedFacade,null,e);this._toggleDropListeners(!1);a.dragInfo=null}};a.prototype._firePointerEvent=function(b,a,c,e,f){b=a instanceof B?a:new B(a,b,c,e,{bubbles:!0,intersection:f});this.eventRegistry.dispatchEventOnFacade(c,b)};a.prototype._getPointerEventState= | ||
function(b){var a=this._pointerEventStates||(this._pointerEventStates=new WeakMap);b=b.eventSource||la;var c=a.get(b);c||a.set(b,c={});return c};a.prototype._toggleDropListeners=function(b){var a=this;ba.forEach(function(c){document[(b?"add":"remove")+"EventListener"](c,a._onDropEvent,!0)})};a.prototype._togglePointerListeners=function(b){var a=this,c=this._element;if(c&&b!==this._pointerListenersAttached){var e=(b?"add":"remove")+"EventListener";ma.forEach(function(b){c[e](b,a._onPointerMotionEvent, | ||
!1)});na.forEach(function(b){c[e](b,a._onPointerActionEvent,!1)});this._pointerListenersAttached=b}};a.prototype._enableContextMenu=function(b){var a=this._element;if(a)a[(b?"remove":"add")+"EventListener"]("contextmenu",ha,!0)};a.prototype.getFacadesAtEvent=function(b,a){throw Error("getFacadesAtEvent: no impl");};a.prototype._findHoverTarget=function(b){var a=this;if(b.touches&&1<b.touches.length)return null;if(b=this.getFacadesAtEvent(b,function(b){return b.isPointerEventTarget&&b.interceptsPointerEvents(a.eventRegistry)})){for(var c= | ||
function(b){var a=this._pointerEventStates||(this._pointerEventStates=new WeakMap);b=b.eventSource||ka;var c=a.get(b);c||a.set(b,c={});return c};a.prototype._toggleDropListeners=function(b){var a=this;aa.forEach(function(c){document[(b?"add":"remove")+"EventListener"](c,a._onDropEvent,!0)})};a.prototype._togglePointerListeners=function(b){var a=this,c=this._element;if(c&&b!==this._pointerListenersAttached){var e=(b?"add":"remove")+"EventListener";la.forEach(function(b){c[e](b,a._onPointerMotionEvent, | ||
!1)});ma.forEach(function(b){c[e](b,a._onPointerActionEvent,!1)});this._pointerListenersAttached=b}};a.prototype._enableContextMenu=function(b){var a=this._element;if(a)a[(b?"remove":"add")+"EventListener"]("contextmenu",fa,!0)};a.prototype.getFacadesAtEvent=function(b,a){throw Error("getFacadesAtEvent: no impl");};a.prototype._findHoverTarget=function(b){var a=this;if(b.touches&&1<b.touches.length)return null;if(b=this.getFacadesAtEvent(b,function(b){return b.isPointerEventTarget&&b.interceptsPointerEvents(a.eventRegistry)})){for(var c= | ||
b[0],e=1;e<b.length;e++)if(b[e].distance<c.distance||b[e].distance===c.distance&&(b[e].distanceBias||0)<(c.distanceBias||0))c=b[e];return c}return null};a.prototype.destructor=function(){this._nextFrameTimer&&this.renderingScheduler.cancelAnimationFrame(this._nextFrameTimer);this._togglePointerListeners(!1);this._toggleDropListeners(!1);c.prototype.destructor.call(this)};Object.defineProperties(a.prototype,e);return a}(M);Object.defineProperty(y.prototype,"isWorld",{value:!0});y.prototype._notifyWorldHandlers= | ||
{needsRender:function(){this._queueRender()},addEventListener:function(c,a){this.eventRegistry.addListenerForFacade(c,a.type,a.handler)},removeEventListener:function(c,a){this.eventRegistry.removeListenerForFacade(c,a.type,a.handler)},removeAllEventListeners:function(c){this.eventRegistry.removeAllListenersForFacade(c)},dispatchEvent:function(c,a){a instanceof B||(a=new B(a,a.type,a.target,a.relatedTarget));this.eventRegistry.dispatchEventOnFacade(c,a)},addHtmlOverlay:function(c){this._htmlOverlays[c.$facadeId]= | ||
c},removeHtmlOverlay:function(c){delete this._htmlOverlays[c.$facadeId]},statsUpdate:function(c,a){(c=this.onStatsUpdate)&&c(a)}};var qa={position:"absolute",top:0,right:0,bottom:0,left:0,pointerEvents:"none",transformStyle:"preserve-3d"},O=function(c){function a(){c.apply(this,arguments)}c&&(a.__proto__=c);a.prototype=Object.create(c&&c.prototype);a.prototype.constructor=a;a.prototype.shouldComponentUpdate=function(a){return a.html!==this.props.html||!0===(a.html.props&&a.html.props.shouldUpdateOnMove)}; | ||
a.prototype.render=function(){var a=this.props.html;return"string"===typeof a?r["default"].createElement("span",null,a):r["default"].cloneElement(a)};return a}(r["default"].Component);O.displayName="Canvas3D.HtmlOverlayContent";O.propTypes={html:u["default"].node};var ca=function(c){function a(a){c.call(this,a);this.setItems=this.setItems.bind(this);this.state={items:null}}c&&(a.__proto__=c);a.prototype=Object.create(c&&c.prototype);a.prototype.constructor=a;a.prototype.shouldComponentUpdate=function(a, | ||
b){a=this.state;return b.items&&b.items.length||a.items&&a.items.length};a.prototype.setItems=function(a){var b=this.state.items;(a&&a.length||b&&b.length)&&this.setState({items:a||null})};a.prototype.render=function(){var a=this.state.items,b=Math.round;return a&&a.length?r["default"].createElement("div",{className:"troika_html_overlay",style:qa},a.map(function(a){var c=a.key,d=a.html,e=a.x,h=a.y,k=a.z;a.exact||(e=b(e),h=b(h));return r["default"].createElement("div",{key:c,style:{position:"absolute", | ||
transform:"translate3d("+e+"px, "+h+"px, "+-k+"px)"}},r["default"].createElement(O,{html:d}))})):null};return a}(r["default"].Component);ca.displayName="Canvas3D.HtmlOverlay";var ra={position:"absolute",top:0,right:0,background:"rgba(0,0,0,.5)",font:"11px sans-serif",padding:10},sa=function(c){function a(a){c.call(this,a);this.state={stats:{}}}c&&(a.__proto__=c);a.prototype=Object.create(c&&c.prototype);a.prototype.constructor=a;a.prototype.setStats=function(a){this.setState({stats:a})};a.prototype.render= | ||
function(){var a=this.state.stats;return r["default"].createElement("div",{style:ra},Object.keys(a).sort().map(function(b){return r["default"].createElement("div",{key:b},b+": "+a[b])}))};return a}(r["default"].Component),ta={width:"100%",height:"100%"};A=function(c){function a(a){c.call(this,a);this._stats={};this.updateStats=this.updateStats.bind(this);this.renderHtmlItems=this.renderHtmlItems.bind(this);this._bindHtmlOverlayRef=this._bindHtmlOverlayRef.bind(this);this._bindCanvasRef=this._bindCanvasRef.bind(this); | ||
this._bindStatsRef=this._bindStatsRef.bind(this)}c&&(a.__proto__=c);a.prototype=Object.create(c&&c.prototype);a.prototype.constructor=a;a.prototype.componentDidUpdate=function(){this.updateWorld()};a.prototype.initWorld=function(a){a=new this.props.worldFacade(a);a.renderHtmlItems=this.renderHtmlItems;return a};a.prototype.updateWorld=function(){var a=this._world;if(a){var b=this.props,c=b.stats,k=c&&Date.now();a.width=b.width;a.height=b.height;a.pixelRatio=b.pixelRatio;a.continuousRender=b.continuousRender; | ||
a.onStatsUpdate=c?this.updateStats:null;x(a,b.worldProps);a.afterUpdate();c&&this.updateStats({"Last World Update (ms)":Date.now()-k})}};a.prototype.destroyWorld=function(){this._world&&(this._world.destructor(),delete this._world);clearTimeout(this._statsDelay)};a.prototype.renderHtmlItems=function(a){this._htmlOverlayRef&&this._htmlOverlayRef.setItems(a)};a.prototype.updateStats=function(a){var b=this;this._stats=x({},this._stats,a);this._statsDelay||(this._statsDelay=setTimeout(function(){b._statsDelay= | ||
null;var a=b._statsRef;a&&a.setStats(b._stats)},250))};a.prototype._bindHtmlOverlayRef=function(a){this._htmlOverlayRef=a};a.prototype._bindCanvasRef=function(a){if(a)try{this._world=this.initWorld(a),this.updateWorld()}catch(d){console.warn("Troika."+this.constructor.displayName+": world init failed, using fallback content.",d),this._failedWorldInit=!0,this._world=null,this.forceUpdate()}else this.destroyWorld();var b=this.props.onCanvasRef;b&&b(a)};a.prototype._bindStatsRef=function(a){this._statsRef= | ||
a};a.prototype.render=function(){var a=this.props;return r["default"].createElement("div",{className:"troika "+(a.className||""),style:{position:"relative",overflow:"hidden",width:a.width,height:a.height,cursor:a.cursor,userSelect:"none"}},this._failedWorldInit?this.props.children:r["default"].createElement("canvas",{className:"troika_canvas",ref:this._bindCanvasRef,style:a.canvasStyle||ta}),r["default"].createElement(ca,{ref:this._bindHtmlOverlayRef}),a.stats?r["default"].createElement(sa,{ref:this._bindStatsRef}): | ||
null)};return a}(r["default"].Component);A.commonPropTypes={width:u["default"].number.isRequired,height:u["default"].number.isRequired,pixelRatio:u["default"].number,worldFacade:u["default"].func,worldProps:u["default"].object,canvasStyle:u["default"].object,className:u["default"].string,continuousRender:u["default"].bool,onCanvasRef:u["default"].func,stats:u["default"].bool,cursor:u["default"].string};p.Facade=k;p.ListFacade=ka;p.ParentFacade=M;p.PointerEventTarget=N;p.ReactCanvasBase=A;p.WorldBaseFacade= | ||
y;p.utils=D;Object.defineProperty(p,"__esModule",{value:!0})}) | ||
c},removeHtmlOverlay:function(c){delete this._htmlOverlays[c.$facadeId]},statsUpdate:function(c,a){(c=this.onStatsUpdate)&&c(a)}};var pa={position:"absolute",top:0,right:0,bottom:0,left:0,pointerEvents:"none",transformStyle:"preserve-3d"},O=function(c){function a(){c.apply(this,arguments)}c&&(a.__proto__=c);a.prototype=Object.create(c&&c.prototype);a.prototype.constructor=a;a.prototype.shouldComponentUpdate=function(a){return a.html!==this.props.html||!0===(a.html.props&&a.html.props.shouldUpdateOnMove)}; | ||
a.prototype.render=function(){var a=this.props.html;return"string"===typeof a?k.createElement("span",null,a):k.cloneElement(a)};return a}(k.Component);O.displayName="Canvas3D.HtmlOverlayContent";O.propTypes={html:q.node};var ba=function(c){function a(a){c.call(this,a);this.setItems=this.setItems.bind(this);this.state={items:null}}c&&(a.__proto__=c);a.prototype=Object.create(c&&c.prototype);a.prototype.constructor=a;a.prototype.shouldComponentUpdate=function(a,b){a=this.state;return b.items&&b.items.length|| | ||
a.items&&a.items.length};a.prototype.setItems=function(a){var b=this.state.items;(a&&a.length||b&&b.length)&&this.setState({items:a||null})};a.prototype.render=function(){var a=this.state.items,b=Math.round;return a&&a.length?k.createElement("div",{className:"troika_html_overlay",style:pa},a.map(function(a){var c=a.key,d=a.html,e=a.x,h=a.y,m=a.z;a.exact||(e=b(e),h=b(h));return k.createElement("div",{key:c,style:{position:"absolute",transform:"translate3d("+e+"px, "+h+"px, "+-m+"px)"}},k.createElement(O, | ||
{html:d}))})):null};return a}(k.Component);ba.displayName="Canvas3D.HtmlOverlay";var qa={position:"absolute",top:0,right:0,background:"rgba(0,0,0,.5)",font:"11px sans-serif",padding:10},ra=function(c){function a(a){c.call(this,a);this.state={stats:{}}}c&&(a.__proto__=c);a.prototype=Object.create(c&&c.prototype);a.prototype.constructor=a;a.prototype.setStats=function(a){this.setState({stats:a})};a.prototype.render=function(){var a=this.state.stats;return k.createElement("div",{style:qa},Object.keys(a).sort().map(function(b){return k.createElement("div", | ||
{key:b},b+": "+a[b])}))};return a}(k.Component),sa={width:"100%",height:"100%"};E=function(c){function a(a){c.call(this,a);this._stats={};this.updateStats=this.updateStats.bind(this);this.renderHtmlItems=this.renderHtmlItems.bind(this);this._bindHtmlOverlayRef=this._bindHtmlOverlayRef.bind(this);this._bindCanvasRef=this._bindCanvasRef.bind(this);this._bindStatsRef=this._bindStatsRef.bind(this)}c&&(a.__proto__=c);a.prototype=Object.create(c&&c.prototype);a.prototype.constructor=a;a.prototype.componentDidUpdate= | ||
function(){this.updateWorld()};a.prototype.initWorld=function(a){a=new this.props.worldFacade(a);a.renderHtmlItems=this.renderHtmlItems;return a};a.prototype.updateWorld=function(){var a=this._world;if(a){var b=this.props,c=b.stats,g=c&&Date.now();a.width=b.width;a.height=b.height;a.pixelRatio=b.pixelRatio;a.continuousRender=b.continuousRender;a.onStatsUpdate=c?this.updateStats:null;x(a,b.worldProps);a.afterUpdate();c&&this.updateStats({"Last World Update (ms)":Date.now()-g})}};a.prototype.destroyWorld= | ||
function(){this._world&&(this._world.destructor(),delete this._world);clearTimeout(this._statsDelay)};a.prototype.renderHtmlItems=function(a){this._htmlOverlayRef&&this._htmlOverlayRef.setItems(a)};a.prototype.updateStats=function(a){var b=this;this._stats=x({},this._stats,a);this._statsDelay||(this._statsDelay=setTimeout(function(){b._statsDelay=null;var a=b._statsRef;a&&a.setStats(b._stats)},250))};a.prototype._bindHtmlOverlayRef=function(a){this._htmlOverlayRef=a};a.prototype._bindCanvasRef=function(a){if(a)try{this._world= | ||
this.initWorld(a),this.updateWorld()}catch(d){console.warn("Troika."+this.constructor.displayName+": world init failed, using fallback content.",d),this._failedWorldInit=!0,this._world=null,this.forceUpdate()}else this.destroyWorld();var b=this.props.onCanvasRef;b&&b(a)};a.prototype._bindStatsRef=function(a){this._statsRef=a};a.prototype.render=function(){var a=this.props;return k.createElement("div",{className:"troika "+(a.className||""),style:{position:"relative",overflow:"hidden",width:a.width, | ||
height:a.height,cursor:a.cursor,userSelect:"none"}},this._failedWorldInit?this.props.children:k.createElement("canvas",{className:"troika_canvas",ref:this._bindCanvasRef,style:a.canvasStyle||sa}),k.createElement(ba,{ref:this._bindHtmlOverlayRef}),a.stats?k.createElement(ra,{ref:this._bindStatsRef}):null)};return a}(k.Component);E.commonPropTypes={width:q.number.isRequired,height:q.number.isRequired,pixelRatio:q.number,worldFacade:q.func,worldProps:q.object,canvasStyle:q.object,className:q.string, | ||
continuousRender:q.bool,onCanvasRef:q.func,stats:q.bool,cursor:q.string};v.Facade=p;v.ListFacade=ja;v.ParentFacade=M;v.PointerEventTarget=N;v.ReactCanvasBase=E;v.WorldBaseFacade=y;v.utils=I;Object.defineProperty(v,"__esModule",{value:!0})}) |
{ | ||
"name": "troika-core", | ||
"version": "0.34.0", | ||
"version": "0.35.0", | ||
"description": "Troika Core", | ||
@@ -18,3 +18,3 @@ "author": "Jason Johnston <jason.johnston@protectwise.com>", | ||
"prop-types": "^15.6.2", | ||
"troika-animation": "^0.34.0" | ||
"troika-animation": "^0.35.0" | ||
}, | ||
@@ -25,3 +25,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "b19cd3aff4b0876253d76b3fc66b7e2a1f16a7e5" | ||
"gitHead": "0fc459bec5f330f6f040d07bfe304d10a87d73c0" | ||
} |
@@ -0,0 +0,0 @@ # Troika Framework Core |
import { assignIf, createClassExtender } from '../utils.js' | ||
import { Tween, MultiTween, Runner } from 'troika-animation' | ||
import { Tween, MultiTween, Runner, SpringTween } from 'troika-animation' | ||
@@ -34,14 +34,34 @@ const DEFAULT_DURATION = 750 | ||
* transitionable property names as keys and transition parameters as values. The | ||
* transition parameters can either be `true` for a default transition, or an object | ||
* of the form: | ||
* transition parameters can either be objects describing the transition parameters, | ||
* or `true` for a default transition. | ||
* | ||
* transition: { | ||
* width: true, //uses default parameters | ||
* height: { | ||
* duration: n, //in ms, defaults to 750 | ||
* easing: e, //easing function, defaults to 'easeOutCubic' | ||
* delay: n, //in ms, defaults to 0 | ||
* interpolate: 'number' //one of the named functions in Interpolators.js ('number', 'color', etc.) or a custom Function | ||
* x: true, // uses a default duration-based transition | ||
* y: 'spring', //uses a default spring-based transition | ||
* z: { | ||
* // ...custom transition config | ||
* } | ||
* } | ||
* | ||
* The custom transition config object can take one of two forms for duration- vs. | ||
* spring-based animations: | ||
* | ||
* Duration-based: | ||
* | ||
* { | ||
* duration: n, //in ms, defaults to 750 | ||
* easing: e, //easing function, defaults to 'easeOutCubic' | ||
* delay: n, //in ms, defaults to 0 | ||
* interpolate: 'number' //one of the builtin named interpolators ('number', 'color', etc.) or a custom Function | ||
* } | ||
* | ||
* Spring-based: | ||
* | ||
* { | ||
* spring: s, //either `true`, a named preset string e.g. "wobbly", or an object with {mass, tension, friction} | ||
* delay: n //in ms, defaults to 0 | ||
* } | ||
* | ||
* Note that spring-based transitions do not currently support custom interpolations so they should only be used | ||
* for numeric values. | ||
*/ | ||
@@ -351,2 +371,3 @@ set transition(descriptor) { | ||
transition = transition[propName] | ||
let springConfig = transition === 'spring' ? 'default' : transition.spring | ||
// If there's no active transition tween, or the new value is different than the active tween's | ||
@@ -357,6 +378,12 @@ // target value, initiate a new transition tween. Otherwise ignore it. | ||
if (tween) { | ||
// Active tween - start new one if new value is different than the old tween's target value | ||
// Active tween - start new one if new value is different than the old tween's target | ||
// value, unless they're both springs in which case update the original | ||
if (value !== tween.toValue) { | ||
runner.stop(tween) | ||
needsNewTween = true | ||
if (springConfig && tween.isSpring) { | ||
// TODO allow mid-simulation modification of spring config? | ||
tween.toValue = value | ||
} else { | ||
runner.stop(tween) | ||
needsNewTween = true | ||
} | ||
} | ||
@@ -368,13 +395,25 @@ } else if (value !== this[propName]) { | ||
if (needsNewTween) { | ||
tween = this[activeTweenKey] = new Tween( | ||
actuallySet.bind(this), //callback | ||
this[propName], //fromValue | ||
value, //toValue | ||
transition.duration || DEFAULT_DURATION, //duration | ||
transition.delay || 0, //delay | ||
transition.easing || DEFAULT_EASING, //easing | ||
1, //iterations | ||
'forward', //direction | ||
transition.interpolate || 'number' //interpolate | ||
) | ||
tween = this[activeTweenKey] = springConfig | ||
? new SpringTween( | ||
actuallySet.bind(this), //callback | ||
this[propName], //fromValue | ||
value, //toValue | ||
springConfig, //springConfig (mass, friction, tension) | ||
0, //initialVelocity | ||
transition.delay || 0 //delay | ||
) | ||
: new Tween( | ||
actuallySet.bind(this), //callback | ||
this[propName], //fromValue | ||
value, //toValue | ||
transition.duration || DEFAULT_DURATION, //duration | ||
transition.delay || 0, //delay | ||
transition.easing || DEFAULT_EASING, //easing | ||
1, //iterations | ||
'forward', //direction | ||
transition.interpolate || 'number' //interpolate | ||
) | ||
tween.onDone = () => { | ||
tween = this[activeTweenKey] = null | ||
} | ||
runner.start(tween) | ||
@@ -381,0 +420,0 @@ } |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ import {assign} from '../utils.js' |
@@ -0,0 +0,0 @@ import Facade from './Facade.js' |
@@ -0,0 +0,0 @@ import Facade from './Facade.js' |
@@ -0,0 +0,0 @@ import ParentFacade from './ParentFacade.js' |
@@ -0,0 +0,0 @@ import { assign, createClassExtender } from '../utils.js' |
@@ -0,0 +0,0 @@ import ParentFacade from './ParentFacade.js' |
@@ -0,0 +0,0 @@ // Troika core exports |
@@ -0,0 +0,0 @@ import React from 'react' |
@@ -0,0 +0,0 @@ import React from 'react' |
@@ -0,0 +0,0 @@ import React from 'react' |
@@ -0,0 +0,0 @@ ///// Miscellaneous Utility Functions ///// |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
7681
329688
+ Addedtroika-animation@0.35.0(transitive)
- Removedtroika-animation@0.34.0(transitive)
Updatedtroika-animation@^0.35.0