@octane-xplat/nativescript-mason-core 0.0.1 → 1.0.0-beta.1
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 +198 -2
- package/artifact-inventory.json +774 -0
- package/box-shadow.d.ts +10 -0
- package/box-shadow.js +48 -0
- package/common.d.ts +485 -0
- package/common.js +2659 -0
- package/css-colors.d.ts +17 -0
- package/css-colors.js +54 -0
- package/css-environment.d.ts +49 -0
- package/css-environment.js +309 -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 +151 -0
- package/gradient-stops.d.ts +25 -0
- package/gradient-stops.js +112 -0
- package/index.android.d.ts +11 -0
- package/index.android.js +9 -0
- package/index.d.ts +12 -0
- package/index.ios.d.ts +11 -0
- package/index.ios.js +9 -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-environment.android.d.ts +3 -0
- package/native-environment.android.js +69 -0
- package/native-environment.d.ts +3 -0
- package/native-environment.ios.d.ts +3 -0
- package/native-environment.ios.js +65 -0
- package/native-types-README.md +51 -0
- package/package.json +47 -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 +234 -0
- package/properties.d.ts +154 -0
- package/properties.js +2456 -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 +7167 -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
package/symbols.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const native_: unique symbol;
|
|
2
|
+
export declare const style_: unique symbol;
|
|
3
|
+
export declare const isTextChild_: unique symbol;
|
|
4
|
+
export declare const isText_: unique symbol;
|
|
5
|
+
export declare const isMasonView_: unique symbol;
|
|
6
|
+
export declare const text_: unique symbol;
|
|
7
|
+
export declare const isPlaceholder_: unique symbol;
|
|
8
|
+
export declare const textNode_: unique symbol;
|
|
9
|
+
export declare const textNodeIndex_: unique symbol;
|
|
10
|
+
export declare const textNodeProxied_: unique symbol;
|
|
11
|
+
export declare const pseudoStyles_: unique symbol;
|
|
12
|
+
export declare const emptyTextNode_: unique symbol;
|
|
13
|
+
export declare const breakRun_: unique symbol;
|
|
14
|
+
export declare const anonymousText_: unique symbol;
|
|
15
|
+
export declare const runMember_: unique symbol;
|
|
16
|
+
export declare const runsInline_: unique symbol;
|
|
17
|
+
export declare const blockified_: unique symbol;
|
|
18
|
+
export declare const runsSettled_: unique symbol;
|
|
19
|
+
export declare const windowsFontSource_: unique symbol;
|
|
20
|
+
export declare const hostsRuns_: unique symbol;
|
|
21
|
+
export declare const needsAnonymousText_: unique symbol;
|
|
22
|
+
export declare const borderRadiusCorners_: unique symbol;
|
|
23
|
+
export declare const borderSideColors_: unique symbol;
|
|
24
|
+
export declare const eventType_: unique symbol;
|
|
25
|
+
export declare const touchAction_: unique symbol;
|
package/symbols.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export const native_ = Symbol('[[native]]');
|
|
2
|
+
export const style_ = Symbol('[[style]]');
|
|
3
|
+
export const isTextChild_ = Symbol('[[isTextChild]]');
|
|
4
|
+
export const isText_ = Symbol('[[isText]]');
|
|
5
|
+
export const isMasonView_ = Symbol('[[isMasonView]]');
|
|
6
|
+
export const text_ = Symbol('[[text]]');
|
|
7
|
+
export const isPlaceholder_ = Symbol('[[isPlaceholder]]');
|
|
8
|
+
export const textNode_ = Symbol('[[textNode]]');
|
|
9
|
+
export const textNodeIndex_ = Symbol('[[textNodeIndex]]');
|
|
10
|
+
export const textNodeProxied_ = Symbol('[[textNodeProxied]]');
|
|
11
|
+
export const pseudoStyles_ = Symbol('[[pseudoStyles]]');
|
|
12
|
+
// Cache slot for the synthetic text node `[textProperty.setNative]` uses when
|
|
13
|
+
// no real framework DOM child backs the text (see common.ts) — lets repeat
|
|
14
|
+
// writes reuse/update it instead of allocating a fresh native text run every
|
|
15
|
+
// time.
|
|
16
|
+
export const emptyTextNode_ = Symbol('[[emptyTextNode]]');
|
|
17
|
+
// The break run a Windows `<br>` placeholder becomes inside a text container.
|
|
18
|
+
export const breakRun_ = Symbol('[[breakRun]]');
|
|
19
|
+
// On a child of a Windows container: the anonymous Text drawing it as part of an inline run.
|
|
20
|
+
export const anonymousText_ = Symbol('[[anonymousText]]');
|
|
21
|
+
// How it is held: 'run', 'break', 'text' or 'box', or 'solo' for a lone element laid out directly.
|
|
22
|
+
export const runMember_ = Symbol('[[runMember]]');
|
|
23
|
+
export const runsInline_ = Symbol('[[runsInline]]');
|
|
24
|
+
export const blockified_ = Symbol('[[blockified]]');
|
|
25
|
+
export const runsSettled_ = Symbol('[[runsSettled]]');
|
|
26
|
+
// The resolved Windows font source a container's anonymous Text uses.
|
|
27
|
+
export const windowsFontSource_ = Symbol('[[windowsFontSource]]');
|
|
28
|
+
// Whether a view's Windows native view lays out text runs itself, and whether it is any other
|
|
29
|
+
// panel that needs an anonymous Text for them; fixed once the native view exists.
|
|
30
|
+
export const hostsRuns_ = Symbol('[[hostsRuns]]');
|
|
31
|
+
export const needsAnonymousText_ = Symbol('[[needsAnonymousText]]');
|
|
32
|
+
// Per-corner / per-side caches for the CSS-class border-radius and
|
|
33
|
+
// border-color longhands core's shorthand expansion hands us — see
|
|
34
|
+
// `common.ts`. Kept on the view so each longhand can recompose the shorthand
|
|
35
|
+
// string the native side actually parses.
|
|
36
|
+
export const borderRadiusCorners_ = Symbol('[[borderRadiusCorners]]');
|
|
37
|
+
export const borderSideColors_ = Symbol('[[borderSideColors]]');
|
|
38
|
+
// Overridden `Event.type`, when a host framework's DOM shim relabels the
|
|
39
|
+
// event on its way to JS listeners — see `Event` in `common.ts`.
|
|
40
|
+
export const eventType_ = Symbol('[[eventType]]');
|
|
41
|
+
export const touchAction_ = Symbol('[[touchAction]]');
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class Tree {
|
|
2
|
+
private _base;
|
|
3
|
+
private static _tree;
|
|
4
|
+
constructor(base?: org.nativescript.mason.masonkit.Mason);
|
|
5
|
+
static get instance(): Tree;
|
|
6
|
+
get native(): org.nativescript.mason.masonkit.Mason;
|
|
7
|
+
createView(context: any): org.nativescript.mason.masonkit.View;
|
|
8
|
+
createScrollView(context: any): org.nativescript.mason.masonkit.Scroll;
|
|
9
|
+
get preflight(): boolean;
|
|
10
|
+
set preflight(value: boolean);
|
|
11
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Screen, Utils } from '@nativescript/core';
|
|
2
|
+
import { setCssUnitContext } from '../units';
|
|
3
|
+
import { refreshViewportUnits } from '../style';
|
|
4
|
+
import { setDisplayDensity } from '../display-density';
|
|
5
|
+
export class Tree {
|
|
6
|
+
constructor(base) {
|
|
7
|
+
this._base = base ?? new org.nativescript.mason.masonkit.Mason();
|
|
8
|
+
}
|
|
9
|
+
static get instance() {
|
|
10
|
+
if (!Tree._tree) {
|
|
11
|
+
Tree._tree = new Tree(org.nativescript.mason.masonkit.Mason.getShared());
|
|
12
|
+
const base = Tree._tree._base;
|
|
13
|
+
base.setDeviceScale(Screen.mainScreen.scale);
|
|
14
|
+
// `vw`/`vh` have nothing to resolve against until the viewport is known, and follow rotation and resizes.
|
|
15
|
+
setCssUnitContext({ viewportWidth: Screen.mainScreen.widthDIPs, viewportHeight: Screen.mainScreen.heightDIPs });
|
|
16
|
+
base.setViewportListener(new org.nativescript.mason.masonkit.Mason.ViewportListener({
|
|
17
|
+
onViewportChanged(width, height) {
|
|
18
|
+
setDisplayDensity(base.getScale());
|
|
19
|
+
setCssUnitContext({ viewportWidth: width, viewportHeight: height });
|
|
20
|
+
refreshViewportUnits();
|
|
21
|
+
},
|
|
22
|
+
}));
|
|
23
|
+
base.watchViewport(Utils.android.getApplicationContext());
|
|
24
|
+
}
|
|
25
|
+
return Tree._tree;
|
|
26
|
+
}
|
|
27
|
+
get native() {
|
|
28
|
+
return this._base;
|
|
29
|
+
}
|
|
30
|
+
createView(context) {
|
|
31
|
+
return this.native.createView(context);
|
|
32
|
+
}
|
|
33
|
+
createScrollView(context) {
|
|
34
|
+
return this.native.createScrollView(context);
|
|
35
|
+
}
|
|
36
|
+
get preflight() {
|
|
37
|
+
return this.native.getPreflight();
|
|
38
|
+
}
|
|
39
|
+
set preflight(value) {
|
|
40
|
+
this.native.setPreflight(value);
|
|
41
|
+
}
|
|
42
|
+
}
|
package/tree/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export class Tree {
|
|
4
|
+
static readonly instance: Tree;
|
|
5
|
+
|
|
6
|
+
constructor();
|
|
7
|
+
|
|
8
|
+
readonly native: org.nativescript.mason.masonkit.Mason | NSCMason;
|
|
9
|
+
|
|
10
|
+
createView(context?): org.nativescript.mason.masonkit.View | MasonView;
|
|
11
|
+
|
|
12
|
+
createScrollView(context?): org.nativescript.mason.masonkit.Scroll | MasonScroll;
|
|
13
|
+
|
|
14
|
+
preflight: boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare class Tree {
|
|
2
|
+
private _base;
|
|
3
|
+
private static _tree;
|
|
4
|
+
constructor(base?: NSCMason);
|
|
5
|
+
static get instance(): Tree;
|
|
6
|
+
get native(): NSCMason;
|
|
7
|
+
createView(): MasonUIView;
|
|
8
|
+
createScrollView(): MasonScroll;
|
|
9
|
+
/**
|
|
10
|
+
* Enable or disable CSS Preflight (web-normalised / Tailwind-like) defaults.
|
|
11
|
+
*
|
|
12
|
+
* When `true` every element starts from a clean, browser-normalised slate:
|
|
13
|
+
* - `box-sizing: border-box`
|
|
14
|
+
* - `margin: 0`, `padding: 0`, `border-width: 0`
|
|
15
|
+
* - `background: transparent`
|
|
16
|
+
* - `list-style: none` on lists
|
|
17
|
+
* - `display: block` on `<img>`
|
|
18
|
+
*
|
|
19
|
+
* Set this **before** creating views for the cleanest result. Changing it
|
|
20
|
+
* afterwards re-seeds the arena so that unstyled nodes immediately pick up
|
|
21
|
+
* the new defaults; nodes that were already individually styled are
|
|
22
|
+
* not affected.
|
|
23
|
+
*/
|
|
24
|
+
get preflight(): boolean;
|
|
25
|
+
set preflight(value: boolean);
|
|
26
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Screen } from '@nativescript/core';
|
|
2
|
+
import { setViewportProvider } from '../units';
|
|
3
|
+
import { refreshViewportUnits } from '../style';
|
|
4
|
+
export class Tree {
|
|
5
|
+
constructor(base) {
|
|
6
|
+
this._base = base ?? NSCMason.new();
|
|
7
|
+
}
|
|
8
|
+
static get instance() {
|
|
9
|
+
if (!Tree._tree) {
|
|
10
|
+
Tree._tree = new Tree(NSCMason.shared);
|
|
11
|
+
// `vw`/`vh` follow the key window, so rotation and resizing reach new style writes.
|
|
12
|
+
setViewportProvider(() => {
|
|
13
|
+
const size = NSCMason.viewportSize;
|
|
14
|
+
if (size && size.width > 0 && size.height > 0)
|
|
15
|
+
return { width: size.width, height: size.height };
|
|
16
|
+
return { width: Screen.mainScreen.widthDIPs, height: Screen.mainScreen.heightDIPs };
|
|
17
|
+
});
|
|
18
|
+
// A rotation or window resize writes the values that used them again.
|
|
19
|
+
NSCMason.setViewportListener(() => refreshViewportUnits());
|
|
20
|
+
}
|
|
21
|
+
return Tree._tree;
|
|
22
|
+
}
|
|
23
|
+
get native() {
|
|
24
|
+
return this._base;
|
|
25
|
+
}
|
|
26
|
+
createView() {
|
|
27
|
+
return this.native.createView();
|
|
28
|
+
}
|
|
29
|
+
createScrollView() {
|
|
30
|
+
return this.native.createScrollView();
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Enable or disable CSS Preflight (web-normalised / Tailwind-like) defaults.
|
|
34
|
+
*
|
|
35
|
+
* When `true` every element starts from a clean, browser-normalised slate:
|
|
36
|
+
* - `box-sizing: border-box`
|
|
37
|
+
* - `margin: 0`, `padding: 0`, `border-width: 0`
|
|
38
|
+
* - `background: transparent`
|
|
39
|
+
* - `list-style: none` on lists
|
|
40
|
+
* - `display: block` on `<img>`
|
|
41
|
+
*
|
|
42
|
+
* Set this **before** creating views for the cleanest result. Changing it
|
|
43
|
+
* afterwards re-seeds the arena so that unstyled nodes immediately pick up
|
|
44
|
+
* the new defaults; nodes that were already individually styled are
|
|
45
|
+
* not affected.
|
|
46
|
+
*/
|
|
47
|
+
get preflight() {
|
|
48
|
+
return this.native.preflight;
|
|
49
|
+
}
|
|
50
|
+
set preflight(value) {
|
|
51
|
+
this.native.preflight = value;
|
|
52
|
+
}
|
|
53
|
+
}
|