@triniwiz/nativescript-masonkit 1.0.0-beta.95 → 1.0.0-beta.97

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 (51) hide show
  1. package/DOCS.md +41 -23
  2. package/README.md +15 -0
  3. package/angular/fesm2022/triniwiz-nativescript-masonkit-angular.mjs +30 -1
  4. package/angular/fesm2022/triniwiz-nativescript-masonkit-angular.mjs.map +1 -1
  5. package/common.js +23 -131
  6. package/common.js.map +1 -1
  7. package/framework-registry.d.ts +50 -0
  8. package/framework-registry.js +176 -0
  9. package/framework-registry.js.map +1 -0
  10. package/index.android.d.ts +15 -0
  11. package/index.android.js +18 -0
  12. package/index.android.js.map +1 -1
  13. package/index.d.ts +18 -0
  14. package/index.ios.d.ts +1 -0
  15. package/index.ios.js +1 -0
  16. package/index.ios.js.map +1 -1
  17. package/index.windows.d.ts +1 -0
  18. package/index.windows.js +1 -0
  19. package/index.windows.js.map +1 -1
  20. package/package.json +1 -1
  21. package/platforms/android/masonkit-release.aar +0 -0
  22. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.abi.json +2688 -11414
  23. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.abi.json +2688 -11414
  24. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +2688 -11414
  25. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.abi.json +2688 -11414
  26. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.abi.json +2688 -11414
  27. package/references.d.ts +5 -0
  28. package/style.d.ts +1 -1
  29. package/text-runs.d.ts +23 -0
  30. package/text-runs.js +65 -0
  31. package/text-runs.js.map +1 -0
  32. package/typings/android.d.ts +7324 -0
  33. package/typings/objc!Mason.d.ts +3957 -0
  34. package/typings/objc!ObjectiveC.d.ts +1640 -0
  35. package/typings/windows.d.ts +330 -0
  36. package/vue/README.md +66 -0
  37. package/vue/index.d.ts +4 -0
  38. package/vue/index.d.ts.map +1 -0
  39. package/vue/index.js +3 -0
  40. package/vue/index.js.map +1 -0
  41. package/vue/package.json +39 -0
  42. package/vue/src/element-registry.d.ts +18 -0
  43. package/vue/src/element-registry.d.ts.map +1 -0
  44. package/vue/src/element-registry.js +56 -0
  45. package/vue/src/element-registry.js.map +1 -0
  46. package/vue/src/mason-meta.d.ts +7 -0
  47. package/vue/src/mason-meta.d.ts.map +1 -0
  48. package/vue/src/mason-meta.js +91 -0
  49. package/vue/src/mason-meta.js.map +1 -0
  50. package/web.js +11 -1
  51. package/web.js.map +1 -1
