From: Ben Beltran Date: Mon, 9 Mar 2020 19:06:23 +0000 (-0500) Subject: Use browserslist defaults X-Git-Tag: 3.0.1 X-Git-Url: https://git.r.bdr.sh/rbdr/serpentity/commitdiff_plain/3828c5670e97df8514e3dad23b3890e8d8939669?ds=inline;hp=6b3e4b4fb52e477f9f3c147127c2fd638baffd8a Use browserslist defaults --- diff --git a/dist/serpentity.js b/dist/serpentity.js index e57efd5..c3b6f62 100644 --- a/dist/serpentity.js +++ b/dist/serpentity.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Serpentity=t():e.Serpentity=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,s=i&&"function"==typeof i.apply?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function u(){u.init.call(this)}e.exports=u,u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var c=10;function f(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function p(e){return void 0===e._maxListeners?u.defaultMaxListeners:e._maxListeners}function l(e,t,n,r){var i,s,o,u;if(f(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]),void 0===o)o=s[t]=n,++e._eventsCount;else if("function"==typeof o?o=s[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=p(e))>0&&o.length>i&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,u=c,console&&console.warn&&console.warn(u)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function a(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=h.bind(r);return i.listener=n,r.wrapFn=i,i}function d(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(o=t[0]),o instanceof Error)throw o;var u=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw u.context=o,u}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)s(c,this,t);else{var f=c.length,p=v(c,f);for(n=0;n=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},u.prototype.listeners=function(e){return d(this,e,!0)},u.prototype.rawListeners=function(e){return d(this,e,!1)},u.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):y.call(e,t)},u.prototype.listenerCount=y,u.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";n.r(t),n.d(t,"Component",(function(){return r})),n.d(t,"Entity",(function(){return i})),n.d(t,"Node",(function(){return s})),n.d(t,"System",(function(){return o})),n.d(t,"default",(function(){return f}));class r{constructor(e){Object.assign(this,e)}}class i{constructor(e){this._componentKeys=[],this._components=[],Object.assign(this,e)}addComponent(e){return!(this._componentKeys.indexOf(e.constructor)>=0)&&(this._componentKeys.push(e.constructor),this._components.push(e),!0)}hasComponent(e){return this._componentKeys.indexOf(e)>=0}getComponent(e){const t=this._componentKeys.indexOf(e);if(t>=0)return this._components[t]}}class s{static matches(e){const t=Object.keys(this.types);for(const n of t){const t=this.types[n];let r=!1;if(e.hasComponent(t)&&(r=!0),!r)return!1}return!0}constructor(e){this.types={},Object.assign(this,e)}}class o{added(){}removed(){}update(){}}const u=n(0);class c extends u{constructor(e){super(),this.nodes=[],this.type=null,Object.assign(this,e)}add(e){if(this.type.matches(e)&&!this._entityExists(e)){const t=new this.type({}),n=this.type.types,r=Object.keys(n);t.entity=e;for(const i of r)t[i]=e.getComponent(n[i]);return this.nodes.push(t),this.emit("nodeAdded",{node:t}),!0}return!1}remove(e){let t=-1,n=null;const r=this.nodes.some((r,i)=>{if(r.entity===e)return t=i,n=r,!0});return r&&(this.nodes.splice(t,1),this.emit("nodeRemoved",{node:n})),r}_entityExists(e){let t=!1;for(const n of this.nodes)n.entity===e&&(t=!0);return t}}c.prototype[Symbol.iterator]=function*(){yield*this.nodes};class f{constructor(e){this.systems=[],this.entities=[],this._nodeCollections=[],this._nodeCollectionKeys=[],Object.assign(this,e)}addSystem(e,t){if(this.systems.indexOf(e)>=0)return!1;e.priority=t;let n=0;return this.systems.some((t,r)=>{if(n=r,t.priority>=e.priority)return!0})||(n+=1),this.systems.splice(n,0,e),e.added(this),!0}removeSystem(e){const t=this.systems.indexOf(e);return t>=0&&(this.systems[t].removed(this),this.systems.splice(t,1),!0)}addEntity(e){if(this.entities.indexOf(e)>=0)return!1;this.entities.push(e);for(const t of this._nodeCollections)t.add(e);return!0}removeEntity(e){const t=this.entities.indexOf(e);if(t>=0){for(const t of this._nodeCollections)t.remove(e);return this.entities.splice(t,1),!0}return!1}getNodes(e){const t=this._nodeCollectionKeys.indexOf(e);if(t>=0)return this._nodeCollections[t].nodes;const n=new c({type:e});this._nodeCollectionKeys.push(e),this._nodeCollections.push(n);for(const e of this.entities)n.add(e);return n}update(e){for(const t of this.systems)t.update(e)}}}])})); +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Serpentity=t():e.Serpentity=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,s=i&&"function"==typeof i.apply?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function u(){u.init.call(this)}e.exports=u,u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var c=10;function f(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function p(e){return void 0===e._maxListeners?u.defaultMaxListeners:e._maxListeners}function l(e,t,n,r){var i,s,o,u;if(f(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]),void 0===o)o=s[t]=n,++e._eventsCount;else if("function"==typeof o?o=s[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=p(e))>0&&o.length>i&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,u=c,console&&console.warn&&console.warn(u)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function a(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=h.bind(r);return i.listener=n,r.wrapFn=i,i}function d(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(o=t[0]),o instanceof Error)throw o;var u=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw u.context=o,u}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)s(c,this,t);else{var f=c.length,p=v(c,f);for(n=0;n=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},u.prototype.listeners=function(e){return d(this,e,!0)},u.prototype.rawListeners=function(e){return d(this,e,!1)},u.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):y.call(e,t)},u.prototype.listenerCount=y,u.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";n.r(t),n.d(t,"Component",(function(){return r})),n.d(t,"Entity",(function(){return i})),n.d(t,"Node",(function(){return s})),n.d(t,"System",(function(){return o})),n.d(t,"default",(function(){return p}));class r{constructor(e){Object.assign(this,e)}}class i{constructor(e){this._componentKeys=[],this._components=[],Object.assign(this,e)}addComponent(e){return!(this._componentKeys.indexOf(e.constructor)>=0)&&(this._componentKeys.push(e.constructor),this._components.push(e),!0)}hasComponent(e){return this._componentKeys.indexOf(e)>=0}getComponent(e){const t=this._componentKeys.indexOf(e);if(t>=0)return this._components[t]}}class s{static matches(e){const t=Object.keys(this.types);for(const n of t){const t=this.types[n];let r=!1;if(e.hasComponent(t)&&(r=!0),!r)return!1}return!0}constructor(e){this.types={},Object.assign(this,e)}}class o{added(){}removed(){}update(){}}var u=n(0),c=n.n(u);class f extends c.a{constructor(e){super(),this.nodes=[],this.type=null,Object.assign(this,e)}add(e){if(this.type.matches(e)&&!this._entityExists(e)){const t=new this.type({}),n=this.type.types,r=Object.keys(n);t.entity=e;for(const i of r)t[i]=e.getComponent(n[i]);return this.nodes.push(t),this.emit("nodeAdded",{node:t}),!0}return!1}remove(e){let t=-1,n=null;const r=this.nodes.some((r,i)=>{if(r.entity===e)return t=i,n=r,!0});return r&&(this.nodes.splice(t,1),this.emit("nodeRemoved",{node:n})),r}_entityExists(e){let t=!1;for(const n of this.nodes)n.entity===e&&(t=!0);return t}}f.prototype[Symbol.iterator]=function*(){yield*this.nodes};class p{constructor(e){this.systems=[],this.entities=[],this._nodeCollections=[],this._nodeCollectionKeys=[],Object.assign(this,e)}addSystem(e,t){if(this.systems.indexOf(e)>=0)return!1;e.priority=t;let n=0;return this.systems.some((t,r)=>{if(n=r,t.priority>=e.priority)return!0})||(n+=1),this.systems.splice(n,0,e),e.added(this),!0}removeSystem(e){const t=this.systems.indexOf(e);return t>=0&&(this.systems[t].removed(this),this.systems.splice(t,1),!0)}addEntity(e){if(this.entities.indexOf(e)>=0)return!1;this.entities.push(e);for(const t of this._nodeCollections)t.add(e);return!0}removeEntity(e){const t=this.entities.indexOf(e);if(t>=0){for(const t of this._nodeCollections)t.remove(e);return this.entities.splice(t,1),!0}return!1}getNodes(e){const t=this._nodeCollectionKeys.indexOf(e);if(t>=0)return this._nodeCollections[t].nodes;const n=new f({type:e});this._nodeCollectionKeys.push(e),this._nodeCollections.push(n);for(const e of this.entities)n.add(e);return n}update(e){for(const t of this.systems)t.update(e)}}}])})); \ No newline at end of file diff --git a/dist/serpentity.min.js b/dist/serpentity.min.js index 2c43039..c3b6f62 100644 --- a/dist/serpentity.min.js +++ b/dist/serpentity.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Serpentity=t():e.Serpentity=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,s=i&&"function"==typeof i.apply?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function u(){u.init.call(this)}e.exports=u,u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var c=10;function f(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function p(e){return void 0===e._maxListeners?u.defaultMaxListeners:e._maxListeners}function l(e,t,n,r){var i,s,o,u;if(f(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]),void 0===o)o=s[t]=n,++e._eventsCount;else if("function"==typeof o?o=s[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=p(e))>0&&o.length>i&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,u=c,console&&console.warn&&console.warn(u)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function a(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=h.bind(r);return i.listener=n,r.wrapFn=i,i}function d(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(o=t[0]),o instanceof Error)throw o;var u=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw u.context=o,u}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)s(c,this,t);else{var f=c.length,p=v(c,f);for(n=0;n=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},u.prototype.listeners=function(e){return d(this,e,!0)},u.prototype.rawListeners=function(e){return d(this,e,!1)},u.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):y.call(e,t)},u.prototype.listenerCount=y,u.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";n.r(t),n.d(t,"Component",(function(){return r})),n.d(t,"Entity",(function(){return i})),n.d(t,"Node",(function(){return s})),n.d(t,"System",(function(){return o})),n.d(t,"default",(function(){return f}));class r{constructor(e){Object.assign(this,e)}}class i{constructor(e){this._componentKeys=[],this._components=[],Object.assign(this,e)}addComponent(e){return!(this._componentKeys.indexOf(e.constructor)>=0)&&(this._componentKeys.push(e.constructor),this._components.push(e),!0)}hasComponent(e){return this._componentKeys.indexOf(e)>=0}getComponent(e){const t=this._componentKeys.indexOf(e);if(t>=0)return this._components[t]}}class s{static matches(e){const t=Object.keys(this.types);for(const n of t){const t=this.types[n];let r=!1;if(e.hasComponent(t)&&(r=!0),!r)return!1}return!0}constructor(e){this.types={},Object.assign(this,e)}}class o{added(){}removed(){}update(){}}const u=n(0);class c extends u{constructor(e){super(),this.nodes=[],this.type=null,Object.assign(this,e)}add(e){if(this.type.matches(e)&&!this._entityExists(e)){const t=new this.type({}),n=this.type.types,r=Object.keys(n);t.entity=e;for(const i of r)t[i]=e.getComponent(n[i]);return this.nodes.push(t),this.emit("nodeAdded",{node:t}),!0}return!1}remove(e){let t=-1,n=null;const r=this.nodes.some((r,i)=>{if(r.entity===e)return t=i,n=r,!0});return r&&(this.nodes.splice(t,1),this.emit("nodeRemoved",{node:n})),r}_entityExists(e){let t=!1;for(const n of this.nodes)n.entity===e&&(t=!0);return t}}c.prototype[Symbol.iterator]=function*(){yield*this.nodes};class f{constructor(e){this.systems=[],this.entities=[],this._nodeCollections=[],this._nodeCollectionKeys=[],Object.assign(this,e)}addSystem(e,t){if(this.systems.indexOf(e)>=0)return!1;e.priority=t;let n=0;return this.systems.some((t,r)=>{if(n=r,t.priority>=e.priority)return!0})||(n+=1),this.systems.splice(n,0,e),e.added(this),!0}removeSystem(e){const t=this.systems.indexOf(e);return t>=0&&(this.systems[t].removed(this),this.systems.splice(t,1),!0)}addEntity(e){if(this.entities.indexOf(e)>=0)return!1;this.entities.push(e);for(const t of this._nodeCollections)t.add(e);return!0}removeEntity(e){const t=this.entities.indexOf(e);if(t>=0){for(const t of this._nodeCollections)t.remove(e);return this.entities.splice(t,1),!0}return!1}getNodes(e){const t=this._nodeCollectionKeys.indexOf(e);if(t>=0)return this._nodeCollections[t].nodes;const n=new c({type:e});this._nodeCollectionKeys.push(e),this._nodeCollections.push(n);for(const e of this.entities)n.add(e);return n}update(e){for(const t of this.systems)t.update(e)}}}])})); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Serpentity=t():e.Serpentity=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,s=i&&"function"==typeof i.apply?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function u(){u.init.call(this)}e.exports=u,u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var c=10;function f(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function p(e){return void 0===e._maxListeners?u.defaultMaxListeners:e._maxListeners}function l(e,t,n,r){var i,s,o,u;if(f(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]),void 0===o)o=s[t]=n,++e._eventsCount;else if("function"==typeof o?o=s[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=p(e))>0&&o.length>i&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,u=c,console&&console.warn&&console.warn(u)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function a(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=h.bind(r);return i.listener=n,r.wrapFn=i,i}function d(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(o=t[0]),o instanceof Error)throw o;var u=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw u.context=o,u}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)s(c,this,t);else{var f=c.length,p=v(c,f);for(n=0;n=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},u.prototype.listeners=function(e){return d(this,e,!0)},u.prototype.rawListeners=function(e){return d(this,e,!1)},u.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):y.call(e,t)},u.prototype.listenerCount=y,u.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){"use strict";n.r(t),n.d(t,"Component",(function(){return r})),n.d(t,"Entity",(function(){return i})),n.d(t,"Node",(function(){return s})),n.d(t,"System",(function(){return o})),n.d(t,"default",(function(){return p}));class r{constructor(e){Object.assign(this,e)}}class i{constructor(e){this._componentKeys=[],this._components=[],Object.assign(this,e)}addComponent(e){return!(this._componentKeys.indexOf(e.constructor)>=0)&&(this._componentKeys.push(e.constructor),this._components.push(e),!0)}hasComponent(e){return this._componentKeys.indexOf(e)>=0}getComponent(e){const t=this._componentKeys.indexOf(e);if(t>=0)return this._components[t]}}class s{static matches(e){const t=Object.keys(this.types);for(const n of t){const t=this.types[n];let r=!1;if(e.hasComponent(t)&&(r=!0),!r)return!1}return!0}constructor(e){this.types={},Object.assign(this,e)}}class o{added(){}removed(){}update(){}}var u=n(0),c=n.n(u);class f extends c.a{constructor(e){super(),this.nodes=[],this.type=null,Object.assign(this,e)}add(e){if(this.type.matches(e)&&!this._entityExists(e)){const t=new this.type({}),n=this.type.types,r=Object.keys(n);t.entity=e;for(const i of r)t[i]=e.getComponent(n[i]);return this.nodes.push(t),this.emit("nodeAdded",{node:t}),!0}return!1}remove(e){let t=-1,n=null;const r=this.nodes.some((r,i)=>{if(r.entity===e)return t=i,n=r,!0});return r&&(this.nodes.splice(t,1),this.emit("nodeRemoved",{node:n})),r}_entityExists(e){let t=!1;for(const n of this.nodes)n.entity===e&&(t=!0);return t}}f.prototype[Symbol.iterator]=function*(){yield*this.nodes};class p{constructor(e){this.systems=[],this.entities=[],this._nodeCollections=[],this._nodeCollectionKeys=[],Object.assign(this,e)}addSystem(e,t){if(this.systems.indexOf(e)>=0)return!1;e.priority=t;let n=0;return this.systems.some((t,r)=>{if(n=r,t.priority>=e.priority)return!0})||(n+=1),this.systems.splice(n,0,e),e.added(this),!0}removeSystem(e){const t=this.systems.indexOf(e);return t>=0&&(this.systems[t].removed(this),this.systems.splice(t,1),!0)}addEntity(e){if(this.entities.indexOf(e)>=0)return!1;this.entities.push(e);for(const t of this._nodeCollections)t.add(e);return!0}removeEntity(e){const t=this.entities.indexOf(e);if(t>=0){for(const t of this._nodeCollections)t.remove(e);return this.entities.splice(t,1),!0}return!1}getNodes(e){const t=this._nodeCollectionKeys.indexOf(e);if(t>=0)return this._nodeCollections[t].nodes;const n=new f({type:e});this._nodeCollectionKeys.push(e),this._nodeCollections.push(n);for(const e of this.entities)n.add(e);return n}update(e){for(const t of this.systems)t.update(e)}}}])})); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index eca1911..d22c5ca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@serpentity/serpentity", - "version": "3.0.0", + "version": "3.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index aa2c132..2c2921f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@serpentity/serpentity", "description": "An Entity-Component-System Engine", - "version": "3.0.0", + "version": "3.0.1", "type": "module", "license": "Apache-2.0", "contributors": [ @@ -34,9 +34,7 @@ "node": ">= 12.0.0" }, "browserslist": [ - "last 2 versions", - "not IE", - "not IE_mob" + "defaults" ], "scripts": { "build": "webpack --config ./config/webpack.js",