@triniwiz/nativescript-masonkit 1.0.0-alpha.21 → 1.0.0-alpha.23
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/index.d.ts +80 -106
- package/package.json +1 -1
- package/platforms/android/masonkit-release.aar +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason-Swift.h +363 -268
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/mason_native.h +67 -18
- 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 +18168 -14735
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.private.swiftinterface +366 -126
- 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 +366 -126
- 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 +2864 -2416
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason-Swift.h +726 -536
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/mason_native.h +67 -18
- 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 +18168 -14735
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +366 -126
- 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 +366 -126
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +18168 -14735
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +366 -126
- 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 +366 -126
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/_CodeSignature/CodeResources +29 -29
- 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 +2864 -2416
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +2779 -2352
- package/common.d.ts +0 -112
- package/common.js +0 -1071
- package/common.js.map +0 -1
- package/helpers.d.ts +0 -255
- package/helpers.js +0 -1315
- package/helpers.js.map +0 -1
- package/index.android.d.ts +0 -61
- package/index.android.js +0 -224
- package/index.android.js.map +0 -1
- package/index.ios.d.ts +0 -77
- package/index.ios.js +0 -481
- package/index.ios.js.map +0 -1
- package/style.d.ts +0 -166
- package/style.js +0 -1705
- package/style.js.map +0 -1
- package/web.d.ts +0 -55
- package/web.js +0 -189
- package/web.js.map +0 -1
package/common.js
DELETED
|
@@ -1,1071 +0,0 @@
|
|
|
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;
|
|
70
|
-
}
|
|
71
|
-
if (length === 1) {
|
|
72
|
-
const xy = values[0];
|
|
73
|
-
properties.push([overflowXProperty, xy]);
|
|
74
|
-
properties.push([overflowYProperty, xy]);
|
|
75
|
-
}
|
|
76
|
-
if (length > 1) {
|
|
77
|
-
const x = values[0];
|
|
78
|
-
const y = values[1];
|
|
79
|
-
properties.push([overflowXProperty, x]);
|
|
80
|
-
properties.push([overflowYProperty, y]);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
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;
|
|
104
|
-
}
|
|
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);
|
|
122
|
-
}
|
|
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);
|
|
139
|
-
}
|
|
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);
|
|
156
|
-
}
|
|
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);
|
|
173
|
-
}
|
|
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;
|
|
185
|
-
}
|
|
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;
|
|
197
|
-
}
|
|
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;
|
|
207
|
-
}
|
|
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;
|
|
217
|
-
}
|
|
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]);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
return properties;
|
|
231
|
-
},
|
|
232
|
-
});
|
|
233
|
-
// export const flexGrowProperty = new CssProperty<Style, number>({
|
|
234
|
-
// name: 'flexGrow',
|
|
235
|
-
// cssName: 'flex-grow',
|
|
236
|
-
// defaultValue: 0,
|
|
237
|
-
// valueConverter: parseFloat,
|
|
238
|
-
// });
|
|
239
|
-
export const flexShrinkProperty = new CssProperty({
|
|
240
|
-
name: 'flexShrink',
|
|
241
|
-
cssName: 'flex-shrink',
|
|
242
|
-
defaultValue: 1,
|
|
243
|
-
valueConverter: parseFloat,
|
|
244
|
-
});
|
|
245
|
-
export const displayProperty = new CssProperty({
|
|
246
|
-
name: 'display',
|
|
247
|
-
cssName: 'display',
|
|
248
|
-
defaultValue: 'block',
|
|
249
|
-
valueConverter(value) {
|
|
250
|
-
if (typeof value === 'number') {
|
|
251
|
-
switch (value) {
|
|
252
|
-
case 0:
|
|
253
|
-
return 'none';
|
|
254
|
-
case 1:
|
|
255
|
-
return 'flex';
|
|
256
|
-
case 2:
|
|
257
|
-
return 'grid';
|
|
258
|
-
case 3:
|
|
259
|
-
return 'block';
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
switch (value) {
|
|
263
|
-
case 'none':
|
|
264
|
-
case 'flex':
|
|
265
|
-
case 'grid':
|
|
266
|
-
case 'block':
|
|
267
|
-
return value;
|
|
268
|
-
default:
|
|
269
|
-
// todo throw???
|
|
270
|
-
return 'block';
|
|
271
|
-
}
|
|
272
|
-
},
|
|
273
|
-
});
|
|
274
|
-
export const maxWidthProperty = new CssProperty({
|
|
275
|
-
name: 'maxWidth',
|
|
276
|
-
cssName: 'max-width',
|
|
277
|
-
defaultValue: 'auto',
|
|
278
|
-
// @ts-ignore
|
|
279
|
-
equalityComparer: NSLength.equals,
|
|
280
|
-
valueConverter: masonLengthParse,
|
|
281
|
-
});
|
|
282
|
-
export const maxHeightProperty = new CssProperty({
|
|
283
|
-
name: 'maxHeight',
|
|
284
|
-
cssName: 'max-height',
|
|
285
|
-
defaultValue: 'auto',
|
|
286
|
-
// @ts-ignore
|
|
287
|
-
equalityComparer: NSLength.equals,
|
|
288
|
-
valueConverter: masonLengthParse,
|
|
289
|
-
});
|
|
290
|
-
export const positionProperty = new CssProperty({
|
|
291
|
-
name: 'position',
|
|
292
|
-
cssName: 'position',
|
|
293
|
-
defaultValue: 'relative',
|
|
294
|
-
});
|
|
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,
|
|
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
|
-
}
|
|
334
|
-
export const leftProperty = new CssProperty({
|
|
335
|
-
name: 'left',
|
|
336
|
-
cssName: 'left',
|
|
337
|
-
defaultValue: 'auto',
|
|
338
|
-
// @ts-ignore
|
|
339
|
-
equalityComparer: NSLength.equals,
|
|
340
|
-
valueConverter: masonLengthParse,
|
|
341
|
-
});
|
|
342
|
-
export const rightProperty = new CssProperty({
|
|
343
|
-
name: 'right',
|
|
344
|
-
cssName: 'right',
|
|
345
|
-
defaultValue: 'auto',
|
|
346
|
-
// @ts-ignore
|
|
347
|
-
equalityComparer: NSLength.equals,
|
|
348
|
-
valueConverter: masonLengthParse,
|
|
349
|
-
});
|
|
350
|
-
export const topProperty = new CssProperty({
|
|
351
|
-
name: 'top',
|
|
352
|
-
cssName: 'top',
|
|
353
|
-
defaultValue: 'auto',
|
|
354
|
-
// @ts-ignore
|
|
355
|
-
equalityComparer: NSLength.equals,
|
|
356
|
-
valueConverter: masonLengthParse,
|
|
357
|
-
});
|
|
358
|
-
export const bottomProperty = new CssProperty({
|
|
359
|
-
name: 'bottom',
|
|
360
|
-
cssName: 'bottom',
|
|
361
|
-
defaultValue: 'auto',
|
|
362
|
-
// @ts-ignore
|
|
363
|
-
equalityComparer: NSLength.equals,
|
|
364
|
-
valueConverter: masonLengthParse,
|
|
365
|
-
});
|
|
366
|
-
export const flexBasisProperty = new CssProperty({
|
|
367
|
-
name: 'flexBasis',
|
|
368
|
-
cssName: 'flex-basis',
|
|
369
|
-
defaultValue: 'auto',
|
|
370
|
-
equalityComparer: NSLength.equals,
|
|
371
|
-
valueConverter: masonLengthParse,
|
|
372
|
-
});
|
|
373
|
-
export const gridRowGapProperty = new ShorthandProperty({
|
|
374
|
-
name: 'gridRowGap',
|
|
375
|
-
cssName: 'grid-row-gap',
|
|
376
|
-
getter: function () {
|
|
377
|
-
return this.rowGap;
|
|
378
|
-
},
|
|
379
|
-
converter(value) {
|
|
380
|
-
return [[rowGapProperty, value]];
|
|
381
|
-
},
|
|
382
|
-
});
|
|
383
|
-
export const gridColumnGapProperty = new ShorthandProperty({
|
|
384
|
-
name: 'gridColumnGap',
|
|
385
|
-
cssName: 'grid-column-gap',
|
|
386
|
-
getter: function () {
|
|
387
|
-
return this.columnGap;
|
|
388
|
-
},
|
|
389
|
-
converter(value) {
|
|
390
|
-
return [[columnGapProperty, value]];
|
|
391
|
-
},
|
|
392
|
-
});
|
|
393
|
-
export const aspectRatioProperty = new CssProperty({
|
|
394
|
-
name: 'aspectRatio',
|
|
395
|
-
cssName: 'aspect-ratio',
|
|
396
|
-
defaultValue: Number.NaN,
|
|
397
|
-
});
|
|
398
|
-
export const alignItemsProperty = new CssProperty({
|
|
399
|
-
name: 'alignItems',
|
|
400
|
-
cssName: 'align-items',
|
|
401
|
-
defaultValue: 'normal',
|
|
402
|
-
});
|
|
403
|
-
export const alignSelfProperty = new CssProperty({
|
|
404
|
-
name: 'alignSelf',
|
|
405
|
-
cssName: 'align-self',
|
|
406
|
-
defaultValue: 'normal',
|
|
407
|
-
});
|
|
408
|
-
export const alignContentProperty = new CssProperty({
|
|
409
|
-
name: 'alignContent',
|
|
410
|
-
cssName: 'align-content',
|
|
411
|
-
defaultValue: 'normal',
|
|
412
|
-
});
|
|
413
|
-
export const justifyItemsProperty = new CssProperty({
|
|
414
|
-
name: 'justifyItems',
|
|
415
|
-
cssName: 'justify-items',
|
|
416
|
-
defaultValue: 'normal',
|
|
417
|
-
});
|
|
418
|
-
export const justifySelfProperty = new CssProperty({
|
|
419
|
-
name: 'justifySelf',
|
|
420
|
-
cssName: 'justify-self',
|
|
421
|
-
defaultValue: 'normal',
|
|
422
|
-
});
|
|
423
|
-
export const justifyContentProperty = new CssProperty({
|
|
424
|
-
name: 'justifyContent',
|
|
425
|
-
cssName: 'justify-content',
|
|
426
|
-
defaultValue: 'normal',
|
|
427
|
-
});
|
|
428
|
-
export const gridAutoRowsProperty = new CssProperty({
|
|
429
|
-
name: 'gridAutoRows',
|
|
430
|
-
cssName: 'grid-auto-rows',
|
|
431
|
-
defaultValue: '',
|
|
432
|
-
});
|
|
433
|
-
export const gridAutoColumnsProperty = new CssProperty({
|
|
434
|
-
name: 'gridAutoColumns',
|
|
435
|
-
cssName: 'grid-auto-columns',
|
|
436
|
-
defaultValue: '',
|
|
437
|
-
});
|
|
438
|
-
export const gridAutoFlowProperty = new CssProperty({
|
|
439
|
-
name: 'gridAutoFlow',
|
|
440
|
-
cssName: 'grid-auto-flow',
|
|
441
|
-
defaultValue: 'row',
|
|
442
|
-
});
|
|
443
|
-
function parseGridColumnOrRow(value) {
|
|
444
|
-
if (value.trim() === 'auto') {
|
|
445
|
-
return 'auto';
|
|
446
|
-
}
|
|
447
|
-
else {
|
|
448
|
-
const split = value.split(/\s+/).filter((item) => item.trim().length !== 0);
|
|
449
|
-
const length = split.length;
|
|
450
|
-
if (length === 0) {
|
|
451
|
-
return undefined;
|
|
452
|
-
}
|
|
453
|
-
const first = split[0];
|
|
454
|
-
if (length === 1) {
|
|
455
|
-
const parsedValue = Number(first);
|
|
456
|
-
if (Number.isNaN(parsedValue)) {
|
|
457
|
-
return undefined;
|
|
458
|
-
}
|
|
459
|
-
return first;
|
|
460
|
-
}
|
|
461
|
-
if (length === 2) {
|
|
462
|
-
if (first === 'span') {
|
|
463
|
-
const second = split[1];
|
|
464
|
-
const parsedValue = Number(second);
|
|
465
|
-
if (Number.isNaN(parsedValue)) {
|
|
466
|
-
return undefined;
|
|
467
|
-
}
|
|
468
|
-
return `${first} ${second}`;
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
//custom-ident unsupport atm
|
|
472
|
-
return undefined;
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
export const gridAreaProperty = new ShorthandProperty({
|
|
476
|
-
name: 'gridArea',
|
|
477
|
-
cssName: 'grid-area',
|
|
478
|
-
getter: function () {
|
|
479
|
-
return `${this.gridRowStart} / ${this.gridColumnStart} / ${this.gridRowEnd} / ${this.gridColumnEnd}`;
|
|
480
|
-
},
|
|
481
|
-
converter(value) {
|
|
482
|
-
if (typeof value === 'string') {
|
|
483
|
-
const values = value.split('/').filter((item) => item.trim().length !== 0);
|
|
484
|
-
// grid-row-start / grid-column-start / grid-row-end / grid-column-end
|
|
485
|
-
const length = values.length;
|
|
486
|
-
if (length === 0) {
|
|
487
|
-
return [];
|
|
488
|
-
}
|
|
489
|
-
if (length === 1) {
|
|
490
|
-
const parsed = parseGridColumnOrRow(values[0]);
|
|
491
|
-
return [
|
|
492
|
-
[gridRowStartProperty, parsed],
|
|
493
|
-
[gridRowEndProperty, parsed],
|
|
494
|
-
[gridColumnStartProperty, parsed],
|
|
495
|
-
[gridColumnEndProperty, parsed],
|
|
496
|
-
];
|
|
497
|
-
}
|
|
498
|
-
if (length === 2) {
|
|
499
|
-
const row = parseGridColumnOrRow(values[0]);
|
|
500
|
-
const column = parseGridColumnOrRow(values[1]);
|
|
501
|
-
return [
|
|
502
|
-
[gridRowStartProperty, row],
|
|
503
|
-
[gridRowEndProperty, row],
|
|
504
|
-
[gridColumnStartProperty, column],
|
|
505
|
-
[gridColumnEndProperty, column],
|
|
506
|
-
];
|
|
507
|
-
}
|
|
508
|
-
if (length === 3) {
|
|
509
|
-
const rowStart = parseGridColumnOrRow(values[0]);
|
|
510
|
-
const rowEnd = parseGridColumnOrRow(values[2]);
|
|
511
|
-
const columnStart = parseGridColumnOrRow(values[1]);
|
|
512
|
-
return [
|
|
513
|
-
[gridRowStartProperty, rowStart],
|
|
514
|
-
[gridRowEndProperty, rowEnd],
|
|
515
|
-
[gridColumnStartProperty, columnStart],
|
|
516
|
-
[gridColumnEndProperty, columnStart],
|
|
517
|
-
];
|
|
518
|
-
}
|
|
519
|
-
if (length >= 4) {
|
|
520
|
-
const rowStart = parseGridColumnOrRow(values[0]);
|
|
521
|
-
const rowEnd = parseGridColumnOrRow(values[2]);
|
|
522
|
-
const columnStart = parseGridColumnOrRow(values[1]);
|
|
523
|
-
const columnEnd = parseGridColumnOrRow(values[3]);
|
|
524
|
-
return [
|
|
525
|
-
[gridRowStartProperty, rowStart],
|
|
526
|
-
[gridRowEndProperty, rowEnd],
|
|
527
|
-
[gridColumnStartProperty, columnStart],
|
|
528
|
-
[gridColumnEndProperty, columnEnd],
|
|
529
|
-
];
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
return [];
|
|
533
|
-
},
|
|
534
|
-
});
|
|
535
|
-
export const gridColumnStartProperty = new CssProperty({
|
|
536
|
-
name: 'gridColumnStart',
|
|
537
|
-
cssName: 'grid-column-start',
|
|
538
|
-
defaultValue: 'auto',
|
|
539
|
-
});
|
|
540
|
-
export const gridColumnEndProperty = new CssProperty({
|
|
541
|
-
name: 'gridColumnEnd',
|
|
542
|
-
cssName: 'grid-column-end',
|
|
543
|
-
defaultValue: 'auto',
|
|
544
|
-
});
|
|
545
|
-
export const gridColumnProperty = new ShorthandProperty({
|
|
546
|
-
name: 'gridColumn',
|
|
547
|
-
cssName: 'grid-column',
|
|
548
|
-
getter: function () {
|
|
549
|
-
if (this.gridColumnStart === this.gridColumnEnd) {
|
|
550
|
-
return this.gridColumnStart;
|
|
551
|
-
}
|
|
552
|
-
return `${this.gridColumnStart} / ${this.gridColumnStart}`;
|
|
553
|
-
},
|
|
554
|
-
converter(value) {
|
|
555
|
-
if (typeof value === 'string') {
|
|
556
|
-
const values = value.split('/').filter((item) => item.trim().length !== 0);
|
|
557
|
-
const length = values.length;
|
|
558
|
-
if (length === 0) {
|
|
559
|
-
return [];
|
|
560
|
-
}
|
|
561
|
-
if (length === 1) {
|
|
562
|
-
const parsed = parseGridColumnOrRow(values[0]);
|
|
563
|
-
return [
|
|
564
|
-
[gridColumnStartProperty, parsed],
|
|
565
|
-
[gridColumnEndProperty, parsed],
|
|
566
|
-
];
|
|
567
|
-
}
|
|
568
|
-
if (length > 1) {
|
|
569
|
-
const start = values[0];
|
|
570
|
-
const end = values[1];
|
|
571
|
-
const parsedStart = parseGridColumnOrRow(start);
|
|
572
|
-
const parsedEnd = parseGridColumnOrRow(end);
|
|
573
|
-
return [
|
|
574
|
-
[gridColumnStartProperty, parsedStart],
|
|
575
|
-
[gridColumnEndProperty, parsedEnd],
|
|
576
|
-
];
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
return [];
|
|
580
|
-
},
|
|
581
|
-
});
|
|
582
|
-
export const gridRowStartProperty = new CssProperty({
|
|
583
|
-
name: 'gridRowStart',
|
|
584
|
-
cssName: 'grid-row-start',
|
|
585
|
-
defaultValue: 'auto',
|
|
586
|
-
});
|
|
587
|
-
export const gridRowEndProperty = new CssProperty({
|
|
588
|
-
name: 'gridRowEnd',
|
|
589
|
-
cssName: 'grid-row-end',
|
|
590
|
-
defaultValue: 'auto',
|
|
591
|
-
});
|
|
592
|
-
export const gridRowProperty = new ShorthandProperty({
|
|
593
|
-
name: 'gridRow',
|
|
594
|
-
cssName: 'grid-row',
|
|
595
|
-
getter: function () {
|
|
596
|
-
if (this.gridRowStart === this.gridRowEnd) {
|
|
597
|
-
return this.gridRowStart;
|
|
598
|
-
}
|
|
599
|
-
return `${this.gridRowStart} / ${this.gridRowStart}`;
|
|
600
|
-
},
|
|
601
|
-
converter(value) {
|
|
602
|
-
if (typeof value === 'string') {
|
|
603
|
-
const values = value.split('/').filter((item) => item.trim().length !== 0);
|
|
604
|
-
const length = values.length;
|
|
605
|
-
if (length === 0) {
|
|
606
|
-
return [];
|
|
607
|
-
}
|
|
608
|
-
if (length === 1) {
|
|
609
|
-
const parsed = parseGridColumnOrRow(values[0]);
|
|
610
|
-
return [
|
|
611
|
-
[gridRowStartProperty, parsed],
|
|
612
|
-
[gridRowEndProperty, parsed],
|
|
613
|
-
];
|
|
614
|
-
}
|
|
615
|
-
if (length > 1) {
|
|
616
|
-
const start = values[0];
|
|
617
|
-
const end = values[1];
|
|
618
|
-
const parsedStart = parseGridColumnOrRow(start);
|
|
619
|
-
const parsedEnd = parseGridColumnOrRow(end);
|
|
620
|
-
return [
|
|
621
|
-
[gridRowStartProperty, parsedStart],
|
|
622
|
-
[gridRowEndProperty, parsedEnd],
|
|
623
|
-
];
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
return [];
|
|
627
|
-
},
|
|
628
|
-
});
|
|
629
|
-
export const gridTemplateRowsProperty = new CssProperty({
|
|
630
|
-
name: 'gridTemplateRows',
|
|
631
|
-
cssName: 'grid-template-rows',
|
|
632
|
-
defaultValue: null,
|
|
633
|
-
});
|
|
634
|
-
export const gridTemplateColumnsProperty = new CssProperty({
|
|
635
|
-
name: 'gridTemplateColumns',
|
|
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,
|
|
734
|
-
defaultValue: '',
|
|
735
|
-
});
|
|
736
|
-
export const boxSizingProperty = new CssProperty({
|
|
737
|
-
name: 'boxSizing',
|
|
738
|
-
cssName: 'box-sizing',
|
|
739
|
-
defaultValue: 'border-box',
|
|
740
|
-
});
|
|
741
|
-
export class ViewBase extends CustomLayoutView {
|
|
742
|
-
constructor() {
|
|
743
|
-
super();
|
|
744
|
-
this._children = [];
|
|
745
|
-
this._isMasonView = false;
|
|
746
|
-
this._isMasonChild = false;
|
|
747
|
-
this._isMasonView = true;
|
|
748
|
-
}
|
|
749
|
-
forceStyleUpdate() {
|
|
750
|
-
_forceStyleUpdate(this);
|
|
751
|
-
}
|
|
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
|
-
}
|
|
766
|
-
}
|
|
767
|
-
eachChild(callback) {
|
|
768
|
-
for (const child of this._children) {
|
|
769
|
-
callback(child);
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
eachChildView(callback) {
|
|
773
|
-
for (const view of this._children) {
|
|
774
|
-
callback(view);
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
_addChildFromBuilder(name, value) {
|
|
778
|
-
if (value instanceof NSView) {
|
|
779
|
-
this.addChild(value);
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
getChildrenCount() {
|
|
783
|
-
return this._children.length;
|
|
784
|
-
}
|
|
785
|
-
get _childrenCount() {
|
|
786
|
-
return this._children.length;
|
|
787
|
-
}
|
|
788
|
-
getChildAt(index) {
|
|
789
|
-
return this._children[index];
|
|
790
|
-
}
|
|
791
|
-
getChildIndex(child) {
|
|
792
|
-
return this._children.indexOf(child);
|
|
793
|
-
}
|
|
794
|
-
getChildById(id) {
|
|
795
|
-
return getViewById(this, id);
|
|
796
|
-
}
|
|
797
|
-
addChild(child) {
|
|
798
|
-
this._children.push(child);
|
|
799
|
-
this._addView(child);
|
|
800
|
-
}
|
|
801
|
-
insertChild(child, atIndex) {
|
|
802
|
-
this._children.splice(atIndex, 0, child);
|
|
803
|
-
this._addView(child, atIndex);
|
|
804
|
-
}
|
|
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
|
-
}
|
|
811
|
-
}
|
|
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);
|
|
821
|
-
}
|
|
822
|
-
[displayProperty.setNative](value) {
|
|
823
|
-
_setDisplay(value, this);
|
|
824
|
-
}
|
|
825
|
-
[overflowXProperty.setNative](value) {
|
|
826
|
-
_setOverflowX(value, this);
|
|
827
|
-
}
|
|
828
|
-
[overflowYProperty.setNative](value) {
|
|
829
|
-
_setOverflowY(value, this);
|
|
830
|
-
}
|
|
831
|
-
[scrollBarWidthProperty.setNative](value) {
|
|
832
|
-
_setScrollbarWidth(value, this);
|
|
833
|
-
}
|
|
834
|
-
[positionProperty.setNative](value) {
|
|
835
|
-
_setPosition(value, this);
|
|
836
|
-
}
|
|
837
|
-
[flexWrapProperty.setNative](value) {
|
|
838
|
-
_setFlexWrap(value, this);
|
|
839
|
-
}
|
|
840
|
-
[flexDirectionProperty.setNative](value) {
|
|
841
|
-
_setFlexDirection(value, this);
|
|
842
|
-
}
|
|
843
|
-
[flexGrowProperty.setNative](value) {
|
|
844
|
-
_setFlexGrow(value, this);
|
|
845
|
-
}
|
|
846
|
-
[flexShrinkProperty.setNative](value) {
|
|
847
|
-
_setFlexShrink(value, this);
|
|
848
|
-
}
|
|
849
|
-
[flexBasisProperty.setNative](value) {
|
|
850
|
-
_setFlexBasis(value, this);
|
|
851
|
-
}
|
|
852
|
-
[alignItemsProperty.setNative](value) {
|
|
853
|
-
_setAlignItems(value, this);
|
|
854
|
-
}
|
|
855
|
-
[alignSelfProperty.setNative](value) {
|
|
856
|
-
_setAlignSelf(value, this);
|
|
857
|
-
}
|
|
858
|
-
[alignContentProperty.setNative](value) {
|
|
859
|
-
_setAlignContent(value, this);
|
|
860
|
-
}
|
|
861
|
-
[justifyItemsProperty.setNative](value) {
|
|
862
|
-
_setJustifyItems(value, this);
|
|
863
|
-
}
|
|
864
|
-
[justifySelfProperty.setNative](value) {
|
|
865
|
-
_setJustifySelf(value, this);
|
|
866
|
-
}
|
|
867
|
-
[justifyContentProperty.setNative](value) {
|
|
868
|
-
_setJustifyContent(value, this);
|
|
869
|
-
}
|
|
870
|
-
[leftProperty.setNative](value) {
|
|
871
|
-
_setLeft(value, this);
|
|
872
|
-
}
|
|
873
|
-
[rightProperty.setNative](value) {
|
|
874
|
-
_setRight(value, this);
|
|
875
|
-
}
|
|
876
|
-
[bottomProperty.setNative](value) {
|
|
877
|
-
_setBottom(value, this);
|
|
878
|
-
}
|
|
879
|
-
[topProperty.setNative](value) {
|
|
880
|
-
_setTop(value, this);
|
|
881
|
-
}
|
|
882
|
-
[minWidthProperty.setNative](value) {
|
|
883
|
-
_setMinWidth(value, this);
|
|
884
|
-
}
|
|
885
|
-
[minHeightProperty.setNative](value) {
|
|
886
|
-
_setMinHeight(value, this);
|
|
887
|
-
}
|
|
888
|
-
[widthProperty.setNative](value) {
|
|
889
|
-
_setWidth(value, this);
|
|
890
|
-
}
|
|
891
|
-
[heightProperty.setNative](value) {
|
|
892
|
-
_setHeight(value, this);
|
|
893
|
-
}
|
|
894
|
-
[marginLeftProperty.setNative](value) {
|
|
895
|
-
_setMarginLeft(value, this);
|
|
896
|
-
}
|
|
897
|
-
[marginRightProperty.setNative](value) {
|
|
898
|
-
_setMarginRight(value, this);
|
|
899
|
-
}
|
|
900
|
-
[marginBottomProperty.setNative](value) {
|
|
901
|
-
_setMarginBottom(value, this);
|
|
902
|
-
}
|
|
903
|
-
[marginTopProperty.setNative](value) {
|
|
904
|
-
_setMarginTop(value, this);
|
|
905
|
-
}
|
|
906
|
-
[paddingLeftProperty.setNative](value) {
|
|
907
|
-
_setPaddingLeft(value, this);
|
|
908
|
-
}
|
|
909
|
-
[paddingRightProperty.setNative](value) {
|
|
910
|
-
_setPaddingRight(value, this);
|
|
911
|
-
}
|
|
912
|
-
[paddingTopProperty.setNative](value) {
|
|
913
|
-
_setPaddingTop(value, this);
|
|
914
|
-
}
|
|
915
|
-
[paddingBottomProperty.setNative](value) {
|
|
916
|
-
_setPaddingBottom(value, this);
|
|
917
|
-
}
|
|
918
|
-
[rowGapProperty.setNative](value) {
|
|
919
|
-
_setRowGap(value, this);
|
|
920
|
-
}
|
|
921
|
-
[columnGapProperty.setNative](value) {
|
|
922
|
-
_setColumnGap(value, this);
|
|
923
|
-
}
|
|
924
|
-
[gridColumnStartProperty.setNative](value) {
|
|
925
|
-
_setGridColumnStart(value, this);
|
|
926
|
-
}
|
|
927
|
-
[gridColumnEndProperty.setNative](value) {
|
|
928
|
-
_setGridColumnEnd(value, this);
|
|
929
|
-
}
|
|
930
|
-
[gridRowStartProperty.setNative](value) {
|
|
931
|
-
_setGridRowStart(value, this);
|
|
932
|
-
}
|
|
933
|
-
[gridRowEndProperty.setNative](value) {
|
|
934
|
-
_setGridRowEnd(value, this);
|
|
935
|
-
}
|
|
936
|
-
[gridTemplateRowsProperty.setNative](value) {
|
|
937
|
-
_setGridTemplateRows(_parseGridTemplates(value), this);
|
|
938
|
-
}
|
|
939
|
-
[gridTemplateColumnsProperty.setNative](value) {
|
|
940
|
-
_setGridTemplateColumns(_parseGridTemplates(value), this);
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
export class TextBase extends ViewBase {
|
|
944
|
-
constructor() {
|
|
945
|
-
super();
|
|
946
|
-
}
|
|
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);
|
|
971
|
-
displayProperty.register(Style);
|
|
972
|
-
maxWidthProperty.register(Style);
|
|
973
|
-
maxHeightProperty.register(Style);
|
|
974
|
-
positionProperty.register(Style);
|
|
975
|
-
leftProperty.register(Style);
|
|
976
|
-
rightProperty.register(Style);
|
|
977
|
-
topProperty.register(Style);
|
|
978
|
-
bottomProperty.register(Style);
|
|
979
|
-
flexBasisProperty.register(Style);
|
|
980
|
-
rowGapProperty.register(Style);
|
|
981
|
-
columnGapProperty.register(Style);
|
|
982
|
-
gridRowGapProperty.register(Style);
|
|
983
|
-
gridColumnGapProperty.register(Style);
|
|
984
|
-
gapProperty.register(Style);
|
|
985
|
-
aspectRatioProperty.register(Style);
|
|
986
|
-
alignContentProperty.register(Style);
|
|
987
|
-
justifyItemsProperty.register(Style);
|
|
988
|
-
justifySelfProperty.register(Style);
|
|
989
|
-
gridAutoRowsProperty.register(Style);
|
|
990
|
-
gridAutoColumnsProperty.register(Style);
|
|
991
|
-
gridAutoFlowProperty.register(Style);
|
|
992
|
-
gridAreaProperty.register(Style);
|
|
993
|
-
gridColumnProperty.register(Style);
|
|
994
|
-
gridColumnStartProperty.register(Style);
|
|
995
|
-
gridColumnEndProperty.register(Style);
|
|
996
|
-
gridRowProperty.register(Style);
|
|
997
|
-
gridRowStartProperty.register(Style);
|
|
998
|
-
gridRowEndProperty.register(Style);
|
|
999
|
-
gridTemplateRowsProperty.register(Style);
|
|
1000
|
-
gridTemplateColumnsProperty.register(Style);
|
|
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);
|
|
1071
|
-
//# sourceMappingURL=common.js.map
|