@triniwiz/nativescript-masonkit 1.0.0-beta.7 → 1.0.0-beta.71
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 +930 -0
- package/br/index.android.d.ts +10 -0
- package/br/index.android.js +31 -0
- package/br/index.android.js.map +1 -0
- package/br/index.ios.d.ts +11 -0
- package/br/index.ios.js +30 -0
- package/br/index.ios.js.map +1 -0
- package/button/index.android.d.ts +4 -2
- package/button/index.android.js +9 -5
- package/button/index.android.js.map +1 -1
- package/button/index.ios.d.ts +4 -5
- package/button/index.ios.js +17 -71
- package/button/index.ios.js.map +1 -1
- package/common.d.ts +207 -73
- package/common.js +1236 -1392
- package/common.js.map +1 -1
- package/img/index.android.d.ts +5 -4
- package/img/index.android.js +18 -6
- package/img/index.android.js.map +1 -1
- package/img/index.ios.d.ts +3 -2
- package/img/index.ios.js +27 -21
- package/img/index.ios.js.map +1 -1
- package/index.android.d.ts +7 -1
- package/index.android.js +7 -1
- package/index.android.js.map +1 -1
- package/index.d.ts +129 -2
- package/index.ios.d.ts +7 -1
- package/index.ios.js +7 -1
- package/index.ios.js.map +1 -1
- package/input/common.d.ts +20 -0
- package/input/common.js +65 -0
- package/input/common.js.map +1 -0
- package/input/index.android.d.ts +20 -0
- package/input/index.android.js +118 -0
- package/input/index.android.js.map +1 -0
- package/input/index.ios.d.ts +23 -0
- package/input/index.ios.js +171 -0
- package/input/index.ios.js.map +1 -0
- package/li/index.android.d.ts +12 -0
- package/li/index.android.js +57 -0
- package/li/index.android.js.map +1 -0
- package/li/index.ios.d.ts +14 -0
- package/li/index.ios.js +128 -0
- package/li/index.ios.js.map +1 -0
- package/list/common.d.ts +33 -0
- package/list/common.js +157 -0
- package/list/common.js.map +1 -0
- package/list/index.android.d.ts +28 -0
- package/list/index.android.js +155 -0
- package/list/index.android.js.map +1 -0
- package/list/index.ios.d.ts +42 -0
- package/list/index.ios.js +321 -0
- package/list/index.ios.js.map +1 -0
- package/package.json +8 -2
- package/platforms/android/include.gradle +1 -0
- package/platforms/android/masonkit-release.aar +0 -0
- package/platforms/ios/Mason.xcframework/Info.plist +5 -5
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason-Swift.h +572 -176
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/mason_native.h +181 -50
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Info.plist +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Mason +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.abi.json +74785 -40729
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.private.swiftinterface +1429 -346
- 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 +1429 -346
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/module.modulemap +0 -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 +8340 -4294
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason-Swift.h +1144 -352
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/mason_native.h +181 -50
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Info.plist +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Mason +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.abi.json +72517 -38461
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +1674 -591
- 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 +1674 -591
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +72517 -38461
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +1674 -591
- 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 +1674 -591
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/module.modulemap +0 -1
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/_CodeSignature/CodeResources +31 -31
- 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 +8335 -4291
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +7982 -4167
- package/properties.d.ts +83 -0
- package/properties.js +1345 -0
- package/properties.js.map +1 -0
- package/pseudo.d.ts +9 -0
- package/pseudo.js +58 -0
- package/pseudo.js.map +1 -0
- package/scroll/index.android.d.ts +3 -2
- package/scroll/index.android.js +20 -5
- package/scroll/index.android.js.map +1 -1
- package/scroll/index.ios.d.ts +7 -4
- package/scroll/index.ios.js +88 -26
- package/scroll/index.ios.js.map +1 -1
- package/style.d.ts +231 -12
- package/style.js +1982 -811
- package/style.js.map +1 -1
- package/symbols.d.ts +12 -0
- package/symbols.js +13 -0
- package/symbols.js.map +1 -0
- package/text/index.android.d.ts +11 -5
- package/text/index.android.js +86 -104
- package/text/index.android.js.map +1 -1
- package/text/index.ios.d.ts +14 -11
- package/text/index.ios.js +111 -181
- package/text/index.ios.js.map +1 -1
- package/text-node/index.android.d.ts +13 -0
- package/text-node/index.android.js +35 -0
- package/text-node/index.android.js.map +1 -0
- package/text-node/index.ios.d.ts +13 -0
- package/text-node/index.ios.js +35 -0
- package/text-node/index.ios.js.map +1 -0
- package/textarea/common.d.ts +8 -0
- package/textarea/common.js +28 -0
- package/textarea/common.js.map +1 -0
- package/textarea/index.android.d.ts +15 -0
- package/textarea/index.android.js +71 -0
- package/textarea/index.android.js.map +1 -0
- package/textarea/index.ios.d.ts +18 -0
- package/textarea/index.ios.js +134 -0
- package/textarea/index.ios.js.map +1 -0
- package/tree/index.android.d.ts +15 -2
- package/tree/index.android.js +83 -8
- package/tree/index.android.js.map +1 -1
- package/tree/index.ios.d.ts +24 -1
- package/tree/index.ios.js +72 -8
- package/tree/index.ios.js.map +1 -1
- package/utils/index.android.d.ts +13 -1
- package/utils/index.android.js +1 -1
- package/utils/index.android.js.map +1 -1
- package/utils/index.ios.d.ts +13 -1
- package/utils/index.ios.js +1 -1
- package/utils/index.ios.js.map +1 -1
- package/view/index.android.d.ts +3 -2
- package/view/index.android.js +22 -5
- package/view/index.android.js.map +1 -1
- package/view/index.ios.d.ts +4 -2
- package/view/index.ios.js +86 -16
- package/view/index.ios.js.map +1 -1
- package/web.d.ts +6 -0
- package/web.js +22 -0
- package/web.js.map +1 -1
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/NSObject+MasonElement_Defaults.h +0 -100
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/NSObject+MasonElement_Defaults.h +0 -100
package/common.js
CHANGED
|
@@ -1,1027 +1,297 @@
|
|
|
1
|
-
var _a, _b, _c;
|
|
1
|
+
var _a, _b, _c, _d;
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
3
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
4
|
-
import {
|
|
5
|
-
import { flexDirectionProperty, flexGrowProperty, flexWrapProperty } from '@nativescript/core/ui/layouts/flexbox-layout';
|
|
4
|
+
import { CustomLayoutView, View as NSView, getViewById, Property, widthProperty, heightProperty, marginLeftProperty, marginRightProperty, marginTopProperty, marginBottomProperty, minWidthProperty, minHeightProperty, fontSizeProperty, fontWeightProperty, fontStyleProperty, colorProperty, Color, lineHeightProperty, letterSpacingProperty, textAlignmentProperty, borderLeftWidthProperty, borderTopWidthProperty, borderRightWidthProperty, borderBottomWidthProperty, backgroundColorProperty, paddingLeftProperty, paddingRightProperty, paddingTopProperty, paddingBottomProperty, zIndexProperty, PseudoClassHandler } from '@nativescript/core';
|
|
5
|
+
import { alignItemsProperty, alignSelfProperty, flexDirectionProperty, flexGrowProperty, flexShrinkProperty, flexWrapProperty, justifyContentProperty } from '@nativescript/core/ui/layouts/flexbox-layout';
|
|
6
6
|
import { _forceStyleUpdate } from './utils';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export const isPlaceholder_ = Symbol('[[isPlaceholder]]');
|
|
7
|
+
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, } from './properties';
|
|
9
|
+
import { isMasonView_, isTextChild_, isText_, isPlaceholder_, text_, native_, textNode_, textNodeIndex_, textNodeProxied_, pseudoStyles_ } from './symbols';
|
|
10
|
+
import { Tree } from './tree';
|
|
11
|
+
import { TextNode } from './text-node';
|
|
12
|
+
import { compile } from './pseudo';
|
|
14
13
|
function getViewStyle(view) {
|
|
15
14
|
const ret = (__ANDROID__ ? view.get() : view.deref());
|
|
16
15
|
return ret._styleHelper;
|
|
17
16
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Cached per-view accessor for the framework's virtual DOM element.
|
|
19
|
+
* The accessor is a function that retrieves the element cheaply on subsequent calls.
|
|
20
|
+
* We use `false` as a sentinel to indicate "no framework detected" (avoids re-scanning).
|
|
21
|
+
*/
|
|
22
|
+
const _frameworkAccessorCache = new WeakMap();
|
|
23
|
+
function getFrameworkElement(view) {
|
|
24
|
+
const cached = _frameworkAccessorCache.get(view);
|
|
25
|
+
if (cached === false)
|
|
26
|
+
return null;
|
|
27
|
+
if (cached)
|
|
28
|
+
return cached(view);
|
|
29
|
+
// First call: detect framework and cache the accessor
|
|
30
|
+
const symbols = Object.getOwnPropertySymbols(view);
|
|
31
|
+
// Vue 3 (nativescript-vue): stores ELEMENT_REF symbol on native view
|
|
32
|
+
for (const sym of symbols) {
|
|
33
|
+
if (sym.description === 'elementRef' || sym.description === '') {
|
|
34
|
+
const el = view[sym];
|
|
35
|
+
if (el && Array.isArray(el.childNodes)) {
|
|
36
|
+
_frameworkAccessorCache.set(view, (v) => v[sym]);
|
|
37
|
+
return el;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// React (react-nativescript): stores __reactFiber$ symbol on node
|
|
42
|
+
for (const sym of symbols) {
|
|
43
|
+
if (sym.description?.startsWith('__reactFiber$')) {
|
|
44
|
+
if (Array.isArray(view.childNodes)) {
|
|
45
|
+
_frameworkAccessorCache.set(view, (v) => v);
|
|
46
|
+
return view;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// Svelte (svelte-native): stores __SvelteNativeElement__ on native view
|
|
51
|
+
if (view.__SvelteNativeElement__) {
|
|
52
|
+
const el = view.__SvelteNativeElement__;
|
|
53
|
+
if (Array.isArray(el.childNodes)) {
|
|
54
|
+
_frameworkAccessorCache.set(view, (v) => v.__SvelteNativeElement__);
|
|
55
|
+
return el;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// SolidJS (dominative): the element IS the native view, extended with DOM methods
|
|
59
|
+
if (view.__dominative_isNative) {
|
|
60
|
+
_frameworkAccessorCache.set(view, (v) => v);
|
|
61
|
+
return view;
|
|
62
|
+
}
|
|
63
|
+
// Angular (@nativescript/angular): uses firstChild/nextSibling linked list
|
|
64
|
+
if (view.firstChild !== undefined && view.meta?.skipAddToDom !== undefined) {
|
|
65
|
+
_frameworkAccessorCache.set(view, (v) => v);
|
|
66
|
+
return view;
|
|
67
|
+
}
|
|
68
|
+
_frameworkAccessorCache.set(view, false);
|
|
69
|
+
return null;
|
|
35
70
|
}
|
|
36
|
-
export const
|
|
37
|
-
name: '
|
|
38
|
-
|
|
39
|
-
defaultValue:
|
|
40
|
-
valueConverter: parseFloat,
|
|
71
|
+
export const textContentProperty = new Property({
|
|
72
|
+
name: 'textContent',
|
|
73
|
+
affectsLayout: true,
|
|
74
|
+
defaultValue: '',
|
|
41
75
|
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return undefined;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
function masonLengthPercentParse(value) {
|
|
74
|
-
try {
|
|
75
|
-
return CorePercentLength.parse(value);
|
|
76
|
+
export class ViewBase extends CustomLayoutView {
|
|
77
|
+
/**
|
|
78
|
+
* Enable or disable CSS Preflight (web-normalised / Tailwind-like) defaults
|
|
79
|
+
* for the entire Mason tree.
|
|
80
|
+
*
|
|
81
|
+
* When `true` every element starts from a clean, browser-normalised slate:
|
|
82
|
+
* - `box-sizing: border-box`
|
|
83
|
+
* - `margin: 0`, `padding: 0`, `border-width: 0`
|
|
84
|
+
* - `background: transparent`
|
|
85
|
+
* - `list-style: none` on `<ul>` / `<ol>`
|
|
86
|
+
* - `display: block` on `<img>` (replaced elements)
|
|
87
|
+
*
|
|
88
|
+
* This is a **tree-global** flag; it should ideally be set **before** views are
|
|
89
|
+
* created so that all new nodes inherit the preflight baseline. Changing it
|
|
90
|
+
* after views have been created re-seeds the arena defaults but does not
|
|
91
|
+
* retroactively restyle individually modified nodes.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* import { ViewBase } from '@triniwiz/nativescript-masonkit';
|
|
96
|
+
* ViewBase.preflight = true; // enable at app startup
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
static get preflight() {
|
|
100
|
+
return Tree.instance.preflight;
|
|
101
|
+
}
|
|
102
|
+
static set preflight(value) {
|
|
103
|
+
Tree.instance.preflight = value;
|
|
76
104
|
}
|
|
77
|
-
|
|
78
|
-
|
|
105
|
+
constructor() {
|
|
106
|
+
super();
|
|
107
|
+
this._children = [];
|
|
108
|
+
this[_a] = false;
|
|
109
|
+
this[_b] = false;
|
|
110
|
+
this[_c] = false;
|
|
111
|
+
this[_d] = {};
|
|
112
|
+
this._pendingEventsRegistration = [];
|
|
79
113
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const borderProperty = new CssProperty({
|
|
87
|
-
name: 'border',
|
|
88
|
-
cssName: 'border',
|
|
89
|
-
});
|
|
90
|
-
borderProperty.register(Style);
|
|
91
|
-
const backgroundProperty = new CssProperty({
|
|
92
|
-
name: 'background',
|
|
93
|
-
cssName: 'background',
|
|
94
|
-
});
|
|
95
|
-
backgroundProperty.register(Style);
|
|
96
|
-
const overFlow = /^\s*(visible|hidden|clip|scroll|auto)(?:\s+(visible|hidden|clip|scroll|auto))?\s*$/;
|
|
97
|
-
export const overflowProperty = new ShorthandProperty({
|
|
98
|
-
name: 'overflow',
|
|
99
|
-
cssName: 'overflow',
|
|
100
|
-
getter: function () {
|
|
101
|
-
if (this.overflowX === this.overflowY) {
|
|
102
|
-
return this.overflowX;
|
|
103
|
-
}
|
|
104
|
-
return `${this.overflowX} ${this.overflowY}`;
|
|
105
|
-
},
|
|
106
|
-
converter(value) {
|
|
107
|
-
const properties = [];
|
|
108
|
-
if (typeof value === 'string') {
|
|
109
|
-
const values = value.match(overFlow);
|
|
110
|
-
const length = values?.length ?? 0;
|
|
111
|
-
if (length === 0) {
|
|
112
|
-
return properties;
|
|
113
|
-
}
|
|
114
|
-
if (length === 1) {
|
|
115
|
-
const xy = values[0];
|
|
116
|
-
properties.push([overflowXProperty, xy]);
|
|
117
|
-
properties.push([overflowYProperty, xy]);
|
|
118
|
-
}
|
|
119
|
-
if (length > 1) {
|
|
120
|
-
const x = values[0];
|
|
121
|
-
const y = values[1];
|
|
122
|
-
properties.push([overflowXProperty, x]);
|
|
123
|
-
properties.push([overflowYProperty, y]);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return properties;
|
|
127
|
-
},
|
|
128
|
-
});
|
|
129
|
-
export const overflowXProperty = new CssProperty({
|
|
130
|
-
name: 'overflowX',
|
|
131
|
-
cssName: 'overflow-x',
|
|
132
|
-
defaultValue: 'visible',
|
|
133
|
-
valueConverter: overflowConverter,
|
|
134
|
-
valueChanged: (target, oldValue, newValue) => {
|
|
135
|
-
const view = getViewStyle(target.viewRef);
|
|
136
|
-
if (view) {
|
|
137
|
-
if (newValue) {
|
|
138
|
-
view.overflowX = newValue;
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
// Revert to old value if newValue is invalid
|
|
142
|
-
view.view.style.overflowX = oldValue;
|
|
114
|
+
get innerHTML() {
|
|
115
|
+
//@ts-ignore
|
|
116
|
+
const nativeView = this._view;
|
|
117
|
+
if (__ANDROID__) {
|
|
118
|
+
if (nativeView && nativeView.getInnerHTML) {
|
|
119
|
+
return nativeView.getInnerHTML();
|
|
143
120
|
}
|
|
144
121
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
name: 'overflowY',
|
|
149
|
-
cssName: 'overflow-y',
|
|
150
|
-
defaultValue: 'visible',
|
|
151
|
-
valueConverter: overflowConverter,
|
|
152
|
-
valueChanged(target, oldValue, newValue) {
|
|
153
|
-
const view = getViewStyle(target.viewRef);
|
|
154
|
-
if (view) {
|
|
155
|
-
if (newValue) {
|
|
156
|
-
view.overflowY = newValue;
|
|
122
|
+
if (__APPLE__) {
|
|
123
|
+
if (nativeView && nativeView.mason_innerHTML) {
|
|
124
|
+
return nativeView.mason_innerHTML;
|
|
157
125
|
}
|
|
158
|
-
else {
|
|
159
|
-
// Revert to old value if newValue is invalid
|
|
160
|
-
view.view.style.overflowY = oldValue;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
});
|
|
165
|
-
const paddingProperty = new CssProperty({
|
|
166
|
-
name: 'padding',
|
|
167
|
-
cssName: 'padding',
|
|
168
|
-
});
|
|
169
|
-
paddingProperty.register(Style);
|
|
170
|
-
const marginProperty = new CssProperty({
|
|
171
|
-
name: 'margin',
|
|
172
|
-
cssName: 'margin',
|
|
173
|
-
});
|
|
174
|
-
marginProperty.register(Style);
|
|
175
|
-
export const paddingLeftProperty = new CssProperty({
|
|
176
|
-
name: 'paddingLeft',
|
|
177
|
-
cssName: 'padding-left',
|
|
178
|
-
defaultValue: CoreTypes.zeroLength,
|
|
179
|
-
affectsLayout: global.isIOS,
|
|
180
|
-
equalityComparer: CoreLength.equals,
|
|
181
|
-
valueChanged: (target, oldValue, newValue) => {
|
|
182
|
-
const view = getViewStyle(target.viewRef);
|
|
183
|
-
if (view) {
|
|
184
|
-
view.paddingLeft = CoreLength.toDevicePixels(newValue, 0);
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
Trace.write(`${newValue} not set to view's property because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
valueConverter: masonLengthParse,
|
|
191
|
-
});
|
|
192
|
-
export const paddingRightProperty = new CssProperty({
|
|
193
|
-
name: 'paddingRight',
|
|
194
|
-
cssName: 'padding-right',
|
|
195
|
-
defaultValue: CoreTypes.zeroLength,
|
|
196
|
-
affectsLayout: global.isIOS,
|
|
197
|
-
equalityComparer: CoreLength.equals,
|
|
198
|
-
valueChanged: (target, oldValue, newValue) => {
|
|
199
|
-
const view = getViewStyle(target.viewRef);
|
|
200
|
-
if (view) {
|
|
201
|
-
view.paddingRight = CoreLength.toDevicePixels(newValue, 0);
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
Trace.write(`${newValue} not set to view's property because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
valueConverter: masonLengthParse,
|
|
208
|
-
});
|
|
209
|
-
export const paddingTopProperty = new CssProperty({
|
|
210
|
-
name: 'paddingTop',
|
|
211
|
-
cssName: 'padding-top',
|
|
212
|
-
defaultValue: CoreTypes.zeroLength,
|
|
213
|
-
affectsLayout: global.isIOS,
|
|
214
|
-
equalityComparer: CoreLength.equals,
|
|
215
|
-
valueChanged: (target, oldValue, newValue) => {
|
|
216
|
-
const view = getViewStyle(target.viewRef);
|
|
217
|
-
if (view) {
|
|
218
|
-
view.paddingTop = CoreLength.toDevicePixels(newValue, 0);
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
Trace.write(`${newValue} not set to view's property because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
valueConverter: masonLengthParse,
|
|
225
|
-
});
|
|
226
|
-
export const paddingBottomProperty = new CssProperty({
|
|
227
|
-
name: 'paddingBottom',
|
|
228
|
-
cssName: 'padding-bottom',
|
|
229
|
-
defaultValue: CoreTypes.zeroLength,
|
|
230
|
-
affectsLayout: global.isIOS,
|
|
231
|
-
equalityComparer: CoreLength.equals,
|
|
232
|
-
valueChanged: (target, oldValue, newValue) => {
|
|
233
|
-
const view = getViewStyle(target.viewRef);
|
|
234
|
-
if (view) {
|
|
235
|
-
view.paddingBottom = CoreLength.toDevicePixels(newValue, 0);
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
Trace.write(`${newValue} not set to view's property because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
|
|
239
126
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
const parsed = CoreLength.parse(value);
|
|
249
|
-
if (typeof parsed === 'string') {
|
|
250
|
-
return 0;
|
|
251
|
-
}
|
|
252
|
-
return parsed;
|
|
253
|
-
},
|
|
254
|
-
valueChanged(target, oldValue, newValue) {
|
|
255
|
-
const view = getViewStyle(target.viewRef);
|
|
256
|
-
if (view) {
|
|
257
|
-
view.rowGap = newValue;
|
|
258
|
-
}
|
|
259
|
-
},
|
|
260
|
-
});
|
|
261
|
-
export const columnGapProperty = new CssProperty({
|
|
262
|
-
name: 'columnGap',
|
|
263
|
-
cssName: 'column-gap',
|
|
264
|
-
defaultValue: 0,
|
|
265
|
-
valueConverter(value) {
|
|
266
|
-
const parsed = CoreLength.parse(value);
|
|
267
|
-
if (typeof parsed === 'string') {
|
|
268
|
-
return 0;
|
|
269
|
-
}
|
|
270
|
-
return parsed;
|
|
271
|
-
},
|
|
272
|
-
valueChanged(target, oldValue, newValue) {
|
|
273
|
-
const view = getViewStyle(target.viewRef);
|
|
274
|
-
if (view) {
|
|
275
|
-
view.columnGap = newValue;
|
|
276
|
-
}
|
|
277
|
-
},
|
|
278
|
-
});
|
|
279
|
-
export const gridGapProperty = new ShorthandProperty({
|
|
280
|
-
name: 'gridGap',
|
|
281
|
-
cssName: 'grid-gap',
|
|
282
|
-
getter: function () {
|
|
283
|
-
if (this.rowGap === this.columnGap) {
|
|
284
|
-
return this.rowGap;
|
|
285
|
-
}
|
|
286
|
-
return `${this.rowGap} ${this.columnGap}`;
|
|
287
|
-
},
|
|
288
|
-
converter(gap) {
|
|
289
|
-
const properties = [];
|
|
290
|
-
let value = gap;
|
|
291
|
-
if (typeof value === 'number') {
|
|
292
|
-
value = `${value}`;
|
|
293
|
-
}
|
|
294
|
-
if (typeof value === 'string') {
|
|
295
|
-
const values = value.split(/\s+/).filter((item) => item.trim().length !== 0);
|
|
296
|
-
const length = values.length;
|
|
297
|
-
if (length === 0) {
|
|
298
|
-
return properties;
|
|
299
|
-
}
|
|
300
|
-
if (length === 1) {
|
|
301
|
-
const row = values[0];
|
|
302
|
-
properties.push([rowGapProperty, row]);
|
|
303
|
-
properties.push([columnGapProperty, row]);
|
|
304
|
-
}
|
|
305
|
-
if (length > 1) {
|
|
306
|
-
const row = values[0];
|
|
307
|
-
const column = values[1];
|
|
308
|
-
properties.push([rowGapProperty, row]);
|
|
309
|
-
properties.push([columnGapProperty, column]);
|
|
127
|
+
return '';
|
|
128
|
+
}
|
|
129
|
+
set innerHTML(value) {
|
|
130
|
+
//@ts-ignore
|
|
131
|
+
const nativeView = this._view;
|
|
132
|
+
if (__ANDROID__) {
|
|
133
|
+
if (nativeView && nativeView.setInnerHTML) {
|
|
134
|
+
nativeView.setInnerHTML(value);
|
|
310
135
|
}
|
|
311
136
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
export const gapProperty = new ShorthandProperty({
|
|
316
|
-
name: 'gap',
|
|
317
|
-
cssName: 'gap',
|
|
318
|
-
getter: function () {
|
|
319
|
-
if (this.rowGap === this.columnGap) {
|
|
320
|
-
return this.rowGap;
|
|
321
|
-
}
|
|
322
|
-
return `${this.rowGap} ${this.columnGap}`;
|
|
323
|
-
},
|
|
324
|
-
converter(gap) {
|
|
325
|
-
const properties = [];
|
|
326
|
-
let value = gap;
|
|
327
|
-
if (typeof value === 'number') {
|
|
328
|
-
value = `${value}`;
|
|
329
|
-
}
|
|
330
|
-
if (typeof value === 'string') {
|
|
331
|
-
const values = value.split(/\s+/).filter((item) => item.trim().length !== 0);
|
|
332
|
-
const length = values.length;
|
|
333
|
-
if (length === 0) {
|
|
334
|
-
return properties;
|
|
137
|
+
if (__APPLE__) {
|
|
138
|
+
if (nativeView && nativeView.mason_innerHTML) {
|
|
139
|
+
nativeView.mason_innerHTML = value;
|
|
335
140
|
}
|
|
336
|
-
if (length === 1) {
|
|
337
|
-
const row = values[0];
|
|
338
|
-
properties.push([rowGapProperty, row]);
|
|
339
|
-
properties.push([columnGapProperty, row]);
|
|
340
|
-
}
|
|
341
|
-
if (length > 1) {
|
|
342
|
-
const row = values[0];
|
|
343
|
-
const column = values[1];
|
|
344
|
-
properties.push([rowGapProperty, row]);
|
|
345
|
-
properties.push([columnGapProperty, column]);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
return properties;
|
|
349
|
-
},
|
|
350
|
-
});
|
|
351
|
-
// export const flexGrowProperty = new CssProperty<Style, number>({
|
|
352
|
-
// name: 'flexGrow',
|
|
353
|
-
// cssName: 'flex-grow',
|
|
354
|
-
// defaultValue: 0,
|
|
355
|
-
// valueConverter: parseFloat,
|
|
356
|
-
// });
|
|
357
|
-
export const flexShrinkProperty = new CssProperty({
|
|
358
|
-
name: 'flexShrink',
|
|
359
|
-
cssName: 'flex-shrink',
|
|
360
|
-
defaultValue: 1,
|
|
361
|
-
valueConverter: parseFloat,
|
|
362
|
-
});
|
|
363
|
-
export const displayProperty = new CssProperty({
|
|
364
|
-
name: 'display',
|
|
365
|
-
cssName: 'display',
|
|
366
|
-
defaultValue: 'block',
|
|
367
|
-
valueChanged: (target, oldValue, newValue) => {
|
|
368
|
-
const view = getViewStyle(target.viewRef);
|
|
369
|
-
if (view && newValue) {
|
|
370
|
-
view.display = newValue;
|
|
371
141
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
142
|
+
}
|
|
143
|
+
_registerNativeEvent(arg, callback, thisArg) {
|
|
144
|
+
if (!this[native_]) {
|
|
145
|
+
this._pendingEventsRegistration.push({ arg, callback, thisArg });
|
|
146
|
+
return;
|
|
375
147
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
148
|
+
//@ts-ignore
|
|
149
|
+
if (this._view) {
|
|
150
|
+
if (__ANDROID__) {
|
|
151
|
+
const ref = new WeakRef(this);
|
|
152
|
+
const cb = new kotlin.jvm.functions.Function1({
|
|
153
|
+
invoke(event) {
|
|
154
|
+
const owner = ref.get();
|
|
155
|
+
if (owner) {
|
|
156
|
+
let ret;
|
|
157
|
+
if (arg === 'input') {
|
|
158
|
+
ret = new InputEvent();
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
ret = new Event();
|
|
162
|
+
}
|
|
163
|
+
ret[native_] = event;
|
|
164
|
+
ret._target = owner;
|
|
165
|
+
callback.call(thisArg || owner, ret);
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
//@ts-ignore
|
|
170
|
+
const id = this._view.addEventListener(arg, cb);
|
|
171
|
+
callback['mason:event:id'] = id;
|
|
396
172
|
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
});
|
|
413
|
-
export const maxWidthProperty = new CssProperty({
|
|
414
|
-
name: 'maxWidth',
|
|
415
|
-
cssName: 'max-width',
|
|
416
|
-
defaultValue: 'auto',
|
|
417
|
-
// @ts-ignore
|
|
418
|
-
equalityComparer: NSLength.equals,
|
|
419
|
-
valueConverter: masonLengthParse,
|
|
420
|
-
valueChanged: (target, oldValue, newValue) => {
|
|
421
|
-
const view = getViewStyle(target.viewRef);
|
|
422
|
-
if (view) {
|
|
423
|
-
view.maxWidth = newValue;
|
|
424
|
-
}
|
|
425
|
-
else {
|
|
426
|
-
Trace.write(`${newValue} not set to view's property because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
|
|
427
|
-
}
|
|
428
|
-
},
|
|
429
|
-
});
|
|
430
|
-
export const maxHeightProperty = new CssProperty({
|
|
431
|
-
name: 'maxHeight',
|
|
432
|
-
cssName: 'max-height',
|
|
433
|
-
defaultValue: 'auto',
|
|
434
|
-
// @ts-ignore
|
|
435
|
-
equalityComparer: NSLength.equals,
|
|
436
|
-
valueConverter: masonLengthParse,
|
|
437
|
-
valueChanged(target, oldValue, newValue) {
|
|
438
|
-
const view = getViewStyle(target.viewRef);
|
|
439
|
-
if (view) {
|
|
440
|
-
view.maxHeight = newValue;
|
|
441
|
-
}
|
|
442
|
-
},
|
|
443
|
-
});
|
|
444
|
-
export const positionProperty = new CssProperty({
|
|
445
|
-
name: 'position',
|
|
446
|
-
cssName: 'position',
|
|
447
|
-
defaultValue: 'relative',
|
|
448
|
-
valueChanged(target, oldValue, newValue) {
|
|
449
|
-
const view = getViewStyle(target.viewRef);
|
|
450
|
-
if (view) {
|
|
451
|
-
view.position = newValue;
|
|
452
|
-
}
|
|
453
|
-
},
|
|
454
|
-
});
|
|
455
|
-
// export const flexDirectionProperty = new CssProperty<Style, FlexDirection>({
|
|
456
|
-
// name: 'flexDirection',
|
|
457
|
-
// cssName: 'flex-direction',
|
|
458
|
-
// });
|
|
459
|
-
// export const flexWrapProperty = new CssProperty<Style, FlexWrap>({
|
|
460
|
-
// name: 'flexWrap',
|
|
461
|
-
// cssName: 'flex-wrap',
|
|
462
|
-
// defaultValue: 'no-wrap',
|
|
463
|
-
// });
|
|
464
|
-
const insetProperty = new ShorthandProperty({
|
|
465
|
-
name: 'inset',
|
|
466
|
-
cssName: 'inset',
|
|
467
|
-
getter: function () {
|
|
468
|
-
if (this.top === this.right && this.top === this.bottom && this.top === this.left) {
|
|
469
|
-
if (typeof this.top === 'string') {
|
|
470
|
-
if (this.top === 'auto') {
|
|
471
|
-
return this.top;
|
|
472
|
-
}
|
|
473
|
-
const value = CorePercentLength.parse(this.top);
|
|
474
|
-
if (Number.isNaN(value)) {
|
|
475
|
-
return this.top;
|
|
476
|
-
}
|
|
477
|
-
else {
|
|
478
|
-
return CorePercentLength.convertToString(value);
|
|
479
|
-
}
|
|
173
|
+
if (__APPLE__) {
|
|
174
|
+
//@ts-ignore
|
|
175
|
+
const id = this._view.mason_addEventListener(arg, (event) => {
|
|
176
|
+
let ret;
|
|
177
|
+
if (arg === 'input') {
|
|
178
|
+
ret = new InputEvent();
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
ret = new Event();
|
|
182
|
+
}
|
|
183
|
+
ret[native_] = event;
|
|
184
|
+
ret._target = this;
|
|
185
|
+
callback.call(thisArg || this, ret);
|
|
186
|
+
});
|
|
187
|
+
callback['mason:event:id'] = id;
|
|
480
188
|
}
|
|
481
189
|
}
|
|
482
|
-
if (CorePercentLength.equals(this.top, this.right) && CorePercentLength.equals(this.top, this.bottom) && CorePercentLength.equals(this.top, this.left)) {
|
|
483
|
-
return this.top;
|
|
484
|
-
}
|
|
485
|
-
return `${CorePercentLength.convertToString(this.paddingTop)} ${CorePercentLength.convertToString(this.paddingRight)} ${CorePercentLength.convertToString(this.paddingBottom)} ${CorePercentLength.convertToString(this.paddingLeft)}`;
|
|
486
|
-
},
|
|
487
|
-
converter: convertToInsets,
|
|
488
|
-
});
|
|
489
|
-
function convertToInsets(value) {
|
|
490
|
-
if (typeof value === 'string' && value !== 'auto') {
|
|
491
|
-
const thickness = parseShorthandPositioning(value);
|
|
492
|
-
return [
|
|
493
|
-
[topProperty, masonLengthPercentParse(thickness.top)],
|
|
494
|
-
[rightProperty, masonLengthPercentParse(thickness.right)],
|
|
495
|
-
[bottomProperty, masonLengthPercentParse(thickness.bottom)],
|
|
496
|
-
[leftProperty, masonLengthPercentParse(thickness.left)],
|
|
497
|
-
];
|
|
498
|
-
}
|
|
499
|
-
else {
|
|
500
|
-
return [
|
|
501
|
-
[topProperty, value],
|
|
502
|
-
[rightProperty, value],
|
|
503
|
-
[bottomProperty, value],
|
|
504
|
-
[leftProperty, value],
|
|
505
|
-
];
|
|
506
190
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
valueConverter: masonLengthParse,
|
|
515
|
-
valueChanged(target, oldValue, newValue) {
|
|
516
|
-
const view = getViewStyle(target.viewRef);
|
|
517
|
-
if (view) {
|
|
518
|
-
view.left = newValue;
|
|
519
|
-
}
|
|
520
|
-
},
|
|
521
|
-
});
|
|
522
|
-
export const rightProperty = new CssProperty({
|
|
523
|
-
name: 'right',
|
|
524
|
-
cssName: 'right',
|
|
525
|
-
defaultValue: 'auto',
|
|
526
|
-
// @ts-ignore
|
|
527
|
-
equalityComparer: NSLength.equals,
|
|
528
|
-
valueConverter: masonLengthParse,
|
|
529
|
-
valueChanged(target, oldValue, newValue) {
|
|
530
|
-
const view = getViewStyle(target.viewRef);
|
|
531
|
-
if (view) {
|
|
532
|
-
view.right = newValue;
|
|
533
|
-
}
|
|
534
|
-
},
|
|
535
|
-
});
|
|
536
|
-
export const topProperty = new CssProperty({
|
|
537
|
-
name: 'top',
|
|
538
|
-
cssName: 'top',
|
|
539
|
-
defaultValue: 'auto',
|
|
540
|
-
// @ts-ignore
|
|
541
|
-
equalityComparer: NSLength.equals,
|
|
542
|
-
valueConverter: masonLengthParse,
|
|
543
|
-
valueChanged(target, oldValue, newValue) {
|
|
544
|
-
const view = getViewStyle(target.viewRef);
|
|
545
|
-
if (view) {
|
|
546
|
-
view.top = newValue;
|
|
547
|
-
}
|
|
548
|
-
},
|
|
549
|
-
});
|
|
550
|
-
export const bottomProperty = new CssProperty({
|
|
551
|
-
name: 'bottom',
|
|
552
|
-
cssName: 'bottom',
|
|
553
|
-
defaultValue: 'auto',
|
|
554
|
-
// @ts-ignore
|
|
555
|
-
equalityComparer: NSLength.equals,
|
|
556
|
-
valueConverter: masonLengthParse,
|
|
557
|
-
valueChanged(target, oldValue, newValue) {
|
|
558
|
-
const view = getViewStyle(target.viewRef);
|
|
559
|
-
if (view) {
|
|
560
|
-
view.bottom = newValue;
|
|
561
|
-
}
|
|
562
|
-
},
|
|
563
|
-
});
|
|
564
|
-
export const flexBasisProperty = new CssProperty({
|
|
565
|
-
name: 'flexBasis',
|
|
566
|
-
cssName: 'flex-basis',
|
|
567
|
-
defaultValue: 'auto',
|
|
568
|
-
equalityComparer: NSLength.equals,
|
|
569
|
-
valueConverter: masonLengthParse,
|
|
570
|
-
valueChanged(target, oldValue, newValue) {
|
|
571
|
-
const view = getViewStyle(target.viewRef);
|
|
572
|
-
if (view) {
|
|
573
|
-
view.flexBasis = newValue;
|
|
574
|
-
}
|
|
575
|
-
},
|
|
576
|
-
});
|
|
577
|
-
export const gridRowGapProperty = new ShorthandProperty({
|
|
578
|
-
name: 'gridRowGap',
|
|
579
|
-
cssName: 'grid-row-gap',
|
|
580
|
-
getter: function () {
|
|
581
|
-
return this.rowGap;
|
|
582
|
-
},
|
|
583
|
-
converter(value) {
|
|
584
|
-
return [[rowGapProperty, value]];
|
|
585
|
-
},
|
|
586
|
-
});
|
|
587
|
-
export const gridColumnGapProperty = new ShorthandProperty({
|
|
588
|
-
name: 'gridColumnGap',
|
|
589
|
-
cssName: 'grid-column-gap',
|
|
590
|
-
getter: function () {
|
|
591
|
-
return this.columnGap;
|
|
592
|
-
},
|
|
593
|
-
converter(value) {
|
|
594
|
-
return [[columnGapProperty, value]];
|
|
595
|
-
},
|
|
596
|
-
});
|
|
597
|
-
export const aspectRatioProperty = new CssProperty({
|
|
598
|
-
name: 'aspectRatio',
|
|
599
|
-
cssName: 'aspect-ratio',
|
|
600
|
-
defaultValue: Number.NaN,
|
|
601
|
-
valueChanged(target, oldValue, newValue) {
|
|
602
|
-
const view = getViewStyle(target.viewRef);
|
|
603
|
-
if (view) {
|
|
604
|
-
view.aspectRatio = newValue;
|
|
605
|
-
}
|
|
606
|
-
},
|
|
607
|
-
});
|
|
608
|
-
export const alignItemsProperty = new CssProperty({
|
|
609
|
-
name: 'alignItems',
|
|
610
|
-
cssName: 'align-items',
|
|
611
|
-
defaultValue: 'normal',
|
|
612
|
-
valueChanged(target, oldValue, newValue) {
|
|
613
|
-
const view = getViewStyle(target.viewRef);
|
|
614
|
-
if (view) {
|
|
615
|
-
view.alignItems = newValue;
|
|
616
|
-
}
|
|
617
|
-
},
|
|
618
|
-
});
|
|
619
|
-
export const alignSelfProperty = new CssProperty({
|
|
620
|
-
name: 'alignSelf',
|
|
621
|
-
cssName: 'align-self',
|
|
622
|
-
defaultValue: 'normal',
|
|
623
|
-
valueChanged(target, oldValue, newValue) {
|
|
624
|
-
const view = getViewStyle(target.viewRef);
|
|
625
|
-
if (view) {
|
|
626
|
-
view.alignSelf = newValue;
|
|
627
|
-
}
|
|
628
|
-
},
|
|
629
|
-
});
|
|
630
|
-
export const alignContentProperty = new CssProperty({
|
|
631
|
-
name: 'alignContent',
|
|
632
|
-
cssName: 'align-content',
|
|
633
|
-
defaultValue: 'normal',
|
|
634
|
-
valueChanged(target, oldValue, newValue) {
|
|
635
|
-
const view = getViewStyle(target.viewRef);
|
|
636
|
-
if (view) {
|
|
637
|
-
view.alignContent = newValue;
|
|
638
|
-
}
|
|
639
|
-
},
|
|
640
|
-
});
|
|
641
|
-
export const justifyItemsProperty = new CssProperty({
|
|
642
|
-
name: 'justifyItems',
|
|
643
|
-
cssName: 'justify-items',
|
|
644
|
-
defaultValue: 'normal',
|
|
645
|
-
valueChanged(target, oldValue, newValue) {
|
|
646
|
-
const view = getViewStyle(target.viewRef);
|
|
647
|
-
if (view) {
|
|
648
|
-
view.justifyItems = newValue;
|
|
649
|
-
}
|
|
650
|
-
},
|
|
651
|
-
});
|
|
652
|
-
export const justifySelfProperty = new CssProperty({
|
|
653
|
-
name: 'justifySelf',
|
|
654
|
-
cssName: 'justify-self',
|
|
655
|
-
defaultValue: 'normal',
|
|
656
|
-
valueChanged(target, oldValue, newValue) {
|
|
657
|
-
const view = getViewStyle(target.viewRef);
|
|
658
|
-
if (view) {
|
|
659
|
-
view.justifySelf = newValue;
|
|
660
|
-
}
|
|
661
|
-
},
|
|
662
|
-
});
|
|
663
|
-
export const justifyContentProperty = new CssProperty({
|
|
664
|
-
name: 'justifyContent',
|
|
665
|
-
cssName: 'justify-content',
|
|
666
|
-
defaultValue: 'normal',
|
|
667
|
-
valueChanged(target, oldValue, newValue) {
|
|
668
|
-
const view = getViewStyle(target.viewRef);
|
|
669
|
-
if (view) {
|
|
670
|
-
view.justifyContent = newValue;
|
|
671
|
-
}
|
|
672
|
-
},
|
|
673
|
-
});
|
|
674
|
-
export const gridAutoRowsProperty = new CssProperty({
|
|
675
|
-
name: 'gridAutoRows',
|
|
676
|
-
cssName: 'grid-auto-rows',
|
|
677
|
-
defaultValue: '',
|
|
678
|
-
valueChanged(target, oldValue, newValue) {
|
|
679
|
-
const view = getViewStyle(target.viewRef);
|
|
680
|
-
if (view) {
|
|
681
|
-
view.gridAutoRows = newValue;
|
|
682
|
-
}
|
|
683
|
-
},
|
|
684
|
-
});
|
|
685
|
-
export const gridAutoColumnsProperty = new CssProperty({
|
|
686
|
-
name: 'gridAutoColumns',
|
|
687
|
-
cssName: 'grid-auto-columns',
|
|
688
|
-
defaultValue: '',
|
|
689
|
-
valueChanged(target, oldValue, newValue) {
|
|
690
|
-
const view = getViewStyle(target.viewRef);
|
|
691
|
-
if (view) {
|
|
692
|
-
view.gridAutoColumns = newValue;
|
|
693
|
-
}
|
|
694
|
-
},
|
|
695
|
-
});
|
|
696
|
-
export const gridAutoFlowProperty = new CssProperty({
|
|
697
|
-
name: 'gridAutoFlow',
|
|
698
|
-
cssName: 'grid-auto-flow',
|
|
699
|
-
defaultValue: 'row',
|
|
700
|
-
valueChanged(target, oldValue, newValue) {
|
|
701
|
-
const view = getViewStyle(target.viewRef);
|
|
702
|
-
if (view) {
|
|
703
|
-
view.gridAutoFlow = newValue;
|
|
704
|
-
}
|
|
705
|
-
},
|
|
706
|
-
});
|
|
707
|
-
export const gridAreaProperty = new CssProperty({
|
|
708
|
-
name: 'gridArea',
|
|
709
|
-
cssName: 'grid-area',
|
|
710
|
-
defaultValue: '',
|
|
711
|
-
valueChanged(target, oldValue, newValue) {
|
|
712
|
-
const view = getViewStyle(target.viewRef);
|
|
713
|
-
if (view) {
|
|
714
|
-
view.gridArea = newValue;
|
|
715
|
-
}
|
|
716
|
-
},
|
|
717
|
-
});
|
|
718
|
-
export const gridColumnStartProperty = new CssProperty({
|
|
719
|
-
name: 'gridColumnStart',
|
|
720
|
-
cssName: 'grid-column-start',
|
|
721
|
-
defaultValue: 'auto',
|
|
722
|
-
valueChanged(target, oldValue, newValue) {
|
|
723
|
-
const view = getViewStyle(target.viewRef);
|
|
724
|
-
if (view) {
|
|
725
|
-
view.gridColumnStart = newValue;
|
|
726
|
-
}
|
|
727
|
-
},
|
|
728
|
-
});
|
|
729
|
-
export const gridColumnEndProperty = new CssProperty({
|
|
730
|
-
name: 'gridColumnEnd',
|
|
731
|
-
cssName: 'grid-column-end',
|
|
732
|
-
defaultValue: 'auto',
|
|
733
|
-
valueChanged(target, oldValue, newValue) {
|
|
734
|
-
const view = getViewStyle(target.viewRef);
|
|
735
|
-
if (view) {
|
|
736
|
-
view.gridColumnEnd = newValue;
|
|
737
|
-
}
|
|
738
|
-
},
|
|
739
|
-
});
|
|
740
|
-
export const gridColumnProperty = new CssProperty({
|
|
741
|
-
name: 'gridColumn',
|
|
742
|
-
cssName: 'grid-column',
|
|
743
|
-
defaultValue: '',
|
|
744
|
-
valueChanged(target, oldValue, newValue) {
|
|
745
|
-
const view = getViewStyle(target.viewRef);
|
|
746
|
-
if (view) {
|
|
747
|
-
view.gridColumn = newValue;
|
|
748
|
-
}
|
|
749
|
-
},
|
|
750
|
-
});
|
|
751
|
-
export const gridRowStartProperty = new CssProperty({
|
|
752
|
-
name: 'gridRowStart',
|
|
753
|
-
cssName: 'grid-row-start',
|
|
754
|
-
defaultValue: 'auto',
|
|
755
|
-
valueChanged(target, oldValue, newValue) {
|
|
756
|
-
const view = getViewStyle(target.viewRef);
|
|
757
|
-
if (view) {
|
|
758
|
-
view.gridRowStart = newValue;
|
|
759
|
-
}
|
|
760
|
-
},
|
|
761
|
-
});
|
|
762
|
-
export const gridRowEndProperty = new CssProperty({
|
|
763
|
-
name: 'gridRowEnd',
|
|
764
|
-
cssName: 'grid-row-end',
|
|
765
|
-
defaultValue: 'auto',
|
|
766
|
-
valueChanged(target, oldValue, newValue) {
|
|
767
|
-
const view = getViewStyle(target.viewRef);
|
|
768
|
-
if (view) {
|
|
769
|
-
view.gridRowEnd = newValue;
|
|
770
|
-
}
|
|
771
|
-
},
|
|
772
|
-
});
|
|
773
|
-
export const gridRowProperty = new CssProperty({
|
|
774
|
-
name: 'gridRow',
|
|
775
|
-
cssName: 'grid-row',
|
|
776
|
-
defaultValue: '',
|
|
777
|
-
valueChanged(target, oldValue, newValue) {
|
|
778
|
-
const view = getViewStyle(target.viewRef);
|
|
779
|
-
if (view) {
|
|
780
|
-
view.gridRow = newValue;
|
|
781
|
-
}
|
|
782
|
-
},
|
|
783
|
-
});
|
|
784
|
-
export const gridTemplateAreasProperty = new CssProperty({
|
|
785
|
-
name: 'gridTemplateAreas',
|
|
786
|
-
cssName: 'grid-template-areas',
|
|
787
|
-
defaultValue: null,
|
|
788
|
-
valueChanged(target, oldValue, newValue) {
|
|
789
|
-
const view = getViewStyle(target.viewRef);
|
|
790
|
-
if (view) {
|
|
791
|
-
view.gridTemplateAreas = newValue;
|
|
792
|
-
}
|
|
793
|
-
},
|
|
794
|
-
});
|
|
795
|
-
export const gridTemplateRowsProperty = new CssProperty({
|
|
796
|
-
name: 'gridTemplateRows',
|
|
797
|
-
cssName: 'grid-template-rows',
|
|
798
|
-
defaultValue: null,
|
|
799
|
-
valueChanged(target, oldValue, newValue) {
|
|
800
|
-
const view = getViewStyle(target.viewRef);
|
|
801
|
-
if (view) {
|
|
802
|
-
view.gridTemplateRows = newValue;
|
|
803
|
-
}
|
|
804
|
-
},
|
|
805
|
-
});
|
|
806
|
-
export const gridTemplateColumnsProperty = new CssProperty({
|
|
807
|
-
name: 'gridTemplateColumns',
|
|
808
|
-
cssName: 'grid-template-columns',
|
|
809
|
-
defaultValue: null,
|
|
810
|
-
valueChanged(target, oldValue, newValue) {
|
|
811
|
-
const view = getViewStyle(target.viewRef);
|
|
812
|
-
if (view) {
|
|
813
|
-
view.gridTemplateColumns = newValue;
|
|
814
|
-
}
|
|
815
|
-
},
|
|
816
|
-
});
|
|
817
|
-
// flex-flow: <flex-direction> || <flex-wrap>
|
|
818
|
-
const flexFlowProperty = new ShorthandProperty({
|
|
819
|
-
name: 'flexFlow',
|
|
820
|
-
cssName: 'flex-flow',
|
|
821
|
-
getter: function () {
|
|
822
|
-
return `${this.flexDirection} ${this.flexWrap}`;
|
|
823
|
-
},
|
|
824
|
-
converter: function (value) {
|
|
825
|
-
const properties = [];
|
|
826
|
-
if (value === unsetValue) {
|
|
827
|
-
properties.push([flexDirectionProperty, value]);
|
|
828
|
-
properties.push([flexWrapProperty, value]);
|
|
191
|
+
_unregisterNativeEvent(arg, callback, thisArg) {
|
|
192
|
+
const id = callback['mason:event:id'];
|
|
193
|
+
if (!this[native_]) {
|
|
194
|
+
this._pendingEventsRegistration = this._pendingEventsRegistration.filter((registration) => {
|
|
195
|
+
return !(registration.arg === arg && registration.callback === callback && registration.thisArg === thisArg);
|
|
196
|
+
});
|
|
197
|
+
return;
|
|
829
198
|
}
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
if (
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
if (value.length >= 2) {
|
|
838
|
-
properties.push([flexWrapProperty, values[1]]);
|
|
199
|
+
//@ts-ignore
|
|
200
|
+
if (this._view) {
|
|
201
|
+
if (__ANDROID__) {
|
|
202
|
+
if (!id) {
|
|
203
|
+
//@ts-ignore
|
|
204
|
+
const removed = this._view.removeEventListener(arg, id);
|
|
205
|
+
callback['mason:event:id'] = undefined;
|
|
839
206
|
}
|
|
840
207
|
}
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
const flexProperty = new ShorthandProperty({
|
|
847
|
-
name: 'flex',
|
|
848
|
-
cssName: 'flex',
|
|
849
|
-
getter: function () {
|
|
850
|
-
return `${this.flexGrow} ${this.flexShrink} ${this.flexBasis}`;
|
|
851
|
-
},
|
|
852
|
-
converter: function (value) {
|
|
853
|
-
const properties = [];
|
|
854
|
-
if (value === unsetValue) {
|
|
855
|
-
properties.push([flexGrowProperty, value]);
|
|
856
|
-
properties.push([flexShrinkProperty, value]);
|
|
857
|
-
}
|
|
858
|
-
else if (typeof value === 'number') {
|
|
859
|
-
properties.push([flexGrowProperty, value]);
|
|
860
|
-
properties.push([flexShrinkProperty, 1]);
|
|
861
|
-
properties.push([flexBasisProperty, 'auto']);
|
|
862
|
-
}
|
|
863
|
-
else {
|
|
864
|
-
const trimmed = value && value.trim();
|
|
865
|
-
if (trimmed) {
|
|
866
|
-
const values = trimmed.split(/\s+/);
|
|
867
|
-
if (values.length === 1) {
|
|
868
|
-
switch (values[0]) {
|
|
869
|
-
case 'inital':
|
|
870
|
-
properties.push([flexGrowProperty, 0]);
|
|
871
|
-
properties.push([flexShrinkProperty, 1]);
|
|
872
|
-
properties.push([flexBasisProperty, 'auto']);
|
|
873
|
-
break;
|
|
874
|
-
case 'auto':
|
|
875
|
-
properties.push([flexGrowProperty, 1]);
|
|
876
|
-
properties.push([flexShrinkProperty, 1]);
|
|
877
|
-
properties.push([flexBasisProperty, 'auto']);
|
|
878
|
-
break;
|
|
879
|
-
case 'none':
|
|
880
|
-
properties.push([flexGrowProperty, 0]);
|
|
881
|
-
properties.push([flexShrinkProperty, 0]);
|
|
882
|
-
properties.push([flexBasisProperty, 'auto']);
|
|
883
|
-
break;
|
|
884
|
-
default:
|
|
885
|
-
properties.push([flexGrowProperty, values[0]]);
|
|
886
|
-
properties.push([flexShrinkProperty, 1]);
|
|
887
|
-
properties.push([flexBasisProperty, 'auto']);
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
if (values.length >= 2) {
|
|
891
|
-
properties.push([flexGrowProperty, values[0]]);
|
|
892
|
-
properties.push([flexShrinkProperty, values[1]]);
|
|
893
|
-
}
|
|
894
|
-
if (value.length >= 3) {
|
|
895
|
-
properties.push({ property: flexBasisProperty, value: values[2] });
|
|
208
|
+
if (__APPLE__) {
|
|
209
|
+
if (!id) {
|
|
210
|
+
//@ts-ignore
|
|
211
|
+
const removed = this._view.mason_removeEventListenerId(arg, id);
|
|
212
|
+
callback['mason:event:id'] = undefined;
|
|
896
213
|
}
|
|
897
214
|
}
|
|
898
215
|
}
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
defaultValue: 'nowrap',
|
|
907
|
-
valueChanged(target, oldValue, newValue) {
|
|
908
|
-
const view = target?.viewRef ? getViewStyle(target.viewRef) : target.view;
|
|
909
|
-
if (view) {
|
|
910
|
-
view.textWrap = newValue;
|
|
911
|
-
}
|
|
912
|
-
},
|
|
913
|
-
});
|
|
914
|
-
// @ts-ignore
|
|
915
|
-
export const textOverFlowProperty = new CssProperty({
|
|
916
|
-
name: 'textOverflow',
|
|
917
|
-
defaultValue: 'text-overflow',
|
|
918
|
-
valueChanged(target, oldValue, newValue) {
|
|
919
|
-
const view = target?.viewRef ? getViewStyle(target.viewRef) : target.view;
|
|
920
|
-
if (view) {
|
|
921
|
-
view.textOverflow = newValue;
|
|
922
|
-
}
|
|
923
|
-
},
|
|
924
|
-
});
|
|
925
|
-
export const textContentProperty = new Property({
|
|
926
|
-
name: 'textContent',
|
|
927
|
-
affectsLayout: true,
|
|
928
|
-
defaultValue: '',
|
|
929
|
-
});
|
|
930
|
-
export const boxSizingProperty = new CssProperty({
|
|
931
|
-
name: 'boxSizing',
|
|
932
|
-
cssName: 'box-sizing',
|
|
933
|
-
defaultValue: 'border-box',
|
|
934
|
-
valueChanged(target, oldValue, newValue) {
|
|
935
|
-
const view = getViewStyle(target.viewRef);
|
|
936
|
-
if (view) {
|
|
937
|
-
if (newValue) {
|
|
938
|
-
view.boxSizing = newValue;
|
|
939
|
-
}
|
|
940
|
-
else {
|
|
941
|
-
// Revert to old value if newValue is invalid
|
|
942
|
-
view.view.style.boxSizing = oldValue;
|
|
216
|
+
}
|
|
217
|
+
initNativeView() {
|
|
218
|
+
super.initNativeView();
|
|
219
|
+
if (this._pendingEventsRegistration.length > 0) {
|
|
220
|
+
const pending = this._pendingEventsRegistration.splice(0);
|
|
221
|
+
for (const registration of pending) {
|
|
222
|
+
this._registerNativeEvent(registration.arg, registration.callback, registration.thisArg);
|
|
943
223
|
}
|
|
944
224
|
}
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
225
|
+
}
|
|
226
|
+
_setNativeViewFrame(nativeView, frame) {
|
|
227
|
+
// nativeView.frame = frame;
|
|
228
|
+
}
|
|
229
|
+
addEventListener(arg, callback, thisArg) {
|
|
230
|
+
if (typeof thisArg === 'boolean') {
|
|
231
|
+
thisArg = {
|
|
232
|
+
capture: thisArg,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
super.addEventListener(arg, callback, thisArg);
|
|
236
|
+
if (typeof arg !== 'string') {
|
|
237
|
+
return;
|
|
953
238
|
}
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
borderRadiusProperty.register(Style);
|
|
961
|
-
export const verticalAlignProperty = new CssProperty({
|
|
962
|
-
name: 'verticalAlign',
|
|
963
|
-
cssName: 'vertical-align',
|
|
964
|
-
defaultValue: 'baseline',
|
|
965
|
-
valueChanged: (target, oldValue, newValue) => {
|
|
966
|
-
const view = getViewStyle(target.viewRef);
|
|
967
|
-
if (view) {
|
|
968
|
-
if (newValue) {
|
|
969
|
-
view.verticalAlign = newValue;
|
|
970
|
-
}
|
|
971
|
-
else {
|
|
972
|
-
// Revert to old value if newValue is invalid
|
|
973
|
-
view.view.style.verticalAlign = oldValue;
|
|
974
|
-
}
|
|
239
|
+
switch (arg) {
|
|
240
|
+
case 'input':
|
|
241
|
+
case 'change':
|
|
242
|
+
case 'click':
|
|
243
|
+
this._registerNativeEvent(arg, callback, thisArg);
|
|
244
|
+
break;
|
|
975
245
|
}
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
valueConverter: function (value) {
|
|
983
|
-
return value;
|
|
984
|
-
},
|
|
985
|
-
valueChanged(target, oldValue, newValue) {
|
|
986
|
-
const view = getViewStyle(target.viewRef);
|
|
987
|
-
if (view) {
|
|
988
|
-
if (newValue) {
|
|
989
|
-
// @ts-ignore
|
|
990
|
-
view.verticalAlign = newValue;
|
|
991
|
-
}
|
|
992
|
-
else {
|
|
993
|
-
// Revert to old value if newValue is invalid
|
|
994
|
-
// @ts-ignore
|
|
995
|
-
view.view.style.verticalAlign = oldValue;
|
|
996
|
-
}
|
|
246
|
+
}
|
|
247
|
+
removeEventListener(arg, callback, thisArg) {
|
|
248
|
+
if (typeof thisArg === 'boolean') {
|
|
249
|
+
thisArg = {
|
|
250
|
+
capture: thisArg,
|
|
251
|
+
};
|
|
997
252
|
}
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
},
|
|
1006
|
-
valueChanged(target, oldValue, newValue) {
|
|
1007
|
-
const view = getViewStyle(target.viewRef);
|
|
1008
|
-
if (view) {
|
|
1009
|
-
view.textShadow = newValue;
|
|
253
|
+
super.removeEventListener(arg, callback, thisArg);
|
|
254
|
+
switch (arg) {
|
|
255
|
+
case 'input':
|
|
256
|
+
case 'change':
|
|
257
|
+
case 'click':
|
|
258
|
+
this._unregisterNativeEvent(arg, callback, thisArg);
|
|
259
|
+
break;
|
|
1010
260
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
261
|
+
}
|
|
262
|
+
_applyPseudoClassStyles(pseudoClass, view, styles) {
|
|
263
|
+
if (pseudoClass && styles && pseudoClass in styles) {
|
|
264
|
+
const current = styles[pseudoClass];
|
|
265
|
+
//@ts-ignore
|
|
266
|
+
const existing = this[pseudoStyles_]?.[pseudoClass];
|
|
267
|
+
const style = existing ?? Style.fromPseudo(pseudoClass, this, view);
|
|
268
|
+
if (style) {
|
|
269
|
+
for (const prop in current) {
|
|
270
|
+
style[prop] = current[prop];
|
|
271
|
+
}
|
|
272
|
+
this[pseudoStyles_][pseudoClass] = style;
|
|
273
|
+
}
|
|
1015
274
|
}
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
275
|
+
}
|
|
276
|
+
_handler(subscribe) {
|
|
277
|
+
const styles = compile(this);
|
|
278
|
+
//@ts-ignore
|
|
279
|
+
this._applyPseudoClassStyles('active', this._view, styles);
|
|
280
|
+
}
|
|
281
|
+
_disableHandler(subscribe) {
|
|
282
|
+
const styles = compile(this);
|
|
283
|
+
//@ts-ignore
|
|
284
|
+
this._applyPseudoClassStyles('disabled', this._view, styles);
|
|
285
|
+
}
|
|
286
|
+
_focusHandler(subscribe) {
|
|
287
|
+
const styles = compile(this);
|
|
288
|
+
//@ts-ignore
|
|
289
|
+
this._applyPseudoClassStyles('focus', this._view, styles);
|
|
290
|
+
}
|
|
291
|
+
_blurHandler(subscribe) {
|
|
292
|
+
const styles = compile(this);
|
|
293
|
+
//@ts-ignore
|
|
294
|
+
this._applyPseudoClassStyles('blur', this._view, styles);
|
|
1025
295
|
}
|
|
1026
296
|
forceStyleUpdate() {
|
|
1027
297
|
_forceStyleUpdate(this);
|
|
@@ -1082,7 +352,7 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1082
352
|
}
|
|
1083
353
|
if (__APPLE__) {
|
|
1084
354
|
//@ts-ignore
|
|
1085
|
-
this._view.
|
|
355
|
+
this._view.mason_append(child._view);
|
|
1086
356
|
}
|
|
1087
357
|
if (this[isText_]) {
|
|
1088
358
|
child[isTextChild_] = true;
|
|
@@ -1112,21 +382,81 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1112
382
|
}
|
|
1113
383
|
this._children.push(child);
|
|
1114
384
|
}
|
|
385
|
+
else if (child instanceof TextNode) {
|
|
386
|
+
//@ts-ignore
|
|
387
|
+
if (this._view) {
|
|
388
|
+
if (__ANDROID__) {
|
|
389
|
+
//@ts-ignore
|
|
390
|
+
this._view.addChildAt(child[native_], this._children.length);
|
|
391
|
+
}
|
|
392
|
+
if (__APPLE__) {
|
|
393
|
+
//@ts-ignore
|
|
394
|
+
this._view.mason_addChildAtNode(child[native_], this._children.length);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
this._children.push(child);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
insertBefore(child, reference) {
|
|
402
|
+
if (reference === null || reference === undefined) {
|
|
403
|
+
if (child && child.nodeType === 3) {
|
|
404
|
+
this._updateTextNode(child, { type: 'add', index: -1, isBreak: child.nodeName === 'br' });
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
this.addChild(child);
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
let atIndex = this._children.indexOf(reference);
|
|
411
|
+
if (atIndex === -1) {
|
|
412
|
+
// reference may be a DOM text node; look it up via its native text-node back-link
|
|
413
|
+
const nativeTextNode = reference[textNode_];
|
|
414
|
+
if (nativeTextNode) {
|
|
415
|
+
atIndex = this._children.findIndex((c) => c && c[textNode_] === nativeTextNode);
|
|
416
|
+
}
|
|
417
|
+
if (atIndex === -1) {
|
|
418
|
+
throw new Error('NotFoundError');
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
if (child && child.nodeType === 3) {
|
|
422
|
+
this._updateTextNode(child, { type: 'insert', index: atIndex, isBreak: child.nodeName === 'br' });
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
this.insertChild(child, atIndex);
|
|
426
|
+
}
|
|
427
|
+
// Native child index for an insertion at `atIndex`: counts only the
|
|
428
|
+
// preceding siblings that already exist in the native tree. Text nodes and
|
|
429
|
+
// placeholders attach natively right away, but NativeScript views attach
|
|
430
|
+
// lazily (on `loaded`), so a raw `_children` index can run ahead of the
|
|
431
|
+
// native children list and push the insert past the end.
|
|
432
|
+
_nativeIndexFor(atIndex) {
|
|
433
|
+
let index = 0;
|
|
434
|
+
const max = Math.min(atIndex, this._children.length);
|
|
435
|
+
for (let i = 0; i < max; i++) {
|
|
436
|
+
const c = this._children[i];
|
|
437
|
+
if (!c) {
|
|
438
|
+
continue;
|
|
439
|
+
}
|
|
440
|
+
if (c[textNode_] || c instanceof TextNode || text_ in c || (c[isPlaceholder_] && c[native_]) || c._isMasonChild) {
|
|
441
|
+
index++;
|
|
442
|
+
}
|
|
1115
443
|
}
|
|
444
|
+
return index;
|
|
1116
445
|
}
|
|
1117
446
|
insertChild(child, atIndex) {
|
|
1118
447
|
if (child && child[isPlaceholder_] && child._view) {
|
|
1119
|
-
this.
|
|
448
|
+
const nativeIndex = this._nativeIndexFor(atIndex);
|
|
449
|
+
this._children.splice(atIndex, 0, child);
|
|
1120
450
|
if (this[isText_]) {
|
|
1121
451
|
child[isTextChild_] = true;
|
|
1122
452
|
}
|
|
1123
453
|
if (__ANDROID__) {
|
|
1124
454
|
//@ts-ignore
|
|
1125
|
-
this._view.addChildAt(child._view,
|
|
455
|
+
this._view.addChildAt(child._view, nativeIndex);
|
|
1126
456
|
}
|
|
1127
457
|
if (__APPLE__) {
|
|
1128
458
|
//@ts-ignore
|
|
1129
|
-
this._view.
|
|
459
|
+
this._view.mason_addChildAtElement(child._view, nativeIndex);
|
|
1130
460
|
}
|
|
1131
461
|
}
|
|
1132
462
|
else if (child instanceof NSView) {
|
|
@@ -1149,7 +479,7 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1149
479
|
}
|
|
1150
480
|
if (__APPLE__) {
|
|
1151
481
|
//@ts-ignore
|
|
1152
|
-
this._view.
|
|
482
|
+
this._view.mason_replaceChildAtElement(child._view, atIndex);
|
|
1153
483
|
}
|
|
1154
484
|
}
|
|
1155
485
|
else if (child instanceof NSView) {
|
|
@@ -1182,12 +512,74 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1182
512
|
}
|
|
1183
513
|
}
|
|
1184
514
|
removeChild(child) {
|
|
515
|
+
// Placeholder (e.g. Br): it was attached straight to the mason tree via the
|
|
516
|
+
// native element APIs (never `_addView`-ed), so `_removeView` would throw.
|
|
517
|
+
// Remove the native node directly instead.
|
|
518
|
+
if (child && child[isPlaceholder_] && child._view) {
|
|
519
|
+
const index = this._children.indexOf(child);
|
|
520
|
+
if (index > -1) {
|
|
521
|
+
this._children.splice(index, 1);
|
|
522
|
+
if (__ANDROID__) {
|
|
523
|
+
//@ts-ignore
|
|
524
|
+
this._view.removeChild(child._view.node);
|
|
525
|
+
}
|
|
526
|
+
if (__APPLE__) {
|
|
527
|
+
//@ts-ignore
|
|
528
|
+
this._view.mason_removeChildNode(child._view.node);
|
|
529
|
+
}
|
|
530
|
+
child[isTextChild_] = false;
|
|
531
|
+
this.requestLayout?.();
|
|
532
|
+
}
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
// Framework text node: it isn't stored in `_children` directly — its native
|
|
536
|
+
// `MasonTextNode` is stamped on it as `child[textNode_]`. Use that to locate
|
|
537
|
+
// and remove the matching native node from the mason tree. NativeScript has
|
|
538
|
+
// no real text nodes (frameworks just set `.text`), so this is what lets a
|
|
539
|
+
// framework's `removeChild(textNode)` actually drop the mason node.
|
|
540
|
+
if (child && child[textNode_]) {
|
|
541
|
+
const native = child[textNode_];
|
|
542
|
+
const tnIndex = this._children.findIndex((c) => c && c[textNode_] === native);
|
|
543
|
+
if (tnIndex > -1) {
|
|
544
|
+
this._nativeRemoveChildNode(native, tnIndex);
|
|
545
|
+
this._children.splice(tnIndex, 1);
|
|
546
|
+
// Drop the proxy binding so a later re-adopt re-installs cleanly.
|
|
547
|
+
child[textNodeProxied_] = false;
|
|
548
|
+
child[textNode_] = undefined;
|
|
549
|
+
this.requestLayout?.();
|
|
550
|
+
return;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
1185
553
|
const index = this._children.indexOf(child);
|
|
1186
554
|
if (index > -1) {
|
|
1187
555
|
this._children.splice(index, 1);
|
|
1188
556
|
this._removeView(child);
|
|
1189
557
|
}
|
|
1190
558
|
}
|
|
559
|
+
// Remove the native node directly when supported (no index drift), falling
|
|
560
|
+
// back to index-based removal on native builds that predate the by-node API.
|
|
561
|
+
_nativeRemoveChildNode(node, index) {
|
|
562
|
+
//@ts-ignore
|
|
563
|
+
const view = this._view;
|
|
564
|
+
if (!view)
|
|
565
|
+
return;
|
|
566
|
+
if (__ANDROID__) {
|
|
567
|
+
//@ts-ignore
|
|
568
|
+
if (typeof view.removeChild === 'function')
|
|
569
|
+
view.removeChild(node);
|
|
570
|
+
//@ts-ignore
|
|
571
|
+
else
|
|
572
|
+
view.removeChildAt(index);
|
|
573
|
+
}
|
|
574
|
+
if (__APPLE__) {
|
|
575
|
+
//@ts-ignore
|
|
576
|
+
if (view.mason_removeChildNode)
|
|
577
|
+
view.mason_removeChildNode(node);
|
|
578
|
+
//@ts-ignore
|
|
579
|
+
else
|
|
580
|
+
view.mason_removeChildAt?.(index);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
1191
583
|
removeChildren() {
|
|
1192
584
|
if (this._viewChildren.length === 0) {
|
|
1193
585
|
return;
|
|
@@ -1201,58 +593,280 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1201
593
|
}
|
|
1202
594
|
this._children.splice(0);
|
|
1203
595
|
}
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
596
|
+
[(_a = isMasonView_, _b = isTextChild_, _c = isText_, _d = pseudoStyles_, zIndexProperty.setNative)](value) {
|
|
597
|
+
// @ts-ignore
|
|
598
|
+
const style = this._styleHelper;
|
|
599
|
+
if (style) {
|
|
600
|
+
// @ts-ignore
|
|
601
|
+
style.zIndex = value;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
set verticalAlign(value) {
|
|
605
|
+
this.style.verticalAlign = value;
|
|
606
|
+
}
|
|
607
|
+
get verticalAlign() {
|
|
608
|
+
return this.style.verticalAlign;
|
|
609
|
+
}
|
|
610
|
+
[verticalAlignProperty.setNative](value) {
|
|
611
|
+
// @ts-ignore
|
|
612
|
+
const style = this._styleHelper;
|
|
613
|
+
if (style) {
|
|
614
|
+
// @ts-ignore
|
|
615
|
+
style.verticalAlign = value;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
// @ts-ignore
|
|
619
|
+
set flex(value) {
|
|
620
|
+
this.style.flex = value;
|
|
621
|
+
}
|
|
622
|
+
get flex() {
|
|
623
|
+
return this.style.flex;
|
|
624
|
+
}
|
|
625
|
+
set textWrap(value) {
|
|
626
|
+
this.style.textWrap = value;
|
|
627
|
+
}
|
|
628
|
+
get textWrap() {
|
|
629
|
+
return this.style.textWrap;
|
|
630
|
+
}
|
|
631
|
+
[textWrapProperty.setNative](value) {
|
|
632
|
+
// @ts-ignore
|
|
633
|
+
const style = this._styleHelper;
|
|
634
|
+
if (style) {
|
|
635
|
+
// @ts-ignore
|
|
636
|
+
style.textWrap = value;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
set aspectRatio(value) {
|
|
640
|
+
this.style.aspectRatio = value;
|
|
641
|
+
}
|
|
642
|
+
get aspectRatio() {
|
|
643
|
+
return this.style.aspectRatio;
|
|
644
|
+
}
|
|
645
|
+
[aspectRatioProperty.setNative](value) {
|
|
646
|
+
// @ts-ignore
|
|
647
|
+
const style = this._styleHelper;
|
|
648
|
+
if (style) {
|
|
649
|
+
// @ts-ignore
|
|
650
|
+
style.aspectRatio = value;
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
// -- Platform bridge methods for native text node operations --
|
|
654
|
+
_createOrUpdateNativeTextNode(node, text) {
|
|
655
|
+
if (node[textNode_]) {
|
|
656
|
+
if (__ANDROID__) {
|
|
657
|
+
node[textNode_].setData(text);
|
|
658
|
+
}
|
|
659
|
+
if (__APPLE__) {
|
|
660
|
+
node[textNode_].data = text;
|
|
661
|
+
}
|
|
662
|
+
this._installTextNodeProxy(node);
|
|
663
|
+
return node[textNode_];
|
|
664
|
+
}
|
|
665
|
+
let textNode;
|
|
666
|
+
if (__ANDROID__) {
|
|
667
|
+
textNode = new org.nativescript.mason.masonkit.TextNode(Tree.instance.native, text);
|
|
668
|
+
}
|
|
669
|
+
if (__APPLE__) {
|
|
670
|
+
textNode = MasonTextNode.alloc().initWithMasonDataAttributes(Tree.instance.native, text, null);
|
|
671
|
+
}
|
|
672
|
+
node[textNode_] = textNode;
|
|
673
|
+
// Back-reference from the native node to the framework text node.
|
|
674
|
+
textNode['__raw__'] = node;
|
|
675
|
+
this._installTextNodeProxy(node);
|
|
676
|
+
return textNode;
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Bind a framework text node directly to its backing native `MasonTextNode`.
|
|
680
|
+
*
|
|
681
|
+
* Once mason adopts a text node (any framework — dominative/undom, Vue, React,
|
|
682
|
+
* Angular) we redefine its `data` accessor so future in-place writes
|
|
683
|
+
* (`node.data = …`, `node.nodeValue = …`, `node.textContent = …`, all of which
|
|
684
|
+
* funnel through `data` on a CharacterData node) flow straight through to the
|
|
685
|
+
* native node and trigger a relayout. The original accessor is still invoked so
|
|
686
|
+
* the framework's own bookkeeping (undom's `__undom_data`, change callbacks)
|
|
687
|
+
* stays intact. This is the framework-agnostic counterpart to the structural
|
|
688
|
+
* reconcile in `textProperty.setNative` — structure is handled there, granular
|
|
689
|
+
* text edits are handled here, with no per-framework glue.
|
|
690
|
+
*/
|
|
691
|
+
_installTextNodeProxy(node) {
|
|
692
|
+
if (!node || node[textNodeProxied_])
|
|
693
|
+
return;
|
|
694
|
+
// Locate the inherited `data` accessor (undom CharacterData and friends define
|
|
695
|
+
// it on a prototype). If the node isn't CharacterData-like there's nothing to
|
|
696
|
+
// proxy — the structural path already covers it.
|
|
697
|
+
let proto = Object.getPrototypeOf(node);
|
|
698
|
+
let dataDesc;
|
|
699
|
+
while (proto && !dataDesc) {
|
|
700
|
+
dataDesc = Object.getOwnPropertyDescriptor(proto, 'data');
|
|
701
|
+
proto = Object.getPrototypeOf(proto);
|
|
702
|
+
}
|
|
703
|
+
if (!dataDesc || !dataDesc.set)
|
|
704
|
+
return;
|
|
705
|
+
node[textNodeProxied_] = true;
|
|
706
|
+
const owner = this;
|
|
707
|
+
Object.defineProperty(node, 'data', {
|
|
708
|
+
configurable: true,
|
|
709
|
+
enumerable: false,
|
|
710
|
+
get() {
|
|
711
|
+
return dataDesc.get ? dataDesc.get.call(this) : this.__undom_data;
|
|
712
|
+
},
|
|
713
|
+
set(value) {
|
|
714
|
+
// Preserve the framework's own bookkeeping first.
|
|
715
|
+
dataDesc.set.call(this, value);
|
|
716
|
+
// Push through to the native node (read `textNode_` lazily so we always
|
|
717
|
+
// target the current backing node even if it was re-created).
|
|
718
|
+
const nativeTextNode = this[textNode_];
|
|
719
|
+
if (nativeTextNode) {
|
|
720
|
+
const data = value == null ? '' : `${value}`;
|
|
721
|
+
if (__ANDROID__)
|
|
722
|
+
nativeTextNode.setData(data);
|
|
723
|
+
if (__APPLE__)
|
|
724
|
+
nativeTextNode.data = data;
|
|
725
|
+
// Re-measure/layout so the new text is reflected on screen.
|
|
726
|
+
owner.requestLayout?.();
|
|
727
|
+
}
|
|
728
|
+
},
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
_nativeAddChild(textNode, index) {
|
|
732
|
+
//@ts-ignore
|
|
733
|
+
if (__ANDROID__)
|
|
734
|
+
this._view.addChildAt(textNode, index);
|
|
735
|
+
//@ts-ignore
|
|
736
|
+
if (__APPLE__)
|
|
737
|
+
this._view.mason_addChildAtNode(textNode, index);
|
|
738
|
+
}
|
|
739
|
+
_nativeReplaceChild(textNode, index) {
|
|
740
|
+
//@ts-ignore
|
|
741
|
+
if (__ANDROID__)
|
|
742
|
+
this._view.replaceChildAt(textNode, index);
|
|
743
|
+
//@ts-ignore
|
|
744
|
+
if (__APPLE__)
|
|
745
|
+
this._view.mason_replaceChildAtNode(textNode, index);
|
|
746
|
+
}
|
|
747
|
+
_setOrPushChild(index, entry) {
|
|
748
|
+
if (this._children.length > index) {
|
|
749
|
+
//@ts-ignore
|
|
750
|
+
this._children[index] = entry;
|
|
751
|
+
}
|
|
752
|
+
else {
|
|
753
|
+
//@ts-ignore
|
|
754
|
+
this._children.push(entry);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
// -- Unified text node update (cross-platform) --
|
|
758
|
+
_updateTextNode(node, operation = null) {
|
|
759
|
+
const text = node.text ?? node.data ?? '';
|
|
760
|
+
const textNode = this._createOrUpdateNativeTextNode(node, text);
|
|
761
|
+
if (!operation)
|
|
762
|
+
return;
|
|
763
|
+
const entry = { [text_]: text, [textNode_]: textNode, [textNodeIndex_]: operation.index ?? this._children.length };
|
|
764
|
+
switch (operation.type) {
|
|
765
|
+
case 'add':
|
|
766
|
+
this._nativeAddChild(textNode, this._children.length);
|
|
767
|
+
//@ts-ignore
|
|
768
|
+
this._children.push({ ...entry, [textNodeIndex_]: this._children.length });
|
|
769
|
+
break;
|
|
770
|
+
case 'replace':
|
|
771
|
+
this._nativeReplaceChild(textNode, operation.index);
|
|
772
|
+
this._setOrPushChild(operation.index, entry);
|
|
773
|
+
break;
|
|
774
|
+
case 'insert':
|
|
775
|
+
this._nativeAddChild(textNode, operation.index);
|
|
776
|
+
this._setOrPushChild(operation.index, entry);
|
|
777
|
+
break;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
// -- Text setter with per-view framework detection --
|
|
781
|
+
[textProperty.setNative](value) {
|
|
782
|
+
const frameworkEl = getFrameworkElement(this);
|
|
783
|
+
if (frameworkEl) {
|
|
784
|
+
// Frameworks with childNodes array (Vue, React, Svelte, SolidJS)
|
|
785
|
+
if (Array.isArray(frameworkEl.childNodes)) {
|
|
786
|
+
const rawChildNodes = frameworkEl.childNodes;
|
|
787
|
+
if (rawChildNodes.length === 0) {
|
|
788
|
+
this.replaceChild({ [text_]: value }, 0);
|
|
789
|
+
return;
|
|
790
|
+
}
|
|
791
|
+
// Deduplicate nodes (some frameworks expose the same nodes via both
|
|
792
|
+
// `childNodes` array and linked `nextSibling` references). Preserve
|
|
793
|
+
// original order while skipping duplicate references.
|
|
794
|
+
const nodes = [];
|
|
795
|
+
const seen = new Set();
|
|
796
|
+
for (let n of rawChildNodes) {
|
|
797
|
+
if (!seen.has(n)) {
|
|
798
|
+
seen.add(n);
|
|
799
|
+
nodes.push(n);
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
803
|
+
const node = nodes[i];
|
|
804
|
+
const isTextNode = node.nodeType === 'text' || node.nodeType === 3;
|
|
805
|
+
if (isTextNode) {
|
|
806
|
+
let type = i === 0 && nodes.length === 1 && !this._children.length ? 'add' : 'replace';
|
|
807
|
+
if (type === 'replace') {
|
|
808
|
+
const toReplace = this._children[i];
|
|
809
|
+
// Replace in place only if this slot already holds THIS framework
|
|
810
|
+
// node (its native node back-references it via '__raw__'); otherwise
|
|
811
|
+
// a different node lives here, so shift via insert instead of
|
|
812
|
+
// overwriting it.
|
|
813
|
+
if (!toReplace || toReplace[textNode_]?.['__raw__'] !== node) {
|
|
814
|
+
type = 'insert';
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
this._updateTextNode(node, { type, index: i, isBreak: node.nodeName === 'br' });
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
// Frameworks with linked-list traversal (Angular)
|
|
823
|
+
if ('firstChild' in frameworkEl) {
|
|
824
|
+
const nodes = [];
|
|
825
|
+
let child = frameworkEl.firstChild;
|
|
826
|
+
while (child) {
|
|
827
|
+
nodes.push(child);
|
|
828
|
+
child = child.nextSibling;
|
|
829
|
+
}
|
|
830
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
831
|
+
const node = nodes[i];
|
|
832
|
+
const isTextNode = node.nodeType === 'text' || node.nodeType === 3 || node.nodeName === 'TextNode' || node.constructor?.name === 'TextNode';
|
|
833
|
+
if (isTextNode || node.nodeName === 'br') {
|
|
834
|
+
this._updateTextNode(node, { type: 'replace', index: i, isBreak: node.nodeName === 'br' });
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
return;
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
// NativeScript Core: linked-list traversal on the view itself
|
|
841
|
+
if ('firstChild' in this) {
|
|
842
|
+
const nodes = [];
|
|
843
|
+
let child = this.firstChild;
|
|
844
|
+
while (child) {
|
|
845
|
+
nodes.push(child);
|
|
846
|
+
child = child.nextSibling;
|
|
847
|
+
}
|
|
848
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
849
|
+
const node = nodes[i];
|
|
850
|
+
const isTextNode = node.nodeType === 'text' || node.nodeName === 'TextNode' || node.constructor?.name === 'TextNode';
|
|
851
|
+
if (isTextNode || node.nodeName === 'br') {
|
|
852
|
+
this._updateTextNode(node, { type: 'replace', index: i, isBreak: node.nodeName === 'br' });
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
return;
|
|
856
|
+
}
|
|
857
|
+
// Fallback: direct textContent
|
|
858
|
+
if ('textContent' in this) {
|
|
859
|
+
// @ts-ignore
|
|
860
|
+
this.textContent = value;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
get filter() {
|
|
864
|
+
return this.style.filter;
|
|
865
|
+
}
|
|
866
|
+
set filter(value) {
|
|
867
|
+
this.style.filter = value;
|
|
868
|
+
}
|
|
869
|
+
[filterProperty.setNative](value) {
|
|
1256
870
|
// @ts-ignore
|
|
1257
871
|
const style = this._styleHelper;
|
|
1258
872
|
if (style) {
|
|
@@ -1260,6 +874,13 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1260
874
|
style.filter = value;
|
|
1261
875
|
}
|
|
1262
876
|
}
|
|
877
|
+
// @ts-ignore
|
|
878
|
+
set borderRadius(value) {
|
|
879
|
+
this.style.borderRadius = value;
|
|
880
|
+
}
|
|
881
|
+
get borderRadius() {
|
|
882
|
+
return this.style.borderRadius;
|
|
883
|
+
}
|
|
1263
884
|
[borderRadiusProperty.setNative](value) {
|
|
1264
885
|
// @ts-ignore
|
|
1265
886
|
const style = this._styleHelper;
|
|
@@ -1268,6 +889,12 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1268
889
|
style.borderRadius = value;
|
|
1269
890
|
}
|
|
1270
891
|
}
|
|
892
|
+
set border(value) {
|
|
893
|
+
this.style.border = value;
|
|
894
|
+
}
|
|
895
|
+
get border() {
|
|
896
|
+
return this.style.border;
|
|
897
|
+
}
|
|
1271
898
|
[borderProperty.setNative](value) {
|
|
1272
899
|
// @ts-ignore
|
|
1273
900
|
const style = this._styleHelper;
|
|
@@ -1276,6 +903,45 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1276
903
|
style.border = value;
|
|
1277
904
|
}
|
|
1278
905
|
}
|
|
906
|
+
[borderLeftProperty.setNative](value) {
|
|
907
|
+
// @ts-ignore
|
|
908
|
+
const style = this._styleHelper;
|
|
909
|
+
if (style) {
|
|
910
|
+
// @ts-ignore
|
|
911
|
+
style.borderLeft = value;
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
[borderTopProperty.setNative](value) {
|
|
915
|
+
// @ts-ignore
|
|
916
|
+
const style = this._styleHelper;
|
|
917
|
+
if (style) {
|
|
918
|
+
// @ts-ignore
|
|
919
|
+
style.borderTop = value;
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
[borderRightProperty.setNative](value) {
|
|
923
|
+
// @ts-ignore
|
|
924
|
+
const style = this._styleHelper;
|
|
925
|
+
if (style) {
|
|
926
|
+
// @ts-ignore
|
|
927
|
+
style.borderRight = value;
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
[borderBottomProperty.setNative](value) {
|
|
931
|
+
// @ts-ignore
|
|
932
|
+
const style = this._styleHelper;
|
|
933
|
+
if (style) {
|
|
934
|
+
// @ts-ignore
|
|
935
|
+
style.borderBottom = value;
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
// @ts-ignore
|
|
939
|
+
set background(value) {
|
|
940
|
+
this.style.background = value;
|
|
941
|
+
}
|
|
942
|
+
get background() {
|
|
943
|
+
return this.style.background;
|
|
944
|
+
}
|
|
1279
945
|
[backgroundProperty.setNative](value) {
|
|
1280
946
|
// @ts-ignore
|
|
1281
947
|
const style = this._styleHelper;
|
|
@@ -1373,34 +1039,83 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1373
1039
|
set boxSizing(value) {
|
|
1374
1040
|
this.style.boxSizing = value;
|
|
1375
1041
|
}
|
|
1042
|
+
[boxSizingProperty.setNative](value) {
|
|
1043
|
+
// @ts-ignore
|
|
1044
|
+
const style = this._styleHelper;
|
|
1045
|
+
if (style) {
|
|
1046
|
+
// @ts-ignore
|
|
1047
|
+
style.boxSizing = value;
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1376
1050
|
get display() {
|
|
1377
1051
|
return this.style.display;
|
|
1378
1052
|
}
|
|
1379
1053
|
set display(value) {
|
|
1380
1054
|
this.style.display = value;
|
|
1381
1055
|
}
|
|
1056
|
+
[displayProperty.setNative](value) {
|
|
1057
|
+
// @ts-ignore
|
|
1058
|
+
const style = this._styleHelper;
|
|
1059
|
+
if (style) {
|
|
1060
|
+
// @ts-ignore
|
|
1061
|
+
style.display = value;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
get overflow() {
|
|
1065
|
+
return this.style.overflow;
|
|
1066
|
+
}
|
|
1067
|
+
set overflow(value) {
|
|
1068
|
+
this.style.overflow = value;
|
|
1069
|
+
}
|
|
1382
1070
|
get overflowX() {
|
|
1383
1071
|
return this.style.overflowX;
|
|
1384
1072
|
}
|
|
1385
1073
|
set overflowX(value) {
|
|
1386
1074
|
this.style.overflowX = value;
|
|
1387
1075
|
}
|
|
1076
|
+
[overflowXProperty.setNative](value) {
|
|
1077
|
+
// @ts-ignore
|
|
1078
|
+
const style = this._styleHelper;
|
|
1079
|
+
if (style) {
|
|
1080
|
+
// @ts-ignore
|
|
1081
|
+
style.overflowX = value;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1388
1084
|
get overflowY() {
|
|
1389
1085
|
return this.style.overflowY;
|
|
1390
1086
|
}
|
|
1391
1087
|
set overflowY(value) {
|
|
1392
1088
|
this.style.overflowY = value;
|
|
1393
1089
|
}
|
|
1090
|
+
[overflowYProperty.setNative](value) {
|
|
1091
|
+
// @ts-ignore
|
|
1092
|
+
const style = this._styleHelper;
|
|
1093
|
+
if (style) {
|
|
1094
|
+
// @ts-ignore
|
|
1095
|
+
style.overflowY = value;
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1394
1098
|
get scrollBarWidth() {
|
|
1395
1099
|
return this.style.scrollBarWidth;
|
|
1396
1100
|
}
|
|
1397
1101
|
set scrollBarWidth(value) {
|
|
1398
1102
|
this.style.scrollBarWidth = value;
|
|
1399
1103
|
}
|
|
1104
|
+
[scrollBarWidthProperty.setNative](value) {
|
|
1105
|
+
// @ts-ignore
|
|
1106
|
+
const style = this._styleHelper;
|
|
1107
|
+
if (style) {
|
|
1108
|
+
// @ts-ignore
|
|
1109
|
+
style.scrollBarWidth = value;
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1400
1112
|
get position() {
|
|
1401
1113
|
return this.style.position;
|
|
1402
1114
|
}
|
|
1403
1115
|
set position(value) {
|
|
1116
|
+
this.style.position = value;
|
|
1117
|
+
}
|
|
1118
|
+
[positionProperty.setNative](value) {
|
|
1404
1119
|
// @ts-ignore
|
|
1405
1120
|
const style = this._styleHelper;
|
|
1406
1121
|
if (style) {
|
|
@@ -1467,6 +1182,12 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1467
1182
|
style.alignSelf = value;
|
|
1468
1183
|
}
|
|
1469
1184
|
}
|
|
1185
|
+
get alignContent() {
|
|
1186
|
+
return this.style.alignContent;
|
|
1187
|
+
}
|
|
1188
|
+
set alignContent(value) {
|
|
1189
|
+
this.style.alignContent = value;
|
|
1190
|
+
}
|
|
1470
1191
|
[alignContentProperty.setNative](value) {
|
|
1471
1192
|
// @ts-ignore
|
|
1472
1193
|
const style = this._styleHelper;
|
|
@@ -1474,6 +1195,12 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1474
1195
|
style.alignContent = value;
|
|
1475
1196
|
}
|
|
1476
1197
|
}
|
|
1198
|
+
get justifyItems() {
|
|
1199
|
+
return this.style.justifyItems;
|
|
1200
|
+
}
|
|
1201
|
+
set justifyItems(value) {
|
|
1202
|
+
this.style.justifyItems = value;
|
|
1203
|
+
}
|
|
1477
1204
|
[justifyItemsProperty.setNative](value) {
|
|
1478
1205
|
// @ts-ignore
|
|
1479
1206
|
const style = this._styleHelper;
|
|
@@ -1481,6 +1208,12 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1481
1208
|
style.justifyItems = value;
|
|
1482
1209
|
}
|
|
1483
1210
|
}
|
|
1211
|
+
get justifySelf() {
|
|
1212
|
+
return this.style.justifySelf;
|
|
1213
|
+
}
|
|
1214
|
+
set justifySelf(value) {
|
|
1215
|
+
this.style.justifySelf = value;
|
|
1216
|
+
}
|
|
1484
1217
|
[justifySelfProperty.setNative](value) {
|
|
1485
1218
|
// @ts-ignore
|
|
1486
1219
|
const style = this._styleHelper;
|
|
@@ -1502,6 +1235,12 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1502
1235
|
style.left = value;
|
|
1503
1236
|
}
|
|
1504
1237
|
}
|
|
1238
|
+
get right() {
|
|
1239
|
+
return this.style.right;
|
|
1240
|
+
}
|
|
1241
|
+
set right(value) {
|
|
1242
|
+
this.style.right = value;
|
|
1243
|
+
}
|
|
1505
1244
|
[rightProperty.setNative](value) {
|
|
1506
1245
|
// @ts-ignore
|
|
1507
1246
|
const style = this._styleHelper;
|
|
@@ -1509,6 +1248,12 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1509
1248
|
style.right = value;
|
|
1510
1249
|
}
|
|
1511
1250
|
}
|
|
1251
|
+
get bottom() {
|
|
1252
|
+
return this.style.bottom;
|
|
1253
|
+
}
|
|
1254
|
+
set bottom(value) {
|
|
1255
|
+
this.style.bottom = value;
|
|
1256
|
+
}
|
|
1512
1257
|
[bottomProperty.setNative](value) {
|
|
1513
1258
|
// @ts-ignore
|
|
1514
1259
|
const style = this._styleHelper;
|
|
@@ -1563,19 +1308,26 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1563
1308
|
get maxHeight() {
|
|
1564
1309
|
return this.style.maxHeight;
|
|
1565
1310
|
}
|
|
1311
|
+
[maxWidthProperty.setNative](value) {
|
|
1312
|
+
// @ts-ignore
|
|
1313
|
+
const style = this._styleHelper;
|
|
1314
|
+
if (style) {
|
|
1315
|
+
style.maxWidth = value;
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
[maxHeightProperty.setNative](value) {
|
|
1319
|
+
// @ts-ignore
|
|
1320
|
+
const style = this._styleHelper;
|
|
1321
|
+
if (style) {
|
|
1322
|
+
style.maxHeight = value;
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1566
1325
|
_redrawNativeBackground(value) { }
|
|
1567
1326
|
[marginProperty.setNative](value) {
|
|
1568
1327
|
// @ts-ignore
|
|
1569
1328
|
const style = this._styleHelper;
|
|
1570
1329
|
if (style) {
|
|
1571
|
-
|
|
1572
|
-
style.margin = 'auto';
|
|
1573
|
-
return;
|
|
1574
|
-
}
|
|
1575
|
-
try {
|
|
1576
|
-
style.margin = CorePercentLength.parse(value);
|
|
1577
|
-
}
|
|
1578
|
-
catch (error) { }
|
|
1330
|
+
style.marginCss = value;
|
|
1579
1331
|
}
|
|
1580
1332
|
}
|
|
1581
1333
|
[marginLeftProperty.setNative](value) {
|
|
@@ -1606,15 +1358,18 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1606
1358
|
style.marginTop = value;
|
|
1607
1359
|
}
|
|
1608
1360
|
}
|
|
1361
|
+
get padding() {
|
|
1362
|
+
return this.style.padding;
|
|
1363
|
+
}
|
|
1364
|
+
set padding(value) {
|
|
1365
|
+
this.style.padding = value;
|
|
1366
|
+
}
|
|
1609
1367
|
[paddingProperty.setNative](value) {
|
|
1610
1368
|
// @ts-ignore
|
|
1611
1369
|
const style = this._styleHelper;
|
|
1612
1370
|
if (style) {
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
style.padding = CoreLength.parse(value);
|
|
1616
|
-
}
|
|
1617
|
-
catch (error) { }
|
|
1371
|
+
// @ts-ignore
|
|
1372
|
+
style.paddingCss = value;
|
|
1618
1373
|
}
|
|
1619
1374
|
}
|
|
1620
1375
|
[paddingLeftProperty.setNative](value) {
|
|
@@ -1645,67 +1400,228 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1645
1400
|
style.paddingBottom = value;
|
|
1646
1401
|
}
|
|
1647
1402
|
}
|
|
1403
|
+
set gap(value) {
|
|
1404
|
+
this.style.gap = value;
|
|
1405
|
+
}
|
|
1406
|
+
get gap() {
|
|
1407
|
+
return this.style.gap;
|
|
1408
|
+
}
|
|
1409
|
+
set gridGap(value) {
|
|
1410
|
+
this.style.gridGap = value;
|
|
1411
|
+
}
|
|
1412
|
+
get gridGap() {
|
|
1413
|
+
return this.style.gridGap;
|
|
1414
|
+
}
|
|
1648
1415
|
set rowGap(value) {
|
|
1649
1416
|
this.style.rowGap = value;
|
|
1650
1417
|
}
|
|
1651
1418
|
get rowGap() {
|
|
1652
1419
|
return this.style.rowGap;
|
|
1653
1420
|
}
|
|
1421
|
+
[rowGapProperty.setNative](value) {
|
|
1422
|
+
// @ts-ignore
|
|
1423
|
+
const style = this._styleHelper;
|
|
1424
|
+
if (style) {
|
|
1425
|
+
// @ts-ignore
|
|
1426
|
+
style.rowGap = value;
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1654
1429
|
set columnGap(value) {
|
|
1655
1430
|
this.style.columnGap = value;
|
|
1656
1431
|
}
|
|
1657
1432
|
get columnGap() {
|
|
1658
1433
|
return this.style.columnGap;
|
|
1659
1434
|
}
|
|
1435
|
+
[columnGapProperty.setNative](value) {
|
|
1436
|
+
// @ts-ignore
|
|
1437
|
+
const style = this._styleHelper;
|
|
1438
|
+
if (style) {
|
|
1439
|
+
// @ts-ignore
|
|
1440
|
+
style.columnGap = value;
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1660
1443
|
set gridColumnStart(value) {
|
|
1661
1444
|
this.style.gridColumnStart = value;
|
|
1662
1445
|
}
|
|
1663
1446
|
get gridColumnStart() {
|
|
1664
1447
|
return this.style.gridColumnStart;
|
|
1665
1448
|
}
|
|
1449
|
+
[gridColumnStartProperty.setNative](value) {
|
|
1450
|
+
// @ts-ignore
|
|
1451
|
+
const style = this._styleHelper;
|
|
1452
|
+
if (style) {
|
|
1453
|
+
// @ts-ignore
|
|
1454
|
+
style.gridColumnStart = value;
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1666
1457
|
set gridColumnEnd(value) {
|
|
1667
1458
|
this.style.gridColumnEnd = value;
|
|
1668
1459
|
}
|
|
1669
1460
|
get gridColumnEnd() {
|
|
1670
1461
|
return this.style.gridColumnEnd;
|
|
1671
1462
|
}
|
|
1463
|
+
[gridColumnEndProperty.setNative](value) {
|
|
1464
|
+
// @ts-ignore
|
|
1465
|
+
const style = this._styleHelper;
|
|
1466
|
+
if (style) {
|
|
1467
|
+
// @ts-ignore
|
|
1468
|
+
style.gridColumnEnd = value;
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
get gridColumn() {
|
|
1472
|
+
return this.style.gridColumn;
|
|
1473
|
+
}
|
|
1474
|
+
set gridColumn(value) {
|
|
1475
|
+
this.style.gridColumn = value;
|
|
1476
|
+
}
|
|
1477
|
+
[gridColumnProperty.setNative](value) {
|
|
1478
|
+
// @ts-ignore
|
|
1479
|
+
const style = this._styleHelper;
|
|
1480
|
+
if (style) {
|
|
1481
|
+
// @ts-ignore
|
|
1482
|
+
style.gridColumn = value;
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1672
1485
|
set gridRowStart(value) {
|
|
1673
1486
|
this.style.gridRowStart = value;
|
|
1674
1487
|
}
|
|
1675
1488
|
get gridRowStart() {
|
|
1676
1489
|
return this.style.gridRowStart;
|
|
1677
1490
|
}
|
|
1491
|
+
[gridRowStartProperty.setNative](value) {
|
|
1492
|
+
// @ts-ignore
|
|
1493
|
+
const style = this._styleHelper;
|
|
1494
|
+
if (style) {
|
|
1495
|
+
// @ts-ignore
|
|
1496
|
+
style.gridRowStart = value;
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1678
1499
|
set gridRowEnd(value) {
|
|
1679
1500
|
this.style.gridRowEnd = value;
|
|
1680
1501
|
}
|
|
1681
1502
|
get gridRowEnd() {
|
|
1682
1503
|
return this.style.gridRowEnd;
|
|
1683
1504
|
}
|
|
1505
|
+
[gridRowEndProperty.setNative](value) {
|
|
1506
|
+
// @ts-ignore
|
|
1507
|
+
const style = this._styleHelper;
|
|
1508
|
+
if (style) {
|
|
1509
|
+
// @ts-ignore
|
|
1510
|
+
style.gridRowEnd = value;
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
get gridRow() {
|
|
1514
|
+
return this.style.gridRow;
|
|
1515
|
+
}
|
|
1516
|
+
set gridRow(value) {
|
|
1517
|
+
this.style.gridRow = value;
|
|
1518
|
+
}
|
|
1519
|
+
[gridRowProperty.setNative](value) {
|
|
1520
|
+
// @ts-ignore
|
|
1521
|
+
const style = this._styleHelper;
|
|
1522
|
+
if (style) {
|
|
1523
|
+
// @ts-ignore
|
|
1524
|
+
style.gridRow = value;
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1684
1527
|
set gridTemplateRows(value) {
|
|
1685
1528
|
this.style.gridTemplateRows = value;
|
|
1686
1529
|
}
|
|
1687
1530
|
get gridTemplateRows() {
|
|
1688
1531
|
return this.style.gridTemplateRows;
|
|
1689
1532
|
}
|
|
1533
|
+
[gridTemplateRowsProperty.setNative](value) {
|
|
1534
|
+
// @ts-ignore
|
|
1535
|
+
const style = this._styleHelper;
|
|
1536
|
+
if (style) {
|
|
1537
|
+
// @ts-ignore
|
|
1538
|
+
style.gridTemplateRows = value;
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1690
1541
|
set gridTemplateColumns(value) {
|
|
1691
1542
|
this.style.gridTemplateColumns = value;
|
|
1692
1543
|
}
|
|
1693
1544
|
get gridTemplateColumns() {
|
|
1694
1545
|
return this.style.gridTemplateColumns;
|
|
1695
1546
|
}
|
|
1547
|
+
[gridTemplateColumnsProperty.setNative](value) {
|
|
1548
|
+
// @ts-ignore
|
|
1549
|
+
const style = this._styleHelper;
|
|
1550
|
+
if (style) {
|
|
1551
|
+
// @ts-ignore
|
|
1552
|
+
style.gridTemplateColumns = value;
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1696
1555
|
set gridAutoColumns(value) {
|
|
1697
1556
|
this.style.gridAutoColumns = value;
|
|
1698
1557
|
}
|
|
1699
1558
|
get gridAutoColumns() {
|
|
1700
1559
|
return this.style.gridAutoColumns;
|
|
1701
1560
|
}
|
|
1561
|
+
[gridAutoColumnsProperty.setNative](value) {
|
|
1562
|
+
// @ts-ignore
|
|
1563
|
+
const style = this._styleHelper;
|
|
1564
|
+
if (style) {
|
|
1565
|
+
// @ts-ignore
|
|
1566
|
+
style.gridAutoColumns = value;
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1702
1569
|
set gridAutoRows(value) {
|
|
1703
1570
|
this.style.gridAutoRows = value;
|
|
1704
1571
|
}
|
|
1705
1572
|
get gridAutoRows() {
|
|
1706
1573
|
return this.style.gridAutoRows;
|
|
1707
1574
|
}
|
|
1708
|
-
|
|
1575
|
+
[gridAutoRowsProperty.setNative](value) {
|
|
1576
|
+
// @ts-ignore
|
|
1577
|
+
const style = this._styleHelper;
|
|
1578
|
+
if (style) {
|
|
1579
|
+
// @ts-ignore
|
|
1580
|
+
style.gridAutoRows = value;
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
set gridAutoFlow(value) {
|
|
1584
|
+
this.style.gridAutoFlow = value;
|
|
1585
|
+
}
|
|
1586
|
+
get gridAutoFlow() {
|
|
1587
|
+
return this.style.gridAutoFlow;
|
|
1588
|
+
}
|
|
1589
|
+
[gridAutoFlowProperty.setNative](value) {
|
|
1590
|
+
// @ts-ignore
|
|
1591
|
+
const style = this._styleHelper;
|
|
1592
|
+
if (style) {
|
|
1593
|
+
// @ts-ignore
|
|
1594
|
+
style.gridAutoFlow = value;
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
set gridArea(value) {
|
|
1598
|
+
this.style.gridArea = value;
|
|
1599
|
+
}
|
|
1600
|
+
get gridArea() {
|
|
1601
|
+
return this.style.gridArea;
|
|
1602
|
+
}
|
|
1603
|
+
[gridAreaProperty.setNative](value) {
|
|
1604
|
+
// @ts-ignore
|
|
1605
|
+
const style = this._styleHelper;
|
|
1606
|
+
if (style) {
|
|
1607
|
+
// @ts-ignore
|
|
1608
|
+
style.gridArea = value;
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
set gridTemplateAreas(value) {
|
|
1612
|
+
this.style.gridTemplateAreas = value;
|
|
1613
|
+
}
|
|
1614
|
+
get gridTemplateAreas() {
|
|
1615
|
+
return this.style.gridTemplateAreas;
|
|
1616
|
+
}
|
|
1617
|
+
[gridTemplateAreasProperty.setNative](value) {
|
|
1618
|
+
// @ts-ignore
|
|
1619
|
+
const style = this._styleHelper;
|
|
1620
|
+
if (style) {
|
|
1621
|
+
// @ts-ignore
|
|
1622
|
+
style.gridTemplateAreas = value;
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1709
1625
|
[fontSizeProperty.setNative](value) {
|
|
1710
1626
|
// @ts-ignore
|
|
1711
1627
|
if (this._styleHelper) {
|
|
@@ -1727,12 +1643,125 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1727
1643
|
this._styleHelper.fontStyle = value;
|
|
1728
1644
|
}
|
|
1729
1645
|
}
|
|
1646
|
+
set flexFlowProperty(value) {
|
|
1647
|
+
this.style.flexFlow = value;
|
|
1648
|
+
}
|
|
1649
|
+
get flexFlowProperty() {
|
|
1650
|
+
return this.style.flexFlow;
|
|
1651
|
+
}
|
|
1652
|
+
set inset(value) {
|
|
1653
|
+
// @ts-ignore
|
|
1654
|
+
const style = this._styleHelper;
|
|
1655
|
+
if (style) {
|
|
1656
|
+
style.insetCss = value;
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
get inset() {
|
|
1660
|
+
return this.style.inset;
|
|
1661
|
+
}
|
|
1662
|
+
set textOverFlow(value) {
|
|
1663
|
+
this.style.textOverFlow = value;
|
|
1664
|
+
}
|
|
1665
|
+
get textOverFlow() {
|
|
1666
|
+
return this.style.textOverFlow;
|
|
1667
|
+
}
|
|
1668
|
+
[textOverFlowProperty.setNative](value) {
|
|
1669
|
+
// @ts-ignore
|
|
1670
|
+
const style = this._styleHelper;
|
|
1671
|
+
if (style) {
|
|
1672
|
+
// @ts-ignore
|
|
1673
|
+
style.textOverFlow = value;
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
[clearProperty.setNative](value) {
|
|
1677
|
+
// @ts-ignore
|
|
1678
|
+
const style = this._styleHelper;
|
|
1679
|
+
if (style) {
|
|
1680
|
+
// @ts-ignore
|
|
1681
|
+
style.clear = value;
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
[floatProperty.setNative](value) {
|
|
1685
|
+
// @ts-ignore
|
|
1686
|
+
const style = this._styleHelper;
|
|
1687
|
+
if (style) {
|
|
1688
|
+
// @ts-ignore
|
|
1689
|
+
style.float = value;
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
[cornerShapeProperty.setNative](value) {
|
|
1693
|
+
// @ts-ignore
|
|
1694
|
+
const style = this._styleHelper;
|
|
1695
|
+
if (style) {
|
|
1696
|
+
style.cornerShape = value;
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
[boxShadowProperty.setNative](value) {
|
|
1700
|
+
// @ts-ignore
|
|
1701
|
+
const style = this._styleHelper;
|
|
1702
|
+
if (style) {
|
|
1703
|
+
// @ts-ignore
|
|
1704
|
+
style.boxShadow = value;
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
[transformProperty.setNative](value) {
|
|
1708
|
+
// @ts-ignore
|
|
1709
|
+
const style = this._styleHelper;
|
|
1710
|
+
if (style) {
|
|
1711
|
+
// @ts-ignore
|
|
1712
|
+
style.transform = value;
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1730
1715
|
}
|
|
1716
|
+
__decorate([
|
|
1717
|
+
PseudoClassHandler('highlighted', 'pressed', 'active'),
|
|
1718
|
+
__metadata("design:type", Function),
|
|
1719
|
+
__metadata("design:paramtypes", [Boolean]),
|
|
1720
|
+
__metadata("design:returntype", void 0)
|
|
1721
|
+
], ViewBase.prototype, "_handler", null);
|
|
1722
|
+
__decorate([
|
|
1723
|
+
PseudoClassHandler('disabled'),
|
|
1724
|
+
__metadata("design:type", Function),
|
|
1725
|
+
__metadata("design:paramtypes", [Boolean]),
|
|
1726
|
+
__metadata("design:returntype", void 0)
|
|
1727
|
+
], ViewBase.prototype, "_disableHandler", null);
|
|
1728
|
+
__decorate([
|
|
1729
|
+
PseudoClassHandler('focus'),
|
|
1730
|
+
__metadata("design:type", Function),
|
|
1731
|
+
__metadata("design:paramtypes", [Boolean]),
|
|
1732
|
+
__metadata("design:returntype", void 0)
|
|
1733
|
+
], ViewBase.prototype, "_focusHandler", null);
|
|
1734
|
+
__decorate([
|
|
1735
|
+
PseudoClassHandler('blur'),
|
|
1736
|
+
__metadata("design:type", Function),
|
|
1737
|
+
__metadata("design:paramtypes", [Boolean]),
|
|
1738
|
+
__metadata("design:returntype", void 0)
|
|
1739
|
+
], ViewBase.prototype, "_blurHandler", null);
|
|
1740
|
+
textProperty.register(ViewBase);
|
|
1731
1741
|
export class TextBase extends ViewBase {
|
|
1742
|
+
[textWrapProperty.setNative](value) {
|
|
1743
|
+
// @ts-ignore
|
|
1744
|
+
const style = this._styleHelper;
|
|
1745
|
+
if (style) {
|
|
1746
|
+
switch (value) {
|
|
1747
|
+
case 'false':
|
|
1748
|
+
case false:
|
|
1749
|
+
case 'nowrap':
|
|
1750
|
+
style.textWrap = 1 /* MasonTextWrap.NoWrap */;
|
|
1751
|
+
break;
|
|
1752
|
+
case true:
|
|
1753
|
+
case 'true':
|
|
1754
|
+
case 'wrap':
|
|
1755
|
+
style.textWrap = 0 /* MasonTextWrap.Wrap */;
|
|
1756
|
+
break;
|
|
1757
|
+
case 'balance':
|
|
1758
|
+
style.textWrap = 2 /* MasonTextWrap.Balance */;
|
|
1759
|
+
break;
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1732
1763
|
}
|
|
1733
|
-
textContentProperty.register(
|
|
1734
|
-
textWrapProperty.register(Style);
|
|
1735
|
-
textOverFlowProperty.register(Style);
|
|
1764
|
+
textContentProperty.register(ViewBase);
|
|
1736
1765
|
export class ButtonBase extends TextBase {
|
|
1737
1766
|
}
|
|
1738
1767
|
// @ts-ignore
|
|
@@ -1743,351 +1772,166 @@ export const srcProperty = new Property({
|
|
|
1743
1772
|
export class ImageBase extends ViewBase {
|
|
1744
1773
|
}
|
|
1745
1774
|
srcProperty.register(ImageBase);
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
// flexDirectionProperty.register(Style);
|
|
1751
|
-
// flexWrapProperty.register(Style);
|
|
1752
|
-
// flexGrowProperty.register(Style);
|
|
1753
|
-
flexShrinkProperty.register(Style);
|
|
1754
|
-
// revert valueConverter if causing issues with core components
|
|
1755
|
-
fontSizeProperty.overrideHandlers({
|
|
1756
|
-
name: 'fontSize',
|
|
1757
|
-
cssName: 'font-size',
|
|
1758
|
-
valueConverter: function (value) {
|
|
1759
|
-
return value;
|
|
1760
|
-
},
|
|
1761
|
-
valueChanged(target, oldValue, newValue) {
|
|
1762
|
-
const view = getViewStyle(target.viewRef);
|
|
1763
|
-
if (view) {
|
|
1764
|
-
if (newValue) {
|
|
1765
|
-
if (typeof newValue === 'string') {
|
|
1766
|
-
// @ts-ignore
|
|
1767
|
-
if (newValue.indexOf('%') !== -1) {
|
|
1768
|
-
view.fontSize = {
|
|
1769
|
-
value: parseFloat(newValue) / 100,
|
|
1770
|
-
unit: '%',
|
|
1771
|
-
};
|
|
1772
|
-
// @ts-ignore
|
|
1773
|
-
}
|
|
1774
|
-
else if (newValue.indexOf('dip') !== -1) {
|
|
1775
|
-
view.fontSize = parseFloat(newValue);
|
|
1776
|
-
// @ts-ignore
|
|
1777
|
-
}
|
|
1778
|
-
else if (newValue.indexOf('px') !== -1) {
|
|
1779
|
-
view.fontSize = {
|
|
1780
|
-
value: parseFloat(newValue),
|
|
1781
|
-
unit: 'px',
|
|
1782
|
-
};
|
|
1783
|
-
}
|
|
1784
|
-
else {
|
|
1785
|
-
view.fontSize = parseFloat(newValue);
|
|
1786
|
-
}
|
|
1787
|
-
}
|
|
1788
|
-
else {
|
|
1789
|
-
view.fontSize = newValue;
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
else {
|
|
1793
|
-
// Revert to old value if newValue is invalid
|
|
1794
|
-
// @ts-ignore
|
|
1795
|
-
view.view.style.fontSize = oldValue;
|
|
1796
|
-
}
|
|
1775
|
+
export class Event {
|
|
1776
|
+
get bubbles() {
|
|
1777
|
+
if (__ANDROID__) {
|
|
1778
|
+
return this[native_]?.getBubbles();
|
|
1797
1779
|
}
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
marginLeftProperty.overrideHandlers({
|
|
1801
|
-
name: 'marginLeft',
|
|
1802
|
-
cssName: 'margin-left',
|
|
1803
|
-
valueChanged(target, oldValue, newValue) {
|
|
1804
|
-
const view = getViewStyle(target.viewRef);
|
|
1805
|
-
if (view) {
|
|
1806
|
-
if (newValue) {
|
|
1807
|
-
view.marginLeft = newValue;
|
|
1808
|
-
}
|
|
1809
|
-
else {
|
|
1810
|
-
// Revert to old value if newValue is invalid
|
|
1811
|
-
// @ts-ignore
|
|
1812
|
-
view.view.style.marginLeft = oldValue;
|
|
1813
|
-
}
|
|
1780
|
+
if (__APPLE__) {
|
|
1781
|
+
return this[native_]?.bubbles;
|
|
1814
1782
|
}
|
|
1815
|
-
|
|
1816
|
-
}
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
valueChanged(target, oldValue, newValue) {
|
|
1821
|
-
const view = getViewStyle(target.viewRef);
|
|
1822
|
-
if (view) {
|
|
1823
|
-
if (newValue) {
|
|
1824
|
-
view.marginTop = newValue;
|
|
1825
|
-
}
|
|
1826
|
-
else {
|
|
1827
|
-
// Revert to old value if newValue is invalid
|
|
1828
|
-
// @ts-ignore
|
|
1829
|
-
view.view.style.marginTop = oldValue;
|
|
1830
|
-
}
|
|
1783
|
+
return false;
|
|
1784
|
+
}
|
|
1785
|
+
get cancelable() {
|
|
1786
|
+
if (__ANDROID__) {
|
|
1787
|
+
return this[native_]?.getCancelable();
|
|
1831
1788
|
}
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
marginRightProperty.overrideHandlers({
|
|
1835
|
-
name: 'marginRight',
|
|
1836
|
-
cssName: 'margin-right',
|
|
1837
|
-
valueChanged(target, oldValue, newValue) {
|
|
1838
|
-
const view = getViewStyle(target.viewRef);
|
|
1839
|
-
if (view) {
|
|
1840
|
-
if (newValue) {
|
|
1841
|
-
view.marginRight = newValue;
|
|
1842
|
-
}
|
|
1843
|
-
else {
|
|
1844
|
-
// Revert to old value if newValue is invalid
|
|
1845
|
-
// @ts-ignore
|
|
1846
|
-
view.view.style.marginRight = oldValue;
|
|
1847
|
-
}
|
|
1789
|
+
if (__APPLE__) {
|
|
1790
|
+
return this[native_]?.cancelable;
|
|
1848
1791
|
}
|
|
1849
|
-
|
|
1850
|
-
}
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
valueChanged(target, oldValue, newValue) {
|
|
1855
|
-
const view = getViewStyle(target.viewRef);
|
|
1856
|
-
if (view) {
|
|
1857
|
-
if (newValue) {
|
|
1858
|
-
view.marginBottom = newValue;
|
|
1859
|
-
}
|
|
1860
|
-
else {
|
|
1861
|
-
// Revert to old value if newValue is invalid
|
|
1862
|
-
// @ts-ignore
|
|
1863
|
-
view.view.style.marginBottom = oldValue;
|
|
1864
|
-
}
|
|
1792
|
+
return false;
|
|
1793
|
+
}
|
|
1794
|
+
get isComposing() {
|
|
1795
|
+
if (__ANDROID__) {
|
|
1796
|
+
return this[native_]?.getIsComposing();
|
|
1865
1797
|
}
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
paddingLeftProperty.overrideHandlers({
|
|
1869
|
-
name: 'paddingLeft',
|
|
1870
|
-
cssName: 'padding-left',
|
|
1871
|
-
valueChanged(target, oldValue, newValue) {
|
|
1872
|
-
const view = getViewStyle(target.viewRef);
|
|
1873
|
-
if (view) {
|
|
1874
|
-
if (newValue) {
|
|
1875
|
-
view.paddingLeft = newValue;
|
|
1876
|
-
}
|
|
1877
|
-
else {
|
|
1878
|
-
// Revert to old value if newValue is invalid
|
|
1879
|
-
// @ts-ignore
|
|
1880
|
-
view.view.style.paddingLeft = oldValue;
|
|
1881
|
-
}
|
|
1798
|
+
if (__APPLE__) {
|
|
1799
|
+
return this[native_]?.isComposing;
|
|
1882
1800
|
}
|
|
1883
|
-
|
|
1884
|
-
}
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
valueChanged(target, oldValue, newValue) {
|
|
1889
|
-
const view = getViewStyle(target.viewRef);
|
|
1890
|
-
if (view) {
|
|
1891
|
-
if (newValue) {
|
|
1892
|
-
view.paddingTop = newValue;
|
|
1893
|
-
}
|
|
1894
|
-
else {
|
|
1895
|
-
// Revert to old value if newValue is invalid
|
|
1896
|
-
// @ts-ignore
|
|
1897
|
-
view.view.style.paddingTop = oldValue;
|
|
1898
|
-
}
|
|
1801
|
+
return false;
|
|
1802
|
+
}
|
|
1803
|
+
get timeStamp() {
|
|
1804
|
+
if (__ANDROID__) {
|
|
1805
|
+
return this[native_]?.getTimeStamp();
|
|
1899
1806
|
}
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
paddingRightProperty.overrideHandlers({
|
|
1903
|
-
name: 'paddingRight',
|
|
1904
|
-
cssName: 'padding-right',
|
|
1905
|
-
valueChanged(target, oldValue, newValue) {
|
|
1906
|
-
const view = getViewStyle(target.viewRef);
|
|
1907
|
-
if (view) {
|
|
1908
|
-
if (newValue) {
|
|
1909
|
-
view.paddingRight = newValue;
|
|
1910
|
-
}
|
|
1911
|
-
else {
|
|
1912
|
-
// Revert to old value if newValue is invalid
|
|
1913
|
-
// @ts-ignore
|
|
1914
|
-
view.view.style.paddingRight = oldValue;
|
|
1915
|
-
}
|
|
1807
|
+
if (__APPLE__) {
|
|
1808
|
+
return this[native_]?.timeStamp;
|
|
1916
1809
|
}
|
|
1917
|
-
|
|
1918
|
-
}
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
valueChanged(target, oldValue, newValue) {
|
|
1923
|
-
const view = getViewStyle(target.viewRef);
|
|
1924
|
-
if (view) {
|
|
1925
|
-
if (newValue) {
|
|
1926
|
-
view.paddingBottom = newValue;
|
|
1927
|
-
}
|
|
1928
|
-
else {
|
|
1929
|
-
// Revert to old value if newValue is invalid
|
|
1930
|
-
// @ts-ignore
|
|
1931
|
-
view.view.style.paddingBottom = oldValue;
|
|
1932
|
-
}
|
|
1810
|
+
return 0;
|
|
1811
|
+
}
|
|
1812
|
+
get defaultPrevented() {
|
|
1813
|
+
if (__ANDROID__) {
|
|
1814
|
+
return this[native_]?.getDefaultPrevented();
|
|
1933
1815
|
}
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
flexDirectionProperty.overrideHandlers({
|
|
1937
|
-
name: 'flexDirection',
|
|
1938
|
-
cssName: 'flex-direction',
|
|
1939
|
-
valueChanged(target, oldValue, newValue) {
|
|
1940
|
-
const view = getViewStyle(target.viewRef);
|
|
1941
|
-
if (view) {
|
|
1942
|
-
if (newValue) {
|
|
1943
|
-
view.flexDirection = newValue;
|
|
1944
|
-
}
|
|
1945
|
-
else {
|
|
1946
|
-
// Revert to old value if newValue is invalid
|
|
1947
|
-
// @ts-ignore
|
|
1948
|
-
view.view.style.flexDirection = oldValue;
|
|
1949
|
-
}
|
|
1816
|
+
if (__APPLE__) {
|
|
1817
|
+
return this[native_]?.defaultPrevented;
|
|
1950
1818
|
}
|
|
1951
|
-
|
|
1952
|
-
}
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
valueChanged(target, oldValue, newValue) {
|
|
1957
|
-
const view = getViewStyle(target.viewRef);
|
|
1958
|
-
if (view) {
|
|
1959
|
-
if (newValue) {
|
|
1960
|
-
view.flexWrap = newValue;
|
|
1961
|
-
}
|
|
1962
|
-
else {
|
|
1963
|
-
// Revert to old value if newValue is invalid
|
|
1964
|
-
// @ts-ignore
|
|
1965
|
-
view.view.style.flexWrap = oldValue;
|
|
1966
|
-
}
|
|
1819
|
+
return false;
|
|
1820
|
+
}
|
|
1821
|
+
get propagationStopped() {
|
|
1822
|
+
if (__ANDROID__) {
|
|
1823
|
+
return this[native_]?.getPropagationStopped();
|
|
1967
1824
|
}
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1825
|
+
if (__APPLE__) {
|
|
1826
|
+
return this[native_]?.propagationStopped;
|
|
1827
|
+
}
|
|
1828
|
+
return false;
|
|
1829
|
+
}
|
|
1830
|
+
get immediatePropagationStopped() {
|
|
1831
|
+
if (__ANDROID__) {
|
|
1832
|
+
return this[native_]?.getImmediatePropagationStopped();
|
|
1833
|
+
}
|
|
1834
|
+
if (__APPLE__) {
|
|
1835
|
+
return this[native_]?.immediatePropagationStopped;
|
|
1836
|
+
}
|
|
1837
|
+
return false;
|
|
1838
|
+
}
|
|
1839
|
+
get currentTarget() {
|
|
1840
|
+
if (__ANDROID__) {
|
|
1841
|
+
return this[native_]?.getCurrentTarget();
|
|
1842
|
+
}
|
|
1843
|
+
if (__APPLE__) {
|
|
1844
|
+
return this[native_]?.currentTarget;
|
|
1845
|
+
}
|
|
1846
|
+
return false;
|
|
1847
|
+
}
|
|
1848
|
+
stopImmediatePropagation() {
|
|
1849
|
+
if (__ANDROID__) {
|
|
1850
|
+
return this[native_]?.stopImmediatePropagation();
|
|
1851
|
+
}
|
|
1852
|
+
if (__APPLE__) {
|
|
1853
|
+
return this[native_]?.stopImmediatePropagation();
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
stopPropagation() {
|
|
1857
|
+
if (__ANDROID__) {
|
|
1858
|
+
return this[native_]?.stopPropagation();
|
|
1859
|
+
}
|
|
1860
|
+
if (__APPLE__) {
|
|
1861
|
+
return this[native_]?.stopPropagation();
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
preventDefault() {
|
|
1865
|
+
if (__ANDROID__) {
|
|
1866
|
+
return this[native_]?.preventDefault();
|
|
1867
|
+
}
|
|
1868
|
+
if (__APPLE__) {
|
|
1869
|
+
return this[native_]?.preventDefault();
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
get type() {
|
|
1873
|
+
if (__ANDROID__) {
|
|
1874
|
+
return this[native_]?.getType();
|
|
1875
|
+
}
|
|
1876
|
+
return this[native_]?.type;
|
|
1877
|
+
}
|
|
1878
|
+
// NS's nativeHandler wrapper assigns event.type; allow it without crashing.
|
|
1879
|
+
set type(_) { }
|
|
1880
|
+
get target() {
|
|
1881
|
+
return this['_target'];
|
|
1882
|
+
}
|
|
1883
|
+
// undom-ng's dispatchEvent and runEventHandlers stamp these on the event object;
|
|
1884
|
+
// allow the assignments without throwing in strict-mode ES modules.
|
|
1885
|
+
set target(_) { }
|
|
1886
|
+
set currentTarget(_) { }
|
|
1887
|
+
set bubbles(_) { }
|
|
1888
|
+
set cancelable(_) { }
|
|
1889
|
+
set timeStamp(_) { }
|
|
1890
|
+
set defaultPrevented(_) { }
|
|
1891
|
+
}
|
|
1892
|
+
export class InputEvent extends Event {
|
|
1893
|
+
get data() {
|
|
1894
|
+
if (__ANDROID__) {
|
|
1895
|
+
if (this[native_] instanceof org.nativescript.mason.masonkit.events.FileInputEvent) {
|
|
1896
|
+
const data = this[native_]?.getRawData();
|
|
1897
|
+
if (!data) {
|
|
1898
|
+
return null;
|
|
1899
|
+
}
|
|
1900
|
+
const ret = [];
|
|
1901
|
+
const size = data.size();
|
|
1902
|
+
for (let i = 0; i < size; i++) {
|
|
1903
|
+
ret.push(data.get(i).toString());
|
|
1904
|
+
}
|
|
1905
|
+
return ret;
|
|
1978
1906
|
}
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1907
|
+
return this[native_]?.getData();
|
|
1908
|
+
}
|
|
1909
|
+
if (__APPLE__) {
|
|
1910
|
+
if (this[native_] instanceof MasonFileInputEvent) {
|
|
1911
|
+
const data = this[native_]?.rawData;
|
|
1912
|
+
if (!data) {
|
|
1913
|
+
return null;
|
|
1914
|
+
}
|
|
1915
|
+
const ret = [];
|
|
1916
|
+
const size = data.count;
|
|
1917
|
+
for (let i = 0; i < size; i++) {
|
|
1918
|
+
const item = data.objectAtIndex(i);
|
|
1919
|
+
ret.push(item.absoluteString);
|
|
1920
|
+
}
|
|
1921
|
+
return ret;
|
|
1983
1922
|
}
|
|
1923
|
+
return this[native_]?.data;
|
|
1984
1924
|
}
|
|
1985
|
-
|
|
1986
|
-
}
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
positionProperty.register(Style);
|
|
1996
|
-
leftProperty.register(Style);
|
|
1997
|
-
rightProperty.register(Style);
|
|
1998
|
-
topProperty.register(Style);
|
|
1999
|
-
bottomProperty.register(Style);
|
|
2000
|
-
flexBasisProperty.register(Style);
|
|
2001
|
-
rowGapProperty.register(Style);
|
|
2002
|
-
columnGapProperty.register(Style);
|
|
2003
|
-
gridRowGapProperty.register(Style);
|
|
2004
|
-
gridColumnGapProperty.register(Style);
|
|
2005
|
-
gapProperty.register(Style);
|
|
2006
|
-
gridGapProperty.register(Style);
|
|
2007
|
-
aspectRatioProperty.register(Style);
|
|
2008
|
-
alignContentProperty.register(Style);
|
|
2009
|
-
justifyItemsProperty.register(Style);
|
|
2010
|
-
justifySelfProperty.register(Style);
|
|
2011
|
-
gridAutoRowsProperty.register(Style);
|
|
2012
|
-
gridAutoColumnsProperty.register(Style);
|
|
2013
|
-
gridAutoFlowProperty.register(Style);
|
|
2014
|
-
gridAreaProperty.register(Style);
|
|
2015
|
-
gridColumnProperty.register(Style);
|
|
2016
|
-
gridColumnStartProperty.register(Style);
|
|
2017
|
-
gridColumnEndProperty.register(Style);
|
|
2018
|
-
gridRowProperty.register(Style);
|
|
2019
|
-
gridRowStartProperty.register(Style);
|
|
2020
|
-
gridRowEndProperty.register(Style);
|
|
2021
|
-
gridTemplateRowsProperty.register(Style);
|
|
2022
|
-
gridTemplateColumnsProperty.register(Style);
|
|
2023
|
-
gridTemplateAreasProperty.register(Style);
|
|
2024
|
-
overflowProperty.register(Style);
|
|
2025
|
-
overflowXProperty.register(Style);
|
|
2026
|
-
overflowYProperty.register(Style);
|
|
2027
|
-
scrollBarWidthProperty.register(Style);
|
|
2028
|
-
flexFlowProperty.register(Style);
|
|
2029
|
-
flexProperty.register(Style);
|
|
2030
|
-
function parseShorthandPositioning(value) {
|
|
2031
|
-
const arr = value.split(/[ ,]+/);
|
|
2032
|
-
let top;
|
|
2033
|
-
let right;
|
|
2034
|
-
let bottom;
|
|
2035
|
-
let left;
|
|
2036
|
-
if (arr.length === 1) {
|
|
2037
|
-
top = arr[0];
|
|
2038
|
-
right = arr[0];
|
|
2039
|
-
bottom = arr[0];
|
|
2040
|
-
left = arr[0];
|
|
2041
|
-
}
|
|
2042
|
-
else if (arr.length === 2) {
|
|
2043
|
-
top = arr[0];
|
|
2044
|
-
bottom = arr[0];
|
|
2045
|
-
right = arr[1];
|
|
2046
|
-
left = arr[1];
|
|
2047
|
-
}
|
|
2048
|
-
else if (arr.length === 3) {
|
|
2049
|
-
top = arr[0];
|
|
2050
|
-
right = arr[1];
|
|
2051
|
-
left = arr[1];
|
|
2052
|
-
bottom = arr[2];
|
|
2053
|
-
}
|
|
2054
|
-
else if (arr.length === 4) {
|
|
2055
|
-
top = arr[0];
|
|
2056
|
-
right = arr[1];
|
|
2057
|
-
bottom = arr[2];
|
|
2058
|
-
left = arr[3];
|
|
2059
|
-
}
|
|
2060
|
-
else {
|
|
2061
|
-
throw new Error('Expected 1, 2, 3 or 4 parameters. Actual: ' + value);
|
|
2062
|
-
}
|
|
2063
|
-
return {
|
|
2064
|
-
top: top,
|
|
2065
|
-
right: right,
|
|
2066
|
-
bottom: bottom,
|
|
2067
|
-
left: left,
|
|
2068
|
-
};
|
|
2069
|
-
}
|
|
2070
|
-
function convertToPaddings(value) {
|
|
2071
|
-
if (typeof value === 'string' && value !== 'auto') {
|
|
2072
|
-
const thickness = parseShorthandPositioning(value);
|
|
2073
|
-
return [
|
|
2074
|
-
[paddingTopProperty, CoreLength.parse(thickness.top)],
|
|
2075
|
-
[paddingRightProperty, CoreLength.parse(thickness.right)],
|
|
2076
|
-
[paddingBottomProperty, CoreLength.parse(thickness.bottom)],
|
|
2077
|
-
[paddingLeftProperty, CoreLength.parse(thickness.left)],
|
|
2078
|
-
];
|
|
2079
|
-
}
|
|
2080
|
-
else {
|
|
2081
|
-
return [
|
|
2082
|
-
[paddingTopProperty, value],
|
|
2083
|
-
[paddingRightProperty, value],
|
|
2084
|
-
[paddingBottomProperty, value],
|
|
2085
|
-
[paddingLeftProperty, value],
|
|
2086
|
-
];
|
|
1925
|
+
return false;
|
|
1926
|
+
}
|
|
1927
|
+
get inputType() {
|
|
1928
|
+
if (__ANDROID__) {
|
|
1929
|
+
return this[native_]?.getInputType();
|
|
1930
|
+
}
|
|
1931
|
+
if (__APPLE__) {
|
|
1932
|
+
return this[native_]?.inputType;
|
|
1933
|
+
}
|
|
1934
|
+
return false;
|
|
2087
1935
|
}
|
|
2088
1936
|
}
|
|
2089
|
-
paddingLeftProperty.register(Style);
|
|
2090
|
-
paddingRightProperty.register(Style);
|
|
2091
|
-
paddingTopProperty.register(Style);
|
|
2092
|
-
paddingBottomProperty.register(Style);
|
|
2093
1937
|
//# sourceMappingURL=common.js.map
|