Comparing version 0.2.6 to 0.2.7
@@ -18,3 +18,9 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Dropmic = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
this.options = options; | ||
this.defaults = { | ||
onOpen: null, | ||
onClose: null | ||
}; | ||
this.options = this.extendObject({}, this.defaults, options); | ||
this.list = null; | ||
@@ -129,4 +135,4 @@ this.custom = null; | ||
/** | ||
* Constructors | ||
*/ | ||
* Constructors | ||
*/ | ||
@@ -197,5 +203,37 @@ // Initialize dropdown if you want to generate it with JS | ||
/** | ||
* Public methodes to generate menu | ||
*/ | ||
* Callback methodes | ||
*/ | ||
}, { | ||
key: "_onOpen", | ||
value: function _onOpen() { | ||
this.options.onOpen(); | ||
} | ||
}, { | ||
key: "_onClose", | ||
value: function _onClose() { | ||
this.options.onClose(); | ||
} | ||
/** | ||
* Helpers | ||
*/ | ||
}, { | ||
key: "extendObject", | ||
value: function extendObject() { | ||
for (var i = 1; i < arguments.length; i++) { | ||
for (var key in arguments[i]) { | ||
if (arguments[i].hasOwnProperty(key)) { | ||
arguments[0][key] = arguments[i][key]; | ||
} | ||
} | ||
} | ||
return arguments[0]; | ||
} | ||
/** | ||
* Public methodes to generate menu | ||
*/ | ||
// Add a link | ||
@@ -269,2 +307,3 @@ | ||
}); | ||
this._onOpen(); | ||
} | ||
@@ -283,2 +322,3 @@ | ||
}); | ||
this._onClose(); | ||
} | ||
@@ -285,0 +325,0 @@ }]); |
@@ -14,2 +14,15 @@ "use strict"; | ||
const paths = { | ||
css: { | ||
src: 'src/*.css', | ||
dest: './dist/', | ||
watch: 'src/*.css' | ||
}, | ||
js: { | ||
src: 'src/dropmic.js', | ||
dest: './dist/', | ||
watch: 'src/*.js' | ||
} | ||
}; | ||
/* config | ||
@@ -19,3 +32,3 @@ ---------------------------------------------------- */ | ||
gulp.task('css', () => { | ||
return gulp.src('src/*.css') | ||
return gulp.src(paths.css.src) | ||
.pipe(autoprefixer({ | ||
@@ -26,3 +39,3 @@ browsers: ['> 1%', 'last 3 versions'], | ||
.pipe(cleanCSS()) | ||
.pipe(gulp.dest('dist')) | ||
.pipe(gulp.dest(paths.css.dest)) | ||
.pipe(reload({ | ||
@@ -36,7 +49,7 @@ stream: true | ||
return browserify({ | ||
entries: ['./src/dropmic.js'], | ||
entries: [paths.js.src], | ||
standalone: 'Dropmic' | ||
}) | ||
.transform('babelify', { | ||
presets: ['es2015'], | ||
presets: ['env'], | ||
global: true, | ||
@@ -47,3 +60,3 @@ ignore: /node_modules/ | ||
.pipe(source('dropmic.js')) | ||
.pipe(gulp.dest('./dist')); | ||
.pipe(gulp.dest(paths.js.dest)); | ||
}); | ||
@@ -55,4 +68,4 @@ | ||
gulp.task('watch', () => { | ||
gulp.watch('src/*.css', ['css']); | ||
gulp.watch('src/*.js', ['js']); | ||
gulp.watch(paths.css.watch, ['css']); | ||
gulp.watch(paths.js.watch, ['js']); | ||
}); | ||
@@ -59,0 +72,0 @@ |
{ | ||
"name": "dropmic", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"description": "A lightweight dropdown plugin", | ||
@@ -8,11 +8,11 @@ "main": "dist/dropmic.js", | ||
"devDependencies": { | ||
"babel-preset-es2015": "^6.14.0", | ||
"babel-preset-env": "^1.6.0", | ||
"babelify": "^7.3.0", | ||
"browser-sync": "^2.16.0", | ||
"browserify": "^14.1.0", | ||
"browser-sync": "^2.18.0", | ||
"browserify": "^14.4.0", | ||
"gulp": "^3.9.1", | ||
"gulp-autoprefixer": "^3.1.1", | ||
"gulp-babel": "^6.1.2", | ||
"gulp-babel": "^7.0.0", | ||
"gulp-clean-css": "^2.0.12", | ||
"gulp-uglify": "^2.0.0", | ||
"gulp-uglify": "^3.0.0", | ||
"vinyl-source-stream": "^1.1.0" | ||
@@ -19,0 +19,0 @@ }, |
@@ -16,8 +16,8 @@ # dropmic | ||
Method | Procedure | ||
-------- | --------- | ||
Bower | bower install dropmic --save | ||
NPM | npm install dropmic --save | ||
Yarn | yarn add dropmic | ||
Download | [Download zip](https://github.com/agence-webup/dropmic/archive/master.zip) | ||
Method | Procedure | ||
-------------------------- | --------- | ||
Bower | bower install dropmic --save | ||
NPM | npm install dropmic | ||
Yarn (obsolete since npm5) | yarn add dropmic | ||
Download | [Download zip](https://github.com/agence-webup/dropmic/archive/master.zip) | ||
@@ -24,0 +24,0 @@ Then dropmic have some css you will have to add (feel free to custom it for a better integration in your UI): |
@@ -9,3 +9,9 @@ const dropmicClassShow = "dropmic--show"; | ||
this.options = options; | ||
this.defaults = { | ||
onOpen: null, | ||
onClose: null | ||
}; | ||
this.options = this.extendObject({}, this.defaults, options); | ||
this.list = null; | ||
@@ -17,2 +23,3 @@ this.custom = null; | ||
this.init(); | ||
} | ||
@@ -114,4 +121,4 @@ | ||
/** | ||
* Constructors | ||
*/ | ||
* Constructors | ||
*/ | ||
@@ -167,5 +174,32 @@ // Initialize dropdown if you want to generate it with JS | ||
/** | ||
* Public methodes to generate menu | ||
*/ | ||
* Callback methodes | ||
*/ | ||
_onOpen() { | ||
this.options.onOpen(); | ||
} | ||
_onClose() { | ||
this.options.onClose(); | ||
} | ||
/** | ||
* Helpers | ||
*/ | ||
extendObject() { | ||
for (let i = 1; i < arguments.length; i++) { | ||
for (let key in arguments[i]) { | ||
if (arguments[i].hasOwnProperty(key)) { | ||
arguments[0][key] = arguments[i][key]; | ||
} | ||
} | ||
} | ||
return arguments[0]; | ||
} | ||
/** | ||
* Public methodes to generate menu | ||
*/ | ||
// Add a link | ||
@@ -224,2 +258,3 @@ addLink(label, url) { | ||
}) | ||
this._onOpen(); | ||
} | ||
@@ -235,2 +270,3 @@ | ||
}) | ||
this._onClose(); | ||
} | ||
@@ -237,0 +273,0 @@ } |
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
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
191515
1064
13