@triniwiz/nativescript-masonkit 1.0.0-beta.85 → 1.0.0-beta.87
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/br/index.windows.d.ts +11 -0
- package/br/index.windows.js +31 -0
- package/br/index.windows.js.map +1 -0
- package/button/index.windows.d.ts +12 -0
- package/button/index.windows.js +44 -0
- package/button/index.windows.js.map +1 -0
- package/common.d.ts +2 -0
- package/common.js +257 -19
- package/common.js.map +1 -1
- package/img/index.windows.d.ts +12 -0
- package/img/index.windows.js +48 -0
- package/img/index.windows.js.map +1 -0
- package/index.windows.d.ts +12 -0
- package/index.windows.js +13 -0
- package/index.windows.js.map +1 -0
- package/input/index.windows.d.ts +14 -0
- package/input/index.windows.js +96 -0
- package/input/index.windows.js.map +1 -0
- package/li/index.windows.d.ts +13 -0
- package/li/index.windows.js +50 -0
- package/li/index.windows.js.map +1 -0
- package/list/common.js +0 -1
- package/list/common.js.map +1 -1
- package/list/index.ios.js +0 -1
- package/list/index.ios.js.map +1 -1
- package/list/index.windows.d.ts +21 -0
- package/list/index.windows.js +68 -0
- package/list/index.windows.js.map +1 -0
- package/package.json +6 -3
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.abi.json +2640 -11192
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.abi.json +2640 -11192
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +2640 -11192
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.abi.json +2640 -11192
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.abi.json +2640 -11192
- package/platforms/windows/arm64/NativeScript.Mason.dll +0 -0
- package/platforms/windows/arm64/NativeScript.Mason.winmd +0 -0
- package/platforms/windows/plugin.props +9 -0
- package/platforms/windows/plugin.targets +50 -0
- package/platforms/windows/x64/NativeScript.Mason.dll +0 -0
- package/platforms/windows/x64/NativeScript.Mason.winmd +0 -0
- package/scroll/index.windows.d.ts +14 -0
- package/scroll/index.windows.js +63 -0
- package/scroll/index.windows.js.map +1 -0
- package/style.d.ts +3 -0
- package/style.js +507 -5
- package/style.js.map +1 -1
- package/text/index.windows.d.ts +13 -0
- package/text/index.windows.js +39 -0
- package/text/index.windows.js.map +1 -0
- package/text-node/index.windows.d.ts +14 -0
- package/text-node/index.windows.js +42 -0
- package/text-node/index.windows.js.map +1 -0
- package/textarea/index.windows.d.ts +15 -0
- package/textarea/index.windows.js +63 -0
- package/textarea/index.windows.js.map +1 -0
- package/tree/index.windows.d.ts +36 -0
- package/tree/index.windows.js +68 -0
- package/tree/index.windows.js.map +1 -0
- package/utils/index.windows.d.ts +128 -0
- package/utils/index.windows.js +155 -0
- package/utils/index.windows.js.map +1 -0
- package/view/index.windows.d.ts +15 -0
- package/view/index.windows.js +52 -0
- package/view/index.windows.js.map +1 -0
- package/web.d.ts +2 -2
- package/web.js +2 -2
- package/web.js.map +1 -1
- package/windows-panel-helpers.d.ts +2 -0
- package/windows-panel-helpers.js +27 -0
- package/windows-panel-helpers.js.map +1 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ViewBase } from '@nativescript/core';
|
|
2
|
+
import { Style } from '../style';
|
|
3
|
+
import { style_ } from '../symbols';
|
|
4
|
+
export declare class Br extends ViewBase {
|
|
5
|
+
[style_]: any;
|
|
6
|
+
constructor();
|
|
7
|
+
get _view(): NativeScript.Mason.Br;
|
|
8
|
+
get windows(): NativeScript.Mason.Br;
|
|
9
|
+
get _styleHelper(): Style;
|
|
10
|
+
createNativeView(): NativeScript.Mason.Br;
|
|
11
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ViewBase } from '@nativescript/core';
|
|
2
|
+
import { Style } from '../style';
|
|
3
|
+
import { Tree } from '../tree';
|
|
4
|
+
import { isMasonView_, isPlaceholder_, native_, style_ } from '../symbols';
|
|
5
|
+
export class Br extends ViewBase {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this[isMasonView_] = true;
|
|
9
|
+
this[isPlaceholder_] = true;
|
|
10
|
+
}
|
|
11
|
+
get _view() {
|
|
12
|
+
if (!this[native_]) {
|
|
13
|
+
this[native_] = Tree.instance.createBr();
|
|
14
|
+
}
|
|
15
|
+
return this[native_];
|
|
16
|
+
}
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
get windows() {
|
|
19
|
+
return this._view;
|
|
20
|
+
}
|
|
21
|
+
get _styleHelper() {
|
|
22
|
+
if (this[style_] === undefined) {
|
|
23
|
+
this[style_] = Style.fromView(this, this._view);
|
|
24
|
+
}
|
|
25
|
+
return this[style_];
|
|
26
|
+
}
|
|
27
|
+
createNativeView() {
|
|
28
|
+
return this._view;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=index.windows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.windows.js","sourceRoot":"","sources":["../../../../packages/nativescript-masonkit/br/index.windows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAE3E,MAAM,OAAO,EAAG,SAAQ,QAAQ;IAE9B;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;QAC1B,IAAI,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;IAC9B,CAAC;IAED,IAAI,KAAK;QACP,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACnB,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAW,CAAC;QACpD,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAmC,CAAC;IACzD,CAAC;IAED,aAAa;IACb,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,IAAI,YAAY;QACd,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,SAAS,EAAE,CAAC;YAC/B,IAAI,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAa,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ButtonBase } from '../common';
|
|
2
|
+
import { Style } from '../style';
|
|
3
|
+
import { style_ } from '../symbols';
|
|
4
|
+
export declare class Button extends ButtonBase {
|
|
5
|
+
[style_]: any;
|
|
6
|
+
_inBatch: boolean;
|
|
7
|
+
constructor();
|
|
8
|
+
get _view(): NativeScript.Mason.Button;
|
|
9
|
+
get windows(): NativeScript.Mason.Button;
|
|
10
|
+
get _styleHelper(): Style;
|
|
11
|
+
createNativeView(): NativeScript.Mason.Button;
|
|
12
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { CSSType } from '@nativescript/core';
|
|
2
|
+
import { ButtonBase, textContentProperty } from '../common';
|
|
3
|
+
import { Style } from '../style';
|
|
4
|
+
import { Tree } from '../tree';
|
|
5
|
+
import { style_, isText_, isMasonView_, native_ } from '../symbols';
|
|
6
|
+
let Button = class Button extends ButtonBase {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this._inBatch = false;
|
|
10
|
+
this[isText_] = true;
|
|
11
|
+
this[isMasonView_] = true;
|
|
12
|
+
}
|
|
13
|
+
get _view() {
|
|
14
|
+
if (!this[native_]) {
|
|
15
|
+
this[native_] = Tree.instance.createButtonView();
|
|
16
|
+
}
|
|
17
|
+
return this[native_];
|
|
18
|
+
}
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
get windows() {
|
|
21
|
+
return this._view;
|
|
22
|
+
}
|
|
23
|
+
get _styleHelper() {
|
|
24
|
+
if (this[style_] === undefined) {
|
|
25
|
+
this[style_] = Style.fromView(this, this._view);
|
|
26
|
+
}
|
|
27
|
+
return this[style_];
|
|
28
|
+
}
|
|
29
|
+
createNativeView() {
|
|
30
|
+
return this._view;
|
|
31
|
+
}
|
|
32
|
+
[textContentProperty.setNative](value) {
|
|
33
|
+
const nativeView = this._view;
|
|
34
|
+
if (nativeView) {
|
|
35
|
+
nativeView.Content = value ?? '';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
Button = __decorate([
|
|
40
|
+
CSSType('Button'),
|
|
41
|
+
__metadata("design:paramtypes", [])
|
|
42
|
+
], Button);
|
|
43
|
+
export { Button };
|
|
44
|
+
//# sourceMappingURL=index.windows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.windows.js","sourceRoot":"","sources":["../../../../packages/nativescript-masonkit/button/index.windows.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG7D,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,UAAU;IAGpC;QACE,KAAK,EAAE,CAAC;QAFV,aAAQ,GAAG,KAAK,CAAC;QAGf,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;IAC5B,CAAC;IAED,IAAI,KAAK;QACP,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACnB,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAW,CAAC;QAC5D,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAuC,CAAC;IAC7D,CAAC;IAED,aAAa;IACb,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,IAAI,YAAY;QACd,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,SAAS,EAAE,CAAC;YAC/B,IAAI,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAa,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC3D,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;IACtB,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC,KAAK;QACnC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC;QAC9B,IAAI,UAAU,EAAE,CAAC;YACf,UAAU,CAAC,OAAO,GAAG,KAAK,IAAI,EAAE,CAAC;QACnC,CAAC;IACH,CAAC;CACF,CAAA;AAtCY,MAAM;IADlB,OAAO,CAAC,QAAQ,CAAC;;GACL,MAAM,CAsClB"}
|
package/common.d.ts
CHANGED
|
@@ -161,6 +161,7 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
|
|
|
161
161
|
private _nativeReplaceChild;
|
|
162
162
|
private _setOrPushChild;
|
|
163
163
|
private _updateTextNode;
|
|
164
|
+
private _syncTextRunLayout;
|
|
164
165
|
get filter(): string;
|
|
165
166
|
set filter(value: string);
|
|
166
167
|
set borderRadius(value: string | number | CoreTypes.LengthDipUnit | CoreTypes.LengthPxUnit);
|
|
@@ -183,6 +184,7 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
|
|
|
183
184
|
set scrollBarWidth(value: Length);
|
|
184
185
|
get position(): Position;
|
|
185
186
|
set position(value: Position);
|
|
187
|
+
private _applyTextRunProp;
|
|
186
188
|
get alignContent(): import("@nativescript/core").AlignContent;
|
|
187
189
|
set alignContent(value: import("@nativescript/core").AlignContent);
|
|
188
190
|
get justifyItems(): import(".").AlignItems;
|
package/common.js
CHANGED
|
@@ -3,6 +3,7 @@ var _a, _b, _c, _d;
|
|
|
3
3
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
4
4
|
import { CustomLayoutView, View as NSView, getViewById, Property, widthProperty, heightProperty, marginLeftProperty, marginRightProperty, marginTopProperty, marginBottomProperty, minWidthProperty, minHeightProperty, fontSizeProperty, fontWeightProperty, fontStyleProperty, colorProperty, Color, lineHeightProperty, letterSpacingProperty, textAlignmentProperty, textDecorationProperty, borderLeftWidthProperty, borderTopWidthProperty, borderRightWidthProperty, borderBottomWidthProperty, backgroundColorProperty, paddingLeftProperty, paddingRightProperty, paddingTopProperty, paddingBottomProperty, zIndexProperty, PseudoClassHandler } from '@nativescript/core';
|
|
5
5
|
import { alignItemsProperty, alignSelfProperty, flexDirectionProperty, flexGrowProperty, flexShrinkProperty, flexWrapProperty, justifyContentProperty } from '@nativescript/core/ui/layouts/flexbox-layout';
|
|
6
|
+
import { fontInternalProperty } from '@nativescript/core/ui/styling/style-properties';
|
|
6
7
|
import { _forceStyleUpdate } from './utils';
|
|
7
8
|
import { Style } from './style';
|
|
8
9
|
import { alignContentProperty, aspectRatioProperty, backgroundProperty, borderProperty, borderLeftProperty, borderTopProperty, borderRightProperty, borderBottomProperty, 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, backgroundImageProperty, listStyleTypeProperty, listStylePositionProperty, } from './properties';
|
|
@@ -14,11 +15,72 @@ function getViewStyle(view) {
|
|
|
14
15
|
const ret = (__ANDROID__ ? view.get() : view.deref());
|
|
15
16
|
return ret._styleHelper;
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
// move to cpp
|
|
19
|
+
function parseCssTransformToMatrix(s) {
|
|
20
|
+
if (!s || s === 'none')
|
|
21
|
+
return null;
|
|
22
|
+
let tx = 0, ty = 0, rad = 0, sx = 1, sy = 1;
|
|
23
|
+
let found = false;
|
|
24
|
+
const re = /(\w+)\(([^)]*)\)/g;
|
|
25
|
+
let m;
|
|
26
|
+
while ((m = re.exec(s))) {
|
|
27
|
+
found = true;
|
|
28
|
+
const args = m[2].split(',').map((a) => parseFloat(a.trim()));
|
|
29
|
+
switch (m[1]) {
|
|
30
|
+
case 'translate':
|
|
31
|
+
tx += args[0] || 0;
|
|
32
|
+
ty += args[1] || 0;
|
|
33
|
+
break;
|
|
34
|
+
case 'translateX':
|
|
35
|
+
tx += args[0] || 0;
|
|
36
|
+
break;
|
|
37
|
+
case 'translateY':
|
|
38
|
+
ty += args[0] || 0;
|
|
39
|
+
break;
|
|
40
|
+
case 'rotate':
|
|
41
|
+
case 'rotateZ':
|
|
42
|
+
rad += ((args[0] || 0) * Math.PI) / 180;
|
|
43
|
+
break;
|
|
44
|
+
case 'scale':
|
|
45
|
+
sx *= args[0] != null ? args[0] : 1;
|
|
46
|
+
sy *= args[1] != null ? args[1] : args[0] != null ? args[0] : 1;
|
|
47
|
+
break;
|
|
48
|
+
case 'scaleX':
|
|
49
|
+
sx *= args[0] != null ? args[0] : 1;
|
|
50
|
+
break;
|
|
51
|
+
case 'scaleY':
|
|
52
|
+
sy *= args[0] != null ? args[0] : 1;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (!found)
|
|
57
|
+
return null;
|
|
58
|
+
const cos = Math.cos(rad), sin = Math.sin(rad);
|
|
59
|
+
// CSS matrix(a,b,c,d,e,f) of rotate*scale → WinUI Matrix(M11,M12,M21,M22,OffsetX,OffsetY).
|
|
60
|
+
return { m11: sx * cos, m12: sx * sin, m21: -sy * sin, m22: sy * cos, tx, ty };
|
|
61
|
+
}
|
|
62
|
+
// move to cpp
|
|
63
|
+
function parseBoxShadow(s) {
|
|
64
|
+
if (!s || s === 'none')
|
|
65
|
+
return null;
|
|
66
|
+
let color = 'rgba(0,0,0,0.2)';
|
|
67
|
+
let rest = s;
|
|
68
|
+
const m = s.match(/rgba?\([^)]*\)|#[0-9a-fA-F]{3,8}/);
|
|
69
|
+
if (m) {
|
|
70
|
+
color = m[0];
|
|
71
|
+
rest = s.replace(m[0], ' ');
|
|
72
|
+
}
|
|
73
|
+
const nums = (rest.match(/-?\d*\.?\d+/g) || []).map((n) => parseFloat(n));
|
|
74
|
+
const ox = nums[0] || 0, oy = nums[1] || 0, blur = nums[2] || 0;
|
|
75
|
+
let argb = 0x33000000;
|
|
76
|
+
try {
|
|
77
|
+
argb = new Color(color).argb >>> 0;
|
|
78
|
+
}
|
|
79
|
+
catch (_) {
|
|
80
|
+
/* keep default */
|
|
81
|
+
}
|
|
82
|
+
return { ox, oy, blur, argb };
|
|
83
|
+
}
|
|
22
84
|
const _frameworkAccessorCache = new WeakMap();
|
|
23
85
|
function getFrameworkElement(view) {
|
|
24
86
|
const cached = _frameworkAccessorCache.get(view);
|
|
@@ -186,6 +248,40 @@ export class ViewBase extends CustomLayoutView {
|
|
|
186
248
|
});
|
|
187
249
|
callback['mason:event:id'] = id;
|
|
188
250
|
}
|
|
251
|
+
if (__WINDOWS__) {
|
|
252
|
+
if (arg === 'click' || arg === 'tap') {
|
|
253
|
+
try {
|
|
254
|
+
const NSWinRT_ = globalThis.NSWinRT;
|
|
255
|
+
const MUX = globalThis.Microsoft;
|
|
256
|
+
const owner = this;
|
|
257
|
+
const view = this._view;
|
|
258
|
+
const delegate = NSWinRT_.asDelegate('Microsoft.UI.Xaml.Input.TappedEventHandler', (_sender, _e) => {
|
|
259
|
+
const ret = {};
|
|
260
|
+
ret[native_] = _e;
|
|
261
|
+
ret._target = owner;
|
|
262
|
+
callback.call(thisArg || owner, ret);
|
|
263
|
+
});
|
|
264
|
+
if (view.Background == null && MUX?.UI?.Xaml?.Media?.SolidColorBrush) {
|
|
265
|
+
view.Background = new MUX.UI.Xaml.Media.SolidColorBrush(MUX.UI.Colors.Transparent);
|
|
266
|
+
}
|
|
267
|
+
const tappedEvent = MUX?.UI?.Xaml?.UIElement?.TappedEvent ?? view.TappedEvent;
|
|
268
|
+
let attached = false;
|
|
269
|
+
if (tappedEvent && typeof view.AddHandler === 'function') {
|
|
270
|
+
try {
|
|
271
|
+
view.AddHandler(tappedEvent, delegate, true);
|
|
272
|
+
callback['mason:event:tapped'] = tappedEvent;
|
|
273
|
+
attached = true;
|
|
274
|
+
}
|
|
275
|
+
catch (_e) { }
|
|
276
|
+
}
|
|
277
|
+
if (!attached) {
|
|
278
|
+
view.Tapped = delegate;
|
|
279
|
+
}
|
|
280
|
+
callback['mason:event:id'] = delegate;
|
|
281
|
+
}
|
|
282
|
+
catch (_) { }
|
|
283
|
+
}
|
|
284
|
+
}
|
|
189
285
|
}
|
|
190
286
|
}
|
|
191
287
|
_unregisterNativeEvent(arg, callback, thisArg) {
|
|
@@ -212,6 +308,23 @@ export class ViewBase extends CustomLayoutView {
|
|
|
212
308
|
callback['mason:event:id'] = undefined;
|
|
213
309
|
}
|
|
214
310
|
}
|
|
311
|
+
if (__WINDOWS__) {
|
|
312
|
+
if (id && (arg === 'click' || arg === 'tap')) {
|
|
313
|
+
try {
|
|
314
|
+
const view = this._view;
|
|
315
|
+
const tappedEvent = callback['mason:event:tapped'];
|
|
316
|
+
if (tappedEvent && typeof view.RemoveHandler === 'function') {
|
|
317
|
+
view.RemoveHandler(tappedEvent, id);
|
|
318
|
+
}
|
|
319
|
+
else if (view) {
|
|
320
|
+
view.Tapped = null;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
catch (_) { }
|
|
324
|
+
callback['mason:event:id'] = undefined;
|
|
325
|
+
callback['mason:event:tapped'] = undefined;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
215
328
|
}
|
|
216
329
|
}
|
|
217
330
|
initNativeView() {
|
|
@@ -546,6 +659,7 @@ export class ViewBase extends CustomLayoutView {
|
|
|
546
659
|
// Drop the proxy binding so a later re-adopt re-installs cleanly.
|
|
547
660
|
child[textNodeProxied_] = false;
|
|
548
661
|
child[textNode_] = undefined;
|
|
662
|
+
this._syncTextRunLayout();
|
|
549
663
|
this.requestLayout?.();
|
|
550
664
|
return;
|
|
551
665
|
}
|
|
@@ -579,6 +693,11 @@ export class ViewBase extends CustomLayoutView {
|
|
|
579
693
|
else
|
|
580
694
|
view.mason_removeChildAt?.(index);
|
|
581
695
|
}
|
|
696
|
+
if (__WINDOWS__) {
|
|
697
|
+
//@ts-ignore
|
|
698
|
+
if (typeof view.RemoveRun === 'function')
|
|
699
|
+
view.RemoveRun(node);
|
|
700
|
+
}
|
|
582
701
|
}
|
|
583
702
|
removeChildren() {
|
|
584
703
|
if (this._viewChildren.length === 0) {
|
|
@@ -659,6 +778,9 @@ export class ViewBase extends CustomLayoutView {
|
|
|
659
778
|
if (__APPLE__) {
|
|
660
779
|
node[textNode_].data = text;
|
|
661
780
|
}
|
|
781
|
+
if (__WINDOWS__) {
|
|
782
|
+
node[textNode_].Data = text;
|
|
783
|
+
}
|
|
662
784
|
this._installTextNodeProxy(node);
|
|
663
785
|
return node[textNode_];
|
|
664
786
|
}
|
|
@@ -669,6 +791,11 @@ export class ViewBase extends CustomLayoutView {
|
|
|
669
791
|
if (__APPLE__) {
|
|
670
792
|
textNode = MasonTextNode.alloc().initWithMasonDataAttributes(Tree.instance.native, text, null);
|
|
671
793
|
}
|
|
794
|
+
if (__WINDOWS__) {
|
|
795
|
+
const tn = new NativeScript.Mason.TextNode();
|
|
796
|
+
tn.Data = text;
|
|
797
|
+
textNode = tn;
|
|
798
|
+
}
|
|
672
799
|
node[textNode_] = textNode;
|
|
673
800
|
// Back-reference from the native node to the framework text node.
|
|
674
801
|
textNode['__raw__'] = node;
|
|
@@ -722,6 +849,8 @@ export class ViewBase extends CustomLayoutView {
|
|
|
722
849
|
nativeTextNode.setData(data);
|
|
723
850
|
if (__APPLE__)
|
|
724
851
|
nativeTextNode.data = data;
|
|
852
|
+
if (__WINDOWS__)
|
|
853
|
+
nativeTextNode.Data = data;
|
|
725
854
|
// Re-measure/layout so the new text is reflected on screen.
|
|
726
855
|
owner.requestLayout?.();
|
|
727
856
|
}
|
|
@@ -735,6 +864,15 @@ export class ViewBase extends CustomLayoutView {
|
|
|
735
864
|
//@ts-ignore
|
|
736
865
|
if (__APPLE__)
|
|
737
866
|
this._view.mason_addChildAtNode(textNode, index);
|
|
867
|
+
if (__WINDOWS__) {
|
|
868
|
+
const view = this._view;
|
|
869
|
+
if (!view)
|
|
870
|
+
return;
|
|
871
|
+
if (typeof view.SetRun === 'function')
|
|
872
|
+
view.SetRun(textNode, index);
|
|
873
|
+
else
|
|
874
|
+
NativeScript.Mason.Css.ReparentChild(view, textNode, index);
|
|
875
|
+
}
|
|
738
876
|
}
|
|
739
877
|
_nativeReplaceChild(textNode, index) {
|
|
740
878
|
//@ts-ignore
|
|
@@ -743,6 +881,15 @@ export class ViewBase extends CustomLayoutView {
|
|
|
743
881
|
//@ts-ignore
|
|
744
882
|
if (__APPLE__)
|
|
745
883
|
this._view.mason_replaceChildAtNode(textNode, index);
|
|
884
|
+
if (__WINDOWS__) {
|
|
885
|
+
const view = this._view;
|
|
886
|
+
if (!view)
|
|
887
|
+
return;
|
|
888
|
+
if (typeof view.SetRun === 'function')
|
|
889
|
+
view.SetRun(textNode, index);
|
|
890
|
+
else
|
|
891
|
+
NativeScript.Mason.Css.ReparentChild(view, textNode, index);
|
|
892
|
+
}
|
|
746
893
|
}
|
|
747
894
|
_setOrPushChild(index, entry) {
|
|
748
895
|
if (this._children.length > index) {
|
|
@@ -758,6 +905,9 @@ export class ViewBase extends CustomLayoutView {
|
|
|
758
905
|
_updateTextNode(node, operation = null) {
|
|
759
906
|
const text = node.text ?? node.data ?? '';
|
|
760
907
|
const textNode = this._createOrUpdateNativeTextNode(node, text);
|
|
908
|
+
if (__WINDOWS__ && textNode && typeof textNode.SetBreak === 'function') {
|
|
909
|
+
textNode.SetBreak(!!operation?.isBreak);
|
|
910
|
+
}
|
|
761
911
|
if (!operation)
|
|
762
912
|
return;
|
|
763
913
|
const entry = { [text_]: text, [textNode_]: textNode, [textNodeIndex_]: operation.index ?? this._children.length };
|
|
@@ -776,6 +926,21 @@ export class ViewBase extends CustomLayoutView {
|
|
|
776
926
|
this._setOrPushChild(operation.index, entry);
|
|
777
927
|
break;
|
|
778
928
|
}
|
|
929
|
+
this._syncTextRunLayout();
|
|
930
|
+
}
|
|
931
|
+
_syncTextRunLayout() {
|
|
932
|
+
if (!__WINDOWS__)
|
|
933
|
+
return;
|
|
934
|
+
// @ts-ignore
|
|
935
|
+
const sh = this._styleHelper;
|
|
936
|
+
if (!sh)
|
|
937
|
+
return;
|
|
938
|
+
try {
|
|
939
|
+
sh.display = 'block';
|
|
940
|
+
}
|
|
941
|
+
catch (_) {
|
|
942
|
+
// empty
|
|
943
|
+
}
|
|
779
944
|
}
|
|
780
945
|
// -- Text setter with per-view framework detection --
|
|
781
946
|
[textProperty.setNative](value) {
|
|
@@ -954,6 +1119,13 @@ export class ViewBase extends CustomLayoutView {
|
|
|
954
1119
|
// @ts-ignore
|
|
955
1120
|
const style = this._styleHelper;
|
|
956
1121
|
if (style) {
|
|
1122
|
+
// Pass the raw value straight through — the style setter's normalizeColorValue handles
|
|
1123
|
+
// number / string / Color / {argb} via duck-typing, which is robust even when a `Color`
|
|
1124
|
+
// instance comes from a different @nativescript/core copy (cross-copy `instanceof` fails).
|
|
1125
|
+
// @ts-ignore
|
|
1126
|
+
style.backgroundColor = value;
|
|
1127
|
+
return;
|
|
1128
|
+
// eslint-disable-next-line no-unreachable
|
|
957
1129
|
switch (typeof value) {
|
|
958
1130
|
case 'number':
|
|
959
1131
|
// @ts-ignore
|
|
@@ -1012,26 +1184,23 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1012
1184
|
[lineHeightProperty.setNative](value) {
|
|
1013
1185
|
// @ts-ignore
|
|
1014
1186
|
const style = this._styleHelper;
|
|
1015
|
-
|
|
1016
|
-
|
|
1187
|
+
// @ts-ignore
|
|
1188
|
+
if (style)
|
|
1017
1189
|
style.lineHeight = value;
|
|
1018
|
-
}
|
|
1019
1190
|
}
|
|
1020
1191
|
[letterSpacingProperty.setNative](value) {
|
|
1021
1192
|
// @ts-ignore
|
|
1022
1193
|
const style = this._styleHelper;
|
|
1023
|
-
|
|
1024
|
-
|
|
1194
|
+
// @ts-ignore
|
|
1195
|
+
if (style)
|
|
1025
1196
|
style.letterSpacing = value;
|
|
1026
|
-
}
|
|
1027
1197
|
}
|
|
1028
1198
|
[textAlignmentProperty.setNative](value) {
|
|
1029
1199
|
// @ts-ignore
|
|
1030
1200
|
const style = this._styleHelper;
|
|
1031
|
-
|
|
1032
|
-
|
|
1201
|
+
// @ts-ignore
|
|
1202
|
+
if (style)
|
|
1033
1203
|
style.textAlignment = value;
|
|
1034
|
-
}
|
|
1035
1204
|
}
|
|
1036
1205
|
[textDecorationProperty.setNative](value) {
|
|
1037
1206
|
// @ts-ignore
|
|
@@ -1050,6 +1219,13 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1050
1219
|
// @ts-ignore
|
|
1051
1220
|
this.nativeView.style.setBorderColor(String(value));
|
|
1052
1221
|
}
|
|
1222
|
+
else if (__WINDOWS__) {
|
|
1223
|
+
// @ts-ignore
|
|
1224
|
+
const style = this._styleHelper;
|
|
1225
|
+
// @ts-ignore
|
|
1226
|
+
if (style)
|
|
1227
|
+
style.setBorderColor(String(value));
|
|
1228
|
+
}
|
|
1053
1229
|
}
|
|
1054
1230
|
// @ts-ignore
|
|
1055
1231
|
[backgroundImageProperty.setNative](value) {
|
|
@@ -1172,13 +1348,35 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1172
1348
|
style.position = value;
|
|
1173
1349
|
}
|
|
1174
1350
|
}
|
|
1351
|
+
// Font props only land in the style buffer, which the TextBlock-backed text doesn't read, so they
|
|
1352
|
+
// must be forwarded to the native Text control to take visual effect. No-op off a Text container.
|
|
1353
|
+
_applyTextRunProp(method, arg) {
|
|
1354
|
+
if (!__WINDOWS__)
|
|
1355
|
+
return;
|
|
1356
|
+
try {
|
|
1357
|
+
const view = this._view;
|
|
1358
|
+
if (view && typeof view[method] === 'function')
|
|
1359
|
+
view[method](arg);
|
|
1360
|
+
}
|
|
1361
|
+
catch (_) { }
|
|
1362
|
+
}
|
|
1175
1363
|
[colorProperty.setNative](value) {
|
|
1176
|
-
|
|
1364
|
+
// @ts-ignore
|
|
1365
|
+
const style = this._styleHelper;
|
|
1366
|
+
if (style) {
|
|
1367
|
+
// Duck-typed via normalizeColorValue (robust to cross-core Color instances).
|
|
1177
1368
|
// @ts-ignore
|
|
1178
|
-
|
|
1179
|
-
if (
|
|
1180
|
-
//
|
|
1181
|
-
|
|
1369
|
+
style.color = value;
|
|
1370
|
+
if (__WINDOWS__) {
|
|
1371
|
+
// Push the resolved color to the Text container's TextBlock (the default for all runs).
|
|
1372
|
+
// Imperative — not during layout.
|
|
1373
|
+
try {
|
|
1374
|
+
const argb = style.color >>> 0 || 0;
|
|
1375
|
+
const view = this._view;
|
|
1376
|
+
if (view && argb && typeof view.SetColor === 'function')
|
|
1377
|
+
view.SetColor(argb);
|
|
1378
|
+
}
|
|
1379
|
+
catch (_) { }
|
|
1182
1380
|
}
|
|
1183
1381
|
}
|
|
1184
1382
|
}
|
|
@@ -1751,6 +1949,19 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1751
1949
|
if (style) {
|
|
1752
1950
|
// @ts-ignore
|
|
1753
1951
|
style.boxShadow = value;
|
|
1952
|
+
if (__WINDOWS__) {
|
|
1953
|
+
// box-shadow isn't a Mason buffer prop — render it as a Composition DropShadow on the element
|
|
1954
|
+
// (masked to its rounded-rect shape, re-applied on resize). The corner radius is read natively.
|
|
1955
|
+
const nv = this.nativeViewProtected ?? this._view;
|
|
1956
|
+
try {
|
|
1957
|
+
const sh = parseBoxShadow(typeof value === 'string' ? value : '');
|
|
1958
|
+
if (!sh)
|
|
1959
|
+
NativeScript.Mason.Css.ClearShadow(nv);
|
|
1960
|
+
else
|
|
1961
|
+
NativeScript.Mason.Css.ApplyShadow(nv, sh.ox, sh.oy, sh.blur, sh.argb, 0);
|
|
1962
|
+
}
|
|
1963
|
+
catch (_) { }
|
|
1964
|
+
}
|
|
1754
1965
|
}
|
|
1755
1966
|
}
|
|
1756
1967
|
[transformProperty.setNative](value) {
|
|
@@ -1759,6 +1970,20 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1759
1970
|
if (style) {
|
|
1760
1971
|
// @ts-ignore
|
|
1761
1972
|
style.transform = value;
|
|
1973
|
+
if (__WINDOWS__) {
|
|
1974
|
+
// transform isn't a Mason buffer prop — apply it to the FrameworkElement via Composition,
|
|
1975
|
+
// like @nativescript/core does on its own panels (the plugin's View is a custom Panel core
|
|
1976
|
+
// doesn't drive transforms on). Parse the CSS string to a matrix and set RenderTransform.
|
|
1977
|
+
const nv = this.nativeViewProtected ?? this._view;
|
|
1978
|
+
try {
|
|
1979
|
+
const mtx = parseCssTransformToMatrix(typeof value === 'string' ? value : '');
|
|
1980
|
+
if (!mtx)
|
|
1981
|
+
NativeScript.Mason.Css.ClearTransform(nv);
|
|
1982
|
+
else
|
|
1983
|
+
NativeScript.Mason.Css.ApplyTransform(nv, mtx.m11, mtx.m12, mtx.m21, mtx.m22, mtx.tx, mtx.ty);
|
|
1984
|
+
}
|
|
1985
|
+
catch (_) { }
|
|
1986
|
+
}
|
|
1762
1987
|
}
|
|
1763
1988
|
}
|
|
1764
1989
|
}
|
|
@@ -1788,6 +2013,19 @@ __decorate([
|
|
|
1788
2013
|
], ViewBase.prototype, "_blurHandler", null);
|
|
1789
2014
|
textProperty.register(ViewBase);
|
|
1790
2015
|
export class TextBase extends ViewBase {
|
|
2016
|
+
[fontInternalProperty.setNative](value) {
|
|
2017
|
+
if (!__WINDOWS__)
|
|
2018
|
+
return;
|
|
2019
|
+
// @ts-ignore
|
|
2020
|
+
const view = this._view;
|
|
2021
|
+
if (!view || typeof view.SetFontFamily !== 'function')
|
|
2022
|
+
return;
|
|
2023
|
+
const family = value && typeof value === 'object' ? (value.fontFamily ?? '') : '';
|
|
2024
|
+
try {
|
|
2025
|
+
view.SetFontFamily(String(family ?? ''));
|
|
2026
|
+
}
|
|
2027
|
+
catch (_) { }
|
|
2028
|
+
}
|
|
1791
2029
|
[textWrapProperty.setNative](value) {
|
|
1792
2030
|
// @ts-ignore
|
|
1793
2031
|
const style = this._styleHelper;
|