@triniwiz/nativescript-masonkit 1.0.0-alpha.2 → 1.0.0-alpha.22

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.
Files changed (58) hide show
  1. package/index.d.ts +167 -17
  2. package/package.json +4 -4
  3. package/platforms/android/include.gradle +22 -1
  4. package/platforms/android/masonkit-release.aar +0 -0
  5. package/platforms/ios/Mason.xcframework/Info.plist +9 -5
  6. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason-Swift.h +495 -313
  7. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason.h +11 -0
  8. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/mason_native.h +215 -818
  9. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Info.plist +0 -0
  10. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Mason +0 -0
  11. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  12. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.abi.json +30167 -19469
  13. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.private.swiftinterface +660 -310
  14. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  15. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftinterface +660 -310
  16. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/module.modulemap +1 -1
  17. package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  18. package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +2421 -0
  19. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason-Swift.h +1053 -689
  20. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason.h +11 -0
  21. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/mason_native.h +215 -818
  22. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Info.plist +0 -0
  23. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Mason +0 -0
  24. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  25. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  26. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.abi.json +30167 -19469
  27. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +660 -310
  28. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  29. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftinterface +660 -310
  30. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +30167 -19469
  31. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +660 -310
  32. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  33. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +660 -310
  34. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/module.modulemap +1 -1
  35. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/_CodeSignature/CodeResources +33 -97
  36. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  37. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +2421 -0
  38. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +2357 -0
  39. package/common.d.ts +0 -75
  40. package/common.js +0 -1556
  41. package/common.js.map +0 -1
  42. package/helpers.d.ts +0 -233
  43. package/helpers.js +0 -3382
  44. package/helpers.js.map +0 -1
  45. package/index.android.d.ts +0 -26
  46. package/index.android.js +0 -95
  47. package/index.android.js.map +0 -1
  48. package/index.ios.d.ts +0 -27
  49. package/index.ios.js +0 -136
  50. package/index.ios.js.map +0 -1
  51. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/PrivateHeaders/mason_native.h +0 -676
  52. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/PrivateHeaders/mason_native.h +0 -676
  53. package/platforms/ios/Podfile +0 -1
  54. package/platforms/ios/build.xcconfig +0 -2
  55. package/platforms/ios/src/JSIModule.h +0 -217
  56. package/platforms/ios/src/JSIModule.mm +0 -2788
  57. package/platforms/ios/src/include/mason_native.h +0 -945
  58. package/platforms/ios/src/module.modulemap +0 -4
