@octane-xplat/nativescript-mason-core 0.0.1 → 1.0.0-beta.0
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/LICENSE +201 -0
- package/README.md +113 -2
- package/artifact-inventory.json +746 -0
- package/box-shadow.d.ts +10 -0
- package/box-shadow.js +48 -0
- package/common.d.ts +482 -0
- package/common.js +2645 -0
- package/css-colors.d.ts +17 -0
- package/css-colors.js +54 -0
- package/css-filter.d.ts +17 -0
- package/css-filter.js +140 -0
- package/css-keyframes.d.ts +41 -0
- package/css-keyframes.js +437 -0
- package/css-math.d.ts +34 -0
- package/css-math.js +300 -0
- package/css-shorthands.d.ts +65 -0
- package/css-shorthands.js +673 -0
- package/css-transform.d.ts +6 -0
- package/css-transform.js +100 -0
- package/diagnostics.d.ts +51 -0
- package/diagnostics.js +52 -0
- package/display-density.d.ts +9 -0
- package/display-density.js +20 -0
- package/fonts.d.ts +20 -0
- package/fonts.js +88 -0
- package/foreign-layout.d.ts +6 -0
- package/foreign-layout.js +149 -0
- package/gradient-stops.d.ts +25 -0
- package/gradient-stops.js +112 -0
- package/index.android.d.ts +9 -0
- package/index.android.js +8 -0
- package/index.d.ts +10 -0
- package/index.ios.d.ts +9 -0
- package/index.ios.js +8 -0
- package/ios-host-README.md +124 -0
- package/layout-types.d.ts +192 -0
- package/mask.d.ts +54 -0
- package/mask.js +26 -0
- package/native-types-README.md +51 -0
- package/package.json +44 -6
- package/panel-helpers.d.ts +3 -0
- package/panel-helpers.js +8 -0
- package/platforms/android/MasonCore.aar +0 -0
- package/platforms/android/include.gradle +6 -0
- package/platforms/android/manifest.json +73 -0
- package/platforms/ios/FontManager.LICENSE +201 -0
- package/platforms/ios/MasonCore.xcframework/Info.plist +43 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Headers/Mason.h +25 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Headers/MasonCore-Swift.h +1739 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Headers/mason_native.h +601 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Info.plist +0 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/MasonCore +0 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios.abi.json +100095 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios.private.swiftinterface +3174 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios.swiftinterface +3174 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/Modules/module.modulemap +9 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/SDWebImage_SDWebImage.bundle/Info.plist +0 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64/MasonCore.framework/SDWebImage_SDWebImage.bundle/PrivacyInfo.xcprivacy +23 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Headers/Mason.h +25 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Headers/MasonCore-Swift.h +1739 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Headers/mason_native.h +601 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Info.plist +0 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/MasonCore +0 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios-simulator.abi.json +100095 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +3174 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/MasonCore.swiftmodule/arm64-apple-ios-simulator.swiftinterface +3174 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/Modules/module.modulemap +9 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/SDWebImage_SDWebImage.bundle/Info.plist +0 -0
- package/platforms/ios/MasonCore.xcframework/ios-arm64-simulator/MasonCore.framework/SDWebImage_SDWebImage.bundle/PrivacyInfo.xcprivacy +23 -0
- package/platforms/ios/Package.resolved +24 -0
- package/platforms/ios/SDWebImage.LICENSE +20 -0
- package/platforms/ios/build.xcconfig +4 -0
- package/platforms/ios/device-manifest.json +213 -0
- package/platforms/ios/include/FontManager/NSCFontDescriptors.h +36 -0
- package/platforms/ios/include/FontManager/NSCFontFace.h +98 -0
- package/platforms/ios/include/FontManager/NSCFontFaceSet.h +73 -0
- package/platforms/ios/include/FontManager/NSCFontManagerUmbrella.h +7 -0
- package/platforms/ios/include/FontManager/NSCFontParser.h +22 -0
- package/platforms/ios/include/FontManager/NSCFontRegex.h +4 -0
- package/platforms/ios/include/FontManager/NSCFontResolver.h +43 -0
- package/platforms/ios/include/FontManager/NSCFontStyle.h +27 -0
- package/platforms/ios/include/FontManager/NSCFontTypes.h +41 -0
- package/platforms/ios/include/SDWebImage/NSButton+WebCache.h +340 -0
- package/platforms/ios/include/SDWebImage/NSData+ImageContentType.h +63 -0
- package/platforms/ios/include/SDWebImage/NSImage+Compatibility.h +67 -0
- package/platforms/ios/include/SDWebImage/SDAnimatedImage.h +136 -0
- package/platforms/ios/include/SDWebImage/SDAnimatedImagePlayer.h +113 -0
- package/platforms/ios/include/SDWebImage/SDAnimatedImageRep.h +33 -0
- package/platforms/ios/include/SDWebImage/SDAnimatedImageView+WebCache.h +168 -0
- package/platforms/ios/include/SDWebImage/SDAnimatedImageView.h +125 -0
- package/platforms/ios/include/SDWebImage/SDCallbackQueue.h +59 -0
- package/platforms/ios/include/SDWebImage/SDDiskCache.h +146 -0
- package/platforms/ios/include/SDWebImage/SDGraphicsImageRenderer.h +84 -0
- package/platforms/ios/include/SDWebImage/SDImageAPNGCoder.h +19 -0
- package/platforms/ios/include/SDWebImage/SDImageAWebPCoder.h +23 -0
- package/platforms/ios/include/SDWebImage/SDImageCache.h +482 -0
- package/platforms/ios/include/SDWebImage/SDImageCacheConfig.h +153 -0
- package/platforms/ios/include/SDWebImage/SDImageCacheDefine.h +179 -0
- package/platforms/ios/include/SDWebImage/SDImageCachesManager.h +81 -0
- package/platforms/ios/include/SDWebImage/SDImageCoder.h +347 -0
- package/platforms/ios/include/SDWebImage/SDImageCoderHelper.h +251 -0
- package/platforms/ios/include/SDWebImage/SDImageCodersManager.h +58 -0
- package/platforms/ios/include/SDWebImage/SDImageFrame.h +44 -0
- package/platforms/ios/include/SDWebImage/SDImageGIFCoder.h +22 -0
- package/platforms/ios/include/SDWebImage/SDImageGraphics.h +28 -0
- package/platforms/ios/include/SDWebImage/SDImageHEICCoder.h +25 -0
- package/platforms/ios/include/SDWebImage/SDImageIOAnimatedCoder.h +65 -0
- package/platforms/ios/include/SDWebImage/SDImageIOCoder.h +30 -0
- package/platforms/ios/include/SDWebImage/SDImageLoader.h +146 -0
- package/platforms/ios/include/SDWebImage/SDImageLoadersManager.h +40 -0
- package/platforms/ios/include/SDWebImage/SDImageTransformer.h +283 -0
- package/platforms/ios/include/SDWebImage/SDMemoryCache.h +78 -0
- package/platforms/ios/include/SDWebImage/SDWebImage.h +91 -0
- package/platforms/ios/include/SDWebImage/SDWebImageCacheKeyFilter.h +35 -0
- package/platforms/ios/include/SDWebImage/SDWebImageCacheSerializer.h +39 -0
- package/platforms/ios/include/SDWebImage/SDWebImageCompat.h +102 -0
- package/platforms/ios/include/SDWebImage/SDWebImageDefine.h +420 -0
- package/platforms/ios/include/SDWebImage/SDWebImageDownloader.h +320 -0
- package/platforms/ios/include/SDWebImage/SDWebImageDownloaderConfig.h +113 -0
- package/platforms/ios/include/SDWebImage/SDWebImageDownloaderDecryptor.h +52 -0
- package/platforms/ios/include/SDWebImage/SDWebImageDownloaderOperation.h +191 -0
- package/platforms/ios/include/SDWebImage/SDWebImageDownloaderRequestModifier.h +72 -0
- package/platforms/ios/include/SDWebImage/SDWebImageDownloaderResponseModifier.h +72 -0
- package/platforms/ios/include/SDWebImage/SDWebImageError.h +33 -0
- package/platforms/ios/include/SDWebImage/SDWebImageIndicator.h +119 -0
- package/platforms/ios/include/SDWebImage/SDWebImageManager.h +290 -0
- package/platforms/ios/include/SDWebImage/SDWebImageOperation.h +27 -0
- package/platforms/ios/include/SDWebImage/SDWebImageOptionsProcessor.h +78 -0
- package/platforms/ios/include/SDWebImage/SDWebImagePrefetcher.h +168 -0
- package/platforms/ios/include/SDWebImage/SDWebImageTransition.h +131 -0
- package/platforms/ios/include/SDWebImage/UIButton+WebCache.h +402 -0
- package/platforms/ios/include/SDWebImage/UIImage+ExtendedCacheData.h +24 -0
- package/platforms/ios/include/SDWebImage/UIImage+ForceDecode.h +52 -0
- package/platforms/ios/include/SDWebImage/UIImage+GIF.h +26 -0
- package/platforms/ios/include/SDWebImage/UIImage+MemoryCacheCost.h +27 -0
- package/platforms/ios/include/SDWebImage/UIImage+Metadata.h +104 -0
- package/platforms/ios/include/SDWebImage/UIImage+MultiFormat.h +81 -0
- package/platforms/ios/include/SDWebImage/UIImage+Transform.h +164 -0
- package/platforms/ios/include/SDWebImage/UIImageView+HighlightedWebCache.h +142 -0
- package/platforms/ios/include/SDWebImage/UIImageView+WebCache.h +209 -0
- package/platforms/ios/include/SDWebImage/UIView+WebCache.h +131 -0
- package/platforms/ios/include/SDWebImage/UIView+WebCacheOperation.h +52 -0
- package/platforms/ios/include/SDWebImage/UIView+WebCacheState.h +63 -0
- package/platforms/ios/include/module.modulemap +2 -0
- package/platforms/ios/manifest.json +132 -0
- package/platforms/ios/simulator-manifest.json +213 -0
- package/plugin-README.md +197 -0
- package/properties.d.ts +154 -0
- package/properties.js +2454 -0
- package/pseudo.d.ts +9 -0
- package/pseudo.js +57 -0
- package/scroll/index.android.d.ts +15 -0
- package/scroll/index.android.js +72 -0
- package/scroll/index.d.ts +5 -0
- package/scroll/index.ios.d.ts +18 -0
- package/scroll/index.ios.js +106 -0
- package/style.d.ts +768 -0
- package/style.js +7151 -0
- package/symbols.d.ts +25 -0
- package/symbols.js +41 -0
- package/tree/index.android.d.ts +11 -0
- package/tree/index.android.js +42 -0
- package/tree/index.d.ts +15 -0
- package/tree/index.ios.d.ts +26 -0
- package/tree/index.ios.js +53 -0
- package/typings/android-declarations.d.ts +4 -0
- package/typings/android.d.ts +9730 -0
- package/typings/manifest.json +45 -0
- package/typings/native.d.ts +5 -0
- package/typings/objc!FontManager.d.ts +389 -0
- package/typings/objc!MasonCore.d.ts +2472 -0
- package/typings/objc!SDWebImage.d.ts +3378 -0
- package/units.d.ts +29 -0
- package/units.js +44 -0
- package/utils/index.android.d.ts +211 -0
- package/utils/index.android.js +595 -0
- package/utils/index.ios.d.ts +222 -0
- package/utils/index.ios.js +790 -0
- package/view/index.android.d.ts +13 -0
- package/view/index.android.js +74 -0
- package/view/index.d.ts +2 -0
- package/view/index.ios.d.ts +24 -0
- package/view/index.ios.js +157 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ViewBase } from '../common';
|
|
2
|
+
import { style_ } from '../symbols';
|
|
3
|
+
export declare class View extends ViewBase {
|
|
4
|
+
[style_]: any;
|
|
5
|
+
_inBatch: boolean;
|
|
6
|
+
constructor();
|
|
7
|
+
get _view(): org.nativescript.mason.masonkit.View;
|
|
8
|
+
get _styleHelper(): any;
|
|
9
|
+
createNativeView(): org.nativescript.mason.masonkit.View;
|
|
10
|
+
get android(): org.nativescript.mason.masonkit.View;
|
|
11
|
+
_addViewToNativeVisualTree(child: MasonChild, atIndex?: number): boolean;
|
|
12
|
+
_removeViewFromNativeVisualTree(view: MasonChild): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { CSSType, Utils } from '@nativescript/core';
|
|
2
|
+
import { ViewBase } from '../common';
|
|
3
|
+
import { Tree } from '../tree';
|
|
4
|
+
import { Style } from '../style';
|
|
5
|
+
import { style_, isMasonView_, native_, isPlaceholder_ } from '../symbols';
|
|
6
|
+
let View = class View extends ViewBase {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this._inBatch = false;
|
|
10
|
+
this[isMasonView_] = true;
|
|
11
|
+
}
|
|
12
|
+
get _view() {
|
|
13
|
+
if (!this[native_]) {
|
|
14
|
+
const context = Utils.android.getCurrentActivity() || Utils.android.getApplicationContext();
|
|
15
|
+
const view = Tree.instance.createView(context);
|
|
16
|
+
this[native_] = view;
|
|
17
|
+
return view;
|
|
18
|
+
}
|
|
19
|
+
return this[native_];
|
|
20
|
+
}
|
|
21
|
+
get _styleHelper() {
|
|
22
|
+
if (this[style_] === undefined) {
|
|
23
|
+
this[style_] = Style.fromView(this, this._view);
|
|
24
|
+
}
|
|
25
|
+
return this[style_];
|
|
26
|
+
}
|
|
27
|
+
createNativeView() {
|
|
28
|
+
return this._view;
|
|
29
|
+
}
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
get android() {
|
|
33
|
+
return this._view;
|
|
34
|
+
}
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
_addViewToNativeVisualTree(child, atIndex = -1) {
|
|
37
|
+
const nativeView = this._view;
|
|
38
|
+
if (nativeView && (child.nativeViewProtected || child.android)) {
|
|
39
|
+
child._hasNativeView = true;
|
|
40
|
+
// Map the JS index onto the native children list (views attach lazily,
|
|
41
|
+
// so the raw index can run ahead of native state).
|
|
42
|
+
const { nativeIndex: index } = this._nativeAttachIndex(child, atIndex);
|
|
43
|
+
child._isMasonChild = true;
|
|
44
|
+
if (child[isPlaceholder_]) {
|
|
45
|
+
nativeView.addChildAt(child.android, index);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
nativeView.addView(child.nativeViewProtected, index);
|
|
49
|
+
this._masonAdoptForeign(child);
|
|
50
|
+
}
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
_removeViewFromNativeVisualTree(view) {
|
|
57
|
+
this._invalidateAttachCursor();
|
|
58
|
+
// Clear the attach flag; `_nativeIndexFor` counts it, so a stale `true` misindexes inserts.
|
|
59
|
+
view._isMasonChild = false;
|
|
60
|
+
// detach the Rust node too, since
|
|
61
|
+
// super only removes the native view.
|
|
62
|
+
const nativeView = this._view;
|
|
63
|
+
if (nativeView && view.nativeViewProtected && typeof nativeView.removeView === 'function') {
|
|
64
|
+
nativeView.removeView(view.nativeViewProtected);
|
|
65
|
+
}
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
super._removeViewFromNativeVisualTree(view);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
View = __decorate([
|
|
71
|
+
CSSType('View'),
|
|
72
|
+
__metadata("design:paramtypes", [])
|
|
73
|
+
], View);
|
|
74
|
+
export { View };
|
package/view/index.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ViewBase } from '../common';
|
|
2
|
+
import { Style } from '../style';
|
|
3
|
+
import { style_ } from '../symbols';
|
|
4
|
+
export declare class View extends ViewBase {
|
|
5
|
+
[style_]: any;
|
|
6
|
+
constructor();
|
|
7
|
+
get _view(): MasonUIView;
|
|
8
|
+
get _styleHelper(): Style;
|
|
9
|
+
_inBatch: boolean;
|
|
10
|
+
createNativeView(): MasonUIView;
|
|
11
|
+
get ios(): MasonUIView;
|
|
12
|
+
onLayout(left: number, top: number, right: number, bottom: number): void;
|
|
13
|
+
onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;
|
|
14
|
+
_setNativeViewFrame(nativeView: any, frame: CGRect): void;
|
|
15
|
+
_addViewToNativeVisualTree(child: MasonChild, atIndex?: number): boolean;
|
|
16
|
+
private _masonInsertNative;
|
|
17
|
+
/** Child/index pairs queued by `_addViewToNativeVisualTree`, from `_masonPendingHead`. */
|
|
18
|
+
private _masonPendingAdds;
|
|
19
|
+
private _masonPendingHead;
|
|
20
|
+
/** Run the queued inserts in order, through `upTo` (every one when omitted). */
|
|
21
|
+
_masonFlushNativeAdds(upTo?: any): void;
|
|
22
|
+
loadView(view: any): void;
|
|
23
|
+
_removeViewFromNativeVisualTree(view: MasonChild): void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { CSSType } from '@nativescript/core';
|
|
2
|
+
import { ViewBase, setRootNativeViewFrame, setMeasuredFromNative } from '../common';
|
|
3
|
+
import { Style } from '../style';
|
|
4
|
+
import { Tree } from '../tree';
|
|
5
|
+
import { isMasonView_, isPlaceholder_, native_, style_ } from '../symbols';
|
|
6
|
+
/** Views with queued native inserts (see `View._addViewToNativeVisualTree`). */
|
|
7
|
+
let pendingAddHosts = 0;
|
|
8
|
+
function flushNativeAddsDeep(view) {
|
|
9
|
+
view._masonFlushNativeAdds?.();
|
|
10
|
+
view.eachChildView?.((child) => {
|
|
11
|
+
if (child[isMasonView_])
|
|
12
|
+
flushNativeAddsDeep(child);
|
|
13
|
+
return true;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
let View = class View extends ViewBase {
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
this._inBatch = false;
|
|
20
|
+
this._masonPendingHead = 0;
|
|
21
|
+
this[isMasonView_] = true;
|
|
22
|
+
}
|
|
23
|
+
get _view() {
|
|
24
|
+
if (!this[native_]) {
|
|
25
|
+
const view = Tree.instance.createView();
|
|
26
|
+
this[native_] = view;
|
|
27
|
+
return view;
|
|
28
|
+
}
|
|
29
|
+
return this[native_];
|
|
30
|
+
}
|
|
31
|
+
get _styleHelper() {
|
|
32
|
+
if (this[style_] === undefined) {
|
|
33
|
+
this[style_] = Style.fromView(this, this._view);
|
|
34
|
+
}
|
|
35
|
+
return this[style_];
|
|
36
|
+
}
|
|
37
|
+
createNativeView() {
|
|
38
|
+
return this._view;
|
|
39
|
+
}
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
41
|
+
// @ts-ignore
|
|
42
|
+
get ios() {
|
|
43
|
+
return this._view;
|
|
44
|
+
}
|
|
45
|
+
onLayout(left, top, right, bottom) {
|
|
46
|
+
super.onLayout(left, top, right, bottom);
|
|
47
|
+
// Mason descendants were placed by the native compute; only a root's
|
|
48
|
+
// non-Mason views still need core's layout.
|
|
49
|
+
if (!this._masonPlacedNatively) {
|
|
50
|
+
this._masonLayoutForeignDescendants();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
onMeasure(widthMeasureSpec, heightMeasureSpec) {
|
|
54
|
+
const nativeView = this._view;
|
|
55
|
+
if (nativeView) {
|
|
56
|
+
const root = !this.parent?.[isMasonView_];
|
|
57
|
+
if (root && pendingAddHosts > 0)
|
|
58
|
+
flushNativeAddsDeep(this);
|
|
59
|
+
// One native call computes a root for the host's specs, or reads a child's placed box.
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
setMeasuredFromNative(this, nativeView.mason_measure(widthMeasureSpec, heightMeasureSpec, root, false));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
_setNativeViewFrame(nativeView, frame) {
|
|
65
|
+
if (this.parent?.[isMasonView_]) {
|
|
66
|
+
nativeView.frame = frame;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
setRootNativeViewFrame(this, nativeView, frame);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
// @ts-ignore
|
|
73
|
+
_addViewToNativeVisualTree(child, atIndex = -1) {
|
|
74
|
+
const nativeView = this._view;
|
|
75
|
+
if (nativeView && (child.nativeViewProtected || child.ios)) {
|
|
76
|
+
child._hasNativeView = true;
|
|
77
|
+
// Views attach lazily, so the JS index can run ahead of the native children.
|
|
78
|
+
const { nativeIndex: index } = this._nativeAttachIndex(child, atIndex);
|
|
79
|
+
child._isMasonChild = true;
|
|
80
|
+
// Inserted once loaded (see loadView), with its CSS and subtree in place.
|
|
81
|
+
if (!child.isLoaded) {
|
|
82
|
+
if (!this._masonPendingAdds) {
|
|
83
|
+
this._masonPendingAdds = [];
|
|
84
|
+
pendingAddHosts++;
|
|
85
|
+
}
|
|
86
|
+
this._masonPendingAdds.push(child, index);
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
this._masonInsertNative(child, index);
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
_masonInsertNative(child, index) {
|
|
95
|
+
const nativeView = this._view;
|
|
96
|
+
if (child[isPlaceholder_]) {
|
|
97
|
+
// @ts-ignore
|
|
98
|
+
nativeView.mason_addChildAtElement(child.ios, index);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
nativeView.addViewAt(child.nativeViewProtected, index);
|
|
102
|
+
this._masonAdoptForeign(child);
|
|
103
|
+
this._masonMeasureForeign(child);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/** Run the queued inserts in order, through `upTo` (every one when omitted). */
|
|
107
|
+
_masonFlushNativeAdds(upTo) {
|
|
108
|
+
const pending = this._masonPendingAdds;
|
|
109
|
+
if (!pending)
|
|
110
|
+
return;
|
|
111
|
+
let end = pending.length;
|
|
112
|
+
if (upTo !== undefined) {
|
|
113
|
+
let i = this._masonPendingHead;
|
|
114
|
+
while (i < end && pending[i] !== upTo)
|
|
115
|
+
i += 2;
|
|
116
|
+
if (i === end)
|
|
117
|
+
return;
|
|
118
|
+
end = i + 2;
|
|
119
|
+
}
|
|
120
|
+
let i = this._masonPendingHead;
|
|
121
|
+
// Advance first: an insert can re-enter (a measure) and flush again.
|
|
122
|
+
this._masonPendingHead = end;
|
|
123
|
+
if (end === pending.length) {
|
|
124
|
+
this._masonPendingAdds = undefined;
|
|
125
|
+
this._masonPendingHead = 0;
|
|
126
|
+
pendingAddHosts--;
|
|
127
|
+
}
|
|
128
|
+
for (; i < end; i += 2)
|
|
129
|
+
this._masonInsertNative(pending[i], pending[i + 1]);
|
|
130
|
+
}
|
|
131
|
+
loadView(view) {
|
|
132
|
+
super.loadView(view);
|
|
133
|
+
if (this._masonPendingAdds)
|
|
134
|
+
this._masonFlushNativeAdds(view);
|
|
135
|
+
}
|
|
136
|
+
// @ts-ignore
|
|
137
|
+
_removeViewFromNativeVisualTree(view) {
|
|
138
|
+
if (this._masonPendingAdds)
|
|
139
|
+
this._masonFlushNativeAdds();
|
|
140
|
+
this._invalidateAttachCursor();
|
|
141
|
+
// Clear the attach flag; `_nativeIndexFor` counts it, so a stale `true` misindexes inserts.
|
|
142
|
+
view._isMasonChild = false;
|
|
143
|
+
// Detach the Rust node too; super only removes the native view.
|
|
144
|
+
const nativeView = this._view;
|
|
145
|
+
if (nativeView && view.nativeViewProtected && typeof nativeView.removeView === 'function') {
|
|
146
|
+
nativeView.removeView(view.nativeViewProtected);
|
|
147
|
+
this._masonRequestLayoutAfterRemoval();
|
|
148
|
+
}
|
|
149
|
+
// @ts-ignore
|
|
150
|
+
super._removeViewFromNativeVisualTree(view);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
View = __decorate([
|
|
154
|
+
CSSType('View'),
|
|
155
|
+
__metadata("design:paramtypes", [])
|
|
156
|
+
], View);
|
|
157
|
+
export { View };
|