@triniwiz/nativescript-masonkit 1.0.0-beta.87 → 1.0.0-beta.88

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 (105) hide show
  1. package/DOCS.md +16 -4
  2. package/angular/README.md +204 -0
  3. package/angular/fesm2022/triniwiz-nativescript-masonkit-angular.mjs +496 -0
  4. package/angular/fesm2022/triniwiz-nativescript-masonkit-angular.mjs.map +1 -0
  5. package/angular/package.json +19 -0
  6. package/angular/types/triniwiz-nativescript-masonkit-angular.d.ts +181 -0
  7. package/button/index.android.d.ts +2 -1
  8. package/button/index.ios.d.ts +2 -1
  9. package/button/index.windows.d.ts +2 -1
  10. package/common.d.ts +102 -1
  11. package/common.js +93 -2
  12. package/common.js.map +1 -1
  13. package/img/index.android.d.ts +2 -1
  14. package/img/index.ios.d.ts +2 -1
  15. package/img/index.windows.d.ts +2 -1
  16. package/index.d.ts +21 -10
  17. package/input/index.android.d.ts +5 -1
  18. package/input/index.ios.d.ts +7 -1
  19. package/input/index.windows.d.ts +6 -1
  20. package/package.json +3 -1
  21. package/platforms/android/masonkit-release.aar +0 -0
  22. package/platforms/ios/Mason.xcframework/Info.plist +2 -36
  23. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason-Swift.h +26 -0
  24. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/mason_native.h +27 -2
  25. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Mason +0 -0
  26. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  27. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.abi.json +2630 -979
  28. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.private.swiftinterface +37 -1
  29. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  30. package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftinterface +37 -1
  31. package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  32. package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8457 -8378
  33. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason-Swift.h +52 -0
  34. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/mason_native.h +27 -2
  35. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Mason +0 -0
  36. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  37. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  38. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.abi.json +2630 -979
  39. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +37 -1
  40. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  41. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftinterface +37 -1
  42. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +2630 -979
  43. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +37 -1
  44. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  45. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +37 -1
  46. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/_CodeSignature/CodeResources +28 -28
  47. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  48. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8452 -8373
  49. package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +8090 -8017
  50. package/platforms/windows/arm64/NativeScript.Mason.dll +0 -0
  51. package/platforms/windows/arm64/NativeScript.Mason.winmd +0 -0
  52. package/platforms/windows/x64/NativeScript.Mason.dll +0 -0
  53. package/platforms/windows/x64/NativeScript.Mason.winmd +0 -0
  54. package/properties.d.ts +4 -0
  55. package/properties.js +58 -15
  56. package/properties.js.map +1 -1
  57. package/style.d.ts +37 -37
  58. package/style.js +299 -110
  59. package/style.js.map +1 -1
  60. package/text/index.android.d.ts +3 -1
  61. package/text/index.ios.d.ts +3 -1
  62. package/text/index.windows.d.ts +2 -1
  63. package/textarea/index.android.d.ts +6 -2
  64. package/textarea/index.ios.d.ts +6 -2
  65. package/textarea/index.windows.d.ts +6 -2
  66. package/utils/index.android.d.ts +15 -6
  67. package/utils/index.android.js +83 -2
  68. package/utils/index.android.js.map +1 -1
  69. package/utils/index.ios.d.ts +15 -6
  70. package/utils/index.ios.js +83 -2
  71. package/utils/index.ios.js.map +1 -1
  72. package/utils/index.windows.d.ts +11 -2
  73. package/utils/index.windows.js +9 -0
  74. package/utils/index.windows.js.map +1 -1
  75. package/view/index.ios.js +14 -1
  76. package/view/index.ios.js.map +1 -1
  77. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Headers/Mason-Swift.h +0 -1982
  78. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Headers/Mason.h +0 -25
  79. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Headers/mason_native.h +0 -499
  80. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Info.plist +0 -0
  81. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Mason +0 -0
  82. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-xros.swiftsourceinfo +0 -0
  83. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.abi.json +0 -98937
  84. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.private.swiftinterface +0 -3475
  85. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.swiftdoc +0 -0
  86. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.swiftinterface +0 -3475
  87. package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/module.modulemap +0 -10
  88. package/platforms/ios/Mason.xcframework/xros-arm64/dSYMs/Mason.framework.dSYM/Contents/Info.plist +0 -20
  89. package/platforms/ios/Mason.xcframework/xros-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  90. package/platforms/ios/Mason.xcframework/xros-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +0 -2134
  91. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Headers/Mason-Swift.h +0 -1982
  92. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Headers/Mason.h +0 -25
  93. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Headers/mason_native.h +0 -499
  94. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Info.plist +0 -0
  95. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Mason +0 -0
  96. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-xros-simulator.swiftsourceinfo +0 -0
  97. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.abi.json +0 -98937
  98. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.private.swiftinterface +0 -3475
  99. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.swiftdoc +0 -0
  100. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.swiftinterface +0 -3475
  101. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/module.modulemap +0 -10
  102. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/_CodeSignature/CodeResources +0 -212
  103. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/dSYMs/Mason.framework.dSYM/Contents/Info.plist +0 -20
  104. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
  105. package/platforms/ios/Mason.xcframework/xros-arm64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +0 -2134
