@triniwiz/nativescript-masonkit 1.0.0-beta.117 → 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 (88) hide show
  1. package/DOCS.md +15 -2
  2. package/common.d.ts +10 -9
  3. package/common.js +60 -58
  4. package/common.js.map +1 -1
  5. package/css-math.d.ts +34 -0
  6. package/css-math.js +301 -0
  7. package/css-math.js.map +1 -0
  8. package/css-shorthands.d.ts +24 -0
  9. package/css-shorthands.js +145 -0
  10. package/css-shorthands.js.map +1 -1
  11. package/index.d.ts +45 -0
  12. package/input/common.d.ts +13 -0
  13. package/input/common.js +97 -0
  14. package/input/common.js.map +1 -1
  15. package/package.json +3 -3
  16. package/platforms/android/masonkit-release.aar +0 -0
  17. package/platforms/ios/Mason.xcframework/Info.plist +11 -11
  18. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason-Swift.h +2 -0
  19. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Mason +0 -0
  20. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  21. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.abi.json +6152 -14642
  22. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.private.swiftinterface +31 -7
  23. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  24. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftinterface +31 -7
  25. package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  26. package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +9394 -9349
  27. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason-Swift.h +4 -0
  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 +6152 -14642
  32. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +31 -7
  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 +31 -7
  35. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +6152 -14642
  36. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +31 -7
  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 +31 -7
  39. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/_CodeSignature/CodeResources +26 -26
  40. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +2 -2
  41. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +9388 -9343
  42. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +8953 -8915
  43. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Headers/Mason-Swift.h +2 -0
  44. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Mason +0 -0
  45. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-xros.swiftsourceinfo +0 -0
  46. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.abi.json +6152 -14642
  47. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.private.swiftinterface +31 -7
  48. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.swiftdoc +0 -0
  49. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.swiftinterface +31 -7
  50. package/platforms/ios/Mason.xcframework/xros-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  51. package/platforms/ios/Mason.xcframework/xros-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8883 -8839
  52. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Headers/Mason-Swift.h +2 -0
  53. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Mason +0 -0
  54. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-xros-simulator.swiftsourceinfo +0 -0
  55. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.abi.json +6152 -14642
  56. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.private.swiftinterface +31 -7
  57. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.swiftdoc +0 -0
  58. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.swiftinterface +31 -7
  59. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/_CodeSignature/CodeResources +14 -14
  60. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  61. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8882 -8838
  62. package/platforms/windows/arm64/NativeScript.Mason.dll +0 -0
  63. package/platforms/windows/arm64/NativeScript.Mason.winmd +0 -0
  64. package/platforms/windows/x64/NativeScript.Mason.dll +0 -0
  65. package/platforms/windows/x64/NativeScript.Mason.winmd +0 -0
  66. package/properties.d.ts +20 -9
  67. package/properties.js +285 -70
  68. package/properties.js.map +1 -1
  69. package/style.d.ts +53 -4
  70. package/style.js +382 -66
  71. package/style.js.map +1 -1
  72. package/svelte/README.md +6 -1
  73. package/svelte/package.json +1 -1
  74. package/svelte/src/element-registry.js +1 -1
  75. package/svelte/src/element-registry.js.map +1 -1
  76. package/svelte/src/mason-element-node.d.ts +2 -2
  77. package/svelte/src/mason-element-node.d.ts.map +1 -1
  78. package/svelte/src/mason-element-node.js +1 -1
  79. package/svelte/src/mason-element-node.js.map +1 -1
  80. package/typings/windows.d.ts +1 -1
  81. package/view/index.ios.d.ts +7 -0
  82. package/view/index.ios.js +68 -18
  83. package/view/index.ios.js.map +1 -1
  84. package/web.js +2 -0
  85. package/web.js.map +1 -1
  86. package/windows-mask.d.ts +2 -0
  87. package/windows-mask.js +2 -18
  88. package/windows-mask.js.map +1 -1
package/properties.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CssProperty, CssAnimationProperty, Style, ShorthandProperty, Property } from '@nativescript/core';
1
+ import { CssProperty, CssAnimationProperty, InheritedCssProperty, Style, ShorthandProperty, Property } from '@nativescript/core';
2
2
  import { Display, Overflow, Length, LengthAuto, Position, BoxSizing, GridAutoFlow, AlignContent, VerticalAlign, Float, Clear } from '.';
3
3
  import type { ViewBase } from './common';
4
4
  import type { LonghandValue } from './css-shorthands';
@@ -13,11 +13,6 @@ export declare const textProperty: Property<ViewBase, string>;
13
13
  export declare const displayProperty: CssProperty<Style, Display>;
14
14
  export declare const filterProperty: CssProperty<Style, string>;
15
15
  export declare const borderColorProperty: CssProperty<Style, string>;
16
- export declare const borderProperty: CssProperty<Style, string>;
17
- export declare const borderLeftProperty: CssProperty<Style, string>;
18
- export declare const borderTopProperty: CssProperty<Style, string>;
19
- export declare const borderRightProperty: CssProperty<Style, string>;
20
- export declare const borderBottomProperty: CssProperty<Style, string>;
21
16
  export declare const backgroundProperty: CssProperty<Style, string>;
