Skip to content

Commit

Permalink
Merge pull request #183 from jonataswalker/up-deps
Browse files Browse the repository at this point in the history
Update Deps and publish
  • Loading branch information
jonataswalker authored Apr 27, 2020
2 parents c240c67 + 6a312e1 commit 76b8ea2
Show file tree
Hide file tree
Showing 11 changed files with 3,815 additions and 1,735 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@
"editor.formatOnPaste": true,
},
"search.showLineNumbers": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
}
6 changes: 3 additions & 3 deletions examples/contextmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ var contextmenu = new ContextMenu({
});
map.addControl(contextmenu);

contextmenu.on('open', function(evt) {
var feature = map.forEachFeatureAtPixel(evt.pixel, function(ft, l) {
contextmenu.on('open', function (evt) {
var feature = map.forEachFeatureAtPixel(evt.pixel, function (ft, l) {
return ft;
});
if (feature && feature.get('type') === 'removable') {
Expand All @@ -68,7 +68,7 @@ contextmenu.on('open', function(evt) {
}
});

map.on('pointermove', function(e) {
map.on('pointermove', function (e) {
var pixel = map.getEventPixel(e.originalEvent);
var hit = map.hasFeatureAtPixel(pixel);

Expand Down
5,444 changes: 3,762 additions & 1,682 deletions package-lock.json

Large diffs are not rendered by default.

34 changes: 18 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ol-contextmenu",
"version": "4.0.0",
"version": "4.0.1",
"description": "Custom Context Menu for Openlayers",
"main": "dist/ol-contextmenu.js",
"author": "Jonatas Walker",
Expand All @@ -19,35 +19,37 @@
"scripts": {
"dev": "rollup -w -c",
"build": "rollup -c",
"lint": "eslint --cache --cache-location .eslintcache/ --ext .js .",
"lint:fix": "npm run lint -- --fix",
"test": "npm run build && npm run test:unit",
"test:unit": "jest",
"test:unit:watch": "jest --watch"
},
"dependencies": {},
"devDependencies": {
"@babel/core": "^7.7.2",
"@babel/preset-env": "^7.7.1",
"autoprefixer": "^9.7.2",
"babel-jest": "^24.9.0",
"canvas": "^2.6.0",
"@babel/core": "^7.9.0",
"@babel/preset-env": "^7.9.5",
"autoprefixer": "^9.7.6",
"babel-jest": "^25.4.0",
"canvas": "^2.6.1",
"eslint": "^6.6.0",
"eslint-config-jwalker": "^5.2.0",
"eslint-config-prettier": "^6.7.0",
"eslint-plugin-jest": "^23.0.4",
"eslint-plugin-prettier": "^3.1.1",
"jest": "^24.9.0",
"ol": "^6.1.1",
"postcss": "^7.0.23",
"prettier": "^1.19.1",
"rollup": "^1.27.2",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-jest": "^23.8.2",
"eslint-plugin-prettier": "^3.1.3",
"jest": "^25.4.0",
"ol": "^6.3.1",
"postcss": "^7.0.27",
"prettier": "^2.0.5",
"rollup": "^2.7.2",
"rollup-plugin-buble": "^0.19.8",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-eslint": "^7.0.0",
"rollup-plugin-filesize": "^6.2.1",
"rollup-plugin-filesize": "^7.0.0",
"rollup-plugin-includepaths": "^0.2.3",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-sass": "^1.2.2",
"rollup-plugin-terser": "^5.1.2",
"rollup-plugin-terser": "^5.3.0",
"should": "^13.2.3"
}
}
4 changes: 2 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ const scssVars = Object.keys(cssVars).reduce(
''
);

const processor = css =>
const processor = (css) =>
postcss([autoprefixer])
.process(css, { from: undefined })
.then(result => banner + result.css);
.then((result) => banner + result.css);

const sassOpts = { data: scssVars, sourceMap: false };

Expand Down
8 changes: 4 additions & 4 deletions src/helpers/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { isNumeric } from './mix';
*/
export function addClass(element, classname, timeout) {
if (Array.isArray(element)) {
element.forEach(each => addClass(each, classname));
element.forEach((each) => addClass(each, classname));
return;
}

Expand All @@ -30,7 +30,7 @@ export function addClass(element, classname, timeout) {
*/
export function removeClass(element, classname, timeout) {
if (Array.isArray(element)) {
element.forEach(each => removeClass(each, classname, timeout));
element.forEach((each) => removeClass(each, classname, timeout));
return;
}

Expand Down Expand Up @@ -62,7 +62,7 @@ export function hasClass(element, c) {
*/
export function toggleClass(element, classname) {
if (Array.isArray(element)) {
element.forEach(each => toggleClass(each, classname));
element.forEach((each) => toggleClass(each, classname));
return;
}

Expand Down Expand Up @@ -165,7 +165,7 @@ export function removeAll(collection) {
}

export function getChildren(node, tag) {
return [].filter.call(node.childNodes, el =>
return [].filter.call(node.childNodes, (el) =>
tag
? el.nodeType === 1 && el.tagName.toLowerCase() === tag
: el.nodeType === 1
Expand Down
15 changes: 5 additions & 10 deletions src/helpers/mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,7 @@ export function contains(str_test, str) {
}

export function getUniqueId() {
return (
'_' +
Math.random()
.toString(36)
.substr(2, 9)
);
return '_' + Math.random().toString(36).substr(2, 9);
}

export function isDefAndNotNull(val) {
Expand All @@ -58,7 +53,7 @@ export function now() {

Date.now =
Date.now ||
function() {
function () {
// thanks IE8
return new Date().getTime();
};
Expand Down Expand Up @@ -94,16 +89,16 @@ export function emptyArray(array) {
}

export function anyMatchInArray(source, target) {
return source.some(each => target.indexOf(each) >= 0);
return source.some((each) => target.indexOf(each) >= 0);
}

export function everyMatchInArray(arr1, arr2) {
return arr2.every(each => arr1.indexOf(each) >= 0);
return arr2.every((each) => arr1.indexOf(each) >= 0);
}

export function anyItemHasValue(obj, has = false) {
const keys = Object.keys(obj);
keys.forEach(key => {
keys.forEach((key) => {
if (!isEmpty(obj[key])) has = true;
});
return has;
Expand Down
2 changes: 1 addition & 1 deletion src/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class Html {
this.Base.Internal.submenu.lastLeft || this.Base.Internal.submenu.left;
li.appendChild(sub);

item.items.forEach(each => {
item.items.forEach((each) => {
this.generateHtmlAndPublish(sub, each, true);
});
} else {
Expand Down
10 changes: 5 additions & 5 deletions src/internal.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class Internal {

getItemsLength() {
let count = 0;
Object.keys(this.items).forEach(k => {
Object.keys(this.items).forEach((k) => {
if (this.items[k].submenu || this.items[k].separator) return;
count++;
});
Expand Down Expand Up @@ -134,7 +134,7 @@ export class Internal {
} else {
this.submenu.lastLeft = this.submenu.left;
}
subs.forEach(sub => {
subs.forEach((sub) => {
// is there enough space for submenu height?
const viewport = getViewportSize();
const sub_offset = offset(sub);
Expand Down Expand Up @@ -210,7 +210,7 @@ export class Internal {
evt.target.addEventListener(
'pointerdown',
{
handleEvent: function(e) {
handleEvent: function (e) {
if (this.opened) {
this_.closeMenu();
e.stopPropagation();
Expand All @@ -225,10 +225,10 @@ export class Internal {
setItemListener(li, index) {
const this_ = this;
if (li && typeof this.items[index].callback === 'function') {
(function(callback) {
(function (callback) {
li.addEventListener(
'click',
function(evt) {
function (evt) {
evt.preventDefault();
const obj = {
coordinate: this_.getCoordinateClicked(),
Expand Down
16 changes: 8 additions & 8 deletions test/unit/helpers/data.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
const { callback1, callback2 } = require('./functions');

const dataMarker = exports.dataMarker = 'data-marker';
const dataCenter = exports.dataCenter = 'data-center';
const dataMarker = (exports.dataMarker = 'data-marker');
const dataCenter = (exports.dataCenter = 'data-center');

const items = exports.items = [
const items = (exports.items = [
'-',
{
text: 'Center map here',
classname: 'bold',
data: dataCenter,
callback: callback1
callback: callback1,
},
{
text: 'Add a Marker',
data: dataMarker,
callback: callback2
callback: callback2,
},
];
]);

exports.items2 = [
{
text: 'Foo',
callback: callback1
callback: callback1,
},
{
text: 'Bar',
callback: callback2
callback: callback2,
},
];

Expand Down
8 changes: 4 additions & 4 deletions test/unit/helpers/functions.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
exports.callback1 = obj => {
exports.callback1 = (obj) => {
console.log(obj);
};

exports.callback2 = obj => {
exports.callback2 = (obj) => {
console.log(obj);
};

exports.toJSON = obj => JSON.stringify(obj);
exports.toJSON = (obj) => JSON.stringify(obj);

exports.countItems = obj => Object.keys(obj).length;
exports.countItems = (obj) => Object.keys(obj).length;

0 comments on commit 76b8ea2

Please sign in to comment.