@triniwiz/nativescript-masonkit 1.0.0-beta.68.1 → 1.0.0-beta.69

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 (52) hide show
  1. package/index.d.ts +46 -1
  2. package/package.json +1 -1
  3. package/platforms/android/masonkit-release.aar +0 -0
  4. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason-Swift.h +3 -0
  5. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/mason_native.h +30 -22
  6. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Mason +0 -0
  7. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  8. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.abi.json +13443 -3032
  9. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.private.swiftinterface +38 -0
  10. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  11. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftinterface +38 -0
  12. package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  13. package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8084 -7985
  14. package/platforms/ios/Mason.xcframework/ios-arm64-simulator/Mason.framework/Headers/Mason-Swift.h +1995 -0
  15. package/platforms/ios/Mason.xcframework/ios-arm64-simulator/Mason.framework/Headers/Mason.h +25 -0
  16. package/platforms/ios/Mason.xcframework/ios-arm64-simulator/Mason.framework/Headers/mason_native.h +499 -0
  17. package/platforms/ios/Mason.xcframework/ios-arm64-simulator/Mason.framework/Info.plist +0 -0
  18. package/platforms/ios/Mason.xcframework/ios-arm64-simulator/Mason.framework/Mason +0 -0
  19. package/platforms/ios/Mason.xcframework/ios-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  20. package/platforms/ios/Mason.xcframework/ios-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.abi.json +111240 -0
  21. package/platforms/ios/Mason.xcframework/ios-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +3807 -0
  22. package/platforms/ios/Mason.xcframework/ios-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  23. package/platforms/ios/Mason.xcframework/ios-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftinterface +3807 -0
  24. package/platforms/ios/Mason.xcframework/ios-arm64-simulator/Mason.framework/Modules/module.modulemap +11 -0
  25. package/platforms/ios/Mason.xcframework/ios-arm64-simulator/Mason.framework/_CodeSignature/CodeResources +212 -0
  26. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason-Swift.h +6 -0
  27. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/mason_native.h +30 -22
  28. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Mason +0 -0
  29. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  30. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  31. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.abi.json +13443 -3032
  32. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +38 -0
  33. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  34. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftinterface +38 -0
  35. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +13443 -3032
  36. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +38 -0
  37. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  38. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +38 -0
  39. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/_CodeSignature/CodeResources +28 -28
  40. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  41. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8079 -7980
  42. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +7740 -7661
  43. package/properties.d.ts +11 -0
  44. package/properties.js +65 -0
  45. package/properties.js.map +1 -1
  46. package/scroll/index.ios.js +3 -1
  47. package/scroll/index.ios.js.map +1 -1
  48. package/style.d.ts +70 -4
  49. package/style.js +572 -1
  50. package/style.js.map +1 -1
  51. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/NSObject+MasonElement_Defaults.h +0 -100
  52. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/NSObject+MasonElement_Defaults.h +0 -100
package/style.js CHANGED
@@ -197,6 +197,27 @@ var StyleKeys;
197
197
  // font-variant-numeric bitmask (byte) + state
198
198
  StyleKeys[StyleKeys["FONT_VARIANT_NUMERIC"] = 419] = "FONT_VARIANT_NUMERIC";
199
199
  StyleKeys[StyleKeys["FONT_VARIANT_NUMERIC_STATE"] = 420] = "FONT_VARIANT_NUMERIC_STATE";
