@triniwiz/nativescript-masonkit 1.0.0-beta.121 → 1.0.0-beta.123
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/button/index.ios.js +5 -73
- package/button/index.ios.js.map +1 -1
- package/common.d.ts +3 -1
- package/common.js +55 -17
- package/common.js.map +1 -1
- package/css-shorthands.d.ts +0 -2
- package/css-shorthands.js +0 -4
- package/css-shorthands.js.map +1 -1
- package/foreign-layout.d.ts +3 -1
- package/foreign-layout.js +33 -1
- package/foreign-layout.js.map +1 -1
- package/img/index.android.js +1 -1
- package/img/index.android.js.map +1 -1
- package/img/index.ios.js +5 -43
- package/img/index.ios.js.map +1 -1
- package/img/index.windows.js +3 -8
- package/img/index.windows.js.map +1 -1
- package/index.d.ts +12 -0
- package/input/index.ios.js +4 -44
- package/input/index.ios.js.map +1 -1
- package/li/index.ios.js +6 -52
- package/li/index.ios.js.map +1 -1
- package/list/index.ios.js +3 -41
- package/list/index.ios.js.map +1 -1
- package/logical-boxes.d.ts +8 -0
- package/logical-boxes.js +131 -0
- package/logical-boxes.js.map +1 -0
- package/package.json +1 -1
- package/platforms/android/masonkit-release.aar +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason-Swift.h +5 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/mason_native.h +9 -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 +33461 -30006
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.private.swiftinterface +274 -221
- 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 +274 -221
- 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 +10099 -9730
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason-Swift.h +10 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/mason_native.h +9 -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 +33461 -30006
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +274 -221
- 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 +274 -221
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +33461 -30006
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +274 -221
- 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 +274 -221
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/_CodeSignature/CodeResources +28 -28
- 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 +10093 -9724
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +9652 -9281
- 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 +37 -0
- package/properties.js +167 -41
- package/properties.js.map +1 -1
- package/scroll/index.ios.js +5 -62
- package/scroll/index.ios.js.map +1 -1
- package/style.d.ts +323 -0
- package/style.js +322 -6
- package/style.js.map +1 -1
- package/symbols.d.ts +3 -0
- package/symbols.js +4 -0
- package/symbols.js.map +1 -1
- package/text/index.ios.js +3 -79
- package/text/index.ios.js.map +1 -1
- package/text/index.windows.js +5 -4
- package/text/index.windows.js.map +1 -1
- package/textarea/index.ios.js +4 -62
- package/textarea/index.ios.js.map +1 -1
- package/typings/objc!Mason.d.ts +2 -0
- package/typings/objc!ObjectiveC.d.ts +2 -0
- package/view/index.ios.js +8 -56
- package/view/index.ios.js.map +1 -1
- package/vue/src/mason-meta.d.ts.map +1 -1
- package/vue/src/mason-meta.js +8 -7
- package/vue/src/mason-meta.js.map +1 -1
- package/web.js +6 -6
- package/web.js.map +1 -1
package/button/index.ios.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { CSSType, Utils, View } from '@nativescript/core';
|
|
2
|
-
import { ButtonBase, textContentProperty } from '../common';
|
|
2
|
+
import { ButtonBase, textContentProperty, setMeasuredFromNative } from '../common';
|
|
3
3
|
import { Style } from '../style';
|
|
4
4
|
import { Tree } from '../tree';
|
|
5
|
-
import { parseLength } from '../utils';
|
|
6
5
|
import { style_, isText_, isMasonView_, isTextChild_, native_ } from '../symbols';
|
|
7
6
|
let Button = class Button extends ButtonBase {
|
|
8
7
|
constructor() {
|
|
@@ -63,80 +62,13 @@ let Button = class Button extends ButtonBase {
|
|
|
63
62
|
onMeasure(widthMeasureSpec, heightMeasureSpec) {
|
|
64
63
|
const nativeView = this._view;
|
|
65
64
|
if (nativeView) {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (!this[isMasonView_]) {
|
|
71
|
-
const unconstrained = widthMode === Utils.layout.UNSPECIFIED || heightMode === Utils.layout.UNSPECIFIED || (widthMode === Utils.layout.AT_MOST && specWidth === 0) || (heightMode === Utils.layout.AT_MOST && specHeight === 0);
|
|
72
|
-
// Compute against the parent's bounds whenever the spec gives any; see
|
|
73
|
-
// view/index.ios.ts for why auto/auto doesn't matter here.
|
|
74
|
-
if (!unconstrained) {
|
|
75
|
-
// todo
|
|
76
|
-
// @ts-ignore
|
|
77
|
-
this.ios.mason_computeWithSize(specWidth, specHeight);
|
|
78
|
-
// Claim this root for the host's spec; see view/index.ios.ts.
|
|
79
|
-
// @ts-ignore
|
|
80
|
-
this.ios.mason_markRootComputeAppliedWithSize(specWidth, specHeight);
|
|
81
|
-
//this.ios.computeWithMaxContent();
|
|
82
|
-
// todo
|
|
83
|
-
// @ts-ignore
|
|
84
|
-
const layout = this.ios.node.computedLayout;
|
|
85
|
-
const w = Utils.layout.makeMeasureSpec(layout.width, Utils.layout.EXACTLY);
|
|
86
|
-
const h = Utils.layout.makeMeasureSpec(layout.height, Utils.layout.EXACTLY);
|
|
87
|
-
this.setMeasuredDimension(w, h);
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
let width;
|
|
92
|
-
switch (typeof this.width) {
|
|
93
|
-
case 'object': {
|
|
94
|
-
const parent = this.parent;
|
|
95
|
-
const mw = parent?.getMeasuredWidth?.() || Utils.layout.toDevicePixels(parent?.nativeView?.frame?.size?.width ?? 0);
|
|
96
|
-
width = parseLength(this.width, mw);
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
case 'string':
|
|
100
|
-
width = -2;
|
|
101
|
-
break;
|
|
102
|
-
case 'number':
|
|
103
|
-
width = Utils.layout.toDevicePixels(this.width);
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
let height;
|
|
107
|
-
switch (typeof this.height) {
|
|
108
|
-
case 'object': {
|
|
109
|
-
const parent = this.parent;
|
|
110
|
-
const mh = parent?.getMeasuredHeight?.() || Utils.layout.toDevicePixels(parent?.nativeView?.frame?.size?.height ?? 0);
|
|
111
|
-
height = parseLength(this.height, mh);
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
case 'string':
|
|
115
|
-
height = -2;
|
|
116
|
-
break;
|
|
117
|
-
case 'number':
|
|
118
|
-
height = Utils.layout.toDevicePixels(this.height);
|
|
119
|
-
break;
|
|
120
|
-
}
|
|
121
|
-
// todo
|
|
122
|
-
// @ts-ignore
|
|
123
|
-
this.ios.mason_computeWithSize(width, height);
|
|
124
|
-
const layout = this.ios.node.computedLayout;
|
|
125
|
-
const w = Utils.layout.makeMeasureSpec(layout.width, Utils.layout.EXACTLY);
|
|
126
|
-
const h = Utils.layout.makeMeasureSpec(layout.height, Utils.layout.EXACTLY);
|
|
127
|
-
this.setMeasuredDimension(w, h);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
// todo
|
|
132
|
-
// @ts-ignore
|
|
133
|
-
const layout = nativeView.node.computedLayout;
|
|
134
|
-
const w = Utils.layout.makeMeasureSpec(layout.width, Utils.layout.EXACTLY);
|
|
135
|
-
const h = Utils.layout.makeMeasureSpec(layout.height, Utils.layout.EXACTLY);
|
|
65
|
+
const root = !this.parent?.[isMasonView_];
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
setMeasuredFromNative(this, nativeView.mason_measure(widthMeasureSpec, heightMeasureSpec, root, false));
|
|
68
|
+
if (!root) {
|
|
136
69
|
this.eachLayoutChild((child) => {
|
|
137
70
|
View.measureChild(this, child, child._currentWidthMeasureSpec, child._currentHeightMeasureSpec);
|
|
138
71
|
});
|
|
139
|
-
this.setMeasuredDimension(w, h);
|
|
140
72
|
}
|
|
141
73
|
}
|
|
142
74
|
}
|
package/button/index.ios.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.ios.js","sourceRoot":"","sources":["../../../../packages/nativescript-masonkit/button/index.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAY,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.ios.js","sourceRoot":"","sources":["../../../../packages/nativescript-masonkit/button/index.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAY,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACnF,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,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C3B,CAAC;CACF,CAAA;AAzGY,MAAM;IADlB,OAAO,CAAC,QAAQ,CAAC;;GACL,MAAM,CAyGlB"}
|
package/common.d.ts
CHANGED
|
@@ -80,6 +80,8 @@ declare module '@nativescript/core/ui/styling/style' {
|
|
|
80
80
|
* `iosOverflowSafeArea` the same way: when the frame grows past the safe area it lays out
|
|
81
81
|
* again at the new size. Like core views, it raises `layoutChanged` when the frame changes.
|
|
82
82
|
*/
|
|
83
|
+
/** Reports the device px size `mason_measure` returns, packed as width * 2^24 + height. */
|
|
84
|
+
export declare function setMeasuredFromNative(view: any, packed: number): void;
|
|
83
85
|
export declare function setRootNativeViewFrame(view: any, nativeView: any, frame: CGRect): void;
|
|
84
86
|
export declare function windowsMemberKind(child: any): 'run' | 'break' | 'text' | 'box';
|
|
85
87
|
export declare function setWindowsInnerHTML(build: (view: any, html: string) => void): void;
|
|
@@ -340,7 +342,7 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
|
|
|
340
342
|
getChildrenCount(): number;
|
|
341
343
|
get _childrenCount(): number;
|
|
342
344
|
getChildAt(index: number): NSView;
|
|
343
|
-
getChildIndex(child:
|
|
345
|
+
getChildIndex(child: unknown): number;
|
|
344
346
|
getChildById(id: string): NSViewBase;
|
|
345
347
|
addChild(child: any): void;
|
|
346
348
|
insertBefore(child: any, reference: any): void;
|
package/common.js
CHANGED
|
@@ -9,15 +9,16 @@ import { alignItemsProperty, alignSelfProperty, flexDirectionProperty, flexGrowP
|
|
|
9
9
|
import { fontInternalProperty, backgroundInternalProperty, borderTopLeftRadiusProperty, borderTopRightRadiusProperty, borderBottomRightRadiusProperty, borderBottomLeftRadiusProperty, borderTopColorProperty, borderRightColorProperty, borderBottomColorProperty, borderLeftColorProperty } from '@nativescript/core/ui/styling/style-properties';
|
|
10
10
|
import { _forceStyleUpdate } from './utils';
|
|
11
11
|
import { borderRadiusCorners, composeBorderRadius, isCssLength, parseCornerRadius, toCamelCase } from './css-shorthands';
|
|
12
|
+
import { installLogicalBoxes } from './logical-boxes';
|
|
12
13
|
import { originXProperty, originYProperty } from '@nativescript/core/ui/core/view';
|
|
13
14
|
import { animateTransforms } from './css-keyframes';
|
|
14
|
-
import { adoptForeignLayout, releaseForeignLayout } from './foreign-layout';
|
|
15
|
+
import { adoptForeignLayout, invalidateOnLayoutRequest, releaseForeignLayout } from './foreign-layout';
|
|
15
16
|
import { Style, nodeHelper, cssLengthToDip, resolveCssMathIn } from './style';
|
|
16
17
|
import { encodeBoxShadows, parseBoxShadows } from './box-shadow';
|
|
17
18
|
import { parseCssTransform } from './css-transform';
|
|
18
|
-
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, masonRawDeclaration, } from './properties';
|
|
19
|
+
import { alignContentProperty, aspectRatioProperty, backgroundProperty, borderRadiusProperty, bottomProperty, boxSizingProperty, clearProperty, columnGapProperty, cornerShapeProperty, displayProperty, applyDisplay, 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, masonRawDeclaration, logicalLonghands, } from './properties';
|
|
19
20
|
import { masonLayout } from './display-density';
|
|
20
|
-
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';
|
|
21
|
+
import { isMasonView_, isTextChild_, isText_, isPlaceholder_, text_, native_, textNode_, textNodeIndex_, textNodeProxied_, pseudoStyles_, emptyTextNode_, breakRun_, anonymousText_, windowsFontSource_, hostsRuns_, needsAnonymousText_, borderRadiusCorners_, borderSideColors_, eventType_, remapLogicalBoxes_, runMember_, runsInline_, runsSettled_, blockified_, touchAction_ } from './symbols';
|
|
21
22
|
import { Tree } from './tree';
|
|
22
23
|
import { masonEngine, removeNativeChild } from './panel-helpers';
|
|
23
24
|
import { TextNode } from './text-node';
|
|
@@ -248,6 +249,11 @@ function windowsBreakRun(child) {
|
|
|
248
249
|
* `iosOverflowSafeArea` the same way: when the frame grows past the safe area it lays out
|
|
249
250
|
* again at the new size. Like core views, it raises `layoutChanged` when the frame changes.
|
|
250
251
|
*/
|
|
252
|
+
/** Reports the device px size `mason_measure` returns, packed as width * 2^24 + height. */
|
|
253
|
+
export function setMeasuredFromNative(view, packed) {
|
|
254
|
+
const width = Math.floor(packed / 16777216);
|
|
255
|
+
view.setMeasuredDimension(width, packed - width * 16777216);
|
|
256
|
+
}
|
|
251
257
|
export function setRootNativeViewFrame(view, nativeView, frame) {
|
|
252
258
|
// Place the view before adjusting, as core does: the safe-area math reads its
|
|
253
259
|
// position on screen, and a stale one applied the insets twice.
|
|
@@ -1013,6 +1019,7 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1013
1019
|
const mason = native?.mason ?? native?.node?.mason;
|
|
1014
1020
|
if (typeof mason?.setMeasureForViewBlock !== 'function')
|
|
1015
1021
|
return;
|
|
1022
|
+
invalidateOnLayoutRequest(child, mason);
|
|
1016
1023
|
const parentRef = new WeakRef(this);
|
|
1017
1024
|
const childRef = new WeakRef(child);
|
|
1018
1025
|
const spec = (known, available) => {
|
|
@@ -1468,7 +1475,7 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1468
1475
|
return;
|
|
1469
1476
|
if (__ANDROID__) {
|
|
1470
1477
|
//@ts-ignore
|
|
1471
|
-
if (typeof view.removeChild === 'function')
|
|
1478
|
+
if (node && typeof view.removeChild === 'function')
|
|
1472
1479
|
view.removeChild(node);
|
|
1473
1480
|
//@ts-ignore
|
|
1474
1481
|
else
|
|
@@ -1476,7 +1483,7 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1476
1483
|
}
|
|
1477
1484
|
if (__APPLE__) {
|
|
1478
1485
|
//@ts-ignore
|
|
1479
|
-
if (view.mason_removeChildNode)
|
|
1486
|
+
if (node && view.mason_removeChildNode)
|
|
1480
1487
|
view.mason_removeChildNode(node);
|
|
1481
1488
|
//@ts-ignore
|
|
1482
1489
|
else
|
|
@@ -1519,28 +1526,50 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1519
1526
|
}
|
|
1520
1527
|
}
|
|
1521
1528
|
removeChildren() {
|
|
1522
|
-
|
|
1529
|
+
const children = this._children;
|
|
1530
|
+
if (children.length === 0) {
|
|
1523
1531
|
return;
|
|
1524
1532
|
}
|
|
1525
1533
|
this._masonSettleNativeAdds();
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1534
|
+
// Backwards, so index-based native removal stays aligned. Text runs and
|
|
1535
|
+
// placeholders hold native nodes too.
|
|
1536
|
+
for (let i = children.length - 1; i >= 0; i--) {
|
|
1537
|
+
const child = children[i];
|
|
1538
|
+
if (!child)
|
|
1539
|
+
continue;
|
|
1540
|
+
if (child[isPlaceholder_]) {
|
|
1541
|
+
if (!__WINDOWS__ && child._view)
|
|
1542
|
+
this._nativeRemoveChildNode(child._view.node, i);
|
|
1543
|
+
child[isTextChild_] = false;
|
|
1544
|
+
}
|
|
1545
|
+
else if (child instanceof NSView) {
|
|
1546
|
+
// @ts-ignore
|
|
1547
|
+
child._isMasonChild = false;
|
|
1530
1548
|
this._removeView(child);
|
|
1531
1549
|
}
|
|
1550
|
+
else if (!__WINDOWS__ && text_ in child) {
|
|
1551
|
+
const node = child[textNode_];
|
|
1552
|
+
this._nativeRemoveChildNode(node, i);
|
|
1553
|
+
// Unbind the framework node so it can be adopted again.
|
|
1554
|
+
const raw = node?.__raw__;
|
|
1555
|
+
if (raw) {
|
|
1556
|
+
raw[textNodeProxied_] = false;
|
|
1557
|
+
raw[textNode_] = undefined;
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1532
1560
|
}
|
|
1533
1561
|
if (__WINDOWS__) {
|
|
1534
1562
|
this._forEachAnonymousText((anonymous) => masonEngine().RemoveChild(this._view, anonymous));
|
|
1535
|
-
for (const c of
|
|
1563
|
+
for (const c of children) {
|
|
1536
1564
|
if (!c)
|
|
1537
1565
|
continue;
|
|
1538
1566
|
c[anonymousText_] = undefined;
|
|
1539
1567
|
c[runMember_] = undefined;
|
|
1540
1568
|
}
|
|
1541
1569
|
}
|
|
1542
|
-
|
|
1570
|
+
children.splice(0);
|
|
1543
1571
|
this._invalidateAttachCursor();
|
|
1572
|
+
this.requestLayout();
|
|
1544
1573
|
}
|
|
1545
1574
|
[(_a = isMasonView_, _b = isTextChild_, _c = isText_, _d = pseudoStyles_, zIndexProperty.setNative)](value) {
|
|
1546
1575
|
// @ts-ignore
|
|
@@ -1554,8 +1583,10 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1554
1583
|
// @ts-ignore
|
|
1555
1584
|
super[directionProperty.setNative]?.(value);
|
|
1556
1585
|
const style = this._styleHelper;
|
|
1557
|
-
if (style)
|
|
1586
|
+
if (style) {
|
|
1558
1587
|
style.direction = value === 'rtl' || value === 'ltr' ? value : 'inherit';
|
|
1588
|
+
this[remapLogicalBoxes_](false);
|
|
1589
|
+
}
|
|
1559
1590
|
}
|
|
1560
1591
|
set verticalAlign(value) {
|
|
1561
1592
|
this.style.verticalAlign = value;
|
|
@@ -2676,10 +2707,8 @@ export class ViewBase extends CustomLayoutView {
|
|
|
2676
2707
|
[displayProperty.setNative](value) {
|
|
2677
2708
|
// @ts-ignore
|
|
2678
2709
|
const style = this._styleHelper;
|
|
2679
|
-
if (style)
|
|
2680
|
-
|
|
2681
|
-
style.display = value;
|
|
2682
|
-
}
|
|
2710
|
+
if (style)
|
|
2711
|
+
applyDisplay(style, value);
|
|
2683
2712
|
}
|
|
2684
2713
|
get overflow() {
|
|
2685
2714
|
return this.style.overflow;
|
|
@@ -3501,6 +3530,15 @@ export function windowsFontSource(font) {
|
|
|
3501
3530
|
catch (_) { }
|
|
3502
3531
|
return String((font && typeof font === 'object' ? font.fontFamily : '') ?? '');
|
|
3503
3532
|
}
|
|
3533
|
+
// Logical margins, padding, insets and sizes: see properties.ts.
|
|
3534
|
+
for (const { property, group, slot } of logicalLonghands) {
|
|
3535
|
+
ViewBase.prototype[property.setNative] = function (value) {
|
|
3536
|
+
// @ts-ignore
|
|
3537
|
+
this._styleHelper?.setLogical(group, slot, value === property.defaultValue ? undefined : value);
|
|
3538
|
+
};
|
|
3539
|
+
}
|
|
3540
|
+
// Logical borders, corners and overflow: see logical-boxes.ts.
|
|
3541
|
+
installLogicalBoxes(ViewBase.prototype);
|
|
3504
3542
|
export class TextBase extends ViewBase {
|
|
3505
3543
|
[fontInternalProperty.setNative](value) {
|
|
3506
3544
|
if (!__WINDOWS__)
|