troika-core
Advanced tools
Comparing version 0.17.0 to 0.17.1
@@ -27,4 +27,4 @@ 'use strict';(function(u,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):(u=u||self,A(u.troika_core={},u.troika_animation,u.React,u.PropTypes))})(this,function(u,A,h,p){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 k in d)d.hasOwnProperty(k)&&(a[k]=d[k])}return a} | ||
v.afterUpdate();l[h]=v;f[d]=h}}if(k)for(var q in k)l&&l[q]||k[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}(q),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.children);c.prototype.afterUpdate.call(this)};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 g=a[l];if(g){d||(d=this._childrenDict=Object.create(null));var m=S(g),h=m?g.props:g;m=m?g.type:g.facade;g=g.key;if(!g){var p=0;do g="auto:"+m.name+":"+p++;while(d[g])}if("production"!==process.env.NODE_ENV&&"function"!==typeof m)throw Error('All scene objects must have a "facade" property pointing to a class/constructor'); | ||
!0;var a=this._itemsDict;if(a)for(var b in a)a[b].destructor();c.prototype.destructor.call(this)};return a}(q),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 g=a[l];if(g){d||(d=this._childrenDict=Object.create(null));var m=S(g),h=m?g.props:g;m=m?g.type:g.facade;g=g.key;if(!g){var p=0;do g="auto:"+m.name+":"+p++;while(d[g])}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[g])for(console.warn("Duplicate key in children: "+g);d[g];)g+="|dupe";p=h.transition;var q=h.animation;if(p||q||h.exitAnimation)m=U(m);h.pointerStates&&(m=V(m));var n=b&&b[g];n&&n.constructor===m?m=n:(n&&n.destructor(),m=new m(this));m.transition=p;m.animation=q;for(var t in h)h.hasOwnProperty(t)&&!c.isSpecialDescriptorProperty(t)&&(m[t]=h[t]);d[g]=m;e.push(g);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&& | ||
@@ -31,0 +31,0 @@ 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}(q),x="onMouseOver onMouseOut onMouseMove onDragStart onDrag onDragEnter onDragOver onDragLeave".split(" "), |
{ | ||
"name": "troika-core", | ||
"version": "0.17.0", | ||
"version": "0.17.1", | ||
"description": "Troika Core", | ||
@@ -16,6 +16,6 @@ "author": "Jason Johnston <jason.johnston@protectwise.com>", | ||
"module": "dist/troika-core.esm.js", | ||
"module:es2015": "src/index.js", | ||
"module:src": "src/index.js", | ||
"dependencies": { | ||
"prop-types": "^15.6.2", | ||
"troika-animation": "^0.17.0" | ||
"troika-animation": "^0.17.1" | ||
}, | ||
@@ -26,3 +26,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "31909f4beed23f5913aa380db1dd3c1802798b39" | ||
"gitHead": "0708fdbb59d0073095124b1ac669bbe84fc640e9" | ||
} |
@@ -9,2 +9,11 @@ import Facade from './Facade.js' | ||
/** | ||
* @typedef {object} FacadeDescriptor | ||
* An object describing the type and properties of a child facade to be created and managed by | ||
* its parent. See the detailed description in the docs for {@link Facade.js}. | ||
* @property {class} facade | ||
* @property {string|number} [key] | ||
*/ | ||
/** | ||
* Base facade class for objects that have `children`. Manages creating and destroying child | ||
@@ -20,3 +29,9 @@ * facade instances as needed as its `children` array changes. | ||
super(parent) | ||
/** | ||
* @member {FacadeDescriptor | Array<FacadeDescriptor>} children | ||
* Descriptors for one or more child facades. | ||
*/ | ||
this.children = null | ||
this._orderedChildKeys = [] | ||
@@ -27,3 +42,3 @@ } | ||
if (this.shouldUpdateChildren()) { | ||
this.updateChildren(this.children) | ||
this.updateChildren(this.describeChildren()) | ||
} | ||
@@ -34,2 +49,15 @@ super.afterUpdate() | ||
/** | ||
* Return the descriptor(s) for the actual children to be created and managed. By default | ||
* this simply returns the value of the `children` property set by the parent, but you can | ||
* override it to customize how the child content should be structured, for instance to wrap | ||
* the `children` within a deeper structure, add in anonymous child siblings, or modify the | ||
* `children` configurations. | ||
* @protected | ||
* @return {FacadeDescriptor | Array<FacadeDescriptor>} | ||
*/ | ||
describeChildren() { | ||
return this.children | ||
} | ||
/** | ||
* Override to selectively prevent traversing to child nodes on `afterUpdate`, for | ||
@@ -36,0 +64,0 @@ * potential performance gain. |
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
316237
7435
Updatedtroika-animation@^0.17.1