@triniwiz/nativescript-masonkit 1.0.0-beta.85 → 1.0.0-beta.86
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 +238 -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 +1 -0
- package/style.js +377 -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
|
@@ -14,11 +14,72 @@ function getViewStyle(view) {
|
|
|
14
14
|
const ret = (__ANDROID__ ? view.get() : view.deref());
|
|
15
15
|
return ret._styleHelper;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
// move to cpp
|
|
18
|
+
function parseCssTransformToMatrix(s) {
|
|
19
|
+
if (!s || s === 'none')
|
|
20
|
+
return null;
|
|
21
|
+
let tx = 0, ty = 0, rad = 0, sx = 1, sy = 1;
|
|
22
|
+
let found = false;
|
|
23
|
+
const re = /(\w+)\(([^)]*)\)/g;
|
|
24
|
+
let m;
|
|
25
|
+
while ((m = re.exec(s))) {
|
|
26
|
+
found = true;
|
|
27
|
+
const args = m[2].split(',').map((a) => parseFloat(a.trim()));
|
|
28
|
+
switch (m[1]) {
|
|
29
|
+
case 'translate':
|
|
30
|
+
tx += args[0] || 0;
|
|
31
|
+
ty += args[1] || 0;
|
|
32
|
+
break;
|
|
33
|
+
case 'translateX':
|
|
34
|
+
tx += args[0] || 0;
|
|
35
|
+
break;
|
|
36
|
+
case 'translateY':
|
|
37
|
+
ty += args[0] || 0;
|
|
38
|
+
break;
|
|
39
|
+
case 'rotate':
|
|
40
|
+
case 'rotateZ':
|
|
41
|
+
rad += ((args[0] || 0) * Math.PI) / 180;
|
|
42
|
+
break;
|
|
43
|
+
case 'scale':
|
|
44
|
+
sx *= args[0] != null ? args[0] : 1;
|
|
45
|
+
sy *= args[1] != null ? args[1] : args[0] != null ? args[0] : 1;
|
|
46
|
+
break;
|
|
47
|
+
case 'scaleX':
|
|
48
|
+
sx *= args[0] != null ? args[0] : 1;
|
|
49
|
+
break;
|
|
50
|
+
case 'scaleY':
|
|
51
|
+
sy *= args[0] != null ? args[0] : 1;
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (!found)
|
|
56
|
+
return null;
|
|
57
|
+
const cos = Math.cos(rad), sin = Math.sin(rad);
|
|
58
|
+
// CSS matrix(a,b,c,d,e,f) of rotate*scale → WinUI Matrix(M11,M12,M21,M22,OffsetX,OffsetY).
|
|
59
|
+
return { m11: sx * cos, m12: sx * sin, m21: -sy * sin, m22: sy * cos, tx, ty };
|
|
60
|
+
}
|
|
61
|
+
// move to cpp
|
|
62
|
+
function parseBoxShadow(s) {
|
|
63
|
+
if (!s || s === 'none')
|
|
64
|
+
return null;
|
|
65
|
+
let color = 'rgba(0,0,0,0.2)';
|
|
66
|
+
let rest = s;
|
|
67
|
+
const m = s.match(/rgba?\([^)]*\)|#[0-9a-fA-F]{3,8}/);
|
|
68
|
+
if (m) {
|
|
69
|
+
color = m[0];
|
|
70
|
+
rest = s.replace(m[0], ' ');
|
|
71
|
+
}
|
|
72
|
+
const nums = (rest.match(/-?\d*\.?\d+/g) || []).map((n) => parseFloat(n));
|
|
73
|
+
const ox = nums[0] || 0, oy = nums[1] || 0, blur = nums[2] || 0;
|
|
74
|
+
let argb = 0x33000000;
|
|
75
|
+
try {
|
|
76
|
+
argb = new Color(color).argb >>> 0;
|
|
77
|
+
}
|
|
78
|
+
catch (_) {
|
|
79
|
+
/* keep default */
|
|
80
|
+
}
|
|
81
|
+
return { ox, oy, blur, argb };
|
|
82
|
+
}
|
|
22
83
|
const _frameworkAccessorCache = new WeakMap();
|
|
23
84
|
function getFrameworkElement(view) {
|
|
24
85
|
const cached = _frameworkAccessorCache.get(view);
|
|
@@ -186,6 +247,40 @@ export class ViewBase extends CustomLayoutView {
|
|
|
186
247
|
});
|
|
187
248
|
callback['mason:event:id'] = id;
|
|
188
249
|
}
|
|
250
|
+
if (__WINDOWS__) {
|
|
251
|
+
if (arg === 'click' || arg === 'tap') {
|
|
252
|
+
try {
|
|
253
|
+
const NSWinRT_ = globalThis.NSWinRT;
|
|
254
|
+
const MUX = globalThis.Microsoft;
|
|
255
|
+
const owner = this;
|
|
256
|
+
const view = this._view;
|
|
257
|
+
const delegate = NSWinRT_.asDelegate('Microsoft.UI.Xaml.Input.TappedEventHandler', (_sender, _e) => {
|
|
258
|
+
const ret = {};
|
|
259
|
+
ret[native_] = _e;
|
|
260
|
+
ret._target = owner;
|
|
261
|
+
callback.call(thisArg || owner, ret);
|
|
262
|
+
});
|
|
263
|
+
if (view.Background == null && MUX?.UI?.Xaml?.Media?.SolidColorBrush) {
|
|
264
|
+
view.Background = new MUX.UI.Xaml.Media.SolidColorBrush(MUX.UI.Colors.Transparent);
|
|
265
|
+
}
|
|
266
|
+
const tappedEvent = MUX?.UI?.Xaml?.UIElement?.TappedEvent ?? view.TappedEvent;
|
|
267
|
+
let attached = false;
|
|
268
|
+
if (tappedEvent && typeof view.AddHandler === 'function') {
|
|
269
|
+
try {
|
|
270
|
+
view.AddHandler(tappedEvent, delegate, true);
|
|
271
|
+
callback['mason:event:tapped'] = tappedEvent;
|
|
272
|
+
attached = true;
|
|
273
|
+
}
|
|
274
|
+
catch (_e) { }
|
|
275
|
+
}
|
|
276
|
+
if (!attached) {
|
|
277
|
+
view.Tapped = delegate;
|
|
278
|
+
}
|
|
279
|
+
callback['mason:event:id'] = delegate;
|
|
280
|
+
}
|
|
281
|
+
catch (_) { }
|
|
282
|
+
}
|
|
283
|
+
}
|
|
189
284
|
}
|
|
190
285
|
}
|
|
191
286
|
_unregisterNativeEvent(arg, callback, thisArg) {
|
|
@@ -212,6 +307,23 @@ export class ViewBase extends CustomLayoutView {
|
|
|
212
307
|
callback['mason:event:id'] = undefined;
|
|
213
308
|
}
|
|
214
309
|
}
|
|
310
|
+
if (__WINDOWS__) {
|
|
311
|
+
if (id && (arg === 'click' || arg === 'tap')) {
|
|
312
|
+
try {
|
|
313
|
+
const view = this._view;
|
|
314
|
+
const tappedEvent = callback['mason:event:tapped'];
|
|
315
|
+
if (tappedEvent && typeof view.RemoveHandler === 'function') {
|
|
316
|
+
view.RemoveHandler(tappedEvent, id);
|
|
317
|
+
}
|
|
318
|
+
else if (view) {
|
|
319
|
+
view.Tapped = null;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
catch (_) { }
|
|
323
|
+
callback['mason:event:id'] = undefined;
|
|
324
|
+
callback['mason:event:tapped'] = undefined;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
215
327
|
}
|
|
216
328
|
}
|
|
217
329
|
initNativeView() {
|
|
@@ -546,6 +658,7 @@ export class ViewBase extends CustomLayoutView {
|
|
|
546
658
|
// Drop the proxy binding so a later re-adopt re-installs cleanly.
|
|
547
659
|
child[textNodeProxied_] = false;
|
|
548
660
|
child[textNode_] = undefined;
|
|
661
|
+
this._syncTextRunLayout();
|
|
549
662
|
this.requestLayout?.();
|
|
550
663
|
return;
|
|
551
664
|
}
|
|
@@ -579,6 +692,11 @@ export class ViewBase extends CustomLayoutView {
|
|
|
579
692
|
else
|
|
580
693
|
view.mason_removeChildAt?.(index);
|
|
581
694
|
}
|
|
695
|
+
if (__WINDOWS__) {
|
|
696
|
+
//@ts-ignore
|
|
697
|
+
if (typeof view.RemoveRun === 'function')
|
|
698
|
+
view.RemoveRun(node);
|
|
699
|
+
}
|
|
582
700
|
}
|
|
583
701
|
removeChildren() {
|
|
584
702
|
if (this._viewChildren.length === 0) {
|
|
@@ -659,6 +777,9 @@ export class ViewBase extends CustomLayoutView {
|
|
|
659
777
|
if (__APPLE__) {
|
|
660
778
|
node[textNode_].data = text;
|
|
661
779
|
}
|
|
780
|
+
if (__WINDOWS__) {
|
|
781
|
+
node[textNode_].Data = text;
|
|
782
|
+
}
|
|
662
783
|
this._installTextNodeProxy(node);
|
|
663
784
|
return node[textNode_];
|
|
664
785
|
}
|
|
@@ -669,6 +790,11 @@ export class ViewBase extends CustomLayoutView {
|
|
|
669
790
|
if (__APPLE__) {
|
|
670
791
|
textNode = MasonTextNode.alloc().initWithMasonDataAttributes(Tree.instance.native, text, null);
|
|
671
792
|
}
|
|
793
|
+
if (__WINDOWS__) {
|
|
794
|
+
const tn = new NativeScript.Mason.TextNode();
|
|
795
|
+
tn.Data = text;
|
|
796
|
+
textNode = tn;
|
|
797
|
+
}
|
|
672
798
|
node[textNode_] = textNode;
|
|
673
799
|
// Back-reference from the native node to the framework text node.
|
|
674
800
|
textNode['__raw__'] = node;
|
|
@@ -722,6 +848,8 @@ export class ViewBase extends CustomLayoutView {
|
|
|
722
848
|
nativeTextNode.setData(data);
|
|
723
849
|
if (__APPLE__)
|
|
724
850
|
nativeTextNode.data = data;
|
|
851
|
+
if (__WINDOWS__)
|
|
852
|
+
nativeTextNode.Data = data;
|
|
725
853
|
// Re-measure/layout so the new text is reflected on screen.
|
|
726
854
|
owner.requestLayout?.();
|
|
727
855
|
}
|
|
@@ -735,6 +863,15 @@ export class ViewBase extends CustomLayoutView {
|
|
|
735
863
|
//@ts-ignore
|
|
736
864
|
if (__APPLE__)
|
|
737
865
|
this._view.mason_addChildAtNode(textNode, index);
|
|
866
|
+
if (__WINDOWS__) {
|
|
867
|
+
const view = this._view;
|
|
868
|
+
if (!view)
|
|
869
|
+
return;
|
|
870
|
+
if (typeof view.SetRun === 'function')
|
|
871
|
+
view.SetRun(textNode, index);
|
|
872
|
+
else
|
|
873
|
+
NativeScript.Mason.Css.ReparentChild(view, textNode, index);
|
|
874
|
+
}
|
|
738
875
|
}
|
|
739
876
|
_nativeReplaceChild(textNode, index) {
|
|
740
877
|
//@ts-ignore
|
|
@@ -743,6 +880,15 @@ export class ViewBase extends CustomLayoutView {
|
|
|
743
880
|
//@ts-ignore
|
|
744
881
|
if (__APPLE__)
|
|
745
882
|
this._view.mason_replaceChildAtNode(textNode, index);
|
|
883
|
+
if (__WINDOWS__) {
|
|
884
|
+
const view = this._view;
|
|
885
|
+
if (!view)
|
|
886
|
+
return;
|
|
887
|
+
if (typeof view.SetRun === 'function')
|
|
888
|
+
view.SetRun(textNode, index);
|
|
889
|
+
else
|
|
890
|
+
NativeScript.Mason.Css.ReparentChild(view, textNode, index);
|
|
891
|
+
}
|
|
746
892
|
}
|
|
747
893
|
_setOrPushChild(index, entry) {
|
|
748
894
|
if (this._children.length > index) {
|
|
@@ -758,6 +904,9 @@ export class ViewBase extends CustomLayoutView {
|
|
|
758
904
|
_updateTextNode(node, operation = null) {
|
|
759
905
|
const text = node.text ?? node.data ?? '';
|
|
760
906
|
const textNode = this._createOrUpdateNativeTextNode(node, text);
|
|
907
|
+
if (__WINDOWS__ && textNode && typeof textNode.SetBreak === 'function') {
|
|
908
|
+
textNode.SetBreak(!!operation?.isBreak);
|
|
909
|
+
}
|
|
761
910
|
if (!operation)
|
|
762
911
|
return;
|
|
763
912
|
const entry = { [text_]: text, [textNode_]: textNode, [textNodeIndex_]: operation.index ?? this._children.length };
|
|
@@ -776,6 +925,21 @@ export class ViewBase extends CustomLayoutView {
|
|
|
776
925
|
this._setOrPushChild(operation.index, entry);
|
|
777
926
|
break;
|
|
778
927
|
}
|
|
928
|
+
this._syncTextRunLayout();
|
|
929
|
+
}
|
|
930
|
+
_syncTextRunLayout() {
|
|
931
|
+
if (!__WINDOWS__)
|
|
932
|
+
return;
|
|
933
|
+
// @ts-ignore
|
|
934
|
+
const sh = this._styleHelper;
|
|
935
|
+
if (!sh)
|
|
936
|
+
return;
|
|
937
|
+
try {
|
|
938
|
+
sh.display = 'block';
|
|
939
|
+
}
|
|
940
|
+
catch (_) {
|
|
941
|
+
// empty
|
|
942
|
+
}
|
|
779
943
|
}
|
|
780
944
|
// -- Text setter with per-view framework detection --
|
|
781
945
|
[textProperty.setNative](value) {
|
|
@@ -954,6 +1118,13 @@ export class ViewBase extends CustomLayoutView {
|
|
|
954
1118
|
// @ts-ignore
|
|
955
1119
|
const style = this._styleHelper;
|
|
956
1120
|
if (style) {
|
|
1121
|
+
// Pass the raw value straight through — the style setter's normalizeColorValue handles
|
|
1122
|
+
// number / string / Color / {argb} via duck-typing, which is robust even when a `Color`
|
|
1123
|
+
// instance comes from a different @nativescript/core copy (cross-copy `instanceof` fails).
|
|
1124
|
+
// @ts-ignore
|
|
1125
|
+
style.backgroundColor = value;
|
|
1126
|
+
return;
|
|
1127
|
+
// eslint-disable-next-line no-unreachable
|
|
957
1128
|
switch (typeof value) {
|
|
958
1129
|
case 'number':
|
|
959
1130
|
// @ts-ignore
|
|
@@ -1012,26 +1183,23 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1012
1183
|
[lineHeightProperty.setNative](value) {
|
|
1013
1184
|
// @ts-ignore
|
|
1014
1185
|
const style = this._styleHelper;
|
|
1015
|
-
|
|
1016
|
-
|
|
1186
|
+
// @ts-ignore
|
|
1187
|
+
if (style)
|
|
1017
1188
|
style.lineHeight = value;
|
|
1018
|
-
}
|
|
1019
1189
|
}
|
|
1020
1190
|
[letterSpacingProperty.setNative](value) {
|
|
1021
1191
|
// @ts-ignore
|
|
1022
1192
|
const style = this._styleHelper;
|
|
1023
|
-
|
|
1024
|
-
|
|
1193
|
+
// @ts-ignore
|
|
1194
|
+
if (style)
|
|
1025
1195
|
style.letterSpacing = value;
|
|
1026
|
-
}
|
|
1027
1196
|
}
|
|
1028
1197
|
[textAlignmentProperty.setNative](value) {
|
|
1029
1198
|
// @ts-ignore
|
|
1030
1199
|
const style = this._styleHelper;
|
|
1031
|
-
|
|
1032
|
-
|
|
1200
|
+
// @ts-ignore
|
|
1201
|
+
if (style)
|
|
1033
1202
|
style.textAlignment = value;
|
|
1034
|
-
}
|
|
1035
1203
|
}
|
|
1036
1204
|
[textDecorationProperty.setNative](value) {
|
|
1037
1205
|
// @ts-ignore
|
|
@@ -1172,13 +1340,37 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1172
1340
|
style.position = value;
|
|
1173
1341
|
}
|
|
1174
1342
|
}
|
|
1343
|
+
// Windows: push a font/text property to the native Text container, which applies it to its
|
|
1344
|
+
// TextBlock (the default for all inline runs). Font props otherwise only land in the style buffer,
|
|
1345
|
+
// which the TextBlock-backed text doesn't read — so size/weight/line-height/letter-spacing
|
|
1346
|
+
// wouldn't change visually. No-op on a container that isn't a Text.
|
|
1347
|
+
_applyTextRunProp(method, arg) {
|
|
1348
|
+
if (!__WINDOWS__)
|
|
1349
|
+
return;
|
|
1350
|
+
try {
|
|
1351
|
+
const view = this._view;
|
|
1352
|
+
if (view && typeof view[method] === 'function')
|
|
1353
|
+
view[method](arg);
|
|
1354
|
+
}
|
|
1355
|
+
catch (_) { }
|
|
1356
|
+
}
|
|
1175
1357
|
[colorProperty.setNative](value) {
|
|
1176
|
-
|
|
1358
|
+
// @ts-ignore
|
|
1359
|
+
const style = this._styleHelper;
|
|
1360
|
+
if (style) {
|
|
1361
|
+
// Duck-typed via normalizeColorValue (robust to cross-core Color instances).
|
|
1177
1362
|
// @ts-ignore
|
|
1178
|
-
|
|
1179
|
-
if (
|
|
1180
|
-
//
|
|
1181
|
-
|
|
1363
|
+
style.color = value;
|
|
1364
|
+
if (__WINDOWS__) {
|
|
1365
|
+
// Push the resolved color to the Text container's TextBlock (the default for all runs).
|
|
1366
|
+
// Imperative — not during layout.
|
|
1367
|
+
try {
|
|
1368
|
+
const argb = style.color >>> 0 || 0;
|
|
1369
|
+
const view = this._view;
|
|
1370
|
+
if (view && argb && typeof view.SetColor === 'function')
|
|
1371
|
+
view.SetColor(argb);
|
|
1372
|
+
}
|
|
1373
|
+
catch (_) { }
|
|
1182
1374
|
}
|
|
1183
1375
|
}
|
|
1184
1376
|
}
|
|
@@ -1751,6 +1943,19 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1751
1943
|
if (style) {
|
|
1752
1944
|
// @ts-ignore
|
|
1753
1945
|
style.boxShadow = value;
|
|
1946
|
+
if (__WINDOWS__) {
|
|
1947
|
+
// box-shadow isn't a Mason buffer prop — render it as a Composition DropShadow on the element
|
|
1948
|
+
// (masked to its rounded-rect shape, re-applied on resize). The corner radius is read natively.
|
|
1949
|
+
const nv = this.nativeViewProtected ?? this._view;
|
|
1950
|
+
try {
|
|
1951
|
+
const sh = parseBoxShadow(typeof value === 'string' ? value : '');
|
|
1952
|
+
if (!sh)
|
|
1953
|
+
NativeScript.Mason.Css.ClearShadow(nv);
|
|
1954
|
+
else
|
|
1955
|
+
NativeScript.Mason.Css.ApplyShadow(nv, sh.ox, sh.oy, sh.blur, sh.argb, 0);
|
|
1956
|
+
}
|
|
1957
|
+
catch (_) { }
|
|
1958
|
+
}
|
|
1754
1959
|
}
|
|
1755
1960
|
}
|
|
1756
1961
|
[transformProperty.setNative](value) {
|
|
@@ -1759,6 +1964,20 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1759
1964
|
if (style) {
|
|
1760
1965
|
// @ts-ignore
|
|
1761
1966
|
style.transform = value;
|
|
1967
|
+
if (__WINDOWS__) {
|
|
1968
|
+
// transform isn't a Mason buffer prop — apply it to the FrameworkElement via Composition,
|
|
1969
|
+
// like @nativescript/core does on its own panels (the plugin's View is a custom Panel core
|
|
1970
|
+
// doesn't drive transforms on). Parse the CSS string to a matrix and set RenderTransform.
|
|
1971
|
+
const nv = this.nativeViewProtected ?? this._view;
|
|
1972
|
+
try {
|
|
1973
|
+
const mtx = parseCssTransformToMatrix(typeof value === 'string' ? value : '');
|
|
1974
|
+
if (!mtx)
|
|
1975
|
+
NativeScript.Mason.Css.ClearTransform(nv);
|
|
1976
|
+
else
|
|
1977
|
+
NativeScript.Mason.Css.ApplyTransform(nv, mtx.m11, mtx.m12, mtx.m21, mtx.m22, mtx.tx, mtx.ty);
|
|
1978
|
+
}
|
|
1979
|
+
catch (_) { }
|
|
1980
|
+
}
|
|
1762
1981
|
}
|
|
1763
1982
|
}
|
|
1764
1983
|
}
|