@triniwiz/nativescript-masonkit 1.0.0-beta.86 → 1.0.0-beta.88
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 +16 -4
- package/angular/README.md +204 -0
- package/angular/fesm2022/triniwiz-nativescript-masonkit-angular.mjs +496 -0
- package/angular/fesm2022/triniwiz-nativescript-masonkit-angular.mjs.map +1 -0
- package/angular/package.json +19 -0
- package/angular/types/triniwiz-nativescript-masonkit-angular.d.ts +181 -0
- package/button/index.android.d.ts +2 -1
- package/button/index.ios.d.ts +2 -1
- package/button/index.windows.d.ts +2 -1
- package/common.d.ts +102 -1
- package/common.js +116 -6
- package/common.js.map +1 -1
- package/img/index.android.d.ts +2 -1
- package/img/index.ios.d.ts +2 -1
- package/img/index.windows.d.ts +2 -1
- package/index.d.ts +21 -10
- package/input/index.android.d.ts +5 -1
- package/input/index.ios.d.ts +7 -1
- package/input/index.windows.d.ts +6 -1
- package/package.json +3 -1
- package/platforms/android/masonkit-release.aar +0 -0
- package/platforms/ios/Mason.xcframework/Info.plist +2 -36
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason-Swift.h +26 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/mason_native.h +27 -2
- 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 +2630 -979
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.private.swiftinterface +37 -1
- 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 +37 -1
- 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 +8457 -8378
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason-Swift.h +52 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/mason_native.h +27 -2
- 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 +2630 -979
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +37 -1
- 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 +37 -1
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +2630 -979
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +37 -1
- 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 +37 -1
- 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 +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8452 -8373
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +8090 -8017
- 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 +4 -0
- package/properties.js +58 -15
- package/properties.js.map +1 -1
- package/style.d.ts +39 -37
- package/style.js +429 -110
- package/style.js.map +1 -1
- package/text/index.android.d.ts +3 -1
- package/text/index.ios.d.ts +3 -1
- package/text/index.windows.d.ts +2 -1
- package/textarea/index.android.d.ts +6 -2
- package/textarea/index.ios.d.ts +6 -2
- package/textarea/index.windows.d.ts +6 -2
- package/utils/index.android.d.ts +15 -6
- package/utils/index.android.js +83 -2
- package/utils/index.android.js.map +1 -1
- package/utils/index.ios.d.ts +15 -6
- package/utils/index.ios.js +83 -2
- package/utils/index.ios.js.map +1 -1
- package/utils/index.windows.d.ts +11 -2
- package/utils/index.windows.js +9 -0
- package/utils/index.windows.js.map +1 -1
- package/view/index.ios.js +14 -1
- package/view/index.ios.js.map +1 -1
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Headers/Mason-Swift.h +0 -1982
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Headers/Mason.h +0 -25
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Headers/mason_native.h +0 -499
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Info.plist +0 -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 +0 -98937
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.private.swiftinterface +0 -3475
- 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 +0 -3475
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/module.modulemap +0 -10
- package/platforms/ios/Mason.xcframework/xros-arm64/dSYMs/Mason.framework.dSYM/Contents/Info.plist +0 -20
- 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 +0 -2134
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Headers/Mason-Swift.h +0 -1982
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Headers/Mason.h +0 -25
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Headers/mason_native.h +0 -499
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Info.plist +0 -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 +0 -98937
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.private.swiftinterface +0 -3475
- 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 +0 -3475
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/module.modulemap +0 -10
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/_CodeSignature/CodeResources +0 -212
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/dSYMs/Mason.framework.dSYM/Contents/Info.plist +0 -20
- 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 +0 -2134
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { ViewClassMeta } from '@nativescript/angular';
|
|
2
|
+
|
|
3
|
+
/** How a passthrough element can be identified. */
|
|
4
|
+
type PassthroughMatcher = string | RegExp | ((elementName: string) => boolean);
|
|
5
|
+
interface ComponentHostOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Turn component-host mode off entirely while keeping element registration.
|
|
8
|
+
*
|
|
9
|
+
* @default true
|
|
10
|
+
*/
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Extra elements to keep as a transparent `ProxyViewContainer`. Strings are
|
|
14
|
+
* compared case-insensitively; regexes and predicates receive the raw element
|
|
15
|
+
* name.
|
|
16
|
+
*
|
|
17
|
+
* Routed components are handled automatically, so this is only needed for a
|
|
18
|
+
* component whose template root is a classic fill-parent view that this
|
|
19
|
+
* cannot see coming - another router outlet, a `Frame`, a `Page`.
|
|
20
|
+
*/
|
|
21
|
+
passthrough?: PassthroughMatcher[];
|
|
22
|
+
/**
|
|
23
|
+
* Recognise page roots automatically: routed components at creation time, and
|
|
24
|
+
* any host that turns out to hold a `Frame`, `Page` or `ActionBar`.
|
|
25
|
+
*
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
autoDetectPassthrough?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Keep the Angular root component's host element a `ProxyViewContainer`.
|
|
31
|
+
*
|
|
32
|
+
* `AppHostView` only wraps the root in its full-screen root `GridLayout` when
|
|
33
|
+
* that root *is* a `ProxyViewContainer`, so the root element has to stay a
|
|
34
|
+
* passthrough for the tree below it to have a viewport-sized ancestor to
|
|
35
|
+
* resolve `height: 100%` against.
|
|
36
|
+
*
|
|
37
|
+
* Detected rather than hardcoded: Angular creates the root component's host
|
|
38
|
+
* element before anything in its template, so the first unregistered element
|
|
39
|
+
* this package is asked to create is the root.
|
|
40
|
+
*
|
|
41
|
+
* @default true
|
|
42
|
+
*/
|
|
43
|
+
rootAsPassthrough?: boolean;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Turn every Angular component host element into a real MasonKit view.
|
|
47
|
+
*
|
|
48
|
+
* Stock `@nativescript/angular` creates a `ProxyViewContainer` for every element
|
|
49
|
+
* that is not `registerElement`'d - i.e. every Angular component selector. That
|
|
50
|
+
* container creates no native view, so anything placed on a component element
|
|
51
|
+
* (`backgroundColor`, `margin`, `class="..."`, host bindings) is set on an
|
|
52
|
+
* invisible logical wrapper with no visual effect, and the component is
|
|
53
|
+
* transparent to layout. Nesting components then produces layouts that do not
|
|
54
|
+
* match the template, because the boxes the template implies do not exist.
|
|
55
|
+
*
|
|
56
|
+
* This replaces that fallback with a {@link MasonComponentHost}, so a component
|
|
57
|
+
* host element is a real box, as on the web.
|
|
58
|
+
*
|
|
59
|
+
* Idempotent: repeated calls only update the configuration.
|
|
60
|
+
*
|
|
61
|
+
* Trade-off: an unknown element name (a typo, a component that was never
|
|
62
|
+
* declared) becomes a host instead of throwing "No known component for element
|
|
63
|
+
* X". Set `enabled: false` to keep the stock behaviour.
|
|
64
|
+
*/
|
|
65
|
+
declare function enableMasonComponentHosts(options?: ComponentHostOptions): void;
|
|
66
|
+
|
|
67
|
+
interface RegisterElementsOptions {
|
|
68
|
+
/**
|
|
69
|
+
* Register MasonKit's own elements: `View`, `Text`, `Scroll`, `Img`, `Button`,
|
|
70
|
+
* `Input`, `TextArea`, `Br`, `Ul`, `Ol`, `Li`.
|
|
71
|
+
*
|
|
72
|
+
* @default true
|
|
73
|
+
*/
|
|
74
|
+
mason?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Register the HTML-shaped elements from `@triniwiz/nativescript-masonkit/web`
|
|
77
|
+
* (`div`, `section`, `p`, `span`, `h1`–`h6`, `blockquote`, `code`, `a`, ...).
|
|
78
|
+
*
|
|
79
|
+
* @default true
|
|
80
|
+
*/
|
|
81
|
+
web?: boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Register MasonKit's elements with `@nativescript/angular`, each with the child
|
|
85
|
+
* bookkeeping meta it needs (see {@link masonMeta}).
|
|
86
|
+
*
|
|
87
|
+
* Safe to call more than once - later calls skip names already registered here.
|
|
88
|
+
*
|
|
89
|
+
* ## Shadowing
|
|
90
|
+
*
|
|
91
|
+
* `registerElement` overwrites silently, and `@nativescript/angular` registers
|
|
92
|
+
* every element under its original, lowercase and kebab spellings. MasonKit's
|
|
93
|
+
* `Button`, `Img` and `/web`'s `Span` therefore *replace* core's `Button`,
|
|
94
|
+
* `img` (`Image`) and `Span` for Angular templates. That is the intent - these
|
|
95
|
+
* are the MasonKit-laid-out equivalents - but it is why `mason`/`web` can each
|
|
96
|
+
* be turned off if an app wants to keep the classic widgets.
|
|
97
|
+
*/
|
|
98
|
+
declare function registerMasonKitElements(options?: RegisterElementsOptions): void;
|
|
99
|
+
|
|
100
|
+
interface InstallMasonKitOptions extends RegisterElementsOptions {
|
|
101
|
+
/**
|
|
102
|
+
* Component-host mode: make every Angular component host element a real
|
|
103
|
+
* MasonKit view instead of an invisible `ProxyViewContainer`.
|
|
104
|
+
*
|
|
105
|
+
* On by default - installing this is taken as the statement that MasonKit is
|
|
106
|
+
* how the app lays out. Pass `false`, or an options object with
|
|
107
|
+
* `enabled: false`, to opt out and keep stock `@nativescript/angular`
|
|
108
|
+
* behaviour while still getting the element registrations.
|
|
109
|
+
*
|
|
110
|
+
* @default true
|
|
111
|
+
*/
|
|
112
|
+
componentHosts?: boolean | ComponentHostOptions;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Install MasonKit's Angular integration.
|
|
116
|
+
*
|
|
117
|
+
* Call this in `main.ts` **before** `runNativeScriptAngularApp()`:
|
|
118
|
+
*
|
|
119
|
+
* ```ts
|
|
120
|
+
* import { installMasonKit } from '@triniwiz/nativescript-masonkit/angular';
|
|
121
|
+
*
|
|
122
|
+
* installMasonKit();
|
|
123
|
+
*
|
|
124
|
+
* runNativeScriptAngularApp({
|
|
125
|
+
* appModuleBootstrap: () => platformNativeScript().bootstrapModule(AppModule),
|
|
126
|
+
* });
|
|
127
|
+
* ```
|
|
128
|
+
*
|
|
129
|
+
* It has to run before the bootstrap, not as part of it: the element map and
|
|
130
|
+
* the renderer patch must be in place before Angular creates the root
|
|
131
|
+
* component's host element, and an `NgModule` import or an `APP_INITIALIZER`
|
|
132
|
+
* would both be too late for some of that. A plain function call at the top of
|
|
133
|
+
* the entry file is unambiguous about when it happens.
|
|
134
|
+
*
|
|
135
|
+
* Idempotent - element registration is deduplicated and the component-host
|
|
136
|
+
* patches are installed once, then only reconfigured.
|
|
137
|
+
*/
|
|
138
|
+
declare function installMasonKit(options?: InstallMasonKitOptions): void;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* `ViewClassMeta` that routes Angular's visual-tree mutations through MasonKit's
|
|
142
|
+
* own child bookkeeping.
|
|
143
|
+
*
|
|
144
|
+
* ## Why every MasonKit element needs this
|
|
145
|
+
*
|
|
146
|
+
* MasonKit's `ViewBase` extends `CustomLayoutView`, **not** `LayoutBase`.
|
|
147
|
+
* `@nativescript/angular`'s `ViewUtil` branches on `view instanceof LayoutBase`,
|
|
148
|
+
* so without a meta a MasonKit container falls into the generic fallbacks:
|
|
149
|
+
*
|
|
150
|
+
* - `addToVisualTree` → `parent._addChildFromBuilder(name, child)`, which is a
|
|
151
|
+
* plain `addChild()` append. The resolved `next` sibling is **discarded**, so
|
|
152
|
+
* anything Angular inserts in the middle of a container (`*ngIf` toggling on,
|
|
153
|
+
* `*ngFor` reordering, a router swap) lands at the end and the Taffy tree ends
|
|
154
|
+
* up in a different order than the template.
|
|
155
|
+
* - `removeFromVisualTree` → core's `parent._removeView(child)`, which bypasses
|
|
156
|
+
* MasonKit's `removeChild()` entirely. The native view detaches but the entry
|
|
157
|
+
* stays in `_children`, and since `_children` is what drives native insertion
|
|
158
|
+
* indices (`_nativeIndexFor`), every later insert into that container is
|
|
159
|
+
* misplaced - the classic "nested components lay out wrong" symptom.
|
|
160
|
+
*
|
|
161
|
+
* Routing through `insertChild`/`addChild`/`removeChild` keeps the Taffy tree,
|
|
162
|
+
* the `_children` bookkeeping and the native view tree in step. This is the same
|
|
163
|
+
* contract `frameMeta`/`formattedStringMeta` use for their containers.
|
|
164
|
+
*
|
|
165
|
+
* ## Why `insertChild` must not throw
|
|
166
|
+
*
|
|
167
|
+
* `next` is whatever `ViewUtil.findNextVisual()` resolved to, which is not
|
|
168
|
+
* guaranteed to be a node MasonKit ever tracked. MasonKit's own `insertBefore()`
|
|
169
|
+
* throws `NotFoundError` for an unknown reference; thrown from here that would
|
|
170
|
+
* abort the component's change detection and blank it. An unknown reference
|
|
171
|
+
* simply degrades to an append, exactly as `insertToLayout` does for classic
|
|
172
|
+
* layouts.
|
|
173
|
+
*
|
|
174
|
+
* Invisible nodes (Angular's `CommentNode`/`TextNode`) are intentionally left to
|
|
175
|
+
* `ViewUtil`'s default handling: it assigns `parent.text`, which MasonKit's
|
|
176
|
+
* `textProperty.setNative` already reconciles into real native text nodes.
|
|
177
|
+
*/
|
|
178
|
+
declare const masonMeta: ViewClassMeta;
|
|
179
|
+
|
|
180
|
+
export { enableMasonComponentHosts, installMasonKit, masonMeta, registerMasonKitElements };
|
|
181
|
+
export type { ComponentHostOptions, InstallMasonKitOptions, PassthroughMatcher, RegisterElementsOptions };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ViewBase } from '@nativescript/core';
|
|
2
|
-
import { ButtonBase } from '../common';
|
|
2
|
+
import { ButtonBase, textContentProperty } from '../common';
|
|
3
3
|
import { style_ } from '../symbols';
|
|
4
4
|
export declare class Button extends ButtonBase {
|
|
5
|
+
[textContentProperty.setNative]: (value: any) => void;
|
|
5
6
|
[style_]: any;
|
|
6
7
|
_inBatch: boolean;
|
|
7
8
|
private __view;
|
package/button/index.ios.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ViewBase } from '@nativescript/core';
|
|
2
|
-
import { ButtonBase } from '../common';
|
|
2
|
+
import { ButtonBase, textContentProperty } from '../common';
|
|
3
3
|
import { Style } from '../style';
|
|
4
4
|
import { style_ } from '../symbols';
|
|
5
5
|
export declare class Button extends ButtonBase {
|
|
6
|
+
[textContentProperty.setNative]: (value: any) => void;
|
|
6
7
|
[style_]: any;
|
|
7
8
|
_inBatch: boolean;
|
|
8
9
|
constructor();
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ButtonBase } from '../common';
|
|
1
|
+
import { ButtonBase, textContentProperty } from '../common';
|
|
2
2
|
import { Style } from '../style';
|
|
3
3
|
import { style_ } from '../symbols';
|
|
4
4
|
export declare class Button extends ButtonBase {
|
|
5
|
+
[textContentProperty.setNative]: (value: any) => void;
|
|
5
6
|
[style_]: any;
|
|
6
7
|
_inBatch: boolean;
|
|
7
8
|
constructor();
|
package/common.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { AddChildFromBuilder, CustomLayoutView, View as NSView, ViewBase as NSViewBase, Property, CoreTypes } from '@nativescript/core';
|
|
1
|
+
import { AddChildFromBuilder, CustomLayoutView, View as NSView, ViewBase as NSViewBase, Property, widthProperty, heightProperty, CoreTypes, marginLeftProperty, marginRightProperty, marginTopProperty, marginBottomProperty, minWidthProperty, minHeightProperty, fontSizeProperty, fontWeightProperty, fontStyleProperty, colorProperty, lineHeightProperty, letterSpacingProperty, textAlignmentProperty, textDecorationProperty, borderLeftWidthProperty, borderTopWidthProperty, borderRightWidthProperty, borderBottomWidthProperty, backgroundColorProperty, paddingLeftProperty, paddingRightProperty, paddingTopProperty, paddingBottomProperty, zIndexProperty } from '@nativescript/core';
|
|
2
2
|
import { Display, Gap, GridAutoFlow, JustifyItems, JustifySelf, Length, LengthAuto, Overflow, Position, BoxSizing, VerticalAlign, FlexDirection, Float, Clear } from '.';
|
|
3
|
+
import { alignItemsProperty, alignSelfProperty, flexDirectionProperty, flexGrowProperty, flexShrinkProperty, flexWrapProperty, justifyContentProperty } from '@nativescript/core/ui/layouts/flexbox-layout';
|
|
4
|
+
import { fontInternalProperty } from '@nativescript/core/ui/styling/style-properties';
|
|
3
5
|
import { Style } from './style';
|
|
6
|
+
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, borderStyleProperty, backgroundImageProperty, listStyleTypeProperty, listStylePositionProperty } from './properties';
|
|
4
7
|
import { isMasonView_, isTextChild_, isText_, native_, pseudoStyles_ } from './symbols';
|
|
5
8
|
import { TextNode } from './text-node';
|
|
6
9
|
export interface MasonChild extends ViewBase {
|
|
@@ -59,6 +62,95 @@ declare module '@nativescript/core/ui/styling/style' {
|
|
|
59
62
|
}
|
|
60
63
|
}
|
|
61
64
|
export declare class ViewBase extends CustomLayoutView implements AddChildFromBuilder {
|
|
65
|
+
[zIndexProperty.setNative]: (value: number) => void;
|
|
66
|
+
[verticalAlignProperty.setNative]: (value: any) => void;
|
|
67
|
+
[textWrapProperty.setNative]: (value: any) => void;
|
|
68
|
+
[aspectRatioProperty.setNative]: (value: any) => void;
|
|
69
|
+
[textProperty.setNative]: (value: string) => void;
|
|
70
|
+
[filterProperty.setNative]: (value: any) => void;
|
|
71
|
+
[borderRadiusProperty.setNative]: (value: any) => void;
|
|
72
|
+
[borderProperty.setNative]: (value: any) => void;
|
|
73
|
+
[borderLeftProperty.setNative]: (value: any) => void;
|
|
74
|
+
[borderTopProperty.setNative]: (value: any) => void;
|
|
75
|
+
[borderRightProperty.setNative]: (value: any) => void;
|
|
76
|
+
[borderBottomProperty.setNative]: (value: any) => void;
|
|
77
|
+
[backgroundProperty.setNative]: (value: any) => void;
|
|
78
|
+
[backgroundColorProperty.setNative]: (value: any) => void;
|
|
79
|
+
[borderLeftWidthProperty.setNative]: (value: CoreTypes.LengthType) => void;
|
|
80
|
+
[borderTopWidthProperty.setNative]: (value: CoreTypes.LengthType) => void;
|
|
81
|
+
[borderRightWidthProperty.setNative]: (value: CoreTypes.LengthType) => void;
|
|
82
|
+
[borderBottomWidthProperty.setNative]: (value: CoreTypes.LengthType) => void;
|
|
83
|
+
[lineHeightProperty.setNative]: (value: CoreTypes.LengthType) => void;
|
|
84
|
+
[letterSpacingProperty.setNative]: (value: CoreTypes.LengthType) => void;
|
|
85
|
+
[textAlignmentProperty.setNative]: (value: any) => void;
|
|
86
|
+
[textDecorationProperty.setNative]: (value: any) => void;
|
|
87
|
+
[borderColorProperty.setNative]: (value: any) => void;
|
|
88
|
+
[borderStyleProperty.setNative]: (value: any) => void;
|
|
89
|
+
[backgroundImageProperty.setNative]: (value: any) => void;
|
|
90
|
+
[listStyleTypeProperty.setNative]: (value: any) => void;
|
|
91
|
+
[listStylePositionProperty.setNative]: (value: any) => void;
|
|
92
|
+
[boxSizingProperty.setNative]: (value: any) => void;
|
|
93
|
+
[displayProperty.setNative]: (value: any) => void;
|
|
94
|
+
[overflowXProperty.setNative]: (value: any) => void;
|
|
95
|
+
[overflowYProperty.setNative]: (value: any) => void;
|
|
96
|
+
[scrollBarWidthProperty.setNative]: (value: any) => void;
|
|
97
|
+
[positionProperty.setNative]: (value: any) => void;
|
|
98
|
+
[colorProperty.setNative]: (value: any) => void;
|
|
99
|
+
[flexWrapProperty.setNative]: (value: any) => void;
|
|
100
|
+
[flexDirectionProperty.setNative]: (value: any) => void;
|
|
101
|
+
[flexGrowProperty.setNative]: (value: any) => void;
|
|
102
|
+
[flexShrinkProperty.setNative]: (value: any) => void;
|
|
103
|
+
[flexBasisProperty.setNative]: (value: any) => void;
|
|
104
|
+
[alignItemsProperty.setNative]: (value: any) => void;
|
|
105
|
+
[alignSelfProperty.setNative]: (value: any) => void;
|
|
106
|
+
[alignContentProperty.setNative]: (value: any) => void;
|
|
107
|
+
[justifyItemsProperty.setNative]: (value: any) => void;
|
|
108
|
+
[justifySelfProperty.setNative]: (value: any) => void;
|
|
109
|
+
[justifyContentProperty.setNative]: (value: any) => void;
|
|
110
|
+
[leftProperty.setNative]: (value: any) => void;
|
|
111
|
+
[rightProperty.setNative]: (value: any) => void;
|
|
112
|
+
[bottomProperty.setNative]: (value: any) => void;
|
|
113
|
+
[topProperty.setNative]: (value: any) => void;
|
|
114
|
+
[minWidthProperty.setNative]: (value: any) => void;
|
|
115
|
+
[minHeightProperty.setNative]: (value: any) => void;
|
|
116
|
+
[heightProperty.setNative]: (value: any) => void;
|
|
117
|
+
[widthProperty.setNative]: (value: any) => void;
|
|
118
|
+
[maxWidthProperty.setNative]: (value: any) => void;
|
|
119
|
+
[maxHeightProperty.setNative]: (value: any) => void;
|
|
120
|
+
[marginProperty.setNative]: (value: any) => void;
|
|
121
|
+
[marginLeftProperty.setNative]: (value: any) => void;
|
|
122
|
+
[marginRightProperty.setNative]: (value: any) => void;
|
|
123
|
+
[marginBottomProperty.setNative]: (value: any) => void;
|
|
124
|
+
[marginTopProperty.setNative]: (value: any) => void;
|
|
125
|
+
[paddingProperty.setNative]: (value: any) => void;
|
|
126
|
+
[paddingLeftProperty.setNative]: (value: any) => void;
|
|
127
|
+
[paddingRightProperty.setNative]: (value: any) => void;
|
|
128
|
+
[paddingTopProperty.setNative]: (value: any) => void;
|
|
129
|
+
[paddingBottomProperty.setNative]: (value: any) => void;
|
|
130
|
+
[rowGapProperty.setNative]: (value: any) => void;
|
|
131
|
+
[columnGapProperty.setNative]: (value: any) => void;
|
|
132
|
+
[gridColumnStartProperty.setNative]: (value: any) => void;
|
|
133
|
+
[gridColumnEndProperty.setNative]: (value: any) => void;
|
|
134
|
+
[gridColumnProperty.setNative]: (value: any) => void;
|
|
135
|
+
[gridRowStartProperty.setNative]: (value: any) => void;
|
|
136
|
+
[gridRowEndProperty.setNative]: (value: any) => void;
|
|
137
|
+
[gridRowProperty.setNative]: (value: any) => void;
|
|
138
|
+
[gridTemplateRowsProperty.setNative]: (value: any) => void;
|
|
139
|
+
[gridTemplateColumnsProperty.setNative]: (value: any) => void;
|
|
140
|
+
[gridAutoColumnsProperty.setNative]: (value: any) => void;
|
|
141
|
+
[gridAutoRowsProperty.setNative]: (value: any) => void;
|
|
142
|
+
[gridAutoFlowProperty.setNative]: (value: any) => void;
|
|
143
|
+
[gridAreaProperty.setNative]: (value: any) => void;
|
|
144
|
+
[gridTemplateAreasProperty.setNative]: (value: any) => void;
|
|
145
|
+
[fontSizeProperty.setNative]: (value: Length) => void;
|
|
146
|
+
[fontWeightProperty.setNative]: (value: any) => void;
|
|
147
|
+
[fontStyleProperty.setNative]: (value: any) => void;
|
|
148
|
+
[textOverFlowProperty.setNative]: (value: any) => void;
|
|
149
|
+
[clearProperty.setNative]: (value: any) => void;
|
|
150
|
+
[floatProperty.setNative]: (value: any) => void;
|
|
151
|
+
[cornerShapeProperty.setNative]: (value: any) => void;
|
|
152
|
+
[boxShadowProperty.setNative]: (value: any) => void;
|
|
153
|
+
[transformProperty.setNative]: (value: any) => void;
|
|
62
154
|
_children: (NSView | {
|
|
63
155
|
text?: string;
|
|
64
156
|
} | TextNode)[];
|
|
@@ -99,6 +191,12 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
|
|
|
99
191
|
constructor();
|
|
100
192
|
get innerHTML(): string;
|
|
101
193
|
set innerHTML(value: string);
|
|
194
|
+
private _rememberNativeOwner;
|
|
195
|
+
/**
|
|
196
|
+
* Returns the top-most Mason/NativeScript element at a point in this view's
|
|
197
|
+
* local coordinate space, similar to the browser's elementFromPoint().
|
|
198
|
+
*/
|
|
199
|
+
elementFromPoint(x: number, y: number): ViewBase | NSViewBase | null;
|
|
102
200
|
_pendingEventsRegistration: Array<{
|
|
103
201
|
arg: string;
|
|
104
202
|
callback: any;
|
|
@@ -160,6 +258,7 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
|
|
|
160
258
|
private _nativeAddChild;
|
|
161
259
|
private _nativeReplaceChild;
|
|
162
260
|
private _setOrPushChild;
|
|
261
|
+
private _spliceOrPushChild;
|
|
163
262
|
private _updateTextNode;
|
|
164
263
|
private _syncTextRunLayout;
|
|
165
264
|
get filter(): string;
|
|
@@ -244,6 +343,8 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
|
|
|
244
343
|
get textOverFlow(): string;
|
|
245
344
|
}
|
|
246
345
|
export declare class TextBase extends ViewBase {
|
|
346
|
+
[fontInternalProperty.setNative]: (value: any) => void;
|
|
347
|
+
[textWrapProperty.setNative]: (value: any) => void;
|
|
247
348
|
textContent: string;
|
|
248
349
|
}
|
|
249
350
|
export declare class ButtonBase extends TextBase {
|
package/common.js
CHANGED
|
@@ -3,9 +3,10 @@ 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
|
-
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';
|
|
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, borderStyleProperty, backgroundImageProperty, listStyleTypeProperty, listStylePositionProperty, } from './properties';
|
|
9
10
|
import { isMasonView_, isTextChild_, isText_, isPlaceholder_, text_, native_, textNode_, textNodeIndex_, textNodeProxied_, pseudoStyles_ } from './symbols';
|
|
10
11
|
import { Tree } from './tree';
|
|
11
12
|
import { TextNode } from './text-node';
|
|
@@ -129,6 +130,43 @@ function getFrameworkElement(view) {
|
|
|
129
130
|
_frameworkAccessorCache.set(view, false);
|
|
130
131
|
return null;
|
|
131
132
|
}
|
|
133
|
+
function getWeakRefValue(value) {
|
|
134
|
+
if (!value)
|
|
135
|
+
return null;
|
|
136
|
+
const maybeWeakRef = value;
|
|
137
|
+
if (typeof maybeWeakRef.get === 'function')
|
|
138
|
+
return maybeWeakRef.get();
|
|
139
|
+
if (typeof maybeWeakRef.deref === 'function')
|
|
140
|
+
return maybeWeakRef.deref();
|
|
141
|
+
return value;
|
|
142
|
+
}
|
|
143
|
+
function nativeOwnerFor(nativeView) {
|
|
144
|
+
if (!nativeView)
|
|
145
|
+
return null;
|
|
146
|
+
const owner = getWeakRefValue(nativeView.__masonOwner);
|
|
147
|
+
if (owner)
|
|
148
|
+
return owner;
|
|
149
|
+
return getFrameworkElement(nativeView);
|
|
150
|
+
}
|
|
151
|
+
function nativeViewFor(owner) {
|
|
152
|
+
return owner?.nativeViewProtected ?? owner?.[native_];
|
|
153
|
+
}
|
|
154
|
+
function findOwnerForNativeView(owner, nativeView) {
|
|
155
|
+
if (!owner || !nativeView)
|
|
156
|
+
return null;
|
|
157
|
+
const ownNativeView = nativeViewFor(owner);
|
|
158
|
+
if (ownNativeView === nativeView)
|
|
159
|
+
return owner;
|
|
160
|
+
const children = owner._children ?? owner._viewChildren;
|
|
161
|
+
if (!children)
|
|
162
|
+
return null;
|
|
163
|
+
for (const child of children) {
|
|
164
|
+
const match = findOwnerForNativeView(child, nativeView);
|
|
165
|
+
if (match)
|
|
166
|
+
return match;
|
|
167
|
+
}
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
132
170
|
export const textContentProperty = new Property({
|
|
133
171
|
name: 'textContent',
|
|
134
172
|
affectsLayout: true,
|
|
@@ -201,6 +239,39 @@ export class ViewBase extends CustomLayoutView {
|
|
|
201
239
|
}
|
|
202
240
|
}
|
|
203
241
|
}
|
|
242
|
+
_rememberNativeOwner(nativeView = nativeViewFor(this)) {
|
|
243
|
+
if (!nativeView)
|
|
244
|
+
return;
|
|
245
|
+
try {
|
|
246
|
+
nativeView.__masonOwner = new WeakRef(this);
|
|
247
|
+
}
|
|
248
|
+
catch (_) {
|
|
249
|
+
// Some host objects do not accept expandos; fallback tree matching still works.
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Returns the top-most Mason/NativeScript element at a point in this view's
|
|
254
|
+
* local coordinate space, similar to the browser's elementFromPoint().
|
|
255
|
+
*/
|
|
256
|
+
elementFromPoint(x, y) {
|
|
257
|
+
const nativeView = nativeViewFor(this) ?? this._view;
|
|
258
|
+
if (!nativeView)
|
|
259
|
+
return null;
|
|
260
|
+
this._rememberNativeOwner(nativeView);
|
|
261
|
+
let nativeHit = null;
|
|
262
|
+
if (__ANDROID__ && typeof nativeView.elementFromPoint === 'function') {
|
|
263
|
+
nativeHit = nativeView.elementFromPoint(x, y);
|
|
264
|
+
}
|
|
265
|
+
else if (__APPLE__) {
|
|
266
|
+
const hitTest = nativeView.mason_elementFromPointY ?? nativeView.mason_elementFromPoint ?? nativeView.elementFromPoint;
|
|
267
|
+
if (typeof hitTest === 'function') {
|
|
268
|
+
nativeHit = hitTest.call(nativeView, x, y);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (!nativeHit)
|
|
272
|
+
return null;
|
|
273
|
+
return nativeOwnerFor(nativeHit) ?? findOwnerForNativeView(this, nativeHit);
|
|
274
|
+
}
|
|
204
275
|
_registerNativeEvent(arg, callback, thisArg) {
|
|
205
276
|
if (!this[native_]) {
|
|
206
277
|
this._pendingEventsRegistration.push({ arg, callback, thisArg });
|
|
@@ -328,6 +399,7 @@ export class ViewBase extends CustomLayoutView {
|
|
|
328
399
|
}
|
|
329
400
|
initNativeView() {
|
|
330
401
|
super.initNativeView();
|
|
402
|
+
this._rememberNativeOwner();
|
|
331
403
|
if (this._pendingEventsRegistration.length > 0) {
|
|
332
404
|
const pending = this._pendingEventsRegistration.splice(0);
|
|
333
405
|
for (const registration of pending) {
|
|
@@ -900,6 +972,17 @@ export class ViewBase extends CustomLayoutView {
|
|
|
900
972
|
this._children.push(entry);
|
|
901
973
|
}
|
|
902
974
|
}
|
|
975
|
+
// Splices a text-node entry in at `index`, shifting existing children right.
|
|
976
|
+
_spliceOrPushChild(index, entry) {
|
|
977
|
+
if (this._children.length > index) {
|
|
978
|
+
//@ts-ignore
|
|
979
|
+
this._children.splice(index, 0, entry);
|
|
980
|
+
}
|
|
981
|
+
else {
|
|
982
|
+
//@ts-ignore
|
|
983
|
+
this._children.push(entry);
|
|
984
|
+
}
|
|
985
|
+
}
|
|
903
986
|
// -- Unified text node update (cross-platform) --
|
|
904
987
|
_updateTextNode(node, operation = null) {
|
|
905
988
|
const text = node.text ?? node.data ?? '';
|
|
@@ -922,7 +1005,7 @@ export class ViewBase extends CustomLayoutView {
|
|
|
922
1005
|
break;
|
|
923
1006
|
case 'insert':
|
|
924
1007
|
this._nativeAddChild(textNode, operation.index);
|
|
925
|
-
this.
|
|
1008
|
+
this._spliceOrPushChild(operation.index, entry);
|
|
926
1009
|
break;
|
|
927
1010
|
}
|
|
928
1011
|
this._syncTextRunLayout();
|
|
@@ -1218,6 +1301,22 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1218
1301
|
// @ts-ignore
|
|
1219
1302
|
this.nativeView.style.setBorderColor(String(value));
|
|
1220
1303
|
}
|
|
1304
|
+
else if (__WINDOWS__) {
|
|
1305
|
+
// @ts-ignore
|
|
1306
|
+
const style = this._styleHelper;
|
|
1307
|
+
// @ts-ignore
|
|
1308
|
+
if (style)
|
|
1309
|
+
style.setBorderColor(String(value));
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
// @ts-ignore
|
|
1313
|
+
[borderStyleProperty.setNative](value) {
|
|
1314
|
+
// @ts-ignore
|
|
1315
|
+
const style = this._styleHelper;
|
|
1316
|
+
if (style) {
|
|
1317
|
+
// @ts-ignore
|
|
1318
|
+
style.borderStyle = String(value ?? '');
|
|
1319
|
+
}
|
|
1221
1320
|
}
|
|
1222
1321
|
// @ts-ignore
|
|
1223
1322
|
[backgroundImageProperty.setNative](value) {
|
|
@@ -1340,10 +1439,8 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1340
1439
|
style.position = value;
|
|
1341
1440
|
}
|
|
1342
1441
|
}
|
|
1343
|
-
//
|
|
1344
|
-
//
|
|
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.
|
|
1442
|
+
// Font props only land in the style buffer, which the TextBlock-backed text doesn't read, so they
|
|
1443
|
+
// must be forwarded to the native Text control to take visual effect. No-op off a Text container.
|
|
1347
1444
|
_applyTextRunProp(method, arg) {
|
|
1348
1445
|
if (!__WINDOWS__)
|
|
1349
1446
|
return;
|
|
@@ -2007,6 +2104,19 @@ __decorate([
|
|
|
2007
2104
|
], ViewBase.prototype, "_blurHandler", null);
|
|
2008
2105
|
textProperty.register(ViewBase);
|
|
2009
2106
|
export class TextBase extends ViewBase {
|
|
2107
|
+
[fontInternalProperty.setNative](value) {
|
|
2108
|
+
if (!__WINDOWS__)
|
|
2109
|
+
return;
|
|
2110
|
+
// @ts-ignore
|
|
2111
|
+
const view = this._view;
|
|
2112
|
+
if (!view || typeof view.SetFontFamily !== 'function')
|
|
2113
|
+
return;
|
|
2114
|
+
const family = value && typeof value === 'object' ? (value.fontFamily ?? '') : '';
|
|
2115
|
+
try {
|
|
2116
|
+
view.SetFontFamily(String(family ?? ''));
|
|
2117
|
+
}
|
|
2118
|
+
catch (_) { }
|
|
2119
|
+
}
|
|
2010
2120
|
[textWrapProperty.setNative](value) {
|
|
2011
2121
|
// @ts-ignore
|
|
2012
2122
|
const style = this._styleHelper;
|