@triniwiz/nativescript-masonkit 1.0.0-beta.118 → 1.0.0-beta.119

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 (45) hide show
  1. package/common.d.ts +3 -0
  2. package/common.js +35 -10
  3. package/common.js.map +1 -1
  4. package/package.json +1 -1
  5. package/platforms/android/masonkit-release.aar +0 -0
  6. package/platforms/ios/Mason.xcframework/Info.plist +8 -8
  7. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Mason +0 -0
  8. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  9. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.abi.json +152 -131
  10. package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  11. package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +9388 -9340
  12. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Mason +0 -0
  13. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  14. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  15. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.abi.json +152 -131
  16. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +152 -131
  17. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/_CodeSignature/CodeResources +12 -12
  18. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +2 -2
  19. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +9382 -9334
  20. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +8947 -8900
  21. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Mason +0 -0
  22. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-xros.swiftsourceinfo +0 -0
  23. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.abi.json +152 -131
  24. package/platforms/ios/Mason.xcframework/xros-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  25. package/platforms/ios/Mason.xcframework/xros-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8877 -8831
  26. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Mason +0 -0
  27. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-xros-simulator.swiftsourceinfo +0 -0
  28. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.abi.json +152 -131
  29. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/_CodeSignature/CodeResources +6 -6
  30. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  31. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8876 -8830
  32. package/platforms/windows/arm64/NativeScript.Mason.dll +0 -0
  33. package/platforms/windows/arm64/NativeScript.Mason.winmd +0 -0
  34. package/platforms/windows/x64/NativeScript.Mason.dll +0 -0
  35. package/platforms/windows/x64/NativeScript.Mason.winmd +0 -0
  36. package/style.d.ts +3 -4
  37. package/style.js +61 -44
  38. package/style.js.map +1 -1
  39. package/typings/windows.d.ts +1 -1
  40. package/view/index.ios.d.ts +7 -0
  41. package/view/index.ios.js +68 -18
  42. package/view/index.ios.js.map +1 -1
  43. package/windows-mask.d.ts +2 -0
  44. package/windows-mask.js +2 -18
  45. package/windows-mask.js.map +1 -1
package/style.d.ts CHANGED
@@ -124,6 +124,7 @@ declare class StateKeys {
124
124
  }