package/helpers.js DELETED
@@ -1,3382 +0,0 @@
1
- import { Length, Utils } from '@nativescript/core';
2
- export let JSIEnabled = false;
3
- if (global.isAndroid) {
4
- try {
5
- __non_webpack_require__('system_lib://libmasonnativev8.so');
6
- // JSIEnabled = true;
7
- }
8
- catch (error) {
9
- console.warn('Failed to enable on FastAPI', error);
10
- }
11
- }
12
- if (global.isIOS) {
13
- TSCMason.alwaysEnable = true;
14
- if (!JSIEnabled) {
15
- try {
16
- //@ts-ignore
17
- const module = new global.JSIModule();
18
- // module.install()
19
- // JSIEnabled = true;
20
- }
21
- catch (error) {
22
- console.warn('Failed to enable on FastAPI', error);
23
- }
24
- }
25
- }
26
- function getMasonInstance(instance) {
27
- const nativeView = instance?.nativeView;
28
- if (instance._isMasonChild) {
29
- const parent = instance.parent?.nativeView;
30
- return parent?.nodeForView?.(nativeView);
31
- }
32
- return nativeView;
33
- }
34
- export function _forceStyleUpdate(instance) {
35
- if (!instance._hasNativeView) {
36
- return;
37
- }
38
- if (JSIEnabled) {
39
- global.__Mason_updateNodeAndStyle(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr);
40
- }
41
- else {
42
- if (global.isAndroid) {
43
- const nodeOrView = getMasonInstance(instance);
44
- nodeOrView.updateNodeAndStyle();
45
- }
46
- if (global.isIOS) {
47
- instance.ios.mason.updateNodeStyle();
48
- }
49
- }
50
- }
51
- export function _markDirty(instance) {
52
- if (!instance._hasNativeView) {
53
- return;
54
- }
55
- if (JSIEnabled) {
56
- global.__Mason_markDirty(instance._masonPtr, instance._masonNodePtr);
57
- }
58
- else {
59
- if (global.isAndroid) {
60
- const nodeOrView = getMasonInstance(instance);
61
- if (instance._isMasonChild) {
62
- nodeOrView.dirty();
63
- }
64
- else {
65
- nodeOrView.markNodeDirty();
66
- }
67
- }
68
- if (global.isIOS) {
69
- instance.ios.mason.markDirty();
70
- }
71
- }
72
- }
73
- export function _isDirty(instance) {
74
- if (!instance._hasNativeView) {
75
- return;
76
- }
77
- if (JSIEnabled) {
78
- return global.__Mason_isDirty(instance._masonPtr, instance._masonNodePtr);
79
- }
80
- else {
81
- if (global.isAndroid) {
82
- const nodeOrView = getMasonInstance(instance);
83
- if (instance._isMasonChild) {
84
- return nodeOrView.isDirty();
85
- }
86
- else {
87
- return nodeOrView.isNodeDirty();
88
- }
89
- }
90
- if (global.isAndroid) {
91
- return instance.ios.mason.isDirty;
92
- }
93
- }
94
- return false;
95
- }
96
- export function _intoType(type) {
97
- switch (type) {
98
- case 'auto':
99
- return 0 /* MasonDimensionCompatType.Auto */;
100
- case 'points':
101
- return 1 /* MasonDimensionCompatType.Points */;
102
- case 'percent':
103
- return 2 /* MasonDimensionCompatType.Percent */;
104
- default:
105
- return 0 /* MasonDimensionCompatType.Auto */;
106
- }
107
- }
108
- export function _parseDimension(dim) {
109
- if (global.isIOS) {
110
- const type = dim.type;
111
- const value = dim.value;
112
- switch (type) {
113
- case 0 /* MasonDimensionCompatType.Auto */:
114
- return 'auto';
115
- case 1 /* MasonDimensionCompatType.Points */:
116
- return { value: value, unit: 'px' };
117
- case 2 /* MasonDimensionCompatType.Percent */:
118
- return { value: value, unit: '%' };
119
- }
120
- }
121
- const name = dim.getClass().getName();
122
- switch (name) {
123
- case 'org.nativescript.mason.masonkit.Dimension$Points':
124
- return { value: dim.getPoints(), unit: 'px' };
125
- case 'org.nativescript.mason.masonkit.Dimension$Percent':
126
- return { value: dim.getPercentage(), unit: '%' };
127
- case 'org.nativescript.mason.masonkit.Dimension$Auto':
128
- return 'auto';
129
- }
130
- }
131
- export function _parseLengthPercentage(dim) {
132
- if (global.isIOS) {
133
- const type = dim.type;
134
- const value = dim.value;
135
- switch (type) {
136
- case 0 /* MasonLengthPercentageCompatType.Points */:
137
- return { value: value, unit: 'px' };
138
- case 1 /* MasonLengthPercentageCompatType.Percent */:
139
- return { value: value, unit: '%' };
140
- }
141
- }
142
- const name = dim.getClass().getName();
143
- switch (name) {
144
- case 'org.nativescript.mason.masonkit.LengthPercentage$Points':
145
- return { value: dim.getPoints(), unit: 'px' };
146
- case 'org.nativescript.mason.masonkit.LengthPercentage$Percent':
147
- return { value: dim.getPercentage(), unit: '%' };
148
- case 'org.nativescript.mason.masonkit.LengthPercentage$Auto':
149
- return 'auto';
150
- }
151
- }
152
- export function _parseLengthPercentageAuto(dim) {
153
- if (global.isIOS) {
154
- const type = dim.type;
155
- const value = dim.value;
156
- switch (type) {
157
- case 0 /* MasonLengthPercentageAutoCompatType.Auto */:
158
- return 'auto';
159
- case 1 /* MasonLengthPercentageAutoCompatType.Points */:
160
- return { value: value, unit: 'px' };
161
- case 2 /* MasonLengthPercentageAutoCompatType.Percent */:
162
- return { value: value, unit: '%' };
163
- }
164
- }
165
- const name = dim.getClass().getName();
166
- switch (name) {
167
- case 'org.nativescript.mason.masonkit.LengthPercentageAuto$Points':
168
- return { value: dim.getPoints(), unit: 'px' };
169
- case 'org.nativescript.mason.masonkit.LengthPercentageAuto$Percent':
170
- return { value: dim.getPercentage(), unit: '%' };
171
- case 'org.nativescript.mason.masonkit.LengthPercentageAuto$Auto':
172
- return 'auto';
173
- }
174
- }
175
- export function _toMasonDimension(value) {
176
- if (value === undefined || value === null) {
177
- return value;
178
- }
179
- if (value === 'auto') {
180
- return { value: 0, type: 'auto', native_type: 0 /* MasonDimensionCompatType.Auto */ };
181
- }
182
- const typeOf = typeof value;
183
- if (typeOf === 'object') {
184
- switch (value?.unit) {
185
- case '%':
186
- return { value: value.value, type: 'percent', native_type: 2 /* MasonDimensionCompatType.Percent */ };
187
- case 'px':
188
- return { value: value.value, type: 'points', native_type: 1 /* MasonDimensionCompatType.Points */ };
189
- case 'dip':
190
- return { value: Utils.layout.toDevicePixels(value.value), type: 'points', native_type: 1 /* MasonDimensionCompatType.Points */ };
191
- }
192
- }
193
- if (typeOf === 'number') {
194
- return { value: Utils.layout.toDevicePixels(value), type: 'points', native_type: 1 /* MasonDimensionCompatType.Points */ };
195
- }
196
- return { value: value, type: 'points', native_type: 1 /* MasonDimensionCompatType.Points */ };
197
- }
198
- export function _intoMasonDimension(value) {
199
- if (value === undefined || value === null) {
200
- return null;
201
- }
202
- if (global.isIOS) {
203
- if (value === 'auto') {
204
- return MasonDimensionCompat.Auto;
205
- }
206
- const typeOf = typeof value;
207
- if (typeOf === 'object') {
208
- switch (value?.unit) {
209
- case '%':
210
- return MasonDimensionCompat.alloc().initWithPercent(value.value);
211
- case 'px':
212
- return MasonDimensionCompat.alloc().initWithPoints(value.value);
213
- case 'dip':
214
- return MasonDimensionCompat.alloc().initWithPoints(Utils.layout.toDevicePixels(value.value));
215
- }
216
- }
217
- if (typeOf === 'number') {
218
- return MasonDimensionCompat.alloc().initWithPoints(Utils.layout.toDevicePixels(value));
219
- }
220
- return MasonDimensionCompat.alloc().initWithPoints(Utils.layout.toDevicePixels(value));
221
- }
222
- if (global.isAndroid) {
223
- if (value === 'auto') {
224
- return org.nativescript.mason.masonkit.Dimension.Auto;
225
- }
226
- const typeOf = typeof value;
227
- if (typeOf === 'object') {
228
- switch (value?.unit) {
229
- case '%':
230
- return new org.nativescript.mason.masonkit.Dimension.Percent(value.value);
231
- case 'px':
232
- return new org.nativescript.mason.masonkit.Dimension.Points(value.value);
233
- case 'dip':
234
- return new org.nativescript.mason.masonkit.Dimension.Points(Utils.layout.toDevicePixels(value.value));
235
- }
236
- }
237
- if (typeOf === 'number') {
238
- return new org.nativescript.mason.masonkit.Dimension.Points(Utils.layout.toDevicePixels(value));
239
- }
240
- return new org.nativescript.mason.masonkit.Dimension.Points(Utils.layout.toDevicePixels(value));
241
- }
242
- return null;
243
- }
244
- export function _toLengthPercentageAuto(value) {
245
- if (value === undefined || value === null) {
246
- return value;
247
- }
248
- if (value === 'auto') {
249
- return { value: 0, type: 'auto', native_type: 0 /* MasonLengthPercentageAutoCompatType.Auto */ };
250
- }
251
- const typeOf = typeof value;
252
- if (typeOf === 'object') {
253
- switch (value?.unit) {
254
- case '%':
255
- return { value: value.value, type: 'percent', native_type: 2 /* MasonLengthPercentageAutoCompatType.Percent */ };
256
- case 'px':
257
- return { value: value.value, type: 'points', native_type: 1 /* MasonLengthPercentageAutoCompatType.Points */ };
258
- case 'dip':
259
- return { value: Utils.layout.toDevicePixels(value.value), type: 'points', native_type: 1 /* MasonLengthPercentageAutoCompatType.Points */ };
260
- }
261
- }
262
- if (typeOf === 'number') {
263
- return { value: Utils.layout.toDevicePixels(value), type: 'points', native_type: 1 /* MasonLengthPercentageAutoCompatType.Points */ };
264
- }
265
- return { value: value, type: 'points', native_type: 1 /* MasonLengthPercentageAutoCompatType.Points */ };
266
- }
267
- export function _toLengthPercentage(value) {
268
- if (value === undefined || value === null) {
269
- return value;
270
- }
271
- if (typeof value === 'string') {
272
- const parsed = Length.parse(value);
273
- if (parsed) {
274
- value = parsed;
275
- }
276
- }
277
- const typeOf = typeof value;
278
- if (typeOf === 'object') {
279
- switch (value?.unit) {
280
- case '%':
281
- return { value: value.value, type: 'percent', native_type: 1 /* MasonLengthPercentageCompatType.Percent */ };
282
- case 'px':
283
- return { value: value.value, type: 'points', native_type: 0 /* MasonLengthPercentageCompatType.Points */ };
284
- case 'dip':
285
- return { value: Utils.layout.toDevicePixels(value.value), type: 'points', native_type: 0 /* MasonLengthPercentageCompatType.Points */ };
286
- }
287
- }
288
- if (typeOf === 'number') {
289
- return { value: Utils.layout.toDevicePixels(value), type: 'points', native_type: 0 /* MasonLengthPercentageCompatType.Points */ };
290
- }
291
- return { value: value, type: 'points', native_type: 0 /* MasonLengthPercentageCompatType.Points */ };
292
- }
293
- export function _setDisplay(value, instance, initial = false) {
294
- if (initial && value === 'flex') {
295
- return;
296
- }
297
- if (instance._hasNativeView) {
298
- if (JSIEnabled) {
299
- let nativeValue = -1;
300
- switch (value) {
301
- case 'none':
302
- nativeValue = 0 /* Display.None */;
303
- break;
304
- case 'flex':
305
- nativeValue = 1 /* Display.Flex */;
306
- break;
307
- case 'grid':
308
- nativeValue = 2 /* Display.Grid */;
309
- break;
310
- }
311
- if (nativeValue !== -1) {
312
- global.__Mason_setDisplay(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, nativeValue, !instance._inBatch);
313
- }
314
- }
315
- else {
316
- if (global.isAndroid) {
317
- let nativeValue = null;
318
- switch (value) {
319
- case 'flex':
320
- nativeValue = org.nativescript.mason.masonkit.Display.Flex;
321
- break;
322
- case 'grid':
323
- nativeValue = org.nativescript.mason.masonkit.Display.Grid;
324
- break;
325
- case 'none':
326
- nativeValue = org.nativescript.mason.masonkit.Display.None;
327
- break;
328
- }
329
- if (nativeValue) {
330
- const nodeOrView = getMasonInstance(instance);
331
- if (instance._isMasonChild) {
332
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setDisplay(nodeOrView, nativeValue);
333
- }
334
- else {
335
- nodeOrView.setDisplay(nativeValue);
336
- }
337
- }
338
- }
339
- if (global.isIOS) {
340
- let nativeValue = -1;
341
- switch (value) {
342
- case 'flex':
343
- nativeValue = 1 /* Display.Flex */;
344
- break;
345
- case 'grid':
346
- nativeValue = 2 /* Display.Grid */;
347
- break;
348
- case 'none':
349
- nativeValue = 0 /* Display.None */;
350
- break;
351
- }
352
- if (nativeValue !== -1) {
353
- instance.ios.display = nativeValue;
354
- }
355
- }
356
- }
357
- }
358
- }
359
- export function _getDisplay(instance) {
360
- if (!instance._hasNativeView) {
361
- return instance.style.display;
362
- }
363
- if (JSIEnabled) {
364
- const value = global.__Mason_getDisplay(instance._masonStylePtr);
365
- switch (value) {
366
- case 0:
367
- return 'none';
368
- case 1:
369
- return 'flex';
370
- case 2:
371
- return 'grid';
372
- }
373
- }
374
- else {
375
- if (global.isAndroid) {
376
- const nodeOrView = getMasonInstance(instance);
377
- let display;
378
- if (instance._isMasonChild) {
379
- display = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getDisplay(nodeOrView);
380
- }
381
- else {
382
- display = nodeOrView.getDisplay();
383
- }
384
- switch (display) {
385
- case org.nativescript.mason.masonkit.Display.None:
386
- return 'none';
387
- case org.nativescript.mason.masonkit.Display.Flex:
388
- return 'flex';
389
- case org.nativescript.mason.masonkit.Display.Grid:
390
- return 'grid';
391
- }
392
- }
393
- if (global.isIOS) {
394
- switch (instance.ios.display) {
395
- case 0 /* Display.None */:
396
- return 'none';
397
- case 1 /* Display.Flex */:
398
- return 'flex';
399
- case 2 /* Display.Grid */:
400
- return 'grid';
401
- }
402
- }
403
- }
404
- return instance.style.display;
405
- }
406
- export function _setMinWidth(value, instance, initial = false) {
407
- if (!instance._hasNativeView) {
408
- return;
409
- }
410
- const val = _toMasonDimension(value);
411
- if (JSIEnabled) {
412
- global.__Mason_setMinWidth(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
413
- }
414
- else {
415
- if (global.isAndroid) {
416
- const nodeOrView = getMasonInstance(instance);
417
- if (instance._isMasonChild) {
418
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setMinSizeWidth(nodeOrView, val.value, val.native_type);
419
- }
420
- else {
421
- nodeOrView.setMinSizeWidth(val.value, val.native_type);
422
- }
423
- }
424
- if (global.isIOS) {
425
- instance.ios.setMinSizeWidth(val.value, val.native_type);
426
- }
427
- }
428
- }
429
- export function _getMinWidth(instance) {
430
- if (!instance._hasNativeView) {
431
- return instance.style.minWidth;
432
- }
433
- if (JSIEnabled) {
434
- return global.__Mason_getMinWidth(instance._masonStylePtr);
435
- }
436
- else {
437
- if (global.isAndroid) {
438
- const nodeOrView = getMasonInstance(instance);
439
- let min;
440
- if (instance._isMasonChild) {
441
- min = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getMinSizeWidth(nodeOrView);
442
- }
443
- else {
444
- min = nodeOrView.getMinSizeWidth();
445
- }
446
- return _parseDimension(min);
447
- }
448
- if (global.isIOS) {
449
- return _parseDimension(instance.ios.getMinSizeWidth());
450
- }
451
- }
452
- }
453
- export function _setMinHeight(value, instance, initial = false) {
454
- if (!instance._hasNativeView) {
455
- return;
456
- }
457
- const val = _toMasonDimension(value);
458
- if (JSIEnabled) {
459
- global.__Mason_setMinHeight(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
460
- }
461
- else {
462
- if (global.isAndroid) {
463
- const nodeOrView = getMasonInstance(instance);
464
- if (instance._isMasonChild) {
465
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setMinSizeHeight(nodeOrView, val.value, val.native_type);
466
- }
467
- else {
468
- nodeOrView.setMinSizeHeight(val.value, val.native_type);
469
- }
470
- }
471
- if (global.isIOS) {
472
- instance.ios.setMinSizeHeight(val.value, val.native_type);
473
- }
474
- }
475
- }
476
- export function _getMinHeight(instance) {
477
- if (!instance._hasNativeView) {
478
- return instance.style.minHeight;
479
- }
480
- if (JSIEnabled) {
481
- return global.__Mason_getMinHeight(instance._masonStylePtr);
482
- }
483
- else {
484
- if (global.isAndroid) {
485
- const nodeOrView = getMasonInstance(instance);
486
- let min;
487
- if (instance._isMasonChild) {
488
- min = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getMinSizeHeight(nodeOrView);
489
- }
490
- else {
491
- min = nodeOrView.getMinSizeHeight();
492
- }
493
- return _parseDimension(min);
494
- }
495
- if (global.isIOS) {
496
- return _parseDimension(instance.ios.getMinSizeHeight());
497
- }
498
- }
499
- }
500
- export function _setWidth(value, instance, initial = false) {
501
- if (!instance._hasNativeView) {
502
- return;
503
- }
504
- const val = _toMasonDimension(value);
505
- if (JSIEnabled) {
506
- global.__Mason_setWidth(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
507
- }
508
- else {
509
- if (global.isAndroid) {
510
- const nodeOrView = getMasonInstance(instance);
511
- if (instance._isMasonChild) {
512
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setSizeWidth(nodeOrView, val.value, val.native_type);
513
- }
514
- else {
515
- nodeOrView.setSizeWidth(val.value, val.native_type);
516
- }
517
- }
518
- if (global.isIOS) {
519
- instance.ios.setSizeWidth(val.value, val.native_type);
520
- }
521
- }
522
- }
523
- export function _getWidth(instance) {
524
- if (!instance._hasNativeView) {
525
- return instance.style.width;
526
- }
527
- if (JSIEnabled) {
528
- return global.__Mason_getWidth(instance._masonStylePtr);
529
- }
530
- else {
531
- if (global.isAndroid) {
532
- const nodeOrView = getMasonInstance(instance);
533
- let size;
534
- if (instance._isMasonChild) {
535
- size = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getSizeWidth(nodeOrView);
536
- }
537
- else {
538
- size = nodeOrView.getSizeWidth();
539
- }
540
- return _parseDimension(size);
541
- }
542
- if (global.isIOS) {
543
- return _parseDimension(instance.ios.getSizeWidth());
544
- }
545
- }
546
- }
547
- export function _setHeight(value, instance, initial = false) {
548
- if (!instance._hasNativeView) {
549
- return;
550
- }
551
- const val = _toMasonDimension(value);
552
- if (JSIEnabled) {
553
- global.__Mason_setHeight(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
554
- }
555
- else {
556
- if (global.isAndroid) {
557
- const nodeOrView = getMasonInstance(instance);
558
- if (instance._isMasonChild) {
559
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setSizeHeight(nodeOrView, val.value, val.native_type);
560
- }
561
- else {
562
- nodeOrView.setSizeHeight(val.value, val.native_type);
563
- }
564
- }
565
- if (global.isIOS) {
566
- instance.ios.setSizeHeight(val.value, val.native_type);
567
- }
568
- }
569
- }
570
- export function _getHeight(instance) {
571
- if (!instance._hasNativeView) {
572
- return instance.style.height;
573
- }
574
- if (JSIEnabled) {
575
- return global.__Mason_getHeight(instance._masonStylePtr);
576
- }
577
- else {
578
- if (global.isAndroid) {
579
- const nodeOrView = getMasonInstance(instance);
580
- let size;
581
- if (instance._isMasonChild) {
582
- size = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getSizeHeight(nodeOrView);
583
- }
584
- else {
585
- size = nodeOrView.getSizeHeight();
586
- }
587
- return _parseDimension(size);
588
- }
589
- if (global.isIOS) {
590
- return _parseDimension(instance.ios.getSizeHeight());
591
- }
592
- }
593
- }
594
- export function _setMaxWidth(value, instance, initial = false) {
595
- if (!instance._hasNativeView) {
596
- return;
597
- }
598
- const val = _toMasonDimension(value);
599
- if (JSIEnabled) {
600
- global.__Mason_setMaxWidth(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
601
- }
602
- else {
603
- if (global.isAndroid) {
604
- const nodeOrView = getMasonInstance(instance);
605
- if (instance._isMasonChild) {
606
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setMaxSizeWidth(nodeOrView, val.value, val.native_type);
607
- }
608
- else {
609
- nodeOrView.setMaxSizeWidth(val.value, val.native_type);
610
- }
611
- }
612
- if (global.isIOS) {
613
- instance.ios.setMaxSizeWidth(val.value, val.native_type);
614
- }
615
- }
616
- }
617
- export function _getMaxWidth(instance) {
618
- if (!instance._hasNativeView) {
619
- return instance.style.maxWidth;
620
- }
621
- if (JSIEnabled) {
622
- return global.__Mason_getMaxWidth(instance._masonStylePtr);
623
- }
624
- else {
625
- if (global.isAndroid) {
626
- const nodeOrView = getMasonInstance(instance);
627
- let max;
628
- if (instance._isMasonChild) {
629
- max = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getMaxSizeWidth(nodeOrView);
630
- }
631
- else {
632
- max = nodeOrView.getMaxSizeWidth();
633
- }
634
- return _parseDimension(max);
635
- }
636
- if (global.isIOS) {
637
- return _parseDimension(instance.ios.getMaxSizeWidth());
638
- }
639
- }
640
- }
641
- export function _setMaxHeight(value, instance, initial = false) {
642
- if (!instance._hasNativeView) {
643
- return;
644
- }
645
- const val = _toMasonDimension(value);
646
- if (JSIEnabled) {
647
- global.__Mason_setMaxHeight(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
648
- }
649
- else {
650
- if (global.isAndroid) {
651
- const nodeOrView = getMasonInstance(instance);
652
- if (instance._isMasonChild) {
653
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setMaxSizeHeight(nodeOrView, val.value, val.native_type);
654
- }
655
- else {
656
- nodeOrView.setMaxSizeHeight(val.value, val.native_type);
657
- }
658
- }
659
- if (global.isIOS) {
660
- instance.ios.setMaxSizeHeight(val.value, val.native_type);
661
- }
662
- }
663
- }
664
- export function _getMaxHeight(instance) {
665
- if (!instance._hasNativeView) {
666
- return instance.style.maxHeight;
667
- }
668
- if (JSIEnabled) {
669
- return global.__Mason_getMaxHeight(instance._masonStylePtr);
670
- }
671
- else {
672
- if (global.isAndroid) {
673
- const nodeOrView = getMasonInstance(instance);
674
- let max;
675
- if (instance._isMasonChild) {
676
- max = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getMaxSizeHeight(nodeOrView);
677
- }
678
- else {
679
- max = nodeOrView.getMaxSizeHeight();
680
- }
681
- return _parseDimension(max);
682
- }
683
- if (global.isIOS) {
684
- return _parseDimension(instance.ios.getMaxSizeHeight());
685
- }
686
- }
687
- }
688
- export function _setFlexDirection(value, instance, initial = false) {
689
- if (initial && value === 'row') {
690
- return;
691
- }
692
- if (instance._hasNativeView) {
693
- let nativeValue = null;
694
- switch (value) {
695
- case 'column':
696
- if (JSIEnabled) {
697
- nativeValue = 1 /* FlexDirection.Column */;
698
- }
699
- else {
700
- if (global.isAndroid) {
701
- nativeValue = org.nativescript.mason.masonkit.FlexDirection.Column;
702
- }
703
- else if (global.isIOS) {
704
- nativeValue = 1 /* FlexDirection.Column */;
705
- }
706
- }
707
- break;
708
- case 'row':
709
- if (JSIEnabled) {
710
- nativeValue = 0 /* FlexDirection.Row */;
711
- }
712
- else {
713
- if (global.isAndroid) {
714
- nativeValue = org.nativescript.mason.masonkit.FlexDirection.Row;
715
- }
716
- else if (global.isIOS) {
717
- nativeValue = 0 /* FlexDirection.Row */;
718
- }
719
- }
720
- break;
721
- case 'column-reverse':
722
- if (JSIEnabled) {
723
- nativeValue = 3 /* FlexDirection.ColumnReverse */;
724
- }
725
- else {
726
- if (global.isAndroid) {
727
- nativeValue = org.nativescript.mason.masonkit.FlexDirection.ColumnReverse;
728
- }
729
- else if (global.isIOS) {
730
- nativeValue = 3 /* FlexDirection.ColumnReverse */;
731
- }
732
- }
733
- break;
734
- case 'row-reverse':
735
- if (JSIEnabled) {
736
- nativeValue = 2 /* FlexDirection.RowReverse */;
737
- }
738
- else {
739
- if (global.isAndroid) {
740
- nativeValue = org.nativescript.mason.masonkit.FlexDirection.RowReverse;
741
- }
742
- else if (global.isIOS) {
743
- nativeValue = 2 /* FlexDirection.RowReverse */;
744
- }
745
- }
746
- break;
747
- }
748
- if (nativeValue) {
749
- if (JSIEnabled) {
750
- global.__Mason_setFlexDirection(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, nativeValue, !instance._inBatch);
751
- }
752
- else {
753
- if (global.isAndroid) {
754
- const nodeOrView = getMasonInstance(instance);
755
- if (instance._isMasonChild) {
756
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setFlexDirection(nodeOrView, nativeValue);
757
- }
758
- else {
759
- nodeOrView.setFlexDirection(nativeValue);
760
- }
761
- }
762
- if (global.isIOS) {
763
- instance.ios.flexDirection = nativeValue;
764
- }
765
- }
766
- }
767
- }
768
- }
769
- export function _getFlexDirection(instance) {
770
- if (instance._hasNativeView) {
771
- if (JSIEnabled) {
772
- const value = global.__Mason_getFlexDirection(instance._masonStylePtr);
773
- switch (value) {
774
- case 0 /* FlexDirection.Row */:
775
- return 'row';
776
- case 1 /* FlexDirection.Column */:
777
- return 'column';
778
- case 2 /* FlexDirection.RowReverse */:
779
- return 'row-reverse';
780
- case 3 /* FlexDirection.ColumnReverse */:
781
- return 'column-reverse';
782
- }
783
- }
784
- else {
785
- if (global.isAndroid) {
786
- const nodeOrView = getMasonInstance(instance);
787
- let value;
788
- if (instance._isMasonChild) {
789
- value = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getFlexDirection(nodeOrView);
790
- }
791
- else {
792
- value = nodeOrView.getFlexDirection();
793
- }
794
- switch (value) {
795
- case org.nativescript.mason.masonkit.FlexDirection.Row:
796
- return 'row';
797
- case org.nativescript.mason.masonkit.FlexDirection.Column:
798
- return 'column';
799
- case org.nativescript.mason.masonkit.FlexDirection.RowReverse:
800
- return 'row-reverse';
801
- case org.nativescript.mason.masonkit.FlexDirection.ColumnReverse:
802
- return 'column-reverse';
803
- }
804
- }
805
- if (global.isIOS) {
806
- const value = instance.ios.flexDirection;
807
- switch (value) {
808
- case 0 /* FlexDirection.Row */:
809
- return 'row';
810
- case 1 /* FlexDirection.Column */:
811
- return 'column';
812
- case 2 /* FlexDirection.RowReverse */:
813
- return 'row-reverse';
814
- case 3 /* FlexDirection.ColumnReverse */:
815
- return 'column-reverse';
816
- }
817
- }
818
- }
819
- }
820
- return instance.style.flexDirection;
821
- }
822
- export function _getPosition(instance) {
823
- if (!instance._hasNativeView) {
824
- return instance.style.position;
825
- }
826
- if (JSIEnabled) {
827
- const value = global.__Mason_getPosition(instance._masonStylePtr);
828
- switch (value) {
829
- case 0:
830
- return 'relative';
831
- case 1:
832
- return 'absolute';
833
- }
834
- }
835
- else {
836
- if (global.isAndroid) {
837
- const nodeOrView = getMasonInstance(instance);
838
- let value;
839
- if (instance._isMasonChild) {
840
- value = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getPosition(nodeOrView);
841
- }
842
- else {
843
- value = nodeOrView.getPosition();
844
- }
845
- switch (value) {
846
- case org.nativescript.mason.masonkit.Position.Absolute:
847
- return 'absolute';
848
- case org.nativescript.mason.masonkit.Position.Relative:
849
- return 'relative';
850
- }
851
- }
852
- if (global.isIOS) {
853
- switch (instance.ios.position) {
854
- case 1 /* Position.Absolute */:
855
- return 'absolute';
856
- case 0 /* Position.Relative */:
857
- return 'relative';
858
- }
859
- }
860
- }
861
- }
862
- export function _setPosition(value, instance, initial = false) {
863
- if (initial && value === 'relative') {
864
- return;
865
- }
866
- if (instance._hasNativeView) {
867
- let nativeValue = null;
868
- switch (value) {
869
- case 'absolute':
870
- if (JSIEnabled) {
871
- nativeValue = 1 /* PositionType.Absolute */;
872
- }
873
- else {
874
- nativeValue = org.nativescript.mason.masonkit.Position.Absolute;
875
- }
876
- break;
877
- case 'relative':
878
- if (JSIEnabled) {
879
- nativeValue = 0 /* PositionType.Relative */;
880
- }
881
- else {
882
- nativeValue = org.nativescript.mason.masonkit.Position.Relative;
883
- }
884
- break;
885
- }
886
- if (nativeValue) {
887
- if (JSIEnabled) {
888
- global.__Mason_setPosition(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, nativeValue, !instance._inBatch);
889
- }
890
- else {
891
- if (global.isAndroid) {
892
- const nodeOrView = getMasonInstance(instance);
893
- if (instance._isMasonChild) {
894
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setPosition(nodeOrView, nativeValue);
895
- }
896
- else {
897
- nodeOrView.setPosition(nativeValue);
898
- }
899
- }
900
- if (global.isIOS) {
901
- instance.ios.position = nativeValue;
902
- }
903
- }
904
- }
905
- }
906
- }
907
- export function _setFlexWrap(value, instance, initial = false) {
908
- if (initial && value === 'no-wrap') {
909
- return;
910
- }
911
- if (instance._hasNativeView) {
912
- let nativeValue = null;
913
- switch (value) {
914
- case 'no-wrap':
915
- if (JSIEnabled) {
916
- nativeValue = 0 /* FlexWrap.NoWrap */;
917
- }
918
- else {
919
- if (global.isAndroid) {
920
- nativeValue = org.nativescript.mason.masonkit.FlexWrap.NoWrap;
921
- }
922
- if (global.isIOS) {
923
- nativeValue = 0 /* FlexWrap.NoWrap */;
924
- }
925
- }
926
- break;
927
- case 'wrap':
928
- if (JSIEnabled) {
929
- nativeValue = 1 /* FlexWrap.Wrap */;
930
- }
931
- else {
932
- if (global.isAndroid) {
933
- nativeValue = org.nativescript.mason.masonkit.FlexWrap.Wrap;
934
- }
935
- if (global.isIOS) {
936
- nativeValue = 1 /* FlexWrap.Wrap */;
937
- }
938
- }
939
- break;
940
- case 'wrap-reverse':
941
- if (JSIEnabled) {
942
- nativeValue = 2 /* FlexWrap.WrapReverse */;
943
- }
944
- else {
945
- if (global.isAndroid) {
946
- nativeValue = org.nativescript.mason.masonkit.FlexWrap.WrapReverse;
947
- }
948
- if (global.isIOS) {
949
- nativeValue = 2 /* FlexWrap.WrapReverse */;
950
- }
951
- }
952
- break;
953
- }
954
- if (nativeValue) {
955
- if (JSIEnabled) {
956
- global.__Mason_setFlexWrap(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, nativeValue, !instance._inBatch);
957
- }
958
- else {
959
- if (global.isAndroid) {
960
- const nodeOrView = getMasonInstance(instance);
961
- if (instance._isMasonChild) {
962
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setFlexWrap(nodeOrView, nativeValue);
963
- }
964
- else {
965
- nodeOrView.setFlexWrap(nativeValue);
966
- }
967
- }
968
- if (global.isIOS) {
969
- instance.ios.flexWrap = nativeValue;
970
- }
971
- }
972
- }
973
- }
974
- }
975
- export function _getFlexWrap(instance) {
976
- if (instance._hasNativeView) {
977
- if (JSIEnabled) {
978
- const value = global.__Mason_getFlexWrap(instance._masonStylePtr);
979
- switch (value) {
980
- case 0:
981
- return 'no-wrap';
982
- case 1:
983
- return 'wrap';
984
- case 2:
985
- return 'wrap-reverse';
986
- }
987
- }
988
- else {
989
- if (global.isAndroid) {
990
- const nodeOrView = getMasonInstance(instance);
991
- let value;
992
- if (instance._isMasonChild) {
993
- value = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getFlexWrap(nodeOrView);
994
- }
995
- else {
996
- value = nodeOrView.getFlexWrap();
997
- }
998
- switch (value) {
999
- case org.nativescript.mason.masonkit.FlexWrap.NoWrap:
1000
- return 'no-wrap';
1001
- case org.nativescript.mason.masonkit.FlexWrap.Wrap:
1002
- return 'wrap';
1003
- case org.nativescript.mason.masonkit.FlexWrap.WrapReverse:
1004
- return 'wrap-reverse';
1005
- }
1006
- }
1007
- if (global.isIOS) {
1008
- const value = instance.ios.flexWrap;
1009
- switch (value) {
1010
- case 0 /* FlexWrap.NoWrap */:
1011
- return 'no-wrap';
1012
- case 1 /* FlexWrap.Wrap */:
1013
- return 'wrap';
1014
- case 2 /* FlexWrap.WrapReverse */:
1015
- return 'wrap-reverse';
1016
- }
1017
- }
1018
- }
1019
- }
1020
- return instance.style.flexWrap;
1021
- }
1022
- export function _setAlignItems(value, instance, initial = false) {
1023
- if (initial && value === 'normal') {
1024
- return;
1025
- }
1026
- if (instance._hasNativeView) {
1027
- let nativeValue = null;
1028
- switch (value) {
1029
- case 'normal':
1030
- if (JSIEnabled || global.isIOS) {
1031
- nativeValue = -1 /* AlignItems.Normal */;
1032
- }
1033
- else {
1034
- nativeValue = org.nativescript.mason.masonkit.AlignItems.Normal;
1035
- }
1036
- break;
1037
- case 'baseline':
1038
- if (JSIEnabled || global.isIOS) {
1039
- nativeValue = 3 /* AlignItems.Baseline */;
1040
- }
1041
- else {
1042
- nativeValue = org.nativescript.mason.masonkit.AlignItems.Baseline;
1043
- }
1044
- break;
1045
- case 'center':
1046
- if (JSIEnabled || global.isIOS) {
1047
- nativeValue = 2 /* AlignItems.Center */;
1048
- }
1049
- else {
1050
- nativeValue = org.nativescript.mason.masonkit.AlignItems.Center;
1051
- }
1052
- break;
1053
- case 'flex-end':
1054
- case 'end':
1055
- if (JSIEnabled || global.isIOS) {
1056
- nativeValue = 1 /* AlignItems.End */;
1057
- }
1058
- else {
1059
- nativeValue = org.nativescript.mason.masonkit.AlignItems.End;
1060
- }
1061
- break;
1062
- case 'flex-start':
1063
- case 'start':
1064
- if (JSIEnabled || global.isIOS) {
1065
- nativeValue = 0 /* AlignItems.Start */;
1066
- }
1067
- else {
1068
- nativeValue = org.nativescript.mason.masonkit.AlignItems.Start;
1069
- }
1070
- break;
1071
- case 'stretch':
1072
- if (JSIEnabled || global.isIOS) {
1073
- nativeValue = 4 /* AlignItems.Stretch */;
1074
- }
1075
- else {
1076
- nativeValue = org.nativescript.mason.masonkit.AlignItems.Stretch;
1077
- }
1078
- break;
1079
- }
1080
- if (nativeValue) {
1081
- if (JSIEnabled) {
1082
- global.__Mason_setAlignItems(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, nativeValue, !instance._inBatch);
1083
- }
1084
- else {
1085
- if (global.isAndroid) {
1086
- const nodeOrView = getMasonInstance(instance);
1087
- if (instance._isMasonChild) {
1088
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setAlignItems(nodeOrView, nativeValue);
1089
- }
1090
- else {
1091
- nodeOrView.setAlignItems(nativeValue);
1092
- }
1093
- }
1094
- if (global.isIOS) {
1095
- instance.ios.alignItems = nativeValue;
1096
- }
1097
- }
1098
- }
1099
- }
1100
- }
1101
- export function _getAlignItems(instance) {
1102
- if (instance._hasNativeView) {
1103
- if (JSIEnabled) {
1104
- const value = global.__Mason_getAlignItems(instance._masonStylePtr);
1105
- switch (value) {
1106
- case -1 /* AlignItems.Normal */:
1107
- return 'normal';
1108
- case 3 /* AlignItems.Baseline */:
1109
- return 'baseline';
1110
- case 2 /* AlignItems.Center */:
1111
- return 'center';
1112
- case 1 /* AlignItems.End */:
1113
- return 'end';
1114
- case 0 /* AlignItems.Start */:
1115
- return 'start';
1116
- case 4 /* AlignItems.Stretch */:
1117
- return 'stretch';
1118
- }
1119
- }
1120
- else {
1121
- if (global.isAndroid) {
1122
- const nodeOrView = getMasonInstance(instance);
1123
- let value;
1124
- if (instance._isMasonChild) {
1125
- value = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getAlignItems(nodeOrView);
1126
- }
1127
- else {
1128
- value = nodeOrView.getAlignItems();
1129
- }
1130
- switch (value) {
1131
- case org.nativescript.mason.masonkit.AlignItems.Normal:
1132
- return 'normal';
1133
- case org.nativescript.mason.masonkit.AlignItems.Baseline:
1134
- return 'baseline';
1135
- case org.nativescript.mason.masonkit.AlignItems.Center:
1136
- return 'center';
1137
- case org.nativescript.mason.masonkit.AlignItems.End:
1138
- return 'end';
1139
- case org.nativescript.mason.masonkit.AlignItems.Start:
1140
- return 'start';
1141
- case org.nativescript.mason.masonkit.AlignItems.Stretch:
1142
- return 'stretch';
1143
- }
1144
- }
1145
- if (global.isIOS) {
1146
- const value = instance.ios.alignItems;
1147
- switch (value) {
1148
- case -1 /* AlignItems.Normal */:
1149
- return 'normal';
1150
- case 3 /* AlignItems.Baseline */:
1151
- return 'baseline';
1152
- case 2 /* AlignItems.Center */:
1153
- return 'center';
1154
- case 1 /* AlignItems.End */:
1155
- return 'end';
1156
- case 0 /* AlignItems.Start */:
1157
- return 'start';
1158
- case 4 /* AlignItems.Stretch */:
1159
- return 'stretch';
1160
- }
1161
- }
1162
- }
1163
- }
1164
- return instance.style.alignItems;
1165
- }
1166
- export function _setAlignSelf(value, instance, initial = false) {
1167
- if (initial && value === 'normal') {
1168
- return;
1169
- }
1170
- if (instance._hasNativeView) {
1171
- let nativeValue = null;
1172
- switch (value) {
1173
- case 'normal':
1174
- if (JSIEnabled || global.isIOS) {
1175
- nativeValue = -1 /* AlignSelf.Normal */;
1176
- }
1177
- else {
1178
- nativeValue = org.nativescript.mason.masonkit.AlignSelf.Normal;
1179
- }
1180
- break;
1181
- case 'baseline':
1182
- if (JSIEnabled || global.isIOS) {
1183
- nativeValue = 3 /* AlignSelf.Baseline */;
1184
- }
1185
- else {
1186
- nativeValue = org.nativescript.mason.masonkit.AlignSelf.Baseline;
1187
- }
1188
- break;
1189
- case 'center':
1190
- if (JSIEnabled || global.isIOS) {
1191
- nativeValue = 2 /* AlignSelf.Center */;
1192
- }
1193
- else {
1194
- nativeValue = org.nativescript.mason.masonkit.AlignSelf.Center;
1195
- }
1196
- break;
1197
- case 'flex-end':
1198
- case 'end':
1199
- if (JSIEnabled || global.isIOS) {
1200
- nativeValue = 1 /* AlignSelf.End */;
1201
- }
1202
- else {
1203
- nativeValue = org.nativescript.mason.masonkit.AlignSelf.End;
1204
- }
1205
- break;
1206
- case 'flex-start':
1207
- case 'start':
1208
- if (JSIEnabled || global.isIOS) {
1209
- nativeValue = 0 /* AlignSelf.Start */;
1210
- }
1211
- else {
1212
- nativeValue = org.nativescript.mason.masonkit.AlignSelf.Start;
1213
- }
1214
- break;
1215
- case 'stretch':
1216
- if (JSIEnabled || global.isIOS) {
1217
- nativeValue = 4 /* AlignSelf.Stretch */;
1218
- }
1219
- else {
1220
- nativeValue = org.nativescript.mason.masonkit.AlignSelf.Stretch;
1221
- }
1222
- break;
1223
- }
1224
- if (nativeValue) {
1225
- if (JSIEnabled) {
1226
- global.__Mason_setAlignSelf(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, nativeValue, !instance._inBatch);
1227
- }
1228
- else {
1229
- if (global.isAndroid) {
1230
- const nodeOrView = getMasonInstance(instance);
1231
- if (instance._isMasonChild) {
1232
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setAlignSelf(nodeOrView, nativeValue);
1233
- }
1234
- else {
1235
- nodeOrView.setAlignSelf(nativeValue);
1236
- }
1237
- }
1238
- if (global.isIOS) {
1239
- instance.ios.alignSelf = nativeValue;
1240
- }
1241
- }
1242
- }
1243
- }
1244
- }
1245
- export function _getAlignSelf(instance) {
1246
- if (instance._hasNativeView) {
1247
- if (JSIEnabled) {
1248
- const value = global.__Mason_getAlignSelf(instance._masonStylePtr);
1249
- switch (value) {
1250
- case -1 /* AlignSelf.Normal */:
1251
- return 'normal';
1252
- case 3 /* AlignSelf.Baseline */:
1253
- return 'baseline';
1254
- case 2 /* AlignSelf.Center */:
1255
- return 'center';
1256
- case 1 /* AlignSelf.End */:
1257
- return 'end';
1258
- case 0 /* AlignSelf.Start */:
1259
- return 'start';
1260
- case 4 /* AlignSelf.Stretch */:
1261
- return 'stretch';
1262
- }
1263
- }
1264
- else {
1265
- if (global.isAndroid) {
1266
- const nodeOrView = getMasonInstance(instance);
1267
- let value;
1268
- if (instance._isMasonChild) {
1269
- value = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getAlignSelf(nodeOrView);
1270
- }
1271
- else {
1272
- value = nodeOrView.getAlignSelf();
1273
- }
1274
- switch (value) {
1275
- case org.nativescript.mason.masonkit.AlignSelf.Normal:
1276
- return 'normal';
1277
- case org.nativescript.mason.masonkit.AlignSelf.Baseline:
1278
- return 'baseline';
1279
- case org.nativescript.mason.masonkit.AlignSelf.Center:
1280
- return 'center';
1281
- case org.nativescript.mason.masonkit.AlignSelf.End:
1282
- return 'end';
1283
- case org.nativescript.mason.masonkit.AlignSelf.Start:
1284
- return 'start';
1285
- case org.nativescript.mason.masonkit.AlignSelf.Stretch:
1286
- return 'stretch';
1287
- }
1288
- }
1289
- if (global.isIOS) {
1290
- const value = instance.ios.alignSelf;
1291
- switch (value) {
1292
- case -1 /* AlignSelf.Normal */:
1293
- return 'normal';
1294
- case 3 /* AlignSelf.Baseline */:
1295
- return 'baseline';
1296
- case 2 /* AlignSelf.Center */:
1297
- return 'center';
1298
- case 1 /* AlignSelf.End */:
1299
- return 'end';
1300
- case 0 /* AlignSelf.Start */:
1301
- return 'start';
1302
- case 4 /* AlignSelf.Stretch */:
1303
- return 'stretch';
1304
- }
1305
- }
1306
- }
1307
- }
1308
- return instance.style.alignSelf;
1309
- }
1310
- export function _setAlignContent(value, instance, initial = false) {
1311
- if (initial && value === 'normal') {
1312
- return;
1313
- }
1314
- if (instance._hasNativeView) {
1315
- let nativeValue = null;
1316
- switch (value) {
1317
- case 'normal':
1318
- if (JSIEnabled) {
1319
- nativeValue = -1 /* AlignContent.Normal */;
1320
- }
1321
- else {
1322
- if (global.isAndroid) {
1323
- nativeValue = org.nativescript.mason.masonkit.AlignContent.Normal;
1324
- }
1325
- if (global.isIOS) {
1326
- nativeValue = -1 /* AlignContent.Normal */;
1327
- }
1328
- }
1329
- break;
1330
- case 'space-around':
1331
- if (JSIEnabled) {
1332
- nativeValue = 5 /* AlignContent.SpaceAround */;
1333
- }
1334
- else {
1335
- if (global.isAndroid) {
1336
- nativeValue = org.nativescript.mason.masonkit.AlignContent.SpaceAround;
1337
- }
1338
- if (global.isIOS) {
1339
- nativeValue = 5 /* AlignContent.SpaceAround */;
1340
- }
1341
- }
1342
- break;
1343
- case 'space-between':
1344
- if (JSIEnabled) {
1345
- nativeValue = 4 /* AlignContent.SpaceBetween */;
1346
- }
1347
- else {
1348
- if (global.isAndroid) {
1349
- nativeValue = org.nativescript.mason.masonkit.AlignContent.SpaceBetween;
1350
- }
1351
- if (global.isIOS) {
1352
- nativeValue = 4 /* AlignContent.SpaceBetween */;
1353
- }
1354
- }
1355
- break;
1356
- case 'space-evenly':
1357
- if (JSIEnabled) {
1358
- nativeValue = 6 /* AlignContent.SpaceEvenly */;
1359
- }
1360
- else {
1361
- if (global.isAndroid) {
1362
- nativeValue = org.nativescript.mason.masonkit.AlignContent.SpaceEvenly;
1363
- }
1364
- if (global.isIOS) {
1365
- nativeValue = 6 /* AlignContent.SpaceEvenly */;
1366
- }
1367
- }
1368
- break;
1369
- case 'center':
1370
- if (JSIEnabled) {
1371
- nativeValue = 2 /* AlignContent.Center */;
1372
- }
1373
- else {
1374
- if (global.isAndroid) {
1375
- nativeValue = org.nativescript.mason.masonkit.AlignContent.Center;
1376
- }
1377
- if (global.isIOS) {
1378
- nativeValue = 2 /* AlignContent.Center */;
1379
- }
1380
- }
1381
- break;
1382
- case 'flex-end':
1383
- case 'end':
1384
- if (JSIEnabled) {
1385
- nativeValue = 1 /* AlignContent.End */;
1386
- }
1387
- else {
1388
- if (global.isAndroid) {
1389
- nativeValue = org.nativescript.mason.masonkit.AlignContent.End;
1390
- }
1391
- if (global.isIOS) {
1392
- nativeValue = 1 /* AlignContent.End */;
1393
- }
1394
- }
1395
- break;
1396
- case 'flex-start':
1397
- case 'start':
1398
- if (JSIEnabled) {
1399
- nativeValue = 0 /* AlignContent.Start */;
1400
- }
1401
- else {
1402
- if (global.isAndroid) {
1403
- nativeValue = org.nativescript.mason.masonkit.AlignContent.Start;
1404
- }
1405
- if (global.isIOS) {
1406
- nativeValue = 0 /* AlignContent.Start */;
1407
- }
1408
- }
1409
- break;
1410
- case 'stretch':
1411
- if (JSIEnabled) {
1412
- nativeValue = 3 /* AlignContent.Stretch */;
1413
- }
1414
- else {
1415
- if (global.isAndroid) {
1416
- nativeValue = org.nativescript.mason.masonkit.AlignContent.Stretch;
1417
- }
1418
- if (global.isIOS) {
1419
- nativeValue = 3 /* AlignContent.Stretch */;
1420
- }
1421
- }
1422
- break;
1423
- }
1424
- if (nativeValue) {
1425
- if (JSIEnabled) {
1426
- global.__Mason_setAlignContent(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, nativeValue, !instance._inBatch);
1427
- }
1428
- else {
1429
- if (global.isAndroid) {
1430
- const nodeOrView = getMasonInstance(instance);
1431
- if (instance._isMasonChild) {
1432
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setAlignContent(nodeOrView, nativeValue);
1433
- }
1434
- else {
1435
- nodeOrView.setAlignContent(nativeValue);
1436
- }
1437
- }
1438
- if (global.isIOS) {
1439
- instance.ios.alignContent = nativeValue;
1440
- }
1441
- }
1442
- }
1443
- }
1444
- }
1445
- export function _getAlignContent(instance) {
1446
- if (instance._hasNativeView) {
1447
- if (JSIEnabled) {
1448
- const value = global.__Mason_getAlignContent(instance._masonStylePtr);
1449
- switch (value) {
1450
- case -1 /* AlignContent.Normal */:
1451
- return 'normal';
1452
- case 5 /* AlignContent.SpaceAround */:
1453
- return 'space-around';
1454
- case 4 /* AlignContent.SpaceBetween */:
1455
- return 'space-between';
1456
- case 6 /* AlignContent.SpaceEvenly */:
1457
- return 'space-evenly';
1458
- case 2 /* AlignContent.Center */:
1459
- return 'center';
1460
- case 1 /* AlignContent.End */:
1461
- return 'end';
1462
- case 0 /* AlignContent.Start */:
1463
- return 'start';
1464
- case 3 /* AlignContent.Stretch */:
1465
- return 'stretch';
1466
- }
1467
- }
1468
- else {
1469
- if (global.isAndroid) {
1470
- const nodeOrView = getMasonInstance(instance);
1471
- let value;
1472
- if (instance._isMasonChild) {
1473
- value = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getAlignContent(nodeOrView);
1474
- }
1475
- else {
1476
- value = nodeOrView.getAlignContent();
1477
- }
1478
- switch (value) {
1479
- case org.nativescript.mason.masonkit.AlignContent.Normal:
1480
- return 'normal';
1481
- case org.nativescript.mason.masonkit.AlignContent.SpaceAround:
1482
- return 'space-around';
1483
- case org.nativescript.mason.masonkit.AlignContent.SpaceBetween:
1484
- return 'space-between';
1485
- case org.nativescript.mason.masonkit.AlignContent.SpaceEvenly:
1486
- return 'space-evenly';
1487
- case org.nativescript.mason.masonkit.AlignContent.Center:
1488
- return 'center';
1489
- case org.nativescript.mason.masonkit.AlignContent.End:
1490
- return 'end';
1491
- case org.nativescript.mason.masonkit.AlignContent.Start:
1492
- return 'start';
1493
- case org.nativescript.mason.masonkit.AlignContent.Stretch:
1494
- return 'stretch';
1495
- }
1496
- }
1497
- if (global.isIOS) {
1498
- const value = instance.ios.alignContent;
1499
- switch (value) {
1500
- case -1 /* AlignContent.Normal */:
1501
- return 'normal';
1502
- case 5 /* AlignContent.SpaceAround */:
1503
- return 'space-around';
1504
- case 4 /* AlignContent.SpaceBetween */:
1505
- return 'space-between';
1506
- case 6 /* AlignContent.SpaceEvenly */:
1507
- return 'space-evenly';
1508
- case 2 /* AlignContent.Center */:
1509
- return 'center';
1510
- case 1 /* AlignContent.End */:
1511
- return 'end';
1512
- case 0 /* AlignContent.Start */:
1513
- return 'start';
1514
- case 3 /* AlignContent.Stretch */:
1515
- return 'stretch';
1516
- }
1517
- }
1518
- }
1519
- }
1520
- return instance.style.alignContent;
1521
- }
1522
- export function _setJustifyItems(value, instance, initial = false) {
1523
- if (initial && value === 'normal') {
1524
- return;
1525
- }
1526
- if (instance._hasNativeView) {
1527
- let nativeValue = null;
1528
- switch (value) {
1529
- case 'normal':
1530
- if (JSIEnabled) {
1531
- nativeValue = -1 /* JustifyItems.Normal */;
1532
- }
1533
- else {
1534
- nativeValue = org.nativescript.mason.masonkit.JustifyItems.Normal;
1535
- }
1536
- break;
1537
- case 'baseline':
1538
- if (JSIEnabled) {
1539
- nativeValue = 3 /* JustifyItems.Baseline */;
1540
- }
1541
- else {
1542
- nativeValue = org.nativescript.mason.masonkit.JustifyItems.Baseline;
1543
- }
1544
- break;
1545
- case 'center':
1546
- if (JSIEnabled) {
1547
- nativeValue = 2 /* JustifyItems.Center */;
1548
- }
1549
- else {
1550
- nativeValue = org.nativescript.mason.masonkit.JustifyItems.Center;
1551
- }
1552
- break;
1553
- case 'flex-end':
1554
- case 'end':
1555
- if (JSIEnabled) {
1556
- nativeValue = 1 /* JustifyItems.End */;
1557
- }
1558
- else {
1559
- nativeValue = org.nativescript.mason.masonkit.JustifyItems.End;
1560
- }
1561
- break;
1562
- case 'flex-start':
1563
- case 'start':
1564
- if (JSIEnabled) {
1565
- nativeValue = 0 /* JustifyItems.Start */;
1566
- }
1567
- else {
1568
- nativeValue = org.nativescript.mason.masonkit.JustifyItems.Start;
1569
- }
1570
- break;
1571
- case 'stretch':
1572
- if (JSIEnabled) {
1573
- nativeValue = 4 /* JustifyItems.Stretch */;
1574
- }
1575
- else {
1576
- nativeValue = org.nativescript.mason.masonkit.JustifyItems.Stretch;
1577
- }
1578
- break;
1579
- }
1580
- if (nativeValue) {
1581
- if (JSIEnabled) {
1582
- global.__Mason_setJustifyItems(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, nativeValue, !instance._inBatch);
1583
- }
1584
- else {
1585
- if (global.isAndroid) {
1586
- const nodeOrView = getMasonInstance(instance);
1587
- if (instance._isMasonChild) {
1588
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setJustifyItems(nodeOrView, nativeValue);
1589
- }
1590
- else {
1591
- nodeOrView.setJustifyItems(nativeValue);
1592
- }
1593
- }
1594
- if (global.isIOS) {
1595
- instance.ios.justifyItems = nativeValue;
1596
- }
1597
- }
1598
- }
1599
- }
1600
- }
1601
- export function _getJustifyItems(instance) {
1602
- if (instance._hasNativeView) {
1603
- if (JSIEnabled) {
1604
- const value = global.__Mason_getJustifyItems(instance._masonStylePtr);
1605
- switch (value) {
1606
- case -1 /* JustifyItems.Normal */:
1607
- return 'normal';
1608
- case 3 /* JustifyItems.Baseline */:
1609
- return 'baseline';
1610
- case 2 /* JustifyItems.Center */:
1611
- return 'center';
1612
- case 1 /* JustifyItems.End */:
1613
- return 'end';
1614
- case 0 /* JustifyItems.Start */:
1615
- return 'start';
1616
- case 4 /* JustifyItems.Stretch */:
1617
- return 'stretch';
1618
- }
1619
- }
1620
- else {
1621
- if (global.isAndroid) {
1622
- const nodeOrView = getMasonInstance(instance);
1623
- let value;
1624
- if (instance._isMasonChild) {
1625
- value = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getJustifyItems(nodeOrView);
1626
- }
1627
- else {
1628
- value = nodeOrView.getJustifyItems();
1629
- }
1630
- switch (value) {
1631
- case org.nativescript.mason.masonkit.JustifyItems.Normal:
1632
- return 'normal';
1633
- case org.nativescript.mason.masonkit.JustifyItems.Baseline:
1634
- return 'baseline';
1635
- case org.nativescript.mason.masonkit.JustifyItems.Center:
1636
- return 'center';
1637
- case org.nativescript.mason.masonkit.JustifyItems.End:
1638
- return 'end';
1639
- case org.nativescript.mason.masonkit.JustifyItems.Start:
1640
- return 'start';
1641
- case org.nativescript.mason.masonkit.JustifyItems.Stretch:
1642
- return 'stretch';
1643
- }
1644
- }
1645
- if (global.isIOS) {
1646
- const value = instance.ios.justifyItems;
1647
- switch (value) {
1648
- case -1 /* JustifyItems.Normal */:
1649
- return 'normal';
1650
- case 3 /* JustifyItems.Baseline */:
1651
- return 'baseline';
1652
- case 2 /* JustifyItems.Center */:
1653
- return 'center';
1654
- case 1 /* JustifyItems.End */:
1655
- return 'end';
1656
- case 0 /* JustifyItems.Start */:
1657
- return 'start';
1658
- case 4 /* JustifyItems.Stretch */:
1659
- return 'stretch';
1660
- }
1661
- }
1662
- }
1663
- }
1664
- return instance.style.justifyItems;
1665
- }
1666
- export function _setJustifySelf(value, instance, initial = false) {
1667
- if (initial && value === 'normal') {
1668
- return;
1669
- }
1670
- if (instance._hasNativeView) {
1671
- let nativeValue = null;
1672
- switch (value) {
1673
- case 'normal':
1674
- if (JSIEnabled) {
1675
- nativeValue = -1 /* JustifySelf.Normal */;
1676
- }
1677
- else {
1678
- nativeValue = org.nativescript.mason.masonkit.JustifySelf.Normal;
1679
- }
1680
- break;
1681
- case 'baseline':
1682
- if (JSIEnabled) {
1683
- nativeValue = 3 /* JustifySelf.Baseline */;
1684
- }
1685
- else {
1686
- nativeValue = org.nativescript.mason.masonkit.JustifySelf.Baseline;
1687
- }
1688
- break;
1689
- case 'center':
1690
- if (JSIEnabled) {
1691
- nativeValue = 2 /* JustifySelf.Center */;
1692
- }
1693
- else {
1694
- nativeValue = org.nativescript.mason.masonkit.JustifySelf.Center;
1695
- }
1696
- break;
1697
- case 'flex-end':
1698
- case 'end':
1699
- if (JSIEnabled) {
1700
- nativeValue = 1 /* JustifySelf.End */;
1701
- }
1702
- else {
1703
- nativeValue = org.nativescript.mason.masonkit.JustifySelf.End;
1704
- }
1705
- break;
1706
- case 'flex-start':
1707
- case 'start':
1708
- if (JSIEnabled) {
1709
- nativeValue = 0 /* JustifySelf.Start */;
1710
- }
1711
- else {
1712
- nativeValue = org.nativescript.mason.masonkit.JustifySelf.Start;
1713
- }
1714
- break;
1715
- case 'stretch':
1716
- if (JSIEnabled) {
1717
- nativeValue = 4 /* JustifySelf.Stretch */;
1718
- }
1719
- else {
1720
- nativeValue = org.nativescript.mason.masonkit.JustifySelf.Stretch;
1721
- }
1722
- break;
1723
- }
1724
- if (nativeValue) {
1725
- if (JSIEnabled) {
1726
- global.__Mason_setJustifySelf(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, nativeValue, !instance._inBatch);
1727
- }
1728
- else {
1729
- if (global.isAndroid) {
1730
- const nodeOrView = getMasonInstance(instance);
1731
- if (instance._isMasonChild) {
1732
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setJustifySelf(nodeOrView, nativeValue);
1733
- }
1734
- else {
1735
- nodeOrView.setJustifySelf(nativeValue);
1736
- }
1737
- }
1738
- if (global.isIOS) {
1739
- instance.ios.justifySelf = nativeValue;
1740
- }
1741
- }
1742
- }
1743
- }
1744
- }
1745
- export function _getJustifySelf(instance) {
1746
- if (instance._hasNativeView) {
1747
- if (JSIEnabled) {
1748
- const value = global.__Mason_getJustifySelf(instance._masonStylePtr);
1749
- switch (value) {
1750
- case -1 /* JustifySelf.Normal */:
1751
- return 'normal';
1752
- case 3 /* JustifySelf.Baseline */:
1753
- return 'baseline';
1754
- case 2 /* JustifySelf.Center */:
1755
- return 'center';
1756
- case 1 /* JustifySelf.End */:
1757
- return 'end';
1758
- case 0 /* JustifySelf.Start */:
1759
- return 'start';
1760
- case 4 /* JustifySelf.Stretch */:
1761
- return 'stretch';
1762
- }
1763
- }
1764
- else {
1765
- if (global.isAndroid) {
1766
- const nodeOrView = getMasonInstance(instance);
1767
- let value;
1768
- if (instance._isMasonChild) {
1769
- value = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getJustifySelf(nodeOrView);
1770
- }
1771
- else {
1772
- value = nodeOrView.getJustifySelf();
1773
- }
1774
- switch (value) {
1775
- case org.nativescript.mason.masonkit.JustifySelf.Normal:
1776
- return 'normal';
1777
- case org.nativescript.mason.masonkit.JustifySelf.Baseline:
1778
- return 'baseline';
1779
- case org.nativescript.mason.masonkit.JustifySelf.Center:
1780
- return 'center';
1781
- case org.nativescript.mason.masonkit.JustifySelf.End:
1782
- return 'end';
1783
- case org.nativescript.mason.masonkit.JustifySelf.Start:
1784
- return 'start';
1785
- case org.nativescript.mason.masonkit.JustifySelf.Stretch:
1786
- return 'stretch';
1787
- }
1788
- }
1789
- if (global.isIOS) {
1790
- const value = instance.ios.justifySelf;
1791
- switch (value) {
1792
- case -1 /* JustifySelf.Normal */:
1793
- return 'normal';
1794
- case 3 /* JustifySelf.Baseline */:
1795
- return 'baseline';
1796
- case 2 /* JustifySelf.Center */:
1797
- return 'center';
1798
- case 1 /* JustifySelf.End */:
1799
- return 'end';
1800
- case 0 /* JustifySelf.Start */:
1801
- return 'start';
1802
- case 4 /* JustifySelf.Stretch */:
1803
- return 'stretch';
1804
- }
1805
- }
1806
- }
1807
- }
1808
- return instance.style.justifySelf;
1809
- }
1810
- export function _setJustifyContent(value, instance, initial = false) {
1811
- if (initial && value === 'normal') {
1812
- return;
1813
- }
1814
- if (instance._hasNativeView) {
1815
- let nativeValue = null;
1816
- switch (value) {
1817
- case 'normal':
1818
- if (JSIEnabled) {
1819
- nativeValue = -1 /* JustifyContent.Normal */;
1820
- }
1821
- else {
1822
- if (global.isAndroid) {
1823
- nativeValue = org.nativescript.mason.masonkit.JustifyContent.Normal;
1824
- }
1825
- if (global.isIOS) {
1826
- nativeValue = -1 /* JustifyContent.Normal */;
1827
- }
1828
- }
1829
- break;
1830
- case 'space-around':
1831
- if (JSIEnabled) {
1832
- nativeValue = 5 /* JustifyContent.SpaceAround */;
1833
- }
1834
- else {
1835
- if (global.isAndroid) {
1836
- nativeValue = org.nativescript.mason.masonkit.JustifyContent.SpaceAround;
1837
- }
1838
- if (global.isIOS) {
1839
- nativeValue = 5 /* JustifyContent.SpaceAround */;
1840
- }
1841
- }
1842
- break;
1843
- case 'space-between':
1844
- if (JSIEnabled) {
1845
- nativeValue = 4 /* JustifyContent.SpaceBetween */;
1846
- }
1847
- else {
1848
- if (global.isAndroid) {
1849
- nativeValue = org.nativescript.mason.masonkit.JustifyContent.SpaceBetween;
1850
- }
1851
- if (global.isIOS) {
1852
- nativeValue = 4 /* JustifyContent.SpaceBetween */;
1853
- }
1854
- }
1855
- break;
1856
- case 'space-evenly':
1857
- if (JSIEnabled) {
1858
- nativeValue = 6 /* JustifyContent.SpaceEvenly */;
1859
- }
1860
- else {
1861
- if (global.isAndroid) {
1862
- nativeValue = org.nativescript.mason.masonkit.JustifyContent.SpaceEvenly;
1863
- }
1864
- if (global.isIOS) {
1865
- nativeValue = 6 /* JustifyContent.SpaceEvenly */;
1866
- }
1867
- }
1868
- break;
1869
- case 'center':
1870
- if (JSIEnabled) {
1871
- nativeValue = 2 /* JustifyContent.Center */;
1872
- }
1873
- else {
1874
- if (global.isAndroid) {
1875
- nativeValue = org.nativescript.mason.masonkit.JustifyContent.Center;
1876
- }
1877
- if (global.isIOS) {
1878
- nativeValue = 2 /* JustifyContent.Center */;
1879
- }
1880
- }
1881
- break;
1882
- case 'flex-end':
1883
- case 'end':
1884
- if (JSIEnabled) {
1885
- nativeValue = 1 /* JustifyContent.End */;
1886
- }
1887
- else {
1888
- if (global.isAndroid) {
1889
- nativeValue = org.nativescript.mason.masonkit.JustifyContent.End;
1890
- }
1891
- if (global.isIOS) {
1892
- nativeValue = 1 /* JustifyContent.End */;
1893
- }
1894
- }
1895
- break;
1896
- case 'flex-start':
1897
- case 'start':
1898
- if (JSIEnabled) {
1899
- nativeValue = 0 /* JustifyContent.Start */;
1900
- }
1901
- else {
1902
- if (global.isAndroid) {
1903
- nativeValue = org.nativescript.mason.masonkit.JustifyContent.Start;
1904
- }
1905
- if (global.isIOS) {
1906
- nativeValue = 0 /* JustifyContent.Start */;
1907
- }
1908
- }
1909
- break;
1910
- case 'stretch':
1911
- if (JSIEnabled) {
1912
- nativeValue = 3 /* JustifyContent.Stretch */;
1913
- }
1914
- else {
1915
- if (global.isAndroid) {
1916
- nativeValue = org.nativescript.mason.masonkit.JustifyContent.Stretch;
1917
- }
1918
- if (global.isIOS) {
1919
- nativeValue = 3 /* JustifyContent.Stretch */;
1920
- }
1921
- }
1922
- break;
1923
- }
1924
- if (nativeValue) {
1925
- if (JSIEnabled) {
1926
- global.__Mason_setJustifyContent(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, nativeValue, !instance._inBatch);
1927
- }
1928
- else {
1929
- if (global.isAndroid) {
1930
- const nodeOrView = getMasonInstance(instance);
1931
- if (instance._isMasonChild) {
1932
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setJustifyContent(nodeOrView, nativeValue);
1933
- }
1934
- else {
1935
- nodeOrView.setJustifyContent(nativeValue);
1936
- }
1937
- }
1938
- if (global.isIOS) {
1939
- instance.ios.justifyContent = nativeValue;
1940
- }
1941
- }
1942
- }
1943
- }
1944
- }
1945
- export function _getJustifyContent(instance) {
1946
- if (instance._hasNativeView) {
1947
- if (JSIEnabled) {
1948
- const value = global.__Mason_getJustifyContent(instance._masonStylePtr);
1949
- switch (value) {
1950
- case -1 /* JustifyContent.Normal */:
1951
- return 'normal';
1952
- case 5 /* JustifyContent.SpaceAround */:
1953
- return 'space-around';
1954
- case 4 /* JustifyContent.SpaceBetween */:
1955
- return 'space-between';
1956
- case 6 /* JustifyContent.SpaceEvenly */:
1957
- return 'space-evenly';
1958
- case 2 /* JustifyContent.Center */:
1959
- return 'center';
1960
- case 1 /* JustifyContent.End */:
1961
- return 'end';
1962
- case 0 /* JustifyContent.Start */:
1963
- return 'start';
1964
- }
1965
- }
1966
- else {
1967
- if (global.isAndroid) {
1968
- const nodeOrView = getMasonInstance(instance);
1969
- let value;
1970
- if (instance._isMasonChild) {
1971
- value = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getJustifyContent(nodeOrView);
1972
- }
1973
- else {
1974
- value = nodeOrView.getJustifyContent();
1975
- }
1976
- switch (value) {
1977
- case org.nativescript.mason.masonkit.JustifyContent.Normal:
1978
- return 'normal';
1979
- case org.nativescript.mason.masonkit.JustifyContent.SpaceAround:
1980
- return 'space-around';
1981
- case org.nativescript.mason.masonkit.JustifyContent.SpaceBetween:
1982
- return 'space-between';
1983
- case org.nativescript.mason.masonkit.JustifyContent.SpaceEvenly:
1984
- return 'space-evenly';
1985
- case org.nativescript.mason.masonkit.JustifyContent.Center:
1986
- return 'center';
1987
- case org.nativescript.mason.masonkit.JustifyContent.End:
1988
- return 'end';
1989
- case org.nativescript.mason.masonkit.JustifyContent.Start:
1990
- return 'start';
1991
- case org.nativescript.mason.masonkit.JustifyContent.Stretch:
1992
- return 'stretch';
1993
- }
1994
- }
1995
- if (global.isIOS) {
1996
- const value = instance.ios.justifyContent;
1997
- switch (value) {
1998
- case -1 /* JustifyContent.Normal */:
1999
- return 'normal';
2000
- case 5 /* JustifyContent.SpaceAround */:
2001
- return 'space-around';
2002
- case 4 /* JustifyContent.SpaceBetween */:
2003
- return 'space-between';
2004
- case 6 /* JustifyContent.SpaceEvenly */:
2005
- return 'space-evenly';
2006
- case 2 /* JustifyContent.Center */:
2007
- return 'center';
2008
- case 1 /* JustifyContent.End */:
2009
- return 'end';
2010
- case 0 /* JustifyContent.Start */:
2011
- return 'start';
2012
- case 3 /* JustifyContent.Stretch */:
2013
- return 'stretch';
2014
- }
2015
- }
2016
- }
2017
- }
2018
- return instance.style.justifyContent;
2019
- }
2020
- export function _setLeft(value, instance, initial = false) {
2021
- if (!instance._hasNativeView) {
2022
- return;
2023
- }
2024
- const val = _toLengthPercentageAuto(value);
2025
- if (JSIEnabled) {
2026
- global.__Mason_setInsetLeft(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
2027
- }
2028
- else {
2029
- if (global.isAndroid) {
2030
- const nodeOrView = getMasonInstance(instance);
2031
- if (instance._isMasonChild) {
2032
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setInsetLeft(nodeOrView, val.value, val.native_type);
2033
- }
2034
- else {
2035
- nodeOrView.setInsetLeft(val.value, val.native_type);
2036
- }
2037
- }
2038
- if (global.isIOS) {
2039
- instance.ios.setInsetLeft(val.value, val.native_type);
2040
- }
2041
- }
2042
- }
2043
- export function _setRight(value, instance, initial = false) {
2044
- if (!instance._hasNativeView) {
2045
- return;
2046
- }
2047
- const val = _toLengthPercentageAuto(value);
2048
- if (JSIEnabled) {
2049
- global.__Mason_setInsetRight(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
2050
- }
2051
- else {
2052
- if (global.isAndroid) {
2053
- const nodeOrView = getMasonInstance(instance);
2054
- if (instance._isMasonChild) {
2055
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setInsetRight(nodeOrView, val.value, val.native_type);
2056
- }
2057
- else {
2058
- nodeOrView.setInsetRight(val.value, val.native_type);
2059
- }
2060
- }
2061
- if (global.isIOS) {
2062
- instance.ios.setInsetRight(val.value, val.native_type);
2063
- }
2064
- }
2065
- }
2066
- export function _setTop(value, instance, initial = false) {
2067
- if (!instance._hasNativeView) {
2068
- return;
2069
- }
2070
- const val = _toLengthPercentageAuto(value);
2071
- if (JSIEnabled) {
2072
- global.__Mason_setInsetTop(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
2073
- }
2074
- else {
2075
- if (global.isAndroid) {
2076
- const nodeOrView = getMasonInstance(instance);
2077
- if (instance._isMasonChild) {
2078
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setInsetTop(nodeOrView, val.value, val.native_type);
2079
- }
2080
- else {
2081
- nodeOrView.setInsetTop(val.value, val.native_type);
2082
- }
2083
- }
2084
- if (global.isIOS) {
2085
- instance.ios.setInsetTop(val.value, val.native_type);
2086
- }
2087
- }
2088
- }
2089
- export function _setBottom(value, instance, initial = false) {
2090
- if (!instance._hasNativeView) {
2091
- return;
2092
- }
2093
- const val = _toLengthPercentageAuto(value);
2094
- if (JSIEnabled) {
2095
- global.__Mason_setInsetBottom(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
2096
- }
2097
- else {
2098
- if (global.isAndroid) {
2099
- const nodeOrView = getMasonInstance(instance);
2100
- if (instance._isMasonChild) {
2101
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setInsetBottom(nodeOrView, val.value, val.native_type);
2102
- }
2103
- else {
2104
- nodeOrView.setInsetBottom(val.value, val.native_type);
2105
- }
2106
- }
2107
- if (global.isIOS) {
2108
- instance.ios.setInsetBottom(val.value, val.native_type);
2109
- }
2110
- }
2111
- }
2112
- export function _setMarginLeft(value, instance, initial = false) {
2113
- if (!instance._hasNativeView) {
2114
- return;
2115
- }
2116
- const val = _toLengthPercentageAuto(value);
2117
- if (JSIEnabled) {
2118
- global.__Mason_setMarginLeft(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
2119
- }
2120
- else {
2121
- if (global.isAndroid) {
2122
- const nodeOrView = getMasonInstance(instance);
2123
- if (instance._isMasonChild) {
2124
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setMarginLeft(nodeOrView, val.value, val.native_type);
2125
- }
2126
- else {
2127
- nodeOrView.setMarginLeft(val.value, val.native_type);
2128
- }
2129
- }
2130
- if (global.isIOS) {
2131
- instance.ios.setMarginLeft(val.value, val.native_type);
2132
- }
2133
- }
2134
- }
2135
- export function _setMarginRight(value, instance, initial = false) {
2136
- if (!instance._hasNativeView) {
2137
- return;
2138
- }
2139
- const val = _toLengthPercentageAuto(value);
2140
- if (JSIEnabled) {
2141
- global.__Mason_setMarginRight(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
2142
- }
2143
- else {
2144
- if (global.isAndroid) {
2145
- const nodeOrView = getMasonInstance(instance);
2146
- if (instance._isMasonChild) {
2147
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setMarginRight(nodeOrView, val.value, val.native_type);
2148
- }
2149
- else {
2150
- nodeOrView.setMarginRight(val.value, val.native_type);
2151
- }
2152
- }
2153
- if (global.isIOS) {
2154
- instance.ios.setMarginRight(val.value, val.native_type);
2155
- }
2156
- }
2157
- }
2158
- export function _setMarginTop(value, instance, initial = false) {
2159
- if (!instance._hasNativeView) {
2160
- return;
2161
- }
2162
- const val = _toLengthPercentageAuto(value);
2163
- if (JSIEnabled) {
2164
- global.__Mason_setMarginTop(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
2165
- }
2166
- else {
2167
- if (global.isAndroid) {
2168
- const nodeOrView = getMasonInstance(instance);
2169
- if (instance._isMasonChild) {
2170
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setMarginTop(nodeOrView, val.value, val.native_type);
2171
- }
2172
- else {
2173
- nodeOrView.setMarginTop(val.value, val.native_type);
2174
- }
2175
- }
2176
- if (global.isIOS) {
2177
- instance.ios.setMarginTop(val.value, val.native_type);
2178
- }
2179
- }
2180
- }
2181
- export function _setMarginBottom(value, instance, initial = false) {
2182
- if (!instance._hasNativeView) {
2183
- return;
2184
- }
2185
- const val = _toLengthPercentageAuto(value);
2186
- if (JSIEnabled) {
2187
- global.__Mason_setMarginBottom(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
2188
- }
2189
- else {
2190
- if (global.isAndroid) {
2191
- const nodeOrView = getMasonInstance(instance);
2192
- if (instance._isMasonChild) {
2193
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setMarginBottom(nodeOrView, val.value, val.native_type);
2194
- }
2195
- else {
2196
- nodeOrView.setMarginBottom(val.value, val.native_type);
2197
- }
2198
- }
2199
- if (global.isIOS) {
2200
- instance.ios.setMarginBottom(val.value, val.native_type);
2201
- }
2202
- }
2203
- }
2204
- export function _setPaddingLeft(value, instance, initial = false) {
2205
- if (!instance._hasNativeView) {
2206
- return;
2207
- }
2208
- const val = _toLengthPercentage(value);
2209
- if (JSIEnabled) {
2210
- global.__Mason_setPaddingLeft(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
2211
- }
2212
- else {
2213
- if (global.isAndroid) {
2214
- const nodeOrView = getMasonInstance(instance);
2215
- if (instance._isMasonChild) {
2216
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setPaddingLeft(nodeOrView, val.value, val.native_type);
2217
- }
2218
- else {
2219
- nodeOrView.setPaddingLeft(val.value, val.native_type);
2220
- }
2221
- }
2222
- if (global.isIOS) {
2223
- instance.ios.setPaddingLeft(val.value, val.native_type);
2224
- }
2225
- }
2226
- }
2227
- export function _setPaddingRight(value, instance, initial = false) {
2228
- if (!instance._hasNativeView) {
2229
- return;
2230
- }
2231
- const val = _toLengthPercentage(value);
2232
- if (JSIEnabled) {
2233
- global.__Mason_setPaddingRight(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
2234
- }
2235
- else {
2236
- if (global.isAndroid) {
2237
- const nodeOrView = getMasonInstance(instance);
2238
- if (instance._isMasonChild) {
2239
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setPaddingRight(nodeOrView, val.value, val.native_type);
2240
- }
2241
- else {
2242
- nodeOrView.setPaddingRight(val.value, val.native_type);
2243
- }
2244
- }
2245
- if (global.isIOS) {
2246
- instance.ios.setPaddingRight(val.value, val.native_type);
2247
- }
2248
- }
2249
- }
2250
- export function _setPaddingTop(value, instance, initial = false) {
2251
- if (!instance._hasNativeView) {
2252
- return;
2253
- }
2254
- const val = _toLengthPercentage(value);
2255
- if (JSIEnabled) {
2256
- global.__Mason_setPaddingTop(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
2257
- }
2258
- else {
2259
- if (global.isAndroid) {
2260
- const nodeOrView = getMasonInstance(instance);
2261
- if (instance._isMasonChild) {
2262
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setPaddingTop(nodeOrView, val.value, val.native_type);
2263
- }
2264
- else {
2265
- nodeOrView.setPaddingTop(val.value, val.native_type);
2266
- }
2267
- }
2268
- if (global.isIOS) {
2269
- instance.ios.setPaddingTop(val.value, val.native_type);
2270
- }
2271
- }
2272
- }
2273
- export function _setPaddingBottom(value, instance, initial = false) {
2274
- if (!instance._hasNativeView) {
2275
- return;
2276
- }
2277
- const val = _toLengthPercentage(value);
2278
- if (JSIEnabled) {
2279
- global.__Mason_setPaddingBottom(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
2280
- }
2281
- else {
2282
- if (global.isAndroid) {
2283
- const nodeOrView = getMasonInstance(instance);
2284
- if (instance._isMasonChild) {
2285
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setPaddingBottom(nodeOrView, val.value, val.native_type);
2286
- }
2287
- else {
2288
- nodeOrView.setPaddingBottom(val.value, val.native_type);
2289
- }
2290
- }
2291
- if (global.isIOS) {
2292
- instance.ios.setPaddingBottom(val.value, val.native_type);
2293
- }
2294
- }
2295
- }
2296
- export function _setBorderLeft(value, instance, initial = false) {
2297
- if (!instance._hasNativeView) {
2298
- return;
2299
- }
2300
- const val = _toLengthPercentage(value);
2301
- if (JSIEnabled) {
2302
- global.__Mason_setBorderLeft(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
2303
- }
2304
- else {
2305
- if (global.isAndroid) {
2306
- const nodeOrView = getMasonInstance(instance);
2307
- if (instance._isMasonChild) {
2308
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setBorderLeft(nodeOrView, val.value, val.native_type);
2309
- }
2310
- else {
2311
- nodeOrView.setBorderLeft(val.value, val.native_type);
2312
- }
2313
- }
2314
- if (global.isIOS) {
2315
- instance.ios.setBorderLeft(val.value, val.native_type);
2316
- }
2317
- }
2318
- }
2319
- export function _setBorderRight(value, instance, initial = false) {
2320
- if (!instance._hasNativeView) {
2321
- return;
2322
- }
2323
- const val = _toLengthPercentage(value);
2324
- if (JSIEnabled) {
2325
- global.__Mason_setBorderRight(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
2326
- }
2327
- else {
2328
- if (global.isAndroid) {
2329
- const nodeOrView = getMasonInstance(instance);
2330
- if (instance._isMasonChild) {
2331
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setBorderRight(nodeOrView, val.value, val.native_type);
2332
- }
2333
- else {
2334
- nodeOrView.setBorderRight(val.value, val.native_type);
2335
- }
2336
- }
2337
- if (global.isIOS) {
2338
- instance.ios.setBorderRight(val.value, val.native_type);
2339
- }
2340
- }
2341
- }
2342
- export function _setBorderTop(value, instance, initial = false) {
2343
- if (!instance._hasNativeView) {
2344
- return;
2345
- }
2346
- const val = _toLengthPercentage(value);
2347
- if (JSIEnabled) {
2348
- global.__Mason_setBorderTop(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
2349
- }
2350
- else {
2351
- if (global.isAndroid) {
2352
- const nodeOrView = getMasonInstance(instance);
2353
- if (instance._isMasonChild) {
2354
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setBorderTop(nodeOrView, val.value, val.native_type);
2355
- }
2356
- else {
2357
- nodeOrView.setBorderTop(val.value, val.native_type);
2358
- }
2359
- }
2360
- if (global.isIOS) {
2361
- instance.ios.setBorderTop(val.value, val.native_type);
2362
- }
2363
- }
2364
- }
2365
- export function _setBorderBottom(value, instance, initial = false) {
2366
- if (!instance._hasNativeView) {
2367
- return;
2368
- }
2369
- const val = _toLengthPercentage(value);
2370
- if (JSIEnabled) {
2371
- global.__Mason_setBorderBottom(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
2372
- }
2373
- else {
2374
- if (global.isAndroid) {
2375
- const nodeOrView = getMasonInstance(instance);
2376
- if (instance._isMasonChild) {
2377
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setBorderBottom(nodeOrView, val.value, val.native_type);
2378
- }
2379
- else {
2380
- nodeOrView.setBorderBottom(val.value, val.native_type);
2381
- }
2382
- }
2383
- if (global.isIOS) {
2384
- instance.ios.setBorderBottom(val.value, val.native_type);
2385
- }
2386
- }
2387
- }
2388
- export function _setFlexBasis(value, instance, initial = false) {
2389
- if (!instance._hasNativeView) {
2390
- return;
2391
- }
2392
- if (JSIEnabled) {
2393
- const val = _toMasonDimension(value);
2394
- global.__Mason_setFlexBasis(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
2395
- }
2396
- else {
2397
- if (global.isAndroid) {
2398
- const val = _toMasonDimension(value);
2399
- const nodeOrView = getMasonInstance(instance);
2400
- if (instance._isMasonChild) {
2401
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setFlexBasis(nodeOrView, val.value, val.native_type);
2402
- }
2403
- else {
2404
- nodeOrView.setFlexBasis(val.value, val.native_type);
2405
- }
2406
- }
2407
- if (global.isIOS) {
2408
- instance.ios.flexBasisCompat = _intoMasonDimension(value);
2409
- }
2410
- }
2411
- }
2412
- export function _getFlexBasis(instance) {
2413
- if (!instance._hasNativeView) {
2414
- return instance.style.flexBasis;
2415
- }
2416
- if (JSIEnabled) {
2417
- return global.__Mason_getFlexBasis(instance._masonStylePtr);
2418
- }
2419
- else {
2420
- if (global.isAndroid) {
2421
- const nodeOrView = getMasonInstance(instance);
2422
- let value;
2423
- if (instance._isMasonChild) {
2424
- value = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getFlexBasis(nodeOrView);
2425
- }
2426
- else {
2427
- value = nodeOrView.getFlexBasis();
2428
- }
2429
- return _parseDimension(value);
2430
- }
2431
- if (global.isIOS) {
2432
- return _parseDimension(instance.ios.flexBasisCompat);
2433
- }
2434
- return instance.style.flexBasis;
2435
- }
2436
- }
2437
- export function _setGap(value, instance, initial = false) {
2438
- if (!instance._hasNativeView) {
2439
- return;
2440
- }
2441
- const width = _toLengthPercentage(value.width);
2442
- const height = _toLengthPercentage(value.height);
2443
- if (JSIEnabled) {
2444
- global.__Mason_setGap(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, width.value, width.native_type, height.value, height.native_type, !instance._inBatch);
2445
- }
2446
- else {
2447
- if (global.isAndroid) {
2448
- const nodeOrView = getMasonInstance(instance);
2449
- if (instance._isMasonChild) {
2450
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setGap(nodeOrView, width.value, width.native_type, height.value, height.native_type);
2451
- }
2452
- else {
2453
- nodeOrView.setGap(width.value, width.native_type, height.value, height.native_type);
2454
- }
2455
- }
2456
- if (global.isIOS) {
2457
- instance.ios.setGapWithWidthHeightType(width.value, width.native_type, height.value, height.native_type);
2458
- }
2459
- }
2460
- }
2461
- export function _getGap(instance) {
2462
- if (!instance._hasNativeView) {
2463
- return instance.style.gap;
2464
- }
2465
- if (JSIEnabled) {
2466
- return global.__Mason_getGap(instance._masonStylePtr);
2467
- }
2468
- else {
2469
- if (global.isAndroid) {
2470
- const nodeOrView = getMasonInstance(instance);
2471
- let gap;
2472
- if (instance._isMasonChild) {
2473
- gap = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getGap(nodeOrView);
2474
- }
2475
- else {
2476
- gap = nodeOrView.getGap();
2477
- }
2478
- const width = _parseLengthPercentage(gap.getWidth());
2479
- const height = _parseLengthPercentage(gap.getHeight());
2480
- return { width, height };
2481
- }
2482
- if (global.isIOS) {
2483
- const gap = instance.ios.getGap();
2484
- const width = _parseLengthPercentage(gap.width);
2485
- const height = _parseLengthPercentage(gap.height);
2486
- return { width, height };
2487
- }
2488
- }
2489
- }
2490
- export function _setFlexGrow(value, instance, initial = false) {
2491
- if (!instance._hasNativeView) {
2492
- return;
2493
- }
2494
- if (JSIEnabled) {
2495
- global.__Mason_setFlexGrow(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, value, !instance._inBatch);
2496
- }
2497
- else {
2498
- if (global.isAndroid) {
2499
- const nodeOrView = getMasonInstance(instance);
2500
- if (instance._isMasonChild) {
2501
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setFlexGrow(nodeOrView, value);
2502
- }
2503
- else {
2504
- nodeOrView.setFlexGrow(value);
2505
- }
2506
- }
2507
- if (global.isIOS) {
2508
- instance.ios.flexGrow = value;
2509
- }
2510
- }
2511
- }
2512
- export function _getFlexGrow(instance) {
2513
- if (!instance._hasNativeView) {
2514
- return instance.style.flexGrow;
2515
- }
2516
- if (JSIEnabled) {
2517
- return global.__Mason_getFlexGrow(instance._masonStylePtr);
2518
- }
2519
- else {
2520
- if (global.isAndroid) {
2521
- const nodeOrView = getMasonInstance(instance);
2522
- let value;
2523
- if (instance._isMasonChild) {
2524
- value = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getFlexGrow(nodeOrView);
2525
- }
2526
- else {
2527
- value = nodeOrView.getFlexGrow();
2528
- }
2529
- return value;
2530
- }
2531
- if (global.isiOS) {
2532
- return instance.ios.flexGrow;
2533
- }
2534
- return instance.style.flexGrow;
2535
- }
2536
- }
2537
- export function _setFlexShrink(value, instance, initial = false) {
2538
- if (!instance._hasNativeView) {
2539
- return;
2540
- }
2541
- if (JSIEnabled) {
2542
- global.__Mason_setFlexShrink(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, value, !instance._inBatch);
2543
- }
2544
- else {
2545
- if (global.isAndroid) {
2546
- const nodeOrView = getMasonInstance(instance);
2547
- if (instance._isMasonChild) {
2548
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setFlexShrink(nodeOrView, value);
2549
- }
2550
- else {
2551
- nodeOrView.setFlexShrink(value);
2552
- }
2553
- }
2554
- if (global.isIOS) {
2555
- instance.ios.flexShrink = value;
2556
- }
2557
- }
2558
- }
2559
- export function _getFlexShrink(instance) {
2560
- if (!instance._hasNativeView) {
2561
- return instance.style.flexShrink;
2562
- }
2563
- if (JSIEnabled) {
2564
- return global.__Mason_getFlexShrink(instance._masonStylePtr);
2565
- }
2566
- else {
2567
- if (global.isAndroid) {
2568
- const nodeOrView = getMasonInstance(instance);
2569
- let value;
2570
- if (instance._isMasonChild) {
2571
- value = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getFlexShrink(nodeOrView);
2572
- }
2573
- else {
2574
- value = nodeOrView.getFlexShrink();
2575
- }
2576
- return value;
2577
- }
2578
- if (global.isIOS) {
2579
- return instance.ios.flexShrink;
2580
- }
2581
- return instance.style.flexShrink;
2582
- }
2583
- }
2584
- export function _setAspectRatio(value, instance, initial = false) {
2585
- if (!instance._hasNativeView) {
2586
- return;
2587
- }
2588
- if (JSIEnabled) {
2589
- global.__Mason_setAspectRatio(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, value, !instance._inBatch);
2590
- }
2591
- else {
2592
- if (global.isAndroid) {
2593
- const val = Number.isNaN(value) ? null : value;
2594
- const nodeOrView = getMasonInstance(instance);
2595
- if (instance._isMasonChild) {
2596
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setAspectRatio(nodeOrView, val);
2597
- }
2598
- else {
2599
- nodeOrView.setAspectRatio(val);
2600
- }
2601
- }
2602
- if (global.isIOS) {
2603
- instance.ios.aspectRatio = value;
2604
- }
2605
- }
2606
- }
2607
- export function _getAspectRatio(instance) {
2608
- if (!instance._hasNativeView) {
2609
- return instance.style.aspectRatio;
2610
- }
2611
- if (JSIEnabled) {
2612
- return global.__Mason_getAspectRatio(instance._masonStylePtr);
2613
- }
2614
- else {
2615
- if (global.isAndroid) {
2616
- const nodeOrView = getMasonInstance(instance);
2617
- let value;
2618
- if (instance._isMasonChild) {
2619
- value = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getAspectRatio(nodeOrView);
2620
- }
2621
- else {
2622
- value = nodeOrView.getAspectRatio();
2623
- }
2624
- return value;
2625
- }
2626
- if (global.isIOS) {
2627
- const ratio = instance.ios.aspectRatio;
2628
- return Number.isNaN(ratio) ? null : ratio;
2629
- }
2630
- return null;
2631
- }
2632
- }
2633
- function _parseGridLine(value) {
2634
- let parsedValue = undefined;
2635
- let parsedType = undefined;
2636
- let nativeValue = undefined;
2637
- if (typeof value === 'string') {
2638
- if (value === 'auto') {
2639
- parsedValue = 0;
2640
- parsedType = 0 /* GridPlacementCompatType.Auto */;
2641
- if (!JSIEnabled) {
2642
- if (global.isAndroid) {
2643
- parsedType = org.nativescript.mason.masonkit.GridPlacement.Auto;
2644
- nativeValue = org.nativescript.mason.masonkit.GridPlacement.Auto;
2645
- }
2646
- if (global.isIOS) {
2647
- parsedType = 0 /* GridPlacementCompatType.Auto */;
2648
- nativeValue = GridPlacementCompat.Auto;
2649
- }
2650
- }
2651
- }
2652
- if (value.startsWith('span')) {
2653
- parsedValue = Number(value.replace('span', '').trim());
2654
- parsedType = 2 /* GridPlacementCompatType.Span */;
2655
- if (!JSIEnabled) {
2656
- const isValid = !Number.isNaN(parsedValue);
2657
- if (global.isAndroid) {
2658
- parsedType = org.nativescript.mason.masonkit.GridPlacement.Span;
2659
- if (isValid) {
2660
- nativeValue = new org.nativescript.mason.masonkit.GridPlacement.Span(parsedValue);
2661
- }
2662
- }
2663
- if (global.isIOS) {
2664
- parsedType = 2 /* GridPlacementCompatType.Span */;
2665
- if (isValid) {
2666
- nativeValue = GridPlacementCompat.alloc().initWithSpan(parsedValue);
2667
- }
2668
- }
2669
- }
2670
- }
2671
- else {
2672
- parsedValue = Number(value.trim());
2673
- parsedType = 1 /* GridPlacementCompatType.Line */;
2674
- if (!JSIEnabled) {
2675
- const isValid = !Number.isNaN(parsedValue);
2676
- if (global.isAndroid) {
2677
- parsedType = org.nativescript.mason.masonkit.GridPlacement.Line;
2678
- if (isValid) {
2679
- nativeValue = new org.nativescript.mason.masonkit.GridPlacement.Line(parsedValue);
2680
- }
2681
- }
2682
- if (global.isIOS) {
2683
- parsedType = 1 /* GridPlacementCompatType.Line */;
2684
- if (isValid) {
2685
- nativeValue = GridPlacementCompat.alloc().initWithLine(parsedValue);
2686
- }
2687
- }
2688
- }
2689
- }
2690
- return { value: Number.isNaN(parsedValue) ? undefined : parsedValue, type: parsedType, native_value: nativeValue };
2691
- }
2692
- if (typeof value === 'number') {
2693
- parsedValue = value;
2694
- parsedType = 1 /* GridPlacementCompatType.Line */;
2695
- if (!JSIEnabled) {
2696
- if (global.isAndroid) {
2697
- parsedType = org.nativescript.mason.masonkit.GridPlacement.Line;
2698
- nativeValue = new org.nativescript.mason.masonkit.GridPlacement.Line(parsedValue);
2699
- }
2700
- if (global.isIOS) {
2701
- parsedType = 1 /* GridPlacementCompatType.Line */;
2702
- nativeValue = GridPlacementCompat.alloc().initWithLine(parsedValue);
2703
- }
2704
- }
2705
- }
2706
- return { value: parsedValue, type: parsedType, native_value: nativeValue };
2707
- }
2708
- export function _setGridColumnStart(value, instance, initial = false) {
2709
- if (!instance._hasNativeView) {
2710
- return;
2711
- }
2712
- const val = _parseGridLine(value);
2713
- if (val.value === undefined || val.type === undefined) {
2714
- return;
2715
- }
2716
- if (JSIEnabled) {
2717
- global.__Mason_setColumnStart(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val, !instance._inBatch);
2718
- }
2719
- else {
2720
- if (global.isAndroid) {
2721
- const nodeOrView = getMasonInstance(instance);
2722
- if (instance._isMasonChild) {
2723
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setGridColumnStart(nodeOrView, val.native_value);
2724
- }
2725
- else {
2726
- nodeOrView.setGridColumnStart(val.native_value);
2727
- }
2728
- }
2729
- if (global.isIOS) {
2730
- instance.ios.gridColumnStartCompat = val.native_value;
2731
- }
2732
- }
2733
- }
2734
- export function _setGridColumnEnd(value, instance, initial = false) {
2735
- if (!instance._hasNativeView) {
2736
- return;
2737
- }
2738
- const val = _parseGridLine(value);
2739
- if (val.value === undefined || val.type === undefined) {
2740
- return;
2741
- }
2742
- if (JSIEnabled) {
2743
- global.__Mason_setColumnEnd(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val, !instance._inBatch);
2744
- }
2745
- else {
2746
- if (global.isAndroid) {
2747
- const nodeOrView = getMasonInstance(instance);
2748
- if (instance._isMasonChild) {
2749
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setGridColumnEnd(nodeOrView, val.native_value);
2750
- }
2751
- else {
2752
- nodeOrView.setGridColumnEnd(val.native_value);
2753
- }
2754
- }
2755
- if (global.isIOS) {
2756
- instance.ios.gridColumnEndCompat = val.native_value;
2757
- }
2758
- }
2759
- }
2760
- export function _setGridRowStart(value, instance, initial = false) {
2761
- if (!instance._hasNativeView) {
2762
- return;
2763
- }
2764
- const val = _parseGridLine(value);
2765
- if (val.value === undefined || val.type === undefined) {
2766
- return;
2767
- }
2768
- if (JSIEnabled) {
2769
- global.__Mason_setRowStart(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val, !instance._inBatch);
2770
- }
2771
- else {
2772
- if (global.isAndroid) {
2773
- const nodeOrView = getMasonInstance(instance);
2774
- if (instance._isMasonChild) {
2775
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setGridRowStart(nodeOrView, val.native_value);
2776
- }
2777
- else {
2778
- nodeOrView.setGridRowStart(val.native_value);
2779
- }
2780
- }
2781
- if (global.isIOS) {
2782
- instance.ios.gridRowStartCompat = val.native_value;
2783
- }
2784
- }
2785
- }
2786
- export function _setGridRowEnd(value, instance, initial = false) {
2787
- if (!instance._hasNativeView) {
2788
- return;
2789
- }
2790
- const val = _parseGridLine(value);
2791
- if (val.value === undefined || val.type === undefined) {
2792
- return;
2793
- }
2794
- if (JSIEnabled) {
2795
- global.__Mason_setRowEnd(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val, !instance._inBatch);
2796
- }
2797
- else {
2798
- if (global.isAndroid) {
2799
- const nodeOrView = getMasonInstance(instance);
2800
- if (instance._isMasonChild) {
2801
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setGridRowEnd(nodeOrView, val.native_value);
2802
- }
2803
- else {
2804
- nodeOrView.setGridRowEnd(val.native_value);
2805
- }
2806
- }
2807
- if (global.isIOS) {
2808
- instance.ios.gridRowEndCompat = val.native_value;
2809
- }
2810
- }
2811
- }
2812
- export function _setRowGap(value, instance, initial = false) {
2813
- if (!instance._hasNativeView) {
2814
- return;
2815
- }
2816
- const val = _toLengthPercentage(value);
2817
- if (val.value === undefined || val.type === undefined) {
2818
- return;
2819
- }
2820
- if (JSIEnabled) {
2821
- global.__Mason_setRowGap(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
2822
- }
2823
- else {
2824
- if (global.isAndroid) {
2825
- const nodeOrView = getMasonInstance(instance);
2826
- if (instance._isMasonChild) {
2827
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setGapRow(nodeOrView, val.value, val.native_type);
2828
- }
2829
- else {
2830
- nodeOrView.setGapRow(val.value, val.native_type);
2831
- }
2832
- }
2833
- if (global.isIOS) {
2834
- instance.ios.setRowGap(val.value, val.native_type);
2835
- }
2836
- }
2837
- }
2838
- export function _getRowGap(instance) {
2839
- if (!instance._hasNativeView) {
2840
- return instance.style.gap;
2841
- }
2842
- if (JSIEnabled) {
2843
- return global.__Mason_getRowGap(instance._masonStylePtr);
2844
- }
2845
- else {
2846
- if (global.isAndroid) {
2847
- const nodeOrView = getMasonInstance(instance);
2848
- let gap;
2849
- if (instance._isMasonChild) {
2850
- gap = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getGapRow(nodeOrView);
2851
- }
2852
- else {
2853
- gap = nodeOrView.getGapRow();
2854
- }
2855
- return _parseLengthPercentage(gap);
2856
- }
2857
- if (global.isIOS) {
2858
- const gap = instance.ios.getRowGap();
2859
- return _parseLengthPercentage(gap);
2860
- }
2861
- }
2862
- }
2863
- export function _setColumnGap(value, instance, initial = false) {
2864
- if (!instance._hasNativeView) {
2865
- return;
2866
- }
2867
- const val = _toLengthPercentage(value);
2868
- if (val.value === undefined || val.type === undefined) {
2869
- return;
2870
- }
2871
- if (JSIEnabled) {
2872
- global.__Mason_setColumnGap(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, val.value, val.native_type, !instance._inBatch);
2873
- }
2874
- else {
2875
- if (global.isAndroid) {
2876
- const nodeOrView = getMasonInstance(instance);
2877
- if (instance._isMasonChild) {
2878
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setGapColumn(nodeOrView, val.value, val.native_type);
2879
- }
2880
- else {
2881
- nodeOrView.setGapColumn(val.value, val.native_type);
2882
- }
2883
- }
2884
- if (global.isIOS) {
2885
- instance.ios.setColumnGap(val.value, val.native_type);
2886
- }
2887
- }
2888
- }
2889
- export function _getColumnGap(instance) {
2890
- if (!instance._hasNativeView) {
2891
- return instance.style.gap;
2892
- }
2893
- if (JSIEnabled) {
2894
- return global.__Mason_getColumnGap(instance._masonStylePtr);
2895
- }
2896
- else {
2897
- if (global.isAndroid) {
2898
- const nodeOrView = getMasonInstance(instance);
2899
- let gap;
2900
- if (instance._isMasonChild) {
2901
- gap = org.nativescript.mason.masonkit.NodeHelper.INSTANCE.getGapColumn(nodeOrView);
2902
- }
2903
- else {
2904
- gap = nodeOrView.getGapColumn();
2905
- }
2906
- return _parseLengthPercentage(gap);
2907
- }
2908
- if (global.isIOS) {
2909
- const gap = instance.ios.getColumnGap();
2910
- return _parseLengthPercentage(gap);
2911
- }
2912
- }
2913
- }
2914
- const Auto = 'auto';
2915
- const None = 'none';
2916
- const MinContent = 'min-content';
2917
- const MaxContent = 'max-content';
2918
- export function _parseMinMaxValue(value) {
2919
- if (typeof value === 'string') {
2920
- if (value === Auto || value === None) {
2921
- return {
2922
- min_type: 0 /* MinSizingType.Auto */,
2923
- min_value: 0,
2924
- max_type: 0 /* MaxSizingType.Auto */,
2925
- max_value: 0,
2926
- };
2927
- }
2928
- else if (value === MinContent) {
2929
- return {
2930
- min_type: 1 /* MinSizingType.MinContent */,
2931
- min_value: 0,
2932
- max_type: 1 /* MaxSizingType.MinContent */,
2933
- max_value: 0,
2934
- };
2935
- }
2936
- else if (value === MaxContent) {
2937
- return {
2938
- min_type: 2 /* MinSizingType.MaxContent */,
2939
- min_value: 0,
2940
- max_type: 2 /* MaxSizingType.MaxContent */,
2941
- max_value: 0,
2942
- };
2943
- }
2944
- else if (value.startsWith('flex')) {
2945
- const flex = parseInt(value.replace('flex(', '').replace(')', '').replace('fr', '').trim());
2946
- return {
2947
- min_type: 0 /* MinSizingType.Auto */,
2948
- min_value: 0,
2949
- max_type: 5 /* MaxSizingType.Flex */,
2950
- max_value: flex,
2951
- };
2952
- }
2953
- else if (value.startsWith('minmax')) {
2954
- // todo
2955
- const minMax = parseInt(value.replace('minmax(', '').replace(')', '').trim());
2956
- }
2957
- else if (value.startsWith('fit-content')) {
2958
- const fitContent = value.replace('fit-content(', '').replace(')', '').trim();
2959
- if (fitContent.indexOf('px') > -1) {
2960
- const px = parseInt(fitContent.replace('px', ''));
2961
- return {
2962
- min_type: 0 /* MinSizingType.Auto */,
2963
- min_value: px,
2964
- max_type: 6 /* MaxSizingType.FitContent */,
2965
- max_value: px,
2966
- };
2967
- }
2968
- if (fitContent.indexOf('px') > -1) {
2969
- const dip = Utils.layout.toDevicePixels(parseInt(fitContent.replace('dip', '')));
2970
- return {
2971
- min_type: 0 /* MinSizingType.Auto */,
2972
- min_value: dip,
2973
- max_type: 6 /* MaxSizingType.FitContent */,
2974
- max_value: dip,
2975
- };
2976
- }
2977
- if (fitContent.indexOf('%') > -1) {
2978
- const percent = parseFloat(fitContent.replace('%', ''));
2979
- return {
2980
- min_type: 0 /* MinSizingType.Auto */,
2981
- min_value: percent,
2982
- max_type: 7 /* MaxSizingType.FitContentPercent */,
2983
- max_value: percent,
2984
- };
2985
- }
2986
- }
2987
- else if (value.indexOf('px') > -1) {
2988
- const px = parseInt(value.replace('px', ''));
2989
- return {
2990
- min_type: 3 /* MinSizingType.Points */,
2991
- min_value: px,
2992
- max_type: 3 /* MaxSizingType.Points */,
2993
- max_value: px,
2994
- };
2995
- }
2996
- else if (value.indexOf('dip') > -1) {
2997
- const dip = Utils.layout.toDevicePixels(parseInt(value.replace('dip', '')));
2998
- return {
2999
- min_type: 3 /* MinSizingType.Points */,
3000
- min_value: dip,
3001
- max_type: 3 /* MaxSizingType.Points */,
3002
- max_value: dip,
3003
- };
3004
- }
3005
- else if (value.indexOf('%') > -1) {
3006
- const percent = parseFloat(value.replace('%', ''));
3007
- return {
3008
- min_type: 4 /* MinSizingType.Percent */,
3009
- min_value: percent,
3010
- max_type: 4 /* MaxSizingType.Percent */,
3011
- max_value: percent,
3012
- };
3013
- }
3014
- else if (value.indexOf('fr') > -1) {
3015
- const flex = parseFloat(value.replace('fr', ''));
3016
- return {
3017
- min_type: 0 /* MinSizingType.Auto */,
3018
- min_value: 0,
3019
- max_type: 5 /* MaxSizingType.Flex */,
3020
- max_value: flex,
3021
- };
3022
- }
3023
- else {
3024
- const dip = Utils.layout.toDevicePixels(Number(value));
3025
- return {
3026
- min_type: 3 /* MinSizingType.Points */,
3027
- min_value: dip,
3028
- max_type: 3 /* MaxSizingType.Points */,
3029
- max_value: dip,
3030
- };
3031
- }
3032
- }
3033
- if (typeof value === 'number') {
3034
- const dip = Utils.layout.toDevicePixels(value);
3035
- return {
3036
- min_type: 3 /* MinSizingType.Points */,
3037
- min_value: dip,
3038
- max_type: 3 /* MaxSizingType.Points */,
3039
- max_value: dip,
3040
- };
3041
- }
3042
- return undefined;
3043
- }
3044
- const grid_templates_regex = /[^\s()]+(?:\([^\s()]+(?:\([^()]+\))?(?:, *[^\s()]+(?:\([^()]+\))?)*\))?/g;
3045
- export function _parseGridTemplates(value) {
3046
- const array = [];
3047
- if (typeof value === 'string') {
3048
- const values = Array.from(value.matchAll(grid_templates_regex), (m) => m[0]);
3049
- values.forEach((item) => {
3050
- if (item.startsWith('repeat(')) {
3051
- const repeatValue = item.replace('repeat(', '').replace(')', '');
3052
- const trackEnd = repeatValue.indexOf(',');
3053
- const repetition = repeatValue.substring(0, trackEnd);
3054
- const tracks = repeatValue
3055
- .substring(trackEnd + 1)
3056
- .split(' ')
3057
- .filter((a) => {
3058
- return a.length || a.trim() === ',';
3059
- });
3060
- let isValid = true;
3061
- let repeating_type = 0;
3062
- let repeat_count = 0;
3063
- switch (repetition) {
3064
- case 'repeat-fill':
3065
- repeating_type = 0 /* TSCGridTrackRepetition.AutoFill */;
3066
- break;
3067
- case 'repeat-fit':
3068
- repeating_type = 1 /* TSCGridTrackRepetition.AutoFit */;
3069
- break;
3070
- default:
3071
- const number = parseInt(repetition);
3072
- repeating_type = 2 /* TSCGridTrackRepetition.Count */;
3073
- isValid = !Number.isNaN(number);
3074
- if (isValid) {
3075
- repeat_count = number;
3076
- }
3077
- break;
3078
- }
3079
- if (isValid) {
3080
- const tracks_array = [];
3081
- tracks.forEach((track) => {
3082
- const minMax = _parseMinMaxValue(track.trim());
3083
- tracks_array.push(minMax);
3084
- });
3085
- array.push({
3086
- is_repeating: true,
3087
- repeating_type,
3088
- repeating_count: repeat_count,
3089
- value: tracks_array,
3090
- });
3091
- }
3092
- }
3093
- else {
3094
- const value = _parseMinMaxValue(item);
3095
- array.push({
3096
- is_repeating: false,
3097
- repeating_type: 0,
3098
- value,
3099
- });
3100
- }
3101
- });
3102
- }
3103
- return array;
3104
- }
3105
- export function _setGridTemplateRows(value, instance, initial = false) {
3106
- if (!instance._hasNativeView) {
3107
- return;
3108
- }
3109
- if (JSIEnabled) {
3110
- global.__Mason_setGridTemplateRows(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, value, !instance._inBatch);
3111
- }
3112
- else {
3113
- if (global.isAndroid) {
3114
- const array = Array.create('org.nativescript.mason.masonkit.TrackSizingFunction', value.length);
3115
- const length = value.length;
3116
- for (let i = 0; i < length; i++) {
3117
- const item = value[i];
3118
- if (item.is_repeating) {
3119
- const repeating = item.value;
3120
- const tracks = Array.create('org.nativescript.mason.masonkit.MinMax', repeating.length);
3121
- let gridTrackRepetition = null;
3122
- switch (item.repeating_type) {
3123
- case 0 /* TSCGridTrackRepetition.AutoFill */:
3124
- gridTrackRepetition = org.nativescript.mason.masonkit.GridTrackRepetition.AutoFill;
3125
- break;
3126
- case 1 /* TSCGridTrackRepetition.AutoFit */:
3127
- gridTrackRepetition = org.nativescript.mason.masonkit.GridTrackRepetition.AutoFit;
3128
- break;
3129
- case 2 /* TSCGridTrackRepetition.Count */:
3130
- gridTrackRepetition = new org.nativescript.mason.masonkit.GridTrackRepetition.Count(item.repeating_count);
3131
- break;
3132
- }
3133
- if (gridTrackRepetition === null) {
3134
- continue;
3135
- }
3136
- const repeatingLength = repeating.length;
3137
- for (let j = 0; j < repeatingLength; j++) {
3138
- const repeat = repeating[j];
3139
- tracks[j] = org.nativescript.mason.masonkit.MinMax.fromTypeValue(repeat.min_type, repeat.min_value, repeat.max_type, repeat.max_value);
3140
- }
3141
- const repeat = new org.nativescript.mason.masonkit.TrackSizingFunction.AutoRepeat(gridTrackRepetition, tracks);
3142
- array[i] = repeat;
3143
- }
3144
- else {
3145
- const single = item.value;
3146
- const trackSizingFunction = new org.nativescript.mason.masonkit.TrackSizingFunction.Single(org.nativescript.mason.masonkit.MinMax.fromTypeValue(single.min_type, single.min_value, single.max_type, single.max_value));
3147
- array[i] = trackSizingFunction;
3148
- }
3149
- }
3150
- const nodeOrView = getMasonInstance(instance);
3151
- if (instance._isMasonChild) {
3152
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setGridTemplateRows(nodeOrView, array);
3153
- }
3154
- else {
3155
- nodeOrView.setGridTemplateRows(array);
3156
- }
3157
- }
3158
- if (global.isIOS) {
3159
- const length = value.length;
3160
- const array = NSMutableArray.arrayWithCapacity(length);
3161
- for (let i = 0; i < length; i++) {
3162
- const item = value[i];
3163
- if (item.is_repeating) {
3164
- const repeating = item.value;
3165
- const repeatingLength = repeating.length;
3166
- const tracks = NSMutableArray.arrayWithCapacity(repeatingLength);
3167
- let gridTrackRepetition = null;
3168
- switch (item.repeating_type) {
3169
- case 0 /* TSCGridTrackRepetition.AutoFill */:
3170
- gridTrackRepetition = 0 /* TSCGridTrackRepetition.AutoFill */;
3171
- break;
3172
- case 1 /* TSCGridTrackRepetition.AutoFit */:
3173
- gridTrackRepetition = 1 /* TSCGridTrackRepetition.AutoFit */;
3174
- break;
3175
- case 2 /* TSCGridTrackRepetition.Count */:
3176
- gridTrackRepetition = GridTrackRepetition.Count(item.repeating_count);
3177
- break;
3178
- }
3179
- if (gridTrackRepetition === null) {
3180
- continue;
3181
- }
3182
- for (let j = 0; j < repeatingLength; j++) {
3183
- const repeat = repeating[j];
3184
- tracks.addObject(MinMax.fromTypeValue(repeat.min_type, repeat.min_value, repeat.max_type, repeat.max_value));
3185
- }
3186
- const repeat = TrackSizingFunction.AutoRepeat(gridTrackRepetition, tracks);
3187
- array.addObject(repeat);
3188
- }
3189
- else {
3190
- const single = item.value;
3191
- const trackSizingFunction = TrackSizingFunction.Single(MinMax.fromTypeValue(single.min_type, single.min_value, single.max_type, single.max_value));
3192
- array.addObject(trackSizingFunction);
3193
- }
3194
- }
3195
- instance.ios.gridTemplateRows = array;
3196
- }
3197
- }
3198
- }
3199
- export function _setGridTemplateColumns(value, instance, initial = false) {
3200
- if (!instance._hasNativeView) {
3201
- return;
3202
- }
3203
- if (JSIEnabled) {
3204
- global.__Mason_setGridTemplateColumns(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, value, !instance._inBatch);
3205
- }
3206
- else {
3207
- if (global.isAndroid) {
3208
- const array = Array.create('org.nativescript.mason.masonkit.TrackSizingFunction', value.length);
3209
- const length = value.length;
3210
- for (let i = 0; i < length; i++) {
3211
- const item = value[i];
3212
- if (item.is_repeating) {
3213
- const repeating = item.value;
3214
- const tracks = Array.create('org.nativescript.mason.masonkit.MinMax', repeating.length);
3215
- let gridTrackRepetition = null;
3216
- switch (item.repeating_type) {
3217
- case 0 /* TSCGridTrackRepetition.AutoFill */:
3218
- gridTrackRepetition = org.nativescript.mason.masonkit.GridTrackRepetition.AutoFill.INSTANCE;
3219
- break;
3220
- case 1 /* TSCGridTrackRepetition.AutoFit */:
3221
- gridTrackRepetition = org.nativescript.mason.masonkit.GridTrackRepetition.AutoFit.INSTANCE;
3222
- break;
3223
- case 2 /* TSCGridTrackRepetition.Count */:
3224
- gridTrackRepetition = new org.nativescript.mason.masonkit.GridTrackRepetition.Count(item.repeating_count);
3225
- break;
3226
- }
3227
- if (gridTrackRepetition === null) {
3228
- continue;
3229
- }
3230
- const repeatingLength = repeating.length;
3231
- for (let j = 0; j < repeatingLength; j++) {
3232
- const repeat = repeating[j];
3233
- tracks[j] = org.nativescript.mason.masonkit.MinMax.fromTypeValue(repeat.min_type, repeat.min_value, repeat.max_type, repeat.max_value);
3234
- }
3235
- const repeat = new org.nativescript.mason.masonkit.TrackSizingFunction.AutoRepeat(gridTrackRepetition, tracks);
3236
- array[i] = repeat;
3237
- }
3238
- else {
3239
- const single = item.value;
3240
- const trackSizingFunction = new org.nativescript.mason.masonkit.TrackSizingFunction.Single(org.nativescript.mason.masonkit.MinMax.fromTypeValue(single.min_type, single.min_value, single.max_type, single.max_value));
3241
- array[i] = trackSizingFunction;
3242
- }
3243
- }
3244
- const nodeOrView = getMasonInstance(instance);
3245
- if (instance._isMasonChild) {
3246
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setGridTemplateColumns(nodeOrView, array);
3247
- }
3248
- else {
3249
- nodeOrView.setGridTemplateColumns(array);
3250
- }
3251
- }
3252
- if (global.isIOS) {
3253
- const length = value.length;
3254
- const array = NSMutableArray.arrayWithCapacity(length);
3255
- for (let i = 0; i < length; i++) {
3256
- const item = value[i];
3257
- if (item.is_repeating) {
3258
- const repeating = item.value;
3259
- const repeatingLength = repeating.length;
3260
- const tracks = NSMutableArray.arrayWithCapacity(repeatingLength);
3261
- let gridTrackRepetition = null;
3262
- switch (item.repeating_type) {
3263
- case 0 /* TSCGridTrackRepetition.AutoFill */:
3264
- gridTrackRepetition = 0 /* TSCGridTrackRepetition.AutoFill */;
3265
- break;
3266
- case 1 /* TSCGridTrackRepetition.AutoFit */:
3267
- gridTrackRepetition = 1 /* TSCGridTrackRepetition.AutoFit */;
3268
- break;
3269
- case 2 /* TSCGridTrackRepetition.Count */:
3270
- gridTrackRepetition = GridTrackRepetition.Count(item.repeating_count);
3271
- break;
3272
- }
3273
- if (gridTrackRepetition === null) {
3274
- continue;
3275
- }
3276
- for (let j = 0; j < repeatingLength; j++) {
3277
- const repeat = repeating[j];
3278
- tracks.addObject(MinMax.fromTypeValue(repeat.min_type, repeat.min_value, repeat.max_type, repeat.max_value));
3279
- }
3280
- const repeat = TrackSizingFunction.AutoRepeat(gridTrackRepetition, tracks);
3281
- array.addObject(repeat);
3282
- }
3283
- else {
3284
- const single = item.value;
3285
- const trackSizingFunction = TrackSizingFunction.Single(MinMax.fromTypeValue(single.min_type, single.min_value, single.max_type, single.max_value));
3286
- array.addObject(trackSizingFunction);
3287
- }
3288
- }
3289
- instance.ios.gridTemplateColumns = array;
3290
- }
3291
- }
3292
- }
3293
- export function _parseGridAutoRowsColumns(value) {
3294
- const array = [];
3295
- if (typeof value === 'string') {
3296
- const values = value.split(' ');
3297
- values.forEach((item) => {
3298
- const value = _parseMinMaxValue(item);
3299
- array.push({
3300
- is_repeating: false,
3301
- repeating_type: 0,
3302
- value,
3303
- });
3304
- });
3305
- }
3306
- return array;
3307
- }
3308
- export function _setGridAutoRows(value, instance, initial = false) {
3309
- if (!instance._hasNativeView) {
3310
- return;
3311
- }
3312
- const values = _parseGridAutoRowsColumns(value);
3313
- if (JSIEnabled) {
3314
- global.__Mason_setGridAutoRows(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, values, !instance._inBatch);
3315
- }
3316
- else {
3317
- if (global.isAndroid) {
3318
- const array = Array.create('org.nativescript.mason.masonkit.MinMax', values.length);
3319
- const length = value.length;
3320
- for (let i = 0; i < length; i++) {
3321
- const item = value[i];
3322
- const minMax = org.nativescript.mason.masonkit.MinMax.fromTypeValue(item.min_type, item.min_value, item.max_type, item.max_value);
3323
- array[i] = minMax;
3324
- }
3325
- const nodeOrView = getMasonInstance(instance);
3326
- if (instance._isMasonChild) {
3327
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setGridAutoRows(nodeOrView, array);
3328
- }
3329
- else {
3330
- nodeOrView.setGridAutoRows(array);
3331
- }
3332
- }
3333
- if (global.isIOS) {
3334
- const length = value.length;
3335
- const array = NSMutableArray.arrayWithCapacity(length);
3336
- for (let i = 0; i < length; i++) {
3337
- const item = value[i];
3338
- const minMax = MinMax.fromTypeValue(item.min_type, item.min_value, item.max_type, item.max_value);
3339
- array.addObject(minMax);
3340
- }
3341
- instance.ios.gridAutoRows = array;
3342
- }
3343
- }
3344
- }
3345
- export function _setGridAutoColumns(value, instance, initial = false) {
3346
- if (!instance._hasNativeView) {
3347
- return;
3348
- }
3349
- const values = _parseGridAutoRowsColumns(value);
3350
- if (JSIEnabled) {
3351
- global.__Mason_setGridAutoColumns(instance._masonPtr, instance._masonNodePtr, instance._masonStylePtr, values, !instance._inBatch);
3352
- }
3353
- else {
3354
- if (global.isAndroid) {
3355
- const array = Array.create('org.nativescript.mason.masonkit.MinMax', values.length);
3356
- const length = value.length;
3357
- for (let i = 0; i < length; i++) {
3358
- const item = value[i];
3359
- const minMax = org.nativescript.mason.masonkit.MinMax.fromTypeValue(item.min_type, item.min_value, item.max_type, item.max_value);
3360
- array[i] = minMax;
3361
- }
3362
- const nodeOrView = getMasonInstance(instance);
3363
- if (instance._isMasonChild) {
3364
- org.nativescript.mason.masonkit.NodeHelper.INSTANCE.setGridAutoColumns(nodeOrView, array);
3365
- }
3366
- else {
3367
- nodeOrView.setGridAutoColumns(array);
3368
- }
3369
- }
3370
- if (global.isIOS) {
3371
- const length = value.length;
3372
- const array = NSMutableArray.arrayWithCapacity(length);
3373
- for (let i = 0; i < length; i++) {
3374
- const item = value[i];
3375
- const minMax = MinMax.fromTypeValue(item.min_type, item.min_value, item.max_type, item.max_value);
3376
- array.addObject(minMax);
3377
- }
3378
- instance.ios.gridAutoColumns = array;
3379
- }
3380
- }
3381
- }
3382
- //# sourceMappingURL=helpers.js.map