22
17
  export declare const backgroundImageProperty: CssProperty<Style, string>;
23
18
  export declare const backgroundRepeatProperty: CssProperty<Style, string>;
@@ -76,6 +71,7 @@ export declare const AlignContentParse: (value: any) => unknown;
76
71
  export declare const alignContentProperty: CssProperty<Style, AlignContent>;
77
72
  export declare const justifyItemsProperty: CssProperty<Style, import(".").AlignItems>;
78
73
  export declare const justifySelfProperty: CssProperty<Style, import(".").AlignSelf>;
74
+ export declare const placeShorthands: MasonShorthand[];
79
75
  export declare const JustifyContentIsValid: (value: any) => value is string;
80
76
  export declare const JustifyContentParse: (value: any) => unknown;
81
77
  export declare const flexBasisProperty: CssProperty<Style, LengthAuto>;
@@ -106,12 +102,19 @@ export declare const cornerShapeTopRightProperty: CssProperty<Style, string>;
106
102
  export declare const cornerShapeBottomRightProperty: CssProperty<Style, string>;
107
103
  export declare const cornerShapeBottomLeftProperty: CssProperty<Style, string>;
108
104
  export declare const objectPositionProperty: CssProperty<Style, string>;
109
- export declare const borderStyleProperty: CssProperty<Style, string>;
105
+ export declare const borderTopStyleProperty: CssProperty<Style, string>;
106
+ export declare const borderRightStyleProperty: CssProperty<Style, string>;
107
+ export declare const borderBottomStyleProperty: CssProperty<Style, string>;
108
+ export declare const borderLeftStyleProperty: CssProperty<Style, string>;
110
109
  export declare const borderImageProperty: CssProperty<Style, string>;
111
110
  export declare const fontStretchProperty: CssProperty<Style, string>;
112
111
  export declare const fontFeatureSettingsProperty: CssProperty<Style, string>;
113
112
  export declare const wordSpacingProperty: CssProperty<Style, string>;
114
113
  export declare const hyphensProperty: CssProperty<Style, string>;
114
+ export declare const textIndentProperty: CssProperty<Style, string>;
115
+ export declare const lineClampProperty: CssProperty<Style, string>;
116
+ export declare const webkitLineClampProperty: CssProperty<Style, string>;
117
+ export declare const transformOriginProperty: CssProperty<Style, string>;
115
118
  export declare const backdropFilterProperty: CssProperty<Style, string>;
116
119
  export declare const maskImageProperty: CssProperty<Style, string>;
117
120
  export declare const maskSizeProperty: CssAnimationProperty<Style, string>;
@@ -133,7 +136,15 @@ export declare const maskBorderProperty: ShorthandProperty<Style, any>;
133
136
  export declare const writingModeProperty: CssProperty<Style, string>;
134
137
  export declare const unicodeBidiProperty: CssProperty<Style, string>;
135
138
  export declare const caretColorProperty: CssProperty<Style, string>;
136
- export declare const listStyleTypeProperty: CssProperty<Style, string>;
137
- export declare const listStylePositionProperty: CssProperty<Style, string>;
139
+ export declare const listStyleTypeProperty: InheritedCssProperty<Style, string>;
140
+ export declare const listStylePositionProperty: InheritedCssProperty<Style, string>;
141
+ export declare const listStyleShorthand: MasonShorthand;
142
+ export declare const listStyleProperty: ShorthandProperty<Style, any>;
143
+ export declare const borderStyleProperty: ShorthandProperty<Style, any>;
144
+ export declare const borderProperty: ShorthandProperty<Style, any>;
145
+ export declare const borderTopProperty: ShorthandProperty<Style, any>;
146
+ export declare const borderRightProperty: ShorthandProperty<Style, any>;
147
+ export declare const borderBottomProperty: ShorthandProperty<Style, any>;
148
+ export declare const borderLeftProperty: ShorthandProperty<Style, any>;
138
149
  export declare const masonShorthands: MasonShorthand[];
139
150
  export {};
package/properties.js CHANGED
@@ -1,14 +1,16 @@
1
- import { CssProperty, CssAnimationProperty, backgroundColorProperty, Style, ShorthandProperty, Length as CoreLength, fontSizeProperty, textAlignmentProperty, textDecorationProperty, textTransformProperty, PercentLength as CorePercentLength, Trace, CoreTypes, unsetValue, verticalAlignmentProperty, textShadowProperty, Font, Property, makeParser, makeValidator, marginTopProperty, marginRightProperty, marginBottomProperty, marginLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, paddingLeftProperty, borderTopWidthProperty, borderRightWidthProperty, borderBottomWidthProperty, borderLeftWidthProperty, minWidthProperty, minHeightProperty, widthProperty, heightProperty } from '@nativescript/core';
1
+ import { CssProperty, CssAnimationProperty, InheritedCssProperty, backgroundColorProperty, Style, ShorthandProperty, Length as CoreLength, fontSizeProperty, textAlignmentProperty, textDecorationProperty, textTransformProperty, PercentLength as CorePercentLength, Trace, CoreTypes, unsetValue, verticalAlignmentProperty, textShadowProperty, Font, Property, makeParser, makeValidator, marginTopProperty, marginRightProperty, marginBottomProperty, marginLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, paddingLeftProperty, borderTopWidthProperty, borderRightWidthProperty, borderBottomWidthProperty, borderLeftWidthProperty, minWidthProperty, minHeightProperty, widthProperty, heightProperty } from '@nativescript/core';
2
2
  import { isMasonView_, touchAction_ } from './symbols';