125
125
  export declare function parseLinearGradientCss(value: string): {
126
126
  angle: number;
127
+ corner?: [number, number];
127
128
  offsets: number[];
128
129
  colors: number[];
129
130
  interpolation: string;
@@ -275,10 +276,8 @@ export declare class Style {
275
276
  * with a percentage of the parent's, or the inherited one when unset.
276
277
  */
277
278
  emBasis(): number;
278
- /**
279
- * The nearest Mason ancestor's font size (the element's own for a pseudo-class
280
- * style). Reads only existing styles, since building one creates the native view.
281
- */
279
+ emBasisFor(value: unknown): number | undefined;
280
+ /** The nearest existing Mason ancestor style's font size (its own for a pseudo-class style). */
282
281
  private parentEmBasis;
283
282
  private prepareMut;
284
283
  get boxSizing(): 'border-box' | 'content-box';
package/style.js CHANGED
@@ -331,6 +331,7 @@ function finite(n) {
331
331
  reportCssDiagnostic({ kind: 'unparsable-value', name: 'length', value: String(n), detail: 'not a finite number, treated as 0' });
332
332
  return 0;
333
333
  }
334
+ const EM_UNIT = /em/i;
334
335
  /** 1pt = 1/72in and 1 CSS px = 1/96in, so a point is 96/72 CSS px. */
335
336
  const PX_PER_PT = 96 / 72;
336
337
  /** `n<unit>` in CSS px inside a math function, or undefined for an unknown unit. */
@@ -825,6 +826,20 @@ function parseGradientAngle(token) {
825
826
  return 315;
826
827
  return 180; // CSS default is 'to bottom'
827
828
  }
829
+ function parseGradientCorner(token) {
830
+ const words = token.trim().toLowerCase().split(/\s+/);
831
+ if (words.length !== 3 || words[0] !== 'to')
832
+ return undefined;
833
+ let x = 0;
834
+ let y = 0;
835
+ for (const word of words.slice(1)) {
836
+ if (word === 'left' || word === 'right')
837
+ x = word === 'left' ? -1 : 1;
838
+ else if (word === 'top' || word === 'bottom')
839
+ y = word === 'top' ? -1 : 1;
840
+ }
841
+ return x && y ? [x, y] : undefined;
842
+ }
828
843
  const LINEAR_GRADIENT = /linear-gradient/i;
829
844
  const ANY_GRADIENT = /gradient/i;
830
845
  const LINEAR_GRADIENT_ARGS = /linear-gradient\s*\(([\s\S]*)\)\s*$/i;
@@ -840,6 +855,7 @@ export function parseLinearGradientCss(value) {
840
855
  if (parts.length < 2)
841
856
  return null;
842
857
  let angle = 180;
858
+ let corner;
843
859
  let start = 0;
844
860
  let head = parts[0];
845
861
  let interpolation = '';
@@ -851,6 +867,7 @@ export function parseLinearGradientCss(value) {
851
867
  }
852
868
  if (/^(to\s|-?[\d.]+(deg|rad|turn))/i.test(head)) {
853
869
  angle = parseGradientAngle(head);
870
+ corner = parseGradientCorner(head);
854
871
  start = 1;
855
872
  }
856
873
  const colors = [];
@@ -868,7 +885,7 @@ export function parseLinearGradientCss(value) {
868
885
  }
869
886
  if (colors.length < 1)
870
887
  return null;
871
- return { angle, offsets: resolveStopPositions(positions), colors, interpolation };
888
+ return { angle, ...(corner && { corner }), offsets: resolveStopPositions(positions), colors, interpolation };
872
889
  }
873
890
  const RADIAL_GRADIENT_ARGS = /radial-gradient\s*\(([\s\S]*)\)\s*$/i;
874
891
  function positionFraction(token, axis) {
@@ -1633,7 +1650,7 @@ export class Style {
1633
1650
  coerceCssStringValue(value) {
1634
1651
  if (typeof value === 'string') {
1635
1652
  // Nor do they evaluate calc()/min()/max()/clamp(); see css-math.ts.
1636
- const resolved = hasCssMathFunction(value) ? resolveCssMathIn(value, this.emBasis()) : value;
1653
+ const resolved = hasCssMathFunction(value) ? resolveCssMathIn(value, this.emBasisFor(value)) : value;
1637
1654
  return resolveCssColors(resolved, cssColorToRgba);
1638
1655
  }
1639
1656
  if (value == null) {
@@ -1687,7 +1704,7 @@ export class Style {
1687
1704
  if (/^linear-gradient/i.test(layer)) {
1688
1705
  const g = parseLinearGradientCss(layer);
1689
1706
  if (g && g.colors.length)
1690
- NativeScript.Mason.Css.ApplyLinearGradient(this.nativeView, g.angle, stopsOf(g), g.interpolation);
1707
+ NativeScript.Mason.Css.ApplyLinearGradient(this.nativeView, g.angle, g.corner?.[0] ?? 0, g.corner?.[1] ?? 0, stopsOf(g), g.interpolation);
1691
1708
  return;
1692
1709
  }
1693
1710
  if (url) {
@@ -1723,7 +1740,7 @@ export class Style {
1723
1740
  }
1724
1741
  windowsMaskContext() {
1725
1742
  return {
1726
- length: (token) => cssLengthToDip(token, this.emBasis()),
1743
+ length: (token) => cssLengthToDip(token, this.emBasisFor(token)),
1727
1744
  color: (color) => normalizeColorValue(color),
1728
1745
  linear: parseLinearGradientCss,
1729
1746
  radial: parseRadialGradientCss,
@@ -1801,7 +1818,7 @@ export class Style {
1801
1818
  if (!view)
1802
1819
  return;
1803
1820
  const current = this.color >>> 0 || 0xff000000;
1804
- const spec = encodeCssFilter(parseCssFilter(typeof value === 'string' ? value : '', (token) => cssLengthToDip(token, this.emBasis())), (color) => (color && color.toLowerCase() !== 'currentcolor' ? (normalizeColorValue(color) ?? current) : current));
1821
+ const spec = encodeCssFilter(parseCssFilter(typeof value === 'string' ? value : '', (token) => cssLengthToDip(token, this.emBasisFor(token))), (color) => (color && color.toLowerCase() !== 'currentcolor' ? (normalizeColorValue(color) ?? current) : current));
1805
1822
  if (name === 'filter')
1806
1823
  NativeScript.Mason.Css.SetFilter(view, spec);
1807
1824
  else
@@ -1818,7 +1835,7 @@ export class Style {
1818
1835
  const view = this.nativeView;
1819
1836
  if (view && typeof view.SetTextShadow === 'function') {
1820
1837
  const current = this.color >>> 0 || 0xff000000;
1821
- const shadows = parseBoxShadows(typeof value === 'string' ? value : '', (token) => cssLengthToDip(token, this.emBasis()));
1838
+ const shadows = parseBoxShadows(typeof value === 'string' ? value : '', (token) => cssLengthToDip(token, this.emBasisFor(token)));
1822
1839
  view.SetTextShadow(encodeBoxShadows(shadows, (color) => (color && color.toLowerCase() !== 'currentcolor' ? (normalizeColorValue(color) ?? current) : current)));
1823
1840
  }
1824
1841
  return;
@@ -1842,7 +1859,7 @@ export class Style {
1842
1859
  return;
1843
1860
  }
1844
1861
  if (name === 'border-radius') {
1845
- const r = parseBorderRadiusShorthand(value, this.emBasis());
1862
+ const r = parseBorderRadiusShorthand(value, this.emBasisFor(value));
1846
1863
  this.prepareMut();
1847
1864
  for (const [corner, keys] of RADIUS_KEYS) {
1848
1865
  const { type, value: v } = r[corner];
@@ -1855,7 +1872,7 @@ export class Style {
1855
1872
  return;
1856
1873
  }
1857
1874
  if (name === 'border' || name === 'border-top' || name === 'border-right' || name === 'border-bottom' || name === 'border-left') {
1858
- const p = parseBorderShorthand(value, this.emBasis());
1875
+ const p = parseBorderShorthand(value, this.emBasisFor(value));
1859
1876
  let style = p.style;
1860
1877
  if (style == null && (p.width != null || p.color != null))
1861
1878
  style = 4; // solid
@@ -1902,7 +1919,7 @@ export class Style {
1902
1919
  let thickness = null;
1903
1920
  switch (name) {
1904
1921
  case 'text-decoration': {
1905
- const d = parseTextDecoration(value, (token) => cssLengthToDip(token, this.emBasis()));
1922
+ const d = parseTextDecoration(value, (token) => cssLengthToDip(token, this.emBasisFor(token)));
1906
1923
  if (!d)
1907
1924
  return;
1908
1925
  ({ line, style, color, thickness } = d);
@@ -1918,7 +1935,7 @@ export class Style {
1918
1935
  color = parseTextDecorationColor(value);
1919
1936
  break;
1920
1937
  case 'text-decoration-thickness':
1921
- thickness = cssLengthToDip(value, this.emBasis()) ?? null;
1938
+ thickness = cssLengthToDip(value, this.emBasisFor(value)) ?? null;
1922
1939
  break;
1923
1940
  }
1924
1941
  if (line == null && style == null && color == null && thickness == null)
@@ -2104,10 +2121,10 @@ export class Style {
2104
2121
  // `0.75em` is stored as 75 (%), not 75px.
2105
2122
  return getInt8(this.style_view, StyleKeys.FONT_SIZE_TYPE) === 1 ? (own / 100) * this.parentEmBasis() : own;
2106
2123
  }
2107
- /**
2108
- * The nearest Mason ancestor's font size (the element's own for a pseudo-class
2109
- * style). Reads only existing styles, since building one creates the native view.
2110
- */
2124
+ emBasisFor(value) {
2125
+ return typeof value === 'string' && EM_UNIT.test(value) ? this.emBasis() : undefined;
2126
+ }
2127
+ /** The nearest existing Mason ancestor style's font size (its own for a pseudo-class style). */
2111
2128
  parentEmBasis() {
2112
2129
  const view = this.view_;
2113
2130
  let ancestor = (this._pseudo ? view : view?.parent);
@@ -2704,7 +2721,7 @@ export class Style {
2704
2721
  switch (typeof value) {
2705
2722
  case 'string': {
2706
2723
  this.prepareMut();
2707
- const dim = lengthPercentageAutoFromString(value, this.emBasis());
2724
+ const dim = lengthPercentageAutoFromString(value, this.emBasisFor(value));
2708
2725
  setInt8(this.style_view, StyleKeys.MIN_WIDTH_TYPE, dim.type);
2709
2726
  setFloat32(this.style_view, StyleKeys.MIN_WIDTH_VALUE, dim.value);
2710
2727
  break;
@@ -2749,7 +2766,7 @@ export class Style {
2749
2766
  switch (typeof value) {
2750
2767
  case 'string': {
2751
2768
  this.prepareMut();
2752
- const dim = lengthPercentageAutoFromString(value, this.emBasis());
2769
+ const dim = lengthPercentageAutoFromString(value, this.emBasisFor(value));
2753
2770
  setInt8(this.style_view, StyleKeys.MIN_HEIGHT_TYPE, dim.type);
2754
2771
  setFloat32(this.style_view, StyleKeys.MIN_HEIGHT_VALUE, dim.value);
2755
2772
  break;
@@ -2794,7 +2811,7 @@ export class Style {
2794
2811
  switch (typeof value) {
2795
2812
  case 'string': {
2796
2813
  this.prepareMut();
2797
- const dim = dimensionFromString(value, this.emBasis());
2814
+ const dim = dimensionFromString(value, this.emBasisFor(value));
2798
2815
  setInt8(this.style_view, StyleKeys.WIDTH_TYPE, dim.type);
2799
2816
  setFloat32(this.style_view, StyleKeys.WIDTH_VALUE, dim.value);
2800
2817
  break;
@@ -2839,7 +2856,7 @@ export class Style {
2839
2856
  switch (typeof value) {
2840
2857
  case 'string': {
2841
2858
  this.prepareMut();
2842
- const dim = dimensionFromString(value, this.emBasis());
2859
+ const dim = dimensionFromString(value, this.emBasisFor(value));
2843
2860
  setInt8(this.style_view, StyleKeys.HEIGHT_TYPE, dim.type);
2844
2861
  setFloat32(this.style_view, StyleKeys.HEIGHT_VALUE, dim.value);
2845
2862
  break;
@@ -2884,7 +2901,7 @@ export class Style {
2884
2901
  switch (typeof value) {
2885
2902
  case 'string': {
2886
2903
  this.prepareMut();
2887
- const dim = lengthPercentageAutoFromString(value, this.emBasis());
2904
+ const dim = lengthPercentageAutoFromString(value, this.emBasisFor(value));
2888
2905
  setInt8(this.style_view, StyleKeys.MAX_WIDTH_TYPE, dim.type);
2889
2906
  setFloat32(this.style_view, StyleKeys.MAX_WIDTH_VALUE, dim.value);
2890
2907
  break;
@@ -2929,7 +2946,7 @@ export class Style {
2929
2946
  switch (typeof value) {
2930
2947
  case 'string': {
2931
2948
  this.prepareMut();
2932
- const dim = lengthPercentageAutoFromString(value, this.emBasis());
2949
+ const dim = lengthPercentageAutoFromString(value, this.emBasisFor(value));
2933
2950
  setInt8(this.style_view, StyleKeys.MAX_HEIGHT_TYPE, dim.type);
2934
2951
  setFloat32(this.style_view, StyleKeys.MAX_HEIGHT_VALUE, dim.value);
2935
2952
  break;
@@ -2974,7 +2991,7 @@ export class Style {
2974
2991
  switch (typeof value) {
2975
2992
  case 'string': {
2976
2993
  this.prepareMut();
2977
- const dim = lengthPercentageFromString(value, this.emBasis());
2994
+ const dim = lengthPercentageFromString(value, this.emBasisFor(value));
2978
2995
  setInt8(this.style_view, StyleKeys.BORDER_LEFT_TYPE, dim.type);
2979
2996
  setFloat32(this.style_view, StyleKeys.BORDER_LEFT_VALUE, dim.value);
2980
2997
  break;
@@ -3015,7 +3032,7 @@ export class Style {
3015
3032
  switch (typeof value) {
3016
3033
  case 'string': {
3017
3034
  this.prepareMut();
3018
- const dim = lengthPercentageFromString(value, this.emBasis());
3035
+ const dim = lengthPercentageFromString(value, this.emBasisFor(value));
3019
3036
  setInt8(this.style_view, StyleKeys.BORDER_RIGHT_TYPE, dim.type);
3020
3037
  setFloat32(this.style_view, StyleKeys.BORDER_RIGHT_VALUE, dim.value);
3021
3038
  break;
@@ -3056,7 +3073,7 @@ export class Style {
3056
3073
  switch (typeof value) {
3057
3074
  case 'string': {
3058
3075
  this.prepareMut();
3059
- const dim = lengthPercentageFromString(value, this.emBasis());
3076
+ const dim = lengthPercentageFromString(value, this.emBasisFor(value));
3060
3077
  setInt8(this.style_view, StyleKeys.BORDER_TOP_TYPE, dim.type);
3061
3078
  setFloat32(this.style_view, StyleKeys.BORDER_TOP_VALUE, dim.value);
3062
3079
  break;
@@ -3097,7 +3114,7 @@ export class Style {
3097
3114
  switch (typeof value) {
3098
3115
  case 'string': {
3099
3116
  this.prepareMut();
3100
- const dim = lengthPercentageFromString(value, this.emBasis());
3117
+ const dim = lengthPercentageFromString(value, this.emBasisFor(value));
3101
3118
  setInt8(this.style_view, StyleKeys.BORDER_BOTTOM_TYPE, dim.type);
3102
3119
  setFloat32(this.style_view, StyleKeys.BORDER_BOTTOM_VALUE, dim.value);
3103
3120
  break;
@@ -3148,7 +3165,7 @@ export class Style {
3148
3165
  var insetValue;
3149
3166
  switch (typeof value) {
3150
3167
  case 'string': {
3151
- const dim = lengthPercentageAutoFromString(value, this.emBasis());
3168
+ const dim = lengthPercentageAutoFromString(value, this.emBasisFor(value));
3152
3169
  type = dim.type;
3153
3170
  insetValue = dim.value;
3154
3171
  break;
@@ -3192,7 +3209,7 @@ export class Style {
3192
3209
  switch (typeof value) {
3193
3210
  case 'string': {
3194
3211
  this.prepareMut();
3195
- const dim = lengthPercentageAutoFromString(value, this.emBasis());
3212
+ const dim = lengthPercentageAutoFromString(value, this.emBasisFor(value));
3196
3213
  setInt8(this.style_view, StyleKeys.INSET_LEFT_TYPE, dim.type);
3197
3214
  setFloat32(this.style_view, StyleKeys.INSET_LEFT_VALUE, dim.value);
3198
3215
  break;
@@ -3233,7 +3250,7 @@ export class Style {
3233
3250
  switch (typeof value) {
3234
3251
  case 'string': {
3235
3252
  this.prepareMut();
3236
- const dim = lengthPercentageAutoFromString(value, this.emBasis());
3253
+ const dim = lengthPercentageAutoFromString(value, this.emBasisFor(value));
3237
3254
  setInt8(this.style_view, StyleKeys.INSET_RIGHT_TYPE, dim.type);
3238
3255
  setFloat32(this.style_view, StyleKeys.INSET_RIGHT_VALUE, dim.value);
3239
3256
  break;
@@ -3274,7 +3291,7 @@ export class Style {
3274
3291
  switch (typeof value) {
3275
3292
  case 'string': {
3276
3293
  this.prepareMut();
3277
- const dim = lengthPercentageAutoFromString(value, this.emBasis());
3294
+ const dim = lengthPercentageAutoFromString(value, this.emBasisFor(value));
3278
3295
  setInt8(this.style_view, StyleKeys.INSET_TOP_TYPE, dim.type);
3279
3296
  setFloat32(this.style_view, StyleKeys.INSET_TOP_VALUE, dim.value);
3280
3297
  break;
@@ -3315,7 +3332,7 @@ export class Style {
3315
3332
  switch (typeof value) {
3316
3333
  case 'string': {
3317
3334
  this.prepareMut();
3318
- const dim = lengthPercentageAutoFromString(value, this.emBasis());
3335
+ const dim = lengthPercentageAutoFromString(value, this.emBasisFor(value));
3319
3336
  setInt8(this.style_view, StyleKeys.INSET_BOTTOM_TYPE, dim.type);
3320
3337
  setFloat32(this.style_view, StyleKeys.INSET_BOTTOM_VALUE, dim.value);
3321
3338
  break;
@@ -3366,7 +3383,7 @@ export class Style {
3366
3383
  var marginValue;
3367
3384
  switch (typeof value) {
3368
3385
  case 'string': {
3369
- const dim = lengthPercentageAutoFromString(value, this.emBasis());
3386
+ const dim = lengthPercentageAutoFromString(value, this.emBasisFor(value));
3370
3387
  type = dim.type;
3371
3388
  marginValue = dim.value;
3372
3389
  break;
@@ -3410,7 +3427,7 @@ export class Style {
3410
3427
  switch (typeof value) {
3411
3428
  case 'string': {
3412
3429
  this.prepareMut();
3413
- const dim = lengthPercentageAutoFromString(value, this.emBasis());
3430
+ const dim = lengthPercentageAutoFromString(value, this.emBasisFor(value));
3414
3431
  setInt8(this.style_view, StyleKeys.MARGIN_LEFT_TYPE, dim.type);
3415
3432
  setFloat32(this.style_view, StyleKeys.MARGIN_LEFT_VALUE, dim.value);
3416
3433
  break;
@@ -3451,7 +3468,7 @@ export class Style {
3451
3468
  switch (typeof value) {
3452
3469
  case 'string': {
3453
3470
  this.prepareMut();
3454
- const dim = lengthPercentageAutoFromString(value, this.emBasis());
3471
+ const dim = lengthPercentageAutoFromString(value, this.emBasisFor(value));
3455
3472
  setInt8(this.style_view, StyleKeys.MARGIN_RIGHT_TYPE, dim.type);
3456
3473
  setFloat32(this.style_view, StyleKeys.MARGIN_RIGHT_VALUE, dim.value);
3457
3474
  break;
@@ -3492,7 +3509,7 @@ export class Style {
3492
3509
  switch (typeof value) {
3493
3510
  case 'string': {
3494
3511
  this.prepareMut();
3495
- const dim = lengthPercentageAutoFromString(value, this.emBasis());
3512
+ const dim = lengthPercentageAutoFromString(value, this.emBasisFor(value));
3496
3513
  setInt8(this.style_view, StyleKeys.MARGIN_TOP_TYPE, dim.type);
3497
3514
  setFloat32(this.style_view, StyleKeys.MARGIN_TOP_VALUE, dim.value);
3498
3515
  break;
@@ -3533,7 +3550,7 @@ export class Style {
3533
3550
  switch (typeof value) {
3534
3551
  case 'string': {
3535
3552
  this.prepareMut();
3536
- const dim = lengthPercentageAutoFromString(value, this.emBasis());
3553
+ const dim = lengthPercentageAutoFromString(value, this.emBasisFor(value));
3537
3554
  setInt8(this.style_view, StyleKeys.MARGIN_BOTTOM_TYPE, dim.type);
3538
3555
  setFloat32(this.style_view, StyleKeys.MARGIN_BOTTOM_VALUE, dim.value);
3539
3556
  break;
@@ -3595,7 +3612,7 @@ export class Style {
3595
3612
  switch (typeof value) {
3596
3613
  case 'string': {
3597
3614
  this.prepareMut();
3598
- const dim = lengthPercentageFromString(value, this.emBasis());
3615
+ const dim = lengthPercentageFromString(value, this.emBasisFor(value));
3599
3616
  setInt8(this.style_view, StyleKeys.PADDING_LEFT_TYPE, dim.type);
3600
3617
  setFloat32(this.style_view, StyleKeys.PADDING_LEFT_VALUE, dim.value);
3601
3618
  break;
@@ -3636,7 +3653,7 @@ export class Style {
3636
3653
  switch (typeof value) {
3637
3654
  case 'string': {
3638
3655
  this.prepareMut();
3639
- const dim = lengthPercentageFromString(value, this.emBasis());
3656
+ const dim = lengthPercentageFromString(value, this.emBasisFor(value));
3640
3657
  setInt8(this.style_view, StyleKeys.PADDING_RIGHT_TYPE, dim.type);
3641
3658
  setFloat32(this.style_view, StyleKeys.PADDING_RIGHT_VALUE, dim.value);
3642
3659
  break;
@@ -3677,7 +3694,7 @@ export class Style {
3677
3694
  switch (typeof value) {
3678
3695
  case 'string': {
3679
3696
  this.prepareMut();
3680
- const dim = lengthPercentageFromString(value, this.emBasis());
3697
+ const dim = lengthPercentageFromString(value, this.emBasisFor(value));
3681
3698
  setInt8(this.style_view, StyleKeys.PADDING_TOP_TYPE, dim.type);
3682
3699
  setFloat32(this.style_view, StyleKeys.PADDING_TOP_VALUE, dim.value);
3683
3700
  break;
@@ -3718,7 +3735,7 @@ export class Style {
3718
3735
  switch (typeof value) {
3719
3736
  case 'string': {
3720
3737
  this.prepareMut();
3721
- const dim = lengthPercentageFromString(value, this.emBasis());
3738
+ const dim = lengthPercentageFromString(value, this.emBasisFor(value));
3722
3739
  setInt8(this.style_view, StyleKeys.PADDING_BOTTOM_TYPE, dim.type);
3723
3740
  setFloat32(this.style_view, StyleKeys.PADDING_BOTTOM_VALUE, dim.value);
3724
3741
  break;
@@ -3791,7 +3808,7 @@ export class Style {
3791
3808
  switch (typeof value) {
3792
3809
  case 'string': {
3793
3810
  this.prepareMut();
3794
- const dim = lengthPercentageFromString(value, this.emBasis());
3811
+ const dim = lengthPercentageFromString(value, this.emBasisFor(value));
3795
3812
  setInt8(this.style_view, StyleKeys.GAP_ROW_TYPE, dim.type);
3796
3813
  setFloat32(this.style_view, StyleKeys.GAP_ROW_VALUE, dim.value);
3797
3814
  break;
@@ -3832,7 +3849,7 @@ export class Style {
3832
3849
  switch (typeof value) {
3833
3850
  case 'string': {
3834
3851
  this.prepareMut();
3835
- const dim = lengthPercentageFromString(value, this.emBasis());
3852
+ const dim = lengthPercentageFromString(value, this.emBasisFor(value));
3836
3853
  setInt8(this.style_view, StyleKeys.GAP_COLUMN_TYPE, dim.type);
3837
3854
  setFloat32(this.style_view, StyleKeys.GAP_COLUMN_VALUE, dim.value);
3838
3855
  break;
@@ -3889,7 +3906,7 @@ export class Style {
3889
3906
  switch (typeof value) {
3890
3907
  case 'string': {
3891
3908
  this.prepareMut();
3892
- const dim = dimensionFromString(value, this.emBasis());
3909
+ const dim = dimensionFromString(value, this.emBasisFor(value));
3893
3910
  setInt8(this.style_view, StyleKeys.FLEX_BASIS_TYPE, dim.type);
3894
3911
  setFloat32(this.style_view, StyleKeys.FLEX_BASIS_VALUE, dim.value);
3895
3912
  break;
@@ -5284,7 +5301,7 @@ export class Style {
5284
5301
  /** Read by TextNode when stroking the decoration line. */
5285
5302
  set textDecorationThickness(value) {
5286
5303
  this.prepareMut();
5287
- const devicePx = typeof value === 'number' ? layout.toDevicePixels(finite(value)) : tokenToDevicePx(value, parseFloat(value) || 0, this.emBasis());
5304
+ const devicePx = typeof value === 'number' ? layout.toDevicePixels(finite(value)) : tokenToDevicePx(value, parseFloat(value) || 0, this.emBasisFor(value));
5288
5305
  setFloat32(this.style_view, StyleKeys.DECORATION_THICKNESS, devicePx);
5289
5306
  setInt8(this.style_view, StyleKeys.DECORATION_THICKNESS_STATE, 1);
5290
5307
  this.commitState(StateKeys.DECORATION_THICKNESS);
@@ -6150,7 +6167,7 @@ export class Style {
6150
6167
  indent = n;
6151
6168
  }
6152
6169
  else {
6153
- indent = tokenToDevicePx(token, n, this.emBasis());
6170
+ indent = tokenToDevicePx(token, n, this.emBasisFor(token));
6154
6171
  }
6155
6172
  }
6156
6173
  this.prepareMut();
@@ -6206,7 +6223,7 @@ export class Style {
6206
6223
  set transformOrigin(value) {
6207
6224
  if (!this.style_view)
6208
6225
  return;
6209
- const parsed = parseTransformOrigin(String(value ?? ''), this.emBasis());
6226
+ const parsed = parseTransformOrigin(String(value ?? ''), this.emBasisFor(value));
6210
6227
  if (!parsed)
6211
6228
  return;
6212
6229
  this.prepareMut();