@nativescript-community/ui-material-core
Advanced tools
Comparing version 7.0.33 to 7.0.34
@@ -214,2 +214,4 @@ import { Application, Color, CoreTypes, Utils, ViewBase, profile } from '@nativescript/core'; | ||
view.setFocusable(focusable); | ||
// so dumb setFocusable to false set setFocusableInTouchMode | ||
// but not when using true :s so we have to do it | ||
view.setFocusableInTouchMode(focusable); | ||
@@ -238,9 +240,9 @@ } | ||
case 'center': | ||
return 1; | ||
return 1; //Gravity.CENTER_HORIZONTAL | ||
case 'right': | ||
return 8388613; | ||
return 8388613; //Gravity.END | ||
case 'initial': | ||
case 'left': | ||
default: | ||
return 8388611; | ||
return 8388611; //Gravity.START | ||
} | ||
@@ -252,10 +254,10 @@ } | ||
case 'top': | ||
return 48; | ||
return 48; //Gravity.TOP | ||
case 'middle': | ||
case 'center': | ||
return 16; | ||
return 16; //Gravity.CENTER_VERTICAL | ||
case 'bottom': | ||
return 80; | ||
return 80; //Gravity.BOTTOM | ||
} | ||
} | ||
//# sourceMappingURL=utils.js.map |
@@ -24,2 +24,3 @@ import { Application, Background, Button, Color, Length, PercentLength, Utils, View, androidDynamicElevationOffsetProperty, androidElevationProperty, backgroundInternalProperty } from '@nativescript/core'; | ||
} | ||
// stub class as we don't use this on android | ||
export class Themer { | ||
@@ -29,5 +30,11 @@ constructor() { | ||
} | ||
// appColorScheme: MDCSemanticColorScheme; | ||
getOrcreateAppColorScheme() { | ||
// if (!this.appColorScheme) { | ||
// this.appColorScheme = MDCSemanticColorScheme.alloc().init(); | ||
// } | ||
// return this.appColorScheme; | ||
} | ||
getAppColorScheme() { | ||
// return this.appColorScheme; | ||
} | ||
@@ -188,3 +195,3 @@ setPrimaryColor(value) { | ||
const temp = color instanceof Color ? color : new Color(color); | ||
return new Color(temp.a !== 255 ? temp.a : 61.5, temp.r, temp.g, temp.b).android; | ||
return new Color(temp.a !== 255 ? temp.a : 61.5, temp.r, temp.g, temp.b).android; // default alpha is 0.24 | ||
} | ||
@@ -251,2 +258,4 @@ return null; | ||
else { | ||
// we recreate the ripple drawable if necessary. | ||
// native button have on the background. Setting color will remove the ripple! | ||
if (this.rippleDrawable || (value.color && this instanceof Button && this.rippleColor)) { | ||
@@ -314,5 +323,7 @@ this.rippleDrawable = null; | ||
[androidElevationProperty.setNative](value) { | ||
// override to prevent override of dynamicElevationOffset | ||
this[elevationProperty.setNative](value); | ||
} | ||
[androidDynamicElevationOffsetProperty.setNative](value) { | ||
// override to prevent override of elevation | ||
this[dynamicElevationOffsetProperty.setNative](value); | ||
@@ -319,0 +330,0 @@ } |
@@ -9,6 +9,6 @@ import { Background, Button, Color, ControlStateChangeListener, CoreTypes, GestureTypes, PercentLength, TouchAction, Utils, View, backgroundInternalProperty } from '@nativescript/core'; | ||
case CornerFamily.CUT: | ||
return 1; | ||
return 1 /* MDCShapeCornerFamily.Cut */; | ||
default: | ||
case CornerFamily.ROUNDED: | ||
return 0; | ||
return 0 /* MDCShapeCornerFamily.Rounded */; | ||
} | ||
@@ -49,3 +49,4 @@ } | ||
this._shapes = {}; | ||
this.appColorScheme = MDCSemanticColorScheme.alloc().init().initWithDefaults(2); | ||
// create a default one to prevent multiple creations on widget side | ||
this.appColorScheme = MDCSemanticColorScheme.alloc().init().initWithDefaults(2 /* MDCColorSchemeDefaults.Material201907 */); | ||
if (this.appColorScheme.primaryColor) { | ||
@@ -135,2 +136,7 @@ this.appColorScheme.primaryColorVariant = this.appColorScheme.primaryColor.colorWithAlphaComponent(0.24); | ||
setButtonTypography(args) { | ||
// const typoTheme = this.getOrcreateAppTypographyScheme(); | ||
// let currentFont = typoTheme.button; | ||
// if (args.fontFamily) { | ||
// currentFont = currentFont.withFontFamily(args.fontFamily); | ||
// } | ||
} | ||
@@ -173,3 +179,4 @@ getShape(key) { | ||
const temp = color instanceof Color ? color : new Color(color); | ||
return new Color(temp.a !== 255 ? temp.a : 61.5, temp.r, temp.g, temp.b).ios; | ||
// return UIColor.colorWithRedGreenBlueAlpha(temp.r / 255, temp.g / 255, temp.b, temp.a !== 255 ? temp.a / 255 : 0.14); | ||
return new Color(temp.a !== 255 ? temp.a : 61.5, temp.r, temp.g, temp.b).ios; // default alpha is 0.24 | ||
} | ||
@@ -187,3 +194,7 @@ return null; | ||
if (!this.inkTouchController) { | ||
// create the shadow Layer | ||
this.inkTouchController = MDCRippleTouchController.alloc().initWithView(this.nativeViewProtected); | ||
// this.inkTouchController.addInkView(); | ||
// const colorScheme = themer.getAppColorScheme(); | ||
// MDCInkColorThemer.applyColorSchemeToInkView(colorScheme, this.inkTouchController.defaultInkView); | ||
if (this.style.backgroundInternal) { | ||
@@ -198,2 +209,3 @@ this.inkTouchController.rippleView.layer.cornerRadius = Utils.layout.toDeviceIndependentPixels(this.style.backgroundInternal.borderTopLeftRadius); | ||
this._shadowElevations = this._shadowElevations || {}; | ||
// create the shadow Layer | ||
const layer = (this.shadowLayer = MDCShadowLayer.alloc().init()); | ||
@@ -204,2 +216,3 @@ layer.shouldRasterize = true; | ||
this.nativeViewProtected.layer.addSublayer(this.shadowLayer); | ||
// we need to set clipToBounds to false. For now it overrides user choice. | ||
this['clipToBounds'] = false; | ||
@@ -315,2 +328,6 @@ this.nativeViewProtected.clipsToBounds = false; | ||
[backgroundInternalProperty.setNative](value) { | ||
// base impl will be called before | ||
// if (this.shadowLayer) { | ||
// this.shadowLayer.cornerRadius = Utils.layout.toDeviceIndependentPixels(value.borderTopLeftRadius); | ||
// } | ||
if (this.inkTouchController) { | ||
@@ -330,2 +347,4 @@ this.inkTouchController.rippleView.layer.cornerRadius = Utils.layout.toDeviceIndependentPixels(value.borderTopLeftRadius); | ||
], ViewWithElevationAndRipple.prototype, "rippleColor", void 0); | ||
// we need mixins to be applied after (run default implementation first) because of _setNativeClipToBounds. | ||
// it needs to be applied after for shadows to be drawn correctly | ||
applyMixins(NSView, [ViewWithElevationAndRipple], { | ||
@@ -332,0 +351,0 @@ after: true |
{ | ||
"name": "@nativescript-community/ui-material-core", | ||
"version": "7.0.33", | ||
"version": "7.0.34", | ||
"description": "Material Core component", | ||
@@ -9,6 +9,5 @@ "main": "./index", | ||
"scripts": { | ||
"tsc": "../../node_modules/.bin/cpy '**/*.d.ts' '../../packages/core' --cwd=../../src/core --parents && ../../node_modules/.bin/tsc -d", | ||
"tsc-win": "..\\..\\node_modules\\.bin\\cpy **/*.d.ts ..\\..\\packages\\core --cwd=..\\..\\src\\core --parents && ..\\..\\node_modules\\.bin\\tsc -d", | ||
"tsc": "cpy '**/*.d.ts' '../../packages/core' --cwd=../../src/core --parents && tsc -d", | ||
"tsc-win": "cpy **/*.d.ts ..\\..\\packages\\core --cwd=..\\..\\src\\core --parents && tsc -d", | ||
"build": "npm run tsc", | ||
"setup.yarn": "yarn install", | ||
"build.watch": "npm run tsc -- -w", | ||
@@ -18,3 +17,3 @@ "build.win": "npm run tsc-win", | ||
"build.all.win": "npm run build.win", | ||
"clean": "../../node_modules/.bin/rimraf ./*.d.ts ./*.js ./*.js.map android" | ||
"clean": "rimraf ./*.d.ts ./*.js ./*.js.map android" | ||
}, | ||
@@ -44,3 +43,3 @@ "nativescript": { | ||
"readmeFilename": "README.md", | ||
"gitHead": "0e601b87754a16516a604d2f32076c9d3b0a8bbd" | ||
"gitHead": "e0ccc861d2f6da556d045b069ebc6c8f32a6872a" | ||
} |
@@ -13,4 +13,4 @@ { | ||
}, | ||
"include": ["../../src/core/scripts/**/*.ts", "../../references.d.ts", "../../src/references.d.ts"], | ||
"include": ["../../src/core/scripts/**/*.ts", "../../references.d.ts", "../../tools/references.d.ts", "../../src/references.d.ts"], | ||
"exclude": ["../../src/core/angular/**"] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1418
114029
29