@eva/plugin-renderer-text 1.2.7-editor.6 → 1.2.7-editor.9
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/package.json +4 -4
- package/dist/miniprogram.js +0 -303
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-renderer-text",
|
|
3
|
-
"version": "1.2.7-editor.
|
|
3
|
+
"version": "1.2.7-editor.9",
|
|
4
4
|
"description": "@eva/plugin-renderer-text",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-text.esm.js",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"homepage": "https://eva.js.org",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@eva/inspector-decorator": "0.1.0-alpha.2",
|
|
22
|
-
"@eva/plugin-renderer": "1.2.7-editor.
|
|
23
|
-
"@eva/renderer-adapter": "1.2.7-editor.
|
|
24
|
-
"@eva/eva.js": "1.2.7-editor.
|
|
22
|
+
"@eva/plugin-renderer": "1.2.7-editor.9",
|
|
23
|
+
"@eva/renderer-adapter": "1.2.7-editor.9",
|
|
24
|
+
"@eva/eva.js": "1.2.7-editor.9",
|
|
25
25
|
"pixi.js": "^4.8.7"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/dist/miniprogram.js
DELETED
|
@@ -1,303 +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 { __decorate, __metadata, __extends, __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 { Field } 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 Color = function () {
|
|
11
|
-
function Color() {}
|
|
12
|
-
|
|
13
|
-
Color.getProperties = function () {
|
|
14
|
-
return 'color';
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
return Color;
|
|
18
|
-
}();
|
|
19
|
-
|
|
20
|
-
var Style = function () {
|
|
21
|
-
function Style() {}
|
|
22
|
-
|
|
23
|
-
__decorate([Field({
|
|
24
|
-
type: 'selector',
|
|
25
|
-
isArray: false,
|
|
26
|
-
options: ['center', 'left', 'right'],
|
|
27
|
-
default: 'left'
|
|
28
|
-
}), __metadata("design:type", String)], Style.prototype, "align", void 0);
|
|
29
|
-
|
|
30
|
-
__decorate([Field(), __metadata("design:type", Boolean)], Style.prototype, "breakWords", void 0);
|
|
31
|
-
|
|
32
|
-
__decorate([Field(), __metadata("design:type", Boolean)], Style.prototype, "dropShadow", void 0);
|
|
33
|
-
|
|
34
|
-
__decorate([Field({
|
|
35
|
-
default: 1
|
|
36
|
-
}), __metadata("design:type", Number)], Style.prototype, "dropShadowAlpha", void 0);
|
|
37
|
-
|
|
38
|
-
__decorate([Field({
|
|
39
|
-
default: Math.PI / 6
|
|
40
|
-
}), __metadata("design:type", Number)], Style.prototype, "dropShadowAngle", void 0);
|
|
41
|
-
|
|
42
|
-
__decorate([Field({
|
|
43
|
-
default: 0
|
|
44
|
-
}), __metadata("design:type", Number)], Style.prototype, "dropShadowBlur", void 0);
|
|
45
|
-
|
|
46
|
-
__decorate([Field(function () {
|
|
47
|
-
return Color;
|
|
48
|
-
}, {
|
|
49
|
-
default: '#000000'
|
|
50
|
-
}), __metadata("design:type", Object)], Style.prototype, "dropShadowColor", void 0);
|
|
51
|
-
|
|
52
|
-
__decorate([Field({
|
|
53
|
-
default: 5
|
|
54
|
-
}), __metadata("design:type", Number)], Style.prototype, "dropShadowDistance", void 0);
|
|
55
|
-
|
|
56
|
-
__decorate([Field(function () {
|
|
57
|
-
return [Color];
|
|
58
|
-
}, {
|
|
59
|
-
default: ['#000000']
|
|
60
|
-
}), __metadata("design:type", Object)], Style.prototype, "fill", void 0);
|
|
61
|
-
|
|
62
|
-
__decorate([Field({
|
|
63
|
-
type: 'selector',
|
|
64
|
-
options: {
|
|
65
|
-
vertical: 1,
|
|
66
|
-
horizontal: 0
|
|
67
|
-
},
|
|
68
|
-
default: 1,
|
|
69
|
-
filter: function filter(val) {
|
|
70
|
-
return Number(val);
|
|
71
|
-
},
|
|
72
|
-
isArray: false
|
|
73
|
-
}), __metadata("design:type", Number)], Style.prototype, "fillGradientType", void 0);
|
|
74
|
-
|
|
75
|
-
__decorate([Field(function () {
|
|
76
|
-
return Number;
|
|
77
|
-
}, {
|
|
78
|
-
step: 0.1,
|
|
79
|
-
min: 0,
|
|
80
|
-
max: 1
|
|
81
|
-
}), __metadata("design:type", Array)], Style.prototype, "fillGradientStops", void 0);
|
|
82
|
-
|
|
83
|
-
__decorate([Field(function () {
|
|
84
|
-
return String;
|
|
85
|
-
}, {
|
|
86
|
-
default: 'Arial'
|
|
87
|
-
}), __metadata("design:type", Object)], Style.prototype, "fontFamily", void 0);
|
|
88
|
-
|
|
89
|
-
__decorate([Field(function () {
|
|
90
|
-
return Number;
|
|
91
|
-
}, {
|
|
92
|
-
min: 5,
|
|
93
|
-
default: 26
|
|
94
|
-
}), __metadata("design:type", Object)], Style.prototype, "fontSize", void 0);
|
|
95
|
-
|
|
96
|
-
__decorate([Field({
|
|
97
|
-
type: 'selector',
|
|
98
|
-
options: ['normal', 'italic', 'oblique'],
|
|
99
|
-
default: 'normal'
|
|
100
|
-
}), __metadata("design:type", String)], Style.prototype, "fontStyle", void 0);
|
|
101
|
-
|
|
102
|
-
__decorate([Field({
|
|
103
|
-
type: 'selector',
|
|
104
|
-
options: ['normal', 'small-caps'],
|
|
105
|
-
default: 'normal'
|
|
106
|
-
}), __metadata("design:type", String)], Style.prototype, "fontVariant", void 0);
|
|
107
|
-
|
|
108
|
-
__decorate([Field({
|
|
109
|
-
type: 'selector',
|
|
110
|
-
options: ['normal', 'bold', 'bolder', 'lighter', '100', '200', '300', '400', '500', '600', '700', '800', '900'],
|
|
111
|
-
default: 'normal'
|
|
112
|
-
}), __metadata("design:type", String)], Style.prototype, "fontWeight", void 0);
|
|
113
|
-
|
|
114
|
-
__decorate([Field({
|
|
115
|
-
default: 0
|
|
116
|
-
}), __metadata("design:type", Number)], Style.prototype, "letterSpacing", void 0);
|
|
117
|
-
|
|
118
|
-
__decorate([Field({
|
|
119
|
-
default: 0
|
|
120
|
-
}), __metadata("design:type", Number)], Style.prototype, "lineHeight", void 0);
|
|
121
|
-
|
|
122
|
-
__decorate([Field({
|
|
123
|
-
type: 'selector',
|
|
124
|
-
options: ['miter', 'round', 'bevel'],
|
|
125
|
-
default: 'miter'
|
|
126
|
-
}), __metadata("design:type", String)], Style.prototype, "lineJoin", void 0);
|
|
127
|
-
|
|
128
|
-
__decorate([Field({
|
|
129
|
-
default: 10
|
|
130
|
-
}), __metadata("design:type", Number)], Style.prototype, "miterLimit", void 0);
|
|
131
|
-
|
|
132
|
-
__decorate([Field({
|
|
133
|
-
default: 0
|
|
134
|
-
}), __metadata("design:type", Number)], Style.prototype, "padding", void 0);
|
|
135
|
-
|
|
136
|
-
__decorate([Field(function () {
|
|
137
|
-
return Color;
|
|
138
|
-
}, {
|
|
139
|
-
default: '#000000'
|
|
140
|
-
}), __metadata("design:type", Object)], Style.prototype, "stroke", void 0);
|
|
141
|
-
|
|
142
|
-
__decorate([Field({
|
|
143
|
-
default: 0,
|
|
144
|
-
min: 0
|
|
145
|
-
}), __metadata("design:type", Number)], Style.prototype, "strokeThickness", void 0);
|
|
146
|
-
|
|
147
|
-
__decorate([Field({
|
|
148
|
-
default: 'alphabetic'
|
|
149
|
-
}), __metadata("design:type", String)], Style.prototype, "textBaseline", void 0);
|
|
150
|
-
|
|
151
|
-
__decorate([Field(), __metadata("design:type", Boolean)], Style.prototype, "trim", void 0);
|
|
152
|
-
|
|
153
|
-
__decorate([Field({
|
|
154
|
-
default: 'pre',
|
|
155
|
-
type: 'selector',
|
|
156
|
-
options: ['normal', 'pre', 'pre-line']
|
|
157
|
-
}), __metadata("design:type", String)], Style.prototype, "whiteSpace", void 0);
|
|
158
|
-
|
|
159
|
-
__decorate([Field(), __metadata("design:type", Boolean)], Style.prototype, "wordWrap", void 0);
|
|
160
|
-
|
|
161
|
-
__decorate([Field({
|
|
162
|
-
default: 100
|
|
163
|
-
}), __metadata("design:type", Number)], Style.prototype, "wordWrapWidth", void 0);
|
|
164
|
-
|
|
165
|
-
__decorate([Field(), __metadata("design:type", Number)], Style.prototype, "leading", void 0);
|
|
166
|
-
|
|
167
|
-
return Style;
|
|
168
|
-
}();
|
|
169
|
-
|
|
170
|
-
var Text$2 = function (_super) {
|
|
171
|
-
__extends(Text, _super);
|
|
172
|
-
|
|
173
|
-
function Text() {
|
|
174
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
175
|
-
|
|
176
|
-
_this.text = '';
|
|
177
|
-
_this.style = {};
|
|
178
|
-
return _this;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
Text.prototype.init = function (obj) {
|
|
182
|
-
var style = new TextStyle({
|
|
183
|
-
fontSize: 20
|
|
184
|
-
});
|
|
185
|
-
var newStyle = {};
|
|
186
|
-
|
|
187
|
-
for (var key in style) {
|
|
188
|
-
if (key.indexOf('_') === 0) {
|
|
189
|
-
newStyle[key.substring(1)] = style[key];
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
this.style = newStyle;
|
|
194
|
-
|
|
195
|
-
if (obj) {
|
|
196
|
-
this.text = obj.text;
|
|
197
|
-
|
|
198
|
-
_extends(this.style, obj.style);
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
Text.componentName = 'Text';
|
|
203
|
-
|
|
204
|
-
__decorate([Field({
|
|
205
|
-
type: 'textarea',
|
|
206
|
-
filter: function filter(text) {
|
|
207
|
-
if (typeof text !== 'string') {
|
|
208
|
-
return '';
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
if (text.length > 100) {
|
|
212
|
-
return text.slice(0, 100);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
return text;
|
|
216
|
-
}
|
|
217
|
-
}), __metadata("design:type", String)], Text.prototype, "text", void 0);
|
|
218
|
-
|
|
219
|
-
__decorate([Field(), __metadata("design:type", Style)], Text.prototype, "style", void 0);
|
|
220
|
-
|
|
221
|
-
return Text;
|
|
222
|
-
}(Component);
|
|
223
|
-
|
|
224
|
-
var Text$3 = Text$2;
|
|
225
|
-
|
|
226
|
-
var Text = function (_super) {
|
|
227
|
-
__extends(Text, _super);
|
|
228
|
-
|
|
229
|
-
function Text() {
|
|
230
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
231
|
-
|
|
232
|
-
_this.name = 'Text';
|
|
233
|
-
_this.texts = {};
|
|
234
|
-
return _this;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
Text.prototype.init = function () {
|
|
238
|
-
this.renderSystem = this.game.getSystem(RendererSystem);
|
|
239
|
-
this.renderSystem.rendererManager.register(this);
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
Text.prototype.componentChanged = function (changed) {
|
|
243
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
244
|
-
var component, text;
|
|
245
|
-
return __generator(this, function (_a) {
|
|
246
|
-
if (changed.componentName !== 'Text') return [2];
|
|
247
|
-
|
|
248
|
-
if (changed.type === OBSERVER_TYPE.ADD) {
|
|
249
|
-
component = changed.component;
|
|
250
|
-
text = new Text$4(component.text, component.style);
|
|
251
|
-
this.containerManager.getContainer(changed.gameObject.id).addChildAt(text, 0);
|
|
252
|
-
this.texts[changed.gameObject.id] = {
|
|
253
|
-
text: text,
|
|
254
|
-
component: changed.component
|
|
255
|
-
};
|
|
256
|
-
this.setSize(changed);
|
|
257
|
-
} else if (changed.type === OBSERVER_TYPE.REMOVE) {
|
|
258
|
-
this.containerManager.getContainer(changed.gameObject.id).removeChild(this.texts[changed.gameObject.id].text);
|
|
259
|
-
this.texts[changed.gameObject.id].text.destroy({
|
|
260
|
-
children: true
|
|
261
|
-
});
|
|
262
|
-
delete this.texts[changed.gameObject.id];
|
|
263
|
-
} else {
|
|
264
|
-
this.change(changed);
|
|
265
|
-
this.setSize(changed);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
return [2];
|
|
269
|
-
});
|
|
270
|
-
});
|
|
271
|
-
};
|
|
272
|
-
|
|
273
|
-
Text.prototype.change = function (changed) {
|
|
274
|
-
var _a = this.texts[changed.gameObject.id],
|
|
275
|
-
text = _a.text,
|
|
276
|
-
component = _a.component;
|
|
277
|
-
|
|
278
|
-
if (changed.prop.prop[0] === 'text') {
|
|
279
|
-
text.text = component.text;
|
|
280
|
-
} else if (changed.prop.prop[0] === 'style') {
|
|
281
|
-
_extends(text.style, changed.component.style);
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
Text.prototype.setSize = function (changed) {
|
|
286
|
-
var transform = changed.gameObject.transform;
|
|
287
|
-
if (!transform) return;
|
|
288
|
-
transform.size.width = this.texts[changed.gameObject.id].text.width;
|
|
289
|
-
transform.size.height = this.texts[changed.gameObject.id].text.height;
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
Text.systemName = 'Text';
|
|
293
|
-
Text = __decorate([decorators.componentObserver({
|
|
294
|
-
Text: ['text', {
|
|
295
|
-
prop: ['style'],
|
|
296
|
-
deep: true
|
|
297
|
-
}]
|
|
298
|
-
})], Text);
|
|
299
|
-
return Text;
|
|
300
|
-
}(Renderer);
|
|
301
|
-
|
|
302
|
-
var Text$1 = Text;
|
|
303
|
-
export { Text$3 as Text, Text$1 as TextSystem };
|