@eva/plugin-renderer-tiling-sprite 2.1.0-beta.13 → 2.1.0-beta.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
1
+ var globalThis = typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : Function('return this')();
2
2
  globalThis.EVA = globalThis.EVA || {};
3
3
  globalThis.EVA.plugin = globalThis.EVA.plugin || {};
4
4
  globalThis.EVA.plugin.renderer = globalThis.EVA.plugin.renderer || {};
5
- var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, rendererAdapter) {
5
+ var _EVA_IIFE_tilingSprite = function (exports, eva_js, inspectorDecorator, pluginRenderer, rendererAdapter) {
6
6
  'use strict';
7
7
  function __decorate(decorators, target, key, desc) {
8
8
  var c = arguments.length,
@@ -41,115 +41,6 @@ var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
41
41
  step((generator = generator.apply(thisArg, _arguments || [])).next());
42
42
  });
43
43
  }
44
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
45
- var e = new Error(message);
46
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
47
- };
48
- function __rest(s, e) {
49
- var t = {};
50
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
51
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
52
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
53
- }
54
- return t;
55
- }
56
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
57
- var e = new Error(message);
58
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
59
- };
60
- class SymbolKeysNotSupportedError extends Error {
61
- constructor() {
62
- super('Symbol keys are not supported yet!');
63
- Object.setPrototypeOf(this, new.target.prototype);
64
- }
65
- }
66
- const IDE_PROPERTY_METADATA = 'IDE_PROPERTY_METADATA';
67
- function transformBasicType(type) {
68
- if (type === String) {
69
- return 'string';
70
- }
71
- if (type === Number) {
72
- return 'number';
73
- }
74
- if (type === Boolean) {
75
- return 'boolean';
76
- }
77
- return 'unknown';
78
- }
79
- function defineLegacyIDEProp(target, propertyKey, patch) {
80
- const constructor = target.constructor;
81
- const current = constructor.IDEProps || {};
82
- current[propertyKey] = _extends(_extends({
83
- key: propertyKey
84
- }, current[propertyKey]), patch);
85
- constructor.IDEProps = current;
86
- }
87
- function defineTypes(target, key, options, returnTypeFunction) {
88
- let type = Reflect.getMetadata('design:type', target, key);
89
- let isArray = type === Array;
90
- const str = transformBasicType(type);
91
- if (str !== 'unknown') {
92
- type = str;
93
- }
94
- if (returnTypeFunction) {
95
- const returnType = returnTypeFunction();
96
- if (Array.isArray(returnType)) {
97
- isArray = true;
98
- type = returnType[0];
99
- } else {
100
- type = returnType;
101
- }
102
- }
103
- const properties = Reflect.getMetadata(IDE_PROPERTY_METADATA, target.constructor) || {};
104
- const current = properties[key] || {};
105
- const property = _extends(_extends(_extends({}, current), {
106
- type,
107
- isArray: isArray
108
- }), options);
109
- properties[key] = property;
110
- Reflect.defineMetadata(IDE_PROPERTY_METADATA, properties, target.constructor);
111
- const legacyProperty = __rest(property, ["isArray"]);
112
- defineLegacyIDEProp(target, key, legacyProperty);
113
- }
114
- function type(type) {
115
- return Field({
116
- type
117
- });
118
- }
119
- function step(step) {
120
- return Field({
121
- step
122
- });
123
- }
124
- function getTypeDecoratorParams(returnTypeFuncOrOptions, maybeOptions) {
125
- if (typeof returnTypeFuncOrOptions === 'function') {
126
- return {
127
- returnTypeFunc: returnTypeFuncOrOptions,
128
- options: maybeOptions || {}
129
- };
130
- }
131
- return {
132
- options: returnTypeFuncOrOptions || {}
133
- };
134
- }
135
- function Field(returnTypeFunction, maybeOptions) {
136
- return (target, propertyKey) => {
137
- if (typeof propertyKey === 'symbol') {
138
- throw new SymbolKeysNotSupportedError();
139
- }
140
- const {
141
- options,
142
- returnTypeFunc
143
- } = getTypeDecoratorParams(returnTypeFunction, maybeOptions);
144
- defineTypes(target, propertyKey, options, returnTypeFunc);
145
- };
146
- }
147
- var ExecuteMode;
148
- (function (ExecuteMode) {
149
- ExecuteMode[ExecuteMode["Edit"] = 2] = "Edit";
150
- ExecuteMode[ExecuteMode["Game"] = 4] = "Game";
151
- ExecuteMode[ExecuteMode["All"] = 6] = "All";
152
- })(ExecuteMode || (ExecuteMode = {}));
153
44
  class TilingSprite$2 extends eva_js.Component {
154
45
  constructor() {
155
46
  super(...arguments);
@@ -172,9 +63,9 @@ var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
172
63
  }
173
64
  }