3
3
  /** Marks a Style whose size accessors already resolve Mason's units. */
4
4
  const MASON_SIZE_UNITS = Symbol('mason:size-units');
5
5
  import { cssLengthToDip, parseAspectRatio } from './style';
6
+ import { isCssMathFunction } from './css-math';
6
7
  import { alignItemsProperty, alignSelfProperty, flexDirectionProperty, flexGrowProperty, flexShrinkProperty, flexWrapProperty, justifyContentProperty } from '@nativescript/core/ui/layouts/flexbox-layout';
7
8
  import { parseCSSShadow } from '@nativescript/core/ui/styling/css-shadow';
8
9
  import { installKeyframes, interpolatePositionList, interpolateSizeList, registerKeyframeProperty } from './css-keyframes';
9
10
  import { borderTopLeftRadiusProperty, borderTopRightRadiusProperty, borderBottomRightRadiusProperty, borderBottomLeftRadiusProperty, borderTopColorProperty, borderRightColorProperty, borderBottomColorProperty, borderLeftColorProperty } from '@nativescript/core/ui/styling/style-properties';
10
- import { BORDER_WIDTH_KEYWORDS, splitBackground, splitMask, splitMaskBorder, splitWebkitMask, webkitMaskBox, webkitMaskComposite, splitBorderColor, splitBorderRadius, splitBorderWidth, splitFlex, splitFlexFlow, splitGap, splitMargin, splitOverflow, splitPadding } from './css-shorthands';
11
+ import { BORDER_WIDTH_KEYWORDS, passThrough, splitBorder, splitBorderSide, splitBorderStyle, splitBorderStyleStartEnd, splitBorderWidthStartEnd, splitBorderColorStartEnd, splitInsetStartEnd, splitMarginStartEnd, splitPaddingStartEnd, splitBackground, splitMask, splitMaskBorder, splitWebkitMask, webkitMaskBox, webkitMaskComposite, splitBorderColor, splitBorderRadius, splitBorderWidth, splitFlex, splitFlexFlow, splitGap, splitMargin, splitOverflow, splitPadding } from './css-shorthands';
11
12
  import { cssLength, isCssLength, toCamelCase } from './css-shorthands';
