@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/index.d.ts CHANGED
@@ -1,8 +1,10 @@
1
- import { CoreTypes } from '@nativescript/core';
1
+ import { Color, CoreTypes } from '@nativescript/core';
2
2
 
3
3
  import { TextBase, ViewBase } from './common';
4
4
  import { LengthPercentage } from '@nativescript/core/css/parser';
5
5
 
6
+ export type InputType = 'text' | 'password' | 'email' | 'number' | 'tel' | 'url' | 'search' | 'date' | 'time' | 'datetime-local' | 'month' | 'week' | 'color' | 'checkbox' | 'radio' | 'button' | 'submit' | 'reset' | 'file' | 'range';
7
+
6
8
  export type Length = CoreTypes.dip | CoreTypes.LengthDipUnit | CoreTypes.LengthPxUnit | CoreTypes.LengthPercentUnit | `${number}px` | `${number}%` | `${number}dip`;
7
9
 
8
10
  export type LengthAuto = CoreTypes.dip | CoreTypes.LengthDipUnit | CoreTypes.LengthPxUnit | CoreTypes.LengthPercentUnit | 'auto' | `${number}px` | `${number}%` | `${number}dip`;
@@ -41,6 +43,10 @@ export type GridAutoFlow = 'row' | 'column' | 'row dense' | 'column dense' | 'de
41
43
 
42
44
  export type VerticalAlign = 'baseline' | 'sub' | 'super' | 'text-top' | 'text-bottom' | 'middle' | 'top' | 'bottom' | Length | number;
43
45
 