174
65
  TilingSprite$2.componentName = 'TilingSprite';
175
- __decorate([type('string'), __metadata("design:type", String)], TilingSprite$2.prototype, "resource", void 0);
176
- __decorate([type('vector2'), step(0.1), __metadata("design:type", Object)], TilingSprite$2.prototype, "tileScale", void 0);
177
- __decorate([type('vector2'), step(1), __metadata("design:type", Object)], TilingSprite$2.prototype, "tilePosition", void 0);
66
+ __decorate([inspectorDecorator.type('string'), __metadata("design:type", String)], TilingSprite$2.prototype, "resource", void 0);
67
+ __decorate([inspectorDecorator.type('vector2'), inspectorDecorator.step(0.1), __metadata("design:type", Object)], TilingSprite$2.prototype, "tileScale", void 0);
68
+ __decorate([inspectorDecorator.type('vector2'), inspectorDecorator.step(1), __metadata("design:type", Object)], TilingSprite$2.prototype, "tilePosition", void 0);
178
69
  let TilingSprite = class TilingSprite extends pluginRenderer.Renderer {
179
70
  constructor() {
180
71
  super(...arguments);
@@ -267,5 +158,5 @@ var _EVA_IIFE_tilingSprite = function (exports, eva_js, pluginRenderer, renderer
267
158
  value: true
268
159
  });
269
160
  return exports;
270
- }({}, EVA, EVA.plugin.renderer, EVA.rendererAdapter);
161
+ }({}, EVA, inspectorDecorator, EVA.plugin.renderer, EVA.rendererAdapter);
271
162
  globalThis.EVA.plugin.renderer.tilingSprite = globalThis.EVA.plugin.renderer.tilingSprite || _EVA_IIFE_tilingSprite;
