@triniwiz/nativescript-masonkit 1.0.0-beta.87 → 1.0.0-beta.89

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 (113) hide show
  1. package/DOCS.md +16 -4
  2. package/angular/README.md +204 -0
  3. package/angular/fesm2022/triniwiz-nativescript-masonkit-angular.mjs +496 -0
  4. package/angular/fesm2022/triniwiz-nativescript-masonkit-angular.mjs.map +1 -0
  5. package/angular/package.json +19 -0
  6. package/angular/types/triniwiz-nativescript-masonkit-angular.d.ts +181 -0
  7. package/button/index.android.d.ts +2 -1
  8. package/button/index.ios.d.ts +2 -1
  9. package/button/index.windows.d.ts +2 -1
  10. package/common.d.ts +102 -1
  11. package/common.js +93 -2
  12. package/common.js.map +1 -1
  13. package/img/index.android.d.ts +2 -1
  14. package/img/index.ios.d.ts +2 -1
  15. package/img/index.windows.d.ts +2 -1
  16. package/index.d.ts +21 -10
  17. package/input/index.android.d.ts +5 -1
  18. package/input/index.android.js +12 -1
  19. package/input/index.android.js.map +1 -1
  20. package/input/index.ios.d.ts +7 -1
  21. package/input/index.ios.js +12 -1
  22. package/input/index.ios.js.map +1 -1
  23. package/input/index.windows.d.ts +6 -1
  24. package/package.json +3 -1
  25. package/platforms/android/masonkit-release.aar +0 -0
  26. package/platforms/ios/Mason.xcframework/Info.plist +0 -34
  27. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason-Swift.h +32 -0
  28. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/mason_native.h +27 -2
  29. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Mason +0 -0
  30. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  31. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.abi.json +2837 -826
  32. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.private.swiftinterface +43 -1
  33. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  34. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftinterface +43 -1
  35. package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  36. package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8477 -8378
  37. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason-Swift.h +64 -0
  38. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/mason_native.h +27 -2
  39. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Mason +0 -0
  40. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  41. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  42. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.abi.json +2837 -826
  43. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +43 -1
  44. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  45. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftinterface +43 -1
  46. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +2837 -826
  47. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +43 -1
  48. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  49. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +43 -1
  50. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/_CodeSignature/CodeResources +28 -28
  51. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  52. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8472 -8373
  53. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +8110 -8017
  54. package/platforms/windows/arm64/NativeScript.Mason.dll +0 -0
  55. package/platforms/windows/arm64/NativeScript.Mason.winmd +0 -0
  56. package/platforms/windows/x64/NativeScript.Mason.dll +0 -0
  57. package/platforms/windows/x64/NativeScript.Mason.winmd +0 -0
  58. package/properties.d.ts +4 -0
  59. package/properties.js +58 -15
  60. package/properties.js.map +1 -1
  61. package/style.d.ts +38 -37
  62. package/style.js +333 -110
  63. package/style.js.map +1 -1
  64. package/text/index.android.d.ts +3 -1
  65. package/text/index.ios.d.ts +3 -1
  66. package/text/index.windows.d.ts +2 -1
  67. package/textarea/index.android.d.ts +6 -2
  68. package/textarea/index.ios.d.ts +6 -2
  69. package/textarea/index.windows.d.ts +6 -2
  70. package/tree/index.android.js +8 -4
  71. package/tree/index.android.js.map +1 -1
  72. package/tree/index.ios.js +11 -0
  73. package/tree/index.ios.js.map +1 -1
  74. package/utils/index.android.d.ts +15 -6
  75. package/utils/index.android.js +83 -2
  76. package/utils/index.android.js.map +1 -1
  77. package/utils/index.ios.d.ts +15 -6
  78. package/utils/index.ios.js +83 -2
  79. package/utils/index.ios.js.map +1 -1
  80. package/utils/index.windows.d.ts +11 -2
  81. package/utils/index.windows.js +9 -0
  82. package/utils/index.windows.js.map +1 -1
  83. package/view/index.ios.js +14 -1
  84. package/view/index.ios.js.map +1 -1
  85. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Headers/Mason-Swift.h +0 -1982
  86. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Headers/Mason.h +0 -25
  87. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Headers/mason_native.h +0 -499
  88. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Info.plist +0 -0
  89. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Mason +0 -0
  90. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-xros.swiftsourceinfo +0 -0
  91. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.abi.json +0 -98937
  92. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.private.swiftinterface +0 -3475
  93. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.swiftdoc +0 -0
  94. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.swiftinterface +0 -3475
  95. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/module.modulemap +0 -10
  96. package/platforms/ios/Mason.xcframework/xros-arm64/dSYMs/Mason.framework.dSYM/Contents/Info.plist +0 -20
  97. package/platforms/ios/Mason.xcframework/xros-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  98. package/platforms/ios/Mason.xcframework/xros-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +0 -2134
  99. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Headers/Mason-Swift.h +0 -1982
  100. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Headers/Mason.h +0 -25
  101. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Headers/mason_native.h +0 -499
  102. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Info.plist +0 -0
  103. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Mason +0 -0
  104. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-xros-simulator.swiftsourceinfo +0 -0
  105. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.abi.json +0 -98937
  106. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.private.swiftinterface +0 -3475
  107. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.swiftdoc +0 -0
  108. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.swiftinterface +0 -3475
  109. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/module.modulemap +0 -10
  110. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/_CodeSignature/CodeResources +0 -212
  111. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/dSYMs/Mason.framework.dSYM/Contents/Info.plist +0 -20
  112. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  113. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +0 -2134
package/style.js CHANGED
@@ -256,7 +256,7 @@ function windowsSetGrid(nativeView, field, value) {
256
256
  }
257
257
  catch (_) { }
258
258
  }