@@ -0,0 +1,181 @@
1
+ import { ViewClassMeta } from '@nativescript/angular';
2
+
3
+ /** How a passthrough element can be identified. */
4
+ type PassthroughMatcher = string | RegExp | ((elementName: string) => boolean);
5
+ interface ComponentHostOptions {
6
+ /**
7
+ * Turn component-host mode off entirely while keeping element registration.
8
+ *
9
+ * @default true
10
+ */
11
+ enabled?: boolean;
12
+ /**
13
+ * Extra elements to keep as a transparent `ProxyViewContainer`. Strings are
14
+ * compared case-insensitively; regexes and predicates receive the raw element
15
+ * name.
16
+ *
17
+ * Routed components are handled automatically, so this is only needed for a
18
+ * component whose template root is a classic fill-parent view that this
19
+ * cannot see coming - another router outlet, a `Frame`, a `Page`.
20
+ */
21
+ passthrough?: PassthroughMatcher[];
22
+ /**
23
+ * Recognise page roots automatically: routed components at creation time, and
24
+ * any host that turns out to hold a `Frame`, `Page` or `ActionBar`.
25
+ *
26
+ * @default true
27
+ */
28
+ autoDetectPassthrough?: boolean;
29
+ /**
30
+ * Keep the Angular root component's host element a `ProxyViewContainer`.
31
+ *
32
+ * `AppHostView` only wraps the root in its full-screen root `GridLayout` when
33
+ * that root *is* a `ProxyViewContainer`, so the root element has to stay a
34
+ * passthrough for the tree below it to have a viewport-sized ancestor to
35
+ * resolve `height: 100%` against.
36
+ *
37
+ * Detected rather than hardcoded: Angular creates the root component's host
38
+ * element before anything in its template, so the first unregistered element
39
+ * this package is asked to create is the root.
40
+ *
41
+ * @default true
42
+ */
43
+ rootAsPassthrough?: boolean;
44
+ }
45
+ /**
46
+ * Turn every Angular component host element into a real MasonKit view.
47
+ *
48
+ * Stock `@nativescript/angular` creates a `ProxyViewContainer` for every element
49
+ * that is not `registerElement`'d - i.e. every Angular component selector. That
50
+ * container creates no native view, so anything placed on a component element
51
+ * (`backgroundColor`, `margin`, `class="..."`, host bindings) is set on an
52
+ * invisible logical wrapper with no visual effect, and the component is
53
+ * transparent to layout. Nesting components then produces layouts that do not
54
+ * match the template, because the boxes the template implies do not exist.
55
+ *
56
+ * This replaces that fallback with a {@link MasonComponentHost}, so a component
57
+ * host element is a real box, as on the web.
58
+ *
59
+ * Idempotent: repeated calls only update the configuration.
60
+ *
61
+ * Trade-off: an unknown element name (a typo, a component that was never
62
+ * declared) becomes a host instead of throwing "No known component for element
63
+ * X". Set `enabled: false` to keep the stock behaviour.
64
+ */
65
+ declare function enableMasonComponentHosts(options?: ComponentHostOptions): void;
66
+
67
+ interface RegisterElementsOptions {
68
+ /**
69
+ * Register MasonKit's own elements: `View`, `Text`, `Scroll`, `Img`, `Button`,
70
+ * `Input`, `TextArea`, `Br`, `Ul`, `Ol`, `Li`.
71
+ *
72
+ * @default true
73
+ */
74
+ mason?: boolean;
75
+ /**
76
+ * Register the HTML-shaped elements from `@triniwiz/nativescript-masonkit/web`
77
+ * (`div`, `section`, `p`, `span`, `h1`–`h6`, `blockquote`, `code`, `a`, ...).
78
+ *
79
+ * @default true
80
+ */
81
+ web?: boolean;
82
+ }
83
+ /**
84
+ * Register MasonKit's elements with `@nativescript/angular`, each with the child
85
+ * bookkeeping meta it needs (see {@link masonMeta}).
86
+ *
87
+ * Safe to call more than once - later calls skip names already registered here.
88
+ *
89
+ * ## Shadowing
90
+ *
91
+ * `registerElement` overwrites silently, and `@nativescript/angular` registers
92
+ * every element under its original, lowercase and kebab spellings. MasonKit's
93
+ * `Button`, `Img` and `/web`'s `Span` therefore *replace* core's `Button`,
94
+ * `img` (`Image`) and `Span` for Angular templates. That is the intent - these
95
+ * are the MasonKit-laid-out equivalents - but it is why `mason`/`web` can each
96
+ * be turned off if an app wants to keep the classic widgets.
97
+ */
98
+ declare function registerMasonKitElements(options?: RegisterElementsOptions): void;
99
+
100
+ interface InstallMasonKitOptions extends RegisterElementsOptions {
101
+ /**
102
+ * Component-host mode: make every Angular component host element a real
103
+ * MasonKit view instead of an invisible `ProxyViewContainer`.
104
+ *
105
+ * On by default - installing this is taken as the statement that MasonKit is
106
+ * how the app lays out. Pass `false`, or an options object with
107
+ * `enabled: false`, to opt out and keep stock `@nativescript/angular`
108
+ * behaviour while still getting the element registrations.
109
+ *
110
+ * @default true
111
+ */
112
+ componentHosts?: boolean | ComponentHostOptions;
113
+ }
114
+ /**
115
+ * Install MasonKit's Angular integration.
116
+ *
117
+ * Call this in `main.ts` **before** `runNativeScriptAngularApp()`:
118
+ *
119
+ * ```ts
120
+ * import { installMasonKit } from '@triniwiz/nativescript-masonkit/angular';
121
+ *
122
+ * installMasonKit();
123
+ *
124
+ * runNativeScriptAngularApp({
125
+ * appModuleBootstrap: () => platformNativeScript().bootstrapModule(AppModule),
126
+ * });
127
+ * ```
128
+ *
129
+ * It has to run before the bootstrap, not as part of it: the element map and
130
+ * the renderer patch must be in place before Angular creates the root
131
+ * component's host element, and an `NgModule` import or an `APP_INITIALIZER`
132
+ * would both be too late for some of that. A plain function call at the top of
133
+ * the entry file is unambiguous about when it happens.
134
+ *
135
+ * Idempotent - element registration is deduplicated and the component-host
136
+ * patches are installed once, then only reconfigured.
137
+ */
138
+ declare function installMasonKit(options?: InstallMasonKitOptions): void;
139
+
140
+ /**
141
+ * `ViewClassMeta` that routes Angular's visual-tree mutations through MasonKit's
142
+ * own child bookkeeping.
143
+ *
144
+ * ## Why every MasonKit element needs this
145
+ *
146
+ * MasonKit's `ViewBase` extends `CustomLayoutView`, **not** `LayoutBase`.
147
+ * `@nativescript/angular`'s `ViewUtil` branches on `view instanceof LayoutBase`,
148
+ * so without a meta a MasonKit container falls into the generic fallbacks:
149
+ *
150
+ * - `addToVisualTree` → `parent._addChildFromBuilder(name, child)`, which is a
151
+ * plain `addChild()` append. The resolved `next` sibling is **discarded**, so
152
+ * anything Angular inserts in the middle of a container (`*ngIf` toggling on,
153
+ * `*ngFor` reordering, a router swap) lands at the end and the Taffy tree ends
154
+ * up in a different order than the template.
155
+ * - `removeFromVisualTree` → core's `parent._removeView(child)`, which bypasses
156
+ * MasonKit's `removeChild()` entirely. The native view detaches but the entry
157
+ * stays in `_children`, and since `_children` is what drives native insertion
158
+ * indices (`_nativeIndexFor`), every later insert into that container is
159
+ * misplaced - the classic "nested components lay out wrong" symptom.
160
+ *
161
+ * Routing through `insertChild`/`addChild`/`removeChild` keeps the Taffy tree,
162
+ * the `_children` bookkeeping and the native view tree in step. This is the same
163
+ * contract `frameMeta`/`formattedStringMeta` use for their containers.
164
+ *
165
+ * ## Why `insertChild` must not throw
166
+ *
167
+ * `next` is whatever `ViewUtil.findNextVisual()` resolved to, which is not
168
+ * guaranteed to be a node MasonKit ever tracked. MasonKit's own `insertBefore()`
169
+ * throws `NotFoundError` for an unknown reference; thrown from here that would
170
+ * abort the component's change detection and blank it. An unknown reference
171
+ * simply degrades to an append, exactly as `insertToLayout` does for classic
172
+ * layouts.
173
+ *
174
+ * Invisible nodes (Angular's `CommentNode`/`TextNode`) are intentionally left to
175
+ * `ViewUtil`'s default handling: it assigns `parent.text`, which MasonKit's
176
+ * `textProperty.setNative` already reconciles into real native text nodes.
177
+ */
178
+ declare const masonMeta: ViewClassMeta;
179
+
180
+ export { enableMasonComponentHosts, installMasonKit, masonMeta, registerMasonKitElements };
181
+ export type { ComponentHostOptions, InstallMasonKitOptions, PassthroughMatcher, RegisterElementsOptions };
@@ -1,7 +1,8 @@
1
1
  import { ViewBase } from '@nativescript/core';
