@eva/plugin-renderer-text 1.2.7-editor.0 → 1.2.7-editor.11

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.
@@ -14,7 +14,7 @@ var _EVA_IIFE_text = function (exports, pixi_js, eva_js, pluginRenderer, rendere
14
14
  d.__proto__ = b;
15
15
  } || function (d, b) {
16
16
  for (var p in b) {
17
- if (b.hasOwnProperty(p)) d[p] = b[p];
17
+ if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
18
18
  }
19
19
  };
20
20
 
@@ -22,6 +22,8 @@ var _EVA_IIFE_text = function (exports, pixi_js, eva_js, pluginRenderer, rendere
22
22
  };
23
23
 
24
24
  function __extends(d, b) {
25
+ if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
26
+
25
27
  _extendStatics(d, b);
26
28
 
27
29
  function __() {
@@ -31,6 +33,22 @@ var _EVA_IIFE_text = function (exports, pixi_js, eva_js, pluginRenderer, rendere
31
33
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
32
34
  }
33
35
 
36
+ var _assign = function __assign() {
37
+ _assign = Object.assign || function __assign(t) {
38
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
39
+ s = arguments[i];
40
+
41
+ for (var p in s) {
42
+ if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
43
+ }
44
+ }
45
+
46
+ return t;
47
+ };
48
+
49
+ return _assign.apply(this, arguments);
50
+ };
51
+
34
52
  function __decorate(decorators, target, key, desc) {
35
53
  var c = arguments.length,
36
54
  r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
@@ -41,6 +59,10 @@ var _EVA_IIFE_text = function (exports, pixi_js, eva_js, pluginRenderer, rendere
41
59
  return c > 3 && r && Object.defineProperty(target, key, r), r;
42
60
  }
43
61
 
62
+ function __metadata(metadataKey, metadataValue) {
63
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
64
+ }
65
+
44
66
  function __awaiter(thisArg, _arguments, P, generator) {
45
67
  function adopt(value) {
46
68
  return value instanceof P ? value : new P(function (resolve) {
@@ -184,27 +206,344 @@ var _EVA_IIFE_text = function (exports, pixi_js, eva_js, pluginRenderer, rendere
184
206
  }
185
207
  }
186
208
 
187
- function getIDEPropsPropertyObj(target, propertyKey) {
188
- if (!target.constructor.IDEProps) {
189
- target.constructor.IDEProps = {};
209
+ var SymbolKeysNotSupportedError = function (_super) {
210
+ __extends(SymbolKeysNotSupportedError, _super);
211
+
212
+ function SymbolKeysNotSupportedError() {
213
+ var _newTarget = this.constructor;
214
+
215
+ var _this = _super.call(this, 'Symbol keys are not supported yet!') || this;
216
+
217
+ Object.setPrototypeOf(_this, _newTarget.prototype);
218
+ return _this;
219
+ }
220
+
221
+ return SymbolKeysNotSupportedError;
222
+ }(Error);
223
+
224
+ (function (_super) {
225
+ __extends(StaticGetPropertiesIsNotAFunctionError, _super);
226
+
227
+ function StaticGetPropertiesIsNotAFunctionError() {
228
+ var _newTarget = this.constructor;
229
+
230
+ var _this = _super.call(this, 'getProperties is not a function!') || this;
231
+
232
+ Object.setPrototypeOf(_this, _newTarget.prototype);
233
+ return _this;
234
+ }
235
+
236
+ return StaticGetPropertiesIsNotAFunctionError;
237
+ })(Error);
238
+
239
+ var IDE_PROPERTY_METADATA = 'IDE_PROPERTY_METADATA';
240
+
241
+ function transformBasicType(type) {
242
+ if (type === String) {
243
+ return 'string';
244
+ }
245
+
246
+ if (type === Number) {
247
+ return 'number';
248
+ }
249
+
250
+ if (type === Boolean) {
251
+ return 'boolean';
252
+ }
253
+
254
+ return 'unknown';
255
+ }
256
+
257
+ function defineTypes(target, key, options, returnTypeFunction) {
258
+ var type = Reflect.getMetadata('design:type', target, key);
259
+ var isArray = type === Array;
260
+ var str = transformBasicType(type);
261
+
262
+ if (str !== 'unknown') {
263
+ type = str;
190
264
  }
191
265
 
192
- if (!target.constructor.IDEProps[propertyKey]) {
193
- target.constructor.IDEProps[propertyKey] = {};
266
+ if (returnTypeFunction) {
267
+ var returnType = returnTypeFunction();
268
+
269
+ if (Array.isArray(returnType)) {
270
+ isArray = true;
271
+ type = returnType[0];
272
+ } else {
273
+ type = returnType;
274
+ }
194
275
  }
195
276
 
196
- var propertyObj = target.constructor.IDEProps[propertyKey];
197
- return propertyObj;
277
+ var properties = Reflect.getMetadata(IDE_PROPERTY_METADATA, target.constructor) || {};
278
+ properties[key] = _assign({
279
+ type: type,
280
+ isArray: isArray
281
+ }, options);
282
+ Reflect.defineMetadata(IDE_PROPERTY_METADATA, properties, target.constructor);
198
283
  }
199
284
 
200
- function type(type) {
285
+ function getTypeDecoratorParams(returnTypeFuncOrOptions, maybeOptions) {
286
+ if (typeof returnTypeFuncOrOptions === 'function') {
287
+ return {
288
+ returnTypeFunc: returnTypeFuncOrOptions,
289
+ options: maybeOptions || {}
290
+ };
291
+ }
292
+
293
+ return {
294
+ options: returnTypeFuncOrOptions || {}
295
+ };
296
+ }
297
+
298
+ function Field(returnTypeFunction, maybeOptions) {
201
299
  return function (target, propertyKey) {
202
- var prop = getIDEPropsPropertyObj(target, propertyKey);
203
- prop.key = propertyKey;
204
- prop.type = type;
300
+ if (typeof propertyKey === 'symbol') {
301
+ throw new SymbolKeysNotSupportedError();
302
+ }
303
+
304
+ var _a = getTypeDecoratorParams(returnTypeFunction, maybeOptions),
305
+ options = _a.options,
306
+ returnTypeFunc = _a.returnTypeFunc;
307
+
308
+ defineTypes(target, propertyKey, options, returnTypeFunc);
205
309
  };
206
310
  }
207
311
 
312
+ var ExecuteMode;
313
+
314
+ (function (ExecuteMode) {
315
+ ExecuteMode[ExecuteMode["Edit"] = 2] = "Edit";
316
+ ExecuteMode[ExecuteMode["Game"] = 4] = "Game";
317
+ ExecuteMode[ExecuteMode["All"] = 6] = "All";
318
+ })(ExecuteMode || (ExecuteMode = {}));
319
+
320
+ var Style = function () {
321
+ function Style() {}
322
+
323
+ __decorate([Field({
324
+ type: 'select',
325
+ options: [{
326
+ key: 'center',
327
+ value: 'center'
328
+ }, {
329
+ key: 'left',
330
+ value: 'left'
331
+ }, {
332
+ key: 'right',
333
+ value: 'right'
334
+ }],
335
+ default: 'left'
336
+ }), __metadata("design:type", String)], Style.prototype, "align", void 0);
337
+
338
+ __decorate([Field(), __metadata("design:type", Boolean)], Style.prototype, "breakWords", void 0);
339
+
340
+ __decorate([Field(), __metadata("design:type", Boolean)], Style.prototype, "dropShadow", void 0);
341
+
342
+ __decorate([Field({
343
+ default: 1
344
+ }), __metadata("design:type", Number)], Style.prototype, "dropShadowAlpha", void 0);
345
+
346
+ __decorate([Field({
347
+ default: Math.PI / 6
348
+ }), __metadata("design:type", Number)], Style.prototype, "dropShadowAngle", void 0);
349
+
350
+ __decorate([Field({
351
+ default: 0
352
+ }), __metadata("design:type", Number)], Style.prototype, "dropShadowBlur", void 0);
353
+
354
+ __decorate([Field({
355
+ type: 'color',
356
+ default: '#000000'
357
+ }), __metadata("design:type", Object)], Style.prototype, "dropShadowColor", void 0);
358
+
359
+ __decorate([Field({
360
+ default: 5
361
+ }), __metadata("design:type", Number)], Style.prototype, "dropShadowDistance", void 0);
362
+
363
+ __decorate([Field({
364
+ type: 'color',
365
+ default: ['#000000'],
366
+ isArray: true
367
+ }), __metadata("design:type", Object)], Style.prototype, "fill", void 0);
368
+
369
+ __decorate([Field({
370
+ type: 'select',
371
+ options: [{
372
+ key: 1,
373
+ value: 'vertical'
374
+ }, {
375
+ key: 0,
376
+ value: 'horizontal'
377
+ }],
378
+ default: 1
379
+ }), __metadata("design:type", Number)], Style.prototype, "fillGradientType", void 0);
380
+
381
+ __decorate([Field(function () {
382
+ return Number;
383
+ }, {
384
+ step: 0.1,
385
+ min: 0,
386
+ max: 1
387
+ }), __metadata("design:type", Array)], Style.prototype, "fillGradientStops", void 0);
388
+
389
+ __decorate([Field(function () {
390
+ return String;
391
+ }, {
392
+ default: 'Arial'
393
+ }), __metadata("design:type", Object)], Style.prototype, "fontFamily", void 0);
394
+
395
+ __decorate([Field(function () {
396
+ return Number;
397
+ }, {
398
+ min: 5,
399
+ default: 26
400
+ }), __metadata("design:type", Object)], Style.prototype, "fontSize", void 0);
401
+
402
+ __decorate([Field({
403
+ type: 'select',
404
+ options: [{
405
+ key: 'normal',
406
+ value: 'normal'
407
+ }, {
408
+ key: 'italic',
409
+ value: 'italic'
410
+ }, {
411
+ key: 'oblique',
412
+ value: 'oblique'
413
+ }],
414
+ default: 'normal'
415
+ }), __metadata("design:type", String)], Style.prototype, "fontStyle", void 0);
416
+
417
+ __decorate([Field({
418
+ type: 'select',
419
+ options: [{
420
+ key: 'normal',
421
+ value: 'normal'
422
+ }, {
423
+ key: 'small-caps',
424
+ value: 'small-caps'
425
+ }],
426
+ default: 'normal'
427
+ }), __metadata("design:type", String)], Style.prototype, "fontVariant", void 0);
428
+
429
+ __decorate([Field({
430
+ type: 'select',
431
+ options: [{
432
+ key: 'normal',
433
+ value: 'normal'
434
+ }, {
435
+ key: 'bold',
436
+ value: 'bold'
437
+ }, {
438
+ key: 'bolder',
439
+ value: 'bolder'
440
+ }, {
441
+ key: 'lighter',
442
+ value: 'lighter'
443
+ }, {
444
+ key: '100',
445
+ value: '100'
446
+ }, {
447
+ key: '200',
448
+ value: '200'
449
+ }, {
450
+ key: '300',
451
+ value: '300'
452
+ }, {
453
+ key: '400',
454
+ value: '400'
455
+ }, {
456
+ key: '500',
457
+ value: '500'
458
+ }, {
459
+ key: '600',
460
+ value: '600'
461
+ }, {
462
+ key: '700',
463
+ value: '700'
464
+ }, {
465
+ key: '800',
466
+ value: '800'
467
+ }, {
468
+ key: '900',
469
+ value: '900'
470
+ }],
471
+ default: 'normal'
472
+ }), __metadata("design:type", String)], Style.prototype, "fontWeight", void 0);
473
+
474
+ __decorate([Field({
475
+ default: 0
476
+ }), __metadata("design:type", Number)], Style.prototype, "letterSpacing", void 0);
477
+
478
+ __decorate([Field({
479
+ default: 0
480
+ }), __metadata("design:type", Number)], Style.prototype, "lineHeight", void 0);
481
+
482
+ __decorate([Field({
483
+ type: 'select',
484
+ options: [{
485
+ key: 'miter',
486
+ value: 'miter'
487
+ }, {
488
+ key: 'round',
489
+ value: 'round'
490
+ }, {
491
+ key: 'bevel',
492
+ value: 'bevel'
493
+ }],
494
+ default: 'miter'
495
+ }), __metadata("design:type", String)], Style.prototype, "lineJoin", void 0);
496
+
497
+ __decorate([Field({
498
+ default: 10
499
+ }), __metadata("design:type", Number)], Style.prototype, "miterLimit", void 0);
500
+
501
+ __decorate([Field({
502
+ default: 0
503
+ }), __metadata("design:type", Number)], Style.prototype, "padding", void 0);
504
+
505
+ __decorate([Field({
506
+ type: 'color',
507
+ default: '#000000'
508
+ }), __metadata("design:type", Object)], Style.prototype, "stroke", void 0);
509
+
510
+ __decorate([Field({
511
+ default: 0,
512
+ min: 0
513
+ }), __metadata("design:type", Number)], Style.prototype, "strokeThickness", void 0);
514
+
515
+ __decorate([Field({
516
+ default: 'alphabetic'
517
+ }), __metadata("design:type", String)], Style.prototype, "textBaseline", void 0);
518
+
519
+ __decorate([Field(), __metadata("design:type", Boolean)], Style.prototype, "trim", void 0);
520
+
521
+ __decorate([Field({
522
+ default: 'pre',
523
+ type: 'select',
524
+ options: [{
525
+ key: 'normal',
526
+ value: 'normal'
527
+ }, {
528
+ key: 'pre',
529
+ value: 'pre'
530
+ }, {
531
+ key: 'pre-line',
532
+ value: 'pre-line'
533
+ }]
534
+ }), __metadata("design:type", String)], Style.prototype, "whiteSpace", void 0);
535
+
536
+ __decorate([Field(), __metadata("design:type", Boolean)], Style.prototype, "wordWrap", void 0);
537
+
538
+ __decorate([Field({
539
+ default: 100
540
+ }), __metadata("design:type", Number)], Style.prototype, "wordWrapWidth", void 0);
541
+
542
+ __decorate([Field(), __metadata("design:type", Number)], Style.prototype, "leading", void 0);
543
+
544
+ return Style;
545
+ }();
546
+
208
547
  var Text$2 = function (_super) {
209
548
  __extends(Text, _super);
210
549
 
@@ -239,7 +578,9 @@ var _EVA_IIFE_text = function (exports, pixi_js, eva_js, pluginRenderer, rendere
239
578
 
240
579
  Text.componentName = 'Text';
241
580
 
242
- __decorate([type('string')], Text.prototype, "text", void 0);
581
+ __decorate([Field(), __metadata("design:type", String)], Text.prototype, "text", void 0);
582
+
583
+ __decorate([Field(), __metadata("design:type", Style)], Text.prototype, "style", void 0);
243
584
 
244
585
  return Text;
245
586
  }(eva_js.Component);
@@ -1 +1 @@
1
- function _extends(){return(_extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{},window.EVA.plugin.renderer=window.EVA.plugin.renderer||{};var _EVA_IIFE_text=function(t,e,n,r,o){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function c(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function s(t,e,n,r){var o,i=arguments.length,c=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(c=(i<3?o(c):i>3?o(e,n,c):o(e,n))||c);return i>3&&c&&Object.defineProperty(e,n,c),c}function a(t,e,n,r){return new(n||(n=Promise))((function(o,i){function c(t){try{a(r.next(t))}catch(t){i(t)}}function s(t){try{a(r.throw(t))}catch(t){i(t)}}function a(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,s)}a((r=r.apply(t,e||[])).next())}))}function u(t,e){var n,r,o,i,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;c;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,r=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){c=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){c.label=i[1];break}if(6===i[0]&&c.label<o[1]){c.label=o[1],o=i;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(i);break}o[2]&&c.ops.pop(),c.trys.pop();continue}i=e.call(t,c)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function p(t){return function(e,n){var r=function(t,e){return t.constructor.IDEProps||(t.constructor.IDEProps={}),t.constructor.IDEProps[e]||(t.constructor.IDEProps[e]={}),t.constructor.IDEProps[e]}(e,n);r.key=n,r.type=t}}var l=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.text="",e.style={},e}return c(n,t),n.prototype.init=function(t){var n=new e.TextStyle({fontSize:20}),r={};for(var o in n)0===o.indexOf("_")&&(r[o.substring(1)]=n[o]);this.style=r,t&&(this.text=t.text,_extends(this.style,t.style))},n.componentName="Text",s([p("string")],n.prototype,"text",void 0),n}(n.Component),f=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="Text",e.texts={},e}return c(e,t),e.prototype.init=function(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)},e.prototype.componentChanged=function(t){return a(this,void 0,void 0,(function(){var e,r;return u(this,(function(i){return"Text"!==t.componentName||(t.type===n.OBSERVER_TYPE.ADD?(e=t.component,r=new o.Text(e.text,e.style),this.containerManager.getContainer(t.gameObject.id).addChildAt(r,0),this.texts[t.gameObject.id]={text:r,component:t.component},this.setSize(t)):t.type===n.OBSERVER_TYPE.REMOVE?(this.containerManager.getContainer(t.gameObject.id).removeChild(this.texts[t.gameObject.id].text),this.texts[t.gameObject.id].text.destroy({children:!0}),delete this.texts[t.gameObject.id]):(this.change(t),this.setSize(t))),[2]}))}))},e.prototype.change=function(t){var e=this.texts[t.gameObject.id],n=e.text,r=e.component;"text"===t.prop.prop[0]?n.text=r.text:"style"===t.prop.prop[0]&&_extends(n.style,t.component.style)},e.prototype.setSize=function(t){var e=t.gameObject.transform;e&&(e.size.width=this.texts[t.gameObject.id].text.width,e.size.height=this.texts[t.gameObject.id].text.height)},e.systemName="Text",e=s([n.decorators.componentObserver({Text:["text",{prop:["style"],deep:!0}]})],e)}(r.Renderer);return t.Text=l,t.TextSystem=f,Object.defineProperty(t,"__esModule",{value:!0}),t}({},PIXI,EVA,EVA.plugin.renderer,EVA.rendererAdapter);window.EVA.plugin.renderer.text=window.EVA.plugin.renderer.text||_EVA_IIFE_text;
1
+ function _extends(){return _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},_extends.apply(this,arguments)}window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{},window.EVA.plugin.renderer=window.EVA.plugin.renderer||{};var _EVA_IIFE_text=function(e,t,n,o,r){"use strict";var i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},i(e,t)};function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var p=function(){return p=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},p.apply(this,arguments)};function l(e,t,n,o){var r,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,o);else for(var p=e.length-1;p>=0;p--)(r=e[p])&&(a=(i<3?r(a):i>3?r(t,n,a):r(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function u(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function s(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function p(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,p)}l((o=o.apply(e,t||[])).next())}))}function y(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:p(0),throw:p(1),return:p(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function p(i){return function(p){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,p])}}}var d=function(e){function t(){var t=this.constructor,n=e.call(this,"Symbol keys are not supported yet!")||this;return Object.setPrototypeOf(n,t.prototype),n}return a(t,e),t}(Error);!function(e){function t(){var t=this.constructor,n=e.call(this,"getProperties is not a function!")||this;return Object.setPrototypeOf(n,t.prototype),n}a(t,e)}(Error);var c,f="IDE_PROPERTY_METADATA";function v(e,t,n,o){var r=Reflect.getMetadata("design:type",e,t),i=r===Array,a=function(e){return e===String?"string":e===Number?"number":e===Boolean?"boolean":"unknown"}(r);if("unknown"!==a&&(r=a),o){var l=o();Array.isArray(l)?(i=!0,r=l[0]):r=l}var u=Reflect.getMetadata(f,e.constructor)||{};u[t]=p({type:r,isArray:i},n),Reflect.defineMetadata(f,u,e.constructor)}function g(e,t){return function(n,o){if("symbol"==typeof o)throw new d;var r=function(e,t){return"function"==typeof e?{returnTypeFunc:e,options:t||{}}:{options:e||{}}}(e,t);v(n,o,r.options,r.returnTypeFunc)}}!function(e){e[e.Edit=2]="Edit",e[e.Game=4]="Game",e[e.All=6]="All"}(c||(c={}));var h=function(){function e(){}return l([g({type:"select",options:[{key:"center",value:"center"},{key:"left",value:"left"},{key:"right",value:"right"}],default:"left"}),u("design:type",String)],e.prototype,"align",void 0),l([g(),u("design:type",Boolean)],e.prototype,"breakWords",void 0),l([g(),u("design:type",Boolean)],e.prototype,"dropShadow",void 0),l([g({default:1}),u("design:type",Number)],e.prototype,"dropShadowAlpha",void 0),l([g({default:Math.PI/6}),u("design:type",Number)],e.prototype,"dropShadowAngle",void 0),l([g({default:0}),u("design:type",Number)],e.prototype,"dropShadowBlur",void 0),l([g({type:"color",default:"#000000"}),u("design:type",Object)],e.prototype,"dropShadowColor",void 0),l([g({default:5}),u("design:type",Number)],e.prototype,"dropShadowDistance",void 0),l([g({type:"color",default:["#000000"],isArray:!0}),u("design:type",Object)],e.prototype,"fill",void 0),l([g({type:"select",options:[{key:1,value:"vertical"},{key:0,value:"horizontal"}],default:1}),u("design:type",Number)],e.prototype,"fillGradientType",void 0),l([g((function(){return Number}),{step:.1,min:0,max:1}),u("design:type",Array)],e.prototype,"fillGradientStops",void 0),l([g((function(){return String}),{default:"Arial"}),u("design:type",Object)],e.prototype,"fontFamily",void 0),l([g((function(){return Number}),{min:5,default:26}),u("design:type",Object)],e.prototype,"fontSize",void 0),l([g({type:"select",options:[{key:"normal",value:"normal"},{key:"italic",value:"italic"},{key:"oblique",value:"oblique"}],default:"normal"}),u("design:type",String)],e.prototype,"fontStyle",void 0),l([g({type:"select",options:[{key:"normal",value:"normal"},{key:"small-caps",value:"small-caps"}],default:"normal"}),u("design:type",String)],e.prototype,"fontVariant",void 0),l([g({type:"select",options:[{key:"normal",value:"normal"},{key:"bold",value:"bold"},{key:"bolder",value:"bolder"},{key:"lighter",value:"lighter"},{key:"100",value:"100"},{key:"200",value:"200"},{key:"300",value:"300"},{key:"400",value:"400"},{key:"500",value:"500"},{key:"600",value:"600"},{key:"700",value:"700"},{key:"800",value:"800"},{key:"900",value:"900"}],default:"normal"}),u("design:type",String)],e.prototype,"fontWeight",void 0),l([g({default:0}),u("design:type",Number)],e.prototype,"letterSpacing",void 0),l([g({default:0}),u("design:type",Number)],e.prototype,"lineHeight",void 0),l([g({type:"select",options:[{key:"miter",value:"miter"},{key:"round",value:"round"},{key:"bevel",value:"bevel"}],default:"miter"}),u("design:type",String)],e.prototype,"lineJoin",void 0),l([g({default:10}),u("design:type",Number)],e.prototype,"miterLimit",void 0),l([g({default:0}),u("design:type",Number)],e.prototype,"padding",void 0),l([g({type:"color",default:"#000000"}),u("design:type",Object)],e.prototype,"stroke",void 0),l([g({default:0,min:0}),u("design:type",Number)],e.prototype,"strokeThickness",void 0),l([g({default:"alphabetic"}),u("design:type",String)],e.prototype,"textBaseline",void 0),l([g(),u("design:type",Boolean)],e.prototype,"trim",void 0),l([g({default:"pre",type:"select",options:[{key:"normal",value:"normal"},{key:"pre",value:"pre"},{key:"pre-line",value:"pre-line"}]}),u("design:type",String)],e.prototype,"whiteSpace",void 0),l([g(),u("design:type",Boolean)],e.prototype,"wordWrap",void 0),l([g({default:100}),u("design:type",Number)],e.prototype,"wordWrapWidth",void 0),l([g(),u("design:type",Number)],e.prototype,"leading",void 0),e}(),m=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.text="",t.style={},t}return a(n,e),n.prototype.init=function(e){var n=new t.TextStyle({fontSize:20}),o={};for(var r in n)0===r.indexOf("_")&&(o[r.substring(1)]=n[r]);this.style=o,e&&(this.text=e.text,_extends(this.style,e.style))},n.componentName="Text",l([g(),u("design:type",String)],n.prototype,"text",void 0),l([g(),u("design:type",h)],n.prototype,"style",void 0),n}(n.Component),b=m,w=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="Text",t.texts={},t}return a(t,e),t.prototype.init=function(){this.renderSystem=this.game.getSystem(o.RendererSystem),this.renderSystem.rendererManager.register(this)},t.prototype.componentChanged=function(e){return s(this,void 0,void 0,(function(){var t,o;return y(this,(function(i){return"Text"!==e.componentName||(e.type===n.OBSERVER_TYPE.ADD?(t=e.component,o=new r.Text(t.text,t.style),this.containerManager.getContainer(e.gameObject.id).addChildAt(o,0),this.texts[e.gameObject.id]={text:o,component:e.component},this.setSize(e)):e.type===n.OBSERVER_TYPE.REMOVE?(this.containerManager.getContainer(e.gameObject.id).removeChild(this.texts[e.gameObject.id].text),this.texts[e.gameObject.id].text.destroy({children:!0}),delete this.texts[e.gameObject.id]):(this.change(e),this.setSize(e))),[2]}))}))},t.prototype.change=function(e){var t=this.texts[e.gameObject.id],n=t.text,o=t.component;"text"===e.prop.prop[0]?n.text=o.text:"style"===e.prop.prop[0]&&_extends(n.style,e.component.style)},t.prototype.setSize=function(e){var t=e.gameObject.transform;t&&(t.size.width=this.texts[e.gameObject.id].text.width,t.size.height=this.texts[e.gameObject.id].text.height)},t.systemName="Text",t=l([n.decorators.componentObserver({Text:["text",{prop:["style"],deep:!0}]})],t)}(o.Renderer),x=w;return e.Text=b,e.TextSystem=x,Object.defineProperty(e,"__esModule",{value:!0}),e}({},PIXI,EVA,EVA.plugin.renderer,EVA.rendererAdapter);window.EVA.plugin.renderer.text=window.EVA.plugin.renderer.text||_EVA_IIFE_text;
@@ -44,6 +44,10 @@ function __decorate(decorators, target, key, desc) {
44
44
  return c > 3 && r && Object.defineProperty(target, key, r), r;
45
45
  }