259
- function parseLengthPercentageAuto(type, value) {
259
+ function parseDimension(type, value) {
260
260
  switch (type) {
261
261
  case 0:
262
262
  return 'auto';
@@ -264,7 +264,78 @@ function parseLengthPercentageAuto(type, value) {
264
264
  return { value, unit: 'px' };
265
265
  case 2:
266
266
  return { value, unit: '%' };
267
+ case 3:
268
+ return 'min-content';
269
+ case 4:
270
+ return 'max-content';
271
+ case 5:
272
+ return 'fit-content';
273
+ case 6:
274
+ return `fit-content(${value}px)`;
275
+ case 7:
276
+ return `fit-content(${value}%)`;
277
+ case 8:
278
+ return 'stretch';
279
+ case 9:
280
+ return 'content';
281
+ }
282
+ }
283
+ function parseLengthPercentageAuto(type, value) {
284
+ return parseDimension(type, value);
285
+ }
286
+ function dimensionFromString(value) {
287
+ const t = value.trim();
288
+ if (t === '' || t === 'auto') {
289
+ return { type: 0, value: 0 };
290
+ }
291
+ switch (t) {
292
+ case 'min-content':
293
+ return { type: 3, value: 0 };
294
+ case 'max-content':
295
+ return { type: 4, value: 0 };
296
+ case 'fit-content':
297
+ return { type: 5, value: 0 };
298
+ case 'stretch':
299
+ return { type: 8, value: 0 };
300
+ case 'content':
301
+ return { type: 9, value: 0 };
302
+ }
303
+ if (t.startsWith('fit-content(') && t.endsWith(')')) {
304
+ const limit = t.slice('fit-content('.length, -1).trim();
305
+ if (limit.endsWith('%')) {
306
+ // taffy percentages are a [0.0, 1.0] fraction, not [0.0, 100.0]
307
+ return { type: 7, value: (parseFloat(limit) || 0) / 100 };
308
+ }
309
+ const n = parseFloat(limit) || 0;
310
+ return { type: 6, value: limit.endsWith('px') ? n : layout.toDevicePixels(n) };
311
+ }
312
+ if (t.endsWith('%')) {
313
+ // percentages are stored as a [0.0, 1.0] fraction, not percentage points
314
+ return { type: 2, value: (parseFloat(t) || 0) / 100 };
315
+ }
316
+ const n = parseFloat(t) || 0;
317
+ return { type: 1, value: t.endsWith('px') ? n : layout.toDevicePixels(n) };
318
+ }
319
+ // Shared parser for LengthPercentageAuto props (min/max width/height, margin, inset)
320
+ function lengthPercentageAutoFromString(value) {
321
+ const t = value.trim();
322
+ if (t === '' || t === 'auto') {
323
+ return { type: 0, value: 0 };
267
324
  }
325
+ if (t.endsWith('%')) {
326
+ return { type: 2, value: (parseFloat(t) || 0) / 100 };
327
+ }
328
+ const n = parseFloat(t) || 0;
329
+ return { type: 1, value: t.endsWith('px') ? n : layout.toDevicePixels(n) };
330
+ }
331
+ // Same as lengthPercentageAutoFromString but for padding (no "auto", type 0/1 swapped)
332
+ function lengthPercentageFromString(value) {
333
+ const t = value.trim();
334
+ if (t.endsWith('%')) {
335
+ return { type: 1, value: (parseFloat(t) || 0) / 100 };
336
+ }
337
+ const n = parseFloat(t) || 0;
338
+ return { type: 0, value: t.endsWith('px') ? n : layout.toDevicePixels(n) };
268
339
  }
269
340
  function parseLengthPercentage(type, value) {
270
341
  switch (type) {
@@ -403,6 +474,25 @@ const splitBigIntToInt64Parts = (value) => {
403
474
  }
404
475
  return [lowSigned.toString(), HIGH.toString()];
405
476
  };
477
+ // Android-only fast path for syncStyle(): splits the 128-bit dirty mask into
478
+ // four signed 32-bit words instead of two 64-bit decimal strings. Plain JS
479
+ // `number` <-> Java `int` marshalling is a completely standard, unambiguous
480
+ // {N} bridge path; encoding as decimal strings instead forced the receiving
481
+ // side (Element.syncStyle(String,String)) through Long.parseUnsignedLong with
482
+ // a BigInteger fallback on every single style write. Recombined bit-exactly
483
+ // on the Kotlin side via (high32 << 32) | (low32 & 0xffffffff) - see
484
+ // Element.syncStyleParts.
485
+ const splitBigIntToInt32Parts = (value) => {
486
+ const MASK64 = (1n << 64n) - 1n;
487
+ const MASK32 = 0xffffffffn;
488
+ const LOW = value & MASK64;
489
+ const HIGH = (value >> 64n) & MASK64;
490
+ const lowLow32 = Number(BigInt.asIntN(32, LOW & MASK32));
491
+ const lowHigh32 = Number(BigInt.asIntN(32, (LOW >> 32n) & MASK32));
492
+ const highLow32 = Number(BigInt.asIntN(32, HIGH & MASK32));
493
+ const highHigh32 = Number(BigInt.asIntN(32, (HIGH >> 32n) & MASK32));
494
+ return [lowLow32, lowHigh32, highLow32, highHigh32];
495
+ };
406
496
  const getInt16 = (view, offset) => {
407
497
  return view.getInt16(offset, true);
408
498
  };
@@ -690,19 +780,20 @@ function borderStyleToEnum(value) {
690
780
  function borderStyleFromEnum(value) {
691
781
  return BORDER_STYLE_VALUES[value] ?? 'none';
692
782
  }
783
+ // hoisted so it's not rebuilt on every parseObjectPosition call
784
+ const OBJECT_POSITION_KEYWORDS = {
785
+ left: { type: 1, val: 0 },
786
+ center: { type: 1, val: 50 },
787
+ right: { type: 1, val: 100 },
788
+ top: { type: 1, val: 0 },
789
+ bottom: { type: 1, val: 100 },
790
+ };
693
791
  function parseObjectPosition(value) {
694
- const keywords = {
695
- left: { type: 1, val: 0 },
696
- center: { type: 1, val: 50 },
697
- right: { type: 1, val: 100 },
698
- top: { type: 1, val: 0 },
699
- bottom: { type: 1, val: 100 },
700
- };
701
792
  const parts = value.trim().split(/\s+/);
702
793
  if (parts.length === 0)
703
794
  return null;
704
795
  function parseComponent(s) {
705
- const kw = keywords[s];
796
+ const kw = OBJECT_POSITION_KEYWORDS[s];
706
797
  if (kw)
707
798
  return kw;
708
799
  if (s.endsWith('%'))
@@ -745,11 +836,12 @@ function fontStretchToValue(value) {
745
836
  }
746
837
  return -1;
747
838
  }
839
+ // built once instead of scanning FONT_STRETCH_KEYWORDS on every getter read
840
+ const FONT_STRETCH_REVERSE = new Map(Object.entries(FONT_STRETCH_KEYWORDS).map(([kw, val]) => [val, kw]));
748
841
  function fontStretchFromValue(v) {
749
- for (const [kw, val] of Object.entries(FONT_STRETCH_KEYWORDS)) {
750
- if (val === v)
751
- return kw;
752
- }
842
+ const kw = FONT_STRETCH_REVERSE.get(v);
843
+ if (kw !== undefined)
844
+ return kw;
753
845
  return `${v / 100}%`;
754
846
  }
755
847
  export class Style {
@@ -891,6 +983,15 @@ export class Style {
891
983
  this.setOrAppendState(value);
892
984
  }
893
985
  }
986
+ coerceCssStringValue(value) {
987
+ if (typeof value === 'string') {
988
+ return value;
989
+ }
990
+ if (value == null) {
991
+ return '';
992
+ }
993
+ return String(value);
994
+ }
894
995
  setPseudoCssStringValue(name, value, applyAndroid, applyApple) {
895
996
  if (!this.nativeView) {
896
997
  return;
@@ -1050,19 +1151,22 @@ export class Style {
1050
1151
  this.isDirty = -1n;
1051
1152
  }
1052
1153
  syncStyle() {
1053
- const [low, high] = splitBigIntToInt64Parts(this.isDirty);
1054
1154
  if (__ANDROID__) {
1155
+ const [lowLow, lowHigh, highLow, highHigh] = splitBigIntToInt32Parts(this.isDirty);
1055
1156
  //@ts-ignore
1056
1157
  const view = this.view?.android ?? this.view._view;
1057
- view.syncStyle(low, high);
1158
+ // @ts-ignore - syncStyleParts is a newer native method; typings regenerate from the AAR separately.
1159
+ view.syncStyleParts(lowLow, lowHigh, highLow, highHigh);
1058
1160
  }
1059
1161
  else if (__APPLE__) {
1162
+ const [low, high] = splitBigIntToInt64Parts(this.isDirty);
1060
1163
  //@ts-ignore
1061
1164
  const view = this.view?.ios ?? this.view._view;
1062
1165
  // @ts-ignore
1063
1166
  view.mason_syncStyle(low, high);
1064
1167
  }
1065
1168
  else if (__WINDOWS__) {
1169
+ const [low, high] = splitBigIntToInt64Parts(this.isDirty);
1066
1170
  // @ts-ignore
1067
1171
  const view = this.view?.windows ?? this.view._view;
1068
1172
  view.SyncStyle(low, high);
@@ -1470,7 +1574,8 @@ export class Style {
1470
1574
  else {
1471
1575
  this.isDirty = this.isDirty | StateKeys.DISPLAY_MODE.bits;
1472
1576
  }
1473
- this.commitState(StateKeys.DISPLAY.and(StateKeys.DISPLAY_MODE));
1577
+ // DISPLAY/DISPLAY_MODE are disjoint bits; use .or(), not .and()
1578
+ this.commitState(StateKeys.DISPLAY.or(StateKeys.DISPLAY_MODE));
1474
1579
  }
1475
1580
  }
1476
1581
  get position() {
@@ -1539,6 +1644,10 @@ export class Style {
1539
1644
  return 'wrap';
1540
1645
  case 2:
1541
1646
  return 'wrap-reverse';
1647
+ case 3:
1648
+ return 'balance';
1649
+ case 4:
1650
+ return 'balance-reverse';
1542
1651
  }
1543
1652
  }
1544
1653
  set flexWrap(value) {
@@ -1553,6 +1662,12 @@ export class Style {
1553
1662
  case 'wrap-reverse':
1554
1663
  wrap = 2;
1555
1664
  break;
1665
+ case 'balance':
1666
+ wrap = 3;
1667
+ break;
1668
+ case 'balance-reverse':
1669
+ wrap = 4;
1670
+ break;
1556
1671
  }
1557
1672
  if (wrap != -1) {
1558
1673
  this.prepareMut();
@@ -1571,10 +1686,13 @@ export class Style {
1571
1686
  }
1572
1687
  set minWidth(value) {
1573
1688
  switch (typeof value) {
1574
- case 'string':
1689
+ case 'string': {
1575
1690
  this.prepareMut();
1576
- setInt8(this.style_view, StyleKeys.MIN_WIDTH_TYPE, 0);
1691
+ const dim = lengthPercentageAutoFromString(value);
1692
+ setInt8(this.style_view, StyleKeys.MIN_WIDTH_TYPE, dim.type);
1693
+ setFloat32(this.style_view, StyleKeys.MIN_WIDTH_VALUE, dim.value);
1577
1694
  break;
1695
+ }
1578
1696
  case 'number':
1579
1697
  this.prepareMut();
1580
1698
  setInt8(this.style_view, StyleKeys.MIN_WIDTH_TYPE, 1);
@@ -1609,10 +1727,13 @@ export class Style {
1609
1727
  }
1610
1728
  set minHeight(value) {
1611
1729
  switch (typeof value) {
1612
- case 'string':
1730
+ case 'string': {
1613
1731
  this.prepareMut();
1614
- setInt8(this.style_view, StyleKeys.MIN_HEIGHT_TYPE, 0);
1732
+ const dim = lengthPercentageAutoFromString(value);
1733
+ setInt8(this.style_view, StyleKeys.MIN_HEIGHT_TYPE, dim.type);
1734
+ setFloat32(this.style_view, StyleKeys.MIN_HEIGHT_VALUE, dim.value);
1615
1735
  break;
1736
+ }
1616
1737
  case 'number':
1617
1738
  this.prepareMut();
1618
1739
  setInt8(this.style_view, StyleKeys.MIN_HEIGHT_TYPE, 1);
@@ -1643,29 +1764,15 @@ export class Style {
1643
1764
  get width() {
1644
1765
  const type = getInt8(this.style_view, StyleKeys.WIDTH_TYPE);
1645
1766
  const value = getFloat32(this.style_view, StyleKeys.WIDTH_VALUE);
1646
- return parseLengthPercentageAuto(type, value);
1767
+ return parseDimension(type, value);
1647
1768
  }
1648
1769
  set width(value) {
1649
1770
  switch (typeof value) {
1650
1771
  case 'string': {
1651
- // Parse the string instead of forcing `auto`. Reactively-applied sizes arrive as strings
1652
- // ("48", "48px", "50%") — the old stub dropped them to auto (0), so dynamically-added boxes
1653
- // rendered 0x0. unitless/dip → device pixels; px → as-is; % → percent.
1654
1772
  this.prepareMut();
1655
- const t = value.trim();
1656
- if (t === '' || t === 'auto') {
1657
- setInt8(this.style_view, StyleKeys.WIDTH_TYPE, 0);
1658
- setFloat32(this.style_view, StyleKeys.WIDTH_VALUE, 0);
1659
- }
1660
- else if (t.endsWith('%')) {
1661
- setInt8(this.style_view, StyleKeys.WIDTH_TYPE, 2);
1662
- setFloat32(this.style_view, StyleKeys.WIDTH_VALUE, parseFloat(t) || 0);
1663
- }
1664
- else {
1665
- const n = parseFloat(t) || 0;
1666
- setInt8(this.style_view, StyleKeys.WIDTH_TYPE, 1);
1667
- setFloat32(this.style_view, StyleKeys.WIDTH_VALUE, t.endsWith('px') ? n : layout.toDevicePixels(n));
1668
- }
1773
+ const dim = dimensionFromString(value);
1774
+ setInt8(this.style_view, StyleKeys.WIDTH_TYPE, dim.type);
1775
+ setFloat32(this.style_view, StyleKeys.WIDTH_VALUE, dim.value);
1669
1776
  break;
1670
1777
  }
1671
1778
  case 'number':
@@ -1698,27 +1805,15 @@ export class Style {
1698
1805
  get height() {
1699
1806
  const type = getInt8(this.style_view, StyleKeys.HEIGHT_TYPE);
1700
1807
  const value = getFloat32(this.style_view, StyleKeys.HEIGHT_VALUE);
1701
- return parseLengthPercentageAuto(type, value);
1808
+ return parseDimension(type, value);
1702
1809
  }
1703
1810
  set height(value) {
1704
1811
  switch (typeof value) {
1705
1812
  case 'string': {
1706
- // Parse the string (see width setter) — the old stub forced auto/0, breaking string sizes.
1707
1813
  this.prepareMut();
1708
- const t = value.trim();
1709
- if (t === '' || t === 'auto') {
1710
- setInt8(this.style_view, StyleKeys.HEIGHT_TYPE, 0);
1711
- setFloat32(this.style_view, StyleKeys.HEIGHT_VALUE, 0);
1712
- }
1713
- else if (t.endsWith('%')) {
1714
- setInt8(this.style_view, StyleKeys.HEIGHT_TYPE, 2);
1715
- setFloat32(this.style_view, StyleKeys.HEIGHT_VALUE, parseFloat(t) || 0);
1716
- }
1717
- else {
1718
- const n = parseFloat(t) || 0;
1719
- setInt8(this.style_view, StyleKeys.HEIGHT_TYPE, 1);
1720
- setFloat32(this.style_view, StyleKeys.HEIGHT_VALUE, t.endsWith('px') ? n : layout.toDevicePixels(n));
1721
- }
1814
+ const dim = dimensionFromString(value);
1815
+ setInt8(this.style_view, StyleKeys.HEIGHT_TYPE, dim.type);
1816
+ setFloat32(this.style_view, StyleKeys.HEIGHT_VALUE, dim.value);
1722
1817
  break;
1723
1818
  }
1724
1819
  case 'number':
@@ -1755,10 +1850,13 @@ export class Style {
1755
1850
  }
1756
1851
  set maxWidth(value) {
1757
1852
  switch (typeof value) {
1758
- case 'string':
1853
+ case 'string': {
1759
1854
  this.prepareMut();
1760
- setInt8(this.style_view, StyleKeys.MAX_WIDTH_TYPE, 0);
1855
+ const dim = lengthPercentageAutoFromString(value);
1856
+ setInt8(this.style_view, StyleKeys.MAX_WIDTH_TYPE, dim.type);
1857
+ setFloat32(this.style_view, StyleKeys.MAX_WIDTH_VALUE, dim.value);
1761
1858
  break;
1859
+ }
1762
1860
  case 'number':
1763
1861
  this.prepareMut();
1764
1862
  setInt8(this.style_view, StyleKeys.MAX_WIDTH_TYPE, 1);
@@ -1793,10 +1891,13 @@ export class Style {
1793
1891
  }
1794
1892
  set maxHeight(value) {
1795
1893
  switch (typeof value) {
1796
- case 'string':
1894
+ case 'string': {
1797
1895
  this.prepareMut();
1798
- setInt8(this.style_view, StyleKeys.MAX_HEIGHT_TYPE, 0);
1896
+ const dim = lengthPercentageAutoFromString(value);
1897
+ setInt8(this.style_view, StyleKeys.MAX_HEIGHT_TYPE, dim.type);
1898
+ setFloat32(this.style_view, StyleKeys.MAX_HEIGHT_VALUE, dim.value);
1799
1899
  break;
1900
+ }
1800
1901
  case 'number':
1801
1902
  this.prepareMut();
1802
1903
  setInt8(this.style_view, StyleKeys.MAX_HEIGHT_TYPE, 1);
@@ -1964,10 +2065,12 @@ export class Style {
1964
2065
  var type;
1965
2066
  var insetValue;
1966
2067
  switch (typeof value) {
1967
- case 'string':
1968
- type = 0;
1969
- insetValue = 0;
2068
+ case 'string': {
2069
+ const dim = lengthPercentageAutoFromString(value);
2070
+ type = dim.type;
2071
+ insetValue = dim.value;
1970
2072
  break;
2073
+ }
1971
2074
  case 'number':
1972
2075
  type = 1;
1973
2076
  insetValue = layout.toDevicePixels(value);
@@ -2004,13 +2107,14 @@ export class Style {
2004
2107
  return parseLengthPercentageAuto(type, value);
2005
2108
  }
2006
2109
  set left(value) {
2007
- if (value === 'auto') {
2008
- this.prepareMut();
2009
- setInt8(this.style_view, StyleKeys.INSET_LEFT_TYPE, 0);
2010
- setFloat32(this.style_view, StyleKeys.INSET_LEFT_VALUE, 0);
2011
- return;
2012
- }
2013
2110
  switch (typeof value) {
2111
+ case 'string': {
2112
+ this.prepareMut();
2113
+ const dim = lengthPercentageAutoFromString(value);
2114
+ setInt8(this.style_view, StyleKeys.INSET_LEFT_TYPE, dim.type);
2115
+ setFloat32(this.style_view, StyleKeys.INSET_LEFT_VALUE, dim.value);
2116
+ break;
2117
+ }
2014
2118
  case 'number':
2015
2119
  this.prepareMut();
2016
2120
  setInt8(this.style_view, StyleKeys.INSET_LEFT_TYPE, 1);
@@ -2044,13 +2148,14 @@ export class Style {
2044
2148
  return parseLengthPercentageAuto(type, value);
2045
2149
  }
2046
2150
  set right(value) {
2047
- if (value === 'auto') {
2048
- this.prepareMut();
2049
- setInt8(this.style_view, StyleKeys.INSET_RIGHT_TYPE, 0);
2050
- setFloat32(this.style_view, StyleKeys.INSET_RIGHT_VALUE, 0);
2051
- return;
2052
- }
2053
2151
  switch (typeof value) {
2152
+ case 'string': {
2153
+ this.prepareMut();
2154
+ const dim = lengthPercentageAutoFromString(value);
2155
+ setInt8(this.style_view, StyleKeys.INSET_RIGHT_TYPE, dim.type);
2156
+ setFloat32(this.style_view, StyleKeys.INSET_RIGHT_VALUE, dim.value);
2157
+ break;
2158
+ }
2054
2159
  case 'number':
2055
2160
  this.prepareMut();
2056
2161
  setInt8(this.style_view, StyleKeys.INSET_RIGHT_TYPE, 1);
@@ -2084,13 +2189,14 @@ export class Style {
2084
2189
  return parseLengthPercentageAuto(type, value);
2085
2190
  }
2086
2191
  set top(value) {
2087
- if (value === 'auto') {
2088
- this.prepareMut();
2089
- setInt8(this.style_view, StyleKeys.INSET_TOP_TYPE, 0);
2090
- setFloat32(this.style_view, StyleKeys.INSET_TOP_VALUE, 0);
2091
- return;
2092
- }
2093
2192
  switch (typeof value) {
2193
+ case 'string': {
2194
+ this.prepareMut();
2195
+ const dim = lengthPercentageAutoFromString(value);
2196
+ setInt8(this.style_view, StyleKeys.INSET_TOP_TYPE, dim.type);
2197
+ setFloat32(this.style_view, StyleKeys.INSET_TOP_VALUE, dim.value);
2198
+ break;
2199
+ }
2094
2200
  case 'number':
2095
2201
  this.prepareMut();
2096
2202
  setInt8(this.style_view, StyleKeys.INSET_TOP_TYPE, 1);
@@ -2124,13 +2230,14 @@ export class Style {
2124
2230
  return parseLengthPercentageAuto(type, value);
2125
2231
  }
2126
2232
  set bottom(value) {
2127
- if (value === 'auto') {
2128
- this.prepareMut();
2129
- setInt8(this.style_view, StyleKeys.INSET_BOTTOM_TYPE, 0);
2130
- setFloat32(this.style_view, StyleKeys.INSET_BOTTOM_VALUE, 0);
2131
- return;
2132
- }
2133
2233
  switch (typeof value) {
2234
+ case 'string': {
2235
+ this.prepareMut();
2236
+ const dim = lengthPercentageAutoFromString(value);
2237
+ setInt8(this.style_view, StyleKeys.INSET_BOTTOM_TYPE, dim.type);
2238
+ setFloat32(this.style_view, StyleKeys.INSET_BOTTOM_VALUE, dim.value);
2239
+ break;
2240
+ }
2134
2241
  case 'number':
2135
2242
  this.prepareMut();
2136
2243
  setInt8(this.style_view, StyleKeys.INSET_BOTTOM_TYPE, 1);
@@ -2162,10 +2269,12 @@ export class Style {
2162
2269
  var type;
2163
2270
  var marginValue;
2164
2271
  switch (typeof value) {
2165
- case 'string':
2166
- type = 0;
2167
- marginValue = 0;
2272
+ case 'string': {
2273
+ const dim = lengthPercentageAutoFromString(value);
2274
+ type = dim.type;
2275
+ marginValue = dim.value;
2168
2276
  break;
2277
+ }
2169
2278
  case 'number':
2170
2279
  type = 1;
2171
2280
  marginValue = layout.toDevicePixels(value);
@@ -2203,10 +2312,13 @@ export class Style {
2203
2312
  }
2204
2313
  set marginLeft(value) {
2205
2314
  switch (typeof value) {
2206
- case 'string':
2315
+ case 'string': {
2207
2316
  this.prepareMut();
2208
- setInt8(this.style_view, StyleKeys.MARGIN_LEFT_TYPE, 0);
2317
+ const dim = lengthPercentageAutoFromString(value);
2318
+ setInt8(this.style_view, StyleKeys.MARGIN_LEFT_TYPE, dim.type);
2319
+ setFloat32(this.style_view, StyleKeys.MARGIN_LEFT_VALUE, dim.value);
2209
2320
  break;
2321
+ }
2210
2322
  case 'number':
2211
2323
  this.prepareMut();
2212
2324
  setInt8(this.style_view, StyleKeys.MARGIN_LEFT_TYPE, 1);
@@ -2241,10 +2353,13 @@ export class Style {
2241
2353
  }
2242
2354
  set marginRight(value) {
2243
2355
  switch (typeof value) {
2244
- case 'string':
2356
+ case 'string': {
2245
2357
  this.prepareMut();
2246
- setInt8(this.style_view, StyleKeys.MARGIN_RIGHT_TYPE, 0);
2358
+ const dim = lengthPercentageAutoFromString(value);
2359
+ setInt8(this.style_view, StyleKeys.MARGIN_RIGHT_TYPE, dim.type);
2360
+ setFloat32(this.style_view, StyleKeys.MARGIN_RIGHT_VALUE, dim.value);
2247
2361
  break;
2362
+ }
2248
2363
  case 'number':
2249
2364
  this.prepareMut();
2250
2365
  setInt8(this.style_view, StyleKeys.MARGIN_RIGHT_TYPE, 1);
@@ -2279,10 +2394,13 @@ export class Style {
2279
2394
  }
2280
2395
  set marginTop(value) {
2281
2396
  switch (typeof value) {
2282
- case 'string':
2397
+ case 'string': {
2283
2398
  this.prepareMut();
2284
- setInt8(this.style_view, StyleKeys.MARGIN_TOP_TYPE, 0);
2399
+ const dim = lengthPercentageAutoFromString(value);
2400
+ setInt8(this.style_view, StyleKeys.MARGIN_TOP_TYPE, dim.type);
2401
+ setFloat32(this.style_view, StyleKeys.MARGIN_TOP_VALUE, dim.value);
2285
2402
  break;
2403
+ }
2286
2404
  case 'number':
2287
2405
  this.prepareMut();
2288
2406
  setInt8(this.style_view, StyleKeys.MARGIN_TOP_TYPE, 1);
@@ -2317,10 +2435,13 @@ export class Style {
2317
2435
  }
2318
2436
  set marginBottom(value) {
2319
2437
  switch (typeof value) {
2320
- case 'string':
2438
+ case 'string': {
2321
2439
  this.prepareMut();
2322
- setInt8(this.style_view, StyleKeys.MARGIN_BOTTOM_TYPE, 0);
2440
+ const dim = lengthPercentageAutoFromString(value);
2441
+ setInt8(this.style_view, StyleKeys.MARGIN_BOTTOM_TYPE, dim.type);
2442
+ setFloat32(this.style_view, StyleKeys.MARGIN_BOTTOM_VALUE, dim.value);
2323
2443
  break;
2444
+ }
2324
2445
  case 'number':
2325
2446
  this.prepareMut();
2326
2447
  setInt8(this.style_view, StyleKeys.MARGIN_BOTTOM_TYPE, 1);
@@ -2361,6 +2482,13 @@ export class Style {
2361
2482
  }
2362
2483
  set paddingLeft(value) {
2363
2484
  switch (typeof value) {
2485
+ case 'string': {
2486
+ this.prepareMut();
2487
+ const dim = lengthPercentageFromString(value);
2488
+ setInt8(this.style_view, StyleKeys.PADDING_LEFT_TYPE, dim.type);
2489
+ setFloat32(this.style_view, StyleKeys.PADDING_LEFT_VALUE, dim.value);
2490
+ break;
2491
+ }
2364
2492
  case 'number':
2365
2493
  this.prepareMut();
2366
2494
  setInt8(this.style_view, StyleKeys.PADDING_LEFT_TYPE, 0);
@@ -2395,6 +2523,13 @@ export class Style {
2395
2523
  }
2396
2524
  set paddingRight(value) {
2397
2525
  switch (typeof value) {
2526
+ case 'string': {
2527
+ this.prepareMut();
2528
+ const dim = lengthPercentageFromString(value);
2529
+ setInt8(this.style_view, StyleKeys.PADDING_RIGHT_TYPE, dim.type);
2530
+ setFloat32(this.style_view, StyleKeys.PADDING_RIGHT_VALUE, dim.value);
2531
+ break;
2532
+ }
2398
2533
  case 'number':
2399
2534
  this.prepareMut();
2400
2535
  setInt8(this.style_view, StyleKeys.PADDING_RIGHT_TYPE, 0);
@@ -2429,6 +2564,13 @@ export class Style {
2429
2564
  }
2430
2565
  set paddingTop(value) {
2431
2566
  switch (typeof value) {
2567
+ case 'string': {
2568
+ this.prepareMut();
2569
+ const dim = lengthPercentageFromString(value);
2570
+ setInt8(this.style_view, StyleKeys.PADDING_TOP_TYPE, dim.type);
2571
+ setFloat32(this.style_view, StyleKeys.PADDING_TOP_VALUE, dim.value);
2572
+ break;
2573
+ }
2432
2574
  case 'number':
2433
2575
  this.prepareMut();
2434
2576
  setInt8(this.style_view, StyleKeys.PADDING_TOP_TYPE, 0);
@@ -2463,6 +2605,13 @@ export class Style {
2463
2605
  }
2464
2606
  set paddingBottom(value) {
2465
2607
  switch (typeof value) {
2608
+ case 'string': {
2609
+ this.prepareMut();
2610
+ const dim = lengthPercentageFromString(value);
2611
+ setInt8(this.style_view, StyleKeys.PADDING_BOTTOM_TYPE, dim.type);
2612
+ setFloat32(this.style_view, StyleKeys.PADDING_BOTTOM_VALUE, dim.value);
2613
+ break;
2614
+ }
2466
2615
  case 'number':
2467
2616
  this.prepareMut();
2468
2617
  setInt8(this.style_view, StyleKeys.PADDING_BOTTOM_TYPE, 0);
@@ -2594,6 +2743,8 @@ export class Style {
2594
2743
  return getFloat32(this.style_view, StyleKeys.ASPECT_RATIO);
2595
2744
  }
2596
2745
  set aspectRatio(value) {
2746
+ if (getFloat32(this.style_view, StyleKeys.ASPECT_RATIO) === value)
2747
+ return;
2597
2748
  this.prepareMut();
2598
2749
  setFloat32(this.style_view, StyleKeys.ASPECT_RATIO, value);
2599
2750
  this.commitState(StateKeys.ASPECT_RATIO);
@@ -2601,14 +2752,17 @@ export class Style {
2601
2752
  get flexBasis() {
2602
2753
  const type = getInt8(this.style_view, StyleKeys.FLEX_BASIS_TYPE);
2603
2754
  const value = getFloat32(this.style_view, StyleKeys.FLEX_BASIS_VALUE);
2604
- return parseLengthPercentageAuto(type, value);
2755
+ return parseDimension(type, value);
2605
2756
  }
2606
2757
  set flexBasis(value) {
2607
2758
  switch (typeof value) {
2608
- case 'string':
2759
+ case 'string': {
2609
2760
  this.prepareMut();
2610
- setInt8(this.style_view, StyleKeys.FLEX_BASIS_TYPE, 0);
2761
+ const dim = dimensionFromString(value);
2762
+ setInt8(this.style_view, StyleKeys.FLEX_BASIS_TYPE, dim.type);
2763
+ setFloat32(this.style_view, StyleKeys.FLEX_BASIS_VALUE, dim.value);
2611
2764
  break;
2765
+ }
2612
2766
  case 'number':
2613
2767
  this.prepareMut();
2614
2768
  setInt8(this.style_view, StyleKeys.FLEX_BASIS_TYPE, 1);
@@ -2762,8 +2916,13 @@ export class Style {
2762
2916
  return 'start';
2763
2917
  case 3 /* AlignContent.Stretch */:
2764
2918
  return 'stretch';
2919
+ case 7 /* AlignContent.FlexStart */:
2920
+ return 'flex-start';
2921
+ case 8 /* AlignContent.FlexEnd */:
2922
+ return 'flex-end';
2765
2923
  }
2766
2924
  }
2925
+ // 'flex-start'/'flex-end' were missing from this switch entirely
2767
2926
  set alignContent(value) {
2768
2927
  let align = -1;
2769
2928
  switch (value) {
@@ -2791,6 +2950,12 @@ export class Style {
2791
2950
  case 'stretch':
2792
2951
  align = 3 /* AlignContent.Stretch */;
2793
2952
  break;
2953
+ case 'flex-start':
2954
+ align = 7 /* AlignContent.FlexStart */;
2955
+ break;
2956
+ case 'flex-end':
2957
+ align = 8 /* AlignContent.FlexEnd */;
2958
+ break;
2794
2959
  }
2795
2960
  if (align !== -1) {
2796
2961
  this.prepareMut();
@@ -2957,6 +3122,12 @@ export class Style {
2957
3122
  case 'stretch':
2958
3123
  v = 3 /* JustifyContent.Stretch */;
2959
3124
  break;
3125
+ case 'flex-start':
3126
+ v = 7 /* JustifyContent.FlexStart */;
3127
+ break;
3128
+ case 'flex-end':
3129
+ v = 8 /* JustifyContent.FlexEnd */;
3130
+ break;
2960
3131
  }
2961
3132
  if (v !== -1) {
2962
3133
  this.prepareMut();
@@ -2980,6 +3151,8 @@ export class Style {
2980
3151
  if (!this.nativeView) {
2981
3152
  return;
2982
3153
  }
3154
+ // A bare number can't marshal over JNI into the native String setter.
3155
+ value = value == null ? '' : String(value);
2983
3156
  if (__ANDROID__) {
2984
3157
  org.nativescript.mason.masonkit.NodeHelper.getShared().setGridAutoRows(this.nativeView, value);
2985
3158
  }
@@ -3006,6 +3179,8 @@ export class Style {
3006
3179
  if (!this.nativeView) {
3007
3180
  return;
3008
3181
  }
3182
+ // See gridAutoRows above.
3183
+ value = value == null ? '' : String(value);
3009
3184
  if (__ANDROID__) {
3010
3185
  org.nativescript.mason.masonkit.NodeHelper.getShared().setGridAutoColumns(this.nativeView, value);
3011
3186
  }
@@ -3052,6 +3227,8 @@ export class Style {
3052
3227
  if (!this.nativeView) {
3053
3228
  return;
3054
3229
  }
3230
+ // See gridAutoRows above.
3231
+ value = value == null ? '' : String(value);
3055
3232
  if (__ANDROID__) {
3056
3233
  org.nativescript.mason.masonkit.NodeHelper.getShared().setGridColumn(this.nativeView, value);
3057
3234
  }
@@ -3090,6 +3267,8 @@ export class Style {
3090
3267
  if (!this.nativeView) {
3091
3268
  return;
3092
3269
  }
3270
+ // See gridAutoRows above.
3271
+ value = value == null ? '' : String(value);
3093
3272
  if (__ANDROID__) {
3094
3273
  org.nativescript.mason.masonkit.NodeHelper.getShared().setGridColumnStart(this.nativeView, value);
3095
3274
  }
@@ -3116,6 +3295,8 @@ export class Style {
3116
3295
  if (!this.nativeView) {
3117
3296
  return;
3118
3297
  }
3298
+ // See gridAutoRows above.
3299
+ value = value == null ? '' : String(value);
3119
3300
  if (__ANDROID__) {
3120
3301
  org.nativescript.mason.masonkit.NodeHelper.getShared().setGridColumnEnd(this.nativeView, value);
3121
3302
  }
@@ -3130,6 +3311,8 @@ export class Style {
3130
3311
  if (!this.nativeView) {
3131
3312
  return;
3132
3313
  }
3314
+ // See gridAutoRows above.
3315
+ value = value == null ? '' : String(value);
3133
3316
  if (__ANDROID__) {
3134
3317
  org.nativescript.mason.masonkit.NodeHelper.getShared().setGridRow(this.nativeView, value);
3135
3318
  }
@@ -3168,6 +3351,8 @@ export class Style {
3168
3351
  if (!this.nativeView) {
3169
3352
  return;
3170
3353
  }
3354
+ // See gridAutoRows above.
3355
+ value = value == null ? '' : String(value);
3171
3356
  if (__ANDROID__) {
3172
3357
  org.nativescript.mason.masonkit.NodeHelper.getShared().setGridRowStart(this.nativeView, value);
3173
3358
  }
@@ -3194,6 +3379,8 @@ export class Style {
3194
3379
  if (!this.nativeView) {
3195
3380
  return;
3196
3381
  }
3382
+ // See gridAutoRows above.
3383
+ value = value == null ? '' : String(value);
3197
3384
  if (__ANDROID__) {
3198
3385
  org.nativescript.mason.masonkit.NodeHelper.getShared().setGridRowEnd(this.nativeView, value);
3199
3386
  }
@@ -3208,6 +3395,8 @@ export class Style {
3208
3395
  if (!this.nativeView) {
3209
3396
  return;
3210
3397
  }
3398
+ // See gridAutoRows above.
3399
+ value = value == null ? '' : String(value);
3211
3400
  if (__ANDROID__) {
3212
3401
  org.nativescript.mason.masonkit.NodeHelper.getShared().setGridArea(this.nativeView, value);
3213
3402
  }
@@ -3234,9 +3423,8 @@ export class Style {
3234
3423
  if (!this.nativeView) {
3235
3424
  return;
3236
3425
  }
3237
- // Reset (e.g. a media query toggling grid-rows off) passes null; the native
3238
- // setters are non-null, so coerce to '' which clears the template.
3239
- value = value ?? '';
3426
+ // null clears the template; also guards against a bare number (see gridAutoRows above).
3427
+ value = value == null ? '' : String(value);
3240
3428
  if (__ANDROID__) {
3241
3429
  org.nativescript.mason.masonkit.NodeHelper.getShared().setGridTemplateRows(this.nativeView, value);
3242
3430
  }
@@ -3275,9 +3463,8 @@ export class Style {
3275
3463
  if (!this.nativeView) {
3276
3464
  return;
3277
3465
  }
3278
- // Reset (e.g. a media query toggling grid-cols off) passes null; the native
3279
- // setters are non-null, so coerce to '' which clears the template.
3280
- value = value ?? '';
3466
+ // null clears the template; also guards against a bare number (see gridAutoRows above).
3467
+ value = value == null ? '' : String(value);
3281
3468
  if (__ANDROID__) {
3282
3469
  org.nativescript.mason.masonkit.NodeHelper.getShared().setGridTemplateColumns(this.nativeView, value);
3283
3470
  }
@@ -3304,8 +3491,8 @@ export class Style {
3304
3491
  if (!this.nativeView) {
3305
3492
  return;
3306
3493
  }
3307
- // Reset passes null; the native setters are non-null, coerce to '' (clears it).
3308
- value = value ?? '';
3494
+ // null clears it; also guards against a bare number (see gridAutoRows above).
3495
+ value = value == null ? '' : String(value);
3309
3496
  if (__ANDROID__) {
3310
3497
  org.nativescript.mason.masonkit.NodeHelper.getShared().setGridTemplateAreas(this.nativeView, value);
3311
3498
  }
@@ -3395,6 +3582,9 @@ export class Style {
3395
3582
  return getFloat32(this.style_view, StyleKeys.FLEX_GROW);
3396
3583
  }
3397
3584
  set flexGrow(value) {
3585
+ // skip invalidation on a no-op re-apply of the same value
3586
+ if (getFloat32(this.style_view, StyleKeys.FLEX_GROW) === value)
3587
+ return;
3398
3588
  this.prepareMut();
3399
3589
  setFloat32(this.style_view, StyleKeys.FLEX_GROW, value);
3400
3590
  this.commitState(StateKeys.FLEX_GROW);
@@ -3403,6 +3593,8 @@ export class Style {
3403
3593
  return getFloat32(this.style_view, StyleKeys.FLEX_SHRINK);
3404
3594
  }
3405
3595
  set flexShrink(value) {
3596
+ if (getFloat32(this.style_view, StyleKeys.FLEX_SHRINK) === value)
3597
+ return;
3406
3598
  this.prepareMut();
3407
3599
  setFloat32(this.style_view, StyleKeys.FLEX_SHRINK, value);
3408
3600
  this.commitState(StateKeys.FLEX_SHRINK);
@@ -3645,6 +3837,7 @@ export class Style {
3645
3837
  return '';
3646
3838
  }
3647
3839
  set background(value) {
3840
+ value = this.coerceCssStringValue(value);
3648
3841
  this.setPseudoCssStringValue('background', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setBackground(this.nativeView, value), () => (this.nativeView.style.background = value));
3649
3842
  }
3650
3843
  get backgroundImage() {
@@ -3660,6 +3853,7 @@ export class Style {
3660
3853
  return '';
3661
3854
  }
3662
3855
  set backgroundImage(value) {
3856
+ value = this.coerceCssStringValue(value);
3663
3857
  this.setPseudoCssStringValue('background-image', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setBackgroundImage(this.nativeView, value), () => (this.nativeView.style.backgroundImage = value));
3664
3858
  }
3665
3859
  get backgroundRepeat() {
@@ -3675,6 +3869,7 @@ export class Style {
3675
3869
  return '';
3676
3870
  }
3677
3871
  set backgroundRepeat(value) {
3872
+ value = this.coerceCssStringValue(value);
3678
3873
  this.setPseudoCssStringValue('background-repeat', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setBackgroundRepeat(this.nativeView, value), () => (this.nativeView.style.backgroundRepeat = value));
3679
3874
  }
3680
3875
  get backgroundPosition() {
@@ -3690,6 +3885,7 @@ export class Style {
3690
3885
  return '';
3691
3886
  }
3692
3887
  set backgroundPosition(value) {
3888
+ value = this.coerceCssStringValue(value);
3693
3889
  this.setPseudoCssStringValue('background-position', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setBackgroundPosition(this.nativeView, value), () => (this.nativeView.style.backgroundPosition = value));
3694
3890
  }
3695
3891
  get backgroundSize() {
@@ -3705,6 +3901,7 @@ export class Style {
3705
3901
  return '';
3706
3902
  }
3707
3903
  set backgroundSize(value) {
3904
+ value = this.coerceCssStringValue(value);
3708
3905
  this.setPseudoCssStringValue('background-size', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setBackgroundSize(this.nativeView, value), () => (this.nativeView.style.backgroundSize = value));
3709
3906
  }
3710
3907
  get backgroundClip() {
@@ -3720,6 +3917,7 @@ export class Style {
3720
3917
  return '';
3721
3918
  }
3722
3919
  set backgroundClip(value) {
3920
+ value = this.coerceCssStringValue(value);
3723
3921
  this.setPseudoCssStringValue('background-clip', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setBackgroundClip(this.nativeView, value), () => (this.nativeView.style.backgroundClip = value));
3724
3922
  }
3725
3923
  get borderRadius() {
@@ -3735,9 +3933,11 @@ export class Style {
3735
3933
  return '';
3736
3934
  }
3737
3935
  set borderRadius(value) {
3936
+ value = this.coerceCssStringValue(value);
3738
3937
  this.setPseudoCssStringValue('border-radius', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setBorderRadius(this.nativeView, value), () => (this.nativeView.style.borderRadius = value));
3739
3938
  }
3740
3939
  set textDecoration(value) {
3940
+ value = this.coerceCssStringValue(value);
3741
3941
  this.setPseudoCssStringValue('text-decoration', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setTextDecoration(this.nativeView, value), () => this.nativeView.style.setTextDecoration(value));
3742
3942
  }
3743
3943
  get border() {
@@ -3753,6 +3953,7 @@ export class Style {
3753
3953
  return '';
3754
3954
  }
3755
3955
  set border(value) {
3956
+ value = this.coerceCssStringValue(value);
3756
3957
  this.setPseudoCssStringValue('border', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setBorder(this.nativeView, value), () => (this.nativeView.style.border = value));
3757
3958
  }
3758
3959
  get paddingCss() {
@@ -3767,7 +3968,9 @@ export class Style {
3767
3968
  return '';
3768
3969
  }
3769
3970
  set paddingCss(value) {
3770
- const strValue = typeof value === 'number' ? `${value}px` : value;
3971
+ // a bare number is dip, matching other numeric setters; Android's
3972
+ // native parser treats "px" as unscaled device pixels, "dip" as scaled
3973
+ const strValue = typeof value === 'number' ? `${value}dip` : value;
3771
3974
  this.setPseudoCssStringValue('padding', strValue, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setPaddingCss(this.nativeView, strValue), () => (this.nativeView.style.paddingCss = strValue));
3772
3975
  }
3773
3976
  get marginCss() {
@@ -3782,7 +3985,8 @@ export class Style {
3782
3985
  return '';
3783
3986
  }
3784
3987
  set marginCss(value) {
3785
- const strValue = typeof value === 'number' ? `${value}px` : value;
3988
+ // See the comment on `paddingCss` above — same dip-vs-px mislabeling fix.
3989
+ const strValue = typeof value === 'number' ? `${value}dip` : value;
3786
3990
  this.setPseudoCssStringValue('margin', strValue, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setMarginCss(this.nativeView, strValue), () => (this.nativeView.style.marginCss = strValue));
3787
3991
  }
3788
3992
  get insetCss() {
@@ -3797,31 +4001,36 @@ export class Style {
3797
4001
  return '';
3798
4002
  }
3799
4003
  set insetCss(value) {
3800
- const strValue = typeof value === 'number' ? `${value}px` : value;
4004
+ // See the comment on `paddingCss` above — same dip-vs-px mislabeling fix.
4005
+ const strValue = typeof value === 'number' ? `${value}dip` : value;
3801
4006
  this.setPseudoCssStringValue('inset', strValue, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setInsetCss(this.nativeView, strValue), () => (this.nativeView.style.insetCss = strValue));
3802
4007
  }
3803
4008
  get borderLeft() {
3804
4009
  return '';
3805
4010
  }
3806
4011
  set borderLeft(value) {
4012
+ value = this.coerceCssStringValue(value);
3807
4013
  this.setPseudoCssStringValue('border-left', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setBorderLeft(this.nativeView, value), () => (this.nativeView.style.borderLeft = value));
3808
4014
  }
3809
4015
  get borderTop() {
3810
4016
  return '';
3811
4017
  }
3812
4018
  set borderTop(value) {
4019
+ value = this.coerceCssStringValue(value);
3813
4020
  this.setPseudoCssStringValue('border-top', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setBorderTop(this.nativeView, value), () => (this.nativeView.style.borderTop = value));
3814
4021
  }
3815
4022
  get borderRight() {
3816
4023
  return '';
3817
4024
  }
3818
4025
  set borderRight(value) {
4026
+ value = this.coerceCssStringValue(value);
3819
4027
  this.setPseudoCssStringValue('border-right', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setBorderRight(this.nativeView, value), () => (this.nativeView.style.borderRight = value));
3820
4028
  }
3821
4029
  get borderBottom() {
3822
4030
  return '';
3823
4031
  }
3824
4032
  set borderBottom(value) {
4033
+ value = this.coerceCssStringValue(value);
3825
4034
  this.setPseudoCssStringValue('border-bottom', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setBorderBottom(this.nativeView, value), () => (this.nativeView.style.borderBottom = value));
3826
4035
  }
3827
4036
  get filter() {
@@ -3837,6 +4046,7 @@ export class Style {
3837
4046
  return '';
3838
4047
  }
3839
4048
  set filter(value) {
4049
+ value = this.coerceCssStringValue(value);
3840
4050
  this.setPseudoCssStringValue('filter', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setFilter(this.nativeView, value), () => (this.nativeView.style.filter = value));
3841
4051
  }
3842
4052
  get boxShadow() {
@@ -3858,6 +4068,7 @@ export class Style {
3858
4068
  return this.boxShadow;
3859
4069
  }
3860
4070
  set boxShadow(value) {
4071
+ value = this.coerceCssStringValue(value);
3861
4072
  this.setPseudoCssStringValue('box-shadow', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setBoxShadow(this.nativeView, value), () => (this.nativeView.style.boxShadow = value));
3862
4073
  }
3863
4074
  get transform() {
@@ -3873,6 +4084,7 @@ export class Style {
3873
4084
  return '';
3874
4085
  }
3875
4086
  set transform(value) {
4087
+ value = this.coerceCssStringValue(value);
3876
4088
  this.setPseudoCssStringValue('transform', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setTransform(this.nativeView, value), () => (this.nativeView.style.transform = value));
3877
4089
  }
3878
4090
  get verticalAlign() {
@@ -4036,12 +4248,15 @@ export class Style {
4036
4248
  return '';
4037
4249
  }
4038
4250
  set textShadow(value) {
4251
+ value = this.coerceCssStringValue(value);
4039
4252
  this.setPseudoCssStringValue('text-shadow', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setTextShadow(this.nativeView, value), () => (this.nativeView.style.textShadow = value));
4040
4253
  }
4041
4254
  get zIndex() {
4042
4255
  return getInt32(this.style_view, StyleKeys.Z_INDEX);
4043
4256
  }
4044
4257
  set zIndex(value) {
4258
+ if (getInt32(this.style_view, StyleKeys.Z_INDEX) === value)
4259
+ return;
4045
4260
  this.prepareMut();
4046
4261
  setInt32(this.style_view, StyleKeys.Z_INDEX, value);
4047
4262
  this.commitState(StateKeys.Z_INDEX);
@@ -4115,6 +4330,7 @@ export class Style {
4115
4330
  this.commitState(StateKeys.CLEAR);
4116
4331
  }
4117
4332
  set cornerShape(value) {
4333
+ value = this.coerceCssStringValue(value);
4118
4334
  this.setPseudoCssStringValue('corner-shape', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setCornerShape(this.nativeView, value), () => (this.nativeView.style.cornerShape = value));
4119
4335
  }
4120
4336
  get cornerShape() {
@@ -4141,6 +4357,7 @@ export class Style {
4141
4357
  return '';
4142
4358
  }
4143
4359
  set cornerShapeTopLeft(value) {
4360
+ value = this.coerceCssStringValue(value);
4144
4361
  this.setPseudoCssStringValue('corner-shape-top-left', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setCornerShapeTopLeft(this.nativeView, value), () => (this.nativeView.style.cornerShapeTopLeft = value));
4145
4362
  }
4146
4363
  get cornerShapeTopRight() {
@@ -4155,6 +4372,7 @@ export class Style {
4155
4372
  return '';
4156
4373
  }
4157
4374
  set cornerShapeTopRight(value) {
4375
+ value = this.coerceCssStringValue(value);
4158
4376
  this.setPseudoCssStringValue('corner-shape-top-right', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setCornerShapeTopRight(this.nativeView, value), () => (this.nativeView.style.cornerShapeTopRight = value));
4159
4377
  }
4160
4378
  get cornerShapeBottomRight() {
@@ -4169,6 +4387,7 @@ export class Style {
4169
4387
  return '';
4170
4388
  }
4171
4389
  set cornerShapeBottomRight(value) {
4390
+ value = this.coerceCssStringValue(value);
4172
4391
  this.setPseudoCssStringValue('corner-shape-bottom-right', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setCornerShapeBottomRight(this.nativeView, value), () => (this.nativeView.style.cornerShapeBottomRight = value));
4173
4392
  }
4174
4393
  get cornerShapeBottomLeft() {
@@ -4183,6 +4402,7 @@ export class Style {
4183
4402
  return '';
4184
4403
  }
4185
4404
  set cornerShapeBottomLeft(value) {
4405
+ value = this.coerceCssStringValue(value);
4186
4406
  this.setPseudoCssStringValue('corner-shape-bottom-left', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setCornerShapeBottomLeft(this.nativeView, value), () => (this.nativeView.style.cornerShapeBottomLeft = value));
4187
4407
  }
4188
4408
  get objectPosition() {
@@ -4330,6 +4550,7 @@ export class Style {
4330
4550
  return '';
4331
4551
  }
4332
4552
  set borderImage(value) {
4553
+ value = this.coerceCssStringValue(value);
4333
4554
  this.setPseudoCssStringValue('border-image', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setBorderImage(this.nativeView, value), () => (this.nativeView.style.borderImage = value));
4334
4555
  }
4335
4556
  set 'border-image'(value) {
@@ -4376,6 +4597,7 @@ export class Style {
4376
4597
  return 'normal';
4377
4598
  }
4378
4599
  set fontFeatureSettings(value) {
4600
+ value = this.coerceCssStringValue(value);
4379
4601
  this.setPseudoCssStringValue('font-feature-settings', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setFontFeatureSettings(this.nativeView, value), () => (this.nativeView.style.fontFeatureSettings = value));
4380
4602
  }
4381
4603
  set 'font-feature-settings'(value) {
@@ -4481,6 +4703,7 @@ export class Style {
4481
4703
  return '';
4482
4704
  }
4483
4705
  set backdropFilter(value) {
4706
+ value = this.coerceCssStringValue(value);
4484
4707
  this.setPseudoCssStringValue('backdrop-filter', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setBackdropFilter(this.nativeView, value), () => (this.nativeView.style.backdropFilter = value));
4485
4708
  }
4486
4709
  set 'backdrop-filter'(value) {