@eva/plugin-renderer-spine 1.2.7-editor.0 → 1.2.7-editor.3

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.
@@ -4,9 +4,180 @@ window.EVA = window.EVA || {};
4
4
  window.EVA.plugin = window.EVA.plugin || {};
5
5
  window.EVA.plugin.renderer = window.EVA.plugin.renderer || {};
6
6
 
7
- var _EVA_IIFE_spine = function (exports, pixi_js, eva_js, pluginRenderer) {
7
+ var _EVA_IIFE_spine = function (exports, eva_js, pluginRenderer, pixi_js) {
8
8
  'use strict';
9
9
 
10
+ var _extendStatics$ = function extendStatics$2(d, b) {
11
+ _extendStatics$ = Object.setPrototypeOf || {
12
+ __proto__: []
13
+ } instanceof Array && function (d, b) {
14
+ d.__proto__ = b;
15
+ } || function (d, b) {
16
+ for (var p in b) {
17
+ if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
18
+ }
19
+ };
20
+
21
+ return _extendStatics$(d, b);
22
+ };
23
+
24
+ function __extends$3(d, b) {
25
+ if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
26
+
27
+ _extendStatics$(d, b);
28
+
29
+ function __() {
30
+ this.constructor = d;
31
+ }
32
+
33
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34
+ }
35
+
36
+ var _extendStatics$2 = function extendStatics$1(d, b) {
37
+ _extendStatics$2 = Object.setPrototypeOf || {
38
+ __proto__: []
39
+ } instanceof Array && function (d, b) {
40
+ d.__proto__ = b;
41
+ } || function (d, b) {
42
+ for (var p in b) {
43
+ if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
44
+ }
45
+ };
46
+
47
+ return _extendStatics$2(d, b);
48
+ };
49
+
50
+ function __extends$2(d, b) {
51
+ if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
52
+
53
+ _extendStatics$2(d, b);
54
+
55
+ function __() {
56
+ this.constructor = d;
57
+ }
58
+
59
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
60
+ }
61
+
62
+ var _assign = function __assign() {
63
+ _assign = Object.assign || function __assign(t) {
64
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
65
+ s = arguments[i];
66
+
67
+ for (var p in s) {
68
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
69
+ }
70
+ }
71
+
72
+ return t;
73
+ };
74
+
75
+ return _assign.apply(this, arguments);
76
+ };
77
+
78
+ var SymbolKeysNotSupportedError = function (_super) {
79
+ __extends$2(SymbolKeysNotSupportedError, _super);
80
+
81
+ function SymbolKeysNotSupportedError() {
82
+ var _newTarget = this.constructor;
83
+
84
+ var _this = _super.call(this, 'Symbol keys are not supported yet!') || this;
85
+
86
+ Object.setPrototypeOf(_this, _newTarget.prototype);
87
+ return _this;
88
+ }
89
+
90
+ return SymbolKeysNotSupportedError;
91
+ }(Error);
92
+
93
+ (function (_super) {
94
+ __extends$2(StaticGetPropertiesIsNotAFunctionError, _super);
95
+
96
+ function StaticGetPropertiesIsNotAFunctionError() {
97
+ var _newTarget = this.constructor;
98
+
99
+ var _this = _super.call(this, 'getProperties is not a function!') || this;
100
+
101
+ Object.setPrototypeOf(_this, _newTarget.prototype);
102
+ return _this;
103
+ }
104
+
105
+ return StaticGetPropertiesIsNotAFunctionError;
106
+ })(Error);
107
+
108
+ var IDE_PROPERTY_METADATA = 'IDE_PROPERTY_METADATA';
109
+
110
+ function transformBasicType(type) {
111
+ if (type === String) {
112
+ return 'string';
113
+ }
114
+
115
+ if (type === Number) {
116
+ return 'number';
117
+ }
118
+
119
+ if (type === Boolean) {
120
+ return 'boolean';
121
+ }
122
+
123
+ return 'unknown';
124
+ }
125
+
126
+ function defineTypes(target, key, options, returnTypeFunction) {
127
+ var type = Reflect.getMetadata('design:type', target, key);
128
+ var isArray = type === Array;
129
+ var str = transformBasicType(type);
130
+
131
+ if (str !== 'unknown') {
132
+ type = str;
133
+ }
134
+
135
+ if (returnTypeFunction) {
136
+ var returnType = returnTypeFunction();
137
+
138
+ if (Array.isArray(returnType)) {
139
+ isArray = true;
140
+ type = returnType[0];
141
+ } else {
142
+ type = returnType;
143
+ }
144
+ }
145
+
146
+ var properties = Reflect.getMetadata(IDE_PROPERTY_METADATA, target.constructor) || {};
147
+ properties[key] = _assign({
148
+ type: type,
149
+ isArray: isArray
150
+ }, options);
151
+ Reflect.defineMetadata(IDE_PROPERTY_METADATA, properties, target.constructor);
152
+ }
153
+
154
+ function getTypeDecoratorParams(returnTypeFuncOrOptions, maybeOptions) {
155
+ if (typeof returnTypeFuncOrOptions === 'function') {
156
+ return {
157
+ returnTypeFunc: returnTypeFuncOrOptions,
158
+ options: maybeOptions || {}
159
+ };
160
+ }
161
+
162
+ return {
163
+ options: returnTypeFuncOrOptions || {}
164
+ };
165
+ }
166
+
167
+ function Field(returnTypeFunction, maybeOptions) {
168
+ return function (target, propertyKey) {
169
+ if (typeof propertyKey === 'symbol') {
170
+ throw new SymbolKeysNotSupportedError();
171
+ }
172
+
173
+ var _a = getTypeDecoratorParams(returnTypeFunction, maybeOptions),
174
+ options = _a.options,
175
+ returnTypeFunc = _a.returnTypeFunc;
176
+
177
+ defineTypes(target, propertyKey, options, returnTypeFunc);
178
+ };
179
+ }
180
+
10
181
  var _extendStatics = function extendStatics(d, b) {
11
182
  _extendStatics = Object.setPrototypeOf || {
12
183
  __proto__: []
@@ -41,13 +212,11 @@ var _EVA_IIFE_spine = function (exports, pixi_js, eva_js, pluginRenderer) {
41
212
  return c > 3 && r && Object.defineProperty(target, key, r), r;
42
213
  }
43
214
 
44
- function __awaiter(thisArg, _arguments, P, generator) {
45
- function adopt(value) {
46
- return value instanceof P ? value : new P(function (resolve) {
47
- resolve(value);
48
- });
49
- }
215
+ function __metadata(metadataKey, metadataValue) {
216
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
217
+ }
50
218
 
219
+ function __awaiter(thisArg, _arguments, P, generator) {
51
220
  return new (P || (P = Promise))(function (resolve, reject) {
52
221
  function fulfilled(value) {
53
222
  try {
@@ -66,7 +235,9 @@ var _EVA_IIFE_spine = function (exports, pixi_js, eva_js, pluginRenderer) {
66
235
  }
67
236
 
68
237
  function step(result) {
69
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
238
+ result.done ? resolve(result.value) : new P(function (resolve) {
239
+ resolve(result.value);
240
+ }).then(fulfilled, rejected);
70
241
  }
71
242
 
72
243
  step((generator = generator.apply(thisArg, _arguments || [])).next());
@@ -185,11 +356,10 @@ var _EVA_IIFE_spine = function (exports, pixi_js, eva_js, pluginRenderer) {
185
356
  }
186
357
 
187
358
  function __values(o) {
188
- var s = typeof Symbol === "function" && Symbol.iterator,
189
- m = s && o[s],
359
+ var m = typeof Symbol === "function" && o[Symbol.iterator],
190
360
  i = 0;
191
361
  if (m) return m.call(o);
192
- if (o && typeof o.length === "number") return {
362
+ return {
193
363
  next: function next() {
194
364
  if (o && i >= o.length) o = void 0;
195
365
  return {
@@ -198,28 +368,6 @@ var _EVA_IIFE_spine = function (exports, pixi_js, eva_js, pluginRenderer) {
198
368
  };
199
369
  }
200
370
  };
201
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
202
- }
203
-
204
- function getIDEPropsPropertyObj(target, propertyKey) {
205
- if (!target.constructor.IDEProps) {
206
- target.constructor.IDEProps = {};
207
- }
208
-
209
- if (!target.constructor.IDEProps[propertyKey]) {
210
- target.constructor.IDEProps[propertyKey] = {};
211
- }
212
-
213
- var propertyObj = target.constructor.IDEProps[propertyKey];
214
- return propertyObj;
215
- }
216
-
217
- function type(type) {
218
- return function (target, propertyKey) {
219
- var prop = getIDEPropsPropertyObj(target, propertyKey);
220
- prop.key = propertyKey;
221
- prop.type = type;
222
- };
223
371
  }
224
372
 
225
373
  var Spine$2 = function (_super) {
@@ -387,16 +535,18 @@ var _EVA_IIFE_spine = function (exports, pixi_js, eva_js, pluginRenderer) {
387
535
 
388
536
  Spine.componentName = 'Spine';
389
537
 
390
- __decorate([type('string')], Spine.prototype, "resource", void 0);
538
+ __decorate([Field({
539
+ type: 'resource'
540
+ }), __metadata("design:type", String)], Spine.prototype, "resource", void 0);
391
541
 
392
- __decorate([type('string')], Spine.prototype, "animationName", void 0);
542
+ __decorate([Field(), __metadata("design:type", String)], Spine.prototype, "animationName", void 0);
393
543
 
394
- __decorate([type('boolean')], Spine.prototype, "autoPlay", void 0);
544
+ __decorate([Field(), __metadata("design:type", Boolean)], Spine.prototype, "autoPlay", void 0);
395
545
 
396
546
  return Spine;
397
547
  }(eva_js.Component);
398
548
 
399
- var SpineBase = Spine$2;
549
+ var Spine$1$1 = Spine$2;
400
550
  var texCache = {};
401
551
 
402
552
  function cacheImage(data) {
@@ -544,21 +694,21 @@ var _EVA_IIFE_spine = function (exports, pixi_js, eva_js, pluginRenderer) {
544
694
  var obj = objs[i];
545
695
 
546
696
  if (obj.id === id) {
547
- var sp = obj.getComponent(SpineBase);
697
+ var sp = obj.getComponent(Spine$1$1);
548
698
 
549
699
  if (sp) {
550
700
  _this.remove({
551
701
  type: eva_js.OBSERVER_TYPE.REMOVE,
552
702
  gameObject: obj,
553
703
  component: sp,
554
- componentName: SpineBase.componentName
704
+ componentName: Spine$1$1.componentName
555
705
  });
556
706
 
557
707
  toAdd.push({
558
708
  type: eva_js.OBSERVER_TYPE.ADD,
559
709
  gameObject: obj,
560
710
  component: sp,
561
- componentName: SpineBase.componentName
711
+ componentName: Spine$1$1.componentName
562
712
  });
563
713
  }
564
714
 
@@ -761,7 +911,8 @@ var _EVA_IIFE_spine = function (exports, pixi_js, eva_js, pluginRenderer) {
761
911
  return SpineSystem;
762
912
  }(pluginRenderer.Renderer);
763
913
 
764
- var SpineSystemBase = SpineSystem$2;
914
+ var SpineSystem$1$1 = SpineSystem$2;
915
+ eva_js.resource.registerResourceType('SPINE');
765
916
  var VERSION = '4.8.9';
766
917
  var loader = pixi_js.loaders.shared;
767
918
  var PIXI = {
@@ -9557,9 +9708,9 @@ var _EVA_IIFE_spine = function (exports, pixi_js, eva_js, pluginRenderer) {
9557
9708
  var cachedResource = loader.resources[name];
9558
9709
 
9559
9710
  if (cachedResource) {
9560
- var done = function done() {
9711
+ function done() {
9561
9712
  callback(cachedResource.texture.baseTexture);
9562
- };
9713
+ }
9563
9714
 
9564
9715
  if (cachedResource.texture) {
9565
9716
  done();
@@ -9610,7 +9761,7 @@ var _EVA_IIFE_spine = function (exports, pixi_js, eva_js, pluginRenderer) {
9610
9761
  var pixiSpine = pixi_spine;
9611
9762
 
9612
9763
  var SpineSystem = function (_super) {
9613
- __extends$1(SpineSystem, _super);
9764
+ __extends$3(SpineSystem, _super);
9614
9765
 
9615
9766
  function SpineSystem() {
9616
9767
  return _super !== null && _super.apply(this, arguments) || this;
@@ -9623,19 +9774,19 @@ var _EVA_IIFE_spine = function (exports, pixi_js, eva_js, pluginRenderer) {
9623
9774
  };
9624
9775
 
9625
9776
  return SpineSystem;
9626
- }(SpineSystemBase);
9777
+ }(SpineSystem$1$1);
9627
9778
 
9628
9779
  var SpineSystem$1 = SpineSystem;
9629
9780
 
9630
9781
  var Spine = function (_super) {
9631
- __extends$1(Spine, _super);
9782
+ __extends$3(Spine, _super);
9632
9783
 
9633
9784
  function Spine() {
9634
9785
  return _super !== null && _super.apply(this, arguments) || this;
9635
9786
  }
9636
9787
 
9637
9788
  return Spine;
9638
- }(SpineBase);
9789
+ }(Spine$1$1);
9639
9790
 
9640
9791
  var Spine$1 = Spine;
9641
9792
  exports.Spine = Spine$1;
@@ -9644,6 +9795,6 @@ var _EVA_IIFE_spine = function (exports, pixi_js, eva_js, pluginRenderer) {
9644
9795
  value: true
9645
9796
  });
9646
9797
  return exports;
9647
- }({}, PIXI, EVA, EVA.plugin.renderer);
9798
+ }({}, EVA, EVA.plugin.renderer, PIXI);
9648
9799
 
9649
9800
  window.EVA.plugin.renderer.spine = window.EVA.plugin.renderer.spine || _EVA_IIFE_spine;