46
46
 
47
+ function __metadata(metadataKey, metadataValue) {
48
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
49
+ }
50
+
47
51
  function __awaiter(thisArg, _arguments, P, generator) {
48
52
  return new (P || (P = Promise))(function (resolve, reject) {
49
53
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -81,6 +85,191 @@ function __generator(thisArg, body) {
81
85
  }
82
86
  }
83
87
 
88
+ var Style = (function () {
89
+ function Style() {
90
+ }
91
+ __decorate([
92
+ inspectorDecorator.Field({
93
+ type: 'select',
94
+ options: [
95
+ { key: 'center', value: 'center' },
96
+ { key: 'left', value: 'left' },
97
+ { key: 'right', value: 'right' },
98
+ ],
99
+ default: 'left',
100
+ }),
101
+ __metadata("design:type", String)
102
+ ], Style.prototype, "align", void 0);
103
+ __decorate([
104
+ inspectorDecorator.Field(),
105
+ __metadata("design:type", Boolean)
106
+ ], Style.prototype, "breakWords", void 0);
107
+ __decorate([
108
+ inspectorDecorator.Field(),
109
+ __metadata("design:type", Boolean)
110
+ ], Style.prototype, "dropShadow", void 0);
111
+ __decorate([
112
+ inspectorDecorator.Field({ default: 1 }),
113
+ __metadata("design:type", Number)
114
+ ], Style.prototype, "dropShadowAlpha", void 0);
115
+ __decorate([
116
+ inspectorDecorator.Field({ default: Math.PI / 6 }),
117
+ __metadata("design:type", Number)
118
+ ], Style.prototype, "dropShadowAngle", void 0);
119
+ __decorate([
120
+ inspectorDecorator.Field({ default: 0 }),
121
+ __metadata("design:type", Number)
122
+ ], Style.prototype, "dropShadowBlur", void 0);
123
+ __decorate([
124
+ inspectorDecorator.Field({ type: 'color', default: '#000000' }),
125
+ __metadata("design:type", Object)
126
+ ], Style.prototype, "dropShadowColor", void 0);
127
+ __decorate([
128
+ inspectorDecorator.Field({ default: 5 }),
129
+ __metadata("design:type", Number)
130
+ ], Style.prototype, "dropShadowDistance", void 0);
131
+ __decorate([
132
+ inspectorDecorator.Field({ type: 'color', default: ['#000000'], isArray: true }),
133
+ __metadata("design:type", Object)
134
+ ], Style.prototype, "fill", void 0);
135
+ __decorate([
136
+ inspectorDecorator.Field({
137
+ type: 'select',
138
+ options: [
139
+ { key: 1, value: 'vertical' },
140
+ { key: 0, value: 'horizontal' },
141
+ ],
142
+ default: 1,
143
+ }),
144
+ __metadata("design:type", Number)
145
+ ], Style.prototype, "fillGradientType", void 0);
146
+ __decorate([
147
+ inspectorDecorator.Field(function () { return Number; }, { step: 0.1, min: 0, max: 1 }),
148
+ __metadata("design:type", Array)
149
+ ], Style.prototype, "fillGradientStops", void 0);
150
+ __decorate([
151
+ inspectorDecorator.Field(function () { return String; }, { default: 'Arial' }),
152
+ __metadata("design:type", Object)
153
+ ], Style.prototype, "fontFamily", void 0);
154
+ __decorate([
155
+ inspectorDecorator.Field(function () { return Number; }, { min: 5, default: 26 }),
156
+ __metadata("design:type", Object)
157
+ ], Style.prototype, "fontSize", void 0);
158
+ __decorate([
159
+ inspectorDecorator.Field({
160
+ type: 'select',
161
+ options: [
162
+ { key: 'normal', value: 'normal' },
163
+ { key: 'italic', value: 'italic' },
164
+ { key: 'oblique', value: 'oblique' },
165
+ ],
166
+ default: 'normal',
167
+ }),
168
+ __metadata("design:type", String)
169
+ ], Style.prototype, "fontStyle", void 0);
170
+ __decorate([
171
+ inspectorDecorator.Field({
172
+ type: 'select',
173
+ options: [
174
+ { key: 'normal', value: 'normal' },
175
+ { key: 'small-caps', value: 'small-caps' },
176
+ ],
177
+ default: 'normal',
178
+ }),
179
+ __metadata("design:type", String)
180
+ ], Style.prototype, "fontVariant", void 0);
181
+ __decorate([
182
+ inspectorDecorator.Field({
183
+ type: 'select',
184
+ options: [
185
+ { key: 'normal', value: 'normal' },
186
+ { key: 'bold', value: 'bold' },
187
+ { key: 'bolder', value: 'bolder' },
188
+ { key: 'lighter', value: 'lighter' },
189
+ { key: '100', value: '100' },
190
+ { key: '200', value: '200' },
191
+ { key: '300', value: '300' },
192
+ { key: '400', value: '400' },
193
+ { key: '500', value: '500' },
194
+ { key: '600', value: '600' },
195
+ { key: '700', value: '700' },
196
+ { key: '800', value: '800' },
197
+ { key: '900', value: '900' },
198
+ ],
199
+ default: 'normal',
200
+ }),
201
+ __metadata("design:type", String)
202
+ ], Style.prototype, "fontWeight", void 0);
203
+ __decorate([
204
+ inspectorDecorator.Field({ default: 0 }),
205
+ __metadata("design:type", Number)
206
+ ], Style.prototype, "letterSpacing", void 0);
207
+ __decorate([
208
+ inspectorDecorator.Field({ default: 0 }),
209
+ __metadata("design:type", Number)
210
+ ], Style.prototype, "lineHeight", void 0);
211
+ __decorate([
212
+ inspectorDecorator.Field({
213
+ type: 'select',
214
+ options: [
215
+ { key: 'miter', value: 'miter' },
216
+ { key: 'round', value: 'round' },
217
+ { key: 'bevel', value: 'bevel' },
218
+ ],
219
+ default: 'miter',
220
+ }),
221
+ __metadata("design:type", String)
222
+ ], Style.prototype, "lineJoin", void 0);
223
+ __decorate([
224
+ inspectorDecorator.Field({ default: 10 }),
225
+ __metadata("design:type", Number)
226
+ ], Style.prototype, "miterLimit", void 0);
227
+ __decorate([
228
+ inspectorDecorator.Field({ default: 0 }),
229
+ __metadata("design:type", Number)
230
+ ], Style.prototype, "padding", void 0);
231
+ __decorate([
232
+ inspectorDecorator.Field({ type: 'color', default: '#000000' }),
233
+ __metadata("design:type", Object)
234
+ ], Style.prototype, "stroke", void 0);
235
+ __decorate([
236
+ inspectorDecorator.Field({ default: 0, min: 0 }),
237
+ __metadata("design:type", Number)
238
+ ], Style.prototype, "strokeThickness", void 0);
239
+ __decorate([
240
+ inspectorDecorator.Field({ default: 'alphabetic' }),
241
+ __metadata("design:type", String)
242
+ ], Style.prototype, "textBaseline", void 0);
243
+ __decorate([
244
+ inspectorDecorator.Field(),
245
+ __metadata("design:type", Boolean)
246
+ ], Style.prototype, "trim", void 0);
247
+ __decorate([
248
+ inspectorDecorator.Field({
249
+ default: 'pre',
250
+ type: 'select',
251
+ options: [
252
+ { key: 'normal', value: 'normal' },
253
+ { key: 'pre', value: 'pre' },
254
+ { key: 'pre-line', value: 'pre-line' },
255
+ ],
256
+ }),
257
+ __metadata("design:type", String)
258
+ ], Style.prototype, "whiteSpace", void 0);
259
+ __decorate([
260
+ inspectorDecorator.Field(),
261
+ __metadata("design:type", Boolean)
262
+ ], Style.prototype, "wordWrap", void 0);
263
+ __decorate([
264
+ inspectorDecorator.Field({ default: 100 }),
265
+ __metadata("design:type", Number)
266
+ ], Style.prototype, "wordWrapWidth", void 0);
267
+ __decorate([
268
+ inspectorDecorator.Field(),
269
+ __metadata("design:type", Number)
270
+ ], Style.prototype, "leading", void 0);
271
+ return Style;
272
+ }());
84
273
  var Text$2 = (function (_super) {
85
274
  __extends(Text, _super);
86
275
  function Text() {
@@ -107,8 +296,13 @@ var Text$2 = (function (_super) {
107
296
  };
108
297
  Text.componentName = 'Text';
109
298
  __decorate([
110
- inspectorDecorator.type('string')
299
+ inspectorDecorator.Field(),
300
+ __metadata("design:type", String)
111
301
  ], Text.prototype, "text", void 0);
302
+ __decorate([
303
+ inspectorDecorator.Field(),
304
+ __metadata("design:type", Style)
305
+ ], Text.prototype, "style", void 0);
112
306
  return Text;
113
307
  }(eva_js.Component));
114
308
  var Text$3 = Text$2;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("pixi.js"),t=require("@eva/eva.js"),n=require("@eva/inspector-decorator"),r=require("@eva/plugin-renderer"),o=require("@eva/renderer-adapter"),i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function s(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function a(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s}function c(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var p=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.text="",e.style={},e}return s(r,t),r.prototype.init=function(t){var n=new e.TextStyle({fontSize:20}),r={};for(var o in n)0===o.indexOf("_")&&(r[o.substring(1)]=n[o]);this.style=r,t&&(this.text=t.text,Object.assign(this.style,t.style))},r.componentName="Text",a([n.type("string")],r.prototype,"text",void 0),r}(t.Component),u=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="Text",t.texts={},t}return s(n,e),n.prototype.init=function(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)},n.prototype.componentChanged=function(e){return n=this,r=void 0,s=function(){var n,r;return c(this,(function(i){return"Text"!==e.componentName||(e.type===t.OBSERVER_TYPE.ADD?(n=e.component,r=new o.Text(n.text,n.style),this.containerManager.getContainer(e.gameObject.id).addChildAt(r,0),this.texts[e.gameObject.id]={text:r,component:e.component},this.setSize(e)):e.type===t.OBSERVER_TYPE.REMOVE?(this.containerManager.getContainer(e.gameObject.id).removeChild(this.texts[e.gameObject.id].text),this.texts[e.gameObject.id].text.destroy({children:!0}),delete this.texts[e.gameObject.id]):(this.change(e),this.setSize(e))),[2]}))},new((i=void 0)||(i=Promise))((function(e,t){function o(e){try{c(s.next(e))}catch(e){t(e)}}function a(e){try{c(s.throw(e))}catch(e){t(e)}}function c(t){t.done?e(t.value):new i((function(e){e(t.value)})).then(o,a)}c((s=s.apply(n,r||[])).next())}));var n,r,i,s},n.prototype.change=function(e){var t=this.texts[e.gameObject.id],n=t.text,r=t.component;"text"===e.prop.prop[0]?n.text=r.text:"style"===e.prop.prop[0]&&Object.assign(n.style,e.component.style)},n.prototype.setSize=function(e){var t=e.gameObject.transform;t&&(t.size.width=this.texts[e.gameObject.id].text.width,t.size.height=this.texts[e.gameObject.id].text.height)},n.systemName="Text",n=a([t.decorators.componentObserver({Text:["text",{prop:["style"],deep:!0}]})],n)}(r.Renderer);exports.Text=p,exports.TextSystem=u;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("pixi.js"),t=require("@eva/eva.js"),o=require("@eva/inspector-decorator"),i=require("@eva/plugin-renderer"),r=require("@eva/renderer-adapter"),n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])},n(e,t)};function l(e,t){function o(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}function p(e,t,o,i){var r,n=arguments.length,l=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,o,i);else for(var p=e.length-1;p>=0;p--)(r=e[p])&&(l=(n<3?r(l):n>3?r(t,o,l):r(t,o))||l);return n>3&&l&&Object.defineProperty(t,o,l),l}function a(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function d(e,t){var o,i,r,n,l={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:p(0),throw:p(1),return:p(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function p(n){return function(p){return function(n){if(o)throw new TypeError("Generator is already executing.");for(;l;)try{if(o=1,i&&(r=2&n[0]?i.return:n[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,n[1])).done)return r;switch(i=0,r&&(n=[2&n[0],r.value]),n[0]){case 0:case 1:r=n;break;case 4:return l.label++,{value:n[1],done:!1};case 5:l.label++,i=n[1],n=[0];continue;case 7:n=l.ops.pop(),l.trys.pop();continue;default:if(!(r=l.trys,(r=r.length>0&&r[r.length-1])||6!==n[0]&&2!==n[0])){l=0;continue}if(3===n[0]&&(!r||n[1]>r[0]&&n[1]<r[3])){l.label=n[1];break}if(6===n[0]&&l.label<r[1]){l.label=r[1],r=n;break}if(r&&l.label<r[2]){l.label=r[2],l.ops.push(n);break}r[2]&&l.ops.pop(),l.trys.pop();continue}n=t.call(e,l)}catch(e){n=[6,e],i=0}finally{o=r=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,p])}}}var s=function(){function e(){}return p([o.Field({type:"select",options:[{key:"center",value:"center"},{key:"left",value:"left"},{key:"right",value:"right"}],default:"left"}),a("design:type",String)],e.prototype,"align",void 0),p([o.Field(),a("design:type",Boolean)],e.prototype,"breakWords",void 0),p([o.Field(),a("design:type",Boolean)],e.prototype,"dropShadow",void 0),p([o.Field({default:1}),a("design:type",Number)],e.prototype,"dropShadowAlpha",void 0),p([o.Field({default:Math.PI/6}),a("design:type",Number)],e.prototype,"dropShadowAngle",void 0),p([o.Field({default:0}),a("design:type",Number)],e.prototype,"dropShadowBlur",void 0),p([o.Field({type:"color",default:"#000000"}),a("design:type",Object)],e.prototype,"dropShadowColor",void 0),p([o.Field({default:5}),a("design:type",Number)],e.prototype,"dropShadowDistance",void 0),p([o.Field({type:"color",default:["#000000"],isArray:!0}),a("design:type",Object)],e.prototype,"fill",void 0),p([o.Field({type:"select",options:[{key:1,value:"vertical"},{key:0,value:"horizontal"}],default:1}),a("design:type",Number)],e.prototype,"fillGradientType",void 0),p([o.Field((function(){return Number}),{step:.1,min:0,max:1}),a("design:type",Array)],e.prototype,"fillGradientStops",void 0),p([o.Field((function(){return String}),{default:"Arial"}),a("design:type",Object)],e.prototype,"fontFamily",void 0),p([o.Field((function(){return Number}),{min:5,default:26}),a("design:type",Object)],e.prototype,"fontSize",void 0),p([o.Field({type:"select",options:[{key:"normal",value:"normal"},{key:"italic",value:"italic"},{key:"oblique",value:"oblique"}],default:"normal"}),a("design:type",String)],e.prototype,"fontStyle",void 0),p([o.Field({type:"select",options:[{key:"normal",value:"normal"},{key:"small-caps",value:"small-caps"}],default:"normal"}),a("design:type",String)],e.prototype,"fontVariant",void 0),p([o.Field({type:"select",options:[{key:"normal",value:"normal"},{key:"bold",value:"bold"},{key:"bolder",value:"bolder"},{key:"lighter",value:"lighter"},{key:"100",value:"100"},{key:"200",value:"200"},{key:"300",value:"300"},{key:"400",value:"400"},{key:"500",value:"500"},{key:"600",value:"600"},{key:"700",value:"700"},{key:"800",value:"800"},{key:"900",value:"900"}],default:"normal"}),a("design:type",String)],e.prototype,"fontWeight",void 0),p([o.Field({default:0}),a("design:type",Number)],e.prototype,"letterSpacing",void 0),p([o.Field({default:0}),a("design:type",Number)],e.prototype,"lineHeight",void 0),p([o.Field({type:"select",options:[{key:"miter",value:"miter"},{key:"round",value:"round"},{key:"bevel",value:"bevel"}],default:"miter"}),a("design:type",String)],e.prototype,"lineJoin",void 0),p([o.Field({default:10}),a("design:type",Number)],e.prototype,"miterLimit",void 0),p([o.Field({default:0}),a("design:type",Number)],e.prototype,"padding",void 0),p([o.Field({type:"color",default:"#000000"}),a("design:type",Object)],e.prototype,"stroke",void 0),p([o.Field({default:0,min:0}),a("design:type",Number)],e.prototype,"strokeThickness",void 0),p([o.Field({default:"alphabetic"}),a("design:type",String)],e.prototype,"textBaseline",void 0),p([o.Field(),a("design:type",Boolean)],e.prototype,"trim",void 0),p([o.Field({default:"pre",type:"select",options:[{key:"normal",value:"normal"},{key:"pre",value:"pre"},{key:"pre-line",value:"pre-line"}]}),a("design:type",String)],e.prototype,"whiteSpace",void 0),p([o.Field(),a("design:type",Boolean)],e.prototype,"wordWrap",void 0),p([o.Field({default:100}),a("design:type",Number)],e.prototype,"wordWrapWidth",void 0),p([o.Field(),a("design:type",Number)],e.prototype,"leading",void 0),e}(),u=function(t){function i(){var e=null!==t&&t.apply(this,arguments)||this;return e.text="",e.style={},e}return l(i,t),i.prototype.init=function(t){var o=new e.TextStyle({fontSize:20}),i={};for(var r in o)0===r.indexOf("_")&&(i[r.substring(1)]=o[r]);this.style=i,t&&(this.text=t.text,Object.assign(this.style,t.style))},i.componentName="Text",p([o.Field(),a("design:type",String)],i.prototype,"text",void 0),p([o.Field(),a("design:type",s)],i.prototype,"style",void 0),i}(t.Component),y=u,c=function(e){function o(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="Text",t.texts={},t}return l(o,e),o.prototype.init=function(){this.renderSystem=this.game.getSystem(i.RendererSystem),this.renderSystem.rendererManager.register(this)},o.prototype.componentChanged=function(e){return o=this,i=void 0,l=function(){var o,i;return d(this,(function(n){return"Text"!==e.componentName||(e.type===t.OBSERVER_TYPE.ADD?(o=e.component,i=new r.Text(o.text,o.style),this.containerManager.getContainer(e.gameObject.id).addChildAt(i,0),this.texts[e.gameObject.id]={text:i,component:e.component},this.setSize(e)):e.type===t.OBSERVER_TYPE.REMOVE?(this.containerManager.getContainer(e.gameObject.id).removeChild(this.texts[e.gameObject.id].text),this.texts[e.gameObject.id].text.destroy({children:!0}),delete this.texts[e.gameObject.id]):(this.change(e),this.setSize(e))),[2]}))},new((n=void 0)||(n=Promise))((function(e,t){function r(e){try{a(l.next(e))}catch(e){t(e)}}function p(e){try{a(l.throw(e))}catch(e){t(e)}}function a(t){t.done?e(t.value):new n((function(e){e(t.value)})).then(r,p)}a((l=l.apply(o,i||[])).next())}));var o,i,n,l},o.prototype.change=function(e){var t=this.texts[e.gameObject.id],o=t.text,i=t.component;"text"===e.prop.prop[0]?o.text=i.text:"style"===e.prop.prop[0]&&Object.assign(o.style,e.component.style)},o.prototype.setSize=function(e){var t=e.gameObject.transform;t&&(t.size.width=this.texts[e.gameObject.id].text.width,t.size.height=this.texts[e.gameObject.id].text.height)},o.systemName="Text",o=p([t.decorators.componentObserver({Text:["text",{prop:["style"],deep:!0}]})],o)}(i.Renderer);exports.Text=y,exports.TextSystem=c;
@@ -6,47 +6,49 @@ import { RendererManager } from '@eva/plugin-renderer';
6
6
  import { RendererSystem } from '@eva/plugin-renderer';
7
7
  import { Text as Text_3 } from '@eva/renderer-adapter';
8
8
 
9
+ declare class Style {
10
+ align?: string;
11
+ breakWords?: boolean;
12
+ dropShadow?: boolean;
13
+ dropShadowAlpha?: number;
14
+ dropShadowAngle?: number;
15
+ dropShadowBlur?: number;
16
+ dropShadowColor?: string | number;
17
+ dropShadowDistance?: number;
18
+ fill?: string | string[] | number | number[] | CanvasGradient | CanvasPattern;
19
+ fillGradientType?: number;
20
+ fillGradientStops?: number[];
21
+ fontFamily?: string | string[];
22
+ fontSize?: number | string;
23
+ fontStyle?: string;
24
+ fontVariant?: string;
25
+ fontWeight?: string;
26
+ letterSpacing?: number;
27
+ lineHeight?: number;
28
+ lineJoin?: string;
29
+ miterLimit?: number;
30
+ padding?: number;
31
+ stroke?: string | number;
32
+ strokeThickness?: number;
33
+ textBaseline?: string;
34
+ trim?: boolean;
35
+ whiteSpace?: string;
36
+ wordWrap?: boolean;
37
+ wordWrapWidth?: number;
38
+ leading?: number;
39
+ }
40
+
9
41
  declare class Text_2 extends Component<TextParams> {
10
42
  static componentName: string;
11
43
  text: string;
12
- style: TextParams['style'];
44
+ style: Style;
13
45
  init(obj?: TextParams): void;
14
46
  }
15
47
  export { Text_2 as Text }
16
48
 
17
49
  export declare interface TextParams {
18
50
  text: string;
19
- style?: {
20
- align?: string;
21
- breakWords?: boolean;
22
- dropShadow?: boolean;
23
- dropShadowAlpha?: number;
24
- dropShadowAngle?: number;
25
- dropShadowBlur?: number;
26
- dropShadowColor?: string | number;
27
- dropShadowDistance?: number;
28
- fill?: string | string[] | number | number[] | CanvasGradient | CanvasPattern;
29
- fillGradientType?: number;
30
- fillGradientStops?: number[];
31
- fontFamily?: string | string[];
32
- fontSize?: number | string;
33
- fontStyle?: string;
34
- fontVariant?: string;
35
- fontWeight?: string;
36
- letterSpacing?: number;
37
- lineHeight?: number;
38
- lineJoin?: string;
39
- miterLimit?: number;
40
- padding?: number;
41
- stroke?: string | number;
42
- strokeThickness?: number;
43
- textBaseline?: string;
44
- trim?: boolean;
45
- whiteSpace?: string;
46
- wordWrap?: boolean;
47
- wordWrapWidth?: number;
48
- leading?: number;
49
- };
51
+ style?: Style;
50
52
  }
51
53
 
52
54
  export declare class TextSystem extends Renderer {
@@ -1,6 +1,6 @@
1
1
  import { TextStyle } from 'pixi.js';
2
2
  import { Component, decorators, OBSERVER_TYPE } from '@eva/eva.js';
3
- import { type } from '@eva/inspector-decorator';
3
+ import { Field } from '@eva/inspector-decorator';
4
4
  import { RendererSystem, Renderer } from '@eva/plugin-renderer';
5
5
  import { Text as Text$4 } from '@eva/renderer-adapter';
6
6
 
@@ -40,6 +40,10 @@ function __decorate(decorators, target, key, desc) {
40
40
  return c > 3 && r && Object.defineProperty(target, key, r), r;
41
41
  }
42
42
 
43
+ function __metadata(metadataKey, metadataValue) {
44
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
45
+ }
46
+
43
47
  function __awaiter(thisArg, _arguments, P, generator) {
44
48
  return new (P || (P = Promise))(function (resolve, reject) {
45
49
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -77,6 +81,191 @@ function __generator(thisArg, body) {
77
81
  }
78
82
  }
79
83
 
84
+ var Style = (function () {
85
+ function Style() {
86
+ }
87
+ __decorate([
88
+ Field({
89
+ type: 'select',
90
+ options: [
91
+ { key: 'center', value: 'center' },
92
+ { key: 'left', value: 'left' },
93
+ { key: 'right', value: 'right' },
94
+ ],
95
+ default: 'left',
96
+ }),
97
+ __metadata("design:type", String)
98
+ ], Style.prototype, "align", void 0);
99
+ __decorate([
100
+ Field(),
101
+ __metadata("design:type", Boolean)
102
+ ], Style.prototype, "breakWords", void 0);
103
+ __decorate([
104
+ Field(),
105
+ __metadata("design:type", Boolean)
106
+ ], Style.prototype, "dropShadow", void 0);
107
+ __decorate([
108
+ Field({ default: 1 }),
109
+ __metadata("design:type", Number)
110
+ ], Style.prototype, "dropShadowAlpha", void 0);
111
+ __decorate([
112
+ Field({ default: Math.PI / 6 }),
113
+ __metadata("design:type", Number)
114
+ ], Style.prototype, "dropShadowAngle", void 0);
115
+ __decorate([
116
+ Field({ default: 0 }),
117
+ __metadata("design:type", Number)
118
+ ], Style.prototype, "dropShadowBlur", void 0);
119
+ __decorate([
120
+ Field({ type: 'color', default: '#000000' }),
121
+ __metadata("design:type", Object)
122
+ ], Style.prototype, "dropShadowColor", void 0);
123
+ __decorate([
124
+ Field({ default: 5 }),
125
+ __metadata("design:type", Number)
126
+ ], Style.prototype, "dropShadowDistance", void 0);
127
+ __decorate([
128
+ Field({ type: 'color', default: ['#000000'], isArray: true }),
129
+ __metadata("design:type", Object)
130
+ ], Style.prototype, "fill", void 0);
131
+ __decorate([
132
+ Field({
133
+ type: 'select',
134
+ options: [
135
+ { key: 1, value: 'vertical' },
136
+ { key: 0, value: 'horizontal' },
137
+ ],
138
+ default: 1,
139
+ }),
140
+ __metadata("design:type", Number)
141
+ ], Style.prototype, "fillGradientType", void 0);
142
+ __decorate([
143
+ Field(function () { return Number; }, { step: 0.1, min: 0, max: 1 }),
144
+ __metadata("design:type", Array)
145
+ ], Style.prototype, "fillGradientStops", void 0);
146
+ __decorate([
147
+ Field(function () { return String; }, { default: 'Arial' }),
148
+ __metadata("design:type", Object)
149
+ ], Style.prototype, "fontFamily", void 0);
150
+ __decorate([
151
+ Field(function () { return Number; }, { min: 5, default: 26 }),
152
+ __metadata("design:type", Object)
153
+ ], Style.prototype, "fontSize", void 0);
154
+ __decorate([
155
+ Field({
156
+ type: 'select',
157
+ options: [
158
+ { key: 'normal', value: 'normal' },
159
+ { key: 'italic', value: 'italic' },
160
+ { key: 'oblique', value: 'oblique' },
161
+ ],
162
+ default: 'normal',
163
+ }),
164
+ __metadata("design:type", String)
165
+ ], Style.prototype, "fontStyle", void 0);
166
+ __decorate([
167
+ Field({
168
+ type: 'select',
169
+ options: [
170
+ { key: 'normal', value: 'normal' },
171
+ { key: 'small-caps', value: 'small-caps' },
172
+ ],
173
+ default: 'normal',
174
+ }),
175
+ __metadata("design:type", String)
176
+ ], Style.prototype, "fontVariant", void 0);
177
+ __decorate([
178
+ Field({
179
+ type: 'select',
180
+ options: [
181
+ { key: 'normal', value: 'normal' },
182
+ { key: 'bold', value: 'bold' },
183
+ { key: 'bolder', value: 'bolder' },
184
+ { key: 'lighter', value: 'lighter' },
185
+ { key: '100', value: '100' },
186
+ { key: '200', value: '200' },
187
+ { key: '300', value: '300' },
188
+ { key: '400', value: '400' },
189
+ { key: '500', value: '500' },
190
+ { key: '600', value: '600' },
191
+ { key: '700', value: '700' },
192
+ { key: '800', value: '800' },
193
+ { key: '900', value: '900' },
194
+ ],
195
+ default: 'normal',
196
+ }),
197
+ __metadata("design:type", String)
198
+ ], Style.prototype, "fontWeight", void 0);
199
+ __decorate([
200
+ Field({ default: 0 }),
201
+ __metadata("design:type", Number)
202
+ ], Style.prototype, "letterSpacing", void 0);
203
+ __decorate([
204
+ Field({ default: 0 }),
205
+ __metadata("design:type", Number)
206
+ ], Style.prototype, "lineHeight", void 0);
207
+ __decorate([
208
+ Field({
209
+ type: 'select',
210
+ options: [
211
+ { key: 'miter', value: 'miter' },
212
+ { key: 'round', value: 'round' },
213
+ { key: 'bevel', value: 'bevel' },
214
+ ],
215
+ default: 'miter',
216
+ }),
217
+ __metadata("design:type", String)
218
+ ], Style.prototype, "lineJoin", void 0);
219
+ __decorate([
220
+ Field({ default: 10 }),
221
+ __metadata("design:type", Number)
222
+ ], Style.prototype, "miterLimit", void 0);
223
+ __decorate([
224
+ Field({ default: 0 }),
225
+ __metadata("design:type", Number)
226
+ ], Style.prototype, "padding", void 0);
227
+ __decorate([
228
+ Field({ type: 'color', default: '#000000' }),
229
+ __metadata("design:type", Object)
230
+ ], Style.prototype, "stroke", void 0);
231
+ __decorate([
232
+ Field({ default: 0, min: 0 }),
233
+ __metadata("design:type", Number)
234
+ ], Style.prototype, "strokeThickness", void 0);
235
+ __decorate([
236
+ Field({ default: 'alphabetic' }),
237
+ __metadata("design:type", String)
238
+ ], Style.prototype, "textBaseline", void 0);
239
+ __decorate([
240
+ Field(),
241
+ __metadata("design:type", Boolean)
242
+ ], Style.prototype, "trim", void 0);
243
+ __decorate([
244
+ Field({
245
+ default: 'pre',
246
+ type: 'select',
247
+ options: [
248
+ { key: 'normal', value: 'normal' },
249
+ { key: 'pre', value: 'pre' },
250
+ { key: 'pre-line', value: 'pre-line' },
251
+ ],
252
+ }),
253
+ __metadata("design:type", String)
254
+ ], Style.prototype, "whiteSpace", void 0);
255
+ __decorate([
256
+ Field(),
257
+ __metadata("design:type", Boolean)
258
+ ], Style.prototype, "wordWrap", void 0);
259
+ __decorate([
260
+ Field({ default: 100 }),
261
+ __metadata("design:type", Number)
262
+ ], Style.prototype, "wordWrapWidth", void 0);
263
+ __decorate([
264
+ Field(),
265
+ __metadata("design:type", Number)
266
+ ], Style.prototype, "leading", void 0);
267
+ return Style;
268
+ }());
80
269
  var Text$2 = (function (_super) {
81
270
  __extends(Text, _super);
82
271
  function Text() {
@@ -103,8 +292,13 @@ var Text$2 = (function (_super) {
103
292
  };
104
293
  Text.componentName = 'Text';
105
294
  __decorate([
106
- type('string')
295
+ Field(),
296
+ __metadata("design:type", String)
107
297
  ], Text.prototype, "text", void 0);
298
+ __decorate([
299
+ Field(),
300
+ __metadata("design:type", Style)
301
+ ], Text.prototype, "style", void 0);
108
302
  return Text;
109
303
  }(Component));
110
304
  var Text$3 = Text$2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eva/plugin-renderer-text",
3
- "version": "1.2.7-editor.0",
3
+ "version": "1.2.7-editor.11",
4
4
  "description": "@eva/plugin-renderer-text",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-renderer-text.esm.js",
@@ -18,10 +18,10 @@
18
18
  "license": "MIT",
19
19
  "homepage": "https://eva.js.org",
20
20
  "dependencies": {
21
- "@eva/inspector-decorator": "^0.0.5",
22
- "@eva/plugin-renderer": "1.2.7-editor.0",
23
- "@eva/renderer-adapter": "1.2.7-editor.0",
24
- "@eva/eva.js": "1.2.7-editor.0",
21
+ "@eva/inspector-decorator": "0.1.0-alpha.3",
22
+ "@eva/plugin-renderer": "1.2.7-editor.11",
23
+ "@eva/renderer-adapter": "1.2.7-editor.11",
24
+ "@eva/eva.js": "1.2.7-editor.11",
25
25
  "pixi.js": "^4.8.7"
26
26
  }
27
27
  }
@@ -1,128 +0,0 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
- import { __extends, __decorate, __awaiter, __generator } from 'tslib';
4
- import { TextStyle } from '@eva/miniprogram-pixi';
5
- import { Component, OBSERVER_TYPE, decorators } from '@eva/eva.js/dist/miniprogram';
6
- import { type } from '@eva/inspector-decorator';
7
- import { RendererSystem, Renderer } from '@eva/plugin-renderer/dist/miniprogram';
8
- import { Text as Text$4 } from '@eva/renderer-adapter/dist/miniprogram';
9
-
10
- var Text$2 = function (_super) {
11
- __extends(Text, _super);
12
-
13
- function Text() {
14
- var _this = _super !== null && _super.apply(this, arguments) || this;
15
-
16
- _this.text = '';
17
- _this.style = {};
18
- return _this;
19
- }
20
-
21
- Text.prototype.init = function (obj) {
22
- var style = new TextStyle({
23
- fontSize: 20
24
- });
25
- var newStyle = {};
26
-
27
- for (var key in style) {
28
- if (key.indexOf('_') === 0) {
29
- newStyle[key.substring(1)] = style[key];
30
- }
31
- }
32
-
33
- this.style = newStyle;
34
-
35
- if (obj) {
36
- this.text = obj.text;
37
-
38
- _extends(this.style, obj.style);
39
- }
40
- };
41
-
42
- Text.componentName = 'Text';
43
-
44
- __decorate([type('string')], Text.prototype, "text", void 0);
45
-
46
- return Text;
47
- }(Component);
48
-
49
- var Text$3 = Text$2;
50
-
51
- var Text = function (_super) {
52
- __extends(Text, _super);
53
-
54
- function Text() {
55
- var _this = _super !== null && _super.apply(this, arguments) || this;
56
-
57
- _this.name = 'Text';
58
- _this.texts = {};
59
- return _this;
60
- }
61
-
62
- Text.prototype.init = function () {
63
- this.renderSystem = this.game.getSystem(RendererSystem);
64
- this.renderSystem.rendererManager.register(this);
65
- };
66
-
67
- Text.prototype.componentChanged = function (changed) {
68
- return __awaiter(this, void 0, void 0, function () {
69
- var component, text;
70
- return __generator(this, function (_a) {
71
- if (changed.componentName !== 'Text') return [2];
72
-
73
- if (changed.type === OBSERVER_TYPE.ADD) {
74
- component = changed.component;
75
- text = new Text$4(component.text, component.style);
76
- this.containerManager.getContainer(changed.gameObject.id).addChildAt(text, 0);
77
- this.texts[changed.gameObject.id] = {
78
- text: text,
79
- component: changed.component
80
- };
81
- this.setSize(changed);
82
- } else if (changed.type === OBSERVER_TYPE.REMOVE) {
83
- this.containerManager.getContainer(changed.gameObject.id).removeChild(this.texts[changed.gameObject.id].text);
84
- this.texts[changed.gameObject.id].text.destroy({
85
- children: true
86
- });
87
- delete this.texts[changed.gameObject.id];
88
- } else {
89
- this.change(changed);
90
- this.setSize(changed);
91
- }
92
-
93
- return [2];
94
- });
95
- });
96
- };
97
-
98
- Text.prototype.change = function (changed) {
99
- var _a = this.texts[changed.gameObject.id],
100
- text = _a.text,
101
- component = _a.component;
102
-
103
- if (changed.prop.prop[0] === 'text') {
104
- text.text = component.text;
105
- } else if (changed.prop.prop[0] === 'style') {
106
- _extends(text.style, changed.component.style);
107
- }
108
- };
109
-
110
- Text.prototype.setSize = function (changed) {
111
- var transform = changed.gameObject.transform;
112
- if (!transform) return;
113
- transform.size.width = this.texts[changed.gameObject.id].text.width;
114
- transform.size.height = this.texts[changed.gameObject.id].text.height;
115
- };
116
-
117
- Text.systemName = 'Text';
118
- Text = __decorate([decorators.componentObserver({
119
- Text: ['text', {
120
- prop: ['style'],
121
- deep: true
122
- }]
123
- })], Text);
124
- return Text;
125
- }(Renderer);
126
-
127
- var Text$1 = Text;
128
- export { Text$3 as Text, Text$1 as TextSystem };