@triniwiz/nativescript-masonkit 1.0.0-alpha.31 → 1.0.0-alpha.33
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/common.d.ts +2 -1
- package/common.js +40 -4
- package/common.js.map +1 -1
- package/package.json +1 -1
- package/platforms/android/masonkit-release.aar +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason-Swift.h +59 -20
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Mason +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.abi.json +18142 -9968
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.private.swiftinterface +170 -52
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftinterface +170 -52
- package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +3259 -3081
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason-Swift.h +124 -46
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Mason +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.abi.json +23045 -14871
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +275 -157
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftinterface +275 -157
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +23045 -14871
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +275 -157
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +275 -157
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/_CodeSignature/CodeResources +26 -26
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +3259 -3075
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +3181 -3002
- package/style.d.ts +12 -4
- package/style.js +212 -48
- package/style.js.map +1 -1
package/style.d.ts
CHANGED
|
@@ -150,15 +150,23 @@ export declare class Style {
|
|
|
150
150
|
set flexShrink(value: number);
|
|
151
151
|
get scrollBarWidth(): number | CoreTypes.LengthType;
|
|
152
152
|
set scrollBarWidth(value: number | CoreTypes.LengthType);
|
|
153
|
+
get letterSpacing(): number | CoreTypes.LengthType;
|
|
154
|
+
set letterSpacing(value: number | CoreTypes.LengthType);
|
|
155
|
+
get lineHeight(): number | CoreTypes.LengthType;
|
|
156
|
+
set lineHeight(value: number | CoreTypes.LengthType);
|
|
157
|
+
get textOverflow(): 'clip' | 'ellipsis' | `${string}`;
|
|
158
|
+
set textOverflow(value: 'clip' | 'ellipsis' | `${string}`);
|
|
159
|
+
get textAlignment(): 'left' | 'right' | 'center' | 'justify' | 'start' | 'end';
|
|
160
|
+
set textAlignment(value: 'left' | 'right' | 'center' | 'justify' | 'start' | 'end');
|
|
153
161
|
toJSON(): {
|
|
154
162
|
display: "none" | "flex" | "grid" | "block" | "inline" | "inline-block" | "inline-flex" | "inline-grid";
|
|
155
163
|
position: "relative" | "absolute";
|
|
156
164
|
flexDirection: "row" | "row-reverse" | "column" | "column-reverse";
|
|
157
165
|
flexWrap: "wrap" | "wrap-reverse" | "no-wrap";
|
|
158
|
-
justifyContent: "normal" | "flex-start" | "flex-end" | "start" | "end" | "
|
|
159
|
-
alignItems: "normal" | "flex-start" | "flex-end" | "start" | "end" | "
|
|
160
|
-
alignContent: "
|
|
161
|
-
alignSelf: "normal" | "flex-start" | "flex-end" | "start" | "end" | "
|
|
166
|
+
justifyContent: "center" | "normal" | "flex-start" | "flex-end" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly";
|
|
167
|
+
alignItems: "center" | "normal" | "flex-start" | "flex-end" | "start" | "end" | "baseline" | "stretch";
|
|
168
|
+
alignContent: "center" | "normal" | "start" | "end" | "stretch" | "space-between" | "space-around" | "space-evenly";
|
|
169
|
+
alignSelf: "center" | "normal" | "flex-start" | "flex-end" | "start" | "end" | "baseline" | "stretch";
|
|
162
170
|
flexGrow: number;
|
|
163
171
|
minWidth: LengthAuto;
|
|
164
172
|
minHeight: LengthAuto;
|
package/style.js
CHANGED
|
@@ -98,8 +98,11 @@ var TextStyleKeys;
|
|
|
98
98
|
TextStyleKeys[TextStyleKeys["SIZE_STATE"] = 13] = "SIZE_STATE";
|
|
99
99
|
TextStyleKeys[TextStyleKeys["FONT_WEIGHT"] = 16] = "FONT_WEIGHT";
|
|
100
100
|
TextStyleKeys[TextStyleKeys["FONT_WEIGHT_STATE"] = 20] = "FONT_WEIGHT_STATE";
|
|
101
|
-
TextStyleKeys[TextStyleKeys["
|
|
102
|
-
TextStyleKeys[TextStyleKeys["
|
|
101
|
+
TextStyleKeys[TextStyleKeys["FONT_STYLE_SLANT"] = 24] = "FONT_STYLE_SLANT";
|
|
102
|
+
TextStyleKeys[TextStyleKeys["FONT_STYLE_TYPE"] = 28] = "FONT_STYLE_TYPE";
|
|
103
|
+
TextStyleKeys[TextStyleKeys["FONT_STYLE_STATE"] = 29] = "FONT_STYLE_STATE";
|
|
104
|
+
TextStyleKeys[TextStyleKeys["FONT_FAMILY_STATE"] = 30] = "FONT_FAMILY_STATE";
|
|
105
|
+
TextStyleKeys[TextStyleKeys["FONT_RESOLVED_DIRTY"] = 31] = "FONT_RESOLVED_DIRTY";
|
|
103
106
|
TextStyleKeys[TextStyleKeys["BACKGROUND_COLOR"] = 32] = "BACKGROUND_COLOR";
|
|
104
107
|
TextStyleKeys[TextStyleKeys["BACKGROUND_COLOR_STATE"] = 36] = "BACKGROUND_COLOR_STATE";
|
|
105
108
|
TextStyleKeys[TextStyleKeys["DECORATION_LINE"] = 40] = "DECORATION_LINE";
|
|
@@ -122,6 +125,11 @@ var TextStyleKeys;
|
|
|
122
125
|
TextStyleKeys[TextStyleKeys["TEXT_JUSTIFY_STATE"] = 108] = "TEXT_JUSTIFY_STATE";
|
|
123
126
|
TextStyleKeys[TextStyleKeys["TEXT_INDENT"] = 112] = "TEXT_INDENT";
|
|
124
127
|
TextStyleKeys[TextStyleKeys["TEXT_INDENT_STATE"] = 116] = "TEXT_INDENT_STATE";
|
|
128
|
+
TextStyleKeys[TextStyleKeys["TEXT_OVERFLOW"] = 120] = "TEXT_OVERFLOW";
|
|
129
|
+
TextStyleKeys[TextStyleKeys["TEXT_OVERFLOW_STATE"] = 124] = "TEXT_OVERFLOW_STATE";
|
|
130
|
+
TextStyleKeys[TextStyleKeys["LINE_HEIGHT"] = 128] = "LINE_HEIGHT";
|
|
131
|
+
TextStyleKeys[TextStyleKeys["LINE_HEIGHT_TYPE"] = 132] = "LINE_HEIGHT_TYPE";
|
|
132
|
+
TextStyleKeys[TextStyleKeys["LINE_HEIGHT_STATE"] = 133] = "LINE_HEIGHT_STATE";
|
|
125
133
|
})(TextStyleKeys || (TextStyleKeys = {}));
|
|
126
134
|
function parseLengthPercentageAuto(type, value) {
|
|
127
135
|
switch (type) {
|
|
@@ -207,21 +215,25 @@ class TextStateKeys {
|
|
|
207
215
|
return (this.bits & flag.bits) !== 0n;
|
|
208
216
|
}
|
|
209
217
|
}
|
|
218
|
+
TextStateKeys.ALL = new TextStateKeys(-1n);
|
|
219
|
+
TextStateKeys.NONE = new TextStateKeys(0n);
|
|
210
220
|
TextStateKeys.COLOR = new TextStateKeys(1n << 0n);
|
|
211
|
-
TextStateKeys.
|
|
212
|
-
TextStateKeys.
|
|
213
|
-
TextStateKeys.
|
|
214
|
-
TextStateKeys.
|
|
215
|
-
TextStateKeys.
|
|
216
|
-
TextStateKeys.
|
|
217
|
-
TextStateKeys.
|
|
218
|
-
TextStateKeys.
|
|
219
|
-
TextStateKeys.
|
|
221
|
+
TextStateKeys.SIZE = new TextStateKeys(1n << 1n);
|
|
222
|
+
TextStateKeys.FONT_WEIGHT = new TextStateKeys(1n << 2n);
|
|
223
|
+
TextStateKeys.FONT_STYLE = new TextStateKeys(1n << 3n);
|
|
224
|
+
TextStateKeys.FONT_FAMILY = new TextStateKeys(1n << 4n);
|
|
225
|
+
TextStateKeys.LETTER_SPACING = new TextStateKeys(1n << 5n);
|
|
226
|
+
TextStateKeys.DECORATION_LINE = new TextStateKeys(1n << 6n);
|
|
227
|
+
TextStateKeys.DECORATION_COLOR = new TextStateKeys(1n << 7n);
|
|
228
|
+
TextStateKeys.DECORATION_STYLE = new TextStateKeys(1n << 8n);
|
|
229
|
+
TextStateKeys.BACKGROUND_COLOR = new TextStateKeys(1n << 9n);
|
|
220
230
|
TextStateKeys.TEXT_WRAP = new TextStateKeys(1n << 10n);
|
|
221
|
-
TextStateKeys.
|
|
222
|
-
TextStateKeys.
|
|
223
|
-
TextStateKeys.
|
|
224
|
-
TextStateKeys.
|
|
231
|
+
TextStateKeys.WHITE_SPACE = new TextStateKeys(1n << 11n);
|
|
232
|
+
TextStateKeys.TRANSFORM = new TextStateKeys(1n << 12n);
|
|
233
|
+
TextStateKeys.TEXT_JUSTIFY = new TextStateKeys(1n << 13n);
|
|
234
|
+
TextStateKeys.TEXT_OVERFLOW = new TextStateKeys(1n << 14n);
|
|
235
|
+
TextStateKeys.LINE_HEIGHT = new TextStateKeys(1n << 15n);
|
|
236
|
+
TextStateKeys.TEXT_ALIGN = new TextStateKeys(1n << 16n);
|
|
225
237
|
const getInt8 = (view, offset) => {
|
|
226
238
|
return view.getInt8(offset);
|
|
227
239
|
};
|
|
@@ -269,7 +281,11 @@ export class Style {
|
|
|
269
281
|
const ret = new Style();
|
|
270
282
|
ret.view_ = view;
|
|
271
283
|
if (__ANDROID__) {
|
|
272
|
-
|
|
284
|
+
let style = nativeView?.getStyle?.();
|
|
285
|
+
if (!style) {
|
|
286
|
+
// if a non mason view is passed
|
|
287
|
+
style = org.nativescript.mason.masonkit.Mason.getShared().styleForView(nativeView);
|
|
288
|
+
}
|
|
273
289
|
const styleBuffer = style.getValues();
|
|
274
290
|
const buffer = ArrayBuffer.from(styleBuffer);
|
|
275
291
|
ret.style_view = new DataView(buffer);
|
|
@@ -278,23 +294,17 @@ export class Style {
|
|
|
278
294
|
ret.text_style_view = new DataView(textBuffer);
|
|
279
295
|
}
|
|
280
296
|
else if (__APPLE__) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
// const buffer = interop.bufferFromData(styleBuffer);
|
|
293
|
-
// ret.style_view = new DataView(buffer);
|
|
294
|
-
// const textStyleBuffer = (nativeView as MasonText).textValues;
|
|
295
|
-
// const textBuffer = interop.bufferFromData(textStyleBuffer);
|
|
296
|
-
// ret.text_style_view = new DataView(textBuffer);
|
|
297
|
-
// }
|
|
297
|
+
let style = nativeView?.style;
|
|
298
|
+
if (!style) {
|
|
299
|
+
style = NSCMason.shared.styleForView(nativeView);
|
|
300
|
+
}
|
|
301
|
+
const styleBuffer = style.values;
|
|
302
|
+
const buffer = interop.bufferFromData(styleBuffer);
|
|
303
|
+
ret.style_view = new DataView(buffer);
|
|
304
|
+
//@ts-ignore
|
|
305
|
+
const textStyleBuffer = style.textValues;
|
|
306
|
+
const textBuffer = interop.bufferFromData(textStyleBuffer);
|
|
307
|
+
ret.text_style_view = new DataView(textBuffer);
|
|
298
308
|
}
|
|
299
309
|
//console.timeEnd('fromView');
|
|
300
310
|
return ret;
|
|
@@ -309,15 +319,9 @@ export class Style {
|
|
|
309
319
|
view.syncStyle(this.isDirty.toString(), this.isTextDirty.toString());
|
|
310
320
|
}
|
|
311
321
|
else if (__APPLE__) {
|
|
312
|
-
|
|
313
|
-
//
|
|
314
|
-
|
|
315
|
-
// // @ts-ignore
|
|
316
|
-
// view.syncStyle(this.isDirty.toString());
|
|
317
|
-
// } else {
|
|
318
|
-
// const view = this.view.ios as never as MasonText;
|
|
319
|
-
// view.syncStyleTextState(this.isDirty.toString(), this.isTextDirty.toString());
|
|
320
|
-
// }
|
|
322
|
+
const view = this.view.ios;
|
|
323
|
+
// @ts-ignore
|
|
324
|
+
view.mason_syncStyle(this.isDirty.toString(), this.isTextDirty.toString());
|
|
321
325
|
}
|
|
322
326
|
this.resetState();
|
|
323
327
|
}
|
|
@@ -487,8 +491,6 @@ export class Style {
|
|
|
487
491
|
weight = 300;
|
|
488
492
|
break;
|
|
489
493
|
case 'normal':
|
|
490
|
-
weight = 400;
|
|
491
|
-
break;
|
|
492
494
|
case '400':
|
|
493
495
|
weight = 400;
|
|
494
496
|
break;
|
|
@@ -498,10 +500,8 @@ export class Style {
|
|
|
498
500
|
case '600':
|
|
499
501
|
weight = 600;
|
|
500
502
|
break;
|
|
501
|
-
case 'bold':
|
|
502
|
-
weight = 700;
|
|
503
|
-
break;
|
|
504
503
|
case '700':
|
|
504
|
+
case 'bold':
|
|
505
505
|
weight = 700;
|
|
506
506
|
break;
|
|
507
507
|
case '800':
|
|
@@ -557,7 +557,7 @@ export class Style {
|
|
|
557
557
|
// BLACK ?
|
|
558
558
|
return 0;
|
|
559
559
|
}
|
|
560
|
-
return getInt32(this.text_style_view, TextStyleKeys.
|
|
560
|
+
return getInt32(this.text_style_view, TextStyleKeys.TEXT_WRAP);
|
|
561
561
|
}
|
|
562
562
|
set textWrap(value) {
|
|
563
563
|
if (!this.text_style_view) {
|
|
@@ -2328,6 +2328,170 @@ export class Style {
|
|
|
2328
2328
|
}
|
|
2329
2329
|
}
|
|
2330
2330
|
}
|
|
2331
|
+
get letterSpacing() {
|
|
2332
|
+
return getFloat32(this.text_style_view, TextStyleKeys.LETTER_SPACING);
|
|
2333
|
+
}
|
|
2334
|
+
set letterSpacing(value) {
|
|
2335
|
+
if (typeof value === 'number') {
|
|
2336
|
+
setFloat32(this.text_style_view, TextStyleKeys.LETTER_SPACING, value);
|
|
2337
|
+
setUint8(this.text_style_view, TextStyleKeys.LETTER_SPACING_STATE, 1);
|
|
2338
|
+
this.setOrAppendTextState(TextStateKeys.LETTER_SPACING);
|
|
2339
|
+
}
|
|
2340
|
+
else if (typeof value === 'object') {
|
|
2341
|
+
switch (value.unit) {
|
|
2342
|
+
case 'dip':
|
|
2343
|
+
setFloat32(this.text_style_view, TextStyleKeys.LETTER_SPACING, layout.toDevicePixels(value.value));
|
|
2344
|
+
setUint8(this.text_style_view, TextStyleKeys.LETTER_SPACING_STATE, 1);
|
|
2345
|
+
this.setOrAppendTextState(TextStateKeys.LETTER_SPACING);
|
|
2346
|
+
break;
|
|
2347
|
+
case 'px':
|
|
2348
|
+
setFloat32(this.text_style_view, TextStyleKeys.LETTER_SPACING, value.value);
|
|
2349
|
+
setUint8(this.text_style_view, TextStyleKeys.LETTER_SPACING_STATE, 1);
|
|
2350
|
+
this.setOrAppendTextState(TextStateKeys.LETTER_SPACING);
|
|
2351
|
+
break;
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
get lineHeight() {
|
|
2356
|
+
return getFloat32(this.text_style_view, TextStyleKeys.LINE_HEIGHT);
|
|
2357
|
+
}
|
|
2358
|
+
set lineHeight(value) {
|
|
2359
|
+
if (typeof value === 'number') {
|
|
2360
|
+
setFloat32(this.text_style_view, TextStyleKeys.LINE_HEIGHT, value);
|
|
2361
|
+
setUint8(this.text_style_view, TextStyleKeys.LINE_HEIGHT_STATE, 1);
|
|
2362
|
+
setUint8(this.text_style_view, TextStyleKeys.LINE_HEIGHT_TYPE, 0);
|
|
2363
|
+
this.setOrAppendTextState(TextStateKeys.LINE_HEIGHT);
|
|
2364
|
+
}
|
|
2365
|
+
else if (typeof value === 'object') {
|
|
2366
|
+
switch (value.unit) {
|
|
2367
|
+
case 'dip':
|
|
2368
|
+
setFloat32(this.text_style_view, TextStyleKeys.LETTER_SPACING, layout.toDevicePixels(value.value));
|
|
2369
|
+
setUint8(this.text_style_view, TextStyleKeys.LINE_HEIGHT_STATE, 1);
|
|
2370
|
+
setUint8(this.text_style_view, TextStyleKeys.LINE_HEIGHT_TYPE, 1);
|
|
2371
|
+
this.setOrAppendTextState(TextStateKeys.LETTER_SPACING);
|
|
2372
|
+
break;
|
|
2373
|
+
case 'px':
|
|
2374
|
+
setFloat32(this.text_style_view, TextStyleKeys.LETTER_SPACING, value.value);
|
|
2375
|
+
setUint8(this.text_style_view, TextStyleKeys.LINE_HEIGHT_STATE, 1);
|
|
2376
|
+
setUint8(this.text_style_view, TextStyleKeys.LINE_HEIGHT_TYPE, 1);
|
|
2377
|
+
this.setOrAppendTextState(TextStateKeys.LETTER_SPACING);
|
|
2378
|
+
break;
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2382
|
+
get textOverflow() {
|
|
2383
|
+
if (!this.text_style_view) {
|
|
2384
|
+
// clip ?
|
|
2385
|
+
return 'clip';
|
|
2386
|
+
}
|
|
2387
|
+
const type = getInt32(this.text_style_view, TextStyleKeys.TEXT_OVERFLOW);
|
|
2388
|
+
switch (type) {
|
|
2389
|
+
case 0:
|
|
2390
|
+
return 'clip';
|
|
2391
|
+
case 1:
|
|
2392
|
+
return 'ellipsis';
|
|
2393
|
+
default:
|
|
2394
|
+
}
|
|
2395
|
+
if (__ANDROID__) {
|
|
2396
|
+
// @ts-ignore
|
|
2397
|
+
const overflow = this.view_._view.getTextOverflow();
|
|
2398
|
+
}
|
|
2399
|
+
if (__APPLE__) {
|
|
2400
|
+
// @ts-ignore
|
|
2401
|
+
const overflow = this.view_._view.textOverflow;
|
|
2402
|
+
}
|
|
2403
|
+
return 'clip';
|
|
2404
|
+
}
|
|
2405
|
+
set textOverflow(value) {
|
|
2406
|
+
if (!this.text_style_view) {
|
|
2407
|
+
return;
|
|
2408
|
+
}
|
|
2409
|
+
let flow = -1;
|
|
2410
|
+
switch (value) {
|
|
2411
|
+
case 'clip':
|
|
2412
|
+
flow = 0;
|
|
2413
|
+
break;
|
|
2414
|
+
case 'ellipsis':
|
|
2415
|
+
flow = 1;
|
|
2416
|
+
break;
|
|
2417
|
+
default:
|
|
2418
|
+
{
|
|
2419
|
+
if (__ANDROID__) {
|
|
2420
|
+
// @ts-ignore
|
|
2421
|
+
const overflow = this.view_._view.getTextOverflow();
|
|
2422
|
+
}
|
|
2423
|
+
if (__APPLE__) {
|
|
2424
|
+
// @ts-ignore
|
|
2425
|
+
const overflow = this.view_._view.textOverflow;
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
break;
|
|
2429
|
+
}
|
|
2430
|
+
if (flow !== -1) {
|
|
2431
|
+
setInt32(this.text_style_view, TextStyleKeys.TEXT_OVERFLOW, flow);
|
|
2432
|
+
setInt8(this.text_style_view, TextStyleKeys.TEXT_OVERFLOW_STATE, 1);
|
|
2433
|
+
this.setOrAppendTextState(TextStateKeys.TEXT_OVERFLOW);
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
get textAlignment() {
|
|
2437
|
+
if (!this.text_style_view) {
|
|
2438
|
+
// clip ?
|
|
2439
|
+
return 'start';
|
|
2440
|
+
}
|
|
2441
|
+
const type = getInt32(this.text_style_view, TextStyleKeys.TEXT_ALIGN);
|
|
2442
|
+
switch (type) {
|
|
2443
|
+
case 0:
|
|
2444
|
+
// auto
|
|
2445
|
+
return 'start';
|
|
2446
|
+
case 1:
|
|
2447
|
+
return 'left';
|
|
2448
|
+
case 2:
|
|
2449
|
+
return 'right';
|
|
2450
|
+
case 3:
|
|
2451
|
+
return 'center';
|
|
2452
|
+
case 4:
|
|
2453
|
+
return 'justify';
|
|
2454
|
+
case 5:
|
|
2455
|
+
return 'start';
|
|
2456
|
+
case 6:
|
|
2457
|
+
return 'end';
|
|
2458
|
+
default:
|
|
2459
|
+
return 'start';
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
set textAlignment(value) {
|
|
2463
|
+
if (!this.text_style_view) {
|
|
2464
|
+
return;
|
|
2465
|
+
}
|
|
2466
|
+
let align = -1;
|
|
2467
|
+
switch (value) {
|
|
2468
|
+
case 'left':
|
|
2469
|
+
align = 1;
|
|
2470
|
+
break;
|
|
2471
|
+
case 'right':
|
|
2472
|
+
align = 2;
|
|
2473
|
+
break;
|
|
2474
|
+
case 'center':
|
|
2475
|
+
align = 3;
|
|
2476
|
+
break;
|
|
2477
|
+
case 'justify':
|
|
2478
|
+
align = 4;
|
|
2479
|
+
break;
|
|
2480
|
+
case 'start':
|
|
2481
|
+
align = 5;
|
|
2482
|
+
break;
|
|
2483
|
+
case 'end':
|
|
2484
|
+
align = 6;
|
|
2485
|
+
break;
|
|
2486
|
+
default:
|
|
2487
|
+
break;
|
|
2488
|
+
}
|
|
2489
|
+
if (align !== -1) {
|
|
2490
|
+
setInt32(this.text_style_view, TextStyleKeys.TEXT_ALIGN, align);
|
|
2491
|
+
setInt8(this.text_style_view, TextStyleKeys.TEXT_ALIGN_STATE, 1);
|
|
2492
|
+
this.setOrAppendTextState(TextStateKeys.TEXT_ALIGN);
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2331
2495
|
toJSON() {
|
|
2332
2496
|
return {
|
|
2333
2497
|
display: this.display,
|