46
+ export type Float = 'left' | 'right' | 'none';
47
+
48
+ export type Clear = 'left' | 'right' | 'both' | 'none';
49
+
44
50
  declare module '@nativescript/core/ui/styling/style' {
45
51
  interface Style {
46
52
  boxSizing: BoxSizing;
@@ -86,11 +92,34 @@ declare module '@nativescript/core/ui/styling/style' {
86
92
  gridRowEnd: string;
87
93
  gridTemplateRows: string;
88
94
  gridTemplateColumns: string;
95
+ gridTemplateAreas: string;
96
+ textOverflow: 'clip' | 'ellipsis' | string;
97
+ textWrap: 'nowrap' | 'wrap' | 'balance';
89
98
  overflow: Overflow | `${Overflow} ${Overflow}`;
90
99
  overflowX: Overflow;
91
100
  overflowY: Overflow;
92
101
  scrollBarWidth: Length;
93
102
  verticalAlign: VerticalAlign;
103
+ cornerShape: string;
104
+ cornerShapeTopLeft: string;
105
+ cornerShapeTopRight: string;
106
+ cornerShapeBottomRight: string;
107
+ cornerShapeBottomLeft: string;
108
+ objectPosition: string;
109
+ borderStyle: string;
110
+ borderLeftStyle: string;
111
+ borderRightStyle: string;
112
+ borderTopStyle: string;
113
+ borderBottomStyle: string;
114
+ borderImage: string;
115
+ fontStretch: string;
116
+ fontFeatureSettings: string;
117
+ wordSpacing: string;
118
+ hyphens: 'none' | 'manual' | 'auto';
119
+ writingMode: 'horizontal-tb' | 'horizontal-lr' | 'vertical-rl' | 'vertical-lr';
120
+ unicodeBidi: 'normal' | 'embed' | 'bidi-override';
121
+ backdropFilter: string;
122
+ caretColor: string | Color;
94
123
  }
95
124
  }
96
125
 
@@ -138,11 +167,34 @@ interface Style {
138
167
  gridRowEnd: string;
139
168
  gridTemplateRows: string;
140
169
  gridTemplateColumns: string;
170
+ gridTemplateAreas: string;
171
+ textOverflow: 'clip' | 'ellipsis' | string;
172
+ textWrap: 'nowrap' | 'wrap' | 'balance';
141
173
  overflow: Overflow | `${Overflow} ${Overflow}`;
142
174
  overflowX: Overflow;
143
175
  overflowY: Overflow;
144
176
  scrollBarWidth: Length;
145
177
  verticalAlign: VerticalAlign;
178
+ cornerShape: string;
179
+ cornerShapeTopLeft: string;
180
+ cornerShapeTopRight: string;
181
+ cornerShapeBottomRight: string;
182
+ cornerShapeBottomLeft: string;
183
+ objectPosition: string;
184
+ borderStyle: string;
185
+ borderLeftStyle: string;
186
+ borderRightStyle: string;
187
+ borderTopStyle: string;
188
+ borderBottomStyle: string;
189
+ borderImage: string;
190
+ fontStretch: string;
191
+ fontFeatureSettings: string;
192
+ wordSpacing: string;
193
+ hyphens: 'none' | 'manual' | 'auto';
194
+ writingMode: 'horizontal-tb' | 'horizontal-lr' | 'vertical-rl' | 'vertical-lr';
195
+ unicodeBidi: 'normal' | 'embed' | 'bidi-override';
196
+ backdropFilter: string;
197
+ caretColor: string | Color;
146
198
  }
147
199
 
148
200
  interface IViewBase {
@@ -188,20 +240,67 @@ interface IViewBase {
188
240
  gridRowEnd: string;
189
241
  gridTemplateRows: string;
190
242
  gridTemplateColumns: string;
243
+ gridTemplateAreas: string;
244
+ textOverflow: 'clip' | 'ellipsis' | string;
245
+ textWrap: 'nowrap' | 'wrap' | 'balance';
191
246
  overflow: Overflow;
192
247
  overflowX: Overflow;
193
248
  overflowY: Overflow;
194
249
  scrollBarWidth: number | CoreTypes.LengthType;
195
250
  verticalAlign: VerticalAlign;
251
+ cornerShape: string;
252
+ cornerShapeTopLeft: string;
253
+ cornerShapeTopRight: string;
254
+ cornerShapeBottomRight: string;
255
+ cornerShapeBottomLeft: string;
256
+ objectPosition: string;
257
+ borderStyle: string;
258
+ borderLeftStyle: string;
259
+ borderRightStyle: string;
260
+ borderTopStyle: string;
261
+ borderBottomStyle: string;
262
+ borderImage: string;
263
+ fontStretch: string;
264
+ fontFeatureSettings: string;
265
+ wordSpacing: string;
266
+ hyphens: 'none' | 'manual' | 'auto';
267
+ writingMode: 'horizontal-tb' | 'horizontal-lr' | 'vertical-rl' | 'vertical-lr';
268
+ unicodeBidi: 'normal' | 'embed' | 'bidi-override';
269
+ backdropFilter: string;
270
+ caretColor: string | Color;
196
271
  }
197
272
 
198
273
  class VBase extends ViewBase implements IViewBase {
199
274
  style: Style;
275
+
276
+ /**
277
+ * Enable or disable CSS defaults
278
+ * for the entire Mason tree.
279
+ *
280
+ * When `true` every element starts from a clean, browser-normalised slate:
281
+ * - `box-sizing: border-box`
282
+ * - `margin: 0`, `padding: 0`, `border-width: 0`
283
+ * - `background: transparent`
284
+ * - `list-style: none` on lists
285
+ * - `display: block` on `<img>`
286
+ *
287
+ * This is a **tree-global** flag; set it **before** creating views for the
288
+ * cleanest result.
289
+ *
290
+ * @example
291
+ * ```ts
292
+ * import { View } from '@triniwiz/nativescript-masonkit';
293
+ * View.preflight = true; // enable at app startup
294
+ * ```
295
+ */
296
+ static preflight: boolean;
200
297
  }
201
298
 
202
299
  export class View extends VBase {}
203
300
 
204
- export class TextBase extends VBase {}
301
+ export class TextBase extends VBase {
302
+ textContent: string;
303
+ }
205
304
 
206
305
  export class Text extends TextBase {}
207
306
 
@@ -214,3 +313,31 @@ export class Scroll extends VBase {}
214
313
  export class Button extends TextBase {}
215
314
 
216
315
  export class Br extends TextBase {}
316
+
317
+ export class InputBase extends VBase {}
318
+
319
+ export class Input extends InputBase {}
320
+
321
+ export class TextNode {
322
+ data: string;
323
+
324
+ readonly length: number;
325
+
326
+ appendData(s: string): this;
327
+
328
+ deleteData(offset: number, count: number): this;
329
+
330
+ insertData(s: string, offset: number): this;
331
+
332
+ substringData(offset: number, count: number): string;
333
+ }
334
+
335
+ export class Ul extends VBase {}
336
+
337
+ export class Ol extends VBase {}
338
+
339
+ export class Li extends VBase {}
340
+
341
+ export class TextAreaBase extends InputBase {}
342
+
343
+ export class TextArea extends TextAreaBase {}
package/index.ios.d.ts CHANGED
@@ -1,6 +1,12 @@
1
1
  export { View } from './view';
2
2
  export { Img } from './img';
3
- export { Text, Br } from './text';
3
+ export { Text } from './text';
4
4
  export { Scroll } from './scroll';
5
5
  export { Button } from './button';
6
+ export { Input } from './input';
7
+ export { Br } from './br';
8
+ export { TextNode } from './text-node';
9
+ export { Li } from './li';
10
+ export { OrderedList as Ol, UnorderedList as Ul } from './list';
11
+ export { TextArea } from './textarea';
6
12
  export * from './web';
package/index.ios.js CHANGED
@@ -1,7 +1,13 @@
1
1
  export { View } from './view';
2
2
  export { Img } from './img';
3
- export { Text, Br } from './text';
3
+ export { Text } from './text';
4
4
  export { Scroll } from './scroll';
5
5
  export { Button } from './button';
6
+ export { Input } from './input';
7
+ export { Br } from './br';
8
+ export { TextNode } from './text-node';
9
+ export { Li } from './li';
10
+ export { OrderedList as Ol, UnorderedList as Ul } from './list';
11
+ export { TextArea } from './textarea';
6
12
  export * from './web';
7
13
  //# sourceMappingURL=index.ios.js.map
package/index.ios.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.ios.js","sourceRoot":"","sources":["../../../packages/nativescript-masonkit/index.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,cAAc,OAAO,CAAC"}
1
+ {"version":3,"file":"index.ios.js","sourceRoot":"","sources":["../../../packages/nativescript-masonkit/index.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAE,WAAW,IAAI,EAAE,EAAE,aAAa,IAAI,EAAE,EAAE,MAAM,QAAQ,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,cAAc,OAAO,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { Property } from '@nativescript/core';
2
+ import { ViewBase } from '../common';
3
+ import { InputType } from '..';
4
+ export declare const defaultValueProperty: unique symbol;
5
+ export declare const getValueProperty: unique symbol;
6
+ export declare const setValueProperty: unique symbol;
7
+ export declare const pendingValue: unique symbol;
8
+ export declare class InputBase extends ViewBase {
9
+ [pendingValue]: any;
10
+ [defaultValueProperty](): any;
11
+ [getValueProperty](): any;
12
+ [setValueProperty](value: string): void;
13
+ get value(): string;
14
+ set value(value: string);
15
+ initNativeView(): void;
16
+ }
17
+ export declare const typeProperty: Property<InputBase, InputType>;
18
+ export declare const placeholderProperty: Property<InputBase, string>;
19
+ export declare const multipleProperty: Property<InputBase, boolean>;
20
+ export declare const acceptProperty: Property<InputBase, string>;
@@ -0,0 +1,65 @@
1
+ var _a;
2
+ import { booleanConverter, Property } from '@nativescript/core';
3
+ import { ViewBase } from '../common';
4
+ import { native_ } from '../symbols';
5
+ export const defaultValueProperty = Symbol('input:default:value');
6
+ export const getValueProperty = Symbol('input:get:value');
7
+ export const setValueProperty = Symbol('input:set:value');
8
+ export const pendingValue = Symbol('input:pending:value');
9
+ export class InputBase extends ViewBase {
10
+ constructor() {
11
+ super(...arguments);
12
+ this[_a] = null;
13
+ }
14
+ [(_a = pendingValue, defaultValueProperty)]() {
15
+ return undefined;
16
+ }
17
+ [getValueProperty]() {
18
+ return undefined;
19
+ }
20
+ //@ts-ignore
21
+ [setValueProperty](value) { }
22
+ get value() {
23
+ if (!this[native_]) {
24
+ const defaultValue = this[defaultValueProperty];
25
+ return defaultValue !== undefined || defaultValue !== null ? defaultValue() : undefined;
26
+ }
27
+ return this[getValueProperty]();
28
+ }
29
+ set value(value) {
30
+ if (!this[native_]) {
31
+ this[pendingValue] = value;
32
+ return;
33
+ }
34
+ this[setValueProperty](value);
35
+ }
36
+ initNativeView() {
37
+ super.initNativeView();
38
+ if (this[pendingValue] !== null) {
39
+ this[setValueProperty](this[pendingValue]);
40
+ this[pendingValue] = null;
41
+ }
42
+ }
43
+ }
44
+ export const typeProperty = new Property({
45
+ name: 'type',
46
+ defaultValue: 'text',
47
+ });
48
+ typeProperty.register(InputBase);
49
+ export const placeholderProperty = new Property({
50
+ name: 'placeholder',
51
+ defaultValue: '',
52
+ });
53
+ placeholderProperty.register(InputBase);
54
+ export const multipleProperty = new Property({
55
+ name: 'multiple',
56
+ defaultValue: false,
57
+ valueConverter: booleanConverter,
58
+ });
59
+ multipleProperty.register(InputBase);
60
+ export const acceptProperty = new Property({
61
+ name: 'accept',
62
+ defaultValue: '*/*',
63
+ });
64
+ acceptProperty.register(InputBase);
65
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../packages/nativescript-masonkit/input/common.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC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AAK,CAAC,cAAc,EAAE,CAAC;QACvB,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,IAAI,EAAE,CAAC;YAChC,IAAI,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;YAC3C,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;QAC5B,CAAC;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,QAAQ,CAAuB;IAC7D,IAAI,EAAE,MAAM;IACZ,YAAY,EAAE,MAAM;CACrB,CAAC,CAAC;AAEH,YAAY,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAEjC,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,QAAQ,CAAoB;IACjE,IAAI,EAAE,aAAa;IACnB,YAAY,EAAE,EAAE;CACjB,CAAC,CAAC;AAEH,mBAAmB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAExC,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,QAAQ,CAAqB;IAC/D,IAAI,EAAE,UAAU;IAChB,YAAY,EAAE,KAAK;IACnB,cAAc,EAAE,gBAAgB;CACjC,CAAC,CAAC;AAEH,gBAAgB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAErC,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,QAAQ,CAAoB;IAC5D,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,KAAK;CACpB,CAAC,CAAC;AAEH,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { defaultValueProperty, getValueProperty, InputBase, setValueProperty } from './common';
2
+ import { style_ } from '../symbols';
3
+ export declare class Input extends InputBase {
4
+ [style_]: any;
5
+ _inBatch: boolean;
6
+ constructor();
7
+ private _type;
8
+ private getType;
9
+ [defaultValueProperty](): string;
10
+ [getValueProperty](): string;
11
+ [setValueProperty](value: any): void;
12
+ set valueAsNumber(value: number);
13
+ get valueAsNumber(): number;
14
+ set valueAsDate(value: Date | null);
15
+ get valueAsDate(): Date | null;
16
+ get _view(): org.nativescript.mason.masonkit.Input;
17
+ get _styleHelper(): any;
18
+ createNativeView(): org.nativescript.mason.masonkit.Input;
19
+ get android(): org.nativescript.mason.masonkit.Input;
20
+ }
@@ -0,0 +1,118 @@
1
+ import { CSSType, Utils } from '@nativescript/core';
2
+ import { defaultValueProperty, getValueProperty, InputBase, multipleProperty, setValueProperty, placeholderProperty, typeProperty } from './common';
3
+ import { Tree } from '../tree';
4
+ import { Style } from '../style';
5
+ import { style_, isMasonView_, native_ } from '../symbols';
6
+ let Input = class Input extends InputBase {
7
+ constructor() {
8
+ super();
9
+ this._inBatch = false;
10
+ this._type = 'text';
11
+ this[isMasonView_] = true;
12
+ }
13
+ getType() {
14
+ switch (this._type) {
15
+ case 'text':
16
+ return org.nativescript.mason.masonkit.Input.Type.Text;
17
+ case 'button':
18
+ return org.nativescript.mason.masonkit.Input.Type.Button;
19
+ case 'checkbox':
20
+ return org.nativescript.mason.masonkit.Input.Type.Checkbox;
21
+ case 'email':
22
+ return org.nativescript.mason.masonkit.Input.Type.Email;
23
+ case 'password':
24
+ return org.nativescript.mason.masonkit.Input.Type.Password;
25
+ case 'date':
26
+ return org.nativescript.mason.masonkit.Input.Type.Date;
27
+ case 'radio':
28
+ return org.nativescript.mason.masonkit.Input.Type.Radio;
29
+ case 'number':
30
+ return org.nativescript.mason.masonkit.Input.Type.Number;
31
+ case 'range':
32
+ return org.nativescript.mason.masonkit.Input.Type.Range;
33
+ case 'tel':
34
+ return org.nativescript.mason.masonkit.Input.Type.Tel;
35
+ case 'url':
36
+ return org.nativescript.mason.masonkit.Input.Type.Url;
37
+ case 'color':
38
+ return org.nativescript.mason.masonkit.Input.Type.Color;
39
+ case 'file':
40
+ return org.nativescript.mason.masonkit.Input.Type.File;
41
+ case 'submit':
42
+ return org.nativescript.mason.masonkit.Input.Type.Submit;
43
+ }
44
+ return org.nativescript.mason.masonkit.Input.Type.Text;
45
+ }
46
+ [multipleProperty.setNative](value) {
47
+ this._type = value;
48
+ if (this._view) {
49
+ //@ts-ignore
50
+ this._view.setMultiple(value);
51
+ }
52
+ }
53
+ [defaultValueProperty]() {
54
+ return '';
55
+ }
56
+ [getValueProperty]() {
57
+ return this._view.getValue();
58
+ }
59
+ [setValueProperty](value) {
60
+ this._view.setValue(value);
61
+ }
62
+ [typeProperty.setNative](value) {
63
+ this._type = value;
64
+ if (this._view) {
65
+ this._view.setType(this.getType());
66
+ }
67
+ }
68
+ [placeholderProperty.setNative](value) {
69
+ if (this._view) {
70
+ this._view.setPlaceholder(value);
71
+ }
72
+ }
73
+ set valueAsNumber(value) {
74
+ if (this._view) {
75
+ this._view.setValueAsNumber(value);
76
+ }
77
+ }
78
+ get valueAsNumber() {
79
+ return this._view ? this._view.getValueAsNumber() : NaN;
80
+ }
81
+ set valueAsDate(value) {
82
+ if (this._view) {
83
+ this._view.setValueAsDate(Utils.dataSerialize(value));
84
+ }
85
+ }
86
+ get valueAsDate() {
87
+ return this._view ? Utils.dataDeserialize(this._view.getValueAsDate()) : null;
88
+ }
89
+ get _view() {
90
+ if (!this[native_]) {
91
+ const context = Utils.android.getCurrentActivity() || Utils.android.getApplicationContext();
92
+ const view = Tree.instance.createInputView(context, this._type);
93
+ this[native_] = view;
94
+ return view;
95
+ }
96
+ return this[native_];
97
+ }
98
+ get _styleHelper() {
99
+ if (this[style_] === undefined) {
100
+ this[style_] = Style.fromView(this, this._view);
101
+ }
102
+ return this[style_];
103
+ }
104
+ createNativeView() {
105
+ return this._view;
106
+ }
107
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
108
+ // @ts-ignore
109
+ get android() {
110
+ return this._view;
111
+ }
112
+ };
113
+ Input = __decorate([
114
+ CSSType('input'),
115
+ __metadata("design:paramtypes", [])
116
+ ], Input);
117
+ export { Input };
118
+ //# sourceMappingURL=index.android.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.android.js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{ defaultValueProperty, getValueProperty, InputBase, setValueProperty } from './common';
2
+ import { style_ } from '../symbols';
3
+ import { Style } from '../style';
4
+ export declare class Input extends InputBase {
5
+ [style_]: any;
6
+ private _type;
7
+ private getType;
8
+ constructor();
9
+ [defaultValueProperty](): string;
10
+ [getValueProperty](): string;
11
+ [setValueProperty](value: any): void;
12
+ set valueAsNumber(value: number);
13
+ get valueAsNumber(): number;
14
+ set valueAsDate(value: Date | null);
15
+ get valueAsDate(): Date | null;
16
+ get _view(): MasonInput;
17
+ get _styleHelper(): Style;
18
+ _inBatch: boolean;
19
+ createNativeView(): MasonInput;
20
+ get ios(): MasonInput;
21
+ onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;
22
+ _setNativeViewFrame(nativeView: any, frame: CGRect): void;
23
+ }
@@ -0,0 +1,171 @@
1
+ import { CSSType, Utils } from '@nativescript/core';
2
+ import { acceptProperty, defaultValueProperty, getValueProperty, InputBase, multipleProperty, setValueProperty } from './common';
3
+ import { style_, isMasonView_, native_ } from '../symbols';
4
+ import { Tree } from '../tree';
5
+ import { placeholderProperty, typeProperty } from './common';
6
+ import { Style } from '../style';
7
+ let Input = class Input extends InputBase {
8
+ getType() {
9
+ switch (this._type) {
10
+ case 'text':
11
+ return 0 /* MasonInputType.Text */;
12
+ case 'button':
13
+ return 1 /* MasonInputType.Button */;
14
+ case 'checkbox':
15
+ return 2 /* MasonInputType.Checkbox */;
16
+ case 'email':
17
+ return 3 /* MasonInputType.Email */;
18
+ case 'password':
19
+ return 4 /* MasonInputType.Password */;
20
+ case 'date':
21
+ return 5 /* MasonInputType.Date */;
22
+ case 'radio':
23
+ return 6 /* MasonInputType.Radio */;
24
+ case 'number':
25
+ return 7 /* MasonInputType.Number */;
26
+ case 'range':
27
+ return 8 /* MasonInputType.Range */;
28
+ case 'tel':
29
+ return 9 /* MasonInputType.Tel */;
30
+ case 'url':
31
+ return 10 /* MasonInputType.Url */;
32
+ case 'color':
33
+ return 11 /* MasonInputType.Color */;
34
+ case 'file':
35
+ return 12 /* MasonInputType.File */;
36
+ case 'submit':
37
+ return 13 /* MasonInputType.Submit */;
38
+ }
39
+ return 0 /* MasonInputType.Text */;
40
+ }
41
+ constructor() {
42
+ super();
43
+ this._type = 'text';
44
+ this._inBatch = false;
45
+ this[isMasonView_] = true;
46
+ }
47
+ [multipleProperty.setNative](value) {
48
+ this._type = value;
49
+ if (this._view) {
50
+ this._view.multiple = value;
51
+ }
52
+ }
53
+ [defaultValueProperty]() {
54
+ return '';
55
+ }
56
+ [getValueProperty]() {
57
+ return this._view.value;
58
+ }
59
+ [setValueProperty](value) {
60
+ this._view.value = value;
61
+ }
62
+ set valueAsNumber(value) {
63
+ if (this._view) {
64
+ this._view.valueAsNumber = value;
65
+ }
66
+ }
67
+ get valueAsNumber() {
68
+ return this._view ? this._view.valueAsNumber : NaN;
69
+ }
70
+ set valueAsDate(value) {
71
+ if (this._view) {
72
+ this._view.valueAsDate = value;
73
+ }
74
+ }
75
+ get valueAsDate() {
76
+ return this._view ? this._view.valueAsDate : null;
77
+ }
78
+ [typeProperty.setNative](value) {
79
+ this._type = value;
80
+ if (this._view) {
81
+ this._view.type = this.getType();
82
+ }
83
+ }
84
+ [placeholderProperty.setNative](value) {
85
+ if (this._view) {
86
+ this._view.placeholder = value;
87
+ }
88
+ }
89
+ [acceptProperty.setNative](value) {
90
+ if (this._view) {
91
+ this._view.accept = value;
92
+ }
93
+ }
94
+ get _view() {
95
+ if (!this[native_]) {
96
+ const view = Tree.instance.createInputView(null, this._type);
97
+ this[native_] = view;
98
+ return view;
99
+ }
100
+ return this[native_];
101
+ }
102
+ get _styleHelper() {
103
+ if (this[style_] === undefined) {
104
+ this[style_] = Style.fromView(this, this._view);
105
+ }
106
+ return this[style_];
107
+ }
108
+ createNativeView() {
109
+ return this._view;
110
+ }
111
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
112
+ // @ts-ignore
113
+ get ios() {
114
+ return this._view;
115
+ }
116
+ onMeasure(widthMeasureSpec, heightMeasureSpec) {
117
+ const nativeView = this._view;
118
+ if (nativeView) {
119
+ const specWidth = Utils.layout.getMeasureSpecSize(widthMeasureSpec);
120
+ const widthMode = Utils.layout.getMeasureSpecMode(widthMeasureSpec);
121
+ const specHeight = Utils.layout.getMeasureSpecSize(heightMeasureSpec);
122
+ const heightMode = Utils.layout.getMeasureSpecMode(heightMeasureSpec);
123
+ if (!this[isMasonView_]) {
124
+ // when operating as a root/non‑Mason parent element we need to
125
+ // decide between computing with an explicit size or using the
126
+ // content-driven fallback. previous logic always used
127
+ // mason_computeWithSize for auto/auto which collapses when the
128
+ // incoming spec is UNSPECIFIED (a common case for the root). detect
129
+ // that and treat it as unconstrained instead.
130
+ const unconstrained = widthMode === Utils.layout.UNSPECIFIED || heightMode === Utils.layout.UNSPECIFIED || (widthMode === Utils.layout.AT_MOST && specWidth === 0) || (heightMode === Utils.layout.AT_MOST && specHeight === 0);
131
+ if (this.width === 'auto' && this.height === 'auto' && !unconstrained) {
132
+ // @ts-ignore
133
+ this.ios.mason_computeWithSize(specWidth, specHeight);
134
+ // @ts-ignore
135
+ const layout = this.ios.mason_layout();
136
+ const w = Utils.layout.makeMeasureSpec(layout.width, Utils.layout.EXACTLY);
137
+ const h = Utils.layout.makeMeasureSpec(layout.height, Utils.layout.EXACTLY);
138
+ this.setMeasuredDimension(w, h);
139
+ return;
140
+ }
141
+ else {
142
+ // either we have fixed dimensions or the spec did not constrain us
143
+ // – compute using max-content so the view can grow to its children.
144
+ // @ts-ignore
145
+ this.ios.mason_computeWithMaxContent();
146
+ // @ts-ignore
147
+ const layout = this.ios.node.computedLayout;
148
+ const w = Utils.layout.makeMeasureSpec(layout.width, Utils.layout.EXACTLY);
149
+ const h = Utils.layout.makeMeasureSpec(layout.height, Utils.layout.EXACTLY);
150
+ this.setMeasuredDimension(w, h);
151
+ }
152
+ }
153
+ else {
154
+ // @ts-ignore
155
+ const layout = this.ios.node.computedLayout;
156
+ const w = Utils.layout.makeMeasureSpec(layout.width, Utils.layout.EXACTLY);
157
+ const h = Utils.layout.makeMeasureSpec(layout.height, Utils.layout.EXACTLY);
158
+ this.setMeasuredDimension(w, h);
159
+ }
160
+ }
161
+ }
162
+ _setNativeViewFrame(nativeView, frame) {
163
+ nativeView.frame = frame;
164
+ }
165
+ };
166
+ Input = __decorate([
167
+ CSSType('input'),
168
+ __metadata("design:paramtypes", [])
169
+ ], Input);
170
+ export { Input };
171
+ //# sourceMappingURL=index.ios.js.map