2
- import { ButtonBase } from '../common';
2
+ import { ButtonBase, textContentProperty } from '../common';
3
3
  import { style_ } from '../symbols';
4
4
  export declare class Button extends ButtonBase {
5
+ [textContentProperty.setNative]: (value: any) => void;
5
6
  [style_]: any;
6
7
  _inBatch: boolean;
7
8
  private __view;
@@ -1,8 +1,9 @@
1
1
  import { ViewBase } from '@nativescript/core';
2
- import { ButtonBase } from '../common';
2
+ import { ButtonBase, textContentProperty } from '../common';
3
3
  import { Style } from '../style';
4
4
  import { style_ } from '../symbols';
5
5
  export declare class Button extends ButtonBase {
6
+ [textContentProperty.setNative]: (value: any) => void;
6
7
  [style_]: any;
7
8
  _inBatch: boolean;
8
9
  constructor();
@@ -1,7 +1,8 @@
1
- import { ButtonBase } from '../common';
1
+ import { ButtonBase, textContentProperty } from '../common';
2
2
  import { Style } from '../style';
3
3
  import { style_ } from '../symbols';
4
4
  export declare class Button extends ButtonBase {
5
+ [textContentProperty.setNative]: (value: any) => void;
5
6
  [style_]: any;
6
7
  _inBatch: boolean;
7
8
  constructor();
package/common.d.ts CHANGED
@@ -1,6 +1,9 @@
1
- import { AddChildFromBuilder, CustomLayoutView, View as NSView, ViewBase as NSViewBase, Property, CoreTypes } from '@nativescript/core';
1
+ import { AddChildFromBuilder, CustomLayoutView, View as NSView, ViewBase as NSViewBase, Property, widthProperty, heightProperty, CoreTypes, marginLeftProperty, marginRightProperty, marginTopProperty, marginBottomProperty, minWidthProperty, minHeightProperty, fontSizeProperty, fontWeightProperty, fontStyleProperty, colorProperty, lineHeightProperty, letterSpacingProperty, textAlignmentProperty, textDecorationProperty, borderLeftWidthProperty, borderTopWidthProperty, borderRightWidthProperty, borderBottomWidthProperty, backgroundColorProperty, paddingLeftProperty, paddingRightProperty, paddingTopProperty, paddingBottomProperty, zIndexProperty } from '@nativescript/core';
2
2
  import { Display, Gap, GridAutoFlow, JustifyItems, JustifySelf, Length, LengthAuto, Overflow, Position, BoxSizing, VerticalAlign, FlexDirection, Float, Clear } from '.';
3
+ import { alignItemsProperty, alignSelfProperty, flexDirectionProperty, flexGrowProperty, flexShrinkProperty, flexWrapProperty, justifyContentProperty } from '@nativescript/core/ui/layouts/flexbox-layout';
4
+ import { fontInternalProperty } from '@nativescript/core/ui/styling/style-properties';
3
5
  import { Style } from './style';
6
+ import { alignContentProperty, aspectRatioProperty, backgroundProperty, borderProperty, borderLeftProperty, borderTopProperty, borderRightProperty, borderBottomProperty, borderRadiusProperty, bottomProperty, boxSizingProperty, clearProperty, columnGapProperty, cornerShapeProperty, displayProperty, filterProperty, flexBasisProperty, floatProperty, gridAreaProperty, gridAutoColumnsProperty, gridAutoFlowProperty, gridAutoRowsProperty, gridColumnEndProperty, gridColumnProperty, gridColumnStartProperty, gridRowEndProperty, gridRowProperty, gridRowStartProperty, gridTemplateAreasProperty, gridTemplateColumnsProperty, gridTemplateRowsProperty, justifyItemsProperty, justifySelfProperty, leftProperty, marginProperty, maxHeightProperty, maxWidthProperty, overflowXProperty, overflowYProperty, paddingProperty, positionProperty, rightProperty, rowGapProperty, scrollBarWidthProperty, textOverFlowProperty, textProperty, textWrapProperty, topProperty, verticalAlignProperty, boxShadowProperty, transformProperty, borderColorProperty, borderStyleProperty, backgroundImageProperty, listStyleTypeProperty, listStylePositionProperty } from './properties';
4
7
  import { isMasonView_, isTextChild_, isText_, native_, pseudoStyles_ } from './symbols';
5
8
  import { TextNode } from './text-node';
6
9
  export interface MasonChild extends ViewBase {
@@ -59,6 +62,95 @@ declare module '@nativescript/core/ui/styling/style' {
59
62
  }
60
63
  }
61
64
  export declare class ViewBase extends CustomLayoutView implements AddChildFromBuilder {
65
+ [zIndexProperty.setNative]: (value: number) => void;
66
+ [verticalAlignProperty.setNative]: (value: any) => void;
67
+ [textWrapProperty.setNative]: (value: any) => void;
68
+ [aspectRatioProperty.setNative]: (value: any) => void;
69
+ [textProperty.setNative]: (value: string) => void;
70
+ [filterProperty.setNative]: (value: any) => void;
71
+ [borderRadiusProperty.setNative]: (value: any) => void;
72
+ [borderProperty.setNative]: (value: any) => void;
73
+ [borderLeftProperty.setNative]: (value: any) => void;
74
+ [borderTopProperty.setNative]: (value: any) => void;
75
+ [borderRightProperty.setNative]: (value: any) => void;
76
+ [borderBottomProperty.setNative]: (value: any) => void;
77
+ [backgroundProperty.setNative]: (value: any) => void;
78
+ [backgroundColorProperty.setNative]: (value: any) => void;
79
+ [borderLeftWidthProperty.setNative]: (value: CoreTypes.LengthType) => void;
80
+ [borderTopWidthProperty.setNative]: (value: CoreTypes.LengthType) => void;
81
+ [borderRightWidthProperty.setNative]: (value: CoreTypes.LengthType) => void;
82
+ [borderBottomWidthProperty.setNative]: (value: CoreTypes.LengthType) => void;
83
+ [lineHeightProperty.setNative]: (value: CoreTypes.LengthType) => void;
84
+ [letterSpacingProperty.setNative]: (value: CoreTypes.LengthType) => void;
85
+ [textAlignmentProperty.setNative]: (value: any) => void;
86
+ [textDecorationProperty.setNative]: (value: any) => void;
87
+ [borderColorProperty.setNative]: (value: any) => void;
88
+ [borderStyleProperty.setNative]: (value: any) => void;
89
+ [backgroundImageProperty.setNative]: (value: any) => void;
90
+ [listStyleTypeProperty.setNative]: (value: any) => void;
91
+ [listStylePositionProperty.setNative]: (value: any) => void;
92
+ [boxSizingProperty.setNative]: (value: any) => void;
93
+ [displayProperty.setNative]: (value: any) => void;
94
+ [overflowXProperty.setNative]: (value: any) => void;
95
+ [overflowYProperty.setNative]: (value: any) => void;
96
+ [scrollBarWidthProperty.setNative]: (value: any) => void;
97
+ [positionProperty.setNative]: (value: any) => void;
98
+ [colorProperty.setNative]: (value: any) => void;
99
+ [flexWrapProperty.setNative]: (value: any) => void;
100
+ [flexDirectionProperty.setNative]: (value: any) => void;
101
+ [flexGrowProperty.setNative]: (value: any) => void;
102
+ [flexShrinkProperty.setNative]: (value: any) => void;
103
+ [flexBasisProperty.setNative]: (value: any) => void;
104
+ [alignItemsProperty.setNative]: (value: any) => void;
105
+ [alignSelfProperty.setNative]: (value: any) => void;
106
+ [alignContentProperty.setNative]: (value: any) => void;
107
+ [justifyItemsProperty.setNative]: (value: any) => void;
108
+ [justifySelfProperty.setNative]: (value: any) => void;
109
+ [justifyContentProperty.setNative]: (value: any) => void;
110
+ [leftProperty.setNative]: (value: any) => void;
111
+ [rightProperty.setNative]: (value: any) => void;
112
+ [bottomProperty.setNative]: (value: any) => void;
113
+ [topProperty.setNative]: (value: any) => void;
114
+ [minWidthProperty.setNative]: (value: any) => void;
115
+ [minHeightProperty.setNative]: (value: any) => void;
116
+ [heightProperty.setNative]: (value: any) => void;
117
+ [widthProperty.setNative]: (value: any) => void;
118
+ [maxWidthProperty.setNative]: (value: any) => void;
119
+ [maxHeightProperty.setNative]: (value: any) => void;
120
+ [marginProperty.setNative]: (value: any) => void;
121
+ [marginLeftProperty.setNative]: (value: any) => void;
122
+ [marginRightProperty.setNative]: (value: any) => void;
123
+ [marginBottomProperty.setNative]: (value: any) => void;
124
+ [marginTopProperty.setNative]: (value: any) => void;
125
+ [paddingProperty.setNative]: (value: any) => void;
126
+ [paddingLeftProperty.setNative]: (value: any) => void;
127
+ [paddingRightProperty.setNative]: (value: any) => void;
128
+ [paddingTopProperty.setNative]: (value: any) => void;
129
+ [paddingBottomProperty.setNative]: (value: any) => void;
130
+ [rowGapProperty.setNative]: (value: any) => void;
131
+ [columnGapProperty.setNative]: (value: any) => void;
132
+ [gridColumnStartProperty.setNative]: (value: any) => void;
133
+ [gridColumnEndProperty.setNative]: (value: any) => void;
134
+ [gridColumnProperty.setNative]: (value: any) => void;
135
+ [gridRowStartProperty.setNative]: (value: any) => void;
136
+ [gridRowEndProperty.setNative]: (value: any) => void;
137
+ [gridRowProperty.setNative]: (value: any) => void;
138
+ [gridTemplateRowsProperty.setNative]: (value: any) => void;
139
+ [gridTemplateColumnsProperty.setNative]: (value: any) => void;
140
+ [gridAutoColumnsProperty.setNative]: (value: any) => void;
141
+ [gridAutoRowsProperty.setNative]: (value: any) => void;
142
+ [gridAutoFlowProperty.setNative]: (value: any) => void;
143
+ [gridAreaProperty.setNative]: (value: any) => void;
144
+ [gridTemplateAreasProperty.setNative]: (value: any) => void;
145
+ [fontSizeProperty.setNative]: (value: Length) => void;
146
+ [fontWeightProperty.setNative]: (value: any) => void;
147
+ [fontStyleProperty.setNative]: (value: any) => void;
148
+ [textOverFlowProperty.setNative]: (value: any) => void;
149
+ [clearProperty.setNative]: (value: any) => void;
150
+ [floatProperty.setNative]: (value: any) => void;
151
+ [cornerShapeProperty.setNative]: (value: any) => void;
152
+ [boxShadowProperty.setNative]: (value: any) => void;
153
+ [transformProperty.setNative]: (value: any) => void;
62
154
  _children: (NSView | {
63
155
  text?: string;
64
156
  } | TextNode)[];
@@ -99,6 +191,12 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
99
191
  constructor();
100
192
  get innerHTML(): string;
101
193
  set innerHTML(value: string);
194
+ private _rememberNativeOwner;
195
+ /**
196
+ * Returns the top-most Mason/NativeScript element at a point in this view's
197
+ * local coordinate space, similar to the browser's elementFromPoint().
198
+ */
199
+ elementFromPoint(x: number, y: number): ViewBase | NSViewBase | null;
102
200
  _pendingEventsRegistration: Array<{
103
201
  arg: string;
104
202
  callback: any;
@@ -160,6 +258,7 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
160
258
  private _nativeAddChild;
161
259
  private _nativeReplaceChild;
162
260
  private _setOrPushChild;
261
+ private _spliceOrPushChild;
163
262
  private _updateTextNode;
164
263
  private _syncTextRunLayout;
165
264
  get filter(): string;
@@ -244,6 +343,8 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
244
343
  get textOverFlow(): string;
245
344
  }
246
345
  export declare class TextBase extends ViewBase {
346
+ [fontInternalProperty.setNative]: (value: any) => void;
347
+ [textWrapProperty.setNative]: (value: any) => void;
247
348
  textContent: string;
248
349
  }
249
350
  export declare class ButtonBase extends TextBase {
package/common.js CHANGED
@@ -6,7 +6,7 @@ import { alignItemsProperty, alignSelfProperty, flexDirectionProperty, flexGrowP
6
6
  import { fontInternalProperty } from '@nativescript/core/ui/styling/style-properties';
7
7
  import { _forceStyleUpdate } from './utils';
8
8
  import { Style } from './style';
9
- import { alignContentProperty, aspectRatioProperty, backgroundProperty, borderProperty, borderLeftProperty, borderTopProperty, borderRightProperty, borderBottomProperty, borderRadiusProperty, bottomProperty, boxSizingProperty, clearProperty, columnGapProperty, cornerShapeProperty, displayProperty, filterProperty, flexBasisProperty, floatProperty, gridAreaProperty, gridAutoColumnsProperty, gridAutoFlowProperty, gridAutoRowsProperty, gridColumnEndProperty, gridColumnProperty, gridColumnStartProperty, gridRowEndProperty, gridRowProperty, gridRowStartProperty, gridTemplateAreasProperty, gridTemplateColumnsProperty, gridTemplateRowsProperty, justifyItemsProperty, justifySelfProperty, leftProperty, marginProperty, maxHeightProperty, maxWidthProperty, overflowXProperty, overflowYProperty, paddingProperty, positionProperty, rightProperty, rowGapProperty, scrollBarWidthProperty, textOverFlowProperty, textProperty, textWrapProperty, topProperty, verticalAlignProperty, boxShadowProperty, transformProperty, borderColorProperty, backgroundImageProperty, listStyleTypeProperty, listStylePositionProperty, } from './properties';
9
+ import { alignContentProperty, aspectRatioProperty, backgroundProperty, borderProperty, borderLeftProperty, borderTopProperty, borderRightProperty, borderBottomProperty, borderRadiusProperty, bottomProperty, boxSizingProperty, clearProperty, columnGapProperty, cornerShapeProperty, displayProperty, filterProperty, flexBasisProperty, floatProperty, gridAreaProperty, gridAutoColumnsProperty, gridAutoFlowProperty, gridAutoRowsProperty, gridColumnEndProperty, gridColumnProperty, gridColumnStartProperty, gridRowEndProperty, gridRowProperty, gridRowStartProperty, gridTemplateAreasProperty, gridTemplateColumnsProperty, gridTemplateRowsProperty, justifyItemsProperty, justifySelfProperty, leftProperty, marginProperty, maxHeightProperty, maxWidthProperty, overflowXProperty, overflowYProperty, paddingProperty, positionProperty, rightProperty, rowGapProperty, scrollBarWidthProperty, textOverFlowProperty, textProperty, textWrapProperty, topProperty, verticalAlignProperty, boxShadowProperty, transformProperty, borderColorProperty, borderStyleProperty, backgroundImageProperty, listStyleTypeProperty, listStylePositionProperty, } from './properties';
10
10
  import { isMasonView_, isTextChild_, isText_, isPlaceholder_, text_, native_, textNode_, textNodeIndex_, textNodeProxied_, pseudoStyles_ } from './symbols';
11
11
  import { Tree } from './tree';
12
12
  import { TextNode } from './text-node';
@@ -130,6 +130,43 @@ function getFrameworkElement(view) {
130
130
  _frameworkAccessorCache.set(view, false);
131
131
  return null;
132
132
  }
133
+ function getWeakRefValue(value) {
134
+ if (!value)
135
+ return null;
136
+ const maybeWeakRef = value;
137
+ if (typeof maybeWeakRef.get === 'function')
138
+ return maybeWeakRef.get();
139
+ if (typeof maybeWeakRef.deref === 'function')
140
+ return maybeWeakRef.deref();
141
+ return value;
142
+ }
143
+ function nativeOwnerFor(nativeView) {
144
+ if (!nativeView)
145
+ return null;
146
+ const owner = getWeakRefValue(nativeView.__masonOwner);
147
+ if (owner)
148
+ return owner;
149
+ return getFrameworkElement(nativeView);
150
+ }
151
+ function nativeViewFor(owner) {
152
+ return owner?.nativeViewProtected ?? owner?.[native_];
153
+ }
154
+ function findOwnerForNativeView(owner, nativeView) {
155
+ if (!owner || !nativeView)
156
+ return null;
157
+ const ownNativeView = nativeViewFor(owner);
158
+ if (ownNativeView === nativeView)
159
+ return owner;
160
+ const children = owner._children ?? owner._viewChildren;
161
+ if (!children)
162
+ return null;
163
+ for (const child of children) {
164
+ const match = findOwnerForNativeView(child, nativeView);
165
+ if (match)
166
+ return match;
167
+ }
168
+ return null;
169
+ }
133
170
  export const textContentProperty = new Property({
134
171
  name: 'textContent',
135
172
  affectsLayout: true,
@@ -202,6 +239,39 @@ export class ViewBase extends CustomLayoutView {
202
239
  }
203
240
  }
204
241
  }
242
+ _rememberNativeOwner(nativeView = nativeViewFor(this)) {
243
+ if (!nativeView)
244
+ return;
245
+ try {
246
+ nativeView.__masonOwner = new WeakRef(this);
247
+ }
248
+ catch (_) {
249
+ // Some host objects do not accept expandos; fallback tree matching still works.
250
+ }
251
+ }
252
+ /**
253
+ * Returns the top-most Mason/NativeScript element at a point in this view's
254
+ * local coordinate space, similar to the browser's elementFromPoint().
255
+ */
256
+ elementFromPoint(x, y) {
257
+ const nativeView = nativeViewFor(this) ?? this._view;
258
+ if (!nativeView)
259
+ return null;
260
+ this._rememberNativeOwner(nativeView);
261
+ let nativeHit = null;
262
+ if (__ANDROID__ && typeof nativeView.elementFromPoint === 'function') {
263
+ nativeHit = nativeView.elementFromPoint(x, y);
264
+ }
265
+ else if (__APPLE__) {
266
+ const hitTest = nativeView.mason_elementFromPointY ?? nativeView.mason_elementFromPoint ?? nativeView.elementFromPoint;
267
+ if (typeof hitTest === 'function') {
268
+ nativeHit = hitTest.call(nativeView, x, y);
269
+ }
270
+ }
271
+ if (!nativeHit)
272
+ return null;
273
+ return nativeOwnerFor(nativeHit) ?? findOwnerForNativeView(this, nativeHit);
274
+ }
205
275
  _registerNativeEvent(arg, callback, thisArg) {
206
276
  if (!this[native_]) {
207
277
  this._pendingEventsRegistration.push({ arg, callback, thisArg });
@@ -329,6 +399,7 @@ export class ViewBase extends CustomLayoutView {
329
399
  }
330
400
  initNativeView() {
331
401
  super.initNativeView();
402
+ this._rememberNativeOwner();
332
403
  if (this._pendingEventsRegistration.length > 0) {
333
404
  const pending = this._pendingEventsRegistration.splice(0);
334
405
  for (const registration of pending) {
@@ -901,6 +972,17 @@ export class ViewBase extends CustomLayoutView {
901
972
  this._children.push(entry);
902
973
  }
903
974
  }
975
+ // Splices a text-node entry in at `index`, shifting existing children right.
976
+ _spliceOrPushChild(index, entry) {
977
+ if (this._children.length > index) {
978
+ //@ts-ignore
979
+ this._children.splice(index, 0, entry);
980
+ }
981
+ else {
982
+ //@ts-ignore
983
+ this._children.push(entry);
984
+ }
985
+ }
904
986
  // -- Unified text node update (cross-platform) --
905
987
  _updateTextNode(node, operation = null) {
906
988
  const text = node.text ?? node.data ?? '';
@@ -923,7 +1005,7 @@ export class ViewBase extends CustomLayoutView {
923
1005
  break;
924
1006
  case 'insert':
925
1007
  this._nativeAddChild(textNode, operation.index);
926
- this._setOrPushChild(operation.index, entry);
1008
+ this._spliceOrPushChild(operation.index, entry);
927
1009
  break;
928
1010
  }
929
1011
  this._syncTextRunLayout();
@@ -1228,6 +1310,15 @@ export class ViewBase extends CustomLayoutView {
1228
1310
  }
1229
1311
  }
1230
1312
  // @ts-ignore
1313
+ [borderStyleProperty.setNative](value) {
1314
+ // @ts-ignore
1315
+ const style = this._styleHelper;
1316
+ if (style) {
1317
+ // @ts-ignore
1318
+ style.borderStyle = String(value ?? '');
1319
+ }
1320
+ }
1321
+ // @ts-ignore
1231
1322
  [backgroundImageProperty.setNative](value) {
1232
1323
  // @ts-ignore
1233
1324
  const style = this._styleHelper;