@triniwiz/nativescript-masonkit 1.0.0-alpha.2 → 1.0.0-alpha.21
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/common.d.ts +67 -30
- package/common.js +609 -1094
- package/common.js.map +1 -1
- package/helpers.d.ts +116 -94
- package/helpers.js +471 -2538
- package/helpers.js.map +1 -1
- package/index.android.d.ts +53 -18
- package/index.android.js +190 -61
- package/index.android.js.map +1 -1
- package/index.d.ts +161 -17
- package/index.ios.d.ts +69 -19
- package/index.ios.js +438 -93
- package/index.ios.js.map +1 -1
- package/package.json +4 -4
- package/platforms/android/include.gradle +22 -1
- package/platforms/android/masonkit-release.aar +0 -0
- package/platforms/ios/Mason.xcframework/Info.plist +9 -5
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason-Swift.h +495 -313
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason.h +11 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/mason_native.h +215 -818
- 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 +34507 -20240
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.private.swiftinterface +660 -310
- 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 +660 -310
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/module.modulemap +1 -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 +2421 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason-Swift.h +1053 -689
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason.h +11 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/mason_native.h +215 -818
- 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 +34507 -20240
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +660 -310
- 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 +660 -310
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +34507 -20240
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +660 -310
- 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 +660 -310
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/module.modulemap +1 -1
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/_CodeSignature/CodeResources +33 -97
- 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 +2421 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +2357 -0
- package/style.d.ts +166 -0
- package/style.js +1705 -0
- package/style.js.map +1 -0
- package/web.d.ts +55 -0
- package/web.js +189 -0
- package/web.js.map +1 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/PrivateHeaders/mason_native.h +0 -676
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/PrivateHeaders/mason_native.h +0 -676
- package/platforms/ios/Podfile +0 -1
- package/platforms/ios/build.xcconfig +0 -2
- package/platforms/ios/src/JSIModule.h +0 -217
- package/platforms/ios/src/JSIModule.mm +0 -2788
- package/platforms/ios/src/include/mason_native.h +0 -945
- package/platforms/ios/src/module.modulemap +0 -4
package/common.js
CHANGED
|
@@ -1,533 +1,241 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
-
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
3
|
+
import { CssProperty, CustomLayoutView, Length as NSLength, ShorthandProperty, Style, View as NSView, getViewById, unsetValue, Property, widthProperty, heightProperty, CoreTypes, Trace, Length as CoreLength, PercentLength as CorePercentLength, marginLeftProperty, marginRightProperty, marginTopProperty, marginBottomProperty, minWidthProperty, minHeightProperty } from '@nativescript/core';
|
|
4
|
+
import { _forceStyleUpdate, _parseGridTemplates, _setAlignContent, _setAlignItems, _setAlignSelf, _setBottom, _setColumnGap, _setDisplay, _setFlexBasis, _setFlexDirection, _setFlexGrow, _setFlexShrink, _setFlexWrap, _setGridColumnEnd, _setGridColumnStart, _setGridRowEnd, _setGridRowStart, _setGridTemplateColumns, _setGridTemplateRows, _setHeight, _setJustifyContent, _setJustifyItems, _setJustifySelf, _setLeft, _setMarginBottom, _setMarginLeft, _setMarginRight, _setMarginTop, _setMinHeight, _setMinWidth, _setOverflowX, _setOverflowY, _setPaddingBottom, _setPaddingLeft, _setPaddingRight, _setPaddingTop, _setPosition, _setRight, _setRowGap, _setScrollbarWidth, _setTop, _setWidth } from './helpers';
|
|
5
|
+
import { flexDirectionProperty, flexGrowProperty, flexWrapProperty } from '@nativescript/core/ui/layouts/flexbox-layout';
|
|
6
|
+
export const native_ = Symbol('[[native]]');
|
|
7
|
+
export const style_ = Symbol('[[style]]');
|
|
8
|
+
export const scrollBarWidthProperty = new CssProperty({
|
|
9
|
+
name: 'scrollBarWidth',
|
|
10
|
+
cssName: 'scroll-bar-width',
|
|
11
|
+
defaultValue: 0,
|
|
12
|
+
valueConverter: parseFloat,
|
|
13
|
+
});
|
|
14
|
+
function overflowConverter(value) {
|
|
15
|
+
if (typeof value === 'number') {
|
|
16
|
+
switch (value) {
|
|
17
|
+
case 0:
|
|
18
|
+
return 'visible';
|
|
19
|
+
case 1:
|
|
20
|
+
return 'clip';
|
|
21
|
+
case 2:
|
|
22
|
+
return 'hidden';
|
|
23
|
+
case 3:
|
|
24
|
+
return 'scroll';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
switch (value) {
|
|
28
|
+
case 'visible':
|
|
29
|
+
case 'hidden':
|
|
30
|
+
case 'clip':
|
|
31
|
+
case 'scroll':
|
|
32
|
+
return value;
|
|
33
|
+
default:
|
|
34
|
+
return 'visible';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function masonLengthParse(value) {
|
|
38
|
+
try {
|
|
39
|
+
return CoreLength.parse(value);
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function masonLengthPercentParse(value) {
|
|
46
|
+
try {
|
|
47
|
+
return CorePercentLength.parse(value);
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const overFlow = /^\s*(visible|hidden|clip|scroll|auto)(?:\s+(visible|hidden|clip|scroll|auto))?\s*$/;
|
|
54
|
+
export const overflowProperty = new ShorthandProperty({
|
|
55
|
+
name: 'overflow',
|
|
56
|
+
cssName: 'overflow',
|
|
57
|
+
getter: function () {
|
|
58
|
+
if (this.overflowX === this.overflowY) {
|
|
59
|
+
return this.overflowX;
|
|
60
|
+
}
|
|
61
|
+
return `${this.overflowX} ${this.overflowY}`;
|
|
62
|
+
},
|
|
63
|
+
converter(value) {
|
|
64
|
+
const properties = [];
|
|
65
|
+
if (typeof value === 'string') {
|
|
66
|
+
const values = value.match(overFlow);
|
|
67
|
+
const length = values.length;
|
|
68
|
+
if (length === 0) {
|
|
69
|
+
return properties;
|
|
69
70
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
if (length === 1) {
|
|
72
|
+
const xy = values[0];
|
|
73
|
+
properties.push([overflowXProperty, xy]);
|
|
74
|
+
properties.push([overflowYProperty, xy]);
|
|
73
75
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
if (options.overrideIfExists) {
|
|
81
|
-
if (this[options.overrideIfExists]) {
|
|
82
|
-
return baseCtor.prototype[symbol].apply(this, args);
|
|
83
|
-
}
|
|
84
|
-
return oldImpl.apply(this, args);
|
|
85
|
-
}
|
|
86
|
-
else if (options.after) {
|
|
87
|
-
oldImpl.apply(this, args);
|
|
88
|
-
return baseCtor.prototype[symbol].apply(this, args);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
baseCtor.prototype[symbol].apply(this, args);
|
|
92
|
-
return oldImpl.apply(this, args);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
baseCtor.prototype[symbol].apply(this, args);
|
|
97
|
-
return oldImpl.apply(this, args);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
76
|
+
if (length > 1) {
|
|
77
|
+
const x = values[0];
|
|
78
|
+
const y = values[1];
|
|
79
|
+
properties.push([overflowXProperty, x]);
|
|
80
|
+
properties.push([overflowYProperty, y]);
|
|
100
81
|
}
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
let mixinInstalled = false;
|
|
105
|
-
export function overrideViewBase() {
|
|
106
|
-
const NSView = require('@nativescript/core').View;
|
|
107
|
-
class ViewOverride extends View {
|
|
108
|
-
constructor() {
|
|
109
|
-
super(...arguments);
|
|
110
|
-
this._isMasonView = false;
|
|
111
|
-
this._isMasonChild = false;
|
|
112
|
-
}
|
|
113
|
-
get _isMasonViewOrChild() {
|
|
114
|
-
return this._isMasonView || this._isMasonChild;
|
|
115
|
-
}
|
|
116
|
-
/* Short Props */
|
|
117
|
-
set gridRowGap(value) {
|
|
118
|
-
this.style.gridRowGap = value;
|
|
119
|
-
}
|
|
120
|
-
get gridRowGap() {
|
|
121
|
-
return this.style.gridRowGap;
|
|
122
|
-
}
|
|
123
|
-
set gridGap(value) {
|
|
124
|
-
this.style.gridGap = value;
|
|
125
|
-
}
|
|
126
|
-
get gridGap() {
|
|
127
|
-
return this.style.gridGap;
|
|
128
|
-
}
|
|
129
|
-
set gap(value) {
|
|
130
|
-
this.style.gap = value;
|
|
131
|
-
}
|
|
132
|
-
get gap() {
|
|
133
|
-
return this.style.gap;
|
|
134
|
-
}
|
|
135
|
-
set gridArea(value) {
|
|
136
|
-
this.style.gridArea = value;
|
|
137
|
-
}
|
|
138
|
-
get gridArea() {
|
|
139
|
-
return this.style.gridArea;
|
|
140
|
-
}
|
|
141
|
-
set gridColumn(value) {
|
|
142
|
-
this.style.gridColumn = value;
|
|
143
|
-
}
|
|
144
|
-
get gridColumn() {
|
|
145
|
-
return this.style.gridColumn;
|
|
146
|
-
}
|
|
147
|
-
set gridRow(value) {
|
|
148
|
-
this.style.gridRow = value;
|
|
149
|
-
}
|
|
150
|
-
get gridRow() {
|
|
151
|
-
return this.style.gridColumn;
|
|
152
|
-
}
|
|
153
|
-
/* Short Props */
|
|
154
|
-
get display() {
|
|
155
|
-
return _getDisplay(this);
|
|
156
|
-
}
|
|
157
|
-
set display(value) {
|
|
158
|
-
this.style.display = value;
|
|
159
|
-
}
|
|
160
|
-
[displayProperty.setNative](value) {
|
|
161
|
-
_setDisplay(value, this);
|
|
162
|
-
}
|
|
163
|
-
set position(value) {
|
|
164
|
-
this.style.position = value;
|
|
165
|
-
}
|
|
166
|
-
get position() {
|
|
167
|
-
return _getPosition(this);
|
|
168
|
-
}
|
|
169
|
-
[positionProperty.setNative](value) {
|
|
170
|
-
_setPosition(value, this);
|
|
171
|
-
}
|
|
172
|
-
set flexDirection(value) {
|
|
173
|
-
this.style.flexDirection = value;
|
|
174
|
-
}
|
|
175
|
-
get flexDirection() {
|
|
176
|
-
return _getFlexDirection(this);
|
|
177
|
-
}
|
|
178
|
-
[flexDirectionProperty.setNative](value) {
|
|
179
|
-
_setFlexDirection(value, this);
|
|
180
|
-
}
|
|
181
|
-
set flexWrap(value) {
|
|
182
|
-
this.style.flexWrap = value;
|
|
183
|
-
}
|
|
184
|
-
[flexWrapProperty.setNative](value) {
|
|
185
|
-
_setFlexWrap(value, this);
|
|
186
|
-
}
|
|
187
|
-
get flexWrap() {
|
|
188
|
-
return _getFlexWrap(this);
|
|
189
|
-
}
|
|
190
|
-
set alignItems(value) {
|
|
191
|
-
this.style.alignItems = value;
|
|
192
|
-
}
|
|
193
|
-
get alignItems() {
|
|
194
|
-
return _getAlignItems(this);
|
|
195
|
-
}
|
|
196
|
-
[alignItemsProperty.setNative](value) {
|
|
197
|
-
_setAlignItems(value, this);
|
|
198
|
-
}
|
|
199
|
-
//@ts-ignore
|
|
200
|
-
set alignSelf(value) {
|
|
201
|
-
this.style.alignSelf = value;
|
|
202
|
-
}
|
|
203
|
-
//@ts-ignore
|
|
204
|
-
get alignSelf() {
|
|
205
|
-
return _getAlignSelf(this);
|
|
206
|
-
}
|
|
207
|
-
[alignSelfProperty.setNative](value) {
|
|
208
|
-
_setAlignSelf(value, this);
|
|
209
|
-
}
|
|
210
|
-
set alignContent(value) {
|
|
211
|
-
this.style.alignContent = value;
|
|
212
|
-
}
|
|
213
|
-
[alignContentProperty.setNative](value) {
|
|
214
|
-
_setAlignContent(value, this);
|
|
215
|
-
}
|
|
216
|
-
get alignContent() {
|
|
217
|
-
return _getAlignContent(this);
|
|
218
|
-
}
|
|
219
|
-
set justifyItems(value) {
|
|
220
|
-
this.style.justifyItems = value;
|
|
221
|
-
}
|
|
222
|
-
[justifyItemsProperty.setNative](value) {
|
|
223
|
-
_setJustifyItems(value, this);
|
|
224
|
-
}
|
|
225
|
-
get justifyItems() {
|
|
226
|
-
return _getJustifyItems(this);
|
|
227
|
-
}
|
|
228
|
-
set justifySelf(value) {
|
|
229
|
-
this.style.justifySelf = value;
|
|
230
|
-
}
|
|
231
|
-
[justifySelfProperty.setNative](value) {
|
|
232
|
-
_setJustifySelf(value, this);
|
|
233
|
-
}
|
|
234
|
-
get justifySelf() {
|
|
235
|
-
return _getJustifySelf(this);
|
|
236
|
-
}
|
|
237
|
-
set justifyContent(value) {
|
|
238
|
-
this.style.justifyContent = value;
|
|
239
|
-
}
|
|
240
|
-
[justifyContentProperty.setNative](value) {
|
|
241
|
-
_setJustifyContent(value, this);
|
|
242
|
-
}
|
|
243
|
-
get justifyContent() {
|
|
244
|
-
return _getJustifyContent(this);
|
|
245
|
-
}
|
|
246
|
-
//@ts-ignore
|
|
247
|
-
set left(value) {
|
|
248
|
-
this.style.left = value;
|
|
249
|
-
}
|
|
250
|
-
get left() {
|
|
251
|
-
return this.style.left;
|
|
252
|
-
}
|
|
253
|
-
[leftProperty.setNative](value) {
|
|
254
|
-
_setLeft(value, this);
|
|
255
|
-
}
|
|
256
|
-
//@ts-ignore
|
|
257
|
-
set right(value) {
|
|
258
|
-
this.style.right = value;
|
|
259
|
-
}
|
|
260
|
-
get right() {
|
|
261
|
-
return this.style.right;
|
|
262
|
-
}
|
|
263
|
-
[rightProperty.setNative](value) {
|
|
264
|
-
_setRight(value, this);
|
|
265
|
-
}
|
|
266
|
-
//@ts-ignore
|
|
267
|
-
set top(value) {
|
|
268
|
-
this.style.top = value;
|
|
269
|
-
}
|
|
270
|
-
get top() {
|
|
271
|
-
return this.style.top;
|
|
272
|
-
}
|
|
273
|
-
[topProperty.setNative](value) {
|
|
274
|
-
_setTop(value, this);
|
|
275
|
-
}
|
|
276
|
-
//@ts-ignore
|
|
277
|
-
set bottom(value) {
|
|
278
|
-
this.style.bottom = value;
|
|
279
|
-
}
|
|
280
|
-
get bottom() {
|
|
281
|
-
return this.style.bottom;
|
|
282
|
-
}
|
|
283
|
-
[bottomProperty.setNative](value) {
|
|
284
|
-
_setBottom(value, this);
|
|
285
|
-
}
|
|
286
|
-
[marginLeftProperty.setNative](value) {
|
|
287
|
-
_setMarginLeft(value, this);
|
|
288
|
-
}
|
|
289
|
-
[marginRightProperty.setNative](value) {
|
|
290
|
-
_setMarginRight(value, this);
|
|
291
|
-
}
|
|
292
|
-
[marginTopProperty.setNative](value) {
|
|
293
|
-
_setMarginTop(value, this);
|
|
294
|
-
}
|
|
295
|
-
[marginBottomProperty.setNative](value) {
|
|
296
|
-
_setMarginBottom(value, this);
|
|
297
|
-
}
|
|
298
|
-
[borderLeftWidthProperty.setNative](value) {
|
|
299
|
-
_setBorderLeft(value, this);
|
|
300
|
-
}
|
|
301
|
-
[borderRightWidthProperty.setNative](value) {
|
|
302
|
-
_setBorderRight(value, this);
|
|
303
|
-
}
|
|
304
|
-
[borderTopWidthProperty.setNative](value) {
|
|
305
|
-
_setBorderTop(value, this);
|
|
306
|
-
}
|
|
307
|
-
[borderBottomWidthProperty.setNative](value) {
|
|
308
|
-
_setBorderBottom(value, this);
|
|
309
|
-
}
|
|
310
|
-
//@ts-ignore
|
|
311
|
-
get flexGrow() {
|
|
312
|
-
return _getFlexGrow(this);
|
|
313
|
-
}
|
|
314
|
-
set flexGrow(value) {
|
|
315
|
-
this.style.flexGrow = value;
|
|
316
|
-
}
|
|
317
|
-
[flexGrowProperty.setNative](value) {
|
|
318
|
-
_setFlexGrow(value, this);
|
|
319
|
-
}
|
|
320
|
-
//@ts-ignore
|
|
321
|
-
get flexShrink() {
|
|
322
|
-
return _getFlexShrink(this);
|
|
323
|
-
}
|
|
324
|
-
set flexShrink(value) {
|
|
325
|
-
this.style.flexShrink = value;
|
|
326
|
-
}
|
|
327
|
-
[flexShrinkProperty.setNative](value) {
|
|
328
|
-
_setFlexShrink(value, this);
|
|
329
|
-
}
|
|
330
|
-
//@ts-ignore
|
|
331
|
-
get flexBasis() {
|
|
332
|
-
return _getFlexBasis(this);
|
|
333
|
-
}
|
|
334
|
-
[flexBasisProperty.setNative](value) {
|
|
335
|
-
_setFlexBasis(value, this);
|
|
336
|
-
}
|
|
337
|
-
/* faster setter/getter
|
|
338
|
-
//@ts-ignore
|
|
339
|
-
get gap() {
|
|
340
|
-
return _getGap(this as any);
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
set gap(value) {
|
|
344
|
-
this.style.gap = value;
|
|
345
|
-
_setGap(value, this as any);
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
*/
|
|
349
|
-
set rowGap(value) {
|
|
350
|
-
this.style.rowGap = value;
|
|
351
|
-
}
|
|
352
|
-
get rowGap() {
|
|
353
|
-
return _getRowGap(this);
|
|
354
|
-
}
|
|
355
|
-
[rowGapProperty.setNative](value) {
|
|
356
|
-
_setRowGap(value, this);
|
|
357
|
-
}
|
|
358
|
-
set columnGap(value) {
|
|
359
|
-
this.style.columnGap = value;
|
|
360
|
-
}
|
|
361
|
-
get columnGap() {
|
|
362
|
-
return _getColumnGap(this);
|
|
363
|
-
}
|
|
364
|
-
[columnGapProperty.setNative](value) {
|
|
365
|
-
_setColumnGap(value, this);
|
|
366
|
-
}
|
|
367
|
-
get aspectRatio() {
|
|
368
|
-
return _getAspectRatio(this);
|
|
369
|
-
}
|
|
370
|
-
[aspectRatioProperty.setNative](value) {
|
|
371
|
-
_setAspectRatio(value, this);
|
|
372
|
-
}
|
|
373
|
-
[paddingLeftProperty.setNative](value) {
|
|
374
|
-
_setPaddingLeft(value, this);
|
|
375
|
-
}
|
|
376
|
-
[paddingTopProperty.setNative](value) {
|
|
377
|
-
_setPaddingTop(value, this);
|
|
378
|
-
}
|
|
379
|
-
[paddingRightProperty.setNative](value) {
|
|
380
|
-
_setPaddingRight(value, this);
|
|
381
|
-
}
|
|
382
|
-
[paddingBottomProperty.setNative](value) {
|
|
383
|
-
_setPaddingBottom(value, this);
|
|
384
|
-
}
|
|
385
|
-
//@ts-ignore
|
|
386
|
-
set minWidth(value) {
|
|
387
|
-
this.style.minWidth = value;
|
|
388
|
-
}
|
|
389
|
-
[minWidthProperty.setNative](value) {
|
|
390
|
-
_setMinWidth(value, this);
|
|
391
|
-
}
|
|
392
|
-
//@ts-ignore
|
|
393
|
-
set minHeight(value) {
|
|
394
|
-
this.style.minHeight = value;
|
|
395
|
-
}
|
|
396
|
-
[minHeightProperty.setNative](value) {
|
|
397
|
-
_setMinHeight(value, this);
|
|
398
|
-
}
|
|
399
|
-
//@ts-ignore
|
|
400
|
-
set width(value) {
|
|
401
|
-
this.style.width = value;
|
|
402
|
-
}
|
|
403
|
-
[widthProperty.setNative](value) {
|
|
404
|
-
_setWidth(value, this);
|
|
405
|
-
}
|
|
406
|
-
get width() {
|
|
407
|
-
return _getWidth(this);
|
|
408
82
|
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
[maxHeightProperty.setNative](value) {
|
|
431
|
-
_setMaxHeight(value, this);
|
|
432
|
-
}
|
|
433
|
-
//@ts-ignore
|
|
434
|
-
set gridAutoRows(value) {
|
|
435
|
-
this.style.gridAutoRows = value;
|
|
436
|
-
}
|
|
437
|
-
[gridAutoRowsProperty.setNative](value) {
|
|
438
|
-
_setGridAutoRows(value, this);
|
|
439
|
-
}
|
|
440
|
-
//@ts-ignore
|
|
441
|
-
get gridAutoRows() {
|
|
442
|
-
return this.style.gridAutoRows;
|
|
443
|
-
}
|
|
444
|
-
//@ts-ignore
|
|
445
|
-
set gridAutoColumns(value) {
|
|
446
|
-
this.style.gridAutoColumns = value;
|
|
447
|
-
}
|
|
448
|
-
[gridAutoColumnsProperty.setNative](value) {
|
|
449
|
-
_setGridAutoColumns(value, this);
|
|
450
|
-
}
|
|
451
|
-
get gridAutoColumns() {
|
|
452
|
-
return this.style.gridAutoColumns;
|
|
453
|
-
}
|
|
454
|
-
set gridAutoFlow(value) {
|
|
455
|
-
this.style.gridAutoFlow = value;
|
|
456
|
-
}
|
|
457
|
-
[gridAutoFlowProperty.setNative](value) { }
|
|
458
|
-
get gridAutoFlow() {
|
|
459
|
-
return this.style.gridAutoFlow;
|
|
460
|
-
}
|
|
461
|
-
set gridColumnStart(value) {
|
|
462
|
-
this.style.gridColumnStart = value;
|
|
463
|
-
}
|
|
464
|
-
[gridColumnStartProperty.setNative](value) {
|
|
465
|
-
_setGridColumnStart(value, this);
|
|
466
|
-
}
|
|
467
|
-
get gridColumnStart() {
|
|
468
|
-
return this.style.gridColumnStart;
|
|
469
|
-
}
|
|
470
|
-
set gridColumnEnd(value) {
|
|
471
|
-
this.style.gridColumnEnd = value;
|
|
472
|
-
}
|
|
473
|
-
[gridColumnEndProperty.setNative](value) {
|
|
474
|
-
_setGridColumnEnd(value, this);
|
|
475
|
-
}
|
|
476
|
-
get gridColumnEnd() {
|
|
477
|
-
return this.style.gridColumnEnd;
|
|
83
|
+
return properties;
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
export const overflowXProperty = new CssProperty({
|
|
87
|
+
name: 'overflowX',
|
|
88
|
+
cssName: 'overflow-x',
|
|
89
|
+
defaultValue: 'visible',
|
|
90
|
+
valueConverter: overflowConverter,
|
|
91
|
+
});
|
|
92
|
+
export const overflowYProperty = new CssProperty({
|
|
93
|
+
name: 'overflow',
|
|
94
|
+
cssName: 'overflow-y',
|
|
95
|
+
defaultValue: 'visible',
|
|
96
|
+
valueConverter: overflowConverter,
|
|
97
|
+
});
|
|
98
|
+
const paddingProperty = new ShorthandProperty({
|
|
99
|
+
name: 'padding',
|
|
100
|
+
cssName: 'padding',
|
|
101
|
+
getter: function () {
|
|
102
|
+
if (CoreLength.equals(this.paddingTop, this.paddingRight) && CoreLength.equals(this.paddingTop, this.paddingBottom) && CoreLength.equals(this.paddingTop, this.paddingLeft)) {
|
|
103
|
+
return this.paddingTop;
|
|
478
104
|
}
|
|
479
|
-
|
|
480
|
-
|
|
105
|
+
return `${CoreLength.convertToString(this.paddingTop)} ${CoreLength.convertToString(this.paddingRight)} ${CoreLength.convertToString(this.paddingBottom)} ${CoreLength.convertToString(this.paddingLeft)}`;
|
|
106
|
+
},
|
|
107
|
+
converter: convertToPaddings,
|
|
108
|
+
});
|
|
109
|
+
export const paddingLeftProperty = new CssProperty({
|
|
110
|
+
name: 'paddingLeft',
|
|
111
|
+
cssName: 'padding-left',
|
|
112
|
+
defaultValue: CoreTypes.zeroLength,
|
|
113
|
+
affectsLayout: global.isIOS,
|
|
114
|
+
equalityComparer: CoreLength.equals,
|
|
115
|
+
valueChanged: (target, oldValue, newValue) => {
|
|
116
|
+
const view = target.viewRef.get();
|
|
117
|
+
if (view) {
|
|
118
|
+
view.effectivePaddingLeft = CoreLength.toDevicePixels(newValue, 0);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
Trace.write(`${newValue} not set to view's property because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
|
|
481
122
|
}
|
|
482
|
-
|
|
483
|
-
|
|
123
|
+
},
|
|
124
|
+
valueConverter: masonLengthParse,
|
|
125
|
+
});
|
|
126
|
+
export const paddingRightProperty = new CssProperty({
|
|
127
|
+
name: 'paddingRight',
|
|
128
|
+
cssName: 'padding-right',
|
|
129
|
+
defaultValue: CoreTypes.zeroLength,
|
|
130
|
+
affectsLayout: global.isIOS,
|
|
131
|
+
equalityComparer: CoreLength.equals,
|
|
132
|
+
valueChanged: (target, oldValue, newValue) => {
|
|
133
|
+
const view = target.viewRef.get();
|
|
134
|
+
if (view) {
|
|
135
|
+
view.effectivePaddingRight = CoreLength.toDevicePixels(newValue, 0);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
Trace.write(`${newValue} not set to view's property because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
|
|
484
139
|
}
|
|
485
|
-
|
|
486
|
-
|
|
140
|
+
},
|
|
141
|
+
valueConverter: masonLengthParse,
|
|
142
|
+
});
|
|
143
|
+
export const paddingTopProperty = new CssProperty({
|
|
144
|
+
name: 'paddingTop',
|
|
145
|
+
cssName: 'padding-top',
|
|
146
|
+
defaultValue: CoreTypes.zeroLength,
|
|
147
|
+
affectsLayout: global.isIOS,
|
|
148
|
+
equalityComparer: CoreLength.equals,
|
|
149
|
+
valueChanged: (target, oldValue, newValue) => {
|
|
150
|
+
const view = target.viewRef.get();
|
|
151
|
+
if (view) {
|
|
152
|
+
view.effectivePaddingTop = CoreLength.toDevicePixels(newValue, 0);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
Trace.write(`${newValue} not set to view's property because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
|
|
487
156
|
}
|
|
488
|
-
|
|
489
|
-
|
|
157
|
+
},
|
|
158
|
+
valueConverter: masonLengthParse,
|
|
159
|
+
});
|
|
160
|
+
export const paddingBottomProperty = new CssProperty({
|
|
161
|
+
name: 'paddingBottom',
|
|
162
|
+
cssName: 'padding-bottom',
|
|
163
|
+
defaultValue: CoreTypes.zeroLength,
|
|
164
|
+
affectsLayout: global.isIOS,
|
|
165
|
+
equalityComparer: CoreLength.equals,
|
|
166
|
+
valueChanged: (target, oldValue, newValue) => {
|
|
167
|
+
const view = target.viewRef.get();
|
|
168
|
+
if (view) {
|
|
169
|
+
view.effectivePaddingBottom = CoreLength.toDevicePixels(newValue, 0);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
Trace.write(`${newValue} not set to view's property because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
|
|
490
173
|
}
|
|
491
|
-
|
|
492
|
-
|
|
174
|
+
},
|
|
175
|
+
valueConverter: masonLengthParse,
|
|
176
|
+
});
|
|
177
|
+
export const rowGapProperty = new CssProperty({
|
|
178
|
+
name: 'rowGap',
|
|
179
|
+
cssName: 'row-gap',
|
|
180
|
+
defaultValue: 0,
|
|
181
|
+
valueConverter(value) {
|
|
182
|
+
const parsed = CoreLength.parse(value);
|
|
183
|
+
if (typeof parsed === 'string') {
|
|
184
|
+
return 0;
|
|
493
185
|
}
|
|
494
|
-
|
|
495
|
-
|
|
186
|
+
return parsed;
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
export const columnGapProperty = new CssProperty({
|
|
190
|
+
name: 'columnGap',
|
|
191
|
+
cssName: 'column-gap',
|
|
192
|
+
defaultValue: 0,
|
|
193
|
+
valueConverter(value) {
|
|
194
|
+
const parsed = CoreLength.parse(value);
|
|
195
|
+
if (typeof parsed === 'string') {
|
|
196
|
+
return 0;
|
|
496
197
|
}
|
|
497
|
-
|
|
498
|
-
|
|
198
|
+
return parsed;
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
export const gapProperty = new ShorthandProperty({
|
|
202
|
+
name: 'gap',
|
|
203
|
+
cssName: 'gap',
|
|
204
|
+
getter: function () {
|
|
205
|
+
if (this.rowGap === this.columnGap) {
|
|
206
|
+
return this.rowGap;
|
|
499
207
|
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
208
|
+
return `${this.rowGap} ${this.columnGap}`;
|
|
209
|
+
},
|
|
210
|
+
converter(value) {
|
|
211
|
+
const properties = [];
|
|
212
|
+
if (typeof value === 'string') {
|
|
213
|
+
const values = value.split(/\s+/).filter((item) => item.trim().length !== 0);
|
|
214
|
+
const length = values.length;
|
|
215
|
+
if (length === 0) {
|
|
216
|
+
return properties;
|
|
504
217
|
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
218
|
+
if (length === 1) {
|
|
219
|
+
const row = values[0];
|
|
220
|
+
properties.push([rowGapProperty, row]);
|
|
221
|
+
properties.push([columnGapProperty, row]);
|
|
222
|
+
}
|
|
223
|
+
if (length > 1) {
|
|
224
|
+
const row = values[0];
|
|
225
|
+
const column = values[1];
|
|
226
|
+
properties.push([rowGapProperty, row]);
|
|
227
|
+
properties.push([columnGapProperty, column]);
|
|
513
228
|
}
|
|
514
229
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
}
|
|
518
|
-
export function installMixins() {
|
|
519
|
-
if (!mixinInstalled) {
|
|
520
|
-
mixinInstalled = true;
|
|
521
|
-
overrideViewBase();
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
const emptyArray = new Array();
|
|
525
|
-
export const flexGrowProperty = new CssProperty({
|
|
526
|
-
name: 'flexGrow',
|
|
527
|
-
cssName: 'flex-grow',
|
|
528
|
-
defaultValue: 0,
|
|
529
|
-
valueConverter: parseFloat,
|
|
230
|
+
return properties;
|
|
231
|
+
},
|
|
530
232
|
});
|
|
233
|
+
// export const flexGrowProperty = new CssProperty<Style, number>({
|
|
234
|
+
// name: 'flexGrow',
|
|
235
|
+
// cssName: 'flex-grow',
|
|
236
|
+
// defaultValue: 0,
|
|
237
|
+
// valueConverter: parseFloat,
|
|
238
|
+
// });
|
|
531
239
|
export const flexShrinkProperty = new CssProperty({
|
|
532
240
|
name: 'flexShrink',
|
|
533
241
|
cssName: 'flex-shrink',
|
|
@@ -537,7 +245,7 @@ export const flexShrinkProperty = new CssProperty({
|
|
|
537
245
|
export const displayProperty = new CssProperty({
|
|
538
246
|
name: 'display',
|
|
539
247
|
cssName: 'display',
|
|
540
|
-
defaultValue: '
|
|
248
|
+
defaultValue: 'block',
|
|
541
249
|
valueConverter(value) {
|
|
542
250
|
if (typeof value === 'number') {
|
|
543
251
|
switch (value) {
|
|
@@ -547,16 +255,19 @@ export const displayProperty = new CssProperty({
|
|
|
547
255
|
return 'flex';
|
|
548
256
|
case 2:
|
|
549
257
|
return 'grid';
|
|
258
|
+
case 3:
|
|
259
|
+
return 'block';
|
|
550
260
|
}
|
|
551
261
|
}
|
|
552
262
|
switch (value) {
|
|
553
263
|
case 'none':
|
|
554
264
|
case 'flex':
|
|
555
265
|
case 'grid':
|
|
266
|
+
case 'block':
|
|
556
267
|
return value;
|
|
557
268
|
default:
|
|
558
269
|
// todo throw???
|
|
559
|
-
return '
|
|
270
|
+
return 'block';
|
|
560
271
|
}
|
|
561
272
|
},
|
|
562
273
|
});
|
|
@@ -564,56 +275,100 @@ export const maxWidthProperty = new CssProperty({
|
|
|
564
275
|
name: 'maxWidth',
|
|
565
276
|
cssName: 'max-width',
|
|
566
277
|
defaultValue: 'auto',
|
|
278
|
+
// @ts-ignore
|
|
567
279
|
equalityComparer: NSLength.equals,
|
|
280
|
+
valueConverter: masonLengthParse,
|
|
568
281
|
});
|
|
569
282
|
export const maxHeightProperty = new CssProperty({
|
|
570
283
|
name: 'maxHeight',
|
|
571
284
|
cssName: 'max-height',
|
|
572
285
|
defaultValue: 'auto',
|
|
286
|
+
// @ts-ignore
|
|
573
287
|
equalityComparer: NSLength.equals,
|
|
288
|
+
valueConverter: masonLengthParse,
|
|
574
289
|
});
|
|
575
290
|
export const positionProperty = new CssProperty({
|
|
576
291
|
name: 'position',
|
|
577
292
|
cssName: 'position',
|
|
578
293
|
defaultValue: 'relative',
|
|
579
294
|
});
|
|
580
|
-
export const flexDirectionProperty = new CssProperty({
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
});
|
|
584
|
-
export const flexWrapProperty = new CssProperty({
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
295
|
+
// export const flexDirectionProperty = new CssProperty<Style, FlexDirection>({
|
|
296
|
+
// name: 'flexDirection',
|
|
297
|
+
// cssName: 'flex-direction',
|
|
298
|
+
// });
|
|
299
|
+
// export const flexWrapProperty = new CssProperty<Style, FlexWrap>({
|
|
300
|
+
// name: 'flexWrap',
|
|
301
|
+
// cssName: 'flex-wrap',
|
|
302
|
+
// defaultValue: 'no-wrap',
|
|
303
|
+
// });
|
|
304
|
+
const insetProperty = new ShorthandProperty({
|
|
305
|
+
name: 'inset',
|
|
306
|
+
cssName: 'inset',
|
|
307
|
+
getter: function () {
|
|
308
|
+
if (CorePercentLength.equals(this.top, this.right) && CorePercentLength.equals(this.top, this.bottom) && CorePercentLength.equals(this.top, this.left)) {
|
|
309
|
+
return this.top;
|
|
310
|
+
}
|
|
311
|
+
return `${CorePercentLength.convertToString(this.paddingTop)} ${CorePercentLength.convertToString(this.paddingRight)} ${CorePercentLength.convertToString(this.paddingBottom)} ${CorePercentLength.convertToString(this.paddingLeft)}`;
|
|
312
|
+
},
|
|
313
|
+
converter: convertToInsets,
|
|
588
314
|
});
|
|
315
|
+
function convertToInsets(value) {
|
|
316
|
+
if (typeof value === 'string' && value !== 'auto') {
|
|
317
|
+
const thickness = parseShorthandPositioning(value);
|
|
318
|
+
return [
|
|
319
|
+
[topProperty, masonLengthPercentParse(thickness.top)],
|
|
320
|
+
[rightProperty, masonLengthPercentParse(thickness.right)],
|
|
321
|
+
[bottomProperty, masonLengthPercentParse(thickness.bottom)],
|
|
322
|
+
[leftProperty, masonLengthPercentParse(thickness.left)],
|
|
323
|
+
];
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
return [
|
|
327
|
+
[topProperty, value],
|
|
328
|
+
[rightProperty, value],
|
|
329
|
+
[bottomProperty, value],
|
|
330
|
+
[leftProperty, value],
|
|
331
|
+
];
|
|
332
|
+
}
|
|
333
|
+
}
|
|
589
334
|
export const leftProperty = new CssProperty({
|
|
590
335
|
name: 'left',
|
|
591
336
|
cssName: 'left',
|
|
592
337
|
defaultValue: 'auto',
|
|
338
|
+
// @ts-ignore
|
|
593
339
|
equalityComparer: NSLength.equals,
|
|
340
|
+
valueConverter: masonLengthParse,
|
|
594
341
|
});
|
|
595
342
|
export const rightProperty = new CssProperty({
|
|
596
343
|
name: 'right',
|
|
597
344
|
cssName: 'right',
|
|
598
345
|
defaultValue: 'auto',
|
|
346
|
+
// @ts-ignore
|
|
599
347
|
equalityComparer: NSLength.equals,
|
|
348
|
+
valueConverter: masonLengthParse,
|
|
600
349
|
});
|
|
601
350
|
export const topProperty = new CssProperty({
|
|
602
351
|
name: 'top',
|
|
603
352
|
cssName: 'top',
|
|
604
353
|
defaultValue: 'auto',
|
|
354
|
+
// @ts-ignore
|
|
605
355
|
equalityComparer: NSLength.equals,
|
|
356
|
+
valueConverter: masonLengthParse,
|
|
606
357
|
});
|
|
607
358
|
export const bottomProperty = new CssProperty({
|
|
608
359
|
name: 'bottom',
|
|
609
360
|
cssName: 'bottom',
|
|
610
361
|
defaultValue: 'auto',
|
|
362
|
+
// @ts-ignore
|
|
611
363
|
equalityComparer: NSLength.equals,
|
|
364
|
+
valueConverter: masonLengthParse,
|
|
612
365
|
});
|
|
613
366
|
export const flexBasisProperty = new CssProperty({
|
|
614
367
|
name: 'flexBasis',
|
|
615
368
|
cssName: 'flex-basis',
|
|
616
369
|
defaultValue: 'auto',
|
|
370
|
+
equalityComparer: NSLength.equals,
|
|
371
|
+
valueConverter: masonLengthParse,
|
|
617
372
|
});
|
|
618
373
|
export const gridRowGapProperty = new ShorthandProperty({
|
|
619
374
|
name: 'gridRowGap',
|
|
@@ -635,86 +390,6 @@ export const gridColumnGapProperty = new ShorthandProperty({
|
|
|
635
390
|
return [[columnGapProperty, value]];
|
|
636
391
|
},
|
|
637
392
|
});
|
|
638
|
-
export const rowGapProperty = new CssProperty({
|
|
639
|
-
name: 'rowGap',
|
|
640
|
-
cssName: 'row-gap',
|
|
641
|
-
defaultValue: 0,
|
|
642
|
-
});
|
|
643
|
-
export const columnGapProperty = new CssProperty({
|
|
644
|
-
name: 'columnGap',
|
|
645
|
-
cssName: 'column-gap',
|
|
646
|
-
defaultValue: 0,
|
|
647
|
-
});
|
|
648
|
-
export const gridGapProperty = new ShorthandProperty({
|
|
649
|
-
name: 'gridGap',
|
|
650
|
-
cssName: 'grid-gap',
|
|
651
|
-
getter: function () {
|
|
652
|
-
if (this.rowGap === this.columnGap) {
|
|
653
|
-
return this.rowGap;
|
|
654
|
-
}
|
|
655
|
-
return `${this.rowGap} ${this.columnGap}`;
|
|
656
|
-
},
|
|
657
|
-
converter(value) {
|
|
658
|
-
if (typeof value === 'string') {
|
|
659
|
-
const values = value.split(/\s+/).filter((item) => item.trim().length !== 0);
|
|
660
|
-
const length = values.length;
|
|
661
|
-
if (length === 0) {
|
|
662
|
-
return emptyArray;
|
|
663
|
-
}
|
|
664
|
-
if (length === 1) {
|
|
665
|
-
const row = values[0];
|
|
666
|
-
return [
|
|
667
|
-
[rowGapProperty, row],
|
|
668
|
-
[columnGapProperty, row],
|
|
669
|
-
];
|
|
670
|
-
}
|
|
671
|
-
if (length > 1) {
|
|
672
|
-
const row = values[0];
|
|
673
|
-
const column = values[1];
|
|
674
|
-
return [
|
|
675
|
-
[rowGapProperty, row],
|
|
676
|
-
[columnGapProperty, column],
|
|
677
|
-
];
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
return emptyArray;
|
|
681
|
-
},
|
|
682
|
-
});
|
|
683
|
-
export const gapProperty = new ShorthandProperty({
|
|
684
|
-
name: 'gap',
|
|
685
|
-
cssName: 'gap',
|
|
686
|
-
getter: function () {
|
|
687
|
-
if (this.rowGap === this.columnGap) {
|
|
688
|
-
return this.rowGap;
|
|
689
|
-
}
|
|
690
|
-
return `${this.rowGap} ${this.columnGap}`;
|
|
691
|
-
},
|
|
692
|
-
converter(value) {
|
|
693
|
-
if (typeof value === 'string') {
|
|
694
|
-
const values = value.split(/\s+/).filter((item) => item.trim().length !== 0);
|
|
695
|
-
const length = values.length;
|
|
696
|
-
if (length === 0) {
|
|
697
|
-
return emptyArray;
|
|
698
|
-
}
|
|
699
|
-
if (length === 1) {
|
|
700
|
-
const row = values[0];
|
|
701
|
-
return [
|
|
702
|
-
[rowGapProperty, row],
|
|
703
|
-
[columnGapProperty, row],
|
|
704
|
-
];
|
|
705
|
-
}
|
|
706
|
-
if (length > 1) {
|
|
707
|
-
const row = values[0];
|
|
708
|
-
const column = values[1];
|
|
709
|
-
return [
|
|
710
|
-
[rowGapProperty, row],
|
|
711
|
-
[columnGapProperty, column],
|
|
712
|
-
];
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
return emptyArray;
|
|
716
|
-
},
|
|
717
|
-
});
|
|
718
393
|
export const aspectRatioProperty = new CssProperty({
|
|
719
394
|
name: 'aspectRatio',
|
|
720
395
|
cssName: 'aspect-ratio',
|
|
@@ -809,7 +484,7 @@ export const gridAreaProperty = new ShorthandProperty({
|
|
|
809
484
|
// grid-row-start / grid-column-start / grid-row-end / grid-column-end
|
|
810
485
|
const length = values.length;
|
|
811
486
|
if (length === 0) {
|
|
812
|
-
return
|
|
487
|
+
return [];
|
|
813
488
|
}
|
|
814
489
|
if (length === 1) {
|
|
815
490
|
const parsed = parseGridColumnOrRow(values[0]);
|
|
@@ -854,7 +529,7 @@ export const gridAreaProperty = new ShorthandProperty({
|
|
|
854
529
|
];
|
|
855
530
|
}
|
|
856
531
|
}
|
|
857
|
-
return
|
|
532
|
+
return [];
|
|
858
533
|
},
|
|
859
534
|
});
|
|
860
535
|
export const gridColumnStartProperty = new CssProperty({
|
|
@@ -881,7 +556,7 @@ export const gridColumnProperty = new ShorthandProperty({
|
|
|
881
556
|
const values = value.split('/').filter((item) => item.trim().length !== 0);
|
|
882
557
|
const length = values.length;
|
|
883
558
|
if (length === 0) {
|
|
884
|
-
return
|
|
559
|
+
return [];
|
|
885
560
|
}
|
|
886
561
|
if (length === 1) {
|
|
887
562
|
const parsed = parseGridColumnOrRow(values[0]);
|
|
@@ -901,7 +576,7 @@ export const gridColumnProperty = new ShorthandProperty({
|
|
|
901
576
|
];
|
|
902
577
|
}
|
|
903
578
|
}
|
|
904
|
-
return
|
|
579
|
+
return [];
|
|
905
580
|
},
|
|
906
581
|
});
|
|
907
582
|
export const gridRowStartProperty = new CssProperty({
|
|
@@ -928,7 +603,7 @@ export const gridRowProperty = new ShorthandProperty({
|
|
|
928
603
|
const values = value.split('/').filter((item) => item.trim().length !== 0);
|
|
929
604
|
const length = values.length;
|
|
930
605
|
if (length === 0) {
|
|
931
|
-
return
|
|
606
|
+
return [];
|
|
932
607
|
}
|
|
933
608
|
if (length === 1) {
|
|
934
609
|
const parsed = parseGridColumnOrRow(values[0]);
|
|
@@ -948,20 +623,122 @@ export const gridRowProperty = new ShorthandProperty({
|
|
|
948
623
|
];
|
|
949
624
|
}
|
|
950
625
|
}
|
|
951
|
-
return
|
|
626
|
+
return [];
|
|
952
627
|
},
|
|
953
628
|
});
|
|
954
629
|
export const gridTemplateRowsProperty = new CssProperty({
|
|
955
630
|
name: 'gridTemplateRows',
|
|
956
631
|
cssName: 'grid-template-rows',
|
|
957
|
-
defaultValue:
|
|
632
|
+
defaultValue: null,
|
|
958
633
|
});
|
|
959
634
|
export const gridTemplateColumnsProperty = new CssProperty({
|
|
960
635
|
name: 'gridTemplateColumns',
|
|
961
636
|
cssName: 'grid-template-columns',
|
|
637
|
+
defaultValue: null,
|
|
638
|
+
});
|
|
639
|
+
// flex-flow: <flex-direction> || <flex-wrap>
|
|
640
|
+
const flexFlowProperty = new ShorthandProperty({
|
|
641
|
+
name: 'flexFlow',
|
|
642
|
+
cssName: 'flex-flow',
|
|
643
|
+
getter: function () {
|
|
644
|
+
return `${this.flexDirection} ${this.flexWrap}`;
|
|
645
|
+
},
|
|
646
|
+
converter: function (value) {
|
|
647
|
+
const properties = [];
|
|
648
|
+
if (value === unsetValue) {
|
|
649
|
+
properties.push([flexDirectionProperty, value]);
|
|
650
|
+
properties.push([flexWrapProperty, value]);
|
|
651
|
+
}
|
|
652
|
+
else {
|
|
653
|
+
const trimmed = value && value.trim();
|
|
654
|
+
if (trimmed) {
|
|
655
|
+
const values = trimmed.split(/\s+/);
|
|
656
|
+
if (values.length >= 1) {
|
|
657
|
+
properties.push([flexDirectionProperty, values[0]]);
|
|
658
|
+
}
|
|
659
|
+
if (value.length >= 2) {
|
|
660
|
+
properties.push([flexWrapProperty, values[1]]);
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
return properties;
|
|
665
|
+
},
|
|
666
|
+
});
|
|
667
|
+
// flex: inital | auto | none | <flex-grow> <flex-shrink> || <flex-basis>
|
|
668
|
+
const flexProperty = new ShorthandProperty({
|
|
669
|
+
name: 'flex',
|
|
670
|
+
cssName: 'flex',
|
|
671
|
+
getter: function () {
|
|
672
|
+
return `${this.flexGrow} ${this.flexShrink} ${this.flexBasis}`;
|
|
673
|
+
},
|
|
674
|
+
converter: function (value) {
|
|
675
|
+
const properties = [];
|
|
676
|
+
if (value === unsetValue) {
|
|
677
|
+
properties.push([flexGrowProperty, value]);
|
|
678
|
+
properties.push([flexShrinkProperty, value]);
|
|
679
|
+
}
|
|
680
|
+
else if (typeof value === 'number') {
|
|
681
|
+
properties.push([flexGrowProperty, value]);
|
|
682
|
+
properties.push([flexShrinkProperty, 1]);
|
|
683
|
+
properties.push([flexBasisProperty, 'auto']);
|
|
684
|
+
}
|
|
685
|
+
else {
|
|
686
|
+
const trimmed = value && value.trim();
|
|
687
|
+
if (trimmed) {
|
|
688
|
+
const values = trimmed.split(/\s+/);
|
|
689
|
+
if (values.length === 1) {
|
|
690
|
+
switch (values[0]) {
|
|
691
|
+
case 'inital':
|
|
692
|
+
properties.push([flexGrowProperty, 0]);
|
|
693
|
+
properties.push([flexShrinkProperty, 1]);
|
|
694
|
+
properties.push([flexBasisProperty, 'auto']);
|
|
695
|
+
break;
|
|
696
|
+
case 'auto':
|
|
697
|
+
properties.push([flexGrowProperty, 1]);
|
|
698
|
+
properties.push([flexShrinkProperty, 1]);
|
|
699
|
+
properties.push([flexBasisProperty, 'auto']);
|
|
700
|
+
break;
|
|
701
|
+
case 'none':
|
|
702
|
+
properties.push([flexGrowProperty, 0]);
|
|
703
|
+
properties.push([flexShrinkProperty, 0]);
|
|
704
|
+
properties.push([flexBasisProperty, 'auto']);
|
|
705
|
+
break;
|
|
706
|
+
default:
|
|
707
|
+
properties.push([flexGrowProperty, values[0]]);
|
|
708
|
+
properties.push([flexShrinkProperty, 1]);
|
|
709
|
+
properties.push([flexBasisProperty, 'auto']);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
if (values.length >= 2) {
|
|
713
|
+
properties.push([flexGrowProperty, values[0]]);
|
|
714
|
+
properties.push([flexShrinkProperty, values[1]]);
|
|
715
|
+
}
|
|
716
|
+
if (value.length >= 3) {
|
|
717
|
+
properties.push({ property: flexBasisProperty, value: values[2] });
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
return properties;
|
|
722
|
+
},
|
|
723
|
+
});
|
|
724
|
+
// @ts-ignore
|
|
725
|
+
export const textWrapProperty = new Property({
|
|
726
|
+
name: 'textWrap',
|
|
727
|
+
affectsLayout: true,
|
|
728
|
+
defaultValue: 'nowrap',
|
|
729
|
+
});
|
|
730
|
+
// @ts-ignore
|
|
731
|
+
export const textProperty = new Property({
|
|
732
|
+
name: 'text',
|
|
733
|
+
affectsLayout: true,
|
|
962
734
|
defaultValue: '',
|
|
963
735
|
});
|
|
964
|
-
|
|
736
|
+
export const boxSizingProperty = new CssProperty({
|
|
737
|
+
name: 'boxSizing',
|
|
738
|
+
cssName: 'box-sizing',
|
|
739
|
+
defaultValue: 'border-box',
|
|
740
|
+
});
|
|
741
|
+
export class ViewBase extends CustomLayoutView {
|
|
965
742
|
constructor() {
|
|
966
743
|
super();
|
|
967
744
|
this._children = [];
|
|
@@ -972,574 +749,243 @@ let TSCViewBase = class TSCViewBase extends CustomLayoutView {
|
|
|
972
749
|
forceStyleUpdate() {
|
|
973
750
|
_forceStyleUpdate(this);
|
|
974
751
|
}
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
752
|
+
eachLayoutChild(callback) {
|
|
753
|
+
let lastChild = null;
|
|
754
|
+
this.eachChildView((cv) => {
|
|
755
|
+
cv._eachLayoutView((lv) => {
|
|
756
|
+
if (lastChild && !lastChild.isCollapsed) {
|
|
757
|
+
callback(lastChild, false);
|
|
758
|
+
}
|
|
759
|
+
lastChild = lv;
|
|
760
|
+
});
|
|
761
|
+
return true;
|
|
762
|
+
});
|
|
763
|
+
if (lastChild && !lastChild.isCollapsed) {
|
|
764
|
+
callback(lastChild, true);
|
|
765
|
+
}
|
|
978
766
|
}
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
767
|
+
eachChild(callback) {
|
|
768
|
+
for (const child of this._children) {
|
|
769
|
+
callback(child);
|
|
770
|
+
}
|
|
982
771
|
}
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
772
|
+
eachChildView(callback) {
|
|
773
|
+
for (const view of this._children) {
|
|
774
|
+
callback(view);
|
|
775
|
+
}
|
|
986
776
|
}
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
777
|
+
_addChildFromBuilder(name, value) {
|
|
778
|
+
if (value instanceof NSView) {
|
|
779
|
+
this.addChild(value);
|
|
780
|
+
}
|
|
990
781
|
}
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
console.log('displayProperty', 'view');
|
|
994
|
-
_setDisplay(value, this as any);
|
|
782
|
+
getChildrenCount() {
|
|
783
|
+
return this._children.length;
|
|
995
784
|
}
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
this.style.position = value;
|
|
785
|
+
get _childrenCount() {
|
|
786
|
+
return this._children.length;
|
|
999
787
|
}
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
return _getPosition(this as any);
|
|
788
|
+
getChildAt(index) {
|
|
789
|
+
return this._children[index];
|
|
1003
790
|
}
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
_setPosition(value, this as any);
|
|
791
|
+
getChildIndex(child) {
|
|
792
|
+
return this._children.indexOf(child);
|
|
1007
793
|
}
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
this.style.flexDirection = value;
|
|
794
|
+
getChildById(id) {
|
|
795
|
+
return getViewById(this, id);
|
|
1011
796
|
}
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
797
|
+
addChild(child) {
|
|
798
|
+
this._children.push(child);
|
|
799
|
+
this._addView(child);
|
|
1015
800
|
}
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
801
|
+
insertChild(child, atIndex) {
|
|
802
|
+
this._children.splice(atIndex, 0, child);
|
|
803
|
+
this._addView(child, atIndex);
|
|
1019
804
|
}
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
805
|
+
removeChild(child) {
|
|
806
|
+
const index = this._children.indexOf(child);
|
|
807
|
+
if (index > -1) {
|
|
808
|
+
this._children.splice(index, 1);
|
|
809
|
+
this._removeView(child);
|
|
810
|
+
}
|
|
1023
811
|
}
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
812
|
+
removeChildren() {
|
|
813
|
+
if (this._children.length === 0) {
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
for (const child of this._children) {
|
|
817
|
+
child._isMasonChild = false;
|
|
818
|
+
this._removeView(child);
|
|
819
|
+
}
|
|
820
|
+
this._children.splice(0);
|
|
1027
821
|
}
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
return _getFlexWrap(this as any);
|
|
822
|
+
[displayProperty.setNative](value) {
|
|
823
|
+
_setDisplay(value, this);
|
|
1031
824
|
}
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
this.style.alignItems = value as any;
|
|
825
|
+
[overflowXProperty.setNative](value) {
|
|
826
|
+
_setOverflowX(value, this);
|
|
1035
827
|
}
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
return _getAlignItems(this as any);
|
|
828
|
+
[overflowYProperty.setNative](value) {
|
|
829
|
+
_setOverflowY(value, this);
|
|
1039
830
|
}
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
_setAlignItems(value, this as any);
|
|
831
|
+
[scrollBarWidthProperty.setNative](value) {
|
|
832
|
+
_setScrollbarWidth(value, this);
|
|
1043
833
|
}
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
set alignSelf(value: AlignSelf) {
|
|
1047
|
-
this.style.alignSelf = value as any;
|
|
834
|
+
[positionProperty.setNative](value) {
|
|
835
|
+
_setPosition(value, this);
|
|
1048
836
|
}
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
get alignSelf() {
|
|
1052
|
-
return _getAlignSelf(this as any);
|
|
837
|
+
[flexWrapProperty.setNative](value) {
|
|
838
|
+
_setFlexWrap(value, this);
|
|
1053
839
|
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
_setAlignSelf(value, this as any);
|
|
840
|
+
[flexDirectionProperty.setNative](value) {
|
|
841
|
+
_setFlexDirection(value, this);
|
|
1057
842
|
}
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
this.style.alignContent = value as any;
|
|
843
|
+
[flexGrowProperty.setNative](value) {
|
|
844
|
+
_setFlexGrow(value, this);
|
|
1061
845
|
}
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
_setAlignContent(value, this as any);
|
|
846
|
+
[flexShrinkProperty.setNative](value) {
|
|
847
|
+
_setFlexShrink(value, this);
|
|
1065
848
|
}
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
return _getAlignContent(this as any);
|
|
849
|
+
[flexBasisProperty.setNative](value) {
|
|
850
|
+
_setFlexBasis(value, this);
|
|
1069
851
|
}
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
this.style.justifyItems = value as any;
|
|
852
|
+
[alignItemsProperty.setNative](value) {
|
|
853
|
+
_setAlignItems(value, this);
|
|
1073
854
|
}
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
_setJustifyItems(value, this as any);
|
|
855
|
+
[alignSelfProperty.setNative](value) {
|
|
856
|
+
_setAlignSelf(value, this);
|
|
1077
857
|
}
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
return _getJustifyItems(this as any);
|
|
858
|
+
[alignContentProperty.setNative](value) {
|
|
859
|
+
_setAlignContent(value, this);
|
|
1081
860
|
}
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
this.style.justifySelf = value as any;
|
|
861
|
+
[justifyItemsProperty.setNative](value) {
|
|
862
|
+
_setJustifyItems(value, this);
|
|
1085
863
|
}
|
|
1086
|
-
|
|
1087
864
|
[justifySelfProperty.setNative](value) {
|
|
1088
|
-
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
get justifySelf() {
|
|
1092
|
-
return _getJustifySelf(this as any);
|
|
865
|
+
_setJustifySelf(value, this);
|
|
1093
866
|
}
|
|
1094
|
-
|
|
1095
|
-
set justifyContent(value) {
|
|
1096
|
-
this.style.justifyContent = value as any;
|
|
1097
|
-
}
|
|
1098
|
-
|
|
1099
867
|
[justifyContentProperty.setNative](value) {
|
|
1100
|
-
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
|
-
get justifyContent() {
|
|
1104
|
-
return _getJustifyContent(this as any);
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
//@ts-ignore
|
|
1108
|
-
set left(value) {
|
|
1109
|
-
this.style.left = value;
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
get left() {
|
|
1113
|
-
return this.style.left;
|
|
868
|
+
_setJustifyContent(value, this);
|
|
1114
869
|
}
|
|
1115
|
-
|
|
1116
870
|
[leftProperty.setNative](value) {
|
|
1117
|
-
|
|
871
|
+
_setLeft(value, this);
|
|
1118
872
|
}
|
|
1119
|
-
|
|
1120
|
-
//@ts-ignore
|
|
1121
|
-
set right(value) {
|
|
1122
|
-
this.style.right = value;
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
get right() {
|
|
1126
|
-
return this.style.right;
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
873
|
[rightProperty.setNative](value) {
|
|
1130
|
-
|
|
874
|
+
_setRight(value, this);
|
|
1131
875
|
}
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
set top(value) {
|
|
1135
|
-
this.style.top = value;
|
|
1136
|
-
}
|
|
1137
|
-
|
|
1138
|
-
get top() {
|
|
1139
|
-
return this.style.top;
|
|
876
|
+
[bottomProperty.setNative](value) {
|
|
877
|
+
_setBottom(value, this);
|
|
1140
878
|
}
|
|
1141
|
-
|
|
1142
879
|
[topProperty.setNative](value) {
|
|
1143
|
-
|
|
880
|
+
_setTop(value, this);
|
|
1144
881
|
}
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
set bottom(value) {
|
|
1148
|
-
this.style.bottom = value;
|
|
882
|
+
[minWidthProperty.setNative](value) {
|
|
883
|
+
_setMinWidth(value, this);
|
|
1149
884
|
}
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
return this.style.bottom;
|
|
885
|
+
[minHeightProperty.setNative](value) {
|
|
886
|
+
_setMinHeight(value, this);
|
|
1153
887
|
}
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
888
|
+
[widthProperty.setNative](value) {
|
|
889
|
+
_setWidth(value, this);
|
|
890
|
+
}
|
|
891
|
+
[heightProperty.setNative](value) {
|
|
892
|
+
_setHeight(value, this);
|
|
1157
893
|
}
|
|
1158
|
-
|
|
1159
894
|
[marginLeftProperty.setNative](value) {
|
|
1160
|
-
|
|
895
|
+
_setMarginLeft(value, this);
|
|
1161
896
|
}
|
|
1162
|
-
|
|
1163
897
|
[marginRightProperty.setNative](value) {
|
|
1164
|
-
|
|
1165
|
-
}
|
|
1166
|
-
|
|
1167
|
-
[marginTopProperty.setNative](value) {
|
|
1168
|
-
_setMarginTop(value, this as any);
|
|
898
|
+
_setMarginRight(value, this);
|
|
1169
899
|
}
|
|
1170
|
-
|
|
1171
900
|
[marginBottomProperty.setNative](value) {
|
|
1172
|
-
|
|
1173
|
-
}
|
|
1174
|
-
|
|
1175
|
-
[borderLeftWidthProperty.setNative](value) {
|
|
1176
|
-
_setBorderLeft(value, this as any);
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
|
-
[borderRightWidthProperty.setNative](value) {
|
|
1180
|
-
_setBorderRight(value, this as any);
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
[borderTopWidthProperty.setNative](value) {
|
|
1184
|
-
_setBorderTop(value, this as any);
|
|
901
|
+
_setMarginBottom(value, this);
|
|
1185
902
|
}
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
_setBorderBottom(value, this as any);
|
|
1189
|
-
}
|
|
1190
|
-
|
|
1191
|
-
//@ts-ignore
|
|
1192
|
-
get flexGrow() {
|
|
1193
|
-
return _getFlexGrow(this as any);
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
|
-
set flexGrow(value) {
|
|
1197
|
-
this.style.flexGrow = value;
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
[flexGrowProperty.setNative](value) {
|
|
1201
|
-
_setFlexGrow(value, this as any);
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
//@ts-ignore
|
|
1205
|
-
get flexShrink() {
|
|
1206
|
-
return _getFlexShrink(this as any);
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
set flexShrink(value) {
|
|
1210
|
-
this.style.flexShrink = value;
|
|
1211
|
-
}
|
|
1212
|
-
|
|
1213
|
-
[flexShrinkProperty.setNative](value) {
|
|
1214
|
-
_setFlexShrink(value, this as any);
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
|
-
//@ts-ignore
|
|
1218
|
-
get flexBasis() {
|
|
1219
|
-
return _getFlexBasis(this as any);
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
[flexBasisProperty.setNative](value) {
|
|
1223
|
-
_setFlexBasis(value, this as any);
|
|
1224
|
-
}
|
|
1225
|
-
|
|
1226
|
-
// faster setter/getter
|
|
1227
|
-
//@ts-ignore
|
|
1228
|
-
get gap() {
|
|
1229
|
-
return _getGap(this as any);
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
set gap(value) {
|
|
1233
|
-
this.style.gap = value;
|
|
1234
|
-
_setGap(value, this as any);
|
|
1235
|
-
}
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
set rowGap(value) {
|
|
1240
|
-
this.style.rowGap = value;
|
|
1241
|
-
}
|
|
1242
|
-
|
|
1243
|
-
[rowGapProperty.setNative](value) {
|
|
1244
|
-
_setRowGap(value, this as any);
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
|
-
set columnGap(value) {
|
|
1248
|
-
this.style.columnGap = value;
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
|
-
[columnGapProperty.setNative](value) {
|
|
1252
|
-
_setColumnGap(value, this as any);
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
|
-
get aspectRatio() {
|
|
1256
|
-
return _getAspectRatio(this as any);
|
|
1257
|
-
}
|
|
1258
|
-
|
|
1259
|
-
[aspectRatioProperty.setNative](value) {
|
|
1260
|
-
_setAspectRatio(value, this as any);
|
|
903
|
+
[marginTopProperty.setNative](value) {
|
|
904
|
+
_setMarginTop(value, this);
|
|
1261
905
|
}
|
|
1262
|
-
|
|
1263
906
|
[paddingLeftProperty.setNative](value) {
|
|
1264
|
-
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
|
-
[paddingTopProperty.setNative](value) {
|
|
1268
|
-
_setPaddingTop(value, this as any);
|
|
907
|
+
_setPaddingLeft(value, this);
|
|
1269
908
|
}
|
|
1270
|
-
|
|
1271
909
|
[paddingRightProperty.setNative](value) {
|
|
1272
|
-
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
[paddingBottomProperty.setNative](value) {
|
|
1276
|
-
_setPaddingBottom(value, this as any);
|
|
1277
|
-
}
|
|
1278
|
-
|
|
1279
|
-
//@ts-ignore
|
|
1280
|
-
set minWidth(value) {
|
|
1281
|
-
this.style.minWidth = value;
|
|
910
|
+
_setPaddingRight(value, this);
|
|
1282
911
|
}
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
_setMinWidth(value, this as any);
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
|
-
//@ts-ignore
|
|
1289
|
-
set minHeight(value) {
|
|
1290
|
-
this.style.minHeight = value;
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
[minHeightProperty.setNative](value) {
|
|
1294
|
-
_setMinHeight(value, this as any);
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
//@ts-ignore
|
|
1298
|
-
set width(value) {
|
|
1299
|
-
this.style.width = value;
|
|
912
|
+
[paddingTopProperty.setNative](value) {
|
|
913
|
+
_setPaddingTop(value, this);
|
|
1300
914
|
}
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
_setWidth(value, this as any);
|
|
915
|
+
[paddingBottomProperty.setNative](value) {
|
|
916
|
+
_setPaddingBottom(value, this);
|
|
1304
917
|
}
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
return _getWidth(this as any);
|
|
918
|
+
[rowGapProperty.setNative](value) {
|
|
919
|
+
_setRowGap(value, this);
|
|
1308
920
|
}
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
set height(value) {
|
|
1312
|
-
this.style.height = value;
|
|
921
|
+
[columnGapProperty.setNative](value) {
|
|
922
|
+
_setColumnGap(value, this);
|
|
1313
923
|
}
|
|
1314
|
-
|
|
1315
|
-
[heightProperty.setNative](value) {
|
|
1316
|
-
_setHeight(value, this as any);
|
|
1317
|
-
}
|
|
1318
|
-
|
|
1319
|
-
//@ts-ignore
|
|
1320
|
-
get height() {
|
|
1321
|
-
return _getHeight(this as any);
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1324
|
-
set maxWidth(value) {
|
|
1325
|
-
this.style.maxWidth = value;
|
|
1326
|
-
}
|
|
1327
|
-
|
|
1328
|
-
[maxWidthProperty.setNative](value) {
|
|
1329
|
-
_setMaxWidth(value, this as any);
|
|
1330
|
-
}
|
|
1331
|
-
|
|
1332
|
-
//@ts-ignore
|
|
1333
|
-
set maxHeight(value) {
|
|
1334
|
-
this.style.maxHeight = value;
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
[maxHeightProperty.setNative](value) {
|
|
1338
|
-
_setMaxHeight(value, this as any);
|
|
1339
|
-
}
|
|
1340
|
-
|
|
1341
|
-
//@ts-ignore
|
|
1342
|
-
set gridAutoRows(value) {
|
|
1343
|
-
this.style.gridAutoRows = value;
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
[gridAutoRowsProperty.setNative](value) {
|
|
1347
|
-
_setGridAutoRows(value, this as any);
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
//@ts-ignore
|
|
1351
|
-
get gridAutoRows() {
|
|
1352
|
-
return this.style.gridAutoRows;
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
//@ts-ignore
|
|
1356
|
-
set gridAutoColumns(value) {
|
|
1357
|
-
this.style.gridAutoColumns = value;
|
|
1358
|
-
}
|
|
1359
|
-
|
|
1360
|
-
[gridAutoColumnsProperty.setNative](value) {
|
|
1361
|
-
_setGridAutoColumns(value, this as any);
|
|
1362
|
-
}
|
|
1363
|
-
|
|
1364
|
-
get gridAutoColumns() {
|
|
1365
|
-
return this.style.gridAutoColumns;
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
set gridAutoFlow(value) {
|
|
1369
|
-
this.style.gridAutoFlow = value;
|
|
1370
|
-
}
|
|
1371
|
-
|
|
1372
|
-
[gridAutoFlowProperty.setNative](value) {}
|
|
1373
|
-
|
|
1374
|
-
get gridAutoFlow() {
|
|
1375
|
-
return this.style.gridAutoFlow;
|
|
1376
|
-
}
|
|
1377
|
-
|
|
1378
|
-
set gridColumnStart(value) {
|
|
1379
|
-
this.style.gridColumnStart = value;
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
924
|
[gridColumnStartProperty.setNative](value) {
|
|
1383
|
-
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
get gridColumnStart() {
|
|
1387
|
-
return this.style.gridColumnStart;
|
|
925
|
+
_setGridColumnStart(value, this);
|
|
1388
926
|
}
|
|
1389
|
-
|
|
1390
|
-
set gridColumnEnd(value) {
|
|
1391
|
-
this.style.gridColumnEnd = value;
|
|
1392
|
-
}
|
|
1393
|
-
|
|
1394
927
|
[gridColumnEndProperty.setNative](value) {
|
|
1395
|
-
|
|
1396
|
-
}
|
|
1397
|
-
|
|
1398
|
-
get gridColumnEnd() {
|
|
1399
|
-
return this.style.gridColumnEnd;
|
|
928
|
+
_setGridColumnEnd(value, this);
|
|
1400
929
|
}
|
|
1401
|
-
|
|
1402
|
-
set gridRowStart(value) {
|
|
1403
|
-
this.style.gridRowStart = value;
|
|
1404
|
-
}
|
|
1405
|
-
|
|
1406
930
|
[gridRowStartProperty.setNative](value) {
|
|
1407
|
-
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
|
-
get gridRowStart() {
|
|
1411
|
-
return this.style.gridRowStart;
|
|
931
|
+
_setGridRowStart(value, this);
|
|
1412
932
|
}
|
|
1413
|
-
|
|
1414
|
-
set gridRowEnd(value) {
|
|
1415
|
-
this.style.gridRowEnd = value;
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1418
933
|
[gridRowEndProperty.setNative](value) {
|
|
1419
|
-
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
|
-
get gridRowEnd() {
|
|
1423
|
-
return this.style.gridRowEnd;
|
|
934
|
+
_setGridRowEnd(value, this);
|
|
1424
935
|
}
|
|
1425
|
-
|
|
1426
|
-
set gridTemplateRows(value) {
|
|
1427
|
-
this.style.gridTemplateRows = value;
|
|
1428
|
-
}
|
|
1429
|
-
|
|
1430
936
|
[gridTemplateRowsProperty.setNative](value) {
|
|
1431
|
-
|
|
1432
|
-
if (templates) {
|
|
1433
|
-
_setGridTemplateRows(templates, this as any);
|
|
1434
|
-
}
|
|
1435
|
-
}
|
|
1436
|
-
|
|
1437
|
-
set gridTemplateColumns(value) {
|
|
1438
|
-
this.style.gridTemplateColumns = value;
|
|
937
|
+
_setGridTemplateRows(_parseGridTemplates(value), this);
|
|
1439
938
|
}
|
|
1440
|
-
|
|
1441
939
|
[gridTemplateColumnsProperty.setNative](value) {
|
|
1442
|
-
|
|
1443
|
-
if (templates) {
|
|
1444
|
-
_setGridTemplateColumns(templates, this as any);
|
|
1445
|
-
}
|
|
1446
|
-
}
|
|
1447
|
-
*/
|
|
1448
|
-
eachLayoutChild(callback) {
|
|
1449
|
-
let lastChild = null;
|
|
1450
|
-
this.eachChildView((cv) => {
|
|
1451
|
-
cv._eachLayoutView((lv) => {
|
|
1452
|
-
if (lastChild && !lastChild.isCollapsed) {
|
|
1453
|
-
callback(lastChild, false);
|
|
1454
|
-
}
|
|
1455
|
-
lastChild = lv;
|
|
1456
|
-
});
|
|
1457
|
-
return true;
|
|
1458
|
-
});
|
|
1459
|
-
if (lastChild && !lastChild.isCollapsed) {
|
|
1460
|
-
callback(lastChild, true);
|
|
1461
|
-
}
|
|
1462
|
-
}
|
|
1463
|
-
eachChild(callback) {
|
|
1464
|
-
this._children.forEach((child) => {
|
|
1465
|
-
callback(child);
|
|
1466
|
-
});
|
|
1467
|
-
}
|
|
1468
|
-
eachChildView(callback) {
|
|
1469
|
-
this._children.forEach((view, key) => {
|
|
1470
|
-
callback(view);
|
|
1471
|
-
});
|
|
1472
|
-
}
|
|
1473
|
-
_addChildFromBuilder(name, value) {
|
|
1474
|
-
this._children.push(value);
|
|
1475
|
-
value._isMasonChild = true;
|
|
1476
|
-
this._addView(value);
|
|
1477
|
-
}
|
|
1478
|
-
getChildrenCount() {
|
|
1479
|
-
return this._children.length;
|
|
1480
|
-
}
|
|
1481
|
-
get _childrenCount() {
|
|
1482
|
-
return this._children.length;
|
|
1483
|
-
}
|
|
1484
|
-
getChildAt(index) {
|
|
1485
|
-
return this._children[index];
|
|
1486
|
-
}
|
|
1487
|
-
getChildIndex(child) {
|
|
1488
|
-
return this._children.indexOf(child);
|
|
1489
|
-
}
|
|
1490
|
-
getChildById(id) {
|
|
1491
|
-
return getViewById(this, id);
|
|
1492
|
-
}
|
|
1493
|
-
addChild(child) {
|
|
1494
|
-
this._children.push(child);
|
|
1495
|
-
this._addView(child);
|
|
1496
|
-
}
|
|
1497
|
-
insertChild(child, atIndex) {
|
|
1498
|
-
this._children.splice(atIndex, 0, child);
|
|
1499
|
-
this._addView(child, atIndex);
|
|
1500
|
-
}
|
|
1501
|
-
removeChild(child) {
|
|
1502
|
-
const index = this._children.indexOf(child);
|
|
1503
|
-
this._children.splice(index, 1);
|
|
1504
|
-
this._removeView(child);
|
|
940
|
+
_setGridTemplateColumns(_parseGridTemplates(value), this);
|
|
1505
941
|
}
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
942
|
+
}
|
|
943
|
+
export class TextBase extends ViewBase {
|
|
944
|
+
constructor() {
|
|
945
|
+
super();
|
|
1510
946
|
}
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
947
|
+
}
|
|
948
|
+
textProperty.register(TextBase);
|
|
949
|
+
textWrapProperty.register(TextBase);
|
|
950
|
+
// @ts-ignore
|
|
951
|
+
export const srcProperty = new Property({
|
|
952
|
+
name: 'src',
|
|
953
|
+
defaultValue: '',
|
|
954
|
+
});
|
|
955
|
+
export class ImageBase extends ViewBase {
|
|
956
|
+
}
|
|
957
|
+
srcProperty.register(ImageBase);
|
|
958
|
+
/**
|
|
959
|
+
* Props are already defined in core flexbox layout,
|
|
960
|
+
* overriding them breaks the core flexbox layout.
|
|
961
|
+
*/
|
|
962
|
+
// flexDirectionProperty.register(Style);
|
|
963
|
+
// flexWrapProperty.register(Style);
|
|
964
|
+
// flexGrowProperty.register(Style);
|
|
965
|
+
// flexShrinkProperty.register(Style);
|
|
966
|
+
insetProperty.register(Style);
|
|
967
|
+
boxSizingProperty.register(Style);
|
|
968
|
+
alignItemsProperty.register(Style);
|
|
969
|
+
alignSelfProperty.register(Style);
|
|
970
|
+
justifyContentProperty.register(Style);
|
|
1517
971
|
displayProperty.register(Style);
|
|
1518
972
|
maxWidthProperty.register(Style);
|
|
1519
973
|
maxHeightProperty.register(Style);
|
|
1520
974
|
positionProperty.register(Style);
|
|
1521
|
-
flexDirectionProperty.register(Style);
|
|
1522
|
-
flexWrapProperty.register(Style);
|
|
1523
975
|
leftProperty.register(Style);
|
|
1524
976
|
rightProperty.register(Style);
|
|
1525
977
|
topProperty.register(Style);
|
|
1526
978
|
bottomProperty.register(Style);
|
|
1527
979
|
flexBasisProperty.register(Style);
|
|
1528
|
-
flexGrowProperty.register(Style);
|
|
1529
|
-
flexShrinkProperty.register(Style);
|
|
1530
980
|
rowGapProperty.register(Style);
|
|
1531
981
|
columnGapProperty.register(Style);
|
|
1532
982
|
gridRowGapProperty.register(Style);
|
|
1533
983
|
gridColumnGapProperty.register(Style);
|
|
1534
984
|
gapProperty.register(Style);
|
|
1535
|
-
gridGapProperty.register(Style);
|
|
1536
985
|
aspectRatioProperty.register(Style);
|
|
1537
|
-
alignItemsProperty.register(Style);
|
|
1538
|
-
alignSelfProperty.register(Style);
|
|
1539
986
|
alignContentProperty.register(Style);
|
|
1540
987
|
justifyItemsProperty.register(Style);
|
|
1541
988
|
justifySelfProperty.register(Style);
|
|
1542
|
-
justifyContentProperty.register(Style);
|
|
1543
989
|
gridAutoRowsProperty.register(Style);
|
|
1544
990
|
gridAutoColumnsProperty.register(Style);
|
|
1545
991
|
gridAutoFlowProperty.register(Style);
|
|
@@ -1552,5 +998,74 @@ gridRowStartProperty.register(Style);
|
|
|
1552
998
|
gridRowEndProperty.register(Style);
|
|
1553
999
|
gridTemplateRowsProperty.register(Style);
|
|
1554
1000
|
gridTemplateColumnsProperty.register(Style);
|
|
1555
|
-
|
|
1001
|
+
overflowProperty.register(Style);
|
|
1002
|
+
overflowXProperty.register(Style);
|
|
1003
|
+
overflowYProperty.register(Style);
|
|
1004
|
+
scrollBarWidthProperty.register(Style);
|
|
1005
|
+
flexFlowProperty.register(Style);
|
|
1006
|
+
flexProperty.register(Style);
|
|
1007
|
+
function parseShorthandPositioning(value) {
|
|
1008
|
+
const arr = value.split(/[ ,]+/);
|
|
1009
|
+
let top;
|
|
1010
|
+
let right;
|
|
1011
|
+
let bottom;
|
|
1012
|
+
let left;
|
|
1013
|
+
if (arr.length === 1) {
|
|
1014
|
+
top = arr[0];
|
|
1015
|
+
right = arr[0];
|
|
1016
|
+
bottom = arr[0];
|
|
1017
|
+
left = arr[0];
|
|
1018
|
+
}
|
|
1019
|
+
else if (arr.length === 2) {
|
|
1020
|
+
top = arr[0];
|
|
1021
|
+
bottom = arr[0];
|
|
1022
|
+
right = arr[1];
|
|
1023
|
+
left = arr[1];
|
|
1024
|
+
}
|
|
1025
|
+
else if (arr.length === 3) {
|
|
1026
|
+
top = arr[0];
|
|
1027
|
+
right = arr[1];
|
|
1028
|
+
left = arr[1];
|
|
1029
|
+
bottom = arr[2];
|
|
1030
|
+
}
|
|
1031
|
+
else if (arr.length === 4) {
|
|
1032
|
+
top = arr[0];
|
|
1033
|
+
right = arr[1];
|
|
1034
|
+
bottom = arr[2];
|
|
1035
|
+
left = arr[3];
|
|
1036
|
+
}
|
|
1037
|
+
else {
|
|
1038
|
+
throw new Error('Expected 1, 2, 3 or 4 parameters. Actual: ' + value);
|
|
1039
|
+
}
|
|
1040
|
+
return {
|
|
1041
|
+
top: top,
|
|
1042
|
+
right: right,
|
|
1043
|
+
bottom: bottom,
|
|
1044
|
+
left: left,
|
|
1045
|
+
};
|
|
1046
|
+
}
|
|
1047
|
+
function convertToPaddings(value) {
|
|
1048
|
+
if (typeof value === 'string' && value !== 'auto') {
|
|
1049
|
+
const thickness = parseShorthandPositioning(value);
|
|
1050
|
+
return [
|
|
1051
|
+
[paddingTopProperty, CoreLength.parse(thickness.top)],
|
|
1052
|
+
[paddingRightProperty, CoreLength.parse(thickness.right)],
|
|
1053
|
+
[paddingBottomProperty, CoreLength.parse(thickness.bottom)],
|
|
1054
|
+
[paddingLeftProperty, CoreLength.parse(thickness.left)],
|
|
1055
|
+
];
|
|
1056
|
+
}
|
|
1057
|
+
else {
|
|
1058
|
+
return [
|
|
1059
|
+
[paddingTopProperty, value],
|
|
1060
|
+
[paddingRightProperty, value],
|
|
1061
|
+
[paddingBottomProperty, value],
|
|
1062
|
+
[paddingLeftProperty, value],
|
|
1063
|
+
];
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
paddingProperty.register(Style);
|
|
1067
|
+
paddingLeftProperty.register(Style);
|
|
1068
|
+
paddingRightProperty.register(Style);
|
|
1069
|
+
paddingTopProperty.register(Style);
|
|
1070
|
+
paddingBottomProperty.register(Style);
|
|
1556
1071
|
//# sourceMappingURL=common.js.map
|