13
+ import { splitListStyle, splitPlace } from './css-shorthands';
12
14
  function getViewStyle(view) {
13
15
  const ret = (__ANDROID__ ? view?.get() : view?.deref());
14
16
  // Undefined for a plain NativeScript view (and for a cleared ref): only mason's
@@ -111,6 +113,11 @@ export const displayProperty = new CssProperty({
111
113
  case 'inline-flex':
112
114
  case 'inline-grid':
113
115
  return value;
116
+ // The legacy boxes `line-clamp` utilities ask for.
117
+ case '-webkit-box':
118
+ return 'block';
119
+ case '-webkit-inline-box':
120
+ return 'inline-block';
114
121
  default:
115
122
  return undefined;
116
123
  }
@@ -124,26 +131,6 @@ export const borderColorProperty = new CssProperty({
124
131
  name: 'borderColor',
125
132
  cssName: 'border-color',
126
133
  });
127
- export const borderProperty = new CssProperty({
128
- name: 'border',
129
- cssName: 'border',
130
- });
131
- export const borderLeftProperty = new CssProperty({
132
- name: 'borderLeft',
133
- cssName: 'border-left',
134
- });
135
- export const borderTopProperty = new CssProperty({
136
- name: 'borderTop',
137
- cssName: 'border-top',
138
- });
139
- export const borderRightProperty = new CssProperty({
140
- name: 'borderRight',
141
- cssName: 'border-right',
142
- });
143
- export const borderBottomProperty = new CssProperty({
144
- name: 'borderBottom',
145
- cssName: 'border-bottom',
146
- });
147
134
  export const backgroundProperty = new CssProperty({
148
135
  name: 'background',
149
136
  cssName: 'background',
@@ -586,7 +573,12 @@ fontSizeProperty.overrideHandlers({
586
573
  if (newValue) {
587
574
  if (typeof newValue === 'string') {
588
575
  // @ts-ignore
589
- if (newValue.indexOf('%') !== -1) {
576
+ if (isCssMathFunction(newValue)) {
577
+ // Mason's setter evaluates calc()/min()/max()/clamp() itself.
578
+ view.fontSize = newValue;
579
+ // @ts-ignore
580
+ }
581
+ else if (newValue.indexOf('%') !== -1) {
590
582
  view.fontSize = {
591
583
  value: parseFloat(newValue) / 100,
592
584
  unit: '%',
@@ -631,16 +623,10 @@ export const rowGapProperty = new CssProperty({
631
623
  name: 'rowGap',
632
624
  cssName: 'row-gap',
633
625
  defaultValue: 0,
634
- // Length.parse has no '%' handling; use masonLengthPercentParse instead.
635
- valueConverter(value) {
636
- // @ts-ignore
637
- const parsed = masonLengthPercentParse(value);
638
- if (parsed === undefined || typeof parsed === 'string') {
639
- return 0;
640
- }
641
- // @ts-ignore
642
- return parsed;
643
- },
626
+ // @ts-ignore
627
+ valueConverter: masonGapConverter,
628
+ // @ts-ignore
629
+ equalityComparer: masonLengthEquals,
644
630
  valueChanged(target, oldValue, newValue) {
645
631
  if (appliedInSetNative(target, rowGapProperty))
646
632
  return;
@@ -654,15 +640,10 @@ export const columnGapProperty = new CssProperty({
654
640
  name: 'columnGap',
655
641
  cssName: 'column-gap',
656
642
  defaultValue: 0,
657
- valueConverter(value) {
658
- // @ts-ignore
659
- const parsed = masonLengthPercentParse(value);
660
- if (parsed === undefined || typeof parsed === 'string') {
661
- return 0;
662
- }
663
- // @ts-ignore
664
- return parsed;
665
- },
643
+ // @ts-ignore
644
+ valueConverter: masonGapConverter,
645
+ // @ts-ignore
646
+ equalityComparer: masonLengthEquals,
666
647
  valueChanged(target, oldValue, newValue) {
667
648
  if (appliedInSetNative(target, columnGapProperty))
668
649
  return;
@@ -672,11 +653,25 @@ export const columnGapProperty = new CssProperty({
672
653
  }
673
654
  },
674
655
  });
656
+ /** A gap longhand as CSS text: CSS text as is, a number in px, a core length as `<n><unit>`. */
657
+ function gapText(value) {
658
+ if (typeof value === 'number') {
659
+ return `${value}px`;
660
+ }
661
+ if (value && typeof value === 'object') {
662
+ const { value: amount, unit } = value;
663
+ return unit === '%' ? `${Math.round((amount ?? 0) * 1e6) / 1e4}%` : `${amount ?? 0}${unit === 'dip' ? 'px' : (unit ?? 'px')}`;
664
+ }
665
+ return String(value ?? '');
666
+ }
675
667
  function gapGetter() {
676
668
  if (this.rowGap === this.columnGap) {
677
669
  return this.rowGap;
678
670
  }
679
- return `${this.rowGap} ${this.columnGap}`;
671
+ const row = gapText(this.rowGap);
672
+ const column = gapText(this.columnGap);
673
+ // Two equal parses are different objects.
674
+ return row === column ? row : `${row} ${column}`;
680
675
  }
681
676
  const gapShorthand = { cssName: 'gap', longhands: [rowGapProperty, columnGapProperty], split: splitGap };
682
677
  const gridGapShorthand = { ...gapShorthand, cssName: 'grid-gap' };
@@ -730,6 +725,40 @@ function masonLengthPercentParse(value) {
730
725
  return undefined;
731
726
  }
732
727
  }
728
+ /** Lengths in units core's parsers read as bare numbers. */
729
+ const UNITS_CORE_MISREADS = /^[+-]?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?(r?em|pt|vw|vh|vmin|vmax|dppx)$/i;
730
+ /** CSS text for a length in a unit core can't parse (rem, em, vw), else undefined. */
731
+ function masonLengthText(value) {
732
+ if (typeof value !== 'string') {
733
+ return undefined;
734
+ }
735
+ const t = value.trim();
736
+ // Core can't evaluate math functions either; Mason's setter does.
737
+ return UNITS_CORE_MISREADS.test(t) || isCssMathFunction(t) ? t : undefined;
738
+ }
739
+ /** `left`/`top`/`right`/`bottom`: Mason's units, else core's parse (`%`, `auto`). */
740
+ function masonInsetConverter(value) {
741
+ return (masonLengthText(value) ?? masonLengthPercentParse(value));
742
+ }
743
+ /** `row-gap`/`column-gap`: as the insets, but anything unparsable is 0. */
744
+ function masonGapConverter(value) {
745
+ const text = masonLengthText(value);
746
+ if (text !== undefined) {
747
+ return text;
748
+ }
749
+ const parsed = masonLengthPercentParse(value);
750
+ if (parsed === undefined || typeof parsed === 'string') {
751
+ return 0;
752
+ }
753
+ return parsed;
754
+ }
755
+ /** Compares CSS text as text: core's `PercentLength.equals` calls any two strings equal. */
756
+ function masonLengthEquals(a, b) {
757
+ if (typeof a === 'string' || typeof b === 'string') {
758
+ return a === b;
759
+ }
760
+ return CorePercentLength.equals(a, b);
761
+ }
733
762
  /** As `masonSizeConverter`, for Mason's own max-* properties (core has none). */
734
763
  function masonMaxSizeConverter(value) {
735
764
  const resolved = masonSizeValue(value);
@@ -945,10 +974,10 @@ function convertToInsets(value) {
945
974
  if (typeof value === 'string' && value !== 'auto') {
946
975
  const thickness = parseShorthandPositioning(value);
947
976
  return [
948
- [topProperty, masonLengthPercentParse(thickness.top)],
949
- [rightProperty, masonLengthPercentParse(thickness.right)],
950
- [bottomProperty, masonLengthPercentParse(thickness.bottom)],
951
- [leftProperty, masonLengthPercentParse(thickness.left)],
977
+ [topProperty, masonInsetConverter(thickness.top)],
978
+ [rightProperty, masonInsetConverter(thickness.right)],
979
+ [bottomProperty, masonInsetConverter(thickness.bottom)],
980
+ [leftProperty, masonInsetConverter(thickness.left)],
952
981
  ];
953
982
  }
954
983
  else {
@@ -965,9 +994,9 @@ export const leftProperty = new CssProperty({
965
994
  cssName: 'left',
966
995
  defaultValue: 'auto',
967
996
  // @ts-ignore
968
- equalityComparer: CorePercentLength.equals,
997
+ equalityComparer: masonLengthEquals,
969
998
  // @ts-ignore
970
- valueConverter: masonLengthPercentParse,
999
+ valueConverter: masonInsetConverter,
971
1000
  valueChanged(target, oldValue, newValue) {
972
1001
  if (appliedInSetNative(target, leftProperty))
973
1002
  return;
@@ -982,9 +1011,9 @@ export const rightProperty = new CssProperty({
982
1011
  cssName: 'right',
983
1012
  defaultValue: 'auto',
984
1013
  // @ts-ignore
985
- equalityComparer: CorePercentLength.equals,
1014
+ equalityComparer: masonLengthEquals,
986
1015
  // @ts-ignore
987
- valueConverter: masonLengthPercentParse,
1016
+ valueConverter: masonInsetConverter,
988
1017
  valueChanged(target, oldValue, newValue) {
989
1018
  if (appliedInSetNative(target, rightProperty))
990
1019
  return;
@@ -999,9 +1028,9 @@ export const topProperty = new CssProperty({
999
1028
  cssName: 'top',
1000
1029
  defaultValue: 'auto',
1001
1030
  // @ts-ignore
1002
- equalityComparer: CorePercentLength.equals,
1031
+ equalityComparer: masonLengthEquals,
1003
1032
  // @ts-ignore
1004
- valueConverter: masonLengthPercentParse,
1033
+ valueConverter: masonInsetConverter,
1005
1034
  valueChanged(target, oldValue, newValue) {
1006
1035
  if (appliedInSetNative(target, topProperty))
1007
1036
  return;
@@ -1016,9 +1045,9 @@ export const bottomProperty = new CssProperty({
1016
1045
  cssName: 'bottom',
1017
1046
  defaultValue: 'auto',
1018
1047
  // @ts-ignore
1019
- equalityComparer: CorePercentLength.equals,
1048
+ equalityComparer: masonLengthEquals,
1020
1049
  // @ts-ignore
1021
- valueConverter: masonLengthPercentParse,
1050
+ valueConverter: masonInsetConverter,
1022
1051
  valueChanged(target, oldValue, newValue) {
1023
1052
  if (appliedInSetNative(target, bottomProperty))
1024
1053
  return;
@@ -1198,6 +1227,14 @@ export const justifySelfProperty = new CssProperty({
1198
1227
  }
1199
1228
  },
1200
1229
  });
1230
+ export const placeShorthands = [
1231
+ { cssName: 'place-items', longhands: [alignItemsProperty, justifyItemsProperty], split: splitPlace },
1232
+ { cssName: 'place-content', longhands: [alignContentProperty, justifyContentProperty], split: splitPlace },
1233
+ { cssName: 'place-self', longhands: [alignSelfProperty, justifySelfProperty], split: splitPlace },
1234
+ ];
1235
+ for (const entry of placeShorthands) {
1236
+ masonShorthandProperty(entry).register(Style);
1237
+ }
1201
1238
  export const JustifyContentIsValid = makeValidator('flex-start', 'flex-end', 'center', 'space-between', 'space-around', 'space-evenly', 'stretch', 'normal', 'start', 'end');
1202
1239
  export const JustifyContentParse = makeParser(JustifyContentIsValid);
1203
1240
  justifyContentProperty.overrideHandlers({
@@ -1230,10 +1267,9 @@ export const flexBasisProperty = new CssProperty({
1230
1267
  cssName: 'flex-basis',
1231
1268
  defaultValue: 'auto',
1232
1269
  // @ts-ignore
1233
- equalityComparer: CorePercentLength.equals,
1234
- // masonLengthParse has no '%' support; see maxWidthProperty above.
1270
+ equalityComparer: masonLengthEquals,
1235
1271
  // @ts-ignore
1236
- valueConverter: masonLengthPercentParse,
1272
+ valueConverter: masonInsetConverter,
1237
1273
  valueChanged(target, oldValue, newValue) {
1238
1274
  if (appliedInSetNative(target, flexBasisProperty))
1239
1275
  return;
@@ -1638,11 +1674,6 @@ backgroundPositionYProperty.register(Style);
1638
1674
  backgroundOriginProperty.register(Style);
1639
1675
  backgroundAttachmentProperty.register(Style);
1640
1676
  backgroundBlendModeProperty.register(Style);
1641
- borderProperty.register(Style);
1642
- borderLeftProperty.register(Style);
1643
- borderTopProperty.register(Style);
1644
- borderRightProperty.register(Style);
1645
- borderBottomProperty.register(Style);
1646
1677
  filterProperty.register(Style);
1647
1678
  registerAlongsideCore(borderColorProperty);
1648
1679
  // New CSS properties
@@ -1657,9 +1688,25 @@ export const objectPositionProperty = new CssProperty({
1657
1688
  }
1658
1689
  },
1659
1690
  });
1660
- export const borderStyleProperty = new CssProperty({
1661
- name: 'borderStyle',
1662
- cssName: 'border-style',
1691
+ // Per-side style longhands; `border-style`, `border` and `border-<side>` expand into them.
1692
+ export const borderTopStyleProperty = new CssProperty({
1693
+ name: 'borderTopStyle',
1694
+ cssName: 'border-top-style',
1695
+ defaultValue: 'none',
1696
+ });
1697
+ export const borderRightStyleProperty = new CssProperty({
1698
+ name: 'borderRightStyle',
1699
+ cssName: 'border-right-style',
1700
+ defaultValue: 'none',
1701
+ });
1702
+ export const borderBottomStyleProperty = new CssProperty({
1703
+ name: 'borderBottomStyle',
1704
+ cssName: 'border-bottom-style',
1705
+ defaultValue: 'none',
1706
+ });
1707
+ export const borderLeftStyleProperty = new CssProperty({
1708
+ name: 'borderLeftStyle',
1709
+ cssName: 'border-left-style',
1663
1710
  defaultValue: 'none',
1664
1711
  });
1665
1712
  export const borderImageProperty = new CssProperty({
@@ -1716,6 +1763,47 @@ export const hyphensProperty = new CssProperty({
1716
1763
  }
1717
1764
  },
1718
1765
  });
1766
+ export const textIndentProperty = new CssProperty({
1767
+ name: 'textIndent',
1768
+ cssName: 'text-indent',
1769
+ defaultValue: '0px',
1770
+ valueChanged(target, oldValue, newValue) {
1771
+ const view = getViewStyle(target.viewRef);
1772
+ if (view) {
1773
+ view.textIndent = newValue;
1774
+ }
1775
+ },
1776
+ });
1777
+ function setLineClamp(target, value) {
1778
+ const view = getViewStyle(target.viewRef);
1779
+ if (view) {
1780
+ view.lineClamp = (value ?? 'none');
1781
+ }
1782
+ }
1783
+ export const lineClampProperty = new CssProperty({
1784
+ name: 'lineClamp',
1785
+ cssName: 'line-clamp',
1786
+ defaultValue: 'none',
1787
+ valueChanged: (target, oldValue, newValue) => setLineClamp(target, newValue),
1788
+ });
1789
+ // Tailwind's `line-clamp-*` pairs this with `display: -webkit-box`, read as block.
1790
+ export const webkitLineClampProperty = new CssProperty({
1791
+ name: 'webkitLineClamp',
1792
+ cssName: '-webkit-line-clamp',
1793
+ defaultValue: 'none',
1794
+ valueChanged: (target, oldValue, newValue) => setLineClamp(target, newValue),
1795
+ });
1796
+ export const transformOriginProperty = new CssProperty({
1797
+ name: 'transformOrigin',
1798
+ cssName: 'transform-origin',
1799
+ defaultValue: '50% 50%',
1800
+ valueChanged(target, oldValue, newValue) {
1801
+ const view = getViewStyle(target.viewRef);
1802
+ if (view) {
1803
+ view.transformOrigin = newValue;
1804
+ }
1805
+ },
1806
+ });
1719
1807
  export const backdropFilterProperty = new CssProperty({
1720
1808
  name: 'backdropFilter',
1721
1809
  cssName: 'backdrop-filter',
@@ -2019,12 +2107,19 @@ export const caretColorProperty = new CssProperty({
2019
2107
  },
2020
2108
  });
2021
2109
  objectPositionProperty.register(Style);
2022
- borderStyleProperty.register(Style);
2110
+ borderTopStyleProperty.register(Style);
2111
+ borderRightStyleProperty.register(Style);
2112
+ borderBottomStyleProperty.register(Style);
2113
+ borderLeftStyleProperty.register(Style);
2023
2114
  borderImageProperty.register(Style);
2024
2115
  fontStretchProperty.register(Style);
2025
2116
  fontFeatureSettingsProperty.register(Style);
2026
2117
  wordSpacingProperty.register(Style);
2027
2118
  hyphensProperty.register(Style);
2119
+ textIndentProperty.register(Style);
2120
+ lineClampProperty.register(Style);
2121
+ webkitLineClampProperty.register(Style);
2122
+ transformOriginProperty.register(Style);
2028
2123
  backdropFilterProperty.register(Style);
2029
2124
  maskImageProperty.register(Style);
2030
2125
  maskProperty.register(Style);
@@ -2061,16 +2156,24 @@ writingModeProperty.register(Style);
2061
2156
  unicodeBidiProperty.register(Style);
2062
2157
  caretColorProperty.register(Style);
2063
2158
  registerAlongsideCore(backgroundImageProperty);
2064
- export const listStyleTypeProperty = new CssProperty({
2159
+ // Inherited, as in CSS, so a list's value reaches its items.
2160
+ export const listStyleTypeProperty = new InheritedCssProperty({
2065
2161
  name: 'listStyleType',
2066
2162
  cssName: 'list-style-type',
2067
2163
  });
2068
- export const listStylePositionProperty = new CssProperty({
2164
+ export const listStylePositionProperty = new InheritedCssProperty({
2069
2165
  name: 'listStylePosition',
2070
2166
  cssName: 'list-style-position',
2071
2167
  });
2072
2168
  listStyleTypeProperty.register(Style);
2073
2169
  listStylePositionProperty.register(Style);
2170
+ export const listStyleShorthand = { cssName: 'list-style', longhands: [listStyleTypeProperty, listStylePositionProperty], split: splitListStyle };
2171
+ export const listStyleProperty = masonShorthandProperty(listStyleShorthand, function () {
2172
+ const style = this;
2173
+ const parts = [style.listStyleType, style.listStylePosition].filter((part) => typeof part === 'string' && part);
2174
+ return parts.join(' ');
2175
+ });
2176
+ listStyleProperty.register(Style);
2074
2177
  // core owns `white-space` too (its Label honours nowrap), so dispatch.
2075
2178
  registerAlongsideCore(whiteSpaceProperty);
2076
2179
  objectFitProperty.register(Style);
@@ -2142,5 +2245,117 @@ const coreShorthands = [
2142
2245
  for (const entry of coreShorthands) {
2143
2246
  masonShorthandProperty(entry);
2144
2247
  }
2145
- export const masonShorthands = [...coreShorthands, overflowShorthand, maskShorthand, webkitMaskShorthand, maskBorderShorthand, webkitMaskBoxImageShorthand, gapShorthand, gridGapShorthand, flexFlowShorthand, flexShorthand];
2248
+ // `border`, `border-<side>` and `border-style` expand into the width, style and
2249
+ // color longhands, so the cascade resolves each longhand on its own.
2250
+ const SIDES = ['top', 'right', 'bottom', 'left'];
2251
+ /** A longhand's value as CSS text, for the shorthand getters. */
2252
+ function cssText(value) {
2253
+ if (value == null || value === unsetValue) {
2254
+ return '';
2255
+ }
2256
+ if (typeof value === 'string') {
2257
+ return value;
2258
+ }
2259
+ if (typeof value === 'number') {
2260
+ return `${value}px`;
2261
+ }
2262
+ if (isCssLength(value)) {
2263
+ return value.css;
2264
+ }
2265
+ const { hex, unit, value: amount } = value;
2266
+ if (typeof hex === 'string') {
2267
+ return hex;
2268
+ }
2269
+ if (typeof amount === 'number') {
2270
+ return unit === '%' ? `${amount * 100}%` : `${amount}px`;
2271
+ }
2272
+ return String(value);
2273
+ }
2274
+ const borderStyleLonghands = [borderTopStyleProperty, borderRightStyleProperty, borderBottomStyleProperty, borderLeftStyleProperty];
2275
+ const borderStyleShorthand = { cssName: 'border-style', longhands: borderStyleLonghands, split: splitBorderStyle };
2276
+ const borderShorthand = { cssName: 'border', longhands: [...borderWidthLonghands, ...borderStyleLonghands, ...borderColorLonghands], split: splitBorder };
2277
+ const borderSideShorthands = [0, 1, 2, 3].map((i) => ({
2278
+ cssName: `border-${SIDES[i]}`,
2279
+ longhands: [borderWidthLonghands[i], borderStyleLonghands[i], borderColorLonghands[i]],
2280
+ split: splitBorderSide,
2281
+ }));
2282
+ function sideValues(style, longhands) {
2283
+ return longhands.map(({ name }) => cssText(style[name]));
2284
+ }
2285
+ /** The shared value when every side agrees, else undefined. */
2286
+ function uniformSides(values) {
2287
+ return values.every((value) => value === values[0]) ? values[0] : undefined;
2288
+ }
2289
+ export const borderStyleProperty = masonShorthandProperty(borderStyleShorthand, function () {
2290
+ const styles = sideValues(this, borderStyleLonghands);
2291
+ return uniformSides(styles) ?? styles.join(' ');
2292
+ });
2293
+ export const borderProperty = masonShorthandProperty(borderShorthand, function () {
2294
+ const width = uniformSides(sideValues(this, borderWidthLonghands));
2295
+ const style = uniformSides(sideValues(this, borderStyleLonghands));
2296
+ const color = uniformSides(sideValues(this, borderColorLonghands));
2297
+ return width !== undefined && style !== undefined && color !== undefined ? [width, style, color].filter(Boolean).join(' ') : '';
2298
+ });
2299
+ function borderSideGetter(i) {
2300
+ return function () {
2301
+ return sideValues(this, [borderWidthLonghands[i], borderStyleLonghands[i], borderColorLonghands[i]]).filter(Boolean).join(' ');
2302
+ };
2303
+ }
2304
+ export const borderTopProperty = masonShorthandProperty(borderSideShorthands[0], borderSideGetter(0));
2305
+ export const borderRightProperty = masonShorthandProperty(borderSideShorthands[1], borderSideGetter(1));
2306
+ export const borderBottomProperty = masonShorthandProperty(borderSideShorthands[2], borderSideGetter(2));
2307
+ export const borderLeftProperty = masonShorthandProperty(borderSideShorthands[3], borderSideGetter(3));
2308
+ borderStyleProperty.register(Style);
2309
+ borderProperty.register(Style);
2310
+ borderTopProperty.register(Style);
2311
+ borderRightProperty.register(Style);
2312
+ borderBottomProperty.register(Style);
2313
+ borderLeftProperty.register(Style);
2314
+ const LOGICAL_SIDES = [
2315
+ ['block-start', 0],
2316
+ ['inline-end', 1],
2317
+ ['block-end', 2],
2318
+ ['inline-start', 3],
2319
+ ];
2320
+ /** `<prefix>-inline<suffix>`, `<prefix>-block<suffix>` and the four `-start`/`-end` sides. */
2321
+ function logicalSides(prefix, suffix, sides, splitAxis) {
2322
+ const inline = { cssName: `${prefix}-inline${suffix}`, longhands: [sides[3], sides[1]], split: splitAxis };
2323
+ const block = { cssName: `${prefix}-block${suffix}`, longhands: [sides[0], sides[2]], split: splitAxis };
2324
+ const perSide = LOGICAL_SIDES.map(([side, i]) => ({ cssName: `${prefix}-${side}${suffix}`, longhands: [sides[i]], split: passThrough }));
2325
+ return [inline, block, ...perSide];
2326
+ }
2327
+ const borderSideLonghands = (i) => [borderWidthLonghands[i], borderStyleLonghands[i], borderColorLonghands[i]];
2328
+ const logicalShorthands = [
2329
+ ...logicalSides('margin', '', marginLonghands, splitMarginStartEnd),
2330
+ ...logicalSides('padding', '', paddingLonghands, splitPaddingStartEnd),
2331
+ ...logicalSides('inset', '', [topProperty, rightProperty, bottomProperty, leftProperty], splitInsetStartEnd),
2332
+ ...logicalSides('border', '-width', borderWidthLonghands, splitBorderWidthStartEnd),
2333
+ ...logicalSides('border', '-style', borderStyleLonghands, splitBorderStyleStartEnd),
2334
+ ...logicalSides('border', '-color', borderColorLonghands, splitBorderColorStartEnd),
2335
+ // `border-inline: 1px solid` gives both sides the same border.
2336
+ { cssName: 'border-inline', longhands: [...borderSideLonghands(3), ...borderSideLonghands(1)], split: (value) => [...splitBorderSide(value), ...splitBorderSide(value)] },
2337
+ { cssName: 'border-block', longhands: [...borderSideLonghands(0), ...borderSideLonghands(2)], split: (value) => [...splitBorderSide(value), ...splitBorderSide(value)] },
2338
+ ...LOGICAL_SIDES.map(([side, i]) => ({ cssName: `border-${side}`, longhands: borderSideLonghands(i), split: splitBorderSide })),
2339
+ // Corners are <block>-<inline>: start-start is top-left.
2340
+ { cssName: 'border-start-start-radius', longhands: [borderTopLeftRadiusProperty], split: passThrough },
2341
+ { cssName: 'border-start-end-radius', longhands: [borderTopRightRadiusProperty], split: passThrough },
2342
+ { cssName: 'border-end-end-radius', longhands: [borderBottomRightRadiusProperty], split: passThrough },
2343
+ { cssName: 'border-end-start-radius', longhands: [borderBottomLeftRadiusProperty], split: passThrough },
2344
+ { cssName: 'inline-size', longhands: [widthProperty], split: passThrough },
2345
+ { cssName: 'block-size', longhands: [heightProperty], split: passThrough },
2346
+ { cssName: 'min-inline-size', longhands: [minWidthProperty], split: passThrough },
2347
+ { cssName: 'min-block-size', longhands: [minHeightProperty], split: passThrough },
2348
+ { cssName: 'max-inline-size', longhands: [maxWidthProperty], split: passThrough },
2349
+ { cssName: 'max-block-size', longhands: [maxHeightProperty], split: passThrough },
2350
+ { cssName: 'overflow-inline', longhands: [overflowXProperty], split: passThrough },
2351
+ { cssName: 'overflow-block', longhands: [overflowYProperty], split: passThrough },
2352
+ ];
2353
+ for (const entry of logicalShorthands) {
2354
+ masonShorthandProperty(entry, function () {
2355
+ const parts = entry.longhands.map((longhand) => cssText(this[longhand.name]));
2356
+ // The axis shorthands read back as one value when both sides agree.
2357
+ return entry.longhands.length === 2 && parts[0] === parts[1] ? parts[0] : parts.join(' ');
2358
+ }).register(Style);
2359
+ }
2360
+ export const masonShorthands = [...coreShorthands, borderStyleShorthand, borderShorthand, ...borderSideShorthands, ...logicalShorthands, overflowShorthand, maskShorthand, webkitMaskShorthand, maskBorderShorthand, webkitMaskBoxImageShorthand, gapShorthand, gridGapShorthand, flexFlowShorthand, flexShorthand];
2146
2361
  //# sourceMappingURL=properties.js.map