200
+ // ============================================================
201
+ // New CSS properties (bytes 560-595)
202
+ // ============================================================
203
+ StyleKeys[StyleKeys["OBJECT_POSITION_X_TYPE"] = 560] = "OBJECT_POSITION_X_TYPE";
204
+ StyleKeys[StyleKeys["OBJECT_POSITION_Y_TYPE"] = 561] = "OBJECT_POSITION_Y_TYPE";
205
+ StyleKeys[StyleKeys["OBJECT_POSITION_X_VALUE"] = 562] = "OBJECT_POSITION_X_VALUE";
206
+ StyleKeys[StyleKeys["OBJECT_POSITION_Y_VALUE"] = 566] = "OBJECT_POSITION_Y_VALUE";
207
+ StyleKeys[StyleKeys["OBJECT_POSITION_STATE"] = 570] = "OBJECT_POSITION_STATE";
208
+ StyleKeys[StyleKeys["WRITING_MODE"] = 571] = "WRITING_MODE";
209
+ StyleKeys[StyleKeys["WRITING_MODE_STATE"] = 572] = "WRITING_MODE_STATE";
210
+ StyleKeys[StyleKeys["UNICODE_BIDI"] = 573] = "UNICODE_BIDI";
211
+ StyleKeys[StyleKeys["UNICODE_BIDI_STATE"] = 574] = "UNICODE_BIDI_STATE";
212
+ StyleKeys[StyleKeys["HYPHENS"] = 575] = "HYPHENS";
213
+ StyleKeys[StyleKeys["HYPHENS_STATE"] = 576] = "HYPHENS_STATE";
214
+ StyleKeys[StyleKeys["CARET_COLOR"] = 577] = "CARET_COLOR";
215
+ StyleKeys[StyleKeys["CARET_COLOR_STATE"] = 581] = "CARET_COLOR_STATE";
216
+ StyleKeys[StyleKeys["WORD_SPACING"] = 582] = "WORD_SPACING";
217
+ StyleKeys[StyleKeys["WORD_SPACING_TYPE"] = 586] = "WORD_SPACING_TYPE";
218
+ StyleKeys[StyleKeys["WORD_SPACING_STATE"] = 587] = "WORD_SPACING_STATE";
219
+ StyleKeys[StyleKeys["FONT_STRETCH"] = 588] = "FONT_STRETCH";
220
+ StyleKeys[StyleKeys["FONT_STRETCH_STATE"] = 592] = "FONT_STRETCH_STATE";
200
221
  })(StyleKeys || (StyleKeys = {}));
