@triniwiz/nativescript-masonkit 1.0.0-beta.106 → 1.0.0-beta.107
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/common.d.ts +17 -0
- package/common.js +96 -5
- package/common.js.map +1 -1
- package/css-shorthands.js +11 -1
- package/css-shorthands.js.map +1 -1
- package/package.json +1 -1
- package/platforms/android/masonkit-release.aar +0 -0
- package/platforms/ios/Mason.xcframework/Info.plist +9 -9
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/Mason-Swift.h +5 -0
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Headers/mason_native.h +33 -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 +3178 -11939
- package/platforms/ios/Mason.xcframework/ios-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios.private.swiftinterface +4 -4
- 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 +4 -4
- 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 +8709 -8673
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/Mason-Swift.h +10 -0
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Headers/mason_native.h +33 -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 +3178 -11939
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +4 -4
- 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 +4 -4
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.abi.json +3178 -11939
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/Mason.framework/Modules/Mason.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +4 -4
- 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 +4 -4
- 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 +8703 -8667
- package/platforms/ios/Mason.xcframework/ios-arm64_x86_64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/x86_64/Mason.yml +8306 -8285
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Headers/Mason-Swift.h +5 -0
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Headers/mason_native.h +33 -0
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Mason +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-xros.swiftsourceinfo +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.abi.json +3178 -11939
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.private.swiftinterface +4 -4
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.swiftdoc +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros.swiftinterface +4 -4
- package/platforms/ios/Mason.xcframework/xros-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8202 -8165
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Headers/Mason-Swift.h +5 -0
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Headers/mason_native.h +33 -0
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Mason +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/Project/arm64-apple-xros-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.abi.json +3178 -11939
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.private.swiftinterface +4 -4
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.swiftdoc +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/Modules/Mason.swiftmodule/arm64-apple-xros-simulator.swiftinterface +4 -4
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/Mason.framework/_CodeSignature/CodeResources +16 -16
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/DWARF/Mason +0 -0
- package/platforms/ios/Mason.xcframework/xros-arm64-simulator/dSYMs/Mason.framework.dSYM/Contents/Resources/Relocations/aarch64/Mason.yml +8202 -8165
- package/scroll/index.ios.js +1 -0
- package/scroll/index.ios.js.map +1 -1
- package/style.js +11 -28
- package/style.js.map +1 -1
- package/text/index.android.js +9 -2
- package/text/index.android.js.map +1 -1
- package/text/index.ios.js +11 -2
- package/text/index.ios.js.map +1 -1
- package/view/index.ios.js +1 -0
- package/view/index.ios.js.map +1 -1
package/common.d.ts
CHANGED
|
@@ -229,8 +229,19 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
|
|
|
229
229
|
_unregisterNativeEvent(arg: string, callback: any, thisArg?: any): void;
|
|
230
230
|
initNativeView(): void;
|
|
231
231
|
_setNativeViewFrame(nativeView: any, frame: CGRect): void;
|
|
232
|
+
/**
|
|
233
|
+
* iOS: the views in this subtree a root's layout pass must visit (non-Mason children, which core
|
|
234
|
+
* lays out, and Mason views listening to layoutChanged). The pass skips subtrees where it's 0.
|
|
235
|
+
*/
|
|
236
|
+
_masonLayoutWork: number;
|
|
237
|
+
private _masonAddLayoutWork;
|
|
238
|
+
private _masonListensToLayout;
|
|
239
|
+
_addViewCore(view: any, atIndex?: number): void;
|
|
240
|
+
_removeViewCore(view: any): void;
|
|
232
241
|
addEventListener(arg: string, callback: any, thisArg?: any): void;
|
|
233
242
|
removeEventListener(arg: string, callback: any, thisArg?: any): void;
|
|
243
|
+
private _addEventListener;
|
|
244
|
+
private _removeEventListener;
|
|
234
245
|
private _applyPseudoClassStyles;
|
|
235
246
|
_hoverHandler(subscribe: boolean): void;
|
|
236
247
|
_handler(subscribe: boolean): void;
|
|
@@ -251,9 +262,15 @@ export declare class ViewBase extends CustomLayoutView implements AddChildFromBu
|
|
|
251
262
|
* it when its native sizing can't express one. `false` when core should handle it.
|
|
252
263
|
*/
|
|
253
264
|
_setChildPercentSize(child: any, horizontal: boolean, fraction: number | null): boolean;
|
|
265
|
+
/**
|
|
266
|
+
* A native removal relays out natively but runs no core layout pass, so `layoutChanged`
|
|
267
|
+
* and non-Mason descendants miss it. Ask for one; a subtree being torn down is unloaded.
|
|
268
|
+
*/
|
|
269
|
+
_masonRequestLayoutAfterRemoval(): void;
|
|
254
270
|
/** Lay out the non-Mason views in this root's subtree from the frames Mason set. */
|
|
255
271
|
_masonLayoutForeignDescendants(): void;
|
|
256
272
|
requestLayout(): void;
|
|
273
|
+
_parentChanged(oldParent: any): void;
|
|
257
274
|
getMeasuredWidth(): number;
|
|
258
275
|
getMeasuredHeight(): number;
|
|
259
276
|
eachChildView(callback: (child: NSView) => boolean): void;
|
package/common.js
CHANGED
|
@@ -212,6 +212,19 @@ function clearWindowsActive(view) {
|
|
|
212
212
|
const TEARDOWN_SLICE_MS = 8;
|
|
213
213
|
// Reading the clock costs more than a teardown on some devices.
|
|
214
214
|
const TEARDOWNS_PER_CLOCK_READ = 16;
|
|
215
|
+
// Mason roots whose requestLayout already climbed to the page in this turn.
|
|
216
|
+
let climbedRoots = null;
|
|
217
|
+
function markClimbed(root) {
|
|
218
|
+
if (!climbedRoots) {
|
|
219
|
+
climbedRoots = new Set();
|
|
220
|
+
queueMicrotask(() => (climbedRoots = null));
|
|
221
|
+
}
|
|
222
|
+
climbedRoots.add(root);
|
|
223
|
+
}
|
|
224
|
+
// A layout in between clears core's flag, so the next request climbs again.
|
|
225
|
+
function climbedThisTurn(root) {
|
|
226
|
+
return !!climbedRoots?.has(root) && !!root.isLayoutRequested;
|
|
227
|
+
}
|
|
215
228
|
export class ViewBase extends CustomLayoutView {
|
|
216
229
|
_tearDownUI(force) {
|
|
217
230
|
if ((__ANDROID__ || __APPLE__ || __WINDOWS__) && !force && !this.reusable && this._context && this.nativeViewProtected) {
|
|
@@ -314,6 +327,11 @@ export class ViewBase extends CustomLayoutView {
|
|
|
314
327
|
this[_c] = false;
|
|
315
328
|
this[_d] = {};
|
|
316
329
|
this._pendingEventsRegistration = [];
|
|
330
|
+
/**
|
|
331
|
+
* iOS: the views in this subtree a root's layout pass must visit (non-Mason children, which core
|
|
332
|
+
* lays out, and Mason views listening to layoutChanged). The pass skips subtrees where it's 0.
|
|
333
|
+
*/
|
|
334
|
+
this._masonLayoutWork = 0;
|
|
317
335
|
// `width`/`height` are core CssAnimationProperties whose stylesheet accessor
|
|
318
336
|
// is non-configurable, so units Mason understands but core does not (`vh`,
|
|
319
337
|
// `rem`, `pt`, …) have to be resolved on this view's own Style object.
|
|
@@ -530,7 +548,50 @@ export class ViewBase extends CustomLayoutView {
|
|
|
530
548
|
_setNativeViewFrame(nativeView, frame) {
|
|
531
549
|
// nativeView.frame = frame;
|
|
532
550
|
}
|
|
551
|
+
_masonAddLayoutWork(delta) {
|
|
552
|
+
// Up to the root: a non-Mason parent is laid out by core and its Mason roots keep their own count.
|
|
553
|
+
let view = this;
|
|
554
|
+
while (view?.[isMasonView_]) {
|
|
555
|
+
view._masonLayoutWork += delta;
|
|
556
|
+
view = view.parent;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
_masonListensToLayout() {
|
|
560
|
+
return this.hasListeners(NSView.layoutChangedEvent);
|
|
561
|
+
}
|
|
562
|
+
_addViewCore(view, atIndex) {
|
|
563
|
+
// Before setup: listeners the child gains while loading add themselves through `parent`.
|
|
564
|
+
if (__APPLE__) {
|
|
565
|
+
const work = view?.[isMasonView_] ? view._masonLayoutWork : 1;
|
|
566
|
+
if (work)
|
|
567
|
+
this._masonAddLayoutWork(work);
|
|
568
|
+
}
|
|
569
|
+
// @ts-ignore
|
|
570
|
+
super._addViewCore(view, atIndex);
|
|
571
|
+
}
|
|
572
|
+
_removeViewCore(view) {
|
|
573
|
+
// @ts-ignore
|
|
574
|
+
super._removeViewCore(view);
|
|
575
|
+
// After teardown: listeners removed while unloading already subtracted themselves.
|
|
576
|
+
if (__APPLE__) {
|
|
577
|
+
const work = view?.[isMasonView_] ? view._masonLayoutWork : 1;
|
|
578
|
+
if (work)
|
|
579
|
+
this._masonAddLayoutWork(-work);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
533
582
|
addEventListener(arg, callback, thisArg) {
|
|
583
|
+
const listened = __APPLE__ && this._masonListensToLayout();
|
|
584
|
+
this._addEventListener(arg, callback, thisArg);
|
|
585
|
+
if (__APPLE__ && !listened && this._masonListensToLayout())
|
|
586
|
+
this._masonAddLayoutWork(1);
|
|
587
|
+
}
|
|
588
|
+
removeEventListener(arg, callback, thisArg) {
|
|
589
|
+
const listened = __APPLE__ && this._masonListensToLayout();
|
|
590
|
+
this._removeEventListener(arg, callback, thisArg);
|
|
591
|
+
if (__APPLE__ && listened && !this._masonListensToLayout())
|
|
592
|
+
this._masonAddLayoutWork(-1);
|
|
593
|
+
}
|
|
594
|
+
_addEventListener(arg, callback, thisArg) {
|
|
534
595
|
if (typeof thisArg === 'boolean') {
|
|
535
596
|
thisArg = {
|
|
536
597
|
capture: thisArg,
|
|
@@ -548,7 +609,7 @@ export class ViewBase extends CustomLayoutView {
|
|
|
548
609
|
}
|
|
549
610
|
super.addEventListener(arg, callback, thisArg);
|
|
550
611
|
}
|
|
551
|
-
|
|
612
|
+
_removeEventListener(arg, callback, thisArg) {
|
|
552
613
|
if (typeof thisArg === 'boolean') {
|
|
553
614
|
thisArg = {
|
|
554
615
|
capture: thisArg,
|
|
@@ -714,6 +775,14 @@ export class ViewBase extends CustomLayoutView {
|
|
|
714
775
|
}
|
|
715
776
|
return true;
|
|
716
777
|
}
|
|
778
|
+
/**
|
|
779
|
+
* A native removal relays out natively but runs no core layout pass, so `layoutChanged`
|
|
780
|
+
* and non-Mason descendants miss it. Ask for one; a subtree being torn down is unloaded.
|
|
781
|
+
*/
|
|
782
|
+
_masonRequestLayoutAfterRemoval() {
|
|
783
|
+
if (__APPLE__ && this.isLoaded)
|
|
784
|
+
this.requestLayout();
|
|
785
|
+
}
|
|
717
786
|
/** Lay out the non-Mason views in this root's subtree from the frames Mason set. */
|
|
718
787
|
_masonLayoutForeignDescendants() {
|
|
719
788
|
if (!__APPLE__)
|
|
@@ -721,6 +790,8 @@ export class ViewBase extends CustomLayoutView {
|
|
|
721
790
|
const visit = (view) => {
|
|
722
791
|
view.eachChildView((child) => {
|
|
723
792
|
if (child[isMasonView_]) {
|
|
793
|
+
if (!(child._masonLayoutWork > 0))
|
|
794
|
+
return true;
|
|
724
795
|
// Keep `layoutChanged` working for the few views that listen to it.
|
|
725
796
|
if (child.hasListeners?.(NSView.layoutChangedEvent)) {
|
|
726
797
|
const b = child._getCurrentLayoutBounds();
|
|
@@ -749,10 +820,21 @@ export class ViewBase extends CustomLayoutView {
|
|
|
749
820
|
let root = this.parent;
|
|
750
821
|
while (root?.parent?.[isMasonView_])
|
|
751
822
|
root = root.parent;
|
|
823
|
+
if (root && climbedThisTurn(root))
|
|
824
|
+
return;
|
|
752
825
|
root?.requestLayout();
|
|
753
826
|
return;
|
|
754
827
|
}
|
|
828
|
+
// Core climbs on every call, once per changed property; once per turn is enough.
|
|
829
|
+
if (__APPLE__ && climbedThisTurn(this))
|
|
830
|
+
return;
|
|
755
831
|
super.requestLayout();
|
|
832
|
+
if (__APPLE__)
|
|
833
|
+
markClimbed(this);
|
|
834
|
+
}
|
|
835
|
+
_parentChanged(oldParent) {
|
|
836
|
+
climbedRoots?.delete(this);
|
|
837
|
+
super._parentChanged(oldParent);
|
|
756
838
|
}
|
|
757
839
|
getMeasuredWidth() {
|
|
758
840
|
if (this._masonPlacedNatively && this.nativeViewProtected) {
|
|
@@ -1582,7 +1664,7 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1582
1664
|
_nativeBorderRadiusCorners() {
|
|
1583
1665
|
// @ts-ignore
|
|
1584
1666
|
const style = this._styleHelper;
|
|
1585
|
-
if (__ANDROID__ && style && !style.hasBorderRadius()) {
|
|
1667
|
+
if ((__ANDROID__ || __APPLE__) && style && !style.hasBorderRadius()) {
|
|
1586
1668
|
return borderRadiusCorners('0');
|
|
1587
1669
|
}
|
|
1588
1670
|
const native = String(style?.borderRadius ?? '').trim();
|
|
@@ -1606,13 +1688,18 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1606
1688
|
const css = lengthToCssString(masonLength(value));
|
|
1607
1689
|
const radius = (corners[corner] = /\s/.test(css) ? parseCornerRadius(css) : [css, css]);
|
|
1608
1690
|
const shorthand = composeBorderRadius(corners);
|
|
1609
|
-
if (__ANDROID__ && style._writeCornerRadius(corner, radius, shorthand)) {
|
|
1691
|
+
if ((__ANDROID__ || __APPLE__) && style._writeCornerRadius(corner, radius, shorthand)) {
|
|
1610
1692
|
return;
|
|
1611
1693
|
}
|
|
1612
1694
|
// @ts-ignore
|
|
1613
1695
|
style.borderRadius = shorthand;
|
|
1614
1696
|
}
|
|
1615
1697
|
_nativeCornerRadius(corner) {
|
|
1698
|
+
// @ts-ignore
|
|
1699
|
+
const style = this._styleHelper;
|
|
1700
|
+
if ((__ANDROID__ || __APPLE__) && style && !style.hasBorderRadius()) {
|
|
1701
|
+
return '0';
|
|
1702
|
+
}
|
|
1616
1703
|
const [h, v] = this._nativeBorderRadiusCorners()[corner];
|
|
1617
1704
|
return h === v ? h : `${h} ${v}`;
|
|
1618
1705
|
}
|
|
@@ -1641,7 +1728,7 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1641
1728
|
this._borderRadiusCorner(3, value);
|
|
1642
1729
|
}
|
|
1643
1730
|
_borderSideColor(side, value) {
|
|
1644
|
-
if (__ANDROID__) {
|
|
1731
|
+
if (__ANDROID__ || __APPLE__) {
|
|
1645
1732
|
const s = this._styleHelper;
|
|
1646
1733
|
if (s) {
|
|
1647
1734
|
s.setBorderSideColor(side === 't' ? 'top' : side === 'r' ? 'right' : side === 'b' ? 'bottom' : 'left', value);
|
|
@@ -1854,8 +1941,12 @@ export class ViewBase extends CustomLayoutView {
|
|
|
1854
1941
|
nodeHelper().setBorderColor(this.nativeView, String(value));
|
|
1855
1942
|
}
|
|
1856
1943
|
else if (__APPLE__) {
|
|
1944
|
+
const s = this._styleHelper;
|
|
1945
|
+
if (s)
|
|
1946
|
+
s.setBorderColor(String(value));
|
|
1857
1947
|
// @ts-ignore
|
|
1858
|
-
|
|
1948
|
+
else
|
|
1949
|
+
this.nativeView.style.setBorderColor(String(value));
|
|
1859
1950
|
}
|
|
1860
1951
|
else if (__WINDOWS__) {
|
|
1861
1952
|
// @ts-ignore
|