2017-01-10 04:04:09 +00:00
( function webpackUniversalModuleDefinition ( root , factory ) {
if ( typeof exports === 'object' && typeof module === 'object' )
module . exports = factory ( ) ;
else if ( typeof define === 'function' && define . amd )
define ( [ ] , factory ) ;
else if ( typeof exports === 'object' )
exports [ "VueMaterial" ] = factory ( ) ;
else
root [ "VueMaterial" ] = factory ( ) ;
} ) ( this , ( function ( ) {
return /******/ ( function ( modules ) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = { } ;
/******/ // The require function
/******/ function _ _webpack _require _ _ ( moduleId ) {
/******/ // Check if module is in cache
/******/ if ( installedModules [ moduleId ] )
/******/ return installedModules [ moduleId ] . exports ;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules [ moduleId ] = {
2017-02-08 03:16:24 +00:00
/******/ i : moduleId ,
/******/ l : false ,
/******/ exports : { }
2017-01-10 04:04:09 +00:00
/******/ } ;
/******/ // Execute the module function
/******/ modules [ moduleId ] . call ( module . exports , module , module . exports , _ _webpack _require _ _ ) ;
/******/ // Flag the module as loaded
2017-02-08 03:16:24 +00:00
/******/ module . l = true ;
2017-01-10 04:04:09 +00:00
/******/ // 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 ;
2017-02-08 03:16:24 +00:00
/******/ // identity function for calling harmony imports with the correct context
/******/ _ _webpack _require _ _ . i = function ( value ) { return value ; } ;
/******/ // define getter function for harmony exports
/******/ _ _webpack _require _ _ . d = function ( exports , name , getter ) {
/******/ if ( ! _ _webpack _require _ _ . o ( exports , name ) ) {
/******/ Object . defineProperty ( exports , name , {
/******/ configurable : false ,
/******/ enumerable : true ,
/******/ get : getter
/******/ } ) ;
/******/ }
/******/ } ;
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ _ _webpack _require _ _ . n = function ( module ) {
/******/ var getter = module && module . _ _esModule ?
/******/ function getDefault ( ) { return module [ 'default' ] ; } :
/******/ function getModuleExports ( ) { return module ; } ;
/******/ _ _webpack _require _ _ . d ( getter , 'a' , getter ) ;
/******/ return getter ;
/******/ } ;
/******/ // Object.prototype.hasOwnProperty.call
/******/ _ _webpack _require _ _ . o = function ( object , property ) { return Object . prototype . hasOwnProperty . call ( object , property ) ; } ;
2017-01-10 04:04:09 +00:00
/******/ // __webpack_public_path__
/******/ _ _webpack _require _ _ . p = "/" ;
/******/ // Load entry module and return exports
2017-02-09 00:05:12 +00:00
/******/ return _ _webpack _require _ _ ( _ _webpack _require _ _ . s = 409 ) ;
2017-01-10 04:04:09 +00:00
/******/ } )
/************************************************************************/
/******/ ( {
/***/ 0 :
2017-02-08 03:16:24 +00:00
/***/ ( function ( module , exports ) {
2017-01-10 04:04:09 +00:00
2017-02-08 03:16:24 +00:00
module . exports = function normalizeComponent (
rawScriptExports ,
compiledTemplate ,
scopeId ,
cssModules
) {
var esModule
var scriptExports = rawScriptExports = rawScriptExports || { }
2017-01-10 04:04:09 +00:00
2017-02-08 03:16:24 +00:00
// ES6 modules interop
var type = typeof rawScriptExports . default
if ( type === 'object' || type === 'function' ) {
esModule = rawScriptExports
scriptExports = rawScriptExports . default
}
2017-01-10 04:04:09 +00:00
2017-02-08 03:16:24 +00:00
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports . options
: scriptExports
// render functions
if ( compiledTemplate ) {
options . render = compiledTemplate . render
options . staticRenderFns = compiledTemplate . staticRenderFns
}
// scopedId
if ( scopeId ) {
options . _scopeId = scopeId
}
// inject cssModules
if ( cssModules ) {
var computed = options . computed || ( options . computed = { } )
Object . keys ( cssModules ) . forEach ( ( function ( key ) {
var module = cssModules [ key ]
computed [ key ] = function ( ) { return module }
} ) )
}
return {
esModule : esModule ,
exports : scriptExports ,
options : options
}
}
/***/ } ) ,
/***/ 102 :
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
exports . default = install ;
var _mdImage = _ _webpack _require _ _ ( 289 ) ;
var _mdImage2 = _interopRequireDefault ( _mdImage ) ;
var _mdImage3 = _ _webpack _require _ _ ( 243 ) ;
var _mdImage4 = _interopRequireDefault ( _mdImage3 ) ;
function _interopRequireDefault ( obj ) { return obj && obj . _ _esModule ? obj : { default : obj } ; }
function install ( Vue ) {
Vue . component ( 'md-image' , _mdImage2 . default ) ;
Vue . material . styles . push ( _mdImage4 . default ) ;
}
module . exports = exports [ 'default' ] ;
/***/ } ) ,
/***/ 152 :
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
var _getImageLightness = _ _webpack _require _ _ ( 58 ) ;
var _getImageLightness2 = _interopRequireDefault ( _getImageLightness ) ;
function _interopRequireDefault ( obj ) { return obj && obj . _ _esModule ? obj : { default : obj } ; }
exports . default = {
props : {
mdSrc : String
} ,
data : function data ( ) {
return {
loaded : false ,
applyBlack : true ,
imageElement : null
} ;
} ,
watch : {
mdSrc : function mdSrc ( ) {
this . createImage ( ) ;
}
} ,
computed : {
classes : function classes ( ) {
return {
'md-loaded' : this . loaded ,
'md-black-output' : this . applyBlack
} ;
}
} ,
methods : {
analyzeLightness : function analyzeLightness ( image ) {
var _this = this ;
2017-02-09 00:05:12 +00:00
var applyLoad = function applyLoad ( ) {
_this . loaded = true ;
} ;
2017-02-08 03:16:24 +00:00
( 0 , _getImageLightness2 . default ) ( image , ( function ( lightness ) {
var limit = 256 ;
var darkness = ( Math . abs ( limit - lightness ) * 100 / limit + 15 ) / 100 ;
if ( darkness >= 0.7 ) {
_this . applyBlack = true ;
}
2017-02-09 00:05:12 +00:00
_this . $nextTick ( applyLoad ) ;
} ) , applyLoad ) ;
2017-02-08 03:16:24 +00:00
} ,
createImage : function createImage ( ) {
this . loaded = false ;
this . applyBlack = false ;
this . imageElement = null ;
if ( this . mdSrc ) {
this . imageElement = document . createElement ( 'img' ) ;
this . imageElement . crossOrigin = '' ;
this . imageElement . src = this . mdSrc ;
this . analyzeLightness ( this . imageElement ) ;
}
}
} ,
created : function created ( ) {
this . createImage ( ) ;
}
} ; //
//
//
//
//
//
module . exports = exports [ 'default' ] ;
/***/ } ) ,
/***/ 229 :
/***/ ( function ( module , exports ) {
// removed by extract-text-webpack-plugin
/***/ } ) ,
/***/ 243 :
/***/ ( function ( module , exports ) {
module . exports = ""
/***/ } ) ,
/***/ 289 :
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
/* styles */
_ _webpack _require _ _ ( 229 )
var Component = _ _webpack _require _ _ ( 0 ) (
/* script */
_ _webpack _require _ _ ( 152 ) ,
/* template */
_ _webpack _require _ _ ( 389 ) ,
/* scopeId */
null ,
/* cssModules */
null
)
2017-02-09 00:05:12 +00:00
Component . options . _ _file = "/Users/mrufino/Projects/personal/github/vue-material/src/components/mdImage/mdImage.vue"
2017-02-08 03:16:24 +00:00
if ( Component . esModule && Object . keys ( Component . esModule ) . some ( ( function ( key ) { return key !== "default" && key !== "__esModule" } ) ) ) { console . error ( "named exports are not supported in *.vue files." ) }
if ( Component . options . functional ) { console . error ( "[vue-loader] mdImage.vue: functional components are not supported with templates, they should use render functions." ) }
/* hot reload */
if ( false ) { ( function ( ) {
var hotAPI = require ( "vue-hot-reload-api" )
hotAPI . install ( require ( "vue" ) , false )
if ( ! hotAPI . compatible ) return
module . hot . accept ( )
if ( ! module . hot . data ) {
hotAPI . createRecord ( "data-v-b0fc1ce4" , Component . options )
} else {
hotAPI . reload ( "data-v-b0fc1ce4" , Component . options )
}
} ) ( ) }
module . exports = Component . exports
/***/ } ) ,
/***/ 389 :
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
module . exports = { render : function ( ) { var _vm = this ; var _h = _vm . $createElement ; var _c = _vm . _self . _c || _h ;
return _c ( 'img' , {
staticClass : "md-image" ,
class : _vm . classes ,
attrs : {
"src" : _vm . mdSrc
}
} )
} , staticRenderFns : [ ] }
module . exports . render . _withStripped = true
if ( false ) {
module . hot . accept ( )
if ( module . hot . data ) {
require ( "vue-hot-reload-api" ) . rerender ( "data-v-b0fc1ce4" , module . exports )
}
}
/***/ } ) ,
2017-02-09 00:05:12 +00:00
/***/ 409 :
2017-02-08 03:16:24 +00:00
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
module . exports = _ _webpack _require _ _ ( 102 ) ;
/***/ } ) ,
/***/ 58 :
/***/ ( function ( module , exports , _ _webpack _require _ _ ) {
2017-01-10 04:04:09 +00:00
2017-02-08 03:16:24 +00:00
"use strict" ;
2017-01-10 04:04:09 +00:00
2017-02-08 03:16:24 +00:00
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
2017-02-09 00:05:12 +00:00
var getImageLightness = function getImageLightness ( image , onLoad , onError ) {
2017-02-08 03:16:24 +00:00
var canvas = document . createElement ( 'canvas' ) ;
2017-01-10 04:04:09 +00:00
2017-02-09 00:05:12 +00:00
image . crossOrigin = 'Anonymous' ;
2017-02-08 03:16:24 +00:00
image . onload = function ( ) {
var colorSum = 0 ;
var ctx = void 0 ;
var imageData = void 0 ;
var imageMetadata = void 0 ;
var r = void 0 ;
var g = void 0 ;
var b = void 0 ;
var average = void 0 ;
2017-01-10 04:04:09 +00:00
2017-02-08 03:16:24 +00:00
canvas . width = this . width ;
canvas . height = this . height ;
ctx = canvas . getContext ( '2d' ) ;
2017-01-10 04:04:09 +00:00
2017-02-08 03:16:24 +00:00
ctx . drawImage ( this , 0 , 0 ) ;
imageData = ctx . getImageData ( 0 , 0 , canvas . width , canvas . height ) ;
imageMetadata = imageData . data ;
for ( var x = 0 , len = imageMetadata . length ; x < len ; x += 4 ) {
r = imageMetadata [ x ] ;
g = imageMetadata [ x + 1 ] ;
b = imageMetadata [ x + 2 ] ;
average = Math . floor ( ( r + g + b ) / 3 ) ;
colorSum += average ;
}
onLoad ( Math . floor ( colorSum / ( this . width * this . height ) ) ) ;
} ;
2017-02-09 00:05:12 +00:00
image . onerror = onError ;
2017-02-08 03:16:24 +00:00
} ;
exports . default = getImageLightness ;
module . exports = exports [ 'default' ] ;
/***/ } )
2017-01-10 04:04:09 +00:00
2017-02-08 03:16:24 +00:00
/******/ } ) ;
} ) ) ;