201
222
  function parseLengthPercentageAuto(type, value) {
202
223
  switch (type) {
@@ -310,6 +331,13 @@ StateKeys.TEXT_SHADOWS = StateKeys.flag(68);
310
331
  StateKeys.FONT_FAMILY = StateKeys.flag(69);
311
332
  StateKeys.LETTER_SPACING = StateKeys.flag(70);
312
333
  StateKeys.FONT_VARIANT_NUMERIC = StateKeys.flag(71);
334
+ StateKeys.OBJECT_POSITION = StateKeys.flag(72);
335
+ StateKeys.WRITING_MODE = StateKeys.flag(73);
336
+ StateKeys.UNICODE_BIDI = StateKeys.flag(74);
337
+ StateKeys.HYPHENS = StateKeys.flag(75);
338
+ StateKeys.CARET_COLOR = StateKeys.flag(76);
339
+ StateKeys.WORD_SPACING = StateKeys.flag(77);
340
+ StateKeys.FONT_STRETCH = StateKeys.flag(78);
313
341
  const getInt8 = (view, offset) => {
314
342
  return view.getInt8(offset);
315
343
  };
@@ -390,10 +418,90 @@ function normalizeColorValue(value) {
390
418
  return null;
391
419
  }
392
420
  }
421
+ // ============================================================
422
+ // Helper: border-style enum ↔ string
423
+ // ============================================================
424
+ const BORDER_STYLE_VALUES = ['none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset'];
425
+ function borderStyleToEnum(value) {
426
+ const idx = BORDER_STYLE_VALUES.indexOf(value);
427
+ return idx === -1 ? -1 : idx;
428
+ }
429
+ function borderStyleFromEnum(value) {
430
+ return BORDER_STYLE_VALUES[value] ?? 'none';
431
+ }
432
+ // ============================================================
433
+ // Helper: object-position parser
434
+ // ============================================================
435
+ function parseObjectPosition(value) {
436
+ const keywords = {
437
+ left: { type: 1, val: 0 },
438
+ center: { type: 1, val: 50 },
439
+ right: { type: 1, val: 100 },
440
+ top: { type: 1, val: 0 },
441
+ bottom: { type: 1, val: 100 },
442
+ };
443
+ const parts = value.trim().split(/\s+/);
444
+ if (parts.length === 0)
445
+ return null;
446
+ function parseComponent(s) {
447
+ const kw = keywords[s];
448
+ if (kw)
449
+ return kw;
450
+ if (s.endsWith('%'))
451
+ return { type: 1, val: parseFloat(s) };
452
+ return { type: 0, val: parseFloat(s) };
453
+ }
454
+ if (parts.length === 1) {
455
+ const c = parseComponent(parts[0]);
456
+ if (!c)
457
+ return null;
458
+ return { xType: c.type, xVal: c.val, yType: 1, yVal: 50 };
459
+ }
460
+ const x = parseComponent(parts[0]);
461
+ const y = parseComponent(parts[1]);
462
+ if (!x || !y)
463
+ return null;
464
+ return { xType: x.type, xVal: x.val, yType: y.type, yVal: y.val };
465
+ }
466
+ // ============================================================
467
+ // Helper: font-stretch keyword ↔ percentage
468
+ // ============================================================
469
+ const FONT_STRETCH_KEYWORDS = {
470
+ 'ultra-condensed': 5000,
471
+ 'extra-condensed': 6250,
472
+ condensed: 7500,
473
+ 'semi-condensed': 8750,
474
+ normal: 10000,
475
+ 'semi-expanded': 11250,
476
+ expanded: 12500,
477
+ 'extra-expanded': 15000,
478
+ 'ultra-expanded': 20000,
479
+ };
480
+ function fontStretchToValue(value) {
481
+ const trimmed = value.trim();
482
+ const kw = FONT_STRETCH_KEYWORDS[trimmed];
483
+ if (kw !== undefined)
484
+ return kw;
485
+ if (trimmed.endsWith('%')) {
486
+ const pct = parseFloat(trimmed);
487
+ if (isNaN(pct) || pct < 0)
488
+ return -1;
489
+ return Math.round(pct * 100);
490
+ }
491
+ return -1;
492
+ }
493
+ function fontStretchFromValue(v) {
494
+ for (const [kw, val] of Object.entries(FONT_STRETCH_KEYWORDS)) {
495
+ if (val === v)
496
+ return kw;
497
+ }
498
+ return `${v / 100}%`;
499
+ }
393
500
  export class Style {
394
501
  constructor() {
395
502
  this.isDirty = -1n;
396
503
  this.inBatch = false;
504
+ this._syncScheduled = false;
397
505
  }
398
506
  static fromView(view, nativeView) {
399
507
  //console.time('fromView');
@@ -561,7 +669,19 @@ export class Style {
561
669
  this.isDirty = this.isDirty | value.bits;
562
670
  }
563
671
  if (!this.inBatch) {
564
- this.syncStyle();
672
+ // Coalesce rapid-fire property changes (e.g. CSS batch apply) into a
673
+ // single syncStyle() call on the next microtask. This avoids N
674
+ // separate JNI/FFI round-trips when N properties change in the same
675
+ // JS turn.
676
+ if (!this._syncScheduled) {
677
+ this._syncScheduled = true;
678
+ queueMicrotask(() => {
679
+ this._syncScheduled = false;
680
+ if (this.isDirty !== -1n) {
681
+ this.syncStyle();
682
+ }
683
+ });
684
+ }
565
685
  }
566
686
  }
567
687
  batch(fn) {
@@ -3519,6 +3639,449 @@ export class Style {
3519
3639
  set cornerShapeBottomLeft(value) {
3520
3640
  this.setPseudoCssStringValue('corner-shape-bottom-left', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setCornerShapeBottomLeft(this.nativeView, value), () => (this.nativeView.style.cornerShapeBottomLeft = value));
3521
3641
  }
3642
+ get objectPosition() {
3643
+ if (!this.style_view)
3644
+ return '50% 50%';
3645
+ const state = getUint8(this.style_view, StyleKeys.OBJECT_POSITION_STATE);
3646
+ if (!state)
3647
+ return '50% 50%';
3648
+ const xType = getUint8(this.style_view, StyleKeys.OBJECT_POSITION_X_TYPE);
3649
+ const yType = getUint8(this.style_view, StyleKeys.OBJECT_POSITION_Y_TYPE);
3650
+ const xVal = getFloat32(this.style_view, StyleKeys.OBJECT_POSITION_X_VALUE);
3651
+ const yVal = getFloat32(this.style_view, StyleKeys.OBJECT_POSITION_Y_VALUE);
3652
+ const x = xType === 1 ? `${xVal}%` : `${xVal}px`;
3653
+ const y = yType === 1 ? `${yVal}%` : `${yVal}px`;
3654
+ return `${x} ${y}`;
3655
+ }
3656
+ set objectPosition(value) {
3657
+ if (!this.style_view)
3658
+ return;
3659
+ const parsed = parseObjectPosition(value);
3660
+ if (!parsed)
3661
+ return;
3662
+ this.prepareMut();
3663
+ setUint8(this.style_view, StyleKeys.OBJECT_POSITION_X_TYPE, parsed.xType);
3664
+ setUint8(this.style_view, StyleKeys.OBJECT_POSITION_Y_TYPE, parsed.yType);
3665
+ setFloat32(this.style_view, StyleKeys.OBJECT_POSITION_X_VALUE, parsed.xVal);
3666
+ setFloat32(this.style_view, StyleKeys.OBJECT_POSITION_Y_VALUE, parsed.yVal);
3667
+ setUint8(this.style_view, StyleKeys.OBJECT_POSITION_STATE, 1);
3668
+ this.commitState(StateKeys.OBJECT_POSITION);
3669
+ }
3670
+ set 'object-position'(value) {
3671
+ this.objectPosition = value;
3672
+ }
3673
+ get 'object-position'() {
3674
+ return this.objectPosition;
3675
+ }
3676
+ get borderLeftStyle() {
3677
+ return borderStyleFromEnum(getInt8(this.style_view, StyleKeys.BORDER_LEFT_STYLE));
3678
+ }
3679
+ set borderLeftStyle(value) {
3680
+ const v = borderStyleToEnum(value);
3681
+ if (v === -1)
3682
+ return;
3683
+ this.prepareMut();
3684
+ setInt8(this.style_view, StyleKeys.BORDER_LEFT_STYLE, v);
3685
+ this.commitState(StateKeys.BORDER_STYLE);
3686
+ }
3687
+ get borderRightStyle() {
3688
+ return borderStyleFromEnum(getInt8(this.style_view, StyleKeys.BORDER_RIGHT_STYLE));
3689
+ }
3690
+ set borderRightStyle(value) {
3691
+ const v = borderStyleToEnum(value);
3692
+ if (v === -1)
3693
+ return;
3694
+ this.prepareMut();
3695
+ setInt8(this.style_view, StyleKeys.BORDER_RIGHT_STYLE, v);
3696
+ this.commitState(StateKeys.BORDER_STYLE);
3697
+ }
3698
+ get borderTopStyle() {
3699
+ return borderStyleFromEnum(getInt8(this.style_view, StyleKeys.BORDER_TOP_STYLE));
3700
+ }
3701
+ set borderTopStyle(value) {
3702
+ const v = borderStyleToEnum(value);
3703
+ if (v === -1)
3704
+ return;
3705
+ this.prepareMut();
3706
+ setInt8(this.style_view, StyleKeys.BORDER_TOP_STYLE, v);
3707
+ this.commitState(StateKeys.BORDER_STYLE);
3708
+ }
3709
+ get borderBottomStyle() {
3710
+ return borderStyleFromEnum(getInt8(this.style_view, StyleKeys.BORDER_BOTTOM_STYLE));
3711
+ }
3712
+ set borderBottomStyle(value) {
3713
+ const v = borderStyleToEnum(value);
3714
+ if (v === -1)
3715
+ return;
3716
+ this.prepareMut();
3717
+ setInt8(this.style_view, StyleKeys.BORDER_BOTTOM_STYLE, v);
3718
+ this.commitState(StateKeys.BORDER_STYLE);
3719
+ }
3720
+ get borderStyle() {
3721
+ const l = this.borderLeftStyle;
3722
+ const r = this.borderRightStyle;
3723
+ const t = this.borderTopStyle;
3724
+ const b = this.borderBottomStyle;
3725
+ if (l === r && r === t && t === b)
3726
+ return l;
3727
+ if (t === b && l === r)
3728
+ return `${t} ${l}`;
3729
+ return `${t} ${r} ${b} ${l}`;
3730
+ }
3731
+ set borderStyle(value) {
3732
+ const parts = value.trim().split(/\s+/);
3733
+ let t, r, b, l;
3734
+ switch (parts.length) {
3735
+ case 1:
3736
+ t = r = b = l = parts[0];
3737
+ break;
3738
+ case 2:
3739
+ t = b = parts[0];
3740
+ r = l = parts[1];
3741
+ break;
3742
+ case 3:
3743
+ t = parts[0];
3744
+ r = l = parts[1];
3745
+ b = parts[2];
3746
+ break;
3747
+ case 4:
3748
+ t = parts[0];
3749
+ r = parts[1];
3750
+ b = parts[2];
3751
+ l = parts[3];
3752
+ break;
3753
+ default:
3754
+ return;
3755
+ }
3756
+ const te = borderStyleToEnum(t);
3757
+ const re = borderStyleToEnum(r);
3758
+ const be = borderStyleToEnum(b);
3759
+ const le = borderStyleToEnum(l);
3760
+ if (te === -1 || re === -1 || be === -1 || le === -1)
3761
+ return;
3762
+ this.prepareMut();
3763
+ setInt8(this.style_view, StyleKeys.BORDER_TOP_STYLE, te);
3764
+ setInt8(this.style_view, StyleKeys.BORDER_RIGHT_STYLE, re);
3765
+ setInt8(this.style_view, StyleKeys.BORDER_BOTTOM_STYLE, be);
3766
+ setInt8(this.style_view, StyleKeys.BORDER_LEFT_STYLE, le);
3767
+ this.commitState(StateKeys.BORDER_STYLE);
3768
+ }
3769
+ set 'border-style'(value) {
3770
+ this.borderStyle = value;
3771
+ }
3772
+ get 'border-style'() {
3773
+ return this.borderStyle;
3774
+ }
3775
+ get borderImage() {
3776
+ if (!this.nativeView)
3777
+ return '';
3778
+ if (__ANDROID__) {
3779
+ return org.nativescript.mason.masonkit.NodeHelper.getShared().getBorderImage(this.nativeView);
3780
+ }
3781
+ if (__APPLE__) {
3782
+ return this.nativeView.style.borderImage;
3783
+ }
3784
+ return '';
3785
+ }
3786
+ set borderImage(value) {
3787
+ this.setPseudoCssStringValue('border-image', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setBorderImage(this.nativeView, value), () => (this.nativeView.style.borderImage = value));
3788
+ }
3789
+ set 'border-image'(value) {
3790
+ this.borderImage = value;
3791
+ }
3792
+ get 'border-image'() {
3793
+ return this.borderImage;
3794
+ }
3795
+ get fontStretch() {
3796
+ if (!this.style_view)
3797
+ return 'normal';
3798
+ const state = getUint8(this.style_view, StyleKeys.FONT_STRETCH_STATE);
3799
+ if (!state)
3800
+ return 'normal';
3801
+ const pct = getInt32(this.style_view, StyleKeys.FONT_STRETCH);
3802
+ return fontStretchFromValue(pct);
3803
+ }
3804
+ set fontStretch(value) {
3805
+ if (!this.style_view)
3806
+ return;
3807
+ const pct = fontStretchToValue(value);
3808
+ if (pct === -1)
3809
+ return;
3810
+ this.prepareMut();
3811
+ setInt32(this.style_view, StyleKeys.FONT_STRETCH, pct);
3812
+ setUint8(this.style_view, StyleKeys.FONT_STRETCH_STATE, 1);
3813
+ this.commitState(StateKeys.FONT_STRETCH);
3814
+ }
3815
+ set 'font-stretch'(value) {
3816
+ this.fontStretch = value;
3817
+ }
3818
+ get 'font-stretch'() {
3819
+ return this.fontStretch;
3820
+ }
3821
+ get fontFeatureSettings() {
3822
+ if (!this.nativeView)
3823
+ return 'normal';
3824
+ if (__ANDROID__) {
3825
+ return org.nativescript.mason.masonkit.NodeHelper.getShared().getFontFeatureSettings(this.nativeView);
3826
+ }
3827
+ if (__APPLE__) {
3828
+ return this.nativeView.style.fontFeatureSettings;
3829
+ }
3830
+ return 'normal';
3831
+ }
3832
+ set fontFeatureSettings(value) {
3833
+ this.setPseudoCssStringValue('font-feature-settings', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setFontFeatureSettings(this.nativeView, value), () => (this.nativeView.style.fontFeatureSettings = value));
3834
+ }
3835
+ set 'font-feature-settings'(value) {
3836
+ this.fontFeatureSettings = value;
3837
+ }
3838
+ get 'font-feature-settings'() {
3839
+ return this.fontFeatureSettings;
3840
+ }
3841
+ get wordSpacing() {
3842
+ if (!this.style_view)
3843
+ return 'normal';
3844
+ const state = getUint8(this.style_view, StyleKeys.WORD_SPACING_STATE);
3845
+ if (!state)
3846
+ return 'normal';
3847
+ const type = getUint8(this.style_view, StyleKeys.WORD_SPACING_TYPE);
3848
+ if (type === 2)
3849
+ return 'normal';
3850
+ const value = getFloat32(this.style_view, StyleKeys.WORD_SPACING);
3851
+ return type === 1 ? `${value}%` : `${value}px`;
3852
+ }
3853
+ set wordSpacing(value) {
3854
+ if (!this.style_view)
3855
+ return;
3856
+ this.prepareMut();
3857
+ if (value === 'normal') {
3858
+ setUint8(this.style_view, StyleKeys.WORD_SPACING_TYPE, 2);
3859
+ setFloat32(this.style_view, StyleKeys.WORD_SPACING, 0);
3860
+ }
3861
+ else if (typeof value === 'number') {
3862
+ setUint8(this.style_view, StyleKeys.WORD_SPACING_TYPE, 0);
3863
+ setFloat32(this.style_view, StyleKeys.WORD_SPACING, layout.toDevicePixels(value));
3864
+ }
3865
+ else {
3866
+ const trimmed = value.trim();
3867
+ if (trimmed === 'normal') {
3868
+ setUint8(this.style_view, StyleKeys.WORD_SPACING_TYPE, 2);
3869
+ setFloat32(this.style_view, StyleKeys.WORD_SPACING, 0);
3870
+ }
3871
+ else if (trimmed.endsWith('%')) {
3872
+ setUint8(this.style_view, StyleKeys.WORD_SPACING_TYPE, 1);
3873
+ setFloat32(this.style_view, StyleKeys.WORD_SPACING, parseFloat(trimmed));
3874
+ }
3875
+ else {
3876
+ setUint8(this.style_view, StyleKeys.WORD_SPACING_TYPE, 0);
3877
+ setFloat32(this.style_view, StyleKeys.WORD_SPACING, layout.toDevicePixels(parseFloat(trimmed)));
3878
+ }
3879
+ }
3880
+ setUint8(this.style_view, StyleKeys.WORD_SPACING_STATE, 1);
3881
+ this.commitState(StateKeys.WORD_SPACING);
3882
+ }
3883
+ set 'word-spacing'(value) {
3884
+ this.wordSpacing = value;
3885
+ }
3886
+ get 'word-spacing'() {
3887
+ return this.wordSpacing;
3888
+ }
3889
+ get hyphens() {
3890
+ if (!this.style_view)
3891
+ return 'manual';
3892
+ const state = getUint8(this.style_view, StyleKeys.HYPHENS_STATE);
3893
+ if (!state)
3894
+ return 'manual';
3895
+ switch (getUint8(this.style_view, StyleKeys.HYPHENS)) {
3896
+ case 0:
3897
+ return 'manual';
3898
+ case 1:
3899
+ return 'none';
3900
+ case 2:
3901
+ return 'auto';
3902
+ default:
3903
+ return 'manual';
3904
+ }
3905
+ }
3906
+ set hyphens(value) {
3907
+ let v = -1;
3908
+ switch (value) {
3909
+ case 'manual':
3910
+ v = 0;
3911
+ break;
3912
+ case 'none':
3913
+ v = 1;
3914
+ break;
3915
+ case 'auto':
3916
+ v = 2;
3917
+ break;
3918
+ }
3919
+ if (v === -1)
3920
+ return;
3921
+ this.prepareMut();
3922
+ setUint8(this.style_view, StyleKeys.HYPHENS, v);
3923
+ setUint8(this.style_view, StyleKeys.HYPHENS_STATE, 1);
3924
+ this.commitState(StateKeys.HYPHENS);
3925
+ }
3926
+ get backdropFilter() {
3927
+ if (!this.nativeView)
3928
+ return '';
3929
+ if (__ANDROID__) {
3930
+ return org.nativescript.mason.masonkit.NodeHelper.getShared().getBackdropFilter(this.nativeView);
3931
+ }
3932
+ if (__APPLE__) {
3933
+ return this.nativeView.style.backdropFilter;
3934
+ }
3935
+ return '';
3936
+ }
3937
+ set backdropFilter(value) {
3938
+ this.setPseudoCssStringValue('backdrop-filter', value, () => org.nativescript.mason.masonkit.NodeHelper.getShared().setBackdropFilter(this.nativeView, value), () => (this.nativeView.style.backdropFilter = value));
3939
+ }
3940
+ set 'backdrop-filter'(value) {
3941
+ this.backdropFilter = value;
3942
+ }
3943
+ get 'backdrop-filter'() {
3944
+ return this.backdropFilter;
3945
+ }
3946
+ get writingMode() {
3947
+ if (!this.style_view)
3948
+ return 'horizontal-tb';
3949
+ const state = getUint8(this.style_view, StyleKeys.WRITING_MODE_STATE);
3950
+ if (!state)
3951
+ return 'horizontal-tb';
3952
+ switch (getUint8(this.style_view, StyleKeys.WRITING_MODE)) {
3953
+ case 0:
3954
+ return 'horizontal-tb';
3955
+ case 1:
3956
+ return 'vertical-rl';
3957
+ case 2:
3958
+ return 'vertical-lr';
3959
+ default:
3960
+ return 'horizontal-tb';
3961
+ }
3962
+ }
3963
+ set writingMode(value) {
3964
+ let v = -1;
3965
+ switch (value) {
3966
+ case 'horizontal-tb':
3967
+ v = 0;
3968
+ break;
3969
+ case 'vertical-rl':
3970
+ v = 1;
3971
+ break;
3972
+ case 'vertical-lr':
3973
+ v = 2;
3974
+ break;
3975
+ }
3976
+ if (v === -1)
3977
+ return;
3978
+ this.prepareMut();
3979
+ setUint8(this.style_view, StyleKeys.WRITING_MODE, v);
3980
+ setUint8(this.style_view, StyleKeys.WRITING_MODE_STATE, 1);
3981
+ this.commitState(StateKeys.WRITING_MODE);
3982
+ }
3983
+ set 'writing-mode'(value) {
3984
+ this.writingMode = value;
3985
+ }
3986
+ get 'writing-mode'() {
3987
+ return this.writingMode;
3988
+ }
3989
+ get unicodeBidi() {
3990
+ if (!this.style_view)
3991
+ return 'normal';
3992
+ const state = getUint8(this.style_view, StyleKeys.UNICODE_BIDI_STATE);
3993
+ if (!state)
3994
+ return 'normal';
3995
+ switch (getUint8(this.style_view, StyleKeys.UNICODE_BIDI)) {
3996
+ case 0:
3997
+ return 'normal';
3998
+ case 1:
3999
+ return 'embed';
4000
+ case 2:
4001
+ return 'bidi-override';
4002
+ case 3:
4003
+ return 'isolate';
4004
+ case 4:
4005
+ return 'isolate-override';
4006
+ case 5:
4007
+ return 'plaintext';
4008
+ default:
4009
+ return 'normal';
4010
+ }
4011
+ }
4012
+ set unicodeBidi(value) {
4013
+ let v = -1;
4014
+ switch (value) {
4015
+ case 'normal':
4016
+ v = 0;
4017
+ break;
4018
+ case 'embed':
4019
+ v = 1;
4020
+ break;
4021
+ case 'bidi-override':
4022
+ v = 2;
4023
+ break;
4024
+ case 'isolate':
4025
+ v = 3;
4026
+ break;
4027
+ case 'isolate-override':
4028
+ v = 4;
4029
+ break;
4030
+ case 'plaintext':
4031
+ v = 5;
4032
+ break;
4033
+ }
4034
+ if (v === -1)
4035
+ return;
4036
+ this.prepareMut();
4037
+ setUint8(this.style_view, StyleKeys.UNICODE_BIDI, v);
4038
+ setUint8(this.style_view, StyleKeys.UNICODE_BIDI_STATE, 1);
4039
+ this.commitState(StateKeys.UNICODE_BIDI);
4040
+ }
4041
+ set 'unicode-bidi'(value) {
4042
+ this.unicodeBidi = value;
4043
+ }
4044
+ get 'unicode-bidi'() {
4045
+ return this.unicodeBidi;
4046
+ }
4047
+ get caretColor() {
4048
+ if (!this.style_view)
4049
+ return 'auto';
4050
+ const state = getUint8(this.style_view, StyleKeys.CARET_COLOR_STATE);
4051
+ if (!state)
4052
+ return 'auto';
4053
+ const argb = getUint32(this.style_view, StyleKeys.CARET_COLOR);
4054
+ if (argb === 0)
4055
+ return 'auto';
4056
+ const a = (argb >>> 24) & 0xff;
4057
+ const r = (argb >>> 16) & 0xff;
4058
+ const g = (argb >>> 8) & 0xff;
4059
+ const b = argb & 0xff;
4060
+ return a === 255 ? `rgb(${r}, ${g}, ${b})` : `rgba(${r}, ${g}, ${b}, ${(a / 255).toFixed(2)})`;
4061
+ }
4062
+ set caretColor(value) {
4063
+ if (!this.style_view)
4064
+ return;
4065
+ this.prepareMut();
4066
+ if (value === 'auto') {
4067
+ setUint32(this.style_view, StyleKeys.CARET_COLOR, 0);
4068
+ setUint8(this.style_view, StyleKeys.CARET_COLOR_STATE, 1);
4069
+ }
4070
+ else {
4071
+ const normalized = normalizeColorValue(value);
4072
+ if (normalized == null)
4073
+ return;
4074
+ setUint32(this.style_view, StyleKeys.CARET_COLOR, normalized);
4075
+ setUint8(this.style_view, StyleKeys.CARET_COLOR_STATE, 1);
4076
+ }
4077
+ this.commitState(StateKeys.CARET_COLOR);
4078
+ }
4079
+ set 'caret-color'(value) {
4080
+ this.caretColor = value;
4081
+ }
4082
+ get 'caret-color'() {
4083
+ return this.caretColor;
4084
+ }
3522
4085
  toJSON() {
3523
4086
  return {
3524
4087
  display: this.display,
@@ -3571,6 +4134,14 @@ export class Style {
3571
4134
  filter: this.filter,
3572
4135
  zIndex: this.zIndex,
3573
4136
  backgroundColor: this.backgroundColor,
4137
+ objectPosition: this.objectPosition,
4138
+ borderStyle: this.borderStyle,
4139
+ writingMode: this.writingMode,
4140
+ unicodeBidi: this.unicodeBidi,
4141
+ hyphens: this.hyphens,
4142
+ caretColor: this.caretColor,
4143
+ wordSpacing: this.wordSpacing,
4144
+ fontStretch: this.fontStretch,
3574
4145
  };
3575
4146
  }
3576
4147
  }