@eva/plugin-renderer-text 1.2.7-editor.9 → 1.2.8-alpha.0
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.
- package/dist/EVA.plugin.renderer.text.js +14 -301
- package/dist/EVA.plugin.renderer.text.min.js +1 -1
- package/dist/miniprogram.js +128 -0
- package/dist/plugin-renderer-text.cjs.js +1 -165
- package/dist/plugin-renderer-text.cjs.prod.js +1 -1
- package/dist/plugin-renderer-text.d.ts +32 -34
- package/dist/plugin-renderer-text.esm.js +2 -166
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
2
|
|
|
3
3
|
window.EVA = window.EVA || {};
|
|
4
4
|
window.EVA.plugin = window.EVA.plugin || {};
|
|
@@ -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 (
|
|
17
|
+
if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -22,8 +22,6 @@ 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
|
-
|
|
27
25
|
_extendStatics(d, b);
|
|
28
26
|
|
|
29
27
|
function __() {
|
|
@@ -33,22 +31,6 @@ var _EVA_IIFE_text = function (exports, pixi_js, eva_js, pluginRenderer, rendere
|
|
|
33
31
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
34
32
|
}
|
|
35
33
|
|
|
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
|
-
|
|
52
34
|
function __decorate(decorators, target, key, desc) {
|
|
53
35
|
var c = arguments.length,
|
|
54
36
|
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
@@ -59,10 +41,6 @@ var _EVA_IIFE_text = function (exports, pixi_js, eva_js, pluginRenderer, rendere
|
|
|
59
41
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
60
42
|
}
|
|
61
43
|
|
|
62
|
-
function __metadata(metadataKey, metadataValue) {
|
|
63
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
44
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
67
45
|
function adopt(value) {
|
|
68
46
|
return value instanceof P ? value : new P(function (resolve) {
|
|
@@ -206,277 +184,27 @@ var _EVA_IIFE_text = function (exports, pixi_js, eva_js, pluginRenderer, rendere
|
|
|
206
184
|
}
|
|
207
185
|
}
|
|
208
186
|
|
|
209
|
-
|
|
210
|
-
|
|
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;
|
|
264
|
-
}
|
|
265
|
-
|
|
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
|
-
}
|
|
187
|
+
function getIDEPropsPropertyObj(target, propertyKey) {
|
|
188
|
+
if (!target.constructor.IDEProps) {
|
|
189
|
+
target.constructor.IDEProps = {};
|
|
275
190
|
}
|
|
276
191
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
type: type,
|
|
280
|
-
isArray: isArray
|
|
281
|
-
}, options);
|
|
282
|
-
Reflect.defineMetadata(IDE_PROPERTY_METADATA, properties, target.constructor);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
function getTypeDecoratorParams(returnTypeFuncOrOptions, maybeOptions) {
|
|
286
|
-
if (typeof returnTypeFuncOrOptions === 'function') {
|
|
287
|
-
return {
|
|
288
|
-
returnTypeFunc: returnTypeFuncOrOptions,
|
|
289
|
-
options: maybeOptions || {}
|
|
290
|
-
};
|
|
192
|
+
if (!target.constructor.IDEProps[propertyKey]) {
|
|
193
|
+
target.constructor.IDEProps[propertyKey] = {};
|
|
291
194
|
}
|
|
292
195
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
};
|
|
196
|
+
var propertyObj = target.constructor.IDEProps[propertyKey];
|
|
197
|
+
return propertyObj;
|
|
296
198
|
}
|
|
297
199
|
|
|
298
|
-
function
|
|
200
|
+
function type(type) {
|
|
299
201
|
return function (target, propertyKey) {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
var _a = getTypeDecoratorParams(returnTypeFunction, maybeOptions),
|
|
305
|
-
options = _a.options,
|
|
306
|
-
returnTypeFunc = _a.returnTypeFunc;
|
|
307
|
-
|
|
308
|
-
defineTypes(target, propertyKey, options, returnTypeFunc);
|
|
202
|
+
var prop = getIDEPropsPropertyObj(target, propertyKey);
|
|
203
|
+
prop.key = propertyKey;
|
|
204
|
+
prop.type = type;
|
|
309
205
|
};
|
|
310
206
|
}
|
|
311
207
|
|
|
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 Color = function () {
|
|
321
|
-
function Color() {}
|
|
322
|
-
|
|
323
|
-
Color.getProperties = function () {
|
|
324
|
-
return 'color';
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
return Color;
|
|
328
|
-
}();
|
|
329
|
-
|
|
330
|
-
var Style = function () {
|
|
331
|
-
function Style() {}
|
|
332
|
-
|
|
333
|
-
__decorate([Field({
|
|
334
|
-
type: 'selector',
|
|
335
|
-
isArray: false,
|
|
336
|
-
options: ['center', 'left', 'right'],
|
|
337
|
-
default: 'left'
|
|
338
|
-
}), __metadata("design:type", String)], Style.prototype, "align", void 0);
|
|
339
|
-
|
|
340
|
-
__decorate([Field(), __metadata("design:type", Boolean)], Style.prototype, "breakWords", void 0);
|
|
341
|
-
|
|
342
|
-
__decorate([Field(), __metadata("design:type", Boolean)], Style.prototype, "dropShadow", void 0);
|
|
343
|
-
|
|
344
|
-
__decorate([Field({
|
|
345
|
-
default: 1
|
|
346
|
-
}), __metadata("design:type", Number)], Style.prototype, "dropShadowAlpha", void 0);
|
|
347
|
-
|
|
348
|
-
__decorate([Field({
|
|
349
|
-
default: Math.PI / 6
|
|
350
|
-
}), __metadata("design:type", Number)], Style.prototype, "dropShadowAngle", void 0);
|
|
351
|
-
|
|
352
|
-
__decorate([Field({
|
|
353
|
-
default: 0
|
|
354
|
-
}), __metadata("design:type", Number)], Style.prototype, "dropShadowBlur", void 0);
|
|
355
|
-
|
|
356
|
-
__decorate([Field(function () {
|
|
357
|
-
return Color;
|
|
358
|
-
}, {
|
|
359
|
-
default: '#000000'
|
|
360
|
-
}), __metadata("design:type", Object)], Style.prototype, "dropShadowColor", void 0);
|
|
361
|
-
|
|
362
|
-
__decorate([Field({
|
|
363
|
-
default: 5
|
|
364
|
-
}), __metadata("design:type", Number)], Style.prototype, "dropShadowDistance", void 0);
|
|
365
|
-
|
|
366
|
-
__decorate([Field(function () {
|
|
367
|
-
return [Color];
|
|
368
|
-
}, {
|
|
369
|
-
default: ['#000000']
|
|
370
|
-
}), __metadata("design:type", Object)], Style.prototype, "fill", void 0);
|
|
371
|
-
|
|
372
|
-
__decorate([Field({
|
|
373
|
-
type: 'selector',
|
|
374
|
-
options: {
|
|
375
|
-
vertical: 1,
|
|
376
|
-
horizontal: 0
|
|
377
|
-
},
|
|
378
|
-
default: 1,
|
|
379
|
-
filter: function filter(val) {
|
|
380
|
-
return Number(val);
|
|
381
|
-
},
|
|
382
|
-
isArray: false
|
|
383
|
-
}), __metadata("design:type", Number)], Style.prototype, "fillGradientType", void 0);
|
|
384
|
-
|
|
385
|
-
__decorate([Field(function () {
|
|
386
|
-
return Number;
|
|
387
|
-
}, {
|
|
388
|
-
step: 0.1,
|
|
389
|
-
min: 0,
|
|
390
|
-
max: 1
|
|
391
|
-
}), __metadata("design:type", Array)], Style.prototype, "fillGradientStops", void 0);
|
|
392
|
-
|
|
393
|
-
__decorate([Field(function () {
|
|
394
|
-
return String;
|
|
395
|
-
}, {
|
|
396
|
-
default: 'Arial'
|
|
397
|
-
}), __metadata("design:type", Object)], Style.prototype, "fontFamily", void 0);
|
|
398
|
-
|
|
399
|
-
__decorate([Field(function () {
|
|
400
|
-
return Number;
|
|
401
|
-
}, {
|
|
402
|
-
min: 5,
|
|
403
|
-
default: 26
|
|
404
|
-
}), __metadata("design:type", Object)], Style.prototype, "fontSize", void 0);
|
|
405
|
-
|
|
406
|
-
__decorate([Field({
|
|
407
|
-
type: 'selector',
|
|
408
|
-
options: ['normal', 'italic', 'oblique'],
|
|
409
|
-
default: 'normal'
|
|
410
|
-
}), __metadata("design:type", String)], Style.prototype, "fontStyle", void 0);
|
|
411
|
-
|
|
412
|
-
__decorate([Field({
|
|
413
|
-
type: 'selector',
|
|
414
|
-
options: ['normal', 'small-caps'],
|
|
415
|
-
default: 'normal'
|
|
416
|
-
}), __metadata("design:type", String)], Style.prototype, "fontVariant", void 0);
|
|
417
|
-
|
|
418
|
-
__decorate([Field({
|
|
419
|
-
type: 'selector',
|
|
420
|
-
options: ['normal', 'bold', 'bolder', 'lighter', '100', '200', '300', '400', '500', '600', '700', '800', '900'],
|
|
421
|
-
default: 'normal'
|
|
422
|
-
}), __metadata("design:type", String)], Style.prototype, "fontWeight", void 0);
|
|
423
|
-
|
|
424
|
-
__decorate([Field({
|
|
425
|
-
default: 0
|
|
426
|
-
}), __metadata("design:type", Number)], Style.prototype, "letterSpacing", void 0);
|
|
427
|
-
|
|
428
|
-
__decorate([Field({
|
|
429
|
-
default: 0
|
|
430
|
-
}), __metadata("design:type", Number)], Style.prototype, "lineHeight", void 0);
|
|
431
|
-
|
|
432
|
-
__decorate([Field({
|
|
433
|
-
type: 'selector',
|
|
434
|
-
options: ['miter', 'round', 'bevel'],
|
|
435
|
-
default: 'miter'
|
|
436
|
-
}), __metadata("design:type", String)], Style.prototype, "lineJoin", void 0);
|
|
437
|
-
|
|
438
|
-
__decorate([Field({
|
|
439
|
-
default: 10
|
|
440
|
-
}), __metadata("design:type", Number)], Style.prototype, "miterLimit", void 0);
|
|
441
|
-
|
|
442
|
-
__decorate([Field({
|
|
443
|
-
default: 0
|
|
444
|
-
}), __metadata("design:type", Number)], Style.prototype, "padding", void 0);
|
|
445
|
-
|
|
446
|
-
__decorate([Field(function () {
|
|
447
|
-
return Color;
|
|
448
|
-
}, {
|
|
449
|
-
default: '#000000'
|
|
450
|
-
}), __metadata("design:type", Object)], Style.prototype, "stroke", void 0);
|
|
451
|
-
|
|
452
|
-
__decorate([Field({
|
|
453
|
-
default: 0,
|
|
454
|
-
min: 0
|
|
455
|
-
}), __metadata("design:type", Number)], Style.prototype, "strokeThickness", void 0);
|
|
456
|
-
|
|
457
|
-
__decorate([Field({
|
|
458
|
-
default: 'alphabetic'
|
|
459
|
-
}), __metadata("design:type", String)], Style.prototype, "textBaseline", void 0);
|
|
460
|
-
|
|
461
|
-
__decorate([Field(), __metadata("design:type", Boolean)], Style.prototype, "trim", void 0);
|
|
462
|
-
|
|
463
|
-
__decorate([Field({
|
|
464
|
-
default: 'pre',
|
|
465
|
-
type: 'selector',
|
|
466
|
-
options: ['normal', 'pre', 'pre-line']
|
|
467
|
-
}), __metadata("design:type", String)], Style.prototype, "whiteSpace", void 0);
|
|
468
|
-
|
|
469
|
-
__decorate([Field(), __metadata("design:type", Boolean)], Style.prototype, "wordWrap", void 0);
|
|
470
|
-
|
|
471
|
-
__decorate([Field({
|
|
472
|
-
default: 100
|
|
473
|
-
}), __metadata("design:type", Number)], Style.prototype, "wordWrapWidth", void 0);
|
|
474
|
-
|
|
475
|
-
__decorate([Field(), __metadata("design:type", Number)], Style.prototype, "leading", void 0);
|
|
476
|
-
|
|
477
|
-
return Style;
|
|
478
|
-
}();
|
|
479
|
-
|
|
480
208
|
var Text$2 = function (_super) {
|
|
481
209
|
__extends(Text, _super);
|
|
482
210
|
|
|
@@ -511,22 +239,7 @@ var _EVA_IIFE_text = function (exports, pixi_js, eva_js, pluginRenderer, rendere
|
|
|
511
239
|
|
|
512
240
|
Text.componentName = 'Text';
|
|
513
241
|
|
|
514
|
-
__decorate([
|
|
515
|
-
type: 'textarea',
|
|
516
|
-
filter: function filter(text) {
|
|
517
|
-
if (typeof text !== 'string') {
|
|
518
|
-
return '';
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
if (text.length > 100) {
|
|
522
|
-
return text.slice(0, 100);
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
return text;
|
|
526
|
-
}
|
|
527
|
-
}), __metadata("design:type", String)], Text.prototype, "text", void 0);
|
|
528
|
-
|
|
529
|
-
__decorate([Field(), __metadata("design:type", Style)], Text.prototype, "style", void 0);
|
|
242
|
+
__decorate([type('string')], Text.prototype, "text", void 0);
|
|
530
243
|
|
|
531
244
|
return Text;
|
|
532
245
|
}(eva_js.Component);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _extends(){return _extends=Object.assign
|
|
1
|
+
function _extends(){return _extends=Object.assign?Object.assign.bind():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},_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(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])},i(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=l,d=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),h=d;return t.Text=f,t.TextSystem=h,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;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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 };
|
|
@@ -44,10 +44,6 @@ 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
|
-
|
|
51
47
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
52
48
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
53
49
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
@@ -85,150 +81,6 @@ function __generator(thisArg, body) {
|
|
|
85
81
|
}
|
|
86
82
|
}
|
|
87
83
|
|
|
88
|
-
var Color = (function () {
|
|
89
|
-
function Color() {
|
|
90
|
-
}
|
|
91
|
-
Color.getProperties = function () {
|
|
92
|
-
return 'color';
|
|
93
|
-
};
|
|
94
|
-
return Color;
|
|
95
|
-
}());
|
|
96
|
-
var Style = (function () {
|
|
97
|
-
function Style() {
|
|
98
|
-
}
|
|
99
|
-
__decorate([
|
|
100
|
-
inspectorDecorator.Field({
|
|
101
|
-
type: 'selector',
|
|
102
|
-
isArray: false,
|
|
103
|
-
options: ['center', 'left', 'right'],
|
|
104
|
-
default: 'left',
|
|
105
|
-
}),
|
|
106
|
-
__metadata("design:type", String)
|
|
107
|
-
], Style.prototype, "align", void 0);
|
|
108
|
-
__decorate([
|
|
109
|
-
inspectorDecorator.Field(),
|
|
110
|
-
__metadata("design:type", Boolean)
|
|
111
|
-
], Style.prototype, "breakWords", void 0);
|
|
112
|
-
__decorate([
|
|
113
|
-
inspectorDecorator.Field(),
|
|
114
|
-
__metadata("design:type", Boolean)
|
|
115
|
-
], Style.prototype, "dropShadow", void 0);
|
|
116
|
-
__decorate([
|
|
117
|
-
inspectorDecorator.Field({ default: 1 }),
|
|
118
|
-
__metadata("design:type", Number)
|
|
119
|
-
], Style.prototype, "dropShadowAlpha", void 0);
|
|
120
|
-
__decorate([
|
|
121
|
-
inspectorDecorator.Field({ default: Math.PI / 6 }),
|
|
122
|
-
__metadata("design:type", Number)
|
|
123
|
-
], Style.prototype, "dropShadowAngle", void 0);
|
|
124
|
-
__decorate([
|
|
125
|
-
inspectorDecorator.Field({ default: 0 }),
|
|
126
|
-
__metadata("design:type", Number)
|
|
127
|
-
], Style.prototype, "dropShadowBlur", void 0);
|
|
128
|
-
__decorate([
|
|
129
|
-
inspectorDecorator.Field(function () { return Color; }, { default: '#000000' }),
|
|
130
|
-
__metadata("design:type", Object)
|
|
131
|
-
], Style.prototype, "dropShadowColor", void 0);
|
|
132
|
-
__decorate([
|
|
133
|
-
inspectorDecorator.Field({ default: 5 }),
|
|
134
|
-
__metadata("design:type", Number)
|
|
135
|
-
], Style.prototype, "dropShadowDistance", void 0);
|
|
136
|
-
__decorate([
|
|
137
|
-
inspectorDecorator.Field(function () { return [Color]; }, { default: ['#000000'] }),
|
|
138
|
-
__metadata("design:type", Object)
|
|
139
|
-
], Style.prototype, "fill", void 0);
|
|
140
|
-
__decorate([
|
|
141
|
-
inspectorDecorator.Field({
|
|
142
|
-
type: 'selector',
|
|
143
|
-
options: { vertical: 1, horizontal: 0 },
|
|
144
|
-
default: 1,
|
|
145
|
-
filter: function (val) { return Number(val); },
|
|
146
|
-
isArray: false,
|
|
147
|
-
}),
|
|
148
|
-
__metadata("design:type", Number)
|
|
149
|
-
], Style.prototype, "fillGradientType", void 0);
|
|
150
|
-
__decorate([
|
|
151
|
-
inspectorDecorator.Field(function () { return Number; }, { step: 0.1, min: 0, max: 1 }),
|
|
152
|
-
__metadata("design:type", Array)
|
|
153
|
-
], Style.prototype, "fillGradientStops", void 0);
|
|
154
|
-
__decorate([
|
|
155
|
-
inspectorDecorator.Field(function () { return String; }, { default: 'Arial' }),
|
|
156
|
-
__metadata("design:type", Object)
|
|
157
|
-
], Style.prototype, "fontFamily", void 0);
|
|
158
|
-
__decorate([
|
|
159
|
-
inspectorDecorator.Field(function () { return Number; }, { min: 5, default: 26 }),
|
|
160
|
-
__metadata("design:type", Object)
|
|
161
|
-
], Style.prototype, "fontSize", void 0);
|
|
162
|
-
__decorate([
|
|
163
|
-
inspectorDecorator.Field({ type: 'selector', options: ['normal', 'italic', 'oblique'], default: 'normal' }),
|
|
164
|
-
__metadata("design:type", String)
|
|
165
|
-
], Style.prototype, "fontStyle", void 0);
|
|
166
|
-
__decorate([
|
|
167
|
-
inspectorDecorator.Field({ type: 'selector', options: ['normal', 'small-caps'], default: 'normal' }),
|
|
168
|
-
__metadata("design:type", String)
|
|
169
|
-
], Style.prototype, "fontVariant", void 0);
|
|
170
|
-
__decorate([
|
|
171
|
-
inspectorDecorator.Field({
|
|
172
|
-
type: 'selector',
|
|
173
|
-
options: ['normal', 'bold', 'bolder', 'lighter', '100', '200', '300', '400', '500', '600', '700', '800', '900'],
|
|
174
|
-
default: 'normal',
|
|
175
|
-
}),
|
|
176
|
-
__metadata("design:type", String)
|
|
177
|
-
], Style.prototype, "fontWeight", void 0);
|
|
178
|
-
__decorate([
|
|
179
|
-
inspectorDecorator.Field({ default: 0 }),
|
|
180
|
-
__metadata("design:type", Number)
|
|
181
|
-
], Style.prototype, "letterSpacing", void 0);
|
|
182
|
-
__decorate([
|
|
183
|
-
inspectorDecorator.Field({ default: 0 }),
|
|
184
|
-
__metadata("design:type", Number)
|
|
185
|
-
], Style.prototype, "lineHeight", void 0);
|
|
186
|
-
__decorate([
|
|
187
|
-
inspectorDecorator.Field({ type: 'selector', options: ['miter', 'round', 'bevel'], default: 'miter' }),
|
|
188
|
-
__metadata("design:type", String)
|
|
189
|
-
], Style.prototype, "lineJoin", void 0);
|
|
190
|
-
__decorate([
|
|
191
|
-
inspectorDecorator.Field({ default: 10 }),
|
|
192
|
-
__metadata("design:type", Number)
|
|
193
|
-
], Style.prototype, "miterLimit", void 0);
|
|
194
|
-
__decorate([
|
|
195
|
-
inspectorDecorator.Field({ default: 0 }),
|
|
196
|
-
__metadata("design:type", Number)
|
|
197
|
-
], Style.prototype, "padding", void 0);
|
|
198
|
-
__decorate([
|
|
199
|
-
inspectorDecorator.Field(function () { return Color; }, { default: '#000000' }),
|
|
200
|
-
__metadata("design:type", Object)
|
|
201
|
-
], Style.prototype, "stroke", void 0);
|
|
202
|
-
__decorate([
|
|
203
|
-
inspectorDecorator.Field({ default: 0, min: 0 }),
|
|
204
|
-
__metadata("design:type", Number)
|
|
205
|
-
], Style.prototype, "strokeThickness", void 0);
|
|
206
|
-
__decorate([
|
|
207
|
-
inspectorDecorator.Field({ default: 'alphabetic' }),
|
|
208
|
-
__metadata("design:type", String)
|
|
209
|
-
], Style.prototype, "textBaseline", void 0);
|
|
210
|
-
__decorate([
|
|
211
|
-
inspectorDecorator.Field(),
|
|
212
|
-
__metadata("design:type", Boolean)
|
|
213
|
-
], Style.prototype, "trim", void 0);
|
|
214
|
-
__decorate([
|
|
215
|
-
inspectorDecorator.Field({ default: 'pre', type: 'selector', options: ['normal', 'pre', 'pre-line'] }),
|
|
216
|
-
__metadata("design:type", String)
|
|
217
|
-
], Style.prototype, "whiteSpace", void 0);
|
|
218
|
-
__decorate([
|
|
219
|
-
inspectorDecorator.Field(),
|
|
220
|
-
__metadata("design:type", Boolean)
|
|
221
|
-
], Style.prototype, "wordWrap", void 0);
|
|
222
|
-
__decorate([
|
|
223
|
-
inspectorDecorator.Field({ default: 100 }),
|
|
224
|
-
__metadata("design:type", Number)
|
|
225
|
-
], Style.prototype, "wordWrapWidth", void 0);
|
|
226
|
-
__decorate([
|
|
227
|
-
inspectorDecorator.Field(),
|
|
228
|
-
__metadata("design:type", Number)
|
|
229
|
-
], Style.prototype, "leading", void 0);
|
|
230
|
-
return Style;
|
|
231
|
-
}());
|
|
232
84
|
var Text$2 = (function (_super) {
|
|
233
85
|
__extends(Text, _super);
|
|
234
86
|
function Text() {
|
|
@@ -255,24 +107,8 @@ var Text$2 = (function (_super) {
|
|
|
255
107
|
};
|
|
256
108
|
Text.componentName = 'Text';
|
|
257
109
|
__decorate([
|
|
258
|
-
inspectorDecorator.
|
|
259
|
-
type: 'textarea',
|
|
260
|
-
filter: function (text) {
|
|
261
|
-
if (typeof text !== 'string') {
|
|
262
|
-
return '';
|
|
263
|
-
}
|
|
264
|
-
if (text.length > 100) {
|
|
265
|
-
return text.slice(0, 100);
|
|
266
|
-
}
|
|
267
|
-
return text;
|
|
268
|
-
},
|
|
269
|
-
}),
|
|
270
|
-
__metadata("design:type", String)
|
|
110
|
+
inspectorDecorator.type('string')
|
|
271
111
|
], Text.prototype, "text", void 0);
|
|
272
|
-
__decorate([
|
|
273
|
-
inspectorDecorator.Field(),
|
|
274
|
-
__metadata("design:type", Style)
|
|
275
|
-
], Text.prototype, "style", void 0);
|
|
276
112
|
return Text;
|
|
277
113
|
}(eva_js.Component));
|
|
278
114
|
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"),
|
|
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])},i(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=p,l=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=u,exports.TextSystem=l;
|
|
@@ -6,49 +6,47 @@ 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
|
-
|
|
41
9
|
declare class Text_2 extends Component<TextParams> {
|
|
42
10
|
static componentName: string;
|
|
43
11
|
text: string;
|
|
44
|
-
style:
|
|
12
|
+
style: TextParams['style'];
|
|
45
13
|
init(obj?: TextParams): void;
|
|
46
14
|
}
|
|
47
15
|
export { Text_2 as Text }
|
|
48
16
|
|
|
49
17
|
export declare interface TextParams {
|
|
50
18
|
text: string;
|
|
51
|
-
style?:
|
|
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
|
+
};
|
|
52
50
|
}
|
|
53
51
|
|
|
54
52
|
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 {
|
|
3
|
+
import { type } 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,10 +40,6 @@ 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
|
-
|
|
47
43
|
function __awaiter(thisArg, _arguments, P, generator) {
|
|
48
44
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
49
45
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
@@ -81,150 +77,6 @@ function __generator(thisArg, body) {
|
|
|
81
77
|
}
|
|
82
78
|
}
|
|
83
79
|
|
|
84
|
-
var Color = (function () {
|
|
85
|
-
function Color() {
|
|
86
|
-
}
|
|
87
|
-
Color.getProperties = function () {
|
|
88
|
-
return 'color';
|
|
89
|
-
};
|
|
90
|
-
return Color;
|
|
91
|
-
}());
|
|
92
|
-
var Style = (function () {
|
|
93
|
-
function Style() {
|
|
94
|
-
}
|
|
95
|
-
__decorate([
|
|
96
|
-
Field({
|
|
97
|
-
type: 'selector',
|
|
98
|
-
isArray: false,
|
|
99
|
-
options: ['center', 'left', 'right'],
|
|
100
|
-
default: 'left',
|
|
101
|
-
}),
|
|
102
|
-
__metadata("design:type", String)
|
|
103
|
-
], Style.prototype, "align", void 0);
|
|
104
|
-
__decorate([
|
|
105
|
-
Field(),
|
|
106
|
-
__metadata("design:type", Boolean)
|
|
107
|
-
], Style.prototype, "breakWords", void 0);
|
|
108
|
-
__decorate([
|
|
109
|
-
Field(),
|
|
110
|
-
__metadata("design:type", Boolean)
|
|
111
|
-
], Style.prototype, "dropShadow", void 0);
|
|
112
|
-
__decorate([
|
|
113
|
-
Field({ default: 1 }),
|
|
114
|
-
__metadata("design:type", Number)
|
|
115
|
-
], Style.prototype, "dropShadowAlpha", void 0);
|
|
116
|
-
__decorate([
|
|
117
|
-
Field({ default: Math.PI / 6 }),
|
|
118
|
-
__metadata("design:type", Number)
|
|
119
|
-
], Style.prototype, "dropShadowAngle", void 0);
|
|
120
|
-
__decorate([
|
|
121
|
-
Field({ default: 0 }),
|
|
122
|
-
__metadata("design:type", Number)
|
|
123
|
-
], Style.prototype, "dropShadowBlur", void 0);
|
|
124
|
-
__decorate([
|
|
125
|
-
Field(function () { return Color; }, { default: '#000000' }),
|
|
126
|
-
__metadata("design:type", Object)
|
|
127
|
-
], Style.prototype, "dropShadowColor", void 0);
|
|
128
|
-
__decorate([
|
|
129
|
-
Field({ default: 5 }),
|
|
130
|
-
__metadata("design:type", Number)
|
|
131
|
-
], Style.prototype, "dropShadowDistance", void 0);
|
|
132
|
-
__decorate([
|
|
133
|
-
Field(function () { return [Color]; }, { default: ['#000000'] }),
|
|
134
|
-
__metadata("design:type", Object)
|
|
135
|
-
], Style.prototype, "fill", void 0);
|
|
136
|
-
__decorate([
|
|
137
|
-
Field({
|
|
138
|
-
type: 'selector',
|
|
139
|
-
options: { vertical: 1, horizontal: 0 },
|
|
140
|
-
default: 1,
|
|
141
|
-
filter: function (val) { return Number(val); },
|
|
142
|
-
isArray: false,
|
|
143
|
-
}),
|
|
144
|
-
__metadata("design:type", Number)
|
|
145
|
-
], Style.prototype, "fillGradientType", void 0);
|
|
146
|
-
__decorate([
|
|
147
|
-
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
|
-
Field(function () { return String; }, { default: 'Arial' }),
|
|
152
|
-
__metadata("design:type", Object)
|
|
153
|
-
], Style.prototype, "fontFamily", void 0);
|
|
154
|
-
__decorate([
|
|
155
|
-
Field(function () { return Number; }, { min: 5, default: 26 }),
|
|
156
|
-
__metadata("design:type", Object)
|
|
157
|
-
], Style.prototype, "fontSize", void 0);
|
|
158
|
-
__decorate([
|
|
159
|
-
Field({ type: 'selector', options: ['normal', 'italic', 'oblique'], default: 'normal' }),
|
|
160
|
-
__metadata("design:type", String)
|
|
161
|
-
], Style.prototype, "fontStyle", void 0);
|
|
162
|
-
__decorate([
|
|
163
|
-
Field({ type: 'selector', options: ['normal', 'small-caps'], default: 'normal' }),
|
|
164
|
-
__metadata("design:type", String)
|
|
165
|
-
], Style.prototype, "fontVariant", void 0);
|
|
166
|
-
__decorate([
|
|
167
|
-
Field({
|
|
168
|
-
type: 'selector',
|
|
169
|
-
options: ['normal', 'bold', 'bolder', 'lighter', '100', '200', '300', '400', '500', '600', '700', '800', '900'],
|
|
170
|
-
default: 'normal',
|
|
171
|
-
}),
|
|
172
|
-
__metadata("design:type", String)
|
|
173
|
-
], Style.prototype, "fontWeight", void 0);
|
|
174
|
-
__decorate([
|
|
175
|
-
Field({ default: 0 }),
|
|
176
|
-
__metadata("design:type", Number)
|
|
177
|
-
], Style.prototype, "letterSpacing", void 0);
|
|
178
|
-
__decorate([
|
|
179
|
-
Field({ default: 0 }),
|
|
180
|
-
__metadata("design:type", Number)
|
|
181
|
-
], Style.prototype, "lineHeight", void 0);
|
|
182
|
-
__decorate([
|
|
183
|
-
Field({ type: 'selector', options: ['miter', 'round', 'bevel'], default: 'miter' }),
|
|
184
|
-
__metadata("design:type", String)
|
|
185
|
-
], Style.prototype, "lineJoin", void 0);
|
|
186
|
-
__decorate([
|
|
187
|
-
Field({ default: 10 }),
|
|
188
|
-
__metadata("design:type", Number)
|
|
189
|
-
], Style.prototype, "miterLimit", void 0);
|
|
190
|
-
__decorate([
|
|
191
|
-
Field({ default: 0 }),
|
|
192
|
-
__metadata("design:type", Number)
|
|
193
|
-
], Style.prototype, "padding", void 0);
|
|
194
|
-
__decorate([
|
|
195
|
-
Field(function () { return Color; }, { default: '#000000' }),
|
|
196
|
-
__metadata("design:type", Object)
|
|
197
|
-
], Style.prototype, "stroke", void 0);
|
|
198
|
-
__decorate([
|
|
199
|
-
Field({ default: 0, min: 0 }),
|
|
200
|
-
__metadata("design:type", Number)
|
|
201
|
-
], Style.prototype, "strokeThickness", void 0);
|
|
202
|
-
__decorate([
|
|
203
|
-
Field({ default: 'alphabetic' }),
|
|
204
|
-
__metadata("design:type", String)
|
|
205
|
-
], Style.prototype, "textBaseline", void 0);
|
|
206
|
-
__decorate([
|
|
207
|
-
Field(),
|
|
208
|
-
__metadata("design:type", Boolean)
|
|
209
|
-
], Style.prototype, "trim", void 0);
|
|
210
|
-
__decorate([
|
|
211
|
-
Field({ default: 'pre', type: 'selector', options: ['normal', 'pre', 'pre-line'] }),
|
|
212
|
-
__metadata("design:type", String)
|
|
213
|
-
], Style.prototype, "whiteSpace", void 0);
|
|
214
|
-
__decorate([
|
|
215
|
-
Field(),
|
|
216
|
-
__metadata("design:type", Boolean)
|
|
217
|
-
], Style.prototype, "wordWrap", void 0);
|
|
218
|
-
__decorate([
|
|
219
|
-
Field({ default: 100 }),
|
|
220
|
-
__metadata("design:type", Number)
|
|
221
|
-
], Style.prototype, "wordWrapWidth", void 0);
|
|
222
|
-
__decorate([
|
|
223
|
-
Field(),
|
|
224
|
-
__metadata("design:type", Number)
|
|
225
|
-
], Style.prototype, "leading", void 0);
|
|
226
|
-
return Style;
|
|
227
|
-
}());
|
|
228
80
|
var Text$2 = (function (_super) {
|
|
229
81
|
__extends(Text, _super);
|
|
230
82
|
function Text() {
|
|
@@ -251,24 +103,8 @@ var Text$2 = (function (_super) {
|
|
|
251
103
|
};
|
|
252
104
|
Text.componentName = 'Text';
|
|
253
105
|
__decorate([
|
|
254
|
-
|
|
255
|
-
type: 'textarea',
|
|
256
|
-
filter: function (text) {
|
|
257
|
-
if (typeof text !== 'string') {
|
|
258
|
-
return '';
|
|
259
|
-
}
|
|
260
|
-
if (text.length > 100) {
|
|
261
|
-
return text.slice(0, 100);
|
|
262
|
-
}
|
|
263
|
-
return text;
|
|
264
|
-
},
|
|
265
|
-
}),
|
|
266
|
-
__metadata("design:type", String)
|
|
106
|
+
type('string')
|
|
267
107
|
], Text.prototype, "text", void 0);
|
|
268
|
-
__decorate([
|
|
269
|
-
Field(),
|
|
270
|
-
__metadata("design:type", Style)
|
|
271
|
-
], Text.prototype, "style", void 0);
|
|
272
108
|
return Text;
|
|
273
109
|
}(Component));
|
|
274
110
|
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.
|
|
3
|
+
"version": "1.2.8-alpha.0",
|
|
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.
|
|
22
|
-
"@eva/plugin-renderer": "1.2.
|
|
23
|
-
"@eva/renderer-adapter": "1.2.
|
|
24
|
-
"@eva/eva.js": "1.2.
|
|
21
|
+
"@eva/inspector-decorator": "^0.0.5",
|
|
22
|
+
"@eva/plugin-renderer": "1.2.8-alpha.0",
|
|
23
|
+
"@eva/renderer-adapter": "1.2.8-alpha.0",
|
|
24
|
+
"@eva/eva.js": "1.2.8-alpha.0",
|
|
25
25
|
"pixi.js": "^4.8.7"
|
|
26
26
|
}
|
|
27
27
|
}
|