@@ -1 +1 @@
1
- function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},_extends.apply(null,arguments)}globalThis.EVA=globalThis.EVA||{},globalThis.EVA.plugin=globalThis.EVA.plugin||{},globalThis.EVA.plugin.renderer=globalThis.EVA.plugin.renderer||{};var _EVA_IIFE_tilingSprite=function(e,t,r,i){"use strict";function n(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s}function o(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function s(e,t,r,i){return new(r||(r=Promise))(function(n,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function c(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,c)}l((i=i.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError,"function"==typeof SuppressedError&&SuppressedError;class c extends Error{constructor(){super("Symbol keys are not supported yet!"),Object.setPrototypeOf(this,new.target.prototype)}}const l="IDE_PROPERTY_METADATA";function a(e,t,r,i){let n=Reflect.getMetadata("design:type",e,t),o=n===Array;const s=function(e){return e===String?"string":e===Number?"number":e===Boolean?"boolean":"unknown"}(n);if("unknown"!==s&&(n=s),i){const e=i();Array.isArray(e)?(o=!0,n=e[0]):n=e}const c=Reflect.getMetadata(l,e.constructor)||{},a=_extends(_extends(_extends({},c[t]||{}),{type:n,isArray:o}),r);c[t]=a,Reflect.defineMetadata(l,c,e.constructor);!function(e,t,r){const i=e.constructor,n=i.IDEProps||{};n[t]=_extends(_extends({key:t},n[t]),r),i.IDEProps=n}(e,t,function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r}(a,["isArray"]))}function p(e){return d({type:e})}function u(e){return d({step:e})}function d(e,t){return(r,i)=>{if("symbol"==typeof i)throw new c;const{options:n,returnTypeFunc:o}=function(e,t){return"function"==typeof e?{returnTypeFunc:e,options:t||{}}:{options:e||{}}}(e,t);a(r,i,n,o)}}var g;!function(e){e[e.Edit=2]="Edit",e[e.Game=4]="Game",e[e.All=6]="All"}(g||(g={}));class f extends t.Component{constructor(){super(...arguments),this.resource="",this.tileScale={x:1,y:1},this.tilePosition={x:0,y:0}}init(e){e&&(this.resource=e.resource,this.tileScale=e.tileScale,this.tilePosition=e.tilePosition)}}f.componentName="TilingSprite",n([p("string"),o("design:type",String)],f.prototype,"resource",void 0),n([p("vector2"),u(.1),o("design:type",Object)],f.prototype,"tileScale",void 0),n([p("vector2"),u(1),o("design:type",Object)],f.prototype,"tilePosition",void 0);let y=class extends r.Renderer{constructor(){super(...arguments),this.name="TilingSprite",this.imgs={}}init(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)}rendererUpdate(e){const{width:t,height:r}=e.transform.size,i=this.imgs[e.id];i&&(i.tilingSprite.width=t,i.tilingSprite.height=r)}componentChanged(e){return s(this,void 0,void 0,function*(){const r=e.gameObject.id;if("TilingSprite"===e.componentName){const n=e.component;if(e.type===t.OBSERVER_TYPE.ADD){const o=new i.TilingSprite(null);this.imgs[e.gameObject.id]=o,this.containerManager.getContainer(e.gameObject.id).addChildAt(o.tilingSprite,0),this.setProp(e.gameObject.id,n);const s=this.increaseAsyncId(r),{data:c}=yield t.resource.getResource(n.resource);if(!this.validateAsyncId(r,s))return;if(!c)return void console.error(`GameObject:${e.gameObject.name}'s TilingSprite resource load error`);o.image=c.image}else if(e.type===t.OBSERVER_TYPE.CHANGE)if("resource"===e.prop.prop[0]){const i=this.increaseAsyncId(r),{data:o}=yield t.resource.getResource(n.resource);if(!this.validateAsyncId(r,i))return;if(!o)return void console.error(`GameObject:${e.gameObject.name}'s TilingSprite resource load error`);this.imgs[e.gameObject.id].image=o.image}else this.setProp(e.gameObject.id,n);else if(e.type===t.OBSERVER_TYPE.REMOVE){this.increaseAsyncId(r);const t=this.imgs[e.gameObject.id];this.containerManager.getContainer(e.gameObject.id).removeChild(t.tilingSprite),t.tilingSprite.destroy({children:!0}),delete this.imgs[e.gameObject.id]}}})}setProp(e,t){this.imgs[e].tilingSprite.tilePosition=t.tilePosition,this.imgs[e].tilingSprite.tileScale=t.tileScale}};y=n([t.decorators.componentObserver({TilingSprite:[{prop:["resource"],deep:!1},{prop:["tileScale"],deep:!0},{prop:["tilePosition"],deep:!0}]})],y);var h=y;return e.TilingSprite=f,e.TilingSpriteSystem=h,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.plugin.renderer,EVA.rendererAdapter);globalThis.EVA.plugin.renderer.tilingSprite=globalThis.EVA.plugin.renderer.tilingSprite||_EVA_IIFE_tilingSprite;
1
+ var globalThis="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();globalThis.EVA=globalThis.EVA||{},globalThis.EVA.plugin=globalThis.EVA.plugin||{},globalThis.EVA.plugin.renderer=globalThis.EVA.plugin.renderer||{};var _EVA_IIFE_tilingSprite=function(e,t,r,i){"use strict";var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(){return s=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},s.apply(this,arguments)};function c(e,t,r,i){var n,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,i);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(s=(o<3?n(s):o>3?n(t,r,s):n(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s}function a(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,r,i){return new(r||(r=Promise))(function(n,o){function s(e){try{a(i.next(e))}catch(e){o(e)}}function c(e){try{a(i.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,c)}a((i=i.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;var p=function(e){function t(){var t=this.constructor,r=e.call(this,"Symbol keys are not supported yet!")||this;return Object.setPrototypeOf(r,t.prototype),r}return o(t,e),t}(Error);!function(e){function t(){var t=this.constructor,r=e.call(this,"getProperties is not a function!")||this;return Object.setPrototypeOf(r,t.prototype),r}o(t,e)}(Error);var u,f="IDE_PROPERTY_METADATA";function g(e,t,r,i){var n=Reflect.getMetadata("design:type",e,t),o=n===Array,c=function(e){return e===String?"string":e===Number?"number":e===Boolean?"boolean":"unknown"}(n);if("unknown"!==c&&(n=c),i){var a=i();Array.isArray(a)?(o=!0,n=a[0]):n=a}var l=Reflect.getMetadata(f,e.constructor)||{},p=l[t]||{},u=s(s(s({},p),{type:n,isArray:o}),r);l[t]=u,Reflect.defineMetadata(f,l,e.constructor),u.isArray,function(e,t,r){var i=e.constructor,n=i.IDEProps||{};n[t]=s(s({key:t},n[t]),r),i.IDEProps=n}(e,t,function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r}(u,["isArray"]))}function d(e){return h({type:e})}function y(e){return h({step:e})}function h(e,t){return function(r,i){if("symbol"==typeof i)throw new p;var n=function(e,t){return"function"==typeof e?{returnTypeFunc:e,options:t||{}}:{options:e||{}}}(e,t);g(r,i,n.options,n.returnTypeFunc)}}!function(e){e[e.Edit=2]="Edit",e[e.Game=4]="Game",e[e.All=6]="All"}(u||(u={}));class m extends t.Component{constructor(){super(...arguments),this.resource="",this.tileScale={x:1,y:1},this.tilePosition={x:0,y:0}}init(e){e&&(this.resource=e.resource,this.tileScale=e.tileScale,this.tilePosition=e.tilePosition)}}m.componentName="TilingSprite",c([d("string"),a("design:type",String)],m.prototype,"resource",void 0),c([d("vector2"),y(.1),a("design:type",Object)],m.prototype,"tileScale",void 0),c([d("vector2"),y(1),a("design:type",Object)],m.prototype,"tilePosition",void 0);let b=class extends r.Renderer{constructor(){super(...arguments),this.name="TilingSprite",this.imgs={}}init(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)}rendererUpdate(e){const{width:t,height:r}=e.transform.size,i=this.imgs[e.id];i&&(i.tilingSprite.width=t,i.tilingSprite.height=r)}componentChanged(e){return l(this,void 0,void 0,function*(){const r=e.gameObject.id;if("TilingSprite"===e.componentName){const n=e.component;if(e.type===t.OBSERVER_TYPE.ADD){const o=new i.TilingSprite(null);this.imgs[e.gameObject.id]=o,this.containerManager.getContainer(e.gameObject.id).addChildAt(o.tilingSprite,0),this.setProp(e.gameObject.id,n);const s=this.increaseAsyncId(r),{data:c}=yield t.resource.getResource(n.resource);if(!this.validateAsyncId(r,s))return;if(!c)return void console.error(`GameObject:${e.gameObject.name}'s TilingSprite resource load error`);o.image=c.image}else if(e.type===t.OBSERVER_TYPE.CHANGE)if("resource"===e.prop.prop[0]){const i=this.increaseAsyncId(r),{data:o}=yield t.resource.getResource(n.resource);if(!this.validateAsyncId(r,i))return;if(!o)return void console.error(`GameObject:${e.gameObject.name}'s TilingSprite resource load error`);this.imgs[e.gameObject.id].image=o.image}else this.setProp(e.gameObject.id,n);else if(e.type===t.OBSERVER_TYPE.REMOVE){this.increaseAsyncId(r);const t=this.imgs[e.gameObject.id];this.containerManager.getContainer(e.gameObject.id).removeChild(t.tilingSprite),t.tilingSprite.destroy({children:!0}),delete this.imgs[e.gameObject.id]}}})}setProp(e,t){this.imgs[e].tilingSprite.tilePosition=t.tilePosition,this.imgs[e].tilingSprite.tileScale=t.tileScale}};b=c([t.decorators.componentObserver({TilingSprite:[{prop:["resource"],deep:!1},{prop:["tileScale"],deep:!0},{prop:["tilePosition"],deep:!0}]})],b);var O=b;return e.TilingSprite=m,e.TilingSpriteSystem=O,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.plugin.renderer,EVA.rendererAdapter);globalThis.EVA.plugin.renderer.tilingSprite=globalThis.EVA.plugin.renderer.tilingSprite||_EVA_IIFE_tilingSprite;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eva/plugin-renderer-tiling-sprite",
3
- "version": "2.1.0-beta.13",
3
+ "version": "2.1.0-beta.15",
4
4
  "description": "@eva/plugin-renderer-tiling-sprite",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-renderer-tiling-sprite.esm.js",
@@ -19,8 +19,8 @@
19
19
  "homepage": "https://eva.js.org",
20
20
  "dependencies": {
21
21
  "@eva/inspector-decorator": "^2.0.0-beta.0",
22
- "@eva/plugin-renderer": "2.1.0-beta.13",
23
- "@eva/renderer-adapter": "2.1.0-beta.13",
24
- "@eva/eva.js": "2.1.0-beta.13"
22
+ "@eva/plugin-renderer": "2.1.0-beta.15",
23
+ "@eva/renderer-adapter": "2.1.0-beta.15",
24
+ "@eva/eva.js": "2.1.0-beta.15"
25
25
  }
26
26
  }