@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/DOCS.md ADDED
@@ -0,0 +1,930 @@
1
+ # @triniwiz/nativescript-masonkit
2
+
3
+ **Web-Inspired Layout System for NativeScript**
4
+
5
+ A layout engine that brings familiar web layout paradigms (Flexbox, CSS Grid) and semantic HTML elements to NativeScript, powered by a high-performance Rust core. Write layouts the way you would on the web, but running natively on iOS and Android.
6
+
7
+ **Version:** 1.0.0-beta.60
8
+ **License:** Apache-2.0
9
+ **Platforms:** iOS 8.0+, Android 8.0+
10
+
11
+ ---
12
+
13
+ ## Table of Contents
14
+
15
+ - [Installation](#installation)
16
+ - [Quick Start](#quick-start)
17
+ - [Components](#components)
18
+ - [View](#view)
19
+ - [Text](#text)
20
+ - [Img](#img)
21
+ - [Scroll](#scroll)
22
+ - [Button](#button)
23
+ - [Input](#input)
24
+ - [Br](#br)
25
+ - [TextNode](#textnode)
26
+ - [Semantic HTML Components](#semantic-html-components)
27
+ - [Layout Properties](#layout-properties)
28
+ - [Display](#display)
29
+ - [Box Model](#box-model)
30
+ - [Sizing](#sizing)
31
+ - [Positioning](#positioning)
32
+ - [Flexbox](#flexbox)
33
+ - [CSS Grid](#css-grid)
34
+ - [Gap & Spacing](#gap--spacing)
35
+ - [Overflow & Scrolling](#overflow--scrolling)
36
+ - [Text & Typography](#text--typography)
37
+ - [Visual Styling](#visual-styling)
38
+ - [Events](#events)
39
+ - [Types Reference](#types-reference)
40
+ - [Framework Support](#framework-support)
41
+
42
+ ---
43
+
44
+ ## Installation
45
+
46
+ ```bash
47
+ ns plugin add @triniwiz/nativescript-masonkit
48
+ ```
49
+
50
+ ---
51
+
52
+ ## Quick Start
53
+
54
+ ### XML (NativeScript Core)
55
+
56
+ ```xml
57
+ <Page xmlns:mason="@triniwiz/nativescript-masonkit">
58
+ <mason:View display="flex" flexDirection="column" padding="16" gap="8">
59
+ <mason:Text textContent="Hello MasonKit!" fontSize="24" fontWeight="bold" />
60
+ <mason:View display="grid" gridTemplateColumns="1fr 1fr" gap="12">
61
+ <mason:View background="#e0e0e0" padding="8">
62
+ <mason:Text textContent="Column 1" />
63
+ </mason:View>
64
+ <mason:View background="#f0f0f0" padding="8">
65
+ <mason:Text textContent="Column 2" />
66
+ </mason:View>
67
+ </mason:View>
68
+ </mason:View>
69
+ </Page>
70
+ ```
71
+
72
+ ### Using Semantic HTML Components
73
+
74
+ ```xml
75
+ <Page xmlns:mason="@triniwiz/nativescript-masonkit">
76
+ <mason:Div display="flex" flexDirection="column">
77
+ <mason:Header padding="16" background="#333">
78
+ <mason:H1 textContent="My App" color="#fff" />
79
+ </mason:Header>
80
+ <mason:Main display="flex" flex="1" padding="16">
81
+ <mason:Nav width="200" padding="8">
82
+ <mason:Ul>
83
+ <mason:Li textContent="Home" />
84
+ <mason:Li textContent="About" />
85
+ </mason:Ul>
86
+ </mason:Nav>
87
+ <mason:Article flex="1" padding="8">
88
+ <mason:P textContent="Welcome to the app!" />
89
+ </mason:Article>
90
+ </mason:Main>
91
+ <mason:Footer padding="16" background="#333">
92
+ <mason:Span textContent="Footer content" color="#fff" />
93
+ </mason:Footer>
94
+ </mason:Div>
95
+ </Page>
96
+ ```
97
+
98
+ ---
99
+
100
+ ## Components
101
+
102
+ ### View
103
+
104
+ The base container component. Use it as a general-purpose layout wrapper, similar to a `<div>` without built-in scrolling.
105
+
106
+ ```typescript
107
+ import { View } from '@triniwiz/nativescript-masonkit';
108
+ ```
109
+
110
+ ```xml
111
+ <mason:View display="flex" flexDirection="row" gap="8" padding="16">
112
+ <!-- children -->
113
+ </mason:View>
114
+ ```
115
+
116
+ **Methods:**
117
+
118
+ | Method | Signature | Description |
119
+ |--------|-----------|-------------|
120
+ | `addChild` | `(child: any): void` | Appends a child to the view |
121
+ | `insertChild` | `(child: any, atIndex: number): void` | Inserts a child at a specific index |
122
+ | `replaceChild` | `(child: any, atIndex: number): void` | Replaces the child at a specific index |
123
+ | `removeChild` | `(child: any): void` | Removes a child from the view |
124
+ | `removeChildren` | `(): void` | Removes all children |
125
+ | `getChildrenCount` | `(): number` | Returns the number of children |
126
+ | `getChildAt` | `(index: number): View` | Returns the child at the specified index |
127
+ | `getChildIndex` | `(child: View): number` | Returns the index of the specified child |
128
+ | `getChildById` | `(id: string): any` | Finds a child by its id |
129
+ | `forceStyleUpdate` | `(): void` | Forces a recalculation of the layout |
130
+
131
+ ---
132
+
133
+ ### Text
134
+
135
+ A text display component. Renders styled text content.
136
+
137
+ ```typescript
138
+ import { Text } from '@triniwiz/nativescript-masonkit';
139
+ ```
140
+
141
+ ```xml
142
+ <mason:Text textContent="Hello World" fontSize="18" fontWeight="bold" color="#333" />
143
+ ```
144
+
145
+ **Properties:**
146
+
147
+ | Property | Type | Description |
148
+ |----------|------|-------------|
149
+ | `textContent` | `string` | The text content to display |
150
+
151
+ Inherits all layout and styling properties from [View](#view).
152
+
153
+ ---
154
+
155
+ ### Img
156
+
157
+ An image component for displaying images from local or remote sources.
158
+
159
+ ```typescript
160
+ import { Img } from '@triniwiz/nativescript-masonkit';
161
+ ```
162
+
163
+ ```xml
164
+ <mason:Img src="~/assets/logo.png" width="100" height="100" />
165
+ <mason:Img src="https://example.com/image.jpg" aspectRatio="1.5" />
166
+ ```
167
+
168
+ **Properties:**
169
+
170
+ | Property | Type | Description |
171
+ |----------|------|-------------|
172
+ | `src` | `string` | The image source — a local path (`~/...`) or a URL |
173
+
174
+ ---
175
+
176
+ ### Scroll
177
+
178
+ A scrollable container. Wraps children in a scrollable region.
179
+
180
+ ```typescript
181
+ import { Scroll } from '@triniwiz/nativescript-masonkit';
182
+ ```
183
+
184
+ ```xml
185
+ <mason:Scroll overflow="scroll" height="300">
186
+ <!-- Scrollable content -->
187
+ </mason:Scroll>
188
+ ```
189
+
190
+ ---
191
+
192
+ ### Button
193
+
194
+ A clickable button with text content.
195
+
196
+ ```typescript
197
+ import { Button } from '@triniwiz/nativescript-masonkit';
198
+ ```
199
+
200
+ ```xml
201
+ <mason:Button textContent="Click Me" padding="12 24" background="#007AFF" color="#fff" borderRadius="8" />
202
+ ```
203
+
204
+ **Properties:**
205
+
206
+ | Property | Type | Description |
207
+ |----------|------|-------------|
208
+ | `textContent` | `string` | The button label text |
209
+
210
+ ---
211
+
212
+ ### Input
213
+
214
+ A form input component supporting various input types.
215
+
216
+ ```typescript
217
+ import { Input } from '@triniwiz/nativescript-masonkit';
218
+ ```
219
+
220
+ ```xml
221
+ <mason:Input type="text" placeholder="Enter your name" />
222
+ <mason:Input type="email" placeholder="you@example.com" />
223
+ <mason:Input type="password" />
224
+ <mason:Input type="file" accept="image/*" multiple="true" />
225
+ <mason:Input type="checkbox" />
226
+ <mason:Input type="range" />
227
+ ```
228
+
229
+ **Properties:**
230
+
231
+ | Property | Type | Description |
232
+ |----------|------|-------------|
233
+ | `type` | `InputType` | The input type (see [InputType](#inputtype)) |
234
+ | `value` | `string` | The current input value |
235
+ | `valueAsNumber` | `number` | The value as a number (for numeric types) |
236
+ | `valueAsDate` | `Date \| null` | The value as a Date (for date types) |
237
+ | `placeholder` | `string` | Placeholder text |
238
+ | `multiple` | `boolean` | Allow multiple values (e.g., file input) |
239
+ | `accept` | `string` | Accepted file types (for file inputs) |
240
+
241
+ ---
242
+
243
+ ### Br
244
+
245
+ A line break element for use inside text components.
246
+
247
+ ```typescript
248
+ import { Br } from '@triniwiz/nativescript-masonkit';
249
+ ```
250
+
251
+ ```xml
252
+ <mason:Text>
253
+ <mason:Span textContent="Line one" />
254
+ <mason:Br />
255
+ <mason:Span textContent="Line two" />
256
+ </mason:Text>
257
+ ```
258
+
259
+ ---
260
+
261
+ ### TextNode
262
+
263
+ A low-level text node for programmatic text manipulation.
264
+
265
+ ```typescript
266
+ import { TextNode } from '@triniwiz/nativescript-masonkit';
267
+ ```
268
+
269
+ **Properties:**
270
+
271
+ | Property | Type | Description |
272
+ |----------|------|-------------|
273
+ | `data` | `string` | The text data |
274
+ | `length` | `number` (readonly) | Length of the text data |
275
+
276
+ **Methods:**
277
+
278
+ | Method | Signature | Description |
279
+ |--------|-----------|-------------|
280
+ | `appendData` | `(s: string): this` | Appends text to the end |
281
+ | `deleteData` | `(offset: number, count: number): this` | Deletes text at offset |
282
+ | `insertData` | `(s: string, offset: number): this` | Inserts text at offset |
283
+ | `substringData` | `(offset: number, count: number): string` | Extracts a substring |
284
+
285
+ ---
286
+
287
+ ## Semantic HTML Components
288
+
289
+ MasonKit provides web-inspired semantic components that map directly to familiar HTML elements. They are styled via CSS using their lowercase tag names.
290
+
291
+ ```typescript
292
+ import { Div, Section, Header, Footer, Article, Main, Nav, Aside,
293
+ Span, Code, H1, H2, H3, H4, H5, H6, P, B, Strong,
294
+ A, Blockquote, Li, Ul } from '@triniwiz/nativescript-masonkit';
295
+ ```
296
+
297
+ ### Container Components
298
+
299
+ | Component | CSS Selector | Extends | Description |
300
+ |-----------|-------------|---------|-------------|
301
+ | `Div` | `div` | `Scroll` | General-purpose scrollable container |
302
+ | `Section` | `section` | `View` | Thematic grouping of content |
303
+ | `Header` | `header` | `View` | Introductory or navigational content |
304
+ | `Footer` | `footer` | `View` | Footer content |
305
+ | `Article` | `article` | `View` | Self-contained content |
306
+ | `Main` | `main` | `View` | Dominant content of the page |
307
+ | `Nav` | `nav` | `View` | Navigation links |
308
+ | `Aside` | `aside` | `View` | Tangentially related content |
309
+ | `Ul` | `ul` | `View` | Unordered list container |
310
+
311
+ ### Text Components
312
+
313
+ | Component | CSS Selector | Description |
314
+ |-----------|-------------|-------------|
315
+ | `Span` | `span` | Inline text |
316
+ | `Code` | `code` | Code/monospace text |
317
+ | `H1` - `H6` | `h1` - `h6` | Heading levels 1 through 6 |
318
+ | `P` | `p` | Paragraph text |
319
+ | `B` | `b` | Bold text |
320
+ | `Strong` | `strong` | Strong emphasis text |
321
+ | `A` | `a` | Anchor/link text |
322
+ | `Blockquote` | `blockquote` | Block quotation |
323
+ | `Li` | `li` | List item |
324
+
325
+ ### Example: CSS Styling
326
+
327
+ ```css
328
+ /* App styles */
329
+ h1 {
330
+ font-size: 32;
331
+ font-weight: bold;
332
+ margin-bottom: 16;
333
+ }
334
+
335
+ p {
336
+ font-size: 16;
337
+ line-height: 1.5;
338
+ color: #333;
339
+ }
340
+
341
+ header {
342
+ background: #1a1a2e;
343
+ padding: 16;
344
+ }
345
+
346
+ nav {
347
+ display: flex;
348
+ flex-direction: column;
349
+ gap: 8;
350
+ }
351
+ ```
352
+
353
+ ---
354
+
355
+ ## Layout Properties
356
+
357
+ All components that extend `View` support the following layout properties, settable as XML attributes, via CSS, or programmatically in TypeScript/JavaScript.
358
+
359
+ ### Display
360
+
361
+ | Property | Type | Default | Description |
362
+ |----------|------|---------|-------------|
363
+ | `display` | `Display` | `'flex'` | Layout mode |
364
+ | `boxSizing` | `BoxSizing` | — | Box model calculation |
365
+
366
+ **Display values:** `'none'` | `'flex'` | `'grid'` | `'block'` | `'inline'` | `'inline-block'` | `'inline-flex'` | `'inline-grid'`
367
+
368
+ **BoxSizing values:** `'border-box'` | `'content-box'`
369
+
370
+ ---
371
+
372
+ ### Box Model
373
+
374
+ | Property | Type | Description |
375
+ |----------|------|-------------|
376
+ | `margin` | `string` | Shorthand margin (all sides) |
377
+ | `marginLeft` | `Length` | Left margin |
378
+ | `marginRight` | `Length` | Right margin |
379
+ | `marginTop` | `Length` | Top margin |
380
+ | `marginBottom` | `Length` | Bottom margin |
381
+ | `padding` | `string` | Shorthand padding (all sides) |
382
+ | `paddingLeft` | `Length` | Left padding |
383
+ | `paddingRight` | `Length` | Right padding |
384
+ | `paddingTop` | `Length` | Top padding |
385
+ | `paddingBottom` | `Length` | Bottom padding |
386
+
387
+ Length values support `px`, `%`, `dip`, and `auto` (for margins).
388
+
389
+ ---
390
+
391
+ ### Sizing
392
+
393
+ | Property | Type | Description |
394
+ |----------|------|-------------|
395
+ | `width` | `LengthAuto` | Element width |
396
+ | `height` | `LengthAuto` | Element height |
397
+ | `minWidth` | `LengthAuto` | Minimum width |
398
+ | `minHeight` | `LengthAuto` | Minimum height |
399
+ | `maxWidth` | `LengthAuto` | Maximum width |
400
+ | `maxHeight` | `LengthAuto` | Maximum height |
401
+
402
+ ## Transforms
403
+
404
+ MasonKit supports a subset of CSS `transform` functions on native views. The following functions are supported on Android via the `transform` style property:
405
+
406
+ - `translate(x, y)` — translation in pixels (also `translateX`, `translateY`)
407
+ - `scale(sx, sy)` — scaling (also `scaleX`, `scaleY`)
408
+ - `rotate(angle)` — rotation in degrees (supports `deg` and `rad`)
409
+
410
+ Notes:
411
+ - Lengths in pixels can be specified with `px` (e.g. `translate(10px, 20px)`). Numeric values without units are interpreted as raw numbers (for scale/angle parsing try to use unit suffixes for clarity).
412
+ - Percentage translations are not supported in this initial implementation.
413
+
414
+ XML example (NativeScript Core):
415
+
416
+ ```xml
417
+ <Page xmlns:mason="@triniwiz/nativescript-masonkit">
418
+ <mason:View padding="16">
419
+ <mason:View width="120" height="120" background="#2196F3"
420
+ transform="translate(10px, 20px) rotate(15deg) scale(1.05)">
421
+ <mason:Text textContent="Transformed" color="#fff" textAlign="center" />
422
+ </mason:View>
423
+ </mason:View>
424
+ </Page>
425
+ ```
426
+
427
+ Programmatic example (TypeScript):
428
+
429
+ ```ts
430
+ import { View } from '@triniwiz/nativescript-masonkit';
431
+
432
+ const v = new View();
433
+ v.width = 120;
434
+ v.height = 120;
435
+ v.background = '#2196F3';
436
+ v.style.transform = 'translate(10px, 20px) rotate(15deg) scale(1.05)';
437
+
438
+ // append to parent as usual
439
+ ```
440
+
441
+ Use-cases:
442
+
443
+ - Simple motion/placement without changing layout (translation)
444
+ - Visual emphasis (scale/rotate)
445
+
446
+ If you want transforms to be driven from the native style buffer (Rust) and cascade with pseudo-state merges, I can add a `TRANSFORM` style key in the Rust layout buffer and wire it through — ask me to proceed and I'll implement the native-side changes and iOS parity.
447
+ | `aspectRatio` | `number` | Width-to-height ratio |
448
+
449
+ ```xml
450
+ <mason:View width="50%" height="200" maxWidth="400" aspectRatio="1.5" />
451
+ ```
452
+
453
+ ---
454
+
455
+ ### Positioning
456
+
457
+ | Property | Type | Description |
458
+ |----------|------|-------------|
459
+ | `position` | `Position` | `'relative'` or `'absolute'` |
460
+ | `left` | `LengthAuto` | Left offset |
461
+ | `right` | `LengthAuto` | Right offset |
462
+ | `top` | `LengthAuto` | Top offset |
463
+ | `bottom` | `LengthAuto` | Bottom offset |
464
+ | `inset` | `LengthAuto` | Shorthand for all four offsets |
465
+ | `zIndex` | `number` | Stacking order |
466
+
467
+ ```xml
468
+ <mason:View position="absolute" top="10" right="10" zIndex="1">
469
+ <mason:Text textContent="Floating badge" />
470
+ </mason:View>
471
+ ```
472
+
473
+ ---
474
+
475
+ ### Flexbox
476
+
477
+ | Property | Type | Description |
478
+ |----------|------|-------------|
479
+ | `flexDirection` | `FlexDirection` | Direction of the main axis |
480
+ | `flexWrap` | `FlexWrap` | Whether items wrap |
481
+ | `flex` | `string \| number` | Shorthand for grow, shrink, and basis |
482
+ | `flexFlow` | `string` | Shorthand for direction + wrap |
483
+ | `flexGrow` | `number` | Grow factor |
484
+ | `flexShrink` | `number` | Shrink factor |
485
+ | `flexBasis` | `Length` | Initial main-axis size |
486
+ | `alignItems` | `AlignItems` | Cross-axis alignment of children |
487
+ | `alignSelf` | `AlignSelf` | Cross-axis alignment of this element |
488
+ | `alignContent` | `AlignContent` | Alignment of wrapped lines |
489
+ | `justifyContent` | `JustifyContent` | Main-axis alignment |
490
+ | `justifyItems` | `JustifyItems` | Default justify for children |
491
+ | `justifySelf` | `JustifySelf` | Justify alignment for this element |
492
+
493
+ **FlexDirection values:** `'row'` | `'column'` | `'row-reverse'` | `'column-reverse'`
494
+
495
+ **FlexWrap values:** `'no-wrap'` | `'wrap'` | `'wrap-reverse'`
496
+
497
+ **Alignment values:** `'normal'` | `'flex-start'` | `'flex-end'` | `'start'` | `'end'` | `'center'` | `'baseline'` | `'stretch'`
498
+
499
+ **JustifyContent/AlignContent also accept:** `'space-between'` | `'space-around'` | `'space-evenly'`
500
+
501
+ #### Example: Flexbox Layout
502
+
503
+ ```xml
504
+ <mason:View display="flex" flexDirection="row" justifyContent="space-between" alignItems="center" padding="16">
505
+ <mason:Text textContent="Left" />
506
+ <mason:Text textContent="Center" />
507
+ <mason:Text textContent="Right" />
508
+ </mason:View>
509
+ ```
510
+
511
+ #### Example: Flex Shorthand
512
+
513
+ ```xml
514
+ <!-- flex: 1 (grow to fill available space) -->
515
+ <mason:View flex="1" />
516
+
517
+ <!-- flex: none (don't grow or shrink) -->
518
+ <mason:View flex="none" />
519
+
520
+ <!-- flex: auto -->
521
+ <mason:View flex="auto" />
522
+ ```
523
+
524
+ ---
525
+
526
+ ### CSS Grid
527
+
528
+ | Property | Type | Description |
529
+ |----------|------|-------------|
530
+ | `gridTemplateColumns` | `string` | Column track definitions |
531
+ | `gridTemplateRows` | `string` | Row track definitions |
532
+ | `gridTemplateAreas` | `string` | Named grid areas |
533
+ | `gridAutoColumns` | `string` | Size of implicit columns |
534
+ | `gridAutoRows` | `string` | Size of implicit rows |
535
+ | `gridAutoFlow` | `GridAutoFlow` | Auto-placement algorithm |
536
+ | `gridColumn` | `string` | Shorthand for column start/end |
537
+ | `gridColumnStart` | `string` | Column start line |
538
+ | `gridColumnEnd` | `string` | Column end line |
539
+ | `gridRow` | `string` | Shorthand for row start/end |
540
+ | `gridRowStart` | `string` | Row start line |
541
+ | `gridRowEnd` | `string` | Row end line |
542
+ | `gridArea` | `string` | Shorthand for row/column start/end or named area |
543
+
544
+ **GridAutoFlow values:** `'row'` | `'column'` | `'row dense'` | `'column dense'` | `'dense'`
545
+
546
+ #### Example: Grid Layout
547
+
548
+ ```xml
549
+ <mason:View display="grid" gridTemplateColumns="1fr 2fr 1fr" gridTemplateRows="auto 1fr auto" gap="8" padding="16">
550
+ <mason:View gridColumn="1 / -1" background="#eee" padding="8">
551
+ <mason:Text textContent="Full-width header" />
552
+ </mason:View>
553
+ <mason:View background="#ddd" padding="8">
554
+ <mason:Text textContent="Sidebar" />
555
+ </mason:View>
556
+ <mason:View background="#ccc" padding="8">
557
+ <mason:Text textContent="Main Content" />
558
+ </mason:View>
559
+ <mason:View background="#ddd" padding="8">
560
+ <mason:Text textContent="Right Panel" />
561
+ </mason:View>
562
+ </mason:View>
563
+ ```
564
+
565
+ #### Example: Grid Template Areas
566
+
567
+ ```xml
568
+ <mason:View
569
+ display="grid"
570
+ gridTemplateColumns="200 1fr"
571
+ gridTemplateRows="auto 1fr auto"
572
+ gridTemplateAreas="'header header' 'sidebar content' 'footer footer'"
573
+ gap="8">
574
+ <mason:View gridArea="header"><mason:Text textContent="Header" /></mason:View>
575
+ <mason:View gridArea="sidebar"><mason:Text textContent="Sidebar" /></mason:View>
576
+ <mason:View gridArea="content"><mason:Text textContent="Content" /></mason:View>
577
+ <mason:View gridArea="footer"><mason:Text textContent="Footer" /></mason:View>
578
+ </mason:View>
579
+ ```
580
+
581
+ #### Example: Auto-fill / minmax
582
+
583
+ ```xml
584
+ <mason:View display="grid" gridTemplateColumns="repeat(auto-fill, minmax(150, 1fr))" gap="12">
585
+ <mason:View background="#eee" padding="12">
586
+ <mason:Text textContent="Card 1" />
587
+ </mason:View>
588
+ <mason:View background="#eee" padding="12">
589
+ <mason:Text textContent="Card 2" />
590
+ </mason:View>
591
+ <mason:View background="#eee" padding="12">
592
+ <mason:Text textContent="Card 3" />
593
+ </mason:View>
594
+ </mason:View>
595
+ ```
596
+
597
+ ---
598
+
599
+ ### Gap & Spacing
600
+
601
+ | Property | Type | Description |
602
+ |----------|------|-------------|
603
+ | `gap` | `Gap` | Shorthand for row and column gap |
604
+ | `rowGap` | `Length` | Gap between rows |
605
+ | `columnGap` | `Length` | Gap between columns |
606
+ | `gridGap` | `Gap` | Alias for `gap` |
607
+ | `gridRowGap` | `Gap` | Alias for `rowGap` |
608
+ | `gridColumnGap` | `Gap` | Alias for `columnGap` |
609
+
610
+ ```xml
611
+ <!-- Uniform gap -->
612
+ <mason:View display="flex" gap="16">...</mason:View>
613
+
614
+ <!-- Different row and column gaps -->
615
+ <mason:View display="grid" rowGap="8" columnGap="16">...</mason:View>
616
+ ```
617
+
618
+ ---
619
+
620
+ ### Overflow & Scrolling
621
+
622
+ | Property | Type | Description |
623
+ |----------|------|-------------|
624
+ | `overflow` | `Overflow` | Overflow behavior (both axes) |
625
+ | `overflowX` | `Overflow` | Horizontal overflow |
626
+ | `overflowY` | `Overflow` | Vertical overflow |
627
+ | `scrollBarWidth` | `Length` | Width of the scrollbar |
628
+
629
+ **Overflow values:** `'visible'` | `'hidden'` | `'scroll'` | `'clip'` | `'auto'`
630
+
631
+ ```xml
632
+ <mason:View overflow="hidden" height="200">
633
+ <!-- Content that may exceed 200 height will be clipped -->
634
+ </mason:View>
635
+
636
+ <mason:Scroll overflowY="scroll" height="400">
637
+ <!-- Vertically scrollable content -->
638
+ </mason:Scroll>
639
+ ```
640
+
641
+ ---
642
+
643
+ ### Text & Typography
644
+
645
+ | Property | Type | Description |
646
+ |----------|------|-------------|
647
+ | `textContent` | `string` | The text to display |
648
+ | `color` | `Color` | Text color |
649
+ | `fontSize` | `number` | Font size |
650
+ | `fontWeight` | `string` | Font weight (e.g., `'bold'`, `'400'`) |
651
+ | `fontStyle` | `string` | Font style (`'normal'`, `'italic'`) |
652
+ | `lineHeight` | `number` | Line height |
653
+ | `letterSpacing` | `number` | Spacing between characters |
654
+ | `textAlignment` | `string` | Text alignment |
655
+ | `textWrap` | `TextWrap` | Text wrapping behavior |
656
+ | `textOverFlow` | `TextOverflow` | Text overflow behavior |
657
+ | `verticalAlign` | `VerticalAlign` | Vertical alignment |
658
+
659
+ **TextWrap values:** `'nowrap'` | `'wrap'` | `'balance'`
660
+
661
+ **TextOverflow values:** `'clip'` | `'ellipsis'`
662
+
663
+ ```xml
664
+ <mason:Text
665
+ textContent="This is a long text that will be truncated with an ellipsis if it overflows"
666
+ textWrap="nowrap"
667
+ textOverFlow="ellipsis"
668
+ maxWidth="200"
669
+ fontSize="16"
670
+ lineHeight="1.4"
671
+ color="#333" />
672
+ ```
673
+
674
+ ---
675
+
676
+ ### Visual Styling
677
+
678
+ | Property | Type | Description |
679
+ |----------|------|-------------|
680
+ | `background` | `string` | Background (color, gradient, etc.) |
681
+ | `backgroundColor` | `Color` | Background color |
682
+ | `border` | `string` | Shorthand border |
683
+ | `borderRadius` | `string` | Corner rounding |
684
+ | `borderLeftWidth` | `Length` | Left border width |
685
+ | `borderRightWidth` | `Length` | Right border width |
686
+ | `borderTopWidth` | `Length` | Top border width |
687
+ | `borderBottomWidth` | `Length` | Bottom border width |
688
+ | `filter` | `string` | CSS filter effects |
689
+
690
+ ```xml
691
+ <mason:View
692
+ background="#f5f5f5"
693
+ border="1 solid #ccc"
694
+ borderRadius="12"
695
+ padding="16">
696
+ <mason:Text textContent="Styled card" />
697
+ </mason:View>
698
+ ```
699
+
700
+ ---
701
+
702
+ ## Events
703
+
704
+ MasonKit components support DOM-like event handling.
705
+
706
+ ### Supported Events
707
+
708
+ | Event | Fires On | Description |
709
+ |-------|----------|-------------|
710
+ | `input` | `Input` | When the input value changes |
711
+ | `change` | `Input` | When the input value is committed |
712
+
713
+ ### Event Class
714
+
715
+ | Property | Type | Description |
716
+ |----------|------|-------------|
717
+ | `type` | `string` (readonly) | Event type name |
718
+ | `target` | `any` (readonly) | The element that fired the event |
719
+ | `currentTarget` | `any` (readonly) | The element the listener is attached to |
720
+ | `bubbles` | `boolean` (readonly) | Whether the event bubbles |
721
+ | `cancelable` | `boolean` (readonly) | Whether the event is cancelable |
722
+ | `isComposing` | `boolean` (readonly) | Whether the event is part of a composition |
723
+ | `timeStamp` | `number` (readonly) | Time at which the event was created |
724
+ | `defaultPrevented` | `boolean` (readonly) | Whether `preventDefault()` was called |
725
+
726
+ | Method | Description |
727
+ |--------|-------------|
728
+ | `stopPropagation()` | Stops further propagation |
729
+ | `stopImmediatePropagation()` | Stops immediate propagation |
730
+ | `preventDefault()` | Prevents the default action |
731
+
732
+ ### InputEvent Class (extends Event)
733
+
734
+ | Property | Type | Description |
735
+ |----------|------|-------------|
736
+ | `data` | `any` (readonly) | The input data (string for text, array for file inputs) |
737
+ | `inputType` | `string` (readonly) | The type of input change |
738
+
739
+ ### Example: Listening to Events
740
+
741
+ ```xml
742
+ <mason:Input type="text" input="{{ onInput }}" />
743
+ ```
744
+
745
+ ```typescript
746
+ onInput(event: InputEvent) {
747
+ console.log('Input data:', event.data);
748
+ console.log('Input type:', event.inputType);
749
+ console.log('Target value:', event.target.value);
750
+ }
751
+ ```
752
+
753
+ ```typescript
754
+ // Programmatic event listeners
755
+ const input = page.getViewById('myInput');
756
+ input.addEventListener('input', (event) => {
757
+ console.log('Value changed:', event.data);
758
+ });
759
+ ```
760
+
761
+ ---
762
+
763
+ ## Types Reference
764
+
765
+ ### InputType
766
+
767
+ ```typescript
768
+ type InputType =
769
+ | 'text' | 'password' | 'email' | 'number' | 'tel' | 'url'
770
+ | 'search' | 'date' | 'time' | 'datetime-local' | 'month'
771
+ | 'week' | 'color' | 'checkbox' | 'radio' | 'button'
772
+ | 'submit' | 'reset' | 'file' | 'range';
773
+ ```
774
+
775
+ ### Length
776
+
777
+ ```typescript
778
+ // A numeric length value — supports px, %, and dip units
779
+ type Length =
780
+ | CoreTypes.dip
781
+ | CoreTypes.LengthDipUnit
782
+ | CoreTypes.LengthPxUnit
783
+ | CoreTypes.LengthPercentUnit
784
+ | `${number}px`
785
+ | `${number}%`
786
+ | `${number}dip`;
787
+ ```
788
+
789
+ ### LengthAuto
790
+
791
+ ```typescript
792
+ // Same as Length, but also accepts 'auto'
793
+ type LengthAuto = Length | 'auto';
794
+ ```
795
+
796
+ ### Display
797
+
798
+ ```typescript
799
+ type Display = 'none' | 'flex' | 'grid' | 'block' | 'inline'
800
+ | 'inline-block' | 'inline-flex' | 'inline-grid';
801
+ ```
802
+
803
+ ### Position
804
+
805
+ ```typescript
806
+ type Position = 'absolute' | 'relative';
807
+ ```
808
+
809
+ ### BoxSizing
810
+
811
+ ```typescript
812
+ type BoxSizing = 'border-box' | 'content-box';
813
+ ```
814
+
815
+ ### Overflow
816
+
817
+ ```typescript
818
+ type Overflow = 'visible' | 'hidden' | 'scroll' | 'clip' | 'auto';
819
+ ```
820
+
821
+ ### FlexDirection
822
+
823
+ ```typescript
824
+ type FlexDirection = 'column' | 'row' | 'column-reverse' | 'row-reverse';
825
+ ```
826
+
827
+ ### FlexWrap
828
+
829
+ ```typescript
830
+ type FlexWrap = 'no-wrap' | 'wrap' | 'wrap-reverse';
831
+ ```
832
+
833
+ ### AlignItems / AlignSelf
834
+
835
+ ```typescript
836
+ type AlignItems = 'normal' | 'flex-start' | 'flex-end' | 'start'
837
+ | 'end' | 'center' | 'baseline' | 'stretch';
838
+ type AlignSelf = AlignItems;
839
+ ```
840
+
841
+ ### AlignContent / JustifyContent
842
+
843
+ ```typescript
844
+ type AlignContent = 'normal' | 'flex-start' | 'flex-end' | 'start'
845
+ | 'end' | 'center' | 'stretch' | 'space-between'
846
+ | 'space-around' | 'space-evenly';
847
+ type JustifyContent = AlignContent;
848
+ ```
849
+
850
+ ### JustifyItems / JustifySelf
851
+
852
+ ```typescript
853
+ type JustifyItems = AlignItems;
854
+ type JustifySelf = AlignSelf;
855
+ ```
856
+
857
+ ### GridAutoFlow
858
+
859
+ ```typescript
860
+ type GridAutoFlow = 'row' | 'column' | 'row dense' | 'column dense' | 'dense';
861
+ ```
862
+
863
+ ### Gap
864
+
865
+ ```typescript
866
+ type GapTypeUnit = 'px' | 'dip' | '%';
867
+ type Gap = `${string}${GapTypeUnit} ${string}${GapTypeUnit}` | SizeLengthType;
868
+ ```
869
+
870
+ ### VerticalAlign
871
+
872
+ ```typescript
873
+ type VerticalAlign = 'baseline' | 'sub' | 'super' | 'text-top'
874
+ | 'text-bottom' | 'middle' | 'top' | 'bottom'
875
+ | Length | number;
876
+ ```
877
+
878
+ ---
879
+
880
+ ## Framework Support
881
+
882
+ MasonKit supports multiple NativeScript frameworks:
883
+
884
+ | Framework | Status |
885
+ |-----------|--------|
886
+ | NativeScript Core (XML) | Supported |
887
+ | Angular | Supported |
888
+ | Vue 3 (`nativescript-vue`) | Supported |
889
+ | React (`react-nativescript`) | Supported |
890
+ | Svelte | Supported |
891
+
892
+ Framework detection is automatic. MasonKit detects which framework is in use and adapts its internal child management accordingly.
893
+
894
+ ### Vue 3 Example
895
+
896
+ ```vue
897
+ <template>
898
+ <Div display="flex" flexDirection="column" padding="16">
899
+ <H1 textContent="Hello from Vue!" />
900
+ <P textContent="MasonKit works with NativeScript Vue." />
901
+ <Button textContent="Click Me" @tap="onTap" />
902
+ </Div>
903
+ </template>
904
+
905
+ <script setup>
906
+ function onTap() {
907
+ console.log('Button tapped!');
908
+ }
909
+ </script>
910
+ ```
911
+
912
+ ### Angular Example
913
+
914
+ ```typescript
915
+ import { registerElement } from '@nativescript/angular';
916
+ import { View, Text, Div, H1, P } from '@triniwiz/nativescript-masonkit';
917
+
918
+ registerElement('view', () => View);
919
+ registerElement('text', () => Text);
920
+ registerElement('div', () => Div);
921
+ registerElement('h1', () => H1);
922
+ registerElement('p', () => P);
923
+ ```
924
+
925
+ ```html
926
+ <MasonDiv display="flex" flexDirection="column" padding="16">
927
+ <MasonH1 textContent="Hello from Angular!"></MasonH1>
928
+ <MasonP textContent="MasonKit works with NativeScript Angular."></MasonP>
929
+ </MasonDiv>
930
+ ```