@@ -0,0 +1,330 @@
1
+ declare namespace NativeScript.Mason {
2
+ enum Display { None = 0, Flex = 1, Grid = 2, Block = 3, Inline = 4, InlineBlock = 5, InlineFlex = 6, InlineGrid = 7 }
3
+ enum Position { Relative = 0, Absolute = 1 }
4
+ enum Direction { Inherit = 0, Ltr = 1, Rtl = 2 }
5
+ enum FlexDirection { Row = 0, Column = 1, RowReverse = 2, ColumnReverse = 3 }
6
+ enum FlexWrap { NoWrap = 0, Wrap = 1, WrapReverse = 2 }
7
+ enum Overflow { Visible = 0, Hidden = 1, Scroll = 2, Clip = 3, Auto = 4 }
8
+ enum AlignItems { Normal = -1, Start = 0, End = 1, Center = 2, Baseline = 3, Stretch = 4, FlexStart = 5, FlexEnd = 6 }
9
+ enum AlignSelf { Normal = -1, Start = 0, End = 1, Center = 2, Baseline = 3, Stretch = 4, FlexStart = 5, FlexEnd = 6 }
10
+ enum AlignContent { Normal = -1, Start = 0, End = 1, Center = 2, Stretch = 3, SpaceBetween = 4, SpaceAround = 5, SpaceEvenly = 6, FlexStart = 7, FlexEnd = 8 }
11
+ enum JustifyItems { Normal = -1, Start = 0, End = 1, Center = 2, Baseline = 3, Stretch = 4, FlexStart = 5, FlexEnd = 6 }
12
+ enum JustifySelf { Normal = -1, Start = 0, End = 1, Center = 2, Baseline = 3, Stretch = 4, FlexStart = 5, FlexEnd = 6 }
13
+ enum JustifyContent { Normal = -1, Start = 0, End = 1, Center = 2, Stretch = 3, SpaceBetween = 4, SpaceAround = 5, SpaceEvenly = 6, FlexStart = 7, FlexEnd = 8 }
14
+ enum GridAutoFlow { Row = 0, Column = 1, RowDense = 2, ColumnDense = 3 }
15
+ enum BoxSizing { BorderBox = 0, ContentBox = 1 }
16
+ enum TextAlign { Auto = 0, Left = 1, Right = 2, Center = 3, Justify = 4, Start = 5, End = 6 }
17
+ enum DimensionType { Auto = 0, Points = 1, Percent = 2 }
18
+ enum AvailableSpaceType { Definite = 0, MinContent = 1, MaxContent = 2 }
19
+ enum PseudoState {
20
+ Default = 0x00,
21
+ Hover = 0x01,
22
+ Active = 0x02,
23
+ Focus = 0x04,
24
+ FocusWithin = 0x08,
25
+ FocusVisible = 0x10,
26
+ Disabled = 0x40,
27
+ Checked = 0x80,
28
+ }
29
+
30
+ // Int64 measure result is surfaced to JS as a number; pack/unpack via MeasureOutput.
31
+ type MeasureFunc = (knownWidth: number, knownHeight: number, availableWidth: number, availableHeight: number) => number;
32
+
33
+ class MeasureOutput {
34
+ static Make(width: number, height: number): number;
35
+ static GetWidth(measureOutput: number): number;
36
+ static GetHeight(measureOutput: number): number;
37
+ }
38
+
39
+ class Layout {
40
+ readonly X: number;
41
+ readonly Y: number;
42
+ readonly Width: number;
43
+ readonly Height: number;
44
+ readonly BorderTop: number;
45
+ readonly BorderRight: number;
46
+ readonly BorderBottom: number;
47
+ readonly BorderLeft: number;
48
+ readonly MarginTop: number;
49
+ readonly MarginRight: number;
50
+ readonly MarginBottom: number;
51
+ readonly MarginLeft: number;
52
+ readonly PaddingTop: number;
53
+ readonly PaddingRight: number;
54
+ readonly PaddingBottom: number;
55
+ readonly PaddingLeft: number;
56
+ readonly ContentWidth: number;
57
+ readonly ContentHeight: number;
58
+ readonly ScrollbarWidth: number;
59
+ readonly ScrollbarHeight: number;
60
+ readonly Order: number;
61
+ readonly HasChildren: boolean;
62
+ // IVectorView<Layout> — has .Size and .GetAt(i).
63
+ readonly Children: { Size: number; GetAt(index: number): Layout };
64
+ }
65
+
66
+ class Style {
67
+ SetWithValues(
68
+ display: number, position: number, direction: number, flexDirection: number,
69
+ flexWrap: number, overflow: number, alignItems: number, alignSelf: number,
70
+ alignContent: number, justifyItems: number, justifySelf: number, justifyContent: number,
71
+ insetLeftType: number, insetLeftValue: number, insetRightType: number, insetRightValue: number,
72
+ insetTopType: number, insetTopValue: number, insetBottomType: number, insetBottomValue: number,
73
+ marginLeftType: number, marginLeftValue: number, marginRightType: number, marginRightValue: number,
74
+ marginTopType: number, marginTopValue: number, marginBottomType: number, marginBottomValue: number,
75
+ paddingLeftType: number, paddingLeftValue: number, paddingRightType: number, paddingRightValue: number,
76
+ paddingTopType: number, paddingTopValue: number, paddingBottomType: number, paddingBottomValue: number,
77
+ borderLeftType: number, borderLeftValue: number, borderRightType: number, borderRightValue: number,
78
+ borderTopType: number, borderTopValue: number, borderBottomType: number, borderBottomValue: number,
79
+ flexGrow: number, flexShrink: number, flexBasisType: number, flexBasisValue: number,
80
+ widthType: number, widthValue: number, heightType: number, heightValue: number,
81
+ minWidthType: number, minWidthValue: number, minHeightType: number, minHeightValue: number,
82
+ maxWidthType: number, maxWidthValue: number, maxHeightType: number, maxHeightValue: number,
83
+ gapRowType: number, gapRowValue: number, gapColumnType: number, gapColumnValue: number,
84
+ aspectRatio: number,
85
+ gridAutoRows: string, gridAutoColumns: string, gridAutoFlow: number,
86
+ gridColumn: string, gridColumnStart: string, gridColumnEnd: string,
87
+ gridRow: string, gridRowStart: string, gridRowEnd: string,
88
+ gridTemplateRows: string, gridTemplateColumns: string,
89
+ overflowX: number, overflowY: number, scrollbarWidth: number, textAlign: number,
90
+ boxSizing: number, gridArea: string, gridTemplateAreas: string): void;
91
+
92
+ UpdateGrid(
93
+ gridAutoRows: string, gridAutoColumns: string, gridColumn: string,
94
+ gridColumnStart: string, gridColumnEnd: string, gridRow: string,
95
+ gridRowStart: string, gridRowEnd: string, gridTemplateRows: string,
96
+ gridTemplateColumns: string, gridArea: string, gridTemplateAreas: string): void;
97
+
98
+ PrepareForMutation(): void;
99
+ // IVectorView<UInt8>.
100
+ GetStyleBuffer(): { Size: number; GetAt(index: number): number };
101
+ // Live, mutable style buffer (IBuffer -> writable ArrayBuffer). Write StyleKeys offsets, then
102
+ // call the owning element's SyncStyle.
103
+ readonly Values: any;
104
+
105
+ readonly GridAreaCss: string;
106
+ readonly GridTemplateAreasCss: string;
107
+ readonly GridAutoRowsCss: string;
108
+ readonly GridAutoColumnsCss: string;
109
+ readonly GridColumnCss: string;
110
+ readonly GridColumnStartCss: string;
111
+ readonly GridColumnEndCss: string;
112
+ readonly GridRowCss: string;
113
+ readonly GridRowStartCss: string;
114
+ readonly GridRowEndCss: string;
115
+ readonly GridTemplateRowsCss: string;
116
+ readonly GridTemplateColumnsCss: string;
117
+ }
118
+
119
+ class Node {
120
+ AddChild(child: Node): void;
121
+ Prepend(child: Node): void;
122
+ AddChildAt(child: Node, index: number): void;
123
+ InsertChildBefore(child: Node, reference: Node): void;
124
+ InsertChildAfter(child: Node, reference: Node): void;
125
+ ReplaceChildAt(child: Node, index: number): Node;
126
+ RemoveChild(child: Node): Node;
127
+ RemoveChildAt(index: number): Node;
128
+ RemoveChildren(): void;
129
+ GetChildAt(index: number): Node;
130
+ SetChildren(children: Node[]): void;
131
+ AddChildren(children: Node[]): void;
132
+ PrependChildren(children: Node[]): void;
133
+ IsChildrenSame(children: Node[]): boolean;
134
+
135
+ IsDirty(): boolean;
136
+ MarkDirty(): void;
137
+ IsEqual(other: Node): boolean;
138
+
139
+ PseudoStates: number;
140
+ HasPseudoState(flag: number): boolean;
141
+ PreparePseudoBuffer(flags: number): any;
142
+
143
+ readonly Style: Style;
144
+
145
+ SetMeasure(callback: MeasureFunc): void;
146
+ RemoveMeasure(): void;
147
+
148
+ Compute(): void;
149
+ ComputeWH(width: number, height: number): void;
150
+ ComputeSize(widthType: AvailableSpaceType, widthValue: number, heightType: AvailableSpaceType, heightValue: number): void;
151
+ ComputeMaxContent(): void;
152
+ ComputeMinContent(): void;
153
+
154
+ GetLayout(): Layout;
155
+ ComputeAndLayout(): Layout;
156
+ ComputeWHAndLayout(width: number, height: number): Layout;
157
+ ComputeMaxContentAndLayout(): Layout;
158
+ ComputeMinContentAndLayout(): Layout;
159
+
160
+ PrintTree(): void;
161
+ Destroy(): void;
162
+ }
163
+
164
+ class Mason {
165
+ constructor();
166
+ static Instance(): Mason;
167
+ Clear(): void;
168
+ SetDeviceScale(scale: number): void;
169
+ Preflight: boolean;
170
+ CreateNode(anonymous: boolean): Node;
171
+ CreateTextNode(anonymous: boolean): Node;
172
+ CreateImageNode(): Node;
173
+ CreateButtonNode(): Node;
174
+ CreateLineBreakNode(): Node;
175
+ CreateListItemNode(): Node;
176
+ PrintTree(node: Node): void;
177
+ }
178
+
179
+ // Implemented by every Mason element (View + the leaf controls). A parent View pulls any child's
180
+ // Node into the layout tree through this.
181
+ interface IMasonElement {
182
+ readonly Node: Node;
183
+ readonly Style: Style;
184
+ SyncStyle(dirtyLow: string, dirtyHigh: string): void;
185
+ }
186
+
187
+ // Rasterized visual result (Image + size + overhang) returned by Css.CreateShadow/CreateBorder.
188
+ class CssImageResult {
189
+ readonly Image: any;
190
+ readonly Width: number;
191
+ readonly Height: number;
192
+ readonly Overhang: number;
193
+ }
194
+
195
+ // Visual CSS helpers driven by the .windows.ts layer. Colors are 0xAARRGGBB.
196
+ class Css {
197
+ static ApplyBackground(element: any, argb: number): void;
198
+ static ClearBackground(element: any): void;
199
+ static ApplyOpacity(element: any, opacity: number): void;
200
+ static ApplyTransform(element: any, m11: number, m12: number, m21: number, m22: number, offsetX: number, offsetY: number): void;
201
+ static ClearTransform(element: any): void;
202
+ static ApplyCornerRadius(element: any, offsetX: number, offsetY: number, width: number, height: number, radiusX: number, radiusY: number): void;
203
+ static ClearClip(element: any): void;
204
+ static CreateShadow(width: number, height: number, blurRadius: number, spread: number, cornerRadius: number, offsetX: number, offsetY: number, argb: number): CssImageResult;
205
+ static CreateBorder(width: number, height: number, topWidth: number, rightWidth: number, bottomWidth: number, leftWidth: number, topArgb: number, rightArgb: number, bottomArgb: number, leftArgb: number, cornerRadius: number): CssImageResult;
206
+ static ApplyLinearGradient(element: any, angleDegrees: number, stops: string): void;
207
+ static ApplyRadialGradient(element: any, stops: string): void;
208
+ static ReparentChild(parent: any, child: any, index: number): void;
209
+ static RemoveChild(parent: any, child: any): void;
210
+ static ApplyShadow(element: any, offsetX: number, offsetY: number, blurRadius: number, argb: number, cornerRadius: number): void;
211
+ static ClearShadow(element: any): void;
212
+ }
213
+
214
+ // A Mason-laid-out WinUI panel (a Microsoft.UI.Xaml.Controls.Panel) — the Windows analogue of the
215
+ // iOS MasonUIView / Android View. Owns a Node and runs Mason layout in its Measure/Arrange
216
+ // overrides. NodeKind: 0 generic/flex, 1 text, 2 image, 3 button, 4 list-item.
217
+ class View /* extends Microsoft.UI.Xaml.Controls.Panel, implements IMasonElement */ {
218
+ constructor();
219
+ constructor(nodeKind: number);
220
+ readonly Node: Node;
221
+ readonly Style: Style;
222
+ readonly NodeKind: number;
223
+ Invalidate(): void;
224
+ }
225
+
226
+ // Text leaf — hosts a TextBlock; Mason text node sized from the text's natural size.
227
+ class Text /* Panel, IMasonElement */ {
228
+ constructor();
229
+ readonly Node: Node;
230
+ readonly Style: Style;
231
+ Content: string;
232
+ FontSize: number;
233
+ // CSS font-family list.
234
+ SetFontFamily(families: string): void;
235
+ // Inline-run management: runs are TextNode descriptors composed into the TextBlock's Inlines.
236
+ // All text styling is read from the live style buffer on SyncStyle (no per-property setters).
237
+ SetRun(run: TextNode, index: number): void;
238
+ RemoveRun(run: TextNode): void;
239
+ ClearRuns(): void;
240
+ }
241
+
242
+ // Image leaf — hosts an Image; Source is a uri/path.
243
+ class Image /* Panel, IMasonElement */ {
244
+ constructor();
245
+ readonly Node: Node;
246
+ readonly Style: Style;
247
+ Source: string;
248
+ }
249
+
250
+ // Button leaf — hosts a Button; Content is the label.
251
+ class Button /* Panel, IMasonElement */ {
252
+ constructor();
253
+ readonly Node: Node;
254
+ readonly Style: Style;
255
+ Content: string;
256
+ }
257
+
258
+ // Line break — zero-size leaf backed by a line-break node (inline flow).
259
+ class Br /* Panel, IMasonElement */ {
260
+ constructor();
261
+ readonly Node: Node;
262
+ readonly Style: Style;
263
+ }
264
+
265
+ // List item — a container backed by a list-item node.
266
+ class Li /* Panel, IMasonElement */ {
267
+ constructor();
268
+ readonly Node: Node;
269
+ readonly Style: Style;
270
+ Invalidate(): void;
271
+ }
272
+
273
+ // <ul>/<ol> container.
274
+ class List /* Panel, IMasonElement */ {
275
+ constructor();
276
+ constructor(ordered: boolean);
277
+ readonly Node: Node;
278
+ readonly Style: Style;
279
+ readonly Ordered: boolean;
280
+ Invalidate(): void;
281
+ }
282
+
283
+ // Inline text node (DOM text node).
284
+ class TextNode /* Panel, IMasonElement */ {
285
+ constructor();
286
+ readonly Node: Node;
287
+ readonly Style: Style;
288
+ Data: string;
289
+ SetColor(argb: number): void;
290
+ SetFontSize(px: number): void;
291
+ SetFontWeight(weight: number): void;
292
+ SetLineHeight(multiplier: number): void;
293
+ SetLetterSpacing(px: number): void;
294
+ SetBreak(isBreak: boolean): void;
295
+ }
296
+
297
+ // <textarea> — native multiline TextBox.
298
+ class TextArea /* Panel, IMasonElement */ {
299
+ constructor();
300
+ readonly Node: Node;
301
+ readonly Style: Style;
302
+ Value: string;
303
+ Placeholder: string;
304
+ Rows: number;
305
+ Cols: number;
306
+ MaxLength: number;
307
+ }
308
+
309
+ // <input> — hosts a stock control chosen by Type (MasonInputType raw value).
310
+ class Input /* Panel, IMasonElement */ {
311
+ constructor();
312
+ readonly Node: Node;
313
+ readonly Style: Style;
314
+ Type: number;
315
+ Value: string;
316
+ Placeholder: string;
317
+ Multiple: boolean;
318
+ Accept: string;
319
+ }
320
+ }
321
+
322
+ // Platform build-time flag (defined by the @nativescript/windows webpack config, like __APPLE__).
323
+ declare const __WINDOWS__: boolean;
324
+
325
+ // @nativescript/windows runtime WinRT interop helpers (present when running on Windows).
326
+ declare const NSWinRT: {
327
+ toPromise<T = any>(op: any): Promise<T>;
328
+ asDelegate(typeName: string, fn: (...args: any[]) => any): any;
329
+ asDelegate(fn: (...args: any[]) => any): any;
330
+ };
package/vue/README.md ADDED
@@ -0,0 +1,66 @@
1
+ # @triniwiz/nativescript-masonkit/vue
2
+
3
+ Vue 3 support for MasonKit and `nativescript-vue`.
4
+
5
+ ## Setup
6
+
7
+ MasonKit ships this entry point, so no extra package is required. Install it in
8
+ the app entry file before starting Vue:
9
+
10
+ ```ts
11
+ import { createApp } from 'nativescript-vue';
12
+ import { installMasonKit } from '@triniwiz/nativescript-masonkit/vue';
13
+ import App from './App.vue';
14
+
15
+ installMasonKit();
16
+ createApp(App).start();
17
+ ```
18
+
19
+ The call registers MasonKit's native elements and all HTML-shaped elements from
20
+ `@triniwiz/nativescript-masonkit/web`. It is safe to call repeatedly during HMR.
21
+
22
+ ```vue
23
+ <template>
24
+ <div class="card">
25
+ <h2>{{ title }}</h2>
26
+ <span>{{ subtitle }}</span>
27
+ </div>
28
+ </template>
29
+ ```
30
+
31
+ Available native elements are `View`, `Text`, `Scroll`, `Img`, `Button`,
32
+ `Input`, `TextArea`, `Br`, `Ul`, `Ol` and `Li`. Web-shaped elements include
33
+ `div`, `section`, `header`, `footer`, `article`, `main`, `nav`, `aside`, `span`,
34
+ `code`, `h1`-`h6`, `p`, `ul`, `li`, `blockquote`, `b`, `strong` and `a`.
35
+
36
+ Names are case-insensitive and ignore hyphens, following NativeScript-Vue's
37
+ normalization rules.
38
+
39
+ ## Options
40
+
41
+ ```ts
42
+ installMasonKit({ web: false }); // native MasonKit elements only
43
+ installMasonKit({ mason: false }); // HTML-shaped elements only
44
+ ```
45
+
46
+ Tags that NativeScript-Vue already registers (core's `Button` and `Span`) are
47
+ replaced by MasonKit's Taffy-backed implementations. The core elements stay
48
+ available under an `n` prefix: `<nbutton>` and `<nspan>`. Use `<nspan>` inside
49
+ `<Label><FormattedString>`, which needs core's `Span`.
50
+
51
+ Vue components do not create native host elements: their root view (or fragment)
52
+ is rendered directly. Attributes and classes on a component are therefore
53
+ forwarded by Vue to a single root as usual; use an explicit `<View>` or `<div>`
54
+ when a component needs its own box, especially for multi-root components.
55
+
56
+ ## Custom elements
57
+
58
+ Use `masonMeta` when registering a custom MasonKit `View` subclass. It ensures
59
+ Vue insertions and removals use MasonKit's child bookkeeping:
60
+
61
+ ```ts
62
+ import { registerElement } from 'nativescript-vue';
63
+ import { masonMeta } from '@triniwiz/nativescript-masonkit/vue';
64
+
65
+ registerElement('MyBox', () => MyBox, masonMeta);
66
+ ```
package/vue/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export { installMasonKit } from './src/element-registry';
2
+ export type { InstallMasonKitOptions } from './src/element-registry';
3
+ export { masonMeta } from './src/mason-meta';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/nativescript-masonkit/vue/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,YAAY,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC"}
package/vue/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { installMasonKit } from './src/element-registry';
2
+ export { masonMeta } from './src/mason-meta';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/nativescript-masonkit/vue/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@triniwiz/nativescript-masonkit-vue",
3
+ "version": "1.0.0-beta.95",
4
+ "description": "NativeScript-Vue 3 integration for @triniwiz/nativescript-masonkit — registers MasonKit's web-standards layout elements and preserves child order via masonMeta.",
5
+ "main": "index.js",
6
+ "module": "index.js",
7
+ "types": "index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./index.d.ts",
11
+ "default": "./index.js"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
15
+ "sideEffects": true,
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/triniwiz/nativescript-mason.git"
19
+ },
20
+ "keywords": [
21
+ "NativeScript",
22
+ "Vue",
23
+ "nativescript-vue",
24
+ "layout",
25
+ "flexbox",
26
+ "grid",
27
+ "mason"
28
+ ],
29
+ "author": {
30
+ "name": "Osei Fortune",
31
+ "email": "fortune.osei@yahoo.com"
32
+ },
33
+ "license": "Apache-2.0",
34
+ "homepage": "https://github.com/triniwiz/nativescript-mason",
35
+ "peerDependencies": {
36
+ "@triniwiz/nativescript-masonkit": ">=1.0.0-beta.95",
37
+ "nativescript-vue": "^3.0.0"
38
+ }
39
+ }
@@ -0,0 +1,18 @@
1
+ import { type GetMasonKitElementsOptions } from '@triniwiz/nativescript-masonkit/elements';
2
+ export type InstallMasonKitOptions = GetMasonKitElementsOptions;
3
+ /**
4
+ * Install MasonKit's Vue 3 integration: register all requested MasonKit
5
+ * elements with NativeScript-Vue 3.
6
+ *
7
+ * Call before `createApp(...).start()` so element registration is complete
8
+ * before the first template renders. Idempotent - safe to call repeatedly,
9
+ * including during HMR. Attaches {@link masonMeta} to containers so child
10
+ * order is preserved.
11
+ *
12
+ * The tag list itself — including the "`/web`'s more specific element wins"
13
+ * de-duplication between `/web` and MasonKit's own widgets — comes from the
14
+ * shared {@link getMasonKitElements}, so it can never drift from what other
15
+ * framework integrations register.
16
+ */
17
+ export declare function installMasonKit(options?: InstallMasonKitOptions): void;
18
+ //# sourceMappingURL=element-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element-registry.d.ts","sourceRoot":"","sources":["../../../../../packages/nativescript-masonkit/vue/src/element-registry.ts"],"names":[],"mappings":"AACA,OAAO,EAA0C,KAAK,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAInI,MAAM,MAAM,sBAAsB,GAAG,0BAA0B,CAAC;AAuChE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE,sBAA2B,GAAG,IAAI,CAI1E"}
@@ -0,0 +1,56 @@
1
+ import { getViewClass, getViewMeta, isKnownView, normalizeElementName, registerElement } from 'nativescript-vue';
2
+ import { getMasonKitElements } from '@triniwiz/nativescript-masonkit/elements';
3
+ import { masonMeta } from './mason-meta';
4
+ /** Names this integration owns, normalized exactly as NativeScript-Vue does. */
5
+ const registered = new Set();
6
+ /**
7
+ * Keep a tag NativeScript-Vue already registers (core's `Button`, `Span`, ...)
8
+ * reachable as `n<tag>` before MasonKit's element takes over the real name, so
9
+ * `<button>`/`<span>` are MasonKit's and `<nbutton>`/`<nspan>` are core's.
10
+ *
11
+ * Core's `Span` matters most: NativeScript-Vue's `FormattedString` element
12
+ * pushes its children straight into `nativeView.spans`, so
13
+ * `<Label><FormattedString><nspan>` still needs the core class.
14
+ */
15
+ function preserveCoreElement(tag) {
16
+ const alias = `n${tag}`;
17
+ if (!isKnownView(tag) || isKnownView(alias)) {
18
+ return;
19
+ }
20
+ // Resolve eagerly: once `tag` is overwritten, `getViewClass(tag)` would
21
+ // return MasonKit's class instead.
22
+ const coreClass = getViewClass(tag);
23
+ registerElement(alias, () => coreClass, getViewMeta(tag));
24
+ }
25
+ function register(tag, cls, isContainer) {
26
+ const key = tag ? normalizeElementName(tag) : '';
27
+ if (!key || registered.has(key)) {
28
+ return;
29
+ }
30
+ preserveCoreElement(tag);
31
+ registerElement(tag, () => cls, {
32
+ ...(isContainer ? masonMeta : undefined),
33
+ overwriteExisting: isKnownView(tag),
34
+ });
35
+ registered.add(key);
36
+ }
37
+ /**
38
+ * Install MasonKit's Vue 3 integration: register all requested MasonKit
39
+ * elements with NativeScript-Vue 3.
40
+ *
41
+ * Call before `createApp(...).start()` so element registration is complete
42
+ * before the first template renders. Idempotent - safe to call repeatedly,
43
+ * including during HMR. Attaches {@link masonMeta} to containers so child
44
+ * order is preserved.
45
+ *
46
+ * The tag list itself — including the "`/web`'s more specific element wins"
47
+ * de-duplication between `/web` and MasonKit's own widgets — comes from the
48
+ * shared {@link getMasonKitElements}, so it can never drift from what other
49
+ * framework integrations register.
50
+ */
51
+ export function installMasonKit(options = {}) {
52
+ for (const { tag, ctor, isContainer } of getMasonKitElements(options)) {
53
+ register(tag, ctor, isContainer);
54
+ }
55
+ }
56
+ //# sourceMappingURL=element-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element-registry.js","sourceRoot":"","sources":["../../../../../packages/nativescript-masonkit/vue/src/element-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACjH,OAAO,EAAE,mBAAmB,EAAsD,MAAM,0CAA0C,CAAC;AAEnI,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,gFAAgF;AAChF,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;AAErC;;;;;;;;GAQG;AACH,SAAS,mBAAmB,CAAC,GAAW;IACtC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;IACxB,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5C,OAAO;IACT,CAAC;IACD,wEAAwE;IACxE,mCAAmC;IACnC,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IACpC,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED,SAAS,QAAQ,CAAC,GAAW,EAAE,GAAiB,EAAE,WAAoB;IACpE,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACjD,IAAI,CAAC,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QAChC,OAAO;IACT,CAAC;IAED,mBAAmB,CAAC,GAAG,CAAC,CAAC;IACzB,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE;QAC9B,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;QACxC,iBAAiB,EAAE,WAAW,CAAC,GAAG,CAAC;KACpC,CAAC,CAAC;IACH,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACtB,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,eAAe,CAAC,UAAkC,EAAE;IAClE,KAAK,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,mBAAmB,CAAC,OAAO,CAAC,EAAE,CAAC;QACtE,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IACnC,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { NSVViewMeta } from 'nativescript-vue';
2
+ /**
3
+ * NativeScript-Vue metadata that routes child insertions/removals through
4
+ * MasonKit's raw child APIs, preserving order across text and comment nodes.
5
+ */
6
+ export declare const masonMeta: Partial<NSVViewMeta>;
7
+ //# sourceMappingURL=mason-meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mason-meta.d.ts","sourceRoot":"","sources":["../../../../../packages/nativescript-masonkit/vue/src/mason-meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAoChE;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,OAAO,CAAC,WAAW,CA4B1C,CAAC"}
@@ -0,0 +1,91 @@
1
+ import { frameworkRegistry, readChildNodes } from '@triniwiz/nativescript-masonkit';
2
+ /**
3
+ * Nodes that occupy a slot in MasonKit's raw child list: elements and
4
+ * non-empty text nodes. Empty text nodes (Vue's keyed-fragment anchors) get no
5
+ * native text run, mirroring `textProperty.setNative` in the base package.
6
+ */
7
+ function isVisualOrTextNode(node) {
8
+ const t = node.nodeType;
9
+ if (t === 'text' || t === 3) {
10
+ return (node.text ?? '') !== '';
11
+ }
12
+ return t === 'element' || t === 1;
13
+ }
14
+ /** Convert Vue's element-only insertion index to MasonKit's raw child index. */
15
+ function rawChildIndex(parent, child) {
16
+ const childNodes = parent.childNodes ?? [];
17
+ const childIndex = childNodes.indexOf(child);
18
+ if (childIndex < 0)
19
+ return -1;
20
+ let rawIndex = 0;
21
+ for (let i = 0; i < childIndex; i++) {
22
+ if (isVisualOrTextNode(childNodes[i]))
23
+ rawIndex++;
24
+ }
25
+ return rawIndex;
26
+ }
27
+ /**
28
+ * NativeScript-Vue metadata that routes child insertions/removals through
29
+ * MasonKit's raw child APIs, preserving order across text and comment nodes.
30
+ */
31
+ export const masonMeta = {
32
+ nodeOps: {
33
+ insert(child, parent, atIndex) {
34
+ const parentView = parent.nativeView;
35
+ if (typeof atIndex !== 'number') {
36
+ // Appends arrive without an index; route through MasonKit's append path
37
+ // so text nodes do not throw off the insertion point.
38
+ parentView.addChild(child.nativeView);
39
+ return;
40
+ }
41
+ // Vue counts only elements; MasonKit includes native text runs, so map
42
+ // the insertion index to the raw child list.
43
+ const index = rawChildIndex(parent, child);
44
+ const rawIndex = index > -1 ? index : atIndex;
45
+ // Keyed fragments may supply an index while appending before a comment
46
+ // anchor that occupies no MasonKit slot. Treat that as an append too.
47
+ if (Array.isArray(parentView._children) && rawIndex >= parentView._children.length) {
48
+ parentView.addChild(child.nativeView);
49
+ }
50
+ else {
51
+ parentView.insertChild(child.nativeView, rawIndex);
52
+ }
53
+ },
54
+ remove(child, parent) {
55
+ parent.nativeView.removeChild(child.nativeView);
56
+ },
57
+ },
58
+ };
59
+ /**
60
+ * Framework adapter: NativeScript-Vue stores the NSVElement under an
61
+ * 'elementRef' symbol on the native view. Registered after the built-in
62
+ * defaults, so it is checked before the generic DOM-shim adapter.
63
+ */
64
+ function getVueElement(view) {
65
+ const symbols = Object.getOwnPropertySymbols(view);
66
+ for (const sym of symbols) {
67
+ if (sym.description === 'elementRef' || sym.description === '') {
68
+ const el = view[sym];
69
+ if (el && Array.isArray(el.childNodes)) {
70
+ return el;
71
+ }
72
+ }
73
+ }
74
+ return null;
75
+ }
76
+ frameworkRegistry.register({
77
+ name: 'nativescript-vue',
78
+ getElement: getVueElement,
79
+ getChildren: readChildNodes,
80
+ classify(node) {
81
+ if (node.nodeType === 'text' || node.nodeType === 3) {
82
+ return 'text';
83
+ }
84
+ if (node.nodeType === 'element' || node.nodeType === 1) {
85
+ return 'element';
86
+ }
87
+ return 'none';
88
+ },
89
+ syntheticTextOnEmpty: true,
90
+ });
91
+ //# sourceMappingURL=mason-meta.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mason-meta.js","sourceRoot":"","sources":["../../../../../packages/nativescript-masonkit/vue/src/mason-meta.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AASpF;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,IAA4C;IACtE,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;IACxB,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC;IAClC,CAA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