@triniwiz/nativescript-masonkit 1.0.0-beta.66 → 1.0.0-beta.68
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.
- package/DOCS.md +46 -0
- package/button/index.android.js +0 -1
- package/button/index.android.js.map +1 -1
- package/button/index.ios.js +6 -3
- package/button/index.ios.js.map +1 -1
- package/common.d.ts +40 -2
- package/common.js +173 -25
- package/common.js.map +1 -1
- package/index.android.d.ts +1 -0
- package/index.android.js +1 -0
- package/index.android.js.map +1 -1
- package/index.d.ts +29 -1
- package/index.ios.d.ts +1 -0
- package/index.ios.js +1 -0
- package/index.ios.js.map +1 -1
- package/input/common.js +1 -0
- package/input/common.js.map +1 -1
- package/li/index.ios.js +7 -4
- package/li/index.ios.js.map +1 -1
- package/package.json +6 -1
- package/platforms/android/masonkit-release.aar +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason-Swift.h +97 -12
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/mason_native.h +46 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Mason +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.abi.json +17963 -13015
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.private.swiftinterface +544 -358
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.swiftinterface +544 -358
- package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8589 -8290
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason-Swift.h +194 -24
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/mason_native.h +46 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Mason +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.abi.json +17963 -13015
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +544 -358
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.swiftinterface +544 -358
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +17963 -13015
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +544 -358
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +544 -358
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/_CodeSignature/CodeResources +28 -28
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8584 -8285
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +8236 -7949
- package/properties.d.ts +13 -1
- package/properties.js +66 -1
- package/properties.js.map +1 -1
- package/pseudo.d.ts +9 -0
- package/pseudo.js +58 -0
- package/pseudo.js.map +1 -0
- package/scroll/index.ios.d.ts +5 -3
- package/scroll/index.ios.js +53 -19
- package/scroll/index.ios.js.map +1 -1
- package/style.d.ts +138 -8
- package/style.js +619 -538
- package/style.js.map +1 -1
- package/symbols.d.ts +1 -0
- package/symbols.js +1 -0
- package/symbols.js.map +1 -1
- package/text/index.android.js +3 -2
- package/text/index.android.js.map +1 -1
- package/text/index.ios.d.ts +2 -1
- package/text/index.ios.js +36 -14
- package/text/index.ios.js.map +1 -1
- package/textarea/common.d.ts +8 -0
- package/textarea/common.js +28 -0
- package/textarea/common.js.map +1 -0
- package/textarea/index.android.d.ts +15 -0
- package/textarea/index.android.js +71 -0
- package/textarea/index.android.js.map +1 -0
- package/textarea/index.ios.d.ts +18 -0
- package/textarea/index.ios.js +134 -0
- package/textarea/index.ios.js.map +1 -0
- package/tree/index.android.d.ts +3 -0
- package/tree/index.android.js +10 -0
- package/tree/index.android.js.map +1 -1
- package/tree/index.ios.d.ts +19 -1
- package/tree/index.ios.js +25 -0
- package/tree/index.ios.js.map +1 -1
- package/view/index.ios.d.ts +1 -0
- package/view/index.ios.js +44 -21
- package/view/index.ios.js.map +1 -1
package/DOCS.md
CHANGED
|
@@ -398,6 +398,52 @@ Length values support `px`, `%`, `dip`, and `auto` (for margins).
|
|
|
398
398
|
| `minHeight` | `LengthAuto` | Minimum height |
|
|
399
399
|
| `maxWidth` | `LengthAuto` | Maximum width |
|
|
400
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.
|
|
401
447
|
| `aspectRatio` | `number` | Width-to-height ratio |
|
|
402
448
|
|
|
403
449
|
```xml
|
package/button/index.android.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.android.js","sourceRoot":"","sources":["../../../../packages/nativescript-masonkit/button/index.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAY,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG3E,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,UAAU;IAIpC;QACE,KAAK,EAAE,CAAC;QAHV,aAAQ,GAAG,KAAK,CAAC;QAIf,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;IAC5B,CAAC;IAED,IAAI,KAAK;QACP,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACnB,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,kBA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AAmB,EAAE,KAAc,CAAC,CAAC;QACnE,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED,+BAA+B,CAAC,IAAc;QAC5C,IAAI,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC;QAC3B,
|
|
1
|
+
{"version":3,"file":"index.android.js","sourceRoot":"","sources":["../../../../packages/nativescript-masonkit/button/index.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAY,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG3E,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,UAAU;IAIpC;QACE,KAAK,EAAE,CAAC;QAHV,aAAQ,GAAG,KAAK,CAAC;QAIf,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;IAC5B,CAAC;IAED,IAAI,KAAK;QACP,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACnB,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,kBAAkB,EAAE,IAAI,KAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;YAC5F,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,OAAO,CAAU,CAAC;QACnE,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAA2C,CAAC;IACjE,CAAC;IAED,6DAA6D;IAC7D,aAAa;IACb,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IA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
|
@@ -51,9 +51,12 @@ let Button = class Button extends ButtonBase {
|
|
|
51
51
|
layout = children.objectAtIndex(i);
|
|
52
52
|
const x = layout.x;
|
|
53
53
|
const y = layout.y;
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
|
|
54
|
+
const w = layout.width;
|
|
55
|
+
const h = layout.height;
|
|
56
|
+
const wSpec = Utils.layout.makeMeasureSpec(w, Utils.layout.EXACTLY);
|
|
57
|
+
const hSpec = Utils.layout.makeMeasureSpec(h, Utils.layout.EXACTLY);
|
|
58
|
+
View.measureChild(this, child, wSpec, hSpec);
|
|
59
|
+
child.layout(x, y, x + w, y + h);
|
|
57
60
|
i++;
|
|
58
61
|
}
|
|
59
62
|
}
|
package/button/index.ios.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.ios.js","sourceRoot":"","sources":["../../../../packages/nativescript-masonkit/button/index.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAY,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG3E,IAAM,MAAM,GAAZ,MAAM,MAAO,SAAQ,UAAU;IAGpC;QACE,KAAK,EAAE,CAAC;QAFV,aAAQ,GAAG,KAAK,CAAC;QAGf,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;IAC5B,CAAC;IAED,IAAI,KAAK;QACP,IAAI,CAAC,IAAI,CA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CAAC;QAC3B,KAAK,CAAC,+BAA+B,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED,mBAAmB,CAAC,UAAe,EAAE,KAAa;QAChD,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC;IAC3B,CAAC;CACF,CAAA;AAlLY,MAAM;IADlB,OAAO,CAAC,QAAQ,CAAC;;GACL,MAAM,CAkLlB"}
|
package/common.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AddChildFromBuilder, CustomLayoutView, View as NSView, ViewBase as NSViewBase, Property, CoreTypes } from '@nativescript/core';
|
|
2
2
|
import { Display, Gap, GridAutoFlow, JustifyItems, JustifySelf, Length, LengthAuto, Overflow, Position, BoxSizing, VerticalAlign, FlexDirection, Float, Clear } from '.';
|
|
3
|
-
import {
|
|
3
|
+
import { Style } from './style';
|
|
4
|
+
import { isMasonView_, isTextChild_, isText_, native_, pseudoStyles_ } from './symbols';
|
|
4
5
|
import { TextNode } from './text-node';
|
|
5
6
|
export interface MasonChild extends ViewBase {
|
|
6
7
|
}
|
|
@@ -54,6 +55,7 @@ declare module '@nativescript/core/ui/styling/style' {
|
|
|
54
55
|
float: Float;
|
|
55
56
|
clear: Clear;
|
|
56
57
|
cornerShape: string;
|
|
58
|
+
transform: string;
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
export declare class ViewBase extends CustomLayoutView implements AddChildFromBuilder {
|
|
@@ -63,8 +65,39 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
|
|
|
63
65
|
text?: string;
|
|
64
66
|
} | TextNode)[];
|
|
65
67
|
[isMasonView_]: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Enable or disable CSS Preflight (web-normalised / Tailwind-like) defaults
|
|
70
|
+
* for the entire Mason tree.
|
|
71
|
+
*
|
|
72
|
+
* When `true` every element starts from a clean, browser-normalised slate:
|
|
73
|
+
* - `box-sizing: border-box`
|
|
74
|
+
* - `margin: 0`, `padding: 0`, `border-width: 0`
|
|
75
|
+
* - `background: transparent`
|
|
76
|
+
* - `list-style: none` on `<ul>` / `<ol>`
|
|
77
|
+
* - `display: block` on `<img>` (replaced elements)
|
|
78
|
+
*
|
|
79
|
+
* This is a **tree-global** flag; it should ideally be set **before** views are
|
|
80
|
+
* created so that all new nodes inherit the preflight baseline. Changing it
|
|
81
|
+
* after views have been created re-seeds the arena defaults but does not
|
|
82
|
+
* retroactively restyle individually modified nodes.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* import { ViewBase } from '@triniwiz/nativescript-masonkit';
|
|
87
|
+
* ViewBase.preflight = true; // enable at app startup
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
static get preflight(): boolean;
|
|
91
|
+
static set preflight(value: boolean);
|
|
66
92
|
[isTextChild_]: boolean;
|
|
67
93
|
[isText_]: boolean;
|
|
94
|
+
[pseudoStyles_]: {
|
|
95
|
+
active?: Style;
|
|
96
|
+
focus?: Style;
|
|
97
|
+
blur?: Style;
|
|
98
|
+
hover?: Style;
|
|
99
|
+
disabled?: Style;
|
|
100
|
+
};
|
|
68
101
|
constructor();
|
|
69
102
|
get innerHTML(): string;
|
|
70
103
|
set innerHTML(value: string);
|
|
@@ -76,8 +109,14 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
|
|
|
76
109
|
_registerNativeEvent(arg: string, callback: any, thisArg?: any): void;
|
|
77
110
|
_unregisterNativeEvent(arg: string, callback: any, thisArg?: any): void;
|
|
78
111
|
initNativeView(): void;
|
|
112
|
+
_setNativeViewFrame(nativeView: any, frame: CGRect): void;
|
|
79
113
|
addEventListener(arg: string, callback: any, thisArg?: any): void;
|
|
80
114
|
removeEventListener(arg: string, callback: any, thisArg?: any): void;
|
|
115
|
+
private _applyPseudoClassStyles;
|
|
116
|
+
_handler(subscribe: boolean): void;
|
|
117
|
+
_disableHandler(subscribe: boolean): void;
|
|
118
|
+
_focusHandler(subscribe: boolean): void;
|
|
119
|
+
_blurHandler(subscribe: boolean): void;
|
|
81
120
|
forceStyleUpdate(): void;
|
|
82
121
|
get _viewChildren(): NSView[];
|
|
83
122
|
eachLayoutChild(callback: (child: NSView, isLast: boolean) => void): void;
|
|
@@ -107,7 +146,6 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
|
|
|
107
146
|
private _nativeReplaceChild;
|
|
108
147
|
private _setOrPushChild;
|
|
109
148
|
private _updateTextNode;
|
|
110
|
-
set text(value: string);
|
|
111
149
|
get filter(): string;
|
|
112
150
|
set filter(value: string);
|
|
113
151
|
set borderRadius(value: string | number | CoreTypes.LengthDipUnit | CoreTypes.LengthPxUnit);
|
package/common.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
var _a, _b, _c;
|
|
1
|
+
var _a, _b, _c, _d;
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
3
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
4
|
-
import { CustomLayoutView, View as NSView, getViewById, Property, widthProperty, heightProperty,
|
|
4
|
+
import { CustomLayoutView, View as NSView, getViewById, Property, widthProperty, heightProperty, marginLeftProperty, marginRightProperty, marginTopProperty, marginBottomProperty, minWidthProperty, minHeightProperty, fontSizeProperty, fontWeightProperty, fontStyleProperty, colorProperty, Color, lineHeightProperty, letterSpacingProperty, textAlignmentProperty, borderLeftWidthProperty, borderTopWidthProperty, borderRightWidthProperty, borderBottomWidthProperty, backgroundColorProperty, paddingLeftProperty, paddingRightProperty, paddingTopProperty, paddingBottomProperty, zIndexProperty, PseudoClassHandler } from '@nativescript/core';
|
|
5
5
|
import { alignItemsProperty, alignSelfProperty, flexDirectionProperty, flexGrowProperty, flexShrinkProperty, flexWrapProperty, justifyContentProperty } from '@nativescript/core/ui/layouts/flexbox-layout';
|
|
6
6
|
import { _forceStyleUpdate } from './utils';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { Style } from './style';
|
|
8
|
+
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, } from './properties';
|
|
9
|
+
import { isMasonView_, isTextChild_, isText_, isPlaceholder_, text_, native_, textNode_, textNodeIndex_, pseudoStyles_ } from './symbols';
|
|
9
10
|
import { Tree } from './tree';
|
|
10
11
|
import { TextNode } from './text-node';
|
|
12
|
+
import { compile } from './pseudo';
|
|
11
13
|
function getViewStyle(view) {
|
|
12
14
|
const ret = (__ANDROID__ ? view.get() : view.deref());
|
|
13
15
|
return ret._styleHelper;
|
|
@@ -72,12 +74,41 @@ export const textContentProperty = new Property({
|
|
|
72
74
|
defaultValue: '',
|
|
73
75
|
});
|
|
74
76
|
export class ViewBase extends CustomLayoutView {
|
|
77
|
+
/**
|
|
78
|
+
* Enable or disable CSS Preflight (web-normalised / Tailwind-like) defaults
|
|
79
|
+
* for the entire Mason tree.
|
|
80
|
+
*
|
|
81
|
+
* When `true` every element starts from a clean, browser-normalised slate:
|
|
82
|
+
* - `box-sizing: border-box`
|
|
83
|
+
* - `margin: 0`, `padding: 0`, `border-width: 0`
|
|
84
|
+
* - `background: transparent`
|
|
85
|
+
* - `list-style: none` on `<ul>` / `<ol>`
|
|
86
|
+
* - `display: block` on `<img>` (replaced elements)
|
|
87
|
+
*
|
|
88
|
+
* This is a **tree-global** flag; it should ideally be set **before** views are
|
|
89
|
+
* created so that all new nodes inherit the preflight baseline. Changing it
|
|
90
|
+
* after views have been created re-seeds the arena defaults but does not
|
|
91
|
+
* retroactively restyle individually modified nodes.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* import { ViewBase } from '@triniwiz/nativescript-masonkit';
|
|
96
|
+
* ViewBase.preflight = true; // enable at app startup
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
static get preflight() {
|
|
100
|
+
return Tree.instance.preflight;
|
|
101
|
+
}
|
|
102
|
+
static set preflight(value) {
|
|
103
|
+
Tree.instance.preflight = value;
|
|
104
|
+
}
|
|
75
105
|
constructor() {
|
|
76
106
|
super();
|
|
77
107
|
this._children = [];
|
|
78
108
|
this[_a] = false;
|
|
79
109
|
this[_b] = false;
|
|
80
110
|
this[_c] = false;
|
|
111
|
+
this[_d] = {};
|
|
81
112
|
this._pendingEventsRegistration = [];
|
|
82
113
|
}
|
|
83
114
|
get innerHTML() {
|
|
@@ -192,6 +223,9 @@ export class ViewBase extends CustomLayoutView {
|
|
|
192
223
|
}
|
|
193
224
|
}
|
|
194
225
|
}
|
|
226
|
+
_setNativeViewFrame(nativeView, frame) {
|
|
227
|
+
// nativeView.frame = frame;
|
|
228
|
+
}
|
|
195
229
|
addEventListener(arg, callback, thisArg) {
|
|
196
230
|
if (typeof thisArg === 'boolean') {
|
|
197
231
|
thisArg = {
|
|
@@ -205,6 +239,7 @@ export class ViewBase extends CustomLayoutView {
|
|
|
205
239
|
switch (arg) {
|
|
206
240
|
case 'input':
|
|
207
241
|
case 'change':
|
|
242
|
+
case 'click':
|
|
208
243
|
this._registerNativeEvent(arg, callback, thisArg);
|
|
209
244
|
break;
|
|
210
245
|
}
|
|
@@ -219,10 +254,45 @@ export class ViewBase extends CustomLayoutView {
|
|
|
219
254
|
switch (arg) {
|
|
220
255
|
case 'input':
|
|
221
256
|
case 'change':
|
|
257
|
+
case 'click':
|
|
222
258
|
this._unregisterNativeEvent(arg, callback, thisArg);
|
|
223
259
|
break;
|
|
224
260
|
}
|
|
225
261
|
}
|
|
262
|
+
_applyPseudoClassStyles(pseudoClass, view, styles) {
|
|
263
|
+
if (pseudoClass && styles && pseudoClass in styles) {
|
|
264
|
+
const current = styles[pseudoClass];
|
|
265
|
+
//@ts-ignore
|
|
266
|
+
const existing = this[pseudoStyles_]?.[pseudoClass];
|
|
267
|
+
const style = existing ?? Style.fromPseudo(pseudoClass, this, view);
|
|
268
|
+
if (style) {
|
|
269
|
+
for (const prop in current) {
|
|
270
|
+
style[prop] = current[prop];
|
|
271
|
+
}
|
|
272
|
+
this[pseudoStyles_][pseudoClass] = style;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
_handler(subscribe) {
|
|
277
|
+
const styles = compile(this);
|
|
278
|
+
//@ts-ignore
|
|
279
|
+
this._applyPseudoClassStyles('active', this._view, styles);
|
|
280
|
+
}
|
|
281
|
+
_disableHandler(subscribe) {
|
|
282
|
+
const styles = compile(this);
|
|
283
|
+
//@ts-ignore
|
|
284
|
+
this._applyPseudoClassStyles('disabled', this._view, styles);
|
|
285
|
+
}
|
|
286
|
+
_focusHandler(subscribe) {
|
|
287
|
+
const styles = compile(this);
|
|
288
|
+
//@ts-ignore
|
|
289
|
+
this._applyPseudoClassStyles('focus', this._view, styles);
|
|
290
|
+
}
|
|
291
|
+
_blurHandler(subscribe) {
|
|
292
|
+
const styles = compile(this);
|
|
293
|
+
//@ts-ignore
|
|
294
|
+
this._applyPseudoClassStyles('blur', this._view, styles);
|
|
295
|
+
}
|
|
226
296
|
forceStyleUpdate() {
|
|
227
297
|
_forceStyleUpdate(this);
|
|
228
298
|
}
|
|
@@ -415,7 +485,7 @@ export class ViewBase extends CustomLayoutView {
|
|
|
415
485
|
}
|
|
416
486
|
this._children.splice(0);
|
|
417
487
|
}
|
|
418
|
-
[(_a = isMasonView_, _b = isTextChild_, _c = isText_, zIndexProperty.setNative)](value) {
|
|
488
|
+
[(_a = isMasonView_, _b = isTextChild_, _c = isText_, _d = pseudoStyles_, zIndexProperty.setNative)](value) {
|
|
419
489
|
// @ts-ignore
|
|
420
490
|
const style = this._styleHelper;
|
|
421
491
|
if (style) {
|
|
@@ -542,21 +612,32 @@ export class ViewBase extends CustomLayoutView {
|
|
|
542
612
|
}
|
|
543
613
|
}
|
|
544
614
|
// -- Text setter with per-view framework detection --
|
|
545
|
-
|
|
615
|
+
[textProperty.setNative](value) {
|
|
546
616
|
const frameworkEl = getFrameworkElement(this);
|
|
547
617
|
if (frameworkEl) {
|
|
548
618
|
// Frameworks with childNodes array (Vue, React, Svelte, SolidJS)
|
|
549
619
|
if (Array.isArray(frameworkEl.childNodes)) {
|
|
550
|
-
const
|
|
551
|
-
if (
|
|
620
|
+
const rawChildNodes = frameworkEl.childNodes;
|
|
621
|
+
if (rawChildNodes.length === 0) {
|
|
552
622
|
this.replaceChild({ [text_]: value }, 0);
|
|
553
623
|
return;
|
|
554
624
|
}
|
|
555
|
-
|
|
556
|
-
|
|
625
|
+
// Deduplicate nodes (some frameworks expose the same nodes via both
|
|
626
|
+
// `childNodes` array and linked `nextSibling` references). Preserve
|
|
627
|
+
// original order while skipping duplicate references.
|
|
628
|
+
const nodes = [];
|
|
629
|
+
const seen = new Set();
|
|
630
|
+
for (let n of rawChildNodes) {
|
|
631
|
+
if (!seen.has(n)) {
|
|
632
|
+
seen.add(n);
|
|
633
|
+
nodes.push(n);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
637
|
+
const node = nodes[i];
|
|
557
638
|
const isTextNode = node.nodeType === 'text' || node.nodeType === 3;
|
|
558
639
|
if (isTextNode) {
|
|
559
|
-
const type = i === 0 &&
|
|
640
|
+
const type = i === 0 && nodes.length === 1 && !this._children.length ? 'add' : 'replace';
|
|
560
641
|
this._updateTextNode(node, { type, index: i, isBreak: node.nodeName === 'br' });
|
|
561
642
|
}
|
|
562
643
|
}
|
|
@@ -646,6 +727,38 @@ export class ViewBase extends CustomLayoutView {
|
|
|
646
727
|
style.border = value;
|
|
647
728
|
}
|
|
648
729
|
}
|
|
730
|
+
[borderLeftProperty.setNative](value) {
|
|
731
|
+
// @ts-ignore
|
|
732
|
+
const style = this._styleHelper;
|
|
733
|
+
if (style) {
|
|
734
|
+
// @ts-ignore
|
|
735
|
+
style.borderLeft = value;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
[borderTopProperty.setNative](value) {
|
|
739
|
+
// @ts-ignore
|
|
740
|
+
const style = this._styleHelper;
|
|
741
|
+
if (style) {
|
|
742
|
+
// @ts-ignore
|
|
743
|
+
style.borderTop = value;
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
[borderRightProperty.setNative](value) {
|
|
747
|
+
// @ts-ignore
|
|
748
|
+
const style = this._styleHelper;
|
|
749
|
+
if (style) {
|
|
750
|
+
// @ts-ignore
|
|
751
|
+
style.borderRight = value;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
[borderBottomProperty.setNative](value) {
|
|
755
|
+
// @ts-ignore
|
|
756
|
+
const style = this._styleHelper;
|
|
757
|
+
if (style) {
|
|
758
|
+
// @ts-ignore
|
|
759
|
+
style.borderBottom = value;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
649
762
|
// @ts-ignore
|
|
650
763
|
set background(value) {
|
|
651
764
|
this.style.background = value;
|
|
@@ -1038,14 +1151,7 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1038
1151
|
// @ts-ignore
|
|
1039
1152
|
const style = this._styleHelper;
|
|
1040
1153
|
if (style) {
|
|
1041
|
-
|
|
1042
|
-
style.margin = 'auto';
|
|
1043
|
-
return;
|
|
1044
|
-
}
|
|
1045
|
-
try {
|
|
1046
|
-
style.margin = CorePercentLength.parse(value);
|
|
1047
|
-
}
|
|
1048
|
-
catch (error) { }
|
|
1154
|
+
style.marginCss = value;
|
|
1049
1155
|
}
|
|
1050
1156
|
}
|
|
1051
1157
|
[marginLeftProperty.setNative](value) {
|
|
@@ -1086,11 +1192,8 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1086
1192
|
// @ts-ignore
|
|
1087
1193
|
const style = this._styleHelper;
|
|
1088
1194
|
if (style) {
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
style.padding = CoreLength.parse(value);
|
|
1092
|
-
}
|
|
1093
|
-
catch (error) { }
|
|
1195
|
+
// @ts-ignore
|
|
1196
|
+
style.paddingCss = value;
|
|
1094
1197
|
}
|
|
1095
1198
|
}
|
|
1096
1199
|
[paddingLeftProperty.setNative](value) {
|
|
@@ -1371,7 +1474,11 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1371
1474
|
return this.style.flexFlow;
|
|
1372
1475
|
}
|
|
1373
1476
|
set inset(value) {
|
|
1374
|
-
|
|
1477
|
+
// @ts-ignore
|
|
1478
|
+
const style = this._styleHelper;
|
|
1479
|
+
if (style) {
|
|
1480
|
+
style.insetCss = value;
|
|
1481
|
+
}
|
|
1375
1482
|
}
|
|
1376
1483
|
get inset() {
|
|
1377
1484
|
return this.style.inset;
|
|
@@ -1413,7 +1520,48 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1413
1520
|
style.cornerShape = value;
|
|
1414
1521
|
}
|
|
1415
1522
|
}
|
|
1523
|
+
[boxShadowProperty.setNative](value) {
|
|
1524
|
+
// @ts-ignore
|
|
1525
|
+
const style = this._styleHelper;
|
|
1526
|
+
if (style) {
|
|
1527
|
+
// @ts-ignore
|
|
1528
|
+
style.boxShadow = value;
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
[transformProperty.setNative](value) {
|
|
1532
|
+
// @ts-ignore
|
|
1533
|
+
const style = this._styleHelper;
|
|
1534
|
+
if (style) {
|
|
1535
|
+
// @ts-ignore
|
|
1536
|
+
style.transform = value;
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1416
1539
|
}
|
|
1540
|
+
__decorate([
|
|
1541
|
+
PseudoClassHandler('highlighted', 'pressed', 'active'),
|
|
1542
|
+
__metadata("design:type", Function),
|
|
1543
|
+
__metadata("design:paramtypes", [Boolean]),
|
|
1544
|
+
__metadata("design:returntype", void 0)
|
|
1545
|
+
], ViewBase.prototype, "_handler", null);
|
|
1546
|
+
__decorate([
|
|
1547
|
+
PseudoClassHandler('disabled'),
|
|
1548
|
+
__metadata("design:type", Function),
|
|
1549
|
+
__metadata("design:paramtypes", [Boolean]),
|
|
1550
|
+
__metadata("design:returntype", void 0)
|
|
1551
|
+
], ViewBase.prototype, "_disableHandler", null);
|
|
1552
|
+
__decorate([
|
|
1553
|
+
PseudoClassHandler('focus'),
|
|
1554
|
+
__metadata("design:type", Function),
|
|
1555
|
+
__metadata("design:paramtypes", [Boolean]),
|
|
1556
|
+
__metadata("design:returntype", void 0)
|
|
1557
|
+
], ViewBase.prototype, "_focusHandler", null);
|
|
1558
|
+
__decorate([
|
|
1559
|
+
PseudoClassHandler('blur'),
|
|
1560
|
+
__metadata("design:type", Function),
|
|
1561
|
+
__metadata("design:paramtypes", [Boolean]),
|
|
1562
|
+
__metadata("design:returntype", void 0)
|
|
1563
|
+
], ViewBase.prototype, "_blurHandler", null);
|
|
1564
|
+
textProperty.register(ViewBase);
|
|
1417
1565
|
export class TextBase extends ViewBase {
|
|
1418
1566
|
[textWrapProperty.setNative](value) {
|
|
1419
1567
|
// @ts-ignore
|