@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.
- package/DOCS.md +15 -2
- package/common.d.ts +10 -9
- package/common.js +60 -58
- package/common.js.map +1 -1
- package/css-math.d.ts +34 -0
- package/css-math.js +301 -0
- package/css-math.js.map +1 -0
- package/css-shorthands.d.ts +24 -0
- package/css-shorthands.js +145 -0
- package/css-shorthands.js.map +1 -1
- package/index.d.ts +45 -0
- package/input/common.d.ts +13 -0
- package/input/common.js +97 -0
- package/input/common.js.map +1 -1
- package/package.json +3 -3
- package/platforms/android/masonkit-release.aar +0 -0
- package/platforms/ios/Mason.xcframework/Info.plist +11 -11
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason-Swift.h +2 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Mason +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.abi.json +6152 -14642
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.private.swiftinterface +31 -7
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftinterface +31 -7
- package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +9394 -9349
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason-Swift.h +4 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Mason +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.abi.json +6152 -14642
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +31 -7
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftinterface +31 -7
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +6152 -14642
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +31 -7
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +31 -7
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/_CodeSignature/CodeResources +26 -26
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +2 -2
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +9388 -9343
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +8953 -8915
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Headers/Mason-Swift.h +2 -0
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Mason +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-xros.swiftsourceinfo +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.abi.json +6152 -14642
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.private.swiftinterface +31 -7
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.swiftdoc +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.swiftinterface +31 -7
- package/platforms/ios/Mason.xcframework/xros-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8883 -8839
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Headers/Mason-Swift.h +2 -0
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Mason +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-xros-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.abi.json +6152 -14642
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.private.swiftinterface +31 -7
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.swiftdoc +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.swiftinterface +31 -7
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/_CodeSignature/CodeResources +14 -14
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8882 -8838
- package/platforms/windows/arm64/NativeScript.Mason.dll +0 -0
- package/platforms/windows/arm64/NativeScript.Mason.winmd +0 -0
- package/platforms/windows/x64/NativeScript.Mason.dll +0 -0
- package/platforms/windows/x64/NativeScript.Mason.winmd +0 -0
- package/properties.d.ts +20 -9
- package/properties.js +285 -70
- package/properties.js.map +1 -1
- package/style.d.ts +53 -4
- package/style.js +382 -66
- package/style.js.map +1 -1
- package/svelte/README.md +6 -1
- package/svelte/package.json +1 -1
- package/svelte/src/element-registry.js +1 -1
- package/svelte/src/element-registry.js.map +1 -1
- package/svelte/src/mason-element-node.d.ts +2 -2
- package/svelte/src/mason-element-node.d.ts.map +1 -1
- package/svelte/src/mason-element-node.js +1 -1
- package/svelte/src/mason-element-node.js.map +1 -1
- package/typings/windows.d.ts +1 -1
- package/view/index.ios.d.ts +7 -0
- package/view/index.ios.js +68 -18
- package/view/index.ios.js.map +1 -1
- package/web.js +2 -0
- package/web.js.map +1 -1
- package/windows-mask.d.ts +2 -0
- package/windows-mask.js +2 -18
- package/windows-mask.js.map +1 -1
package/DOCS.md
CHANGED
|
@@ -386,6 +386,8 @@ All components that extend `View` support the following layout properties, setta
|
|
|
386
386
|
|
|
387
387
|
Length values support `px`, `%`, `dip`, and `auto` (for margins).
|
|
388
388
|
|
|
389
|
+
The logical forms `margin-inline`, `margin-block`, `padding-inline`, `padding-block` and their `-start` / `-end` longhands are supported and map to the physical sides for left-to-right, horizontal text (inline-start is left, block-start is top).
|
|
390
|
+
|
|
389
391
|
---
|
|
390
392
|
|
|
391
393
|
### Sizing
|
|
@@ -399,6 +401,8 @@ Length values support `px`, `%`, `dip`, and `auto` (for margins).
|
|
|
399
401
|
| `maxWidth` | `LengthAuto` | Maximum width |
|
|
400
402
|
| `maxHeight` | `LengthAuto` | Maximum height |
|
|
401
403
|
|
|
404
|
+
`inline-size`, `block-size` and their `min-` / `max-` forms map to width and height.
|
|
405
|
+
|
|
402
406
|
## Transforms
|
|
403
407
|
|
|
404
408
|
MasonKit supports a subset of CSS `transform` functions on native views. The following functions are supported on Android via the `transform` style property:
|
|
@@ -407,6 +411,8 @@ MasonKit supports a subset of CSS `transform` functions on native views. The fol
|
|
|
407
411
|
- `scale(sx, sy)` — scaling (also `scaleX`, `scaleY`)
|
|
408
412
|
- `rotate(angle)` — rotation in degrees (supports `deg` and `rad`)
|
|
409
413
|
|
|
414
|
+
`transform-origin` sets the point transforms pivot about: keywords (`top left`), lengths or percentages of the element's box. The default is `50% 50%`.
|
|
415
|
+
|
|
410
416
|
Notes:
|
|
411
417
|
- Lengths in pixels can be specified with `px` (e.g. `translate(10px, 20px)`). Numeric values without units are interpreted as raw numbers (for scale/angle parsing try to use unit suffixes for clarity).
|
|
412
418
|
- Percentage translations are not supported in this initial implementation.
|
|
@@ -462,6 +468,7 @@ If you want transforms to be driven from the native style buffer (Rust) and casc
|
|
|
462
468
|
| `top` | `LengthAuto` | Top offset |
|
|
463
469
|
| `bottom` | `LengthAuto` | Bottom offset |
|
|
464
470
|
| `inset` | `LengthAuto` | Shorthand for all four offsets |
|
|
471
|
+
| `insetInline` / `insetBlock` | `string` | Logical offsets: left then right, top then bottom |
|
|
465
472
|
| `zIndex` | `number` | Stacking order |
|
|
466
473
|
|
|
467
474
|
```xml
|
|
@@ -489,6 +496,9 @@ If you want transforms to be driven from the native style buffer (Rust) and casc
|
|
|
489
496
|
| `justifyContent` | `JustifyContent` | Main-axis alignment |
|
|
490
497
|
| `justifyItems` | `JustifyItems` | Default justify for children |
|
|
491
498
|
| `justifySelf` | `JustifySelf` | Justify alignment for this element |
|
|
499
|
+
| `placeItems` | `string` | `align-items` then `justify-items` |
|
|
500
|
+
| `placeContent` | `string` | `align-content` then `justify-content` |
|
|
501
|
+
| `placeSelf` | `string` | `align-self` then `justify-self` |
|
|
492
502
|
|
|
493
503
|
**FlexDirection values:** `'row'` | `'column'` | `'row-reverse'` | `'column-reverse'`
|
|
494
504
|
|
|
@@ -655,6 +665,9 @@ If you want transforms to be driven from the native style buffer (Rust) and casc
|
|
|
655
665
|
| `textWrap` | `TextWrap` | Text wrapping behavior |
|
|
656
666
|
| `textOverFlow` | `TextOverflow` | Text overflow behavior |
|
|
657
667
|
| `verticalAlign` | `VerticalAlign` | Vertical alignment |
|
|
668
|
+
| `textIndent` | `string` | Indent of the first line (length or `%` of the width) |
|
|
669
|
+
| `lineClamp` | `number \| 'none'` | Show at most this many lines, ending the last in an ellipsis. `-webkit-line-clamp` is an alias |
|
|
670
|
+
| `listStyle` | `string` | Shorthand for `list-style-type` and `list-style-position` |
|
|
658
671
|
|
|
659
672
|
**TextWrap values:** `'nowrap'` | `'wrap'` | `'balance'`
|
|
660
673
|
|
|
@@ -899,7 +912,7 @@ MasonKit supports multiple NativeScript frameworks:
|
|
|
899
912
|
| Angular | Supported |
|
|
900
913
|
| Vue 3 (`nativescript-vue`) | Supported |
|
|
901
914
|
| React (`react-nativescript`) | Supported |
|
|
902
|
-
| Svelte (
|
|
915
|
+
| Svelte (`@nativescript-community/svelte-native`) | Supported |
|
|
903
916
|
|
|
904
917
|
Framework detection is automatic. MasonKit detects which framework is in use and adapts its internal child management accordingly.
|
|
905
918
|
|
|
@@ -938,7 +951,7 @@ Install the integration in the app entry file, before starting Svelte Native:
|
|
|
938
951
|
|
|
939
952
|
```ts
|
|
940
953
|
// app.ts
|
|
941
|
-
import { svelteNative } from 'svelte-native';
|
|
954
|
+
import { svelteNative } from '@nativescript-community/svelte-native';
|
|
942
955
|
import { installMasonKit } from '@triniwiz/nativescript-masonkit/svelte';
|
|
943
956
|
import App from './App.svelte';
|
|
944
957
|
|
package/common.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { alignItemsProperty, alignSelfProperty, flexDirectionProperty, flexGrowP
|
|
|
4
4
|
import { fontInternalProperty, backgroundInternalProperty, borderTopLeftRadiusProperty, borderTopRightRadiusProperty, borderBottomRightRadiusProperty, borderBottomLeftRadiusProperty, borderTopColorProperty, borderRightColorProperty, borderBottomColorProperty, borderLeftColorProperty } from '@nativescript/core/ui/styling/style-properties';
|
|
5
5
|
import { originXProperty, originYProperty } from '@nativescript/core/ui/core/view';
|
|
6
6
|
import { Style } from './style';
|
|
7
|
-
import { alignContentProperty, aspectRatioProperty, backgroundProperty,
|
|
7
|
+
import { alignContentProperty, aspectRatioProperty, backgroundProperty, borderRadiusProperty, bottomProperty, boxSizingProperty, clearProperty, columnGapProperty, cornerShapeProperty, displayProperty, filterProperty, flexBasisProperty, floatProperty, gridAreaProperty, gridAutoColumnsProperty, gridAutoFlowProperty, gridAutoRowsProperty, gridColumnEndProperty, gridColumnProperty, gridColumnStartProperty, gridRowEndProperty, gridRowProperty, gridRowStartProperty, gridTemplateAreasProperty, gridTemplateColumnsProperty, gridTemplateRowsProperty, justifyItemsProperty, justifySelfProperty, leftProperty, marginProperty, maxHeightProperty, maxWidthProperty, overflowXProperty, overflowYProperty, paddingProperty, positionProperty, rightProperty, rowGapProperty, scrollBarWidthProperty, textOverFlowProperty, textProperty, textWrapProperty, topProperty, verticalAlignProperty, boxShadowProperty, transformProperty, borderColorProperty, borderTopStyleProperty, borderRightStyleProperty, borderBottomStyleProperty, borderLeftStyleProperty, backgroundImageProperty, listStyleTypeProperty, listStylePositionProperty } from './properties';
|
|
8
8
|
import { isMasonView_, isTextChild_, isText_, native_, pseudoStyles_, eventType_, touchAction_ } from './symbols';
|
|
9
9
|
import { TextNode } from './text-node';
|
|
10
10
|
export interface MasonChild extends ViewBase {
|
|
@@ -94,11 +94,6 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
|
|
|
94
94
|
[borderRightColorProperty.setNative]: (value: any) => void;
|
|
95
95
|
[borderBottomColorProperty.setNative]: (value: any) => void;
|
|
96
96
|
[borderLeftColorProperty.setNative]: (value: any) => void;
|
|
97
|
-
[borderProperty.setNative]: (value: any) => void;
|
|
98
|
-
[borderLeftProperty.setNative]: (value: any) => void;
|
|
99
|
-
[borderTopProperty.setNative]: (value: any) => void;
|
|
100
|
-
[borderRightProperty.setNative]: (value: any) => void;
|
|
101
|
-
[borderBottomProperty.setNative]: (value: any) => void;
|
|
102
97
|
[backgroundProperty.setNative]: (value: any) => void;
|
|
103
98
|
[backgroundColorProperty.setNative]: (value: any) => void;
|
|
104
99
|
[borderLeftWidthProperty.setNative]: (value: CoreTypes.LengthType) => void;
|
|
@@ -110,7 +105,10 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
|
|
|
110
105
|
[textAlignmentProperty.setNative]: (value: any) => void;
|
|
111
106
|
[textDecorationProperty.setNative]: (value: any) => void;
|
|
112
107
|
[borderColorProperty.setNative]: (value: any) => void;
|
|
113
|
-
[
|
|
108
|
+
[borderTopStyleProperty.setNative]: (value: any) => void;
|
|
109
|
+
[borderRightStyleProperty.setNative]: (value: any) => void;
|
|
110
|
+
[borderBottomStyleProperty.setNative]: (value: any) => void;
|
|
111
|
+
[borderLeftStyleProperty.setNative]: (value: any) => void;
|
|
114
112
|
[backgroundImageProperty.setNative]: (value: any) => void;
|
|
115
113
|
[listStyleTypeProperty.setNative]: (value: any) => void;
|
|
116
114
|
[listStylePositionProperty.setNative]: (value: any) => void;
|
|
@@ -312,6 +310,8 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
|
|
|
312
310
|
nativeIndex: number;
|
|
313
311
|
};
|
|
314
312
|
_invalidateAttachCursor(): void;
|
|
313
|
+
/** Runs an iOS View's queued inserts before a native child edit. */
|
|
314
|
+
private _masonSettleNativeAdds;
|
|
315
315
|
_windowsNativeIndexOf(child: any, atIndex: number): number;
|
|
316
316
|
_childIndexToNativeChildIndex(index?: number): number;
|
|
317
317
|
insertChild(child: any, atIndex: number): void;
|
|
@@ -353,6 +353,7 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
|
|
|
353
353
|
private _windowsHostsRuns;
|
|
354
354
|
_windowsRunsInline(): boolean;
|
|
355
355
|
private _windowsScheduleSettle;
|
|
356
|
+
onLoaded(): void;
|
|
356
357
|
_windowsSettleRuns(): void;
|
|
357
358
|
private _windowsJoins;
|
|
358
359
|
private _windowsJoinsAt;
|
|
@@ -389,8 +390,8 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
|
|
|
389
390
|
set boxSizing(value: BoxSizing);
|
|
390
391
|
get display(): Display;
|
|
391
392
|
set display(value: Display);
|
|
392
|
-
get overflow(): Overflow | "auto auto" | "auto scroll" | "auto clip" | "auto visible" | "auto
|
|
393
|
-
set overflow(value: Overflow | "auto auto" | "auto scroll" | "auto clip" | "auto visible" | "auto
|
|
393
|
+
get overflow(): Overflow | "auto auto" | "auto hidden" | "auto scroll" | "auto clip" | "auto visible" | "hidden auto" | "hidden hidden" | "hidden scroll" | "hidden clip" | "hidden visible" | "scroll auto" | "scroll hidden" | "scroll scroll" | "scroll clip" | "scroll visible" | "clip auto" | "clip hidden" | "clip scroll" | "clip clip" | "clip visible" | "visible auto" | "visible hidden" | "visible scroll" | "visible clip" | "visible visible";
|
|
394
|
+
set overflow(value: Overflow | "auto auto" | "auto hidden" | "auto scroll" | "auto clip" | "auto visible" | "hidden auto" | "hidden hidden" | "hidden scroll" | "hidden clip" | "hidden visible" | "scroll auto" | "scroll hidden" | "scroll scroll" | "scroll clip" | "scroll visible" | "clip auto" | "clip hidden" | "clip scroll" | "clip clip" | "clip visible" | "visible auto" | "visible hidden" | "visible scroll" | "visible clip" | "visible visible");
|
|
394
395
|
get overflowX(): Overflow;
|
|
395
396
|
set overflowX(value: Overflow);
|
|
396
397
|
get overflowY(): Overflow;
|
package/common.js
CHANGED
|
@@ -11,10 +11,10 @@ import { _forceStyleUpdate } from './utils';
|
|
|
11
11
|
import { borderRadiusCorners, composeBorderRadius, isCssLength, parseCornerRadius, toCamelCase } from './css-shorthands';
|
|
12
12
|
import { originXProperty, originYProperty } from '@nativescript/core/ui/core/view';
|
|
13
13
|
import { animateTransforms } from './css-keyframes';
|
|
14
|
-
import { Style, nodeHelper, cssLengthToDip } from './style';
|
|
14
|
+
import { Style, nodeHelper, cssLengthToDip, resolveCssMathIn } from './style';
|
|
15
15
|
import { encodeBoxShadows, parseBoxShadows } from './box-shadow';
|
|
16
16
|
import { parseCssTransform } from './css-transform';
|
|
17
|
-
import { alignContentProperty, aspectRatioProperty, backgroundProperty,
|
|
17
|
+
import { alignContentProperty, aspectRatioProperty, backgroundProperty, borderRadiusProperty, bottomProperty, boxSizingProperty, clearProperty, columnGapProperty, cornerShapeProperty, displayProperty, filterProperty, flexBasisProperty, floatProperty, gridAreaProperty, gridAutoColumnsProperty, gridAutoFlowProperty, gridAutoRowsProperty, gridColumnEndProperty, gridColumnProperty, gridColumnStartProperty, gridRowEndProperty, gridRowProperty, gridRowStartProperty, gridTemplateAreasProperty, gridTemplateColumnsProperty, gridTemplateRowsProperty, justifyItemsProperty, justifySelfProperty, leftProperty, marginProperty, maxHeightProperty, maxWidthProperty, overflowXProperty, overflowYProperty, paddingProperty, positionProperty, rightProperty, rowGapProperty, scrollBarWidthProperty, textOverFlowProperty, textProperty, textWrapProperty, topProperty, verticalAlignProperty, boxShadowProperty, transformProperty, borderColorProperty, borderTopStyleProperty, borderRightStyleProperty, borderBottomStyleProperty, borderLeftStyleProperty, backgroundImageProperty, listStyleTypeProperty, listStylePositionProperty, installMasonSizeUnits, } from './properties';
|
|
18
18
|
import { isMasonView_, isTextChild_, isText_, isPlaceholder_, text_, native_, textNode_, textNodeIndex_, textNodeProxied_, pseudoStyles_, emptyTextNode_, breakRun_, anonymousText_, windowsFontSource_, hostsRuns_, needsAnonymousText_, borderRadiusCorners_, borderSideColors_, eventType_, runMember_, runsInline_, runsSettled_, blockified_, touchAction_ } from './symbols';
|
|
19
19
|
import { Tree } from './tree';
|
|
20
20
|
import { masonEngine, removeNativeChild } from './windows-panel-helpers';
|
|
@@ -1022,6 +1022,8 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1022
1022
|
return getViewById(this, id);
|
|
1023
1023
|
}
|
|
1024
1024
|
addChild(child) {
|
|
1025
|
+
if (!(child instanceof NSView))
|
|
1026
|
+
this._masonSettleNativeAdds();
|
|
1025
1027
|
if (child && child[isPlaceholder_] && child._view) {
|
|
1026
1028
|
if (__ANDROID__) {
|
|
1027
1029
|
//@ts-ignore
|
|
@@ -1150,6 +1152,11 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1150
1152
|
_invalidateAttachCursor() {
|
|
1151
1153
|
this._attachCursor = undefined;
|
|
1152
1154
|
}
|
|
1155
|
+
/** Runs an iOS View's queued inserts before a native child edit. */
|
|
1156
|
+
_masonSettleNativeAdds() {
|
|
1157
|
+
if (this._masonPendingAdds)
|
|
1158
|
+
this._masonFlushNativeAdds();
|
|
1159
|
+
}
|
|
1153
1160
|
// Windows attaches element children on load with no index, after text runs that attached
|
|
1154
1161
|
// straight away, so an append would land them after text that comes later.
|
|
1155
1162
|
_windowsNativeIndexOf(child, atIndex) {
|
|
@@ -1165,6 +1172,7 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1165
1172
|
return super._childIndexToNativeChildIndex(index);
|
|
1166
1173
|
}
|
|
1167
1174
|
insertChild(child, atIndex) {
|
|
1175
|
+
this._masonSettleNativeAdds();
|
|
1168
1176
|
this._invalidateAttachCursor();
|
|
1169
1177
|
if (child && child[isPlaceholder_] && child._view) {
|
|
1170
1178
|
const nativeIndex = this._nativeIndexFor(atIndex);
|
|
@@ -1193,6 +1201,7 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1193
1201
|
}
|
|
1194
1202
|
}
|
|
1195
1203
|
replaceChild(child, atIndex) {
|
|
1204
|
+
this._masonSettleNativeAdds();
|
|
1196
1205
|
this._invalidateAttachCursor();
|
|
1197
1206
|
if (child && child[isPlaceholder_] && child._view) {
|
|
1198
1207
|
this._children[atIndex] = child;
|
|
@@ -1241,10 +1250,9 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1241
1250
|
}
|
|
1242
1251
|
}
|
|
1243
1252
|
removeChild(child) {
|
|
1253
|
+
this._masonSettleNativeAdds();
|
|
1244
1254
|
this._invalidateAttachCursor();
|
|
1245
|
-
//
|
|
1246
|
-
// native element APIs (never `_addView`-ed), so `_removeView` would throw.
|
|
1247
|
-
// Remove the native node directly instead.
|
|
1255
|
+
// A placeholder (e.g. Br) was never `_addView`-ed, so remove its native node directly.
|
|
1248
1256
|
if (child && child[isPlaceholder_] && child._view) {
|
|
1249
1257
|
const index = this._children.indexOf(child);
|
|
1250
1258
|
if (index > -1) {
|
|
@@ -1293,9 +1301,9 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1293
1301
|
}
|
|
1294
1302
|
}
|
|
1295
1303
|
}
|
|
1296
|
-
//
|
|
1297
|
-
// back to index-based removal on native builds that predate the by-node API.
|
|
1304
|
+
// By node when the native build supports it, else by index.
|
|
1298
1305
|
_nativeRemoveChildNode(node, index) {
|
|
1306
|
+
this._masonSettleNativeAdds();
|
|
1299
1307
|
//@ts-ignore
|
|
1300
1308
|
const view = this._view;
|
|
1301
1309
|
if (!view)
|
|
@@ -1356,6 +1364,7 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1356
1364
|
if (this._viewChildren.length === 0) {
|
|
1357
1365
|
return;
|
|
1358
1366
|
}
|
|
1367
|
+
this._masonSettleNativeAdds();
|
|
1359
1368
|
for (const child of this._viewChildren) {
|
|
1360
1369
|
// @ts-ignore
|
|
1361
1370
|
child._isMasonChild = false;
|
|
@@ -1530,6 +1539,7 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1530
1539
|
});
|
|
1531
1540
|
}
|
|
1532
1541
|
_nativeAddChild(textNode, index) {
|
|
1542
|
+
this._masonSettleNativeAdds();
|
|
1533
1543
|
//@ts-ignore
|
|
1534
1544
|
if (__ANDROID__)
|
|
1535
1545
|
this._view.addChildAt(textNode, index);
|
|
@@ -1547,6 +1557,7 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1547
1557
|
}
|
|
1548
1558
|
}
|
|
1549
1559
|
_nativeReplaceChild(textNode, index) {
|
|
1560
|
+
this._masonSettleNativeAdds();
|
|
1550
1561
|
//@ts-ignore
|
|
1551
1562
|
if (__ANDROID__)
|
|
1552
1563
|
this._view.replaceChildAt(textNode, index);
|
|
@@ -1668,12 +1679,25 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1668
1679
|
const display = this._styleHelper?.display;
|
|
1669
1680
|
return display === 'block' || display === 'inline-block';
|
|
1670
1681
|
}
|
|
1671
|
-
// A container's display arrives with its CSS, after its children attach, so runs are grouped once
|
|
1682
|
+
// A container's display arrives with its CSS, after its children attach, so runs are grouped once
|
|
1683
|
+
// the turn ends, or once it loads if it hasn't by then.
|
|
1672
1684
|
_windowsScheduleSettle() {
|
|
1673
1685
|
if (this[runsSettled_] !== undefined)
|
|
1674
1686
|
return;
|
|
1675
1687
|
this[runsSettled_] = false;
|
|
1676
|
-
queueMicrotask(() =>
|
|
1688
|
+
queueMicrotask(() => {
|
|
1689
|
+
if (this[runsSettled_] !== false)
|
|
1690
|
+
return;
|
|
1691
|
+
if (this.isLoaded)
|
|
1692
|
+
this._windowsSettleRuns();
|
|
1693
|
+
else
|
|
1694
|
+
this[runsSettled_] = 'load';
|
|
1695
|
+
});
|
|
1696
|
+
}
|
|
1697
|
+
onLoaded() {
|
|
1698
|
+
super.onLoaded();
|
|
1699
|
+
if (__WINDOWS__ && this[runsSettled_] === 'load')
|
|
1700
|
+
this._windowsSettleRuns();
|
|
1677
1701
|
}
|
|
1678
1702
|
_windowsSettleRuns() {
|
|
1679
1703
|
this[runsSettled_] = true;
|
|
@@ -2166,7 +2190,9 @@ export class ViewBase extends CustomLayoutView {
|
|
|
2166
2190
|
if (!corners) {
|
|
2167
2191
|
corners = this[borderRadiusCorners_] = this._nativeBorderRadiusCorners();
|
|
2168
2192
|
}
|
|
2169
|
-
|
|
2193
|
+
// Resolve math functions first: the corner parser can't read them.
|
|
2194
|
+
const text = lengthToCssString(masonLength(value));
|
|
2195
|
+
const css = resolveCssMathIn(text, style.emBasisFor(text));
|
|
2170
2196
|
const radius = (corners[corner] = /\s/.test(css) ? parseCornerRadius(css) : [css, css]);
|
|
2171
2197
|
const shorthand = composeBorderRadius(corners);
|
|
2172
2198
|
if ((__ANDROID__ || __APPLE__) && style._writeCornerRadius(corner, radius, shorthand)) {
|
|
@@ -2253,46 +2279,6 @@ export class ViewBase extends CustomLayoutView {
|
|
|
2253
2279
|
get border() {
|
|
2254
2280
|
return this.style.border;
|
|
2255
2281
|
}
|
|
2256
|
-
[borderProperty.setNative](value) {
|
|
2257
|
-
// @ts-ignore
|
|
2258
|
-
const style = this._styleHelper;
|
|
2259
|
-
if (style) {
|
|
2260
|
-
// @ts-ignore
|
|
2261
|
-
style.border = value;
|
|
2262
|
-
}
|
|
2263
|
-
}
|
|
2264
|
-
[borderLeftProperty.setNative](value) {
|
|
2265
|
-
// @ts-ignore
|
|
2266
|
-
const style = this._styleHelper;
|
|
2267
|
-
if (style) {
|
|
2268
|
-
// @ts-ignore
|
|
2269
|
-
style.borderLeft = value;
|
|
2270
|
-
}
|
|
2271
|
-
}
|
|
2272
|
-
[borderTopProperty.setNative](value) {
|
|
2273
|
-
// @ts-ignore
|
|
2274
|
-
const style = this._styleHelper;
|
|
2275
|
-
if (style) {
|
|
2276
|
-
// @ts-ignore
|
|
2277
|
-
style.borderTop = value;
|
|
2278
|
-
}
|
|
2279
|
-
}
|
|
2280
|
-
[borderRightProperty.setNative](value) {
|
|
2281
|
-
// @ts-ignore
|
|
2282
|
-
const style = this._styleHelper;
|
|
2283
|
-
if (style) {
|
|
2284
|
-
// @ts-ignore
|
|
2285
|
-
style.borderRight = value;
|
|
2286
|
-
}
|
|
2287
|
-
}
|
|
2288
|
-
[borderBottomProperty.setNative](value) {
|
|
2289
|
-
// @ts-ignore
|
|
2290
|
-
const style = this._styleHelper;
|
|
2291
|
-
if (style) {
|
|
2292
|
-
// @ts-ignore
|
|
2293
|
-
style.borderBottom = value;
|
|
2294
|
-
}
|
|
2295
|
-
}
|
|
2296
2282
|
// @ts-ignore
|
|
2297
2283
|
set background(value) {
|
|
2298
2284
|
this.style.background = value;
|
|
@@ -2437,14 +2423,30 @@ export class ViewBase extends CustomLayoutView {
|
|
|
2437
2423
|
style.setBorderColor(String(value));
|
|
2438
2424
|
}
|
|
2439
2425
|
}
|
|
2440
|
-
//
|
|
2441
|
-
[
|
|
2426
|
+
// `border-style`, `border` and `border-<side>` are shorthands over these.
|
|
2427
|
+
[borderTopStyleProperty.setNative](value) {
|
|
2442
2428
|
// @ts-ignore
|
|
2443
2429
|
const style = this._styleHelper;
|
|
2444
|
-
if (style)
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2430
|
+
if (style)
|
|
2431
|
+
style.borderTopStyle = String(value ?? 'none');
|
|
2432
|
+
}
|
|
2433
|
+
[borderRightStyleProperty.setNative](value) {
|
|
2434
|
+
// @ts-ignore
|
|
2435
|
+
const style = this._styleHelper;
|
|
2436
|
+
if (style)
|
|
2437
|
+
style.borderRightStyle = String(value ?? 'none');
|
|
2438
|
+
}
|
|
2439
|
+
[borderBottomStyleProperty.setNative](value) {
|
|
2440
|
+
// @ts-ignore
|
|
2441
|
+
const style = this._styleHelper;
|
|
2442
|
+
if (style)
|
|
2443
|
+
style.borderBottomStyle = String(value ?? 'none');
|
|
2444
|
+
}
|
|
2445
|
+
[borderLeftStyleProperty.setNative](value) {
|
|
2446
|
+
// @ts-ignore
|
|
2447
|
+
const style = this._styleHelper;
|
|
2448
|
+
if (style)
|
|
2449
|
+
style.borderLeftStyle = String(value ?? 'none');
|
|
2448
2450
|
}
|
|
2449
2451
|
// @ts-ignore
|
|
2450
2452
|
[backgroundImageProperty.setNative](value) {
|
|
@@ -3192,7 +3194,7 @@ export class ViewBase extends CustomLayoutView {
|
|
|
3192
3194
|
if (__WINDOWS__) {
|
|
3193
3195
|
const nv = this.nativeViewProtected ?? this._view;
|
|
3194
3196
|
try {
|
|
3195
|
-
const shadows = parseBoxShadows(typeof value === 'string' ? value : '', (token) => cssLengthToDip(token, style.
|
|
3197
|
+
const shadows = parseBoxShadows(typeof value === 'string' ? value : '', (token) => cssLengthToDip(token, style.emBasisFor(token)));
|
|
3196
3198
|
const current = style.color >>> 0 || 0xff000000;
|
|
3197
3199
|
const spec = encodeBoxShadows(shadows, (color) => {
|
|
3198
3200
|
if (!color || color.toLowerCase() === 'currentcolor')
|
|
@@ -3266,7 +3268,7 @@ export class ViewBase extends CustomLayoutView {
|
|
|
3266
3268
|
const nv = this.nativeViewProtected ?? this._view;
|
|
3267
3269
|
try {
|
|
3268
3270
|
const size = { width: nv?.ActualWidth ?? 0, height: nv?.ActualHeight ?? 0 };
|
|
3269
|
-
const m = parseCssTransform(typeof value === 'string' ? value : '', (token) => cssLengthToDip(token, style.
|
|
3271
|
+
const m = parseCssTransform(typeof value === 'string' ? value : '', (token) => cssLengthToDip(token, style.emBasisFor(token)), size);
|
|
3270
3272
|
if (!m)
|
|
3271
3273
|
NativeScript.Mason.Css.ClearTransform(nv);
|
|
3272
3274
|
else {
|