New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nativescript-material-core

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nativescript-material-core - npm Package Compare versions

Comparing version 2.2.0-alpha.0 to 2.2.0-alpha.1

61

android/utils.js
import { Color } from 'tns-core-modules/color/color';
import { ad } from 'tns-core-modules/utils/utils';
let isPostLollipopVar = undefined;
var isPostLollipopVar = undefined;
export function isPostLollipop() {

@@ -10,3 +10,3 @@ if (isPostLollipopVar === undefined) {

}
let isPostLollipopMR1Var = undefined;
var isPostLollipopMR1Var = undefined;
export function isPostLollipopMR1() {

@@ -18,3 +18,3 @@ if (isPostLollipopMR1Var === undefined) {

}
export const state = {
export var state = {
get selected() {

@@ -42,8 +42,12 @@ return 16842913;

};
function createNativeArray(...args) {
const result = Array.create('int', args.length);
args.forEach((a, i) => (result[i] = a));
function createNativeArray() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var result = Array.create('int', args.length);
args.forEach(function (a, i) { return (result[i] = a); });
return result;
}
export const stateSets = {
export var stateSets = {
get PRESSED_STATE_SET() {

@@ -141,6 +145,6 @@ if (!this._PRESSED_STATE_SET) {

export function getRippleColorStateList(color) {
const states = Array.create('[I', 2);
var states = Array.create('[I', 2);
states[0] = stateSets.SELECTED_PRESSED_STATE_SET;
states[1] = Array.create('int', 0);
const colors = Array.create('int', 2);
var colors = Array.create('int', 2);
colors[0] = color;

@@ -151,7 +155,7 @@ colors[1] = 0;

export function getEnabledColorStateList(color, variant) {
const states = Array.create('[I', 2);
var states = Array.create('[I', 2);
states[0] = Array.create('int', 1);
states[0][0] = -state.enabled;
states[1] = android.util.StateSet.NOTHING;
const colors = Array.create('int', 2);
var colors = Array.create('int', 2);
colors[0] = variant === 'text' || variant === 'outline' ? 0 : new Color(30, 0, 0, 0).android;

@@ -162,11 +166,11 @@ colors[1] = color;

export function createStateListAnimator(view, nativeView) {
const elevation = android.support.v4.view.ViewCompat.getElevation(nativeView);
const translationZ = android.support.v4.view.ViewCompat.getTranslationZ(nativeView);
const elevationSelected = view.style['elevationHighlighted'] !== undefined ? view.style['elevationHighlighted'] : elevation * 2;
const translationSelectedZ = translationZ + (6 * elevationSelected) / elevation / 2;
const animationDuration = 100;
const listAnimator = new android.animation.StateListAnimator();
let animators = new java.util.ArrayList();
let set = new android.animation.AnimatorSet();
let animator = android.animation.ObjectAnimator.ofFloat(nativeView, 'translationZ', [translationSelectedZ]);
var elevation = android.support.v4.view.ViewCompat.getElevation(nativeView);
var translationZ = android.support.v4.view.ViewCompat.getTranslationZ(nativeView);
var elevationSelected = view.style['elevationHighlighted'] !== undefined ? view.style['elevationHighlighted'] : elevation * 2;
var translationSelectedZ = translationZ + (6 * elevationSelected) / elevation / 2;
var animationDuration = 100;
var listAnimator = new android.animation.StateListAnimator();
var animators = new java.util.ArrayList();
var set = new android.animation.AnimatorSet();
var animator = android.animation.ObjectAnimator.ofFloat(nativeView, 'translationZ', [translationSelectedZ]);
animators.add(animator);

@@ -211,4 +215,4 @@ animator = android.animation.ObjectAnimator.ofFloat(nativeView, 'elevation', [elevationSelected]);

export function getAttrColor(context, name) {
const ta = context.obtainStyledAttributes([ad.resources.getId(':attr/' + name)]);
const color = ta.getColor(0, 0);
var ta = context.obtainStyledAttributes([ad.resources.getId(':attr/' + name)]);
var color = ta.getColor(0, 0);
ta.recycle();

@@ -218,11 +222,12 @@ return color;

function createForegroundShape(radius) {
const radii = Array.create('float', 8);
var radii = Array.create('float', 8);
java.util.Arrays.fill(radii, radius);
const shape = new android.graphics.drawable.shapes.RoundRectShape(radii, null, null);
const shapeDrawable = new android.graphics.drawable.ShapeDrawable(shape);
var shape = new android.graphics.drawable.shapes.RoundRectShape(radii, null, null);
var shapeDrawable = new android.graphics.drawable.ShapeDrawable(shape);
return shapeDrawable;
}
export function createRippleDrawable(view, rippleColor, radius = 0) {
const rippleShape = createForegroundShape(radius);
let rippleDrawable;
export function createRippleDrawable(view, rippleColor, radius) {
if (radius === void 0) { radius = 0; }
var rippleShape = createForegroundShape(radius);
var rippleDrawable;
if (isPostLollipopMR1()) {

@@ -229,0 +234,0 @@ rippleDrawable = new android.graphics.drawable.RippleDrawable(android.content.res.ColorStateList.valueOf(rippleColor), null, rippleShape);

@@ -14,3 +14,3 @@ import { CssProperty } from 'tns-core-modules/ui/core/properties';

}
export const cssProperty = (target, key) => {
export var cssProperty = function (target, key) {
Object.defineProperty(target, key, {

@@ -23,22 +23,22 @@ get: createGetter(key),

};
export const rippleColorProperty = new CssProperty({
export var rippleColorProperty = new CssProperty({
name: 'rippleColor',
cssName: 'ripple-color',
equalityComparer: Color.equals,
valueConverter: v => new Color(v)
valueConverter: function (v) { return new Color(v); }
});
rippleColorProperty.register(Style);
export const elevationProperty = new CssProperty({
export var elevationProperty = new CssProperty({
name: 'elevation',
cssName: 'elevation',
valueConverter: v => Length.toDevicePixels(Length.parse(v), 0)
valueConverter: function (v) { return Length.toDevicePixels(Length.parse(v), 0); }
});
elevationProperty.register(Style);
export const elevationHighlightedProperty = new CssProperty({
export var elevationHighlightedProperty = new CssProperty({
name: 'elevationHighlighted',
cssName: 'elevation-highlighted',
valueConverter: v => Length.toDevicePixels(Length.parse(v), 0)
valueConverter: function (v) { return Length.toDevicePixels(Length.parse(v), 0); }
});
elevationHighlightedProperty.register(Style);
export const variantProperty = new CssProperty({
export var variantProperty = new CssProperty({
name: 'variant',

@@ -45,0 +45,0 @@ cssName: 'variant'

import { Color } from 'tns-core-modules/color/color';
import { applyMixins } from './material.common';
export { applyMixins };
export class Themer {
getOrcreateAppColorScheme() {
var Themer = (function () {
function Themer() {
}
getAppColorScheme() {
}
setPrimaryColor(value) {
}
setPrimaryColorVariant(value) {
}
}
export const themer = new Themer();
Themer.prototype.getOrcreateAppColorScheme = function () {
};
Themer.prototype.getAppColorScheme = function () {
};
Themer.prototype.setPrimaryColor = function (value) {
};
Themer.prototype.setPrimaryColorVariant = function (value) {
};
return Themer;
}());
export { Themer };
export var themer = new Themer();
export function install() {

@@ -25,3 +29,3 @@ try {

if (color) {
const temp = typeof color === 'string' ? new Color(color) : color;
var temp = typeof color === 'string' ? new Color(color) : color;
return new Color(temp.a !== 255 ? temp.a : 36, temp.r, temp.g, temp.b).android;

@@ -28,0 +32,0 @@ }

export function applyMixins(derivedCtor, baseCtors) {
baseCtors.forEach(baseCtor => {
Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
const descriptor = Object.getOwnPropertyDescriptor(baseCtor.prototype, name);
baseCtors.forEach(function (baseCtor) {
Object.getOwnPropertyNames(baseCtor.prototype).forEach(function (name) {
var descriptor = Object.getOwnPropertyDescriptor(baseCtor.prototype, name);
if (name === 'constructor')

@@ -11,9 +11,13 @@ return;

else {
const oldImpl = derivedCtor.prototype[name];
if (!oldImpl) {
var oldImpl_1 = derivedCtor.prototype[name];
if (!oldImpl_1) {
derivedCtor.prototype[name] = baseCtor.prototype[name];
}
else {
derivedCtor.prototype[name] = function (...args) {
oldImpl.apply(this, args);
derivedCtor.prototype[name] = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
oldImpl_1.apply(this, args);
baseCtor.prototype[name].apply(this, args);

@@ -24,4 +28,4 @@ };

});
Object.getOwnPropertySymbols(baseCtor.prototype).forEach(symbol => {
const oldImpl = derivedCtor.prototype[symbol];
Object.getOwnPropertySymbols(baseCtor.prototype).forEach(function (symbol) {
var oldImpl = derivedCtor.prototype[symbol];
if (!oldImpl) {

@@ -31,3 +35,7 @@ derivedCtor.prototype[symbol] = baseCtor.prototype[symbol];

else {
derivedCtor.prototype[symbol] = function (...args) {
derivedCtor.prototype[symbol] = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
oldImpl.apply(this, args);

@@ -34,0 +42,0 @@ baseCtor.prototype[symbol].apply(this, args);

@@ -8,8 +8,8 @@ import { Color } from 'tns-core-modules/color/color';

export { applyMixins };
export class Themer {
constructor() {
var Themer = (function () {
function Themer() {
this.appColorScheme = MDCSemanticColorScheme.new();
this.appColorScheme.primaryColorVariant = this.appColorScheme.primaryColor.colorWithAlphaComponent(0.24);
}
getOrcreateAppColorScheme() {
Themer.prototype.getOrcreateAppColorScheme = function () {
if (!this.appColorScheme) {

@@ -19,16 +19,16 @@ this.appColorScheme = MDCSemanticColorScheme.new();

return this.appColorScheme;
}
getAppColorScheme() {
};
Themer.prototype.getAppColorScheme = function () {
return this.appColorScheme;
}
setPrimaryColor(value) {
const colorTheme = this.getOrcreateAppColorScheme();
const color = new Color(value);
};
Themer.prototype.setPrimaryColor = function (value) {
var colorTheme = this.getOrcreateAppColorScheme();
var color = new Color(value);
colorTheme.primaryColor = color.ios;
colorTheme.primaryColorVariant = new Color(61.2, color.r, color.g, color.b).ios;
}
setPrimaryColorVariant(value) {
};
Themer.prototype.setPrimaryColorVariant = function (value) {
this.getOrcreateAppColorScheme().primaryColorVariant = new Color(value).ios;
}
getOrcreateAppTypographyScheme() {
};
Themer.prototype.getOrcreateAppTypographyScheme = function () {
if (!this.appTypoScheme) {

@@ -38,10 +38,12 @@ this.appTypoScheme = MDCTypographyScheme.new();

return this.appTypoScheme;
}
getAppTypographyScheme() {
};
Themer.prototype.getAppTypographyScheme = function () {
return this.appTypoScheme;
}
setButtonTypography(args) {
}
}
export const themer = new Themer();
};
Themer.prototype.setButtonTypography = function (args) {
};
return Themer;
}());
export { Themer };
export var themer = new Themer();
export function install() {

@@ -57,3 +59,3 @@ try {

if (color) {
const temp = typeof color === 'string' ? new Color(color) : color;
var temp = typeof color === 'string' ? new Color(color) : color;
return new Color(temp.a !== 255 ? temp.a : 36, temp.r, temp.g, temp.b).ios;

@@ -63,12 +65,14 @@ }

}
class ViewWithElevationAndRipple extends View {
constructor() {
super(...arguments);
this._shadowElevations = {};
var ViewWithElevationAndRipple = (function (_super) {
__extends(ViewWithElevationAndRipple, _super);
function ViewWithElevationAndRipple() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._shadowElevations = {};
return _this;
}
getOrCreateRippleController() {
ViewWithElevationAndRipple.prototype.getOrCreateRippleController = function () {
if (!this.inkTouchController) {
this.inkTouchController = MDCInkTouchController.alloc().initWithView(this.nativeViewProtected);
this.inkTouchController.addInkView();
const colorScheme = themer.getAppColorScheme();
var colorScheme = themer.getAppColorScheme();
MDCInkColorThemer.applyColorSchemeToInkView(colorScheme, this.inkTouchController.defaultInkView);

@@ -80,7 +84,7 @@ if (this.style.backgroundInternal) {

return this.inkTouchController;
}
getOrCreateShadowLayer() {
};
ViewWithElevationAndRipple.prototype.getOrCreateShadowLayer = function () {
if (!this.shadowLayer) {
this._shadowElevations = this._shadowElevations || {};
const layer = (this.shadowLayer = MDCShadowLayer.layer());
var layer = (this.shadowLayer = MDCShadowLayer.layer());
layer.frame = this.nativeViewProtected.layer.bounds;

@@ -96,14 +100,14 @@ this.nativeViewProtected.layer.addSublayer(this.shadowLayer);

return this.shadowLayer;
}
_onSizeChanged() {
};
ViewWithElevationAndRipple.prototype._onSizeChanged = function () {
if (this.nativeViewProtected && this.shadowLayer) {
this.shadowLayer.frame = this.nativeViewProtected.layer.bounds;
}
}
_setNativeClipToBounds() {
};
ViewWithElevationAndRipple.prototype._setNativeClipToBounds = function () {
if (this.shadowLayer) {
this.nativeViewProtected.clipsToBounds = false;
}
}
onUnloaded() {
};
ViewWithElevationAndRipple.prototype.onUnloaded = function () {
if (this._elevationStateChangedHandler) {

@@ -117,14 +121,14 @@ if (this._elevationStateChangedHandler.stop) {

}
}
updateShadowElevation(state) {
};
ViewWithElevationAndRipple.prototype.updateShadowElevation = function (state) {
if (this.shadowLayer) {
const elevation = this._shadowElevations[state];
var elevation = this._shadowElevations[state];
this.shadowLayer.elevation = elevation;
}
}
[rippleColorProperty.setNative](color) {
};
ViewWithElevationAndRipple.prototype[rippleColorProperty.setNative] = function (color) {
this.getOrCreateRippleController();
this.inkTouchController.defaultInkView.inkColor = getRippleColor(color);
}
[elevationProperty.setNative](value) {
};
ViewWithElevationAndRipple.prototype[elevationProperty.setNative] = function (value) {
this.getOrCreateShadowLayer();

@@ -137,4 +141,5 @@ this._shadowElevations['normal'] = value;

}
}
startElevationStateChangeHandler() {
};
ViewWithElevationAndRipple.prototype.startElevationStateChangeHandler = function () {
var _this = this;
if (!this._elevationStateChangedHandler) {

@@ -144,4 +149,4 @@ if (this.nativeViewProtected instanceof UIControl) {

this._elevationStateChangedHandler ||
new ControlStateChangeListener(this.nativeViewProtected, (s) => {
this.updateShadowElevation(s);
new ControlStateChangeListener(this.nativeViewProtected, function (s) {
_this.updateShadowElevation(s);
});

@@ -153,9 +158,9 @@ this._elevationStateChangedHandler.start();

this._elevationStateChangedHandler ||
((args) => {
(function (args) {
switch (args.action) {
case TouchAction.up:
this.updateShadowElevation('normal');
_this.updateShadowElevation('normal');
break;
case TouchAction.down:
this.updateShadowElevation('highlighted');
_this.updateShadowElevation('highlighted');
break;

@@ -167,9 +172,9 @@ }

}
}
[elevationHighlightedProperty.setNative](value) {
};
ViewWithElevationAndRipple.prototype[elevationHighlightedProperty.setNative] = function (value) {
this.getOrCreateShadowLayer();
this.startElevationStateChangeHandler();
this._shadowElevations['highlighted'] = value;
}
[backgroundInternalProperty.setNative](value) {
};
ViewWithElevationAndRipple.prototype[backgroundInternalProperty.setNative] = function (value) {
if (this.shadowLayer) {

@@ -181,18 +186,19 @@ this.shadowLayer.cornerRadius = layout.toDeviceIndependentPixels(value.borderTopLeftRadius);

}
}
}
__decorate([
cssProperty,
__metadata("design:type", Number)
], ViewWithElevationAndRipple.prototype, "elevation", void 0);
__decorate([
cssProperty,
__metadata("design:type", Number)
], ViewWithElevationAndRipple.prototype, "elevationHighlighted", void 0);
__decorate([
cssProperty,
__metadata("design:type", Color)
], ViewWithElevationAndRipple.prototype, "rippleColor", void 0);
};
__decorate([
cssProperty,
__metadata("design:type", Number)
], ViewWithElevationAndRipple.prototype, "elevation", void 0);
__decorate([
cssProperty,
__metadata("design:type", Number)
], ViewWithElevationAndRipple.prototype, "elevationHighlighted", void 0);
__decorate([
cssProperty,
__metadata("design:type", Color)
], ViewWithElevationAndRipple.prototype, "rippleColor", void 0);
return ViewWithElevationAndRipple;
}(View));
export function overrideViewBase() {
const NSView = require('tns-core-modules/ui/core/view').View;
var NSView = require('tns-core-modules/ui/core/view').View;
applyMixins(NSView, [ViewWithElevationAndRipple]);

@@ -199,0 +205,0 @@ }

{
"name": "nativescript-material-core",
"version": "2.2.0-alpha.0",
"version": "2.2.0-alpha.1",
"description": "Material Core component",

@@ -33,3 +33,3 @@ "main": "./material",

"readmeFilename": "README.md",
"gitHead": "8f2127d5e67f6bc8ca43a74f1ba8887c927b2654"
"gitHead": "c5e5eb5a30a4064200fbdb289ca8799407f47aeb"
}

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc