Socket
Socket
Sign inDemoInstall

@material/animation

Package Overview
Dependencies
Maintainers
8
Versions
1668
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@material/animation - npm Package Compare versions

Comparing version 0.1.5 to 0.2.0

143

dist/mdc.animation.js

@@ -19,10 +19,10 @@ /*!

/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)

@@ -34,23 +34,23 @@ /******/ var module = installedModules[moduleId] = {

/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports

@@ -66,3 +66,3 @@ /******/ __webpack_require__.d = function(exports, name, getter) {

/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules

@@ -76,11 +76,11 @@ /******/ __webpack_require__.n = function(module) {

/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/assets/";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 55);
/******/ return __webpack_require__(__webpack_require__.s = 59);
/******/ })

@@ -90,3 +90,3 @@ /************************************************************************/

/***/ 55:
/***/ 59:
/***/ (function(module, exports, __webpack_require__) {

@@ -122,31 +122,45 @@

/**
* @typedef {{
* noPrefix: string,
* webkitPrefix: string
* }}
*/
var VendorPropertyMapType = void 0;
/** @const {Object<string, !VendorPropertyMapType>} */
var eventTypeMap = {
animationstart: {
'animationstart': {
noPrefix: 'animationstart',
webkitPrefix: 'webkitAnimationStart'
webkitPrefix: 'webkitAnimationStart',
styleProperty: 'animation'
},
animationend: {
'animationend': {
noPrefix: 'animationend',
webkitPrefix: 'webkitAnimationEnd'
webkitPrefix: 'webkitAnimationEnd',
styleProperty: 'animation'
},
animationiteration: {
'animationiteration': {
noPrefix: 'animationiteration',
webkitPrefix: 'webkitAnimationIteration'
webkitPrefix: 'webkitAnimationIteration',
styleProperty: 'animation'
},
transitionend: {
'transitionend': {
noPrefix: 'transitionend',
webkitPrefix: 'webkitTransitionEnd'
webkitPrefix: 'webkitTransitionEnd',
styleProperty: 'transition'
}
};
/** @const {Object<string, !VendorPropertyMapType>} */
var cssPropertyMap = {
animation: {
'animation': {
noPrefix: 'animation',
webkitPrefix: '-webkit-animation'
},
transform: {
'transform': {
noPrefix: 'transform',
webkitPrefix: '-webkit-transform'
},
transition: {
'transition': {
noPrefix: 'transition',

@@ -157,6 +171,14 @@ webkitPrefix: '-webkit-transition'

/**
* @param {!Object} windowObj
* @return {boolean}
*/
function hasProperShape(windowObj) {
return windowObj.document !== undefined && typeof windowObj.document.createElement === 'function';
return windowObj['document'] !== undefined && typeof windowObj['document']['createElement'] === 'function';
}
/**
* @param {string} eventType
* @return {boolean}
*/
function eventFoundInMaps(eventType) {

@@ -166,28 +188,19 @@ return eventType in eventTypeMap || eventType in cssPropertyMap;

// If 'animation' or 'transition' exist as style property, webkit prefix isn't necessary. Since we are unable to
// see the event types on the element, we must rely on the corresponding style properties.
/**
* @param {string} eventType
* @param {!Object<string, !VendorPropertyMapType>} map
* @param {!Element} el
* @return {string}
*/
function getJavaScriptEventName(eventType, map, el) {
switch (eventType) {
case 'animationstart':
case 'animationend':
case 'animationiteration':
return 'animation' in el.style ? map[eventType].noPrefix : map[eventType].webkitPrefix;
case 'transitionend':
return 'transition' in el.style ? map[eventType].noPrefix : map[eventType].webkitPrefix;
default:
return map[eventType].noPrefix;
}
return map[eventType].styleProperty in el.style ? map[eventType].noPrefix : map[eventType].webkitPrefix;
}
// Helper function to determine browser prefix for CSS3 animation events
// and property names
//
// Parameters:
// windowObject: Object -- Contains Document with a `createElement()` method
// eventType: string -- The type of animation
//
// returns the value of the event as a string, prefixed if necessary.
// If proper arguments are not supplied, this function will return
// the property or event type without webkit prefix.
//
/**
* Helper function to determine browser prefix for CSS3 animation events
* and property names.
* @param {!Object} windowObj
* @param {string} eventType
* @return {string}
*/
function getAnimationName(windowObj, eventType) {

@@ -198,4 +211,4 @@ if (!hasProperShape(windowObj) || !eventFoundInMaps(eventType)) {

var map = eventType in eventTypeMap ? eventTypeMap : cssPropertyMap;
var el = windowObj.document.createElement('div');
var map = /** @type {!Object<string, !VendorPropertyMapType>} */eventType in eventTypeMap ? eventTypeMap : cssPropertyMap;
var el = windowObj['document']['createElement']('div');
var eventName = '';

@@ -214,11 +227,8 @@

// property names.
//
// Parameters:
// windowObject: Object -- Contains Document with a `createElement()` method
// eventType: string -- The type of animation
//
// returns the value of the event as a string, prefixed if necessary.
// If proper arguments are not supplied, this function will return
// the property or event type without webkit prefix.
//
/**
* @param {!Object} windowObj
* @param {string} eventType
* @return {string}
*/
function getCorrectEventName(windowObj, eventType) {

@@ -228,2 +238,7 @@ return getAnimationName(windowObj, eventType);

/**
* @param {!Object} windowObj
* @param {string} eventType
* @return {string}
*/
function getCorrectPropertyName(windowObj, eventType) {

@@ -230,0 +245,0 @@ return getAnimationName(windowObj, eventType);

@@ -6,2 +6,2 @@ /*!

*/
!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.animation=t():(n.mdc=n.mdc||{},n.mdc.animation=t())}(this,function(){return function(n){function t(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return n[i].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var e={};return t.m=n,t.c=e,t.i=function(n){return n},t.d=function(n,e,i){t.o(n,e)||Object.defineProperty(n,e,{configurable:!1,enumerable:!0,get:i})},t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},t.p="/assets/",t(t.s=55)}({55:function(n,t,e){n.exports=e(7)},7:function(n,t,e){"use strict";function i(n){return void 0!==n.document&&"function"==typeof n.document.createElement}function r(n){return n in c||n in s}function o(n,t,e){switch(n){case"animationstart":case"animationend":case"animationiteration":return"animation"in e.style?t[n].noPrefix:t[n].webkitPrefix;case"transitionend":return"transition"in e.style?t[n].noPrefix:t[n].webkitPrefix;default:return t[n].noPrefix}}function a(n,t){if(!i(n)||!r(t))return t;var e=t in c?c:s,a=n.document.createElement("div"),f="";return f=e===c?o(t,e,a):e[t].noPrefix in a.style?e[t].noPrefix:e[t].webkitPrefix}function f(n,t){return a(n,t)}function u(n,t){return a(n,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.getCorrectEventName=f,t.getCorrectPropertyName=u;var c={animationstart:{noPrefix:"animationstart",webkitPrefix:"webkitAnimationStart"},animationend:{noPrefix:"animationend",webkitPrefix:"webkitAnimationEnd"},animationiteration:{noPrefix:"animationiteration",webkitPrefix:"webkitAnimationIteration"},transitionend:{noPrefix:"transitionend",webkitPrefix:"webkitTransitionEnd"}},s={animation:{noPrefix:"animation",webkitPrefix:"-webkit-animation"},transform:{noPrefix:"transform",webkitPrefix:"-webkit-transform"},transition:{noPrefix:"transition",webkitPrefix:"-webkit-transition"}}}})});
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.animation=n():(t.mdc=t.mdc||{},t.mdc.animation=n())}(this,function(){return function(t){function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}var e={};return n.m=t,n.c=e,n.i=function(t){return t},n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="/assets/",n(n.s=59)}({59:function(t,n,e){t.exports=e(7)},7:function(t,n,e){"use strict";function i(t){return void 0!==t.document&&"function"==typeof t.document.createElement}function r(t){return t in c||t in s}function o(t,n,e){return n[t].styleProperty in e.style?n[t].noPrefix:n[t].webkitPrefix}function a(t,n){if(!i(t)||!r(n))return n;var e=n in c?c:s,a=t.document.createElement("div");return e===c?o(n,e,a):e[n].noPrefix in a.style?e[n].noPrefix:e[n].webkitPrefix}function f(t,n){return a(t,n)}function u(t,n){return a(t,n)}Object.defineProperty(n,"__esModule",{value:!0}),n.getCorrectEventName=f,n.getCorrectPropertyName=u;var c={animationstart:{noPrefix:"animationstart",webkitPrefix:"webkitAnimationStart",styleProperty:"animation"},animationend:{noPrefix:"animationend",webkitPrefix:"webkitAnimationEnd",styleProperty:"animation"},animationiteration:{noPrefix:"animationiteration",webkitPrefix:"webkitAnimationIteration",styleProperty:"animation"},transitionend:{noPrefix:"transitionend",webkitPrefix:"webkitTransitionEnd",styleProperty:"transition"}},s={animation:{noPrefix:"animation",webkitPrefix:"-webkit-animation"},transform:{noPrefix:"transform",webkitPrefix:"-webkit-transform"},transition:{noPrefix:"transition",webkitPrefix:"-webkit-transition"}}}})});

@@ -17,31 +17,45 @@ /**

/**
* @typedef {{
* noPrefix: string,
* webkitPrefix: string
* }}
*/
let VendorPropertyMapType;
/** @const {Object<string, !VendorPropertyMapType>} */
const eventTypeMap = {
animationstart: {
'animationstart': {
noPrefix: 'animationstart',
webkitPrefix: 'webkitAnimationStart',
styleProperty: 'animation',
},
animationend: {
'animationend': {
noPrefix: 'animationend',
webkitPrefix: 'webkitAnimationEnd',
styleProperty: 'animation',
},
animationiteration: {
'animationiteration': {
noPrefix: 'animationiteration',
webkitPrefix: 'webkitAnimationIteration',
styleProperty: 'animation',
},
transitionend: {
'transitionend': {
noPrefix: 'transitionend',
webkitPrefix: 'webkitTransitionEnd',
styleProperty: 'transition',
},
};
/** @const {Object<string, !VendorPropertyMapType>} */
const cssPropertyMap = {
animation: {
'animation': {
noPrefix: 'animation',
webkitPrefix: '-webkit-animation',
},
transform: {
'transform': {
noPrefix: 'transform',
webkitPrefix: '-webkit-transform',
},
transition: {
'transition': {
noPrefix: 'transition',

@@ -52,6 +66,14 @@ webkitPrefix: '-webkit-transition',

/**
* @param {!Object} windowObj
* @return {boolean}
*/
function hasProperShape(windowObj) {
return (windowObj.document !== undefined && typeof windowObj.document.createElement === 'function');
return (windowObj['document'] !== undefined && typeof windowObj['document']['createElement'] === 'function');
}
/**
* @param {string} eventType
* @return {boolean}
*/
function eventFoundInMaps(eventType) {

@@ -61,28 +83,19 @@ return (eventType in eventTypeMap || eventType in cssPropertyMap);

// If 'animation' or 'transition' exist as style property, webkit prefix isn't necessary. Since we are unable to
// see the event types on the element, we must rely on the corresponding style properties.
/**
* @param {string} eventType
* @param {!Object<string, !VendorPropertyMapType>} map
* @param {!Element} el
* @return {string}
*/
function getJavaScriptEventName(eventType, map, el) {
switch (eventType) {
case 'animationstart':
case 'animationend':
case 'animationiteration':
return 'animation' in el.style ? map[eventType].noPrefix : map[eventType].webkitPrefix;
case 'transitionend':
return 'transition' in el.style ? map[eventType].noPrefix : map[eventType].webkitPrefix;
default:
return map[eventType].noPrefix;
}
return map[eventType].styleProperty in el.style ? map[eventType].noPrefix : map[eventType].webkitPrefix;
}
// Helper function to determine browser prefix for CSS3 animation events
// and property names
//
// Parameters:
// windowObject: Object -- Contains Document with a `createElement()` method
// eventType: string -- The type of animation
//
// returns the value of the event as a string, prefixed if necessary.
// If proper arguments are not supplied, this function will return
// the property or event type without webkit prefix.
//
/**
* Helper function to determine browser prefix for CSS3 animation events
* and property names.
* @param {!Object} windowObj
* @param {string} eventType
* @return {string}
*/
function getAnimationName(windowObj, eventType) {

@@ -93,4 +106,6 @@ if (!hasProperShape(windowObj) || !eventFoundInMaps(eventType)) {

const map = eventType in eventTypeMap ? eventTypeMap : cssPropertyMap;
const el = windowObj.document.createElement('div');
const map = /** @type {!Object<string, !VendorPropertyMapType>} */ (
eventType in eventTypeMap ? eventTypeMap : cssPropertyMap
);
const el = windowObj['document']['createElement']('div');
let eventName = '';

@@ -109,11 +124,8 @@

// property names.
//
// Parameters:
// windowObject: Object -- Contains Document with a `createElement()` method
// eventType: string -- The type of animation
//
// returns the value of the event as a string, prefixed if necessary.
// If proper arguments are not supplied, this function will return
// the property or event type without webkit prefix.
//
/**
* @param {!Object} windowObj
* @param {string} eventType
* @return {string}
*/
export function getCorrectEventName(windowObj, eventType) {

@@ -123,4 +135,9 @@ return getAnimationName(windowObj, eventType);

/**
* @param {!Object} windowObj
* @param {string} eventType
* @return {string}
*/
export function getCorrectPropertyName(windowObj, eventType) {
return getAnimationName(windowObj, eventType);
}
{
"name": "@material/animation",
"description": "Animation Variables and Mixins used by Material Components for the web",
"version": "0.1.5",
"version": "0.2.0",
"license": "Apache-2.0",

@@ -6,0 +6,0 @@ "keywords": [

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