Socket
Socket
Sign inDemoInstall

hecs

Package Overview
Dependencies
0
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.8.0 to 0.8.1

2

dist/hecs.js

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.hecs=e():t.HECS=e()}(this,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){"use strict";(function(t){n.d(e,"a",(function(){return r})),n.d(e,"c",(function(){return i})),n.d(e,"e",(function(){return o})),n.d(e,"d",(function(){return s})),n.d(e,"b",(function(){return a}));var r={name:"Boolean",initial:function(t){return t||!1},toJSON:function(t){return t},fromJSON:function(t,e){return t||!1}},i={name:"Number",initial:function(t){return t||0},toJSON:function(t){return t},fromJSON:function(t,e){return t||0}},o={name:"String",initial:function(t){return t||""},toJSON:function(t){return t},fromJSON:function(t,e){return t||""}},s={name:"Ref",initial:function(t){return t||null},toJSON:function(t){return null},fromJSON:function(t,e){return t||null}},c="undefined"==typeof window?t.JSON:window.JSON,a={name:"JSON",initial:function(t){return t?c.parse(c.stringify(t)):null},toJSON:function(t){return t&&c.stringify(t)},fromJSON:function(t,e){return t&&c.parse(t)}}}).call(this,n(1))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}n.r(e),n.d(e,"World",(function(){return B})),n.d(e,"System",(function(){return F})),n.d(e,"Component",(function(){return y})),n.d(e,"LocalComponent",(function(){return K})),n.d(e,"StateComponent",(function(){return O})),n.d(e,"BooleanType",(function(){return Q.a})),n.d(e,"NumberType",(function(){return Q.c})),n.d(e,"StringType",(function(){return Q.e})),n.d(e,"RefType",(function(){return Q.d})),n.d(e,"JSONType",(function(){return Q.b})),n.d(e,"Groups",(function(){return q})),n.d(e,"Not",(function(){return V})),n.d(e,"Modified",(function(){return X})),n.d(e,"createPlugin",(function(){return T}));var i=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.world=e,this.Systems=new Map,this.systems=[],this.systemsByName={},this.tick=0}var e,n,i;return e=t,(n=[{key:"register",value:function(t){if(!this.Systems.has(t)){var e=new t(this.world);this.Systems.set(t,e);for(var n=0,r=0;r<this.systems.length&&!(this.systems[r].order>e.order);r++)n=r+1;return this.systems.splice(n,0,e),this.systemsByName[t.name]=e,this}console.warn("hecs: already registered system '".concat(t.name,"'"))}},{key:"init",value:function(){for(var t=0;t<this.systems.length;t++)this.systems[t].init(this.world)}},{key:"get",value:function(t){return this.Systems.get(t)}},{key:"getByName",value:function(t){return this.systemsByName[t]}},{key:"update",value:function(t){for(var e=0;e<this.systems.length;e++){this.tick++;var n=this.systems[e];n.active&&n.update(t)}}},{key:"reset",value:function(){this.systems.forEach((function(t){t.reset()}))}}])&&r(e.prototype,n),i&&r(e,i),t}();function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var s=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.world=e,this.Components=n,this.Modified=[],this.archetypes=[];for(var r=0;r<n.length;r++){var i=n[r];i.isModified&&this.Modified.push(i.Component)}for(var o in this.world.archetypes.archetypes){var s=this.world.archetypes.archetypes[o];this.matchesArchetype(s)&&this.archetypes.push(s)}}var e,n,r;return e=t,(n=[{key:"isModified",value:function(t){for(var e=0;e<this.Modified.length;e++){var n=this.Modified[e];if(t.get(n).modifiedUntilSystemTick>=this.world.systems.tick)return!0}return!1}},{key:"forEach",value:function(t){this.Modified.length?this._forEachModified(t):this._forEach(t)}},{key:"_forEachModified",value:function(t){for(var e=this.archetypes.length-1;e>=0;--e)for(var n=this.archetypes[e].entities,r=n.length-1;r>=0;--r){var i=n[r];this.isModified(i)&&t(i)}}},{key:"_forEach",value:function(t){for(var e=this.archetypes.length-1;e>=0;--e)for(var n=this.archetypes[e].entities,r=n.length-1;r>=0;--r)t(n[r])}},{key:"count",value:function(){var t=0;return this.forEach((function(){return function(t){throw new Error('"'+t+'" is read-only')}("count"),t++})),t}},{key:"onArchetypeCreated",value:function(t){this.matchesArchetype(t)&&this.archetypes.push(t)}},{key:"matchesArchetype",value:function(t){for(var e=!0,n=0;n<this.Components.length;n++){var r=this.Components[n],i=r.isNot,o=r.isModified;if((i||o)&&(r=r.Component),i){if(-1!==t.Components.indexOf(r)){e=!1;break}}else if(-1===t.Components.indexOf(r)){e=!1;break}}e&&this.archetypes.push(t)}}])&&o(e.prototype,n),r&&o(e,r),t}();function c(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var a=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.world=e,this.queries=[]}var e,n,r;return e=t,(n=[{key:"create",value:function(t){var e=new s(this.world,t);return this.queries.push(e),e}},{key:"onArchetypeCreated",value:function(t){for(var e=0;e<this.queries.length;e++)this.queries[e].onArchetypeCreated(t)}}])&&c(e.prototype,n),r&&c(e,r),t}();var u=function t(e,n,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.world=e,this.id=n,this.Components=r,this.entities=[]};function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var h=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.world=e,this.archetypes={},this.initialId=null}var e,n,r;return e=t,(n=[{key:"init",value:function(){this.initialId="";for(var t=this.world.components.count;t;)this.initialId+="0",t--;console.log("hecs: using ".concat(this.world.components.count," bit archetype ids")),this.createArchetype(this.initialId,[])}},{key:"onEntityActive",value:function(t){this.addToArchetype(t)}},{key:"onEntityComponentChange",value:function(t,e,n){t.active&&this.removeFromArchetype(t),t.archetypeId=t.archetypeId.substring(0,e.id)+(n?"1":"0")+t.archetypeId.substring(e.id+1),this.archetypes[t.archetypeId]||this.createArchetype(t.archetypeId,t.Components),t.active&&this.addToArchetype(t)}},{key:"onEntityInactive",value:function(t){this.removeFromArchetype(t)}},{key:"addToArchetype",value:function(t){var e=this.archetypes[t.archetypeId];-1===e.entities.indexOf(t)&&e.entities.push(t)}},{key:"removeFromArchetype",value:function(t){var e=this.archetypes[t.archetypeId].entities,n=e.indexOf(t);-1!==n&&e.splice(n,1)}},{key:"createArchetype",value:function(t,e){e=e.slice();var n=new u(this.world,t,e);return this.archetypes[n.id]=n,this.world.queries.onArchetypeCreated(n),n}}])&&f(e.prototype,n),r&&f(e,r),t}();function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function p(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var y=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(var r in l(this,t),this.world=e,this.name=this.constructor.name,this.props=[],this.modifiedUntilSystemTick=0,this.constructor.props){var i=this.constructor.props[r],o=n[r];i.type||(i={type:i},this.constructor.props[r]=i),this[r]=i.type.initial(void 0===o?i.default:o),this.props.push(i)}}var e,n,r;return e=t,(n=[{key:"toJSON",value:function(){var t={};for(var e in this.constructor.props){var n=this.constructor.props[e],r=n.type||n;t[e]=r.toJSON(this[e])}return t}},{key:"fromJSON",value:function(t){for(var e in this.constructor.props){var n=this.constructor.props[e],r=n.type||n;void 0!==t[e]&&(this[e]=r.fromJSON(t[e],this[e]))}return this}},{key:"modified",value:function(){this.modifiedUntilSystemTick=this.world.systems.tick+this.world.systems.systems.length}}])&&p(e.prototype,n),r&&p(e,r),t}();function d(t){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function v(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function m(t,e){return(m=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function b(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=g(t);if(e){var i=g(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return w(this,n)}}function w(t,e){return!e||"object"!==d(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function g(t){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}y.props={},y.isComponent=!0;var O=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&m(t,e)}(n,t);var e=b(n);function n(){return v(this,n),e.apply(this,arguments)}return n}(y);function k(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function C(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?k(Object(n),!0).forEach((function(e){E(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):k(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function E(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function S(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}O.isStateComponent=!0;var j=function(){function t(e,n,r,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.world=e,this.id=r,this.name=n||null,this.meta=i||{},this.Components=[],this.components=new Map,this.inactiveComponents=[],this.archetypeId=e.archetypes.initialId,this.active=!1}var e,n,r;return e=t,(n=[{key:"add",value:function(t,e,n){var r;t.isComponent?r=new t(this.world,e):(r=t,t=t.constructor);var i=this.components.has(t);return this.components.set(t,r),i||(this.Components.push(t),this.world.archetypes.onEntityComponentChange(this,t,!0)),n?r:this}},{key:"get",value:function(t){return this.components.get(t)}},{key:"has",value:function(t){return!!this.components.get(t)}},{key:"remove",value:function(t){if(this.components.has(t)){this.components.delete(t);var e=this.Components.indexOf(t);return this.Components.splice(e,1),this.world.archetypes.onEntityComponentChange(this,t,!1),this.Components.length||!this.deactivating&&!this.destroying||(this.active=!1,this.deactivating=!1,this.destroying=!1,this.world.entities.onEntityInactive(this),this.world.archetypes.onEntityInactive(this)),this}console.warn("Entity: cannot remove component as it doesnt have one")}},{key:"activate",value:function(){if(!this.active){for(;this.inactiveComponents.length;){var t=this.inactiveComponents.pop(),e=t.constructor;this.components.set(e,t),this.Components.push(e),this.world.archetypes.onEntityComponentChange(this,e,!0)}return this.active=!0,this.deactivating=!1,this.destroying=!1,this.world.entities.onEntityActive(this),this.world.archetypes.onEntityActive(this),this}console.warn("Entity: cannot activate as entity is already active")}},{key:"deactivate",value:function(){for(var t=this.Components.length-1;t>=0;--t){var e=this.Components[t];if(e.__proto__===O)this.deactivating=!0;else{var n=this.components.get(e);this.components.delete(e),this.Components.splice(t,1),this.inactiveComponents.push(n),this.world.archetypes.onEntityComponentChange(this,e,!1)}}return this.deactivating||(this.active=!1,this.world.entities.onEntityInactive(this),this.world.archetypes.onEntityInactive(this)),this}},{key:"destroy",value:function(){for(var t=this.Components.length-1;t>=0;--t){var e=this.Components[t];e.__proto__===O?this.destroying=!0:(this.components.delete(e),this.Components.splice(t,1),this.world.archetypes.onEntityComponentChange(this,e,!1))}return this.destroying||(this.active=!1,this.world.entities.onEntityInactive(this),this.world.archetypes.onEntityInactive(this)),this}},{key:"toJSON",value:function(){var t={id:this.id,name:this.name,meta:C({},this.meta)};return this.components.forEach((function(e){e.constructor.__proto__===y&&(t[e.name]=e.toJSON())})),t}},{key:"fromJSON",value:function(t){for(var e in this.id=t.id,this.name=t.name,this.meta=t.meta,t)if("id"!==e&&"name"!==e&&"meta"!==e){var n=this.world.components.getByName(e);this.add(n,void 0,!0).fromJSON(t[e])}return this}}])&&S(e.prototype,n),r&&S(e,r),t}();function P(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var N=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.world=e,this.entities=new Map,this.nextEntityId=0}var e,n,r;return e=t,(n=[{key:"create",value:function(t,e){return e||(e="".concat(this.world.id,":").concat(this.nextEntityId++)),new j(this.world,t,e)}},{key:"getById",value:function(t){return this.entities.get(t)}},{key:"onEntityActive",value:function(t){this.entities.set(t.id,t)}},{key:"onEntityInactive",value:function(t){this.entities.delete(t.id)}},{key:"reset",value:function(){this.entities.forEach((function(t){t.destroy()}))}}])&&P(e.prototype,n),r&&P(e,r),t}();function _(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var I=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.world=e,this.count=0,this.lastComponentId=0,this.componentsByName={}}var e,n,r;return e=t,(n=[{key:"register",value:function(t){if(this.componentsByName[t.name])throw new Error("hecs: component already registered '".concat(t.name,"'"));return t.id=this.lastComponentId++,this.componentsByName[t.name]=t,this.count++,this}},{key:"getByName",value:function(t){return this.componentsByName[t]}}])&&_(e.prototype,n),r&&_(e,r),t}();function T(t){var e=t.name,n=t.plugins,r=void 0===n?[]:n,i=t.systems,o=void 0===i?[]:i,s=t.components,c=void 0===s?[]:s,a=t.decorate,u=void 0===a?function(){}:a;if(!e)throw new Error("hecs: createPlugin requires name");return{name:e,plugins:r,systems:o,components:c,decorate:u}}function J(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function x(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?J(Object(n),!0).forEach((function(e){M(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):J(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function M(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function A(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function R(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var B=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};A(this,t),this.id=0,this.version=0,this.plugins=new Map,this.providers={},this.systems=new i(this),this.queries=new a(this),this.archetypes=new h(this),this.entities=new N(this),this.components=new I(this),this.registerPlugin(T(x({name:"root"},e))),this.archetypes.init(),this.systems.init()}var e,n,r;return e=t,(n=[{key:"registerPlugin",value:function(t){var e=this;this.plugins.has(t)?console.warn("hecs: already registered plugin '".concat(t.name,"'")):(this.plugins.set(t,!0),t.plugins.forEach((function(t){e.registerPlugin(t)})),t.systems.forEach((function(t){e.systems.register(t)})),t.components.forEach((function(t){e.components.register(t)})),t.decorate&&t.decorate(this),console.log("hecs: registered plugin '".concat(t.name,"'")))}},{key:"update",value:function(t){this.version++,this.systems.update(t)}},{key:"reset",value:function(){this.entities.reset(),this.update(),this.systems.reset()}},{key:"toJSON",value:function(){var t={nextEntityId:this.entities.nextEntityId,entities:[]};return this.entities.entities.forEach((function(e){return t.entities.push(e.toJSON())})),t}},{key:"fromJSON",value:function(t){var e=this;this.entities.nextEntityId=t.nextEntityId,t.entities.forEach((function(t){e.entities.create(t.name,t.id).fromJSON(t).activate()}))}}])&&R(e.prototype,n),r&&R(e,r),t}(),q={Initialization:1e3,Simulation:2e3,Presentation:3e3};function D(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var F=function(){function t(e){for(var n in function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.order=q.Simulation,this.world=e,this.queries={},this.active=!0,this.constructor.queries){var r=this.constructor.queries[n];this.queries[n]=this.world.queries.create(r)}}var e,n,r;return e=t,(n=[{key:"init",value:function(t){}},{key:"update",value:function(){}},{key:"reset",value:function(){}}])&&D(e.prototype,n),r&&D(e,r),t}();function U(t){return(U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function L(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function z(t,e){return(z=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function G(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=W(t);if(e){var i=W(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return H(this,n)}}function H(t,e){return!e||"object"!==U(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function W(t){return(W=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var K=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&z(t,e)}(n,t);var e=G(n);function n(){return L(this,n),e.apply(this,arguments)}return n}(y);K.isLocalComponent=!0;var Q=n(0);function V(t){return{Component:t,isNot:!0}}function X(t){return{Component:t,isModified:!0}}}])}));
!function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.hecs=t():e.HECS=t()}(this,(function(){return function(e){var t={};function __webpack_require__(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,__webpack_require__),r.l=!0,r.exports}return __webpack_require__.m=e,__webpack_require__.c=t,__webpack_require__.d=function(e,t,n){__webpack_require__.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},__webpack_require__.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.t=function(e,t){if(1&t&&(e=__webpack_require__(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(__webpack_require__.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)__webpack_require__.d(n,r,function(t){return e[t]}.bind(null,r));return n},__webpack_require__.n=function(e){var t=e&&e.__esModule?function getDefault(){return e.default}:function getModuleExports(){return e};return __webpack_require__.d(t,"a",t),t},__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=2)}([function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return r})),n.d(t,"c",(function(){return o})),n.d(t,"e",(function(){return i})),n.d(t,"d",(function(){return s})),n.d(t,"b",(function(){return c}));var r={name:"Boolean",initial:function initial(e){return e||!1},toJSON:function toJSON(e){return e},fromJSON:function fromJSON(e,t){return e||!1}},o={name:"Number",initial:function initial(e){return e||0},toJSON:function toJSON(e){return e},fromJSON:function fromJSON(e,t){return e||0}},i={name:"String",initial:function initial(e){return e||""},toJSON:function toJSON(e){return e},fromJSON:function fromJSON(e,t){return e||""}},s={name:"Ref",initial:function initial(e){return e||null},toJSON:function toJSON(e){return null},fromJSON:function fromJSON(e,t){return e||null}},a="undefined"==typeof window?e.JSON:window.JSON,c={name:"JSON",initial:function initial(e){return e?a.parse(a.stringify(e)):null},toJSON:function toJSON(e){return e&&a.stringify(e)},fromJSON:function fromJSON(e,t){return e&&a.parse(e)}}}).call(this,n(1))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}n.r(t),n.d(t,"World",(function(){return h})),n.d(t,"System",(function(){return d})),n.d(t,"Component",(function(){return c})),n.d(t,"LocalComponent",(function(){return m})),n.d(t,"StateComponent",(function(){return u})),n.d(t,"BooleanType",(function(){return v.a})),n.d(t,"NumberType",(function(){return v.c})),n.d(t,"StringType",(function(){return v.e})),n.d(t,"RefType",(function(){return v.d})),n.d(t,"JSONType",(function(){return v.b})),n.d(t,"Groups",(function(){return y})),n.d(t,"Not",(function(){return Not})),n.d(t,"Modified",(function(){return Modified})),n.d(t,"createPlugin",(function(){return createPlugin}));var r=function(){function SystemManager(e){!function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,SystemManager),this.world=e,this.Systems=new Map,this.systems=[],this.systemsByName={},this.tick=0}return function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}(SystemManager,[{key:"register",value:function register(e){if(!this.Systems.has(e)){var t=new e(this.world);this.Systems.set(e,t);for(var n=0,r=0;r<this.systems.length;r++){if(this.systems[r].order>t.order)break;n=r+1}return this.systems.splice(n,0,t),this.systemsByName[e.name]=t,this}console.warn("hecs: already registered system '".concat(e.name,"'"))}},{key:"init",value:function init(){for(var e=0;e<this.systems.length;e++){this.systems[e].init(this.world)}}},{key:"get",value:function get(e){return this.Systems.get(e)}},{key:"getByName",value:function getByName(e){return this.systemsByName[e]}},{key:"update",value:function update(e){for(var t=0;t<this.systems.length;t++){this.tick++;var n=this.systems[t];n.active&&n.update(e)}}},{key:"reset",value:function reset(){this.systems.forEach((function(e){e.reset()}))}}]),SystemManager}();function Query_defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=function(){function Query(e,t){!function Query_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Query),this.world=e,this.Components=t,this.Modified=[],this.archetypes=[];for(var n=0;n<t.length;n++){var r=t[n];r.isModified&&this.Modified.push(r.Component)}for(var o in this.world.archetypes.archetypes){var i=this.world.archetypes.archetypes[o];this.matchesArchetype(i)&&this.archetypes.push(i)}}return function Query_createClass(e,t,n){return t&&Query_defineProperties(e.prototype,t),n&&Query_defineProperties(e,n),e}(Query,[{key:"isModified",value:function isModified(e){for(var t=0;t<this.Modified.length;t++){var n=this.Modified[t];if(e.get(n).modifiedUntilSystemTick>=this.world.systems.tick)return!0}return!1}},{key:"forEach",value:function forEach(e){this.Modified.length?this._forEachModified(e):this._forEach(e)}},{key:"_forEachModified",value:function _forEachModified(e){for(var t=this.archetypes.length-1;t>=0;--t)for(var n=this.archetypes[t].entities,r=n.length-1;r>=0;--r){var o=n[r];this.isModified(o)&&e(o)}}},{key:"_forEach",value:function _forEach(e){for(var t=this.archetypes.length-1;t>=0;--t)for(var n=this.archetypes[t].entities,r=n.length-1;r>=0;--r){e(n[r])}}},{key:"count",value:function count(){var count=0;return this.forEach((function(){return function _readOnlyError(e){throw new Error('"'+e+'" is read-only')}("count"),count++})),count}},{key:"onArchetypeCreated",value:function onArchetypeCreated(e){this.matchesArchetype(e)&&this.archetypes.push(e)}},{key:"matchesArchetype",value:function matchesArchetype(e){for(var t=!0,n=0;n<this.Components.length;n++){var r=this.Components[n],o=r.isNot,i=r.isModified;if((o||i)&&(r=r.Component),o){if(-1!==e.Components.indexOf(r)){t=!1;break}}else if(-1===e.Components.indexOf(r)){t=!1;break}}t&&this.archetypes.push(e)}}]),Query}();function QueryManager_defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var i=function(){function QueryManager(e){!function QueryManager_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,QueryManager),this.world=e,this.queries=[]}return function QueryManager_createClass(e,t,n){return t&&QueryManager_defineProperties(e.prototype,t),n&&QueryManager_defineProperties(e,n),e}(QueryManager,[{key:"create",value:function create(e){var t=new o(this.world,e);return this.queries.push(t),t}},{key:"onArchetypeCreated",value:function onArchetypeCreated(e){for(var t=0;t<this.queries.length;t++){this.queries[t].onArchetypeCreated(e)}}}]),QueryManager}();var s=function Archetype(e,t,n){!function Archetype_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Archetype),this.world=e,this.id=t,this.Components=n,this.entities=[]};function ArchetypeManager_defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=function(){function ArchetypeManager(e,t){!function ArchetypeManager_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,ArchetypeManager),this.world=e,this.archetypes={},this.initialId=null}return function ArchetypeManager_createClass(e,t,n){return t&&ArchetypeManager_defineProperties(e.prototype,t),n&&ArchetypeManager_defineProperties(e,n),e}(ArchetypeManager,[{key:"init",value:function init(){this.initialId="";for(var e=this.world.components.count;e;)this.initialId+="0",e--;console.log("hecs: using ".concat(this.world.components.count," bit archetype ids")),this.createArchetype(this.initialId,[])}},{key:"onEntityActive",value:function onEntityActive(e){this.addToArchetype(e)}},{key:"onEntityComponentChange",value:function onEntityComponentChange(e,t,n){e.active&&this.removeFromArchetype(e),e.archetypeId=e.archetypeId.substring(0,t.id)+(n?"1":"0")+e.archetypeId.substring(t.id+1),this.archetypes[e.archetypeId]||this.createArchetype(e.archetypeId,e.Components),e.active&&this.addToArchetype(e)}},{key:"onEntityInactive",value:function onEntityInactive(e){this.removeFromArchetype(e)}},{key:"addToArchetype",value:function addToArchetype(e){var t=this.archetypes[e.archetypeId];-1===t.entities.indexOf(e)&&t.entities.push(e)}},{key:"removeFromArchetype",value:function removeFromArchetype(e){var t=this.archetypes[e.archetypeId].entities,n=t.indexOf(e);-1!==n&&t.splice(n,1)}},{key:"createArchetype",value:function createArchetype(e,t){t=t.slice();var n=new s(this.world,e,t);return this.archetypes[n.id]=n,this.world.queries.onArchetypeCreated(n),n}}]),ArchetypeManager}();function Component_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Component_defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var c=function(){function Component(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(var n in Component_classCallCheck(this,Component),this.world=e,this.name=this.constructor.name,this.props=[],this.modifiedUntilSystemTick=0,this.constructor.props){var r=this.constructor.props[n],o=t[n];r.type||(r={type:r},this.constructor.props[n]=r),this[n]=r.type.initial(void 0===o?r.default:o),this.props.push(r)}}return function Component_createClass(e,t,n){return t&&Component_defineProperties(e.prototype,t),n&&Component_defineProperties(e,n),e}(Component,[{key:"toJSON",value:function toJSON(){var e={};for(var t in this.constructor.props){var n=this.constructor.props[t],r=n.type||n;e[t]=r.toJSON(this[t])}return e}},{key:"fromJSON",value:function fromJSON(e){for(var t in this.constructor.props){var n=this.constructor.props[t],r=n.type||n;void 0!==e[t]&&(this[t]=r.fromJSON(e[t],this[t]))}return this}},{key:"modified",value:function modified(){this.modifiedUntilSystemTick=this.world.systems.tick+this.world.systems.systems.length}}]),Component}();function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function StateComponent_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(e){var t=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function _createSuperInternal(){var n,r=_getPrototypeOf(e);if(t){var o=_getPrototypeOf(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return _possibleConstructorReturn(this,n)}}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}c.props={},c.isComponent=!0;var u=function(e){!function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}(StateComponent,e);var t=_createSuper(StateComponent);function StateComponent(){return StateComponent_classCallCheck(this,StateComponent),t.apply(this,arguments)}return StateComponent}(c);function ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach((function(t){_defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Entity_defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}u.isStateComponent=!0;var f=function(){function Entity(e,t,n,r){!function Entity_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,Entity),this.world=e,this.id=n,this.name=t||null,this.meta=r||{},this.Components=[],this.components=new Map,this.inactiveComponents=[],this.archetypeId=e.archetypes.initialId,this.active=!1}return function Entity_createClass(e,t,n){return t&&Entity_defineProperties(e.prototype,t),n&&Entity_defineProperties(e,n),e}(Entity,[{key:"add",value:function add(e,t,n){var r;e.isComponent?r=new e(this.world,t):(r=e,e=e.constructor);var o=this.components.has(e);return this.components.set(e,r),o||(this.Components.push(e),this.world.archetypes.onEntityComponentChange(this,e,!0)),n?r:this}},{key:"get",value:function get(e){return this.components.get(e)}},{key:"has",value:function has(e){return!!this.components.get(e)}},{key:"remove",value:function remove(e){if(this.components.has(e)){this.components.delete(e);var t=this.Components.indexOf(e);return this.Components.splice(t,1),this.world.archetypes.onEntityComponentChange(this,e,!1),this.Components.length||!this.deactivating&&!this.destroying||(this.active=!1,this.deactivating=!1,this.destroying=!1,this.world.entities.onEntityInactive(this),this.world.archetypes.onEntityInactive(this)),this}console.warn("Entity: cannot remove component as it doesnt have one")}},{key:"activate",value:function activate(){if(!this.active){for(;this.inactiveComponents.length;){var e=this.inactiveComponents.pop(),t=e.constructor;this.components.set(t,e),this.Components.push(t),this.world.archetypes.onEntityComponentChange(this,t,!0)}return this.active=!0,this.deactivating=!1,this.destroying=!1,this.world.entities.onEntityActive(this),this.world.archetypes.onEntityActive(this),this}console.warn("Entity: cannot activate as entity is already active")}},{key:"deactivate",value:function deactivate(){for(var e=this.Components.length-1;e>=0;--e){var t=this.Components[e];if(t.__proto__===u)this.deactivating=!0;else{var n=this.components.get(t);this.components.delete(t),this.Components.splice(e,1),this.inactiveComponents.push(n),this.world.archetypes.onEntityComponentChange(this,t,!1)}}return this.deactivating||(this.active=!1,this.world.entities.onEntityInactive(this),this.world.archetypes.onEntityInactive(this)),this}},{key:"destroy",value:function destroy(){for(var e=this.Components.length-1;e>=0;--e){var t=this.Components[e];t.__proto__===u?this.destroying=!0:(this.components.delete(t),this.Components.splice(e,1),this.world.archetypes.onEntityComponentChange(this,t,!1))}return this.destroying||(this.active=!1,this.world.entities.onEntityInactive(this),this.world.archetypes.onEntityInactive(this)),this}},{key:"toJSON",value:function toJSON(){var e={id:this.id,name:this.name,meta:_objectSpread({},this.meta)};return this.components.forEach((function(t){t.constructor.__proto__===c&&(e[t.name]=t.toJSON())})),e}},{key:"fromJSON",value:function fromJSON(e){for(var t in this.id=e.id,this.name=e.name,this.meta=e.meta,e)if("id"!==t&&"name"!==t&&"meta"!==t){var n=this.world.components.getByName(t);this.add(n,void 0,!0).fromJSON(e[t])}return this}}]),Entity}();function EntityManager_defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var p=function(){function EntityManager(e){!function EntityManager_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,EntityManager),this.world=e,this.entities=new Map,this.nextEntityId=0}return function EntityManager_createClass(e,t,n){return t&&EntityManager_defineProperties(e.prototype,t),n&&EntityManager_defineProperties(e,n),e}(EntityManager,[{key:"create",value:function create(e,t){return t||(t="".concat(this.world.id,":").concat(this.nextEntityId++)),new f(this.world,e,t)}},{key:"getById",value:function getById(e){return this.entities.get(e)}},{key:"onEntityActive",value:function onEntityActive(e){this.entities.set(e.id,e)}},{key:"onEntityInactive",value:function onEntityInactive(e){this.entities.delete(e.id)}},{key:"reset",value:function reset(){this.entities.forEach((function(e){e.destroy()}))}}]),EntityManager}();function ComponentManager_defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var l=function(){function ComponentManager(e){!function ComponentManager_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,ComponentManager),this.world=e,this.count=0,this.lastComponentId=0,this.componentsByName={}}return function ComponentManager_createClass(e,t,n){return t&&ComponentManager_defineProperties(e.prototype,t),n&&ComponentManager_defineProperties(e,n),e}(ComponentManager,[{key:"register",value:function register(e){if(this.componentsByName[e.name])throw new Error("hecs: component already registered '".concat(e.name,"'"));return e.id=this.lastComponentId++,this.componentsByName[e.name]=e,this.count++,this}},{key:"getByName",value:function getByName(e){return this.componentsByName[e]}}]),ComponentManager}();function createPlugin(e){var t=e.name,n=e.plugins,r=void 0===n?[]:n,o=e.systems,i=void 0===o?[]:o,s=e.components,a=void 0===s?[]:s,c=e.decorate,u=void 0===c?function(){}:c;if(!t)throw new Error("hecs: createPlugin requires name");return{name:t,plugins:r,systems:i,components:a,decorate:u}}function World_ownKeys(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function World_objectSpread(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?World_ownKeys(Object(n),!0).forEach((function(t){World_defineProperty(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):World_ownKeys(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function World_defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function World_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function World_defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var h=function(){function World(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};World_classCallCheck(this,World),this.id=0,this.version=0,this.plugins=new Map,this.providers={},this.systems=new r(this),this.queries=new i(this),this.archetypes=new a(this),this.entities=new p(this),this.components=new l(this),this.registerPlugin(createPlugin(World_objectSpread({name:"root"},e))),this.archetypes.init(),this.systems.init()}return function World_createClass(e,t,n){return t&&World_defineProperties(e.prototype,t),n&&World_defineProperties(e,n),e}(World,[{key:"registerPlugin",value:function registerPlugin(e){var t=this;this.plugins.has(e)?console.warn("hecs: already registered plugin '".concat(e.name,"'")):(this.plugins.set(e,!0),e.plugins.forEach((function(e){t.registerPlugin(e)})),e.systems.forEach((function(e){t.systems.register(e)})),e.components.forEach((function(e){t.components.register(e)})),e.decorate&&e.decorate(this),console.log("hecs: registered plugin '".concat(e.name,"'")))}},{key:"update",value:function update(e){this.version++,this.systems.update(e)}},{key:"reset",value:function reset(){this.entities.reset(),this.update(),this.systems.reset()}},{key:"toJSON",value:function toJSON(){var e={nextEntityId:this.entities.nextEntityId,entities:[]};return this.entities.entities.forEach((function(t){return e.entities.push(t.toJSON())})),e}},{key:"fromJSON",value:function fromJSON(e){var t=this;this.entities.nextEntityId=e.nextEntityId,e.entities.forEach((function(e){t.entities.create(e.name,e.id).fromJSON(e).activate()}))}}]),World}(),y={Initialization:1e3,Simulation:2e3,Presentation:3e3};function System_defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var d=function(){function System(e){for(var t in function System_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,System),this.order=y.Simulation,this.world=e,this.queries={},this.active=!0,this.constructor.queries){var n=this.constructor.queries[t];this.queries[t]=this.world.queries.create(n)}}return function System_createClass(e,t,n){return t&&System_defineProperties(e.prototype,t),n&&System_defineProperties(e,n),e}(System,[{key:"init",value:function init(e){}},{key:"update",value:function update(){}},{key:"reset",value:function reset(){}}]),System}();function LocalComponent_typeof(e){return(LocalComponent_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function _typeof(e){return typeof e}:function _typeof(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function LocalComponent_classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function LocalComponent_setPrototypeOf(e,t){return(LocalComponent_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(e,t){return e.__proto__=t,e})(e,t)}function LocalComponent_createSuper(e){var t=function LocalComponent_isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function _createSuperInternal(){var n,r=LocalComponent_getPrototypeOf(e);if(t){var o=LocalComponent_getPrototypeOf(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return LocalComponent_possibleConstructorReturn(this,n)}}function LocalComponent_possibleConstructorReturn(e,t){return!t||"object"!==LocalComponent_typeof(t)&&"function"!=typeof t?function LocalComponent_assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function LocalComponent_getPrototypeOf(e){return(LocalComponent_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var m=function(e){!function LocalComponent_inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&LocalComponent_setPrototypeOf(e,t)}(LocalComponent,e);var t=LocalComponent_createSuper(LocalComponent);function LocalComponent(){return LocalComponent_classCallCheck(this,LocalComponent),t.apply(this,arguments)}return LocalComponent}(c);m.isLocalComponent=!0;var v=n(0);function Not(e){return{Component:e,isNot:!0}}function Modified(e){return{Component:e,isModified:!0}}}])}));
{
"name": "hecs",
"version": "0.8.0",
"version": "0.8.1",
"main": "dist/hecs.js",

@@ -19,2 +19,3 @@ "scripts": {

"jest": "^26.1.0",
"terser-webpack-plugin": "^4.1.0",
"webpack": "^4.41.5",

@@ -44,3 +45,3 @@ "webpack-cli": "^3.3.10"

"license": "MIT",
"gitHead": "4d17609228290b072d67cd83b4d3c9fd302e9849"
"gitHead": "9590f5ceefd9e92c49143f30e607c86fe4da6a44"
}
const path = require('path')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin')

@@ -21,2 +22,14 @@ const isProduction = process.env.NODE_ENV === 'production'

},
optimization: {
minimizer: [
new TerserPlugin({
cache: true,
parallel: true,
terserOptions: {
keep_classnames: true,
keep_fnames: true,
},
}),
],
},
devtool: 'source-map',

@@ -23,0 +36,0 @@ node: { fs: 'empty' },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc