@triniwiz/nativescript-masonkit 1.0.0-beta.7 → 1.0.0-beta.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/DOCS.md +930 -0
  2. package/br/index.android.d.ts +10 -0
  3. package/br/index.android.js +31 -0
  4. package/br/index.android.js.map +1 -0
  5. package/br/index.ios.d.ts +11 -0
  6. package/br/index.ios.js +30 -0
  7. package/br/index.ios.js.map +1 -0
  8. package/button/index.android.d.ts +4 -2
  9. package/button/index.android.js +9 -5
  10. package/button/index.android.js.map +1 -1
  11. package/button/index.ios.d.ts +4 -5
  12. package/button/index.ios.js +17 -71
  13. package/button/index.ios.js.map +1 -1
  14. package/common.d.ts +207 -73
  15. package/common.js +1236 -1392
  16. package/common.js.map +1 -1
  17. package/img/index.android.d.ts +5 -4
  18. package/img/index.android.js +18 -6
  19. package/img/index.android.js.map +1 -1
  20. package/img/index.ios.d.ts +3 -2
  21. package/img/index.ios.js +27 -21
  22. package/img/index.ios.js.map +1 -1
  23. package/index.android.d.ts +7 -1
  24. package/index.android.js +7 -1
  25. package/index.android.js.map +1 -1
  26. package/index.d.ts +129 -2
  27. package/index.ios.d.ts +7 -1
  28. package/index.ios.js +7 -1
  29. package/index.ios.js.map +1 -1
  30. package/input/common.d.ts +20 -0
  31. package/input/common.js +65 -0
  32. package/input/common.js.map +1 -0
  33. package/input/index.android.d.ts +20 -0
  34. package/input/index.android.js +118 -0
  35. package/input/index.android.js.map +1 -0
  36. package/input/index.ios.d.ts +23 -0
  37. package/input/index.ios.js +171 -0
  38. package/input/index.ios.js.map +1 -0
  39. package/li/index.android.d.ts +12 -0
  40. package/li/index.android.js +57 -0
  41. package/li/index.android.js.map +1 -0
  42. package/li/index.ios.d.ts +14 -0
  43. package/li/index.ios.js +128 -0
  44. package/li/index.ios.js.map +1 -0
  45. package/list/common.d.ts +33 -0
  46. package/list/common.js +157 -0
  47. package/list/common.js.map +1 -0
  48. package/list/index.android.d.ts +28 -0
  49. package/list/index.android.js +155 -0
  50. package/list/index.android.js.map +1 -0
  51. package/list/index.ios.d.ts +42 -0
  52. package/list/index.ios.js +321 -0
  53. package/list/index.ios.js.map +1 -0
  54. package/package.json +8 -2
  55. package/platforms/android/include.gradle +1 -0
  56. package/platforms/android/masonkit-release.aar +0 -0
  57. package/platforms/ios/Mason.xcframework/Info.plist +5 -5
  58. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason-Swift.h +572 -176
  59. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/mason_native.h +181 -50
  60. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Info.plist +0 -0
  61. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Mason +0 -0
  62. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  63. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.abi.json +74785 -40729
  64. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.private.swiftinterface +1429 -346
  65. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  66. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftinterface +1429 -346
  67. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/module.modulemap +0 -1
  68. package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  69. package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8340 -4294
  70. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason-Swift.h +1144 -352
  71. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/mason_native.h +181 -50
  72. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Info.plist +0 -0
  73. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Mason +0 -0
  74. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  75. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  76. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.abi.json +72517 -38461
  77. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +1674 -591
  78. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  79. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1674 -591
  80. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +72517 -38461
  81. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +1674 -591
  82. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  83. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +1674 -591
  84. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/module.modulemap +0 -1
  85. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/_CodeSignature/CodeResources +31 -31
  86. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  87. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8335 -4291
  88. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +7982 -4167
  89. package/properties.d.ts +83 -0
  90. package/properties.js +1345 -0
  91. package/properties.js.map +1 -0
  92. package/pseudo.d.ts +9 -0
  93. package/pseudo.js +58 -0
  94. package/pseudo.js.map +1 -0
  95. package/scroll/index.android.d.ts +3 -2
  96. package/scroll/index.android.js +20 -5
  97. package/scroll/index.android.js.map +1 -1
  98. package/scroll/index.ios.d.ts +7 -4
  99. package/scroll/index.ios.js +88 -26
  100. package/scroll/index.ios.js.map +1 -1
  101. package/style.d.ts +231 -12
  102. package/style.js +1982 -811
  103. package/style.js.map +1 -1
  104. package/symbols.d.ts +12 -0
  105. package/symbols.js +13 -0
  106. package/symbols.js.map +1 -0
  107. package/text/index.android.d.ts +11 -5
  108. package/text/index.android.js +86 -104
  109. package/text/index.android.js.map +1 -1
  110. package/text/index.ios.d.ts +14 -11
  111. package/text/index.ios.js +111 -181
  112. package/text/index.ios.js.map +1 -1
  113. package/text-node/index.android.d.ts +13 -0
  114. package/text-node/index.android.js +35 -0
  115. package/text-node/index.android.js.map +1 -0
  116. package/text-node/index.ios.d.ts +13 -0
  117. package/text-node/index.ios.js +35 -0
  118. package/text-node/index.ios.js.map +1 -0
  119. package/textarea/common.d.ts +8 -0
  120. package/textarea/common.js +28 -0
  121. package/textarea/common.js.map +1 -0
  122. package/textarea/index.android.d.ts +15 -0
  123. package/textarea/index.android.js +71 -0
  124. package/textarea/index.android.js.map +1 -0
  125. package/textarea/index.ios.d.ts +18 -0
  126. package/textarea/index.ios.js +134 -0
  127. package/textarea/index.ios.js.map +1 -0
  128. package/tree/index.android.d.ts +15 -2
  129. package/tree/index.android.js +83 -8
  130. package/tree/index.android.js.map +1 -1
  131. package/tree/index.ios.d.ts +24 -1
  132. package/tree/index.ios.js +72 -8
  133. package/tree/index.ios.js.map +1 -1
  134. package/utils/index.android.d.ts +13 -1
  135. package/utils/index.android.js +1 -1
  136. package/utils/index.android.js.map +1 -1
  137. package/utils/index.ios.d.ts +13 -1
  138. package/utils/index.ios.js +1 -1
  139. package/utils/index.ios.js.map +1 -1
  140. package/view/index.android.d.ts +3 -2
  141. package/view/index.android.js +22 -5
  142. package/view/index.android.js.map +1 -1
  143. package/view/index.ios.d.ts +4 -2
  144. package/view/index.ios.js +86 -16
  145. package/view/index.ios.js.map +1 -1
  146. package/web.d.ts +6 -0
  147. package/web.js +22 -0
  148. package/web.js.map +1 -1
  149. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/NSObject+MasonElement_Defaults.h +0 -100
  150. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/NSObject+MasonElement_Defaults.h +0 -100
package/properties.js ADDED
@@ -0,0 +1,1345 @@
1
+ import { CssProperty, Style, ShorthandProperty, Length as CoreLength, fontSizeProperty, textAlignmentProperty, PercentLength as CorePercentLength, Trace, CoreTypes, unsetValue, verticalAlignmentProperty, textShadowProperty, Font, Property, makeParser, makeValidator } from '@nativescript/core';
2
+ import { isMasonChild_, isMasonView_ } from './symbols';
3
+ import { alignItemsProperty, alignSelfProperty, flexDirectionProperty, flexGrowProperty, flexShrinkProperty, flexWrapProperty, justifyContentProperty } from '@nativescript/core/ui/layouts/flexbox-layout';
4
+ function getViewStyle(view) {
5
+ const ret = (__ANDROID__ ? view.get() : view.deref());
6
+ return ret._styleHelper;
7
+ }
8
+ function isMasonViewOrChild(style) {
9
+ if (style && style.viewRef) {
10
+ const view = __ANDROID__ ? style.viewRef.get() : style.viewRef.deref();
11
+ return view && (view[isMasonView_] || view[isMasonChild_]);
12
+ }
13
+ return false;
14
+ }
15
+ export const textProperty = new Property({
16
+ name: 'text',
17
+ });
18
+ export const displayProperty = new CssProperty({
19
+ name: 'display',
20
+ cssName: 'display',
21
+ defaultValue: 'block',
22
+ valueChanged: (target, oldValue, newValue) => {
23
+ const view = getViewStyle(target.viewRef);
24
+ if (view && newValue) {
25
+ view.display = newValue;
26
+ }
27
+ },
28
+ valueConverter: function (value) {
29
+ if (typeof value === 'number') {
30
+ switch (value) {
31
+ case 0:
32
+ return 'none';
33
+ case 1:
34
+ return 'flex';
35
+ case 2:
36
+ return 'grid';
37
+ case 3:
38
+ return 'block';
39
+ case 4:
40
+ return 'inline';
41
+ case 5:
42
+ return 'inline-block';
43
+ case 6:
44
+ return 'inline-flex';
45
+ case 7:
46
+ return 'inline-grid';
47
+ }
48
+ }
49
+ switch (value) {
50
+ case 'none':
51
+ case 'flex':
52
+ case 'grid':
53
+ case 'block':
54
+ case 'inline':
55
+ case 'inline-block':
56
+ case 'inline-flex':
57
+ case 'inline-grid':
58
+ return value;
59
+ default:
60
+ return undefined;
61
+ }
62
+ },
63
+ });
64
+ export const filterProperty = new CssProperty({
65
+ name: 'filter',
66
+ cssName: 'filter',
67
+ });
68
+ export const borderProperty = new CssProperty({
69
+ name: 'border',
70
+ cssName: 'border',
71
+ });
72
+ export const borderLeftProperty = new CssProperty({
73
+ name: 'borderLeft',
74
+ cssName: 'border-left',
75
+ });
76
+ export const borderTopProperty = new CssProperty({
77
+ name: 'borderTop',
78
+ cssName: 'border-top',
79
+ });
80
+ export const borderRightProperty = new CssProperty({
81
+ name: 'borderRight',
82
+ cssName: 'border-right',
83
+ });
84
+ export const borderBottomProperty = new CssProperty({
85
+ name: 'borderBottom',
86
+ cssName: 'border-bottom',
87
+ });
88
+ export const backgroundProperty = new CssProperty({
89
+ name: 'background',
90
+ cssName: 'background',
91
+ });
92
+ export const backgroundRepeatProperty = new CssProperty({
93
+ name: 'backgroundRepeat',
94
+ cssName: 'background-repeat',
95
+ });
96
+ export const backgroundPositionProperty = new CssProperty({
97
+ name: 'backgroundPosition',
98
+ cssName: 'background-position',
99
+ });
100
+ export const backgroundSizeProperty = new CssProperty({
101
+ name: 'backgroundSize',
102
+ cssName: 'background-size',
103
+ });
104
+ export const backgroundClipProperty = new CssProperty({
105
+ name: 'backgroundClip',
106
+ cssName: 'background-clip',
107
+ });
108
+ function overflowConverter(value) {
109
+ if (typeof value === 'number') {
110
+ switch (value) {
111
+ case 0:
112
+ return 'visible';
113
+ case 1:
114
+ return 'clip';
115
+ case 2:
116
+ return 'hidden';
117
+ case 3:
118
+ return 'scroll';
119
+ }
120
+ }
121
+ switch (value) {
122
+ case 'visible':
123
+ case 'hidden':
124
+ case 'clip':
125
+ case 'scroll':
126
+ return value;
127
+ default:
128
+ return undefined;
129
+ }
130
+ }
131
+ const overFlow = /^\s*(visible|hidden|clip|scroll|auto)(?:\s+(visible|hidden|clip|scroll|auto))?\s*$/;
132
+ export const overflowProperty = new ShorthandProperty({
133
+ name: 'overflow',
134
+ cssName: 'overflow',
135
+ getter: function () {
136
+ if (this.overflowX === this.overflowY) {
137
+ return this.overflowX;
138
+ }
139
+ return `${this.overflowX} ${this.overflowY}`;
140
+ },
141
+ converter(value) {
142
+ const properties = [];
143
+ if (typeof value === 'string') {
144
+ const values = value.match(overFlow);
145
+ const length = values?.length ?? 0;
146
+ if (length === 0) {
147
+ return properties;
148
+ }
149
+ if (length === 1) {
150
+ const xy = values[0];
151
+ properties.push([overflowXProperty, xy]);
152
+ properties.push([overflowYProperty, xy]);
153
+ }
154
+ if (length > 1) {
155
+ const x = values[0];
156
+ const y = values[1];
157
+ properties.push([overflowXProperty, x]);
158
+ properties.push([overflowYProperty, y]);
159
+ }
160
+ }
161
+ return properties;
162
+ },
163
+ });
164
+ export const overflowXProperty = new CssProperty({
165
+ name: 'overflowX',
166
+ cssName: 'overflow-x',
167
+ defaultValue: 'visible',
168
+ valueConverter: overflowConverter,
169
+ valueChanged: (target, oldValue, newValue) => {
170
+ const view = getViewStyle(target.viewRef);
171
+ if (view) {
172
+ if (newValue) {
173
+ view.overflowX = newValue;
174
+ }
175
+ else {
176
+ // Revert to old value if newValue is invalid
177
+ target.overflowX = oldValue;
178
+ }
179
+ }
180
+ },
181
+ });
182
+ export const overflowYProperty = new CssProperty({
183
+ name: 'overflowY',
184
+ cssName: 'overflow-y',
185
+ defaultValue: 'visible',
186
+ valueConverter: overflowConverter,
187
+ valueChanged(target, oldValue, newValue) {
188
+ const view = getViewStyle(target.viewRef);
189
+ if (view) {
190
+ if (newValue) {
191
+ view.overflowY = newValue;
192
+ }
193
+ else {
194
+ // Revert to old value if newValue is invalid
195
+ target.overflowY = oldValue;
196
+ }
197
+ }
198
+ },
199
+ });
200
+ export const paddingProperty = new CssProperty({
201
+ name: 'padding',
202
+ cssName: 'padding',
203
+ });
204
+ paddingProperty.register(Style);
205
+ export const marginProperty = new CssProperty({
206
+ name: 'margin',
207
+ cssName: 'margin',
208
+ });
209
+ export const scrollBarWidthProperty = new CssProperty({
210
+ name: 'scrollBarWidth',
211
+ cssName: 'scrollbar-width',
212
+ defaultValue: 0,
213
+ valueConverter: parseFloat,
214
+ });
215
+ flexDirectionProperty.overrideHandlers({
216
+ name: 'flexDirection',
217
+ cssName: 'flex-direction',
218
+ valueChanged(target, oldValue, newValue) {
219
+ const view = getViewStyle(target.viewRef);
220
+ if (view) {
221
+ if (newValue) {
222
+ view.flexDirection = newValue;
223
+ }
224
+ else {
225
+ // Revert to old value if newValue is invalid
226
+ // @ts-ignore
227
+ target.flexDirection = oldValue;
228
+ }
229
+ }
230
+ },
231
+ });
232
+ flexWrapProperty.overrideHandlers({
233
+ name: 'flexWrap',
234
+ cssName: 'flex-wrap',
235
+ valueConverter: function (value) {
236
+ return value;
237
+ },
238
+ valueChanged(target, oldValue, newValue) {
239
+ const view = getViewStyle(target.viewRef);
240
+ if (view) {
241
+ if (newValue) {
242
+ view.flexWrap = newValue;
243
+ }
244
+ else {
245
+ // Revert to old value if newValue is invalid
246
+ // @ts-ignore
247
+ target.flexWrap = oldValue;
248
+ }
249
+ }
250
+ },
251
+ });
252
+ flexGrowProperty.overrideHandlers({
253
+ name: 'flexGrow',
254
+ cssName: 'flex-grow',
255
+ valueChanged(target, oldValue, newValue) {
256
+ const view = getViewStyle(target.viewRef);
257
+ if (view) {
258
+ if (newValue) {
259
+ view.flexGrow = newValue;
260
+ }
261
+ else {
262
+ // Revert to old value if newValue is invalid
263
+ // @ts-ignore
264
+ target.flexGrow = oldValue;
265
+ }
266
+ }
267
+ },
268
+ });
269
+ fontSizeProperty.overrideHandlers({
270
+ name: 'fontSize',
271
+ cssName: 'font-size',
272
+ valueConverter: function (value) {
273
+ if (isMasonViewOrChild(this)) {
274
+ return value;
275
+ }
276
+ return parseFloat(value);
277
+ },
278
+ valueChanged(target, oldValue, newValue) {
279
+ const view = getViewStyle(target.viewRef);
280
+ if (view) {
281
+ if (newValue) {
282
+ if (typeof newValue === 'string') {
283
+ // @ts-ignore
284
+ if (newValue.indexOf('%') !== -1) {
285
+ view.fontSize = {
286
+ value: parseFloat(newValue) / 100,
287
+ unit: '%',
288
+ };
289
+ // @ts-ignore
290
+ }
291
+ else if (newValue.indexOf('dip') !== -1) {
292
+ view.fontSize = parseFloat(newValue);
293
+ // @ts-ignore
294
+ }
295
+ else if (newValue.indexOf('px') !== -1) {
296
+ view.fontSize = {
297
+ value: parseFloat(newValue),
298
+ unit: 'px',
299
+ };
300
+ }
301
+ else {
302
+ view.fontSize = parseFloat(newValue);
303
+ }
304
+ }
305
+ else {
306
+ view.fontSize = newValue;
307
+ }
308
+ }
309
+ else {
310
+ // Revert to old value if newValue is invalid
311
+ // @ts-ignore
312
+ target.fontSize = oldValue;
313
+ }
314
+ }
315
+ else {
316
+ // fallback to core behavior
317
+ const currentFont = target.fontInternal || Font.default;
318
+ if (currentFont.fontSize !== newValue) {
319
+ const newFont = currentFont.withFontSize(newValue);
320
+ target.fontInternal = Font.equals(Font.default, newFont) ? unsetValue : newFont;
321
+ }
322
+ }
323
+ },
324
+ });
325
+ // marginTopProperty.overrideHandlers({
326
+ // name: 'marginTop',
327
+ // cssName: 'margin-top',
328
+ // valueChanged(target, oldValue, newValue) {
329
+ // const view = getViewStyle(target.viewRef);
330
+ // if (view) {
331
+ // if (newValue) {
332
+ // view.marginTop = newValue as never;
333
+ // } else {
334
+ // // Revert to old value if newValue is invalid
335
+ // // @ts-ignore
336
+ // target.marginTop = oldValue as never;
337
+ // }
338
+ // }
339
+ // },
340
+ // });
341
+ export const rowGapProperty = new CssProperty({
342
+ name: 'rowGap',
343
+ cssName: 'row-gap',
344
+ defaultValue: 0,
345
+ valueConverter(value) {
346
+ const parsed = CoreLength.parse(value);
347
+ if (typeof parsed === 'string') {
348
+ return 0;
349
+ }
350
+ return parsed;
351
+ },
352
+ valueChanged(target, oldValue, newValue) {
353
+ const view = getViewStyle(target.viewRef);
354
+ if (view) {
355
+ view.rowGap = newValue;
356
+ }
357
+ },
358
+ });
359
+ export const columnGapProperty = new CssProperty({
360
+ name: 'columnGap',
361
+ cssName: 'column-gap',
362
+ defaultValue: 0,
363
+ valueConverter(value) {
364
+ const parsed = CoreLength.parse(value);
365
+ if (typeof parsed === 'string') {
366
+ return 0;
367
+ }
368
+ return parsed;
369
+ },
370
+ valueChanged(target, oldValue, newValue) {
371
+ const view = getViewStyle(target.viewRef);
372
+ if (view) {
373
+ view.columnGap = newValue;
374
+ }
375
+ },
376
+ });
377
+ export const gridGapProperty = new ShorthandProperty({
378
+ name: 'gridGap',
379
+ cssName: 'grid-gap',
380
+ getter: function () {
381
+ if (this.rowGap === this.columnGap) {
382
+ return this.rowGap;
383
+ }
384
+ return `${this.rowGap} ${this.columnGap}`;
385
+ },
386
+ converter(gap) {
387
+ const properties = [];
388
+ let value = gap;
389
+ if (typeof value === 'number') {
390
+ value = `${value}`;
391
+ }
392
+ if (typeof value === 'string') {
393
+ const values = value.split(/\s+/).filter((item) => item.trim().length !== 0);
394
+ const length = values.length;
395
+ if (length === 0) {
396
+ return properties;
397
+ }
398
+ if (length === 1) {
399
+ const row = values[0];
400
+ properties.push([rowGapProperty, row]);
401
+ properties.push([columnGapProperty, row]);
402
+ }
403
+ if (length > 1) {
404
+ const row = values[0];
405
+ const column = values[1];
406
+ properties.push([rowGapProperty, row]);
407
+ properties.push([columnGapProperty, column]);
408
+ }
409
+ }
410
+ return properties;
411
+ },
412
+ });
413
+ export const gapProperty = new ShorthandProperty({
414
+ name: 'gap',
415
+ cssName: 'gap',
416
+ getter: function () {
417
+ if (this.rowGap === this.columnGap) {
418
+ return this.rowGap;
419
+ }
420
+ return `${this.rowGap} ${this.columnGap}`;
421
+ },
422
+ converter(gap) {
423
+ const properties = [];
424
+ let value = gap;
425
+ if (typeof value === 'number') {
426
+ value = `${value}`;
427
+ }
428
+ if (typeof value === 'string') {
429
+ const values = value.split(/\s+/).filter((item) => item.trim().length !== 0);
430
+ const length = values.length;
431
+ if (length === 0) {
432
+ return properties;
433
+ }
434
+ if (length === 1) {
435
+ const row = values[0];
436
+ properties.push([rowGapProperty, row]);
437
+ properties.push([columnGapProperty, row]);
438
+ }
439
+ if (length > 1) {
440
+ const row = values[0];
441
+ const column = values[1];
442
+ properties.push([rowGapProperty, row]);
443
+ properties.push([columnGapProperty, column]);
444
+ }
445
+ }
446
+ return properties;
447
+ },
448
+ });
449
+ export const gridRowGapProperty = new ShorthandProperty({
450
+ name: 'gridRowGap',
451
+ cssName: 'grid-row-gap',
452
+ getter: function () {
453
+ return this.rowGap;
454
+ },
455
+ converter(value) {
456
+ return [[rowGapProperty, value]];
457
+ },
458
+ });
459
+ export const gridColumnGapProperty = new ShorthandProperty({
460
+ name: 'gridColumnGap',
461
+ cssName: 'grid-column-gap',
462
+ getter: function () {
463
+ return this.columnGap;
464
+ },
465
+ converter(value) {
466
+ return [[columnGapProperty, value]];
467
+ },
468
+ });
469
+ textAlignmentProperty.overrideHandlers({
470
+ name: 'textAlignment',
471
+ cssName: 'text-align',
472
+ valueChanged(target, oldValue, newValue) {
473
+ const view = getViewStyle(target.viewRef);
474
+ if (view) {
475
+ if (newValue) {
476
+ view.textAlignment = newValue;
477
+ }
478
+ else {
479
+ // Revert to old value if newValue is invalid
480
+ // @ts-ignore
481
+ target.textAlignment = oldValue;
482
+ }
483
+ }
484
+ },
485
+ });
486
+ function masonLengthParse(value) {
487
+ try {
488
+ return CoreLength.parse(value);
489
+ }
490
+ catch (e) {
491
+ return undefined;
492
+ }
493
+ }
494
+ function masonLengthPercentParse(value) {
495
+ try {
496
+ return CorePercentLength.parse(value);
497
+ }
498
+ catch (e) {
499
+ return undefined;
500
+ }
501
+ }
502
+ export const maxWidthProperty = new CssProperty({
503
+ name: 'maxWidth',
504
+ cssName: 'max-width',
505
+ defaultValue: 'auto',
506
+ // @ts-ignore
507
+ equalityComparer: CoreLength.equals,
508
+ // @ts-ignore
509
+ valueConverter: masonLengthParse,
510
+ valueChanged: (target, oldValue, newValue) => {
511
+ const view = getViewStyle(target.viewRef);
512
+ if (view) {
513
+ view.maxWidth = newValue;
514
+ }
515
+ else {
516
+ Trace.write(`${newValue} not set to view's property because ".viewRef" is cleared`, Trace.categories.Style, Trace.messageType.warn);
517
+ }
518
+ },
519
+ });
520
+ export const maxHeightProperty = new CssProperty({
521
+ name: 'maxHeight',
522
+ cssName: 'max-height',
523
+ defaultValue: 'auto',
524
+ // @ts-ignore
525
+ equalityComparer: CoreLength.equals,
526
+ // @ts-ignore
527
+ valueConverter: masonLengthParse,
528
+ valueChanged(target, oldValue, newValue) {
529
+ const view = getViewStyle(target.viewRef);
530
+ if (view) {
531
+ view.maxHeight = newValue;
532
+ }
533
+ },
534
+ });
535
+ export const insetProperty = new ShorthandProperty({
536
+ name: 'inset',
537
+ cssName: 'inset',
538
+ getter: function () {
539
+ if (this.top === this.right && this.top === this.bottom && this.top === this.left) {
540
+ if (typeof this.top === 'string') {
541
+ if (this.top === 'auto') {
542
+ return this.top;
543
+ }
544
+ const value = CorePercentLength.parse(this.top);
545
+ if (Number.isNaN(value)) {
546
+ return this.top;
547
+ }
548
+ else {
549
+ return CorePercentLength.convertToString(value);
550
+ }
551
+ }
552
+ }
553
+ if (CorePercentLength.equals(this.top, this.right) && CorePercentLength.equals(this.top, this.bottom) && CorePercentLength.equals(this.top, this.left)) {
554
+ return this.top;
555
+ }
556
+ return `${CorePercentLength.convertToString(this.paddingTop)} ${CorePercentLength.convertToString(this.paddingRight)} ${CorePercentLength.convertToString(this.paddingBottom)} ${CorePercentLength.convertToString(this.paddingLeft)}`;
557
+ },
558
+ converter: convertToInsets,
559
+ });
560
+ function parseShorthandPositioning(value) {
561
+ const arr = value.split(/[ ,]+/);
562
+ let top;
563
+ let right;
564
+ let bottom;
565
+ let left;
566
+ if (arr.length === 1) {
567
+ top = arr[0];
568
+ right = arr[0];
569
+ bottom = arr[0];
570
+ left = arr[0];
571
+ }
572
+ else if (arr.length === 2) {
573
+ top = arr[0];
574
+ bottom = arr[0];
575
+ right = arr[1];
576
+ left = arr[1];
577
+ }
578
+ else if (arr.length === 3) {
579
+ top = arr[0];
580
+ right = arr[1];
581
+ left = arr[1];
582
+ bottom = arr[2];
583
+ }
584
+ else if (arr.length === 4) {
585
+ top = arr[0];
586
+ right = arr[1];
587
+ bottom = arr[2];
588
+ left = arr[3];
589
+ }
590
+ else {
591
+ throw new Error('Expected 1, 2, 3 or 4 parameters. Actual: ' + value);
592
+ }
593
+ return {
594
+ top: top,
595
+ right: right,
596
+ bottom: bottom,
597
+ left: left,
598
+ };
599
+ }
600
+ function convertToInsets(value) {
601
+ if (typeof value === 'string' && value !== 'auto') {
602
+ const thickness = parseShorthandPositioning(value);
603
+ return [
604
+ [topProperty, masonLengthPercentParse(thickness.top)],
605
+ [rightProperty, masonLengthPercentParse(thickness.right)],
606
+ [bottomProperty, masonLengthPercentParse(thickness.bottom)],
607
+ [leftProperty, masonLengthPercentParse(thickness.left)],
608
+ ];
609
+ }
610
+ else {
611
+ return [
612
+ [topProperty, value],
613
+ [rightProperty, value],
614
+ [bottomProperty, value],
615
+ [leftProperty, value],
616
+ ];
617
+ }
618
+ }
619
+ export const leftProperty = new CssProperty({
620
+ name: 'left',
621
+ cssName: 'left',
622
+ defaultValue: 'auto',
623
+ // @ts-ignore
624
+ equalityComparer: CorePercentLength.equals,
625
+ // @ts-ignore
626
+ valueConverter: masonLengthPercentParse,
627
+ valueChanged(target, oldValue, newValue) {
628
+ const view = getViewStyle(target.viewRef);
629
+ if (view) {
630
+ view.left = newValue;
631
+ }
632
+ },
633
+ });
634
+ export const rightProperty = new CssProperty({
635
+ name: 'right',
636
+ cssName: 'right',
637
+ defaultValue: 'auto',
638
+ // @ts-ignore
639
+ equalityComparer: CorePercentLength.equals,
640
+ // @ts-ignore
641
+ valueConverter: masonLengthPercentParse,
642
+ valueChanged(target, oldValue, newValue) {
643
+ const view = getViewStyle(target.viewRef);
644
+ if (view) {
645
+ view.right = newValue;
646
+ }
647
+ },
648
+ });
649
+ export const topProperty = new CssProperty({
650
+ name: 'top',
651
+ cssName: 'top',
652
+ defaultValue: 'auto',
653
+ // @ts-ignore
654
+ equalityComparer: CorePercentLength.equals,
655
+ // @ts-ignore
656
+ valueConverter: masonLengthPercentParse,
657
+ valueChanged(target, oldValue, newValue) {
658
+ const view = getViewStyle(target.viewRef);
659
+ if (view) {
660
+ view.top = newValue;
661
+ }
662
+ },
663
+ });
664
+ export const bottomProperty = new CssProperty({
665
+ name: 'bottom',
666
+ cssName: 'bottom',
667
+ defaultValue: 'auto',
668
+ // @ts-ignore
669
+ equalityComparer: CorePercentLength.equals,
670
+ // @ts-ignore
671
+ valueConverter: masonLengthPercentParse,
672
+ valueChanged(target, oldValue, newValue) {
673
+ const view = getViewStyle(target.viewRef);
674
+ if (view) {
675
+ view.bottom = newValue;
676
+ }
677
+ },
678
+ });
679
+ export const positionProperty = new CssProperty({
680
+ name: 'position',
681
+ cssName: 'position',
682
+ defaultValue: 'relative',
683
+ valueChanged(target, oldValue, newValue) {
684
+ const view = getViewStyle(target.viewRef);
685
+ if (view) {
686
+ view.position = newValue;
687
+ }
688
+ },
689
+ });
690
+ export const boxSizingProperty = new CssProperty({
691
+ name: 'boxSizing',
692
+ cssName: 'box-sizing',
693
+ defaultValue: 'border-box',
694
+ valueChanged(target, oldValue, newValue) {
695
+ const view = getViewStyle(target.viewRef);
696
+ if (view) {
697
+ if (newValue) {
698
+ view.boxSizing = newValue;
699
+ }
700
+ else {
701
+ // Revert to old value if newValue is invalid
702
+ target.boxSizing = oldValue;
703
+ }
704
+ }
705
+ },
706
+ valueConverter(value) {
707
+ switch (value) {
708
+ case 'content-box':
709
+ case 'border-box':
710
+ return value;
711
+ default:
712
+ return undefined;
713
+ }
714
+ },
715
+ });
716
+ export const borderRadiusProperty = new CssProperty({
717
+ name: 'borderRadius',
718
+ cssName: 'border-radius',
719
+ });
720
+ alignItemsProperty.overrideHandlers({
721
+ name: 'alignItems',
722
+ cssName: 'align-items',
723
+ valueChanged(target, oldValue, newValue) {
724
+ const view = getViewStyle(target.viewRef);
725
+ if (view) {
726
+ if (newValue) {
727
+ view.alignItems = newValue;
728
+ }
729
+ else {
730
+ // Revert to old value if newValue is invalid
731
+ // @ts-ignore
732
+ target.alignItems = oldValue;
733
+ }
734
+ }
735
+ },
736
+ });
737
+ alignSelfProperty.overrideHandlers({
738
+ name: 'alignSelf',
739
+ cssName: 'align-self',
740
+ valueChanged(target, oldValue, newValue) {
741
+ const view = getViewStyle(target.viewRef);
742
+ if (view) {
743
+ if (newValue) {
744
+ view.alignSelf = newValue;
745
+ }
746
+ else {
747
+ // Revert to old value if newValue is invalid
748
+ // @ts-ignore
749
+ target.alignSelf = oldValue;
750
+ }
751
+ }
752
+ },
753
+ });
754
+ export const AlignContentIsValid = makeValidator('flex-start', 'flex-end', 'center', 'space-between', 'space-around', 'stretch');
755
+ export const AlignContentParse = makeParser(AlignContentIsValid);
756
+ export const alignContentProperty = new CssProperty({
757
+ name: 'alignContent',
758
+ cssName: 'align-content',
759
+ defaultValue: 'normal',
760
+ valueConverter: function (value) {
761
+ if (isMasonViewOrChild(this)) {
762
+ return value;
763
+ }
764
+ return AlignContentParse(value);
765
+ },
766
+ valueChanged(target, oldValue, newValue) {
767
+ const view = getViewStyle(target.viewRef);
768
+ if (view) {
769
+ if (newValue) {
770
+ view.alignContent = newValue;
771
+ }
772
+ else {
773
+ // Revert to old value if newValue is invalid
774
+ // @ts-ignore
775
+ target.alignContent = oldValue;
776
+ }
777
+ }
778
+ },
779
+ });
780
+ export const justifyItemsProperty = new CssProperty({
781
+ name: 'justifyItems',
782
+ cssName: 'justify-items',
783
+ defaultValue: 'normal',
784
+ valueChanged(target, oldValue, newValue) {
785
+ const view = getViewStyle(target.viewRef);
786
+ if (view) {
787
+ if (newValue) {
788
+ view.justifyItems = newValue;
789
+ }
790
+ else {
791
+ // Revert to old value if newValue is invalid
792
+ // @ts-ignore
793
+ target.justifyItems = oldValue;
794
+ }
795
+ }
796
+ },
797
+ });
798
+ export const justifySelfProperty = new CssProperty({
799
+ name: 'justifySelf',
800
+ cssName: 'justify-self',
801
+ defaultValue: 'normal',
802
+ valueChanged(target, oldValue, newValue) {
803
+ const view = getViewStyle(target.viewRef);
804
+ if (view) {
805
+ if (newValue) {
806
+ view.justifySelf = newValue;
807
+ }
808
+ else {
809
+ // Revert to old value if newValue is invalid
810
+ // @ts-ignore
811
+ target.justifySelf = oldValue;
812
+ }
813
+ }
814
+ },
815
+ });
816
+ export const JustifyContentIsValid = makeValidator('flex-start', 'flex-end', 'center', 'space-between', 'space-around');
817
+ export const JustifyContentParse = makeParser(JustifyContentIsValid);
818
+ justifyContentProperty.overrideHandlers({
819
+ name: 'justifyContent',
820
+ cssName: 'justify-content',
821
+ valueConverter: function (value) {
822
+ if (isMasonViewOrChild(this)) {
823
+ return value;
824
+ }
825
+ return JustifyContentParse(value);
826
+ },
827
+ valueChanged(target, oldValue, newValue) {
828
+ const view = getViewStyle(target.viewRef);
829
+ if (view) {
830
+ if (newValue) {
831
+ view.justifyContent = newValue;
832
+ }
833
+ else {
834
+ // Revert to old value if newValue is invalid
835
+ // @ts-ignore
836
+ target.justifyContent = oldValue;
837
+ }
838
+ }
839
+ },
840
+ });
841
+ export const flexBasisProperty = new CssProperty({
842
+ name: 'flexBasis',
843
+ cssName: 'flex-basis',
844
+ defaultValue: 'auto',
845
+ // @ts-ignore
846
+ equalityComparer: CoreLength.equals,
847
+ // @ts-ignore
848
+ valueConverter: masonLengthParse,
849
+ valueChanged(target, oldValue, newValue) {
850
+ const view = getViewStyle(target.viewRef);
851
+ if (view) {
852
+ view.flexBasis = newValue;
853
+ }
854
+ },
855
+ });
856
+ export const aspectRatioProperty = new CssProperty({
857
+ name: 'aspectRatio',
858
+ cssName: 'aspect-ratio',
859
+ defaultValue: Number.NaN,
860
+ valueChanged(target, oldValue, newValue) {
861
+ const view = getViewStyle(target.viewRef);
862
+ if (view) {
863
+ view.aspectRatio = newValue;
864
+ }
865
+ },
866
+ });
867
+ export const gridAutoRowsProperty = new CssProperty({
868
+ name: 'gridAutoRows',
869
+ cssName: 'grid-auto-rows',
870
+ defaultValue: '',
871
+ valueChanged(target, oldValue, newValue) {
872
+ const view = getViewStyle(target.viewRef);
873
+ if (view) {
874
+ view.gridAutoRows = newValue;
875
+ }
876
+ },
877
+ });
878
+ export const gridAutoColumnsProperty = new CssProperty({
879
+ name: 'gridAutoColumns',
880
+ cssName: 'grid-auto-columns',
881
+ defaultValue: '',
882
+ valueChanged(target, oldValue, newValue) {
883
+ const view = getViewStyle(target.viewRef);
884
+ if (view) {
885
+ view.gridAutoColumns = newValue;
886
+ }
887
+ },
888
+ });
889
+ export const gridAutoFlowProperty = new CssProperty({
890
+ name: 'gridAutoFlow',
891
+ cssName: 'grid-auto-flow',
892
+ defaultValue: 'row',
893
+ valueChanged(target, oldValue, newValue) {
894
+ const view = getViewStyle(target.viewRef);
895
+ if (view) {
896
+ view.gridAutoFlow = newValue;
897
+ }
898
+ },
899
+ });
900
+ export const gridAreaProperty = new CssProperty({
901
+ name: 'gridArea',
902
+ cssName: 'grid-area',
903
+ defaultValue: '',
904
+ valueChanged(target, oldValue, newValue) {
905
+ const view = getViewStyle(target.viewRef);
906
+ if (view) {
907
+ view.gridArea = newValue;
908
+ }
909
+ },
910
+ });
911
+ export const gridColumnStartProperty = new CssProperty({
912
+ name: 'gridColumnStart',
913
+ cssName: 'grid-column-start',
914
+ defaultValue: 'auto',
915
+ valueChanged(target, oldValue, newValue) {
916
+ const view = getViewStyle(target.viewRef);
917
+ if (view) {
918
+ view.gridColumnStart = newValue;
919
+ }
920
+ },
921
+ });
922
+ export const gridColumnEndProperty = new CssProperty({
923
+ name: 'gridColumnEnd',
924
+ cssName: 'grid-column-end',
925
+ defaultValue: 'auto',
926
+ valueChanged(target, oldValue, newValue) {
927
+ const view = getViewStyle(target.viewRef);
928
+ if (view) {
929
+ view.gridColumnEnd = newValue;
930
+ }
931
+ },
932
+ });
933
+ export const gridColumnProperty = new CssProperty({
934
+ name: 'gridColumn',
935
+ cssName: 'grid-column',
936
+ defaultValue: '',
937
+ valueChanged(target, oldValue, newValue) {
938
+ const view = getViewStyle(target.viewRef);
939
+ if (view) {
940
+ view.gridColumn = newValue;
941
+ }
942
+ },
943
+ });
944
+ export const gridRowStartProperty = new CssProperty({
945
+ name: 'gridRowStart',
946
+ cssName: 'grid-row-start',
947
+ defaultValue: 'auto',
948
+ valueChanged(target, oldValue, newValue) {
949
+ const view = getViewStyle(target.viewRef);
950
+ if (view) {
951
+ view.gridRowStart = newValue;
952
+ }
953
+ },
954
+ });
955
+ export const gridRowEndProperty = new CssProperty({
956
+ name: 'gridRowEnd',
957
+ cssName: 'grid-row-end',
958
+ defaultValue: 'auto',
959
+ valueChanged(target, oldValue, newValue) {
960
+ const view = getViewStyle(target.viewRef);
961
+ if (view) {
962
+ view.gridRowEnd = newValue;
963
+ }
964
+ },
965
+ });
966
+ export const gridRowProperty = new CssProperty({
967
+ name: 'gridRow',
968
+ cssName: 'grid-row',
969
+ defaultValue: '',
970
+ valueChanged(target, oldValue, newValue) {
971
+ const view = getViewStyle(target.viewRef);
972
+ if (view) {
973
+ view.gridRow = newValue;
974
+ }
975
+ },
976
+ });
977
+ export const gridTemplateAreasProperty = new CssProperty({
978
+ name: 'gridTemplateAreas',
979
+ cssName: 'grid-template-areas',
980
+ defaultValue: null,
981
+ valueChanged(target, oldValue, newValue) {
982
+ const view = getViewStyle(target.viewRef);
983
+ if (view) {
984
+ view.gridTemplateAreas = newValue;
985
+ }
986
+ },
987
+ });
988
+ export const gridTemplateRowsProperty = new CssProperty({
989
+ name: 'gridTemplateRows',
990
+ cssName: 'grid-template-rows',
991
+ defaultValue: null,
992
+ valueChanged(target, oldValue, newValue) {
993
+ const view = getViewStyle(target.viewRef);
994
+ if (view) {
995
+ view.gridTemplateRows = newValue;
996
+ }
997
+ },
998
+ });
999
+ export const gridTemplateColumnsProperty = new CssProperty({
1000
+ name: 'gridTemplateColumns',
1001
+ cssName: 'grid-template-columns',
1002
+ defaultValue: null,
1003
+ valueChanged(target, oldValue, newValue) {
1004
+ const view = getViewStyle(target.viewRef);
1005
+ if (view) {
1006
+ view.gridTemplateColumns = newValue;
1007
+ }
1008
+ },
1009
+ });
1010
+ // @ts-ignore
1011
+ export const textWrapProperty = new CssProperty({
1012
+ name: 'textWrap',
1013
+ affectsLayout: true,
1014
+ defaultValue: 'wrap',
1015
+ valueChanged(target, oldValue, newValue) {
1016
+ const view = target?.viewRef ? getViewStyle(target.viewRef) : target.view;
1017
+ if (view) {
1018
+ view.textWrap = newValue;
1019
+ }
1020
+ },
1021
+ });
1022
+ // flex-flow: <flex-direction> || <flex-wrap>
1023
+ const flexFlowProperty = new ShorthandProperty({
1024
+ name: 'flexFlow',
1025
+ cssName: 'flex-flow',
1026
+ getter: function () {
1027
+ return `${this.flexDirection} ${this.flexWrap}`;
1028
+ },
1029
+ converter: function (value) {
1030
+ const properties = [];
1031
+ if (value === unsetValue) {
1032
+ properties.push([flexDirectionProperty, value]);
1033
+ properties.push([flexWrapProperty, value]);
1034
+ }
1035
+ else {
1036
+ const trimmed = value && value.trim();
1037
+ if (trimmed) {
1038
+ const values = trimmed.split(/\s+/);
1039
+ if (values.length >= 1) {
1040
+ properties.push([flexDirectionProperty, values[0]]);
1041
+ }
1042
+ if (value.length >= 2) {
1043
+ properties.push([flexWrapProperty, values[1]]);
1044
+ }
1045
+ }
1046
+ }
1047
+ return properties;
1048
+ },
1049
+ });
1050
+ // flex: inital | auto | none | <flex-grow> <flex-shrink> || <flex-basis>
1051
+ const flexProperty = new ShorthandProperty({
1052
+ name: 'flex',
1053
+ cssName: 'flex',
1054
+ getter: function () {
1055
+ return `${this.flexGrow} ${this.flexShrink} ${this.flexBasis}`;
1056
+ },
1057
+ converter: function (value) {
1058
+ const properties = [];
1059
+ if (value === unsetValue) {
1060
+ properties.push([flexGrowProperty, value]);
1061
+ properties.push([flexShrinkProperty, value]);
1062
+ }
1063
+ else if (typeof value === 'number') {
1064
+ properties.push([flexGrowProperty, value]);
1065
+ properties.push([flexShrinkProperty, 1]);
1066
+ properties.push([flexBasisProperty, 'auto']);
1067
+ }
1068
+ else {
1069
+ const trimmed = value && value.trim();
1070
+ if (trimmed) {
1071
+ const values = trimmed.split(/\s+/);
1072
+ if (values.length === 1) {
1073
+ switch (values[0]) {
1074
+ case 'inital':
1075
+ properties.push([flexGrowProperty, 0]);
1076
+ properties.push([flexShrinkProperty, 1]);
1077
+ properties.push([flexBasisProperty, 'auto']);
1078
+ break;
1079
+ case 'auto':
1080
+ properties.push([flexGrowProperty, 1]);
1081
+ properties.push([flexShrinkProperty, 1]);
1082
+ properties.push([flexBasisProperty, 'auto']);
1083
+ break;
1084
+ case 'none':
1085
+ properties.push([flexGrowProperty, 0]);
1086
+ properties.push([flexShrinkProperty, 0]);
1087
+ properties.push([flexBasisProperty, 'auto']);
1088
+ break;
1089
+ default:
1090
+ properties.push([flexGrowProperty, values[0]]);
1091
+ properties.push([flexShrinkProperty, 1]);
1092
+ properties.push([flexBasisProperty, 'auto']);
1093
+ }
1094
+ }
1095
+ if (values.length >= 2) {
1096
+ properties.push([flexGrowProperty, values[0]]);
1097
+ properties.push([flexShrinkProperty, values[1]]);
1098
+ }
1099
+ if (value.length >= 3) {
1100
+ properties.push({ property: flexBasisProperty, value: values[2] });
1101
+ }
1102
+ }
1103
+ }
1104
+ return properties;
1105
+ },
1106
+ });
1107
+ export const textOverFlowProperty = new CssProperty({
1108
+ name: 'textOverflow',
1109
+ cssName: 'text-overflow',
1110
+ defaultValue: 'clip',
1111
+ valueChanged(target, oldValue, newValue) {
1112
+ const view = target?.viewRef ? getViewStyle(target.viewRef) : target.view;
1113
+ if (view) {
1114
+ view.textOverflow = newValue;
1115
+ }
1116
+ },
1117
+ });
1118
+ export const verticalAlignProperty = new CssProperty({
1119
+ name: 'verticalAlign',
1120
+ cssName: 'vertical-align',
1121
+ defaultValue: 'baseline',
1122
+ valueChanged: (target, oldValue, newValue) => {
1123
+ const view = getViewStyle(target.viewRef);
1124
+ if (view) {
1125
+ if (newValue) {
1126
+ view.verticalAlign = newValue;
1127
+ }
1128
+ else {
1129
+ // Revert to old value if newValue is invalid
1130
+ target.verticalAlign = oldValue;
1131
+ }
1132
+ }
1133
+ },
1134
+ });
1135
+ verticalAlignmentProperty.overrideHandlers({
1136
+ name: 'verticalAlignment',
1137
+ cssName: 'vertical-align',
1138
+ valueConverter: function (value) {
1139
+ if (isMasonViewOrChild(this)) {
1140
+ return value;
1141
+ }
1142
+ return CoreTypes.VerticalAlignmentText.parse(value);
1143
+ },
1144
+ valueChanged(target, oldValue, newValue) {
1145
+ const view = getViewStyle(target.viewRef);
1146
+ if (view) {
1147
+ if (newValue) {
1148
+ // @ts-ignore
1149
+ view.verticalAlign = newValue;
1150
+ }
1151
+ else {
1152
+ // Revert to old value if newValue is invalid
1153
+ // @ts-ignore
1154
+ target.verticalAlign = oldValue;
1155
+ }
1156
+ }
1157
+ },
1158
+ });
1159
+ textShadowProperty.overrideHandlers({
1160
+ name: 'textShadow',
1161
+ cssName: 'text-shadow',
1162
+ valueConverter: function (value) {
1163
+ return value;
1164
+ },
1165
+ valueChanged(target, oldValue, newValue) {
1166
+ const view = getViewStyle(target.viewRef);
1167
+ if (view) {
1168
+ view.textShadow = newValue;
1169
+ }
1170
+ else {
1171
+ // Revert to old value if newValue is invalid
1172
+ // @ts-ignore
1173
+ target.textShadow = oldValue;
1174
+ }
1175
+ },
1176
+ });
1177
+ export const floatProperty = new CssProperty({
1178
+ name: 'float',
1179
+ cssName: 'float',
1180
+ defaultValue: 'none',
1181
+ });
1182
+ export const clearProperty = new CssProperty({
1183
+ name: 'clear',
1184
+ cssName: 'clear',
1185
+ defaultValue: 'none',
1186
+ });
1187
+ export const cornerShapeProperty = new CssProperty({
1188
+ name: 'cornerShape',
1189
+ cssName: 'corner-shape',
1190
+ });
1191
+ export const boxShadowProperty = new CssProperty({
1192
+ name: 'boxShadow',
1193
+ cssName: 'box-shadow',
1194
+ });
1195
+ export const transformProperty = new CssProperty({
1196
+ name: 'transform',
1197
+ cssName: 'transform',
1198
+ });
1199
+ export const cornerShapeTopLeftProperty = new CssProperty({
1200
+ name: 'cornerShapeTopLeft',
1201
+ cssName: 'corner-shape-top-left',
1202
+ });
1203
+ export const cornerShapeTopRightProperty = new CssProperty({
1204
+ name: 'cornerShapeTopRight',
1205
+ cssName: 'corner-shape-top-right',
1206
+ });
1207
+ export const cornerShapeBottomRightProperty = new CssProperty({
1208
+ name: 'cornerShapeBottomRight',
1209
+ cssName: 'corner-shape-bottom-right',
1210
+ });
1211
+ export const cornerShapeBottomLeftProperty = new CssProperty({
1212
+ name: 'cornerShapeBottomLeft',
1213
+ cssName: 'corner-shape-bottom-left',
1214
+ });
1215
+ cornerShapeProperty.register(Style);
1216
+ boxShadowProperty.register(Style);
1217
+ transformProperty.register(Style);
1218
+ cornerShapeTopLeftProperty.register(Style);
1219
+ cornerShapeTopRightProperty.register(Style);
1220
+ cornerShapeBottomRightProperty.register(Style);
1221
+ cornerShapeBottomLeftProperty.register(Style);
1222
+ clearProperty.register(Style);
1223
+ floatProperty.register(Style);
1224
+ verticalAlignProperty.register(Style);
1225
+ textOverFlowProperty.register(Style);
1226
+ flexProperty.register(Style);
1227
+ flexFlowProperty.register(Style);
1228
+ textWrapProperty.register(Style);
1229
+ gridTemplateColumnsProperty.register(Style);
1230
+ gridTemplateRowsProperty.register(Style);
1231
+ alignContentProperty.register(Style);
1232
+ justifySelfProperty.register(Style);
1233
+ justifyItemsProperty.register(Style);
1234
+ gridTemplateAreasProperty.register(Style);
1235
+ gridRowProperty.register(Style);
1236
+ gridRowStartProperty.register(Style);
1237
+ gridRowEndProperty.register(Style);
1238
+ gridColumnProperty.register(Style);
1239
+ gridColumnEndProperty.register(Style);
1240
+ gridColumnStartProperty.register(Style);
1241
+ gridAreaProperty.register(Style);
1242
+ gridAutoFlowProperty.register(Style);
1243
+ gridAutoRowsProperty.register(Style);
1244
+ gridAutoColumnsProperty.register(Style);
1245
+ aspectRatioProperty.register(Style);
1246
+ flexBasisProperty.register(Style);
1247
+ borderRadiusProperty.register(Style);
1248
+ boxSizingProperty.register(Style);
1249
+ positionProperty.register(Style);
1250
+ insetProperty.register(Style);
1251
+ leftProperty.register(Style);
1252
+ rightProperty.register(Style);
1253
+ topProperty.register(Style);
1254
+ bottomProperty.register(Style);
1255
+ maxWidthProperty.register(Style);
1256
+ maxHeightProperty.register(Style);
1257
+ gridRowGapProperty.register(Style);
1258
+ gridColumnGapProperty.register(Style);
1259
+ gridGapProperty.register(Style);
1260
+ gapProperty.register(Style);
1261
+ rowGapProperty.register(Style);
1262
+ columnGapProperty.register(Style);
1263
+ scrollBarWidthProperty.register(Style);
1264
+ marginProperty.register(Style);
1265
+ overflowProperty.register(Style);
1266
+ overflowXProperty.register(Style);
1267
+ overflowYProperty.register(Style);
1268
+ backgroundProperty.register(Style);
1269
+ backgroundRepeatProperty.register(Style);
1270
+ backgroundPositionProperty.register(Style);
1271
+ backgroundSizeProperty.register(Style);
1272
+ backgroundClipProperty.register(Style);
1273
+ borderProperty.register(Style);
1274
+ borderLeftProperty.register(Style);
1275
+ borderTopProperty.register(Style);
1276
+ borderRightProperty.register(Style);
1277
+ borderBottomProperty.register(Style);
1278
+ filterProperty.register(Style);
1279
+ // New CSS properties
1280
+ export const objectPositionProperty = new CssProperty({
1281
+ name: 'objectPosition',
1282
+ cssName: 'object-position',
1283
+ defaultValue: '50% 50%',
1284
+ });
1285
+ export const borderStyleProperty = new CssProperty({
1286
+ name: 'borderStyle',
1287
+ cssName: 'border-style',
1288
+ defaultValue: 'none',
1289
+ });
1290
+ export const borderImageProperty = new CssProperty({
1291
+ name: 'borderImage',
1292
+ cssName: 'border-image',
1293
+ });
1294
+ export const fontStretchProperty = new CssProperty({
1295
+ name: 'fontStretch',
1296
+ cssName: 'font-stretch',
1297
+ defaultValue: 'normal',
1298
+ });
1299
+ export const fontFeatureSettingsProperty = new CssProperty({
1300
+ name: 'fontFeatureSettings',
1301
+ cssName: 'font-feature-settings',
1302
+ defaultValue: 'normal',
1303
+ });
1304
+ export const wordSpacingProperty = new CssProperty({
1305
+ name: 'wordSpacing',
1306
+ cssName: 'word-spacing',
1307
+ defaultValue: 'normal',
1308
+ });
1309
+ export const hyphensProperty = new CssProperty({
1310
+ name: 'hyphens',
1311
+ cssName: 'hyphens',
1312
+ defaultValue: 'manual',
1313
+ });
1314
+ export const backdropFilterProperty = new CssProperty({
1315
+ name: 'backdropFilter',
1316
+ cssName: 'backdrop-filter',
1317
+ });
1318
+ export const writingModeProperty = new CssProperty({
1319
+ name: 'writingMode',
1320
+ cssName: 'writing-mode',
1321
+ defaultValue: 'horizontal-tb',
1322
+ });
1323
+ export const unicodeBidiProperty = new CssProperty({
1324
+ name: 'unicodeBidi',
1325
+ cssName: 'unicode-bidi',
1326
+ defaultValue: 'normal',
1327
+ });
1328
+ export const caretColorProperty = new CssProperty({
1329
+ name: 'caretColor',
1330
+ cssName: 'caret-color',
1331
+ defaultValue: 'auto',
1332
+ });
1333
+ objectPositionProperty.register(Style);
1334
+ borderStyleProperty.register(Style);
1335
+ borderImageProperty.register(Style);
1336
+ fontStretchProperty.register(Style);
1337
+ fontFeatureSettingsProperty.register(Style);
1338
+ wordSpacingProperty.register(Style);
1339
+ hyphensProperty.register(Style);
1340
+ backdropFilterProperty.register(Style);
1341
+ writingModeProperty.register(Style);
1342
+ unicodeBidiProperty.register(Style);
1343
+ caretColorProperty.register(Style);
1344
+ displayProperty.register(Style);
1345
+ //# sourceMappingURL=properties.js.map