@lightningjs/blits 0.4.2 → 0.5.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/CHANGELOG.md +6 -0
- package/boilerplate/package.json +1 -1
- package/package.json +1 -1
- package/src/components/Text.js +8 -5
- package/src/element.js +9 -1
package/CHANGELOG.md
CHANGED
package/boilerplate/package.json
CHANGED
package/package.json
CHANGED
package/src/components/Text.js
CHANGED
|
@@ -31,8 +31,8 @@ export default () =>
|
|
|
31
31
|
letterSpacing="$letterspacing"
|
|
32
32
|
stretch="$stretch"
|
|
33
33
|
contain="$_contain"
|
|
34
|
-
:
|
|
35
|
-
:
|
|
34
|
+
:wordWrap="$wordwrap"
|
|
35
|
+
:maxLines="$maxlines"
|
|
36
36
|
:textAlign="$align"
|
|
37
37
|
@loaded="$@loaded"
|
|
38
38
|
@error="$@error"
|
|
@@ -54,15 +54,18 @@ export default () =>
|
|
|
54
54
|
'letterspacing',
|
|
55
55
|
'stretch',
|
|
56
56
|
'align',
|
|
57
|
-
'
|
|
58
|
-
'
|
|
57
|
+
'wordwrap',
|
|
58
|
+
'maxlines',
|
|
59
59
|
'contain',
|
|
60
60
|
'@loaded',
|
|
61
61
|
'@error',
|
|
62
62
|
],
|
|
63
63
|
computed: {
|
|
64
64
|
_contain() {
|
|
65
|
-
return
|
|
65
|
+
return (
|
|
66
|
+
this.contain ||
|
|
67
|
+
(this.wordwrap && this.maxlines ? 'both' : this.wordwrap ? 'width' : 'none')
|
|
68
|
+
)
|
|
66
69
|
},
|
|
67
70
|
},
|
|
68
71
|
})
|
package/src/element.js
CHANGED
|
@@ -54,6 +54,8 @@ const transformations = {
|
|
|
54
54
|
delete props.h
|
|
55
55
|
'z' in props && (props.zIndex = props.z)
|
|
56
56
|
delete props.z
|
|
57
|
+
'wordWrap' in props && (props.width = props.wordWrap)
|
|
58
|
+
delete props.wordWrap
|
|
57
59
|
},
|
|
58
60
|
parent(props) {
|
|
59
61
|
if (props.parent === 'root') {
|
|
@@ -161,6 +163,12 @@ const transformations = {
|
|
|
161
163
|
texture(props, setProperties) {
|
|
162
164
|
this.src(props, setProperties)
|
|
163
165
|
},
|
|
166
|
+
maxLines(props, setProperties, element) {
|
|
167
|
+
if (props.maxLines) {
|
|
168
|
+
props.height = props.maxLines * element.node.fontSize
|
|
169
|
+
}
|
|
170
|
+
delete props.maxLines
|
|
171
|
+
},
|
|
164
172
|
}
|
|
165
173
|
|
|
166
174
|
const Element = {
|
|
@@ -217,7 +225,7 @@ const Element = {
|
|
|
217
225
|
|
|
218
226
|
transformations.remap(props)
|
|
219
227
|
if (transformations[prop]) {
|
|
220
|
-
transformations[prop](props, this.setProperties)
|
|
228
|
+
transformations[prop](props, this.setProperties, this)
|
|
221
229
|
}
|
|
222
230
|
|
|
223
231
|
Object.keys(props).forEach((prop) => {
|