Merge remote-tracking branch 'upstream/master' into fix/map-controls-and-improve-zoom-styling

This commit is contained in:
orangemug 2020-02-22 17:59:24 +00:00
commit 874c6460f6
10 changed files with 3482 additions and 2334 deletions

View file

@ -18,8 +18,8 @@ templates:
- run: mkdir -p /tmp/artifacts/logs - run: mkdir -p /tmp/artifacts/logs
- run: npm run build - run: npm run build
- run: npm run lint - run: npm run lint-js
- run: npm run lint-styles - run: npm run lint-css
- store_artifacts: - store_artifacts:
path: /tmp/artifacts path: /tmp/artifacts
destination: /artifacts destination: /artifacts
@ -42,8 +42,8 @@ templates:
- run: mkdir -p /tmp/artifacts/logs - run: mkdir -p /tmp/artifacts/logs
- run: npm run build - run: npm run build
- run: npm run profiling-build - run: npm run profiling-build
- run: npm run lint - run: npm run lint-js
- run: npm run lint-styles - run: npm run lint-css
- run: DOCKER_HOST=localhost npm test - run: DOCKER_HOST=localhost npm test
- run: ./node_modules/.bin/istanbul report --include /tmp/artifacts/coverage/coverage.json --dir /tmp/artifacts/coverage html lcov - run: ./node_modules/.bin/istanbul report --include /tmp/artifacts/coverage/coverage.json --dir /tmp/artifacts/coverage html lcov
- store_artifacts: - store_artifacts:

View file

@ -22,5 +22,5 @@ install:
build_script: build_script:
- npm run build - npm run build
test_script: test_script:
- npm run lint - npm run lint-js
- npm run lint-styles - npm run lint-css

View file

@ -97,7 +97,7 @@ exports.config = {
// //
screenshotPath: SCREENSHOT_PATH, screenshotPath: SCREENSHOT_PATH,
// Note: This is here because @orangemug currently runs Maputnik inside a docker container. // Note: This is here because @orangemug currently runs Maputnik inside a docker container.
host: process.env.DOCKER_HOST || "0.0.0.0", hostname: process.env.DOCKER_HOST || "0.0.0.0",
// Set a base URL in order to shorten url command calls. If your `url` parameter starts // Set a base URL in order to shorten url command calls. If your `url` parameter starts
// with `/`, the base url gets prepended, not including the path portion of your baseUrl. // with `/`, the base url gets prepended, not including the path portion of your baseUrl.
// If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url // If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
@ -118,7 +118,6 @@ exports.config = {
// Services take over a specific job you don't want to take care of. They enhance // Services take over a specific job you don't want to take care of. They enhance
// your test setup with almost no effort. Unlike plugins, they don't add new // your test setup with almost no effort. Unlike plugins, they don't add new
// commands. Instead, they hook themselves up into the test process. // commands. Instead, they hook themselves up into the test process.
services: ['selenium-standalone'],
// //
// Framework you want to run your specs with. // Framework you want to run your specs with.
// The following are supported: Mocha, Jasmine, and Cucumber // The following are supported: Mocha, Jasmine, and Cucumber
@ -147,12 +146,16 @@ exports.config = {
onPrepare: function (config, capabilities) { onPrepare: function (config, capabilities) {
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
var compiler = webpack(webpackConfig); var compiler = webpack(webpackConfig);
const serverHost = isDocker() ? "0.0.0.0" : "localhost";
server = new WebpackDevServer(compiler, { server = new WebpackDevServer(compiler, {
host: serverHost,
stats: { stats: {
colors: true colors: true
} }
}); });
server.listen(testConfig.port, (isDocker() ? "0.0.0.0" : "localhost"), function(err) {
server.listen(testConfig.port, serverHost, function(err) {
if(err) { if(err) {
reject(err); reject(err);
} }

View file

@ -3,6 +3,7 @@ var webpack = require('webpack');
var path = require('path'); var path = require('path');
var rules = require('./webpack.rules'); var rules = require('./webpack.rules');
var HtmlWebpackPlugin = require('html-webpack-plugin'); var HtmlWebpackPlugin = require('html-webpack-plugin');
var HtmlWebpackInlineSVGPlugin = require('html-webpack-inline-svg-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin'); var CopyWebpackPlugin = require('copy-webpack-plugin');
const HOST = process.env.HOST || "127.0.0.1"; const HOST = process.env.HOST || "127.0.0.1";
@ -61,6 +62,9 @@ module.exports = {
title: 'Maputnik', title: 'Maputnik',
template: './src/template.html' template: './src/template.html'
}), }),
new HtmlWebpackInlineSVGPlugin({
runPreEmit: true,
}),
new CopyWebpackPlugin([ new CopyWebpackPlugin([
{ {
from: './src/manifest.json', from: './src/manifest.json',

View file

@ -2,6 +2,7 @@ var webpack = require('webpack');
var path = require('path'); var path = require('path');
var rules = require('./webpack.rules'); var rules = require('./webpack.rules');
var HtmlWebpackPlugin = require('html-webpack-plugin'); var HtmlWebpackPlugin = require('html-webpack-plugin');
var HtmlWebpackInlineSVGPlugin = require('html-webpack-inline-svg-plugin');
var WebpackCleanupPlugin = require('webpack-cleanup-plugin'); var WebpackCleanupPlugin = require('webpack-cleanup-plugin');
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
var CopyWebpackPlugin = require('copy-webpack-plugin'); var CopyWebpackPlugin = require('copy-webpack-plugin');
@ -44,6 +45,9 @@ module.exports = {
template: './src/template.html', template: './src/template.html',
title: 'Maputnik' title: 'Maputnik'
}), }),
new HtmlWebpackInlineSVGPlugin({
runPreEmit: true,
}),
new CopyWebpackPlugin([ new CopyWebpackPlugin([
{ {
from: './src/manifest.json', from: './src/manifest.json',

5615
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -10,8 +10,9 @@
"test": "cross-env NODE_ENV=test wdio config/wdio.conf.js", "test": "cross-env NODE_ENV=test wdio config/wdio.conf.js",
"test-watch": "cross-env NODE_ENV=test wdio config/wdio.conf.js --watch", "test-watch": "cross-env NODE_ENV=test wdio config/wdio.conf.js --watch",
"start": "webpack-dev-server --progress --profile --colors --config config/webpack.config.js", "start": "webpack-dev-server --progress --profile --colors --config config/webpack.config.js",
"lint": "eslint --ext js --ext jsx src test", "lint-js": "eslint --ext js --ext jsx src test",
"lint-styles": "stylelint \"src/styles/*.scss\"" "lint-css": "stylelint \"src/styles/*.scss\"",
"lint": "npm run lint-js && npm run lint-css"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -21,11 +22,11 @@
"license": "MIT", "license": "MIT",
"homepage": "https://github.com/maputnik/editor#readme", "homepage": "https://github.com/maputnik/editor#readme",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.8.3", "@babel/runtime": "^7.8.4",
"@mapbox/mapbox-gl-rtl-text": "^0.2.3", "@mapbox/mapbox-gl-rtl-text": "^0.2.3",
"@mapbox/mapbox-gl-style-spec": "^13.10.2", "@mapbox/mapbox-gl-style-spec": "^13.12.0",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"codemirror": "^5.49.0", "codemirror": "^5.52.0",
"color": "^3.1.2", "color": "^3.1.2",
"detect-browser": "^4.8.0", "detect-browser": "^4.8.0",
"file-saver": "^2.0.2", "file-saver": "^2.0.2",
@ -37,14 +38,14 @@
"lodash.get": "^4.4.2", "lodash.get": "^4.4.2",
"lodash.isequal": "^4.5.0", "lodash.isequal": "^4.5.0",
"lodash.throttle": "^4.1.1", "lodash.throttle": "^4.1.1",
"mapbox-gl": "^1.6.1", "mapbox-gl": "^1.8.0",
"mapbox-gl-inspect": "^1.3.1", "mapbox-gl-inspect": "^1.3.1",
"maputnik-design": "github:maputnik/design", "maputnik-design": "github:maputnik/design#f7a2b4d",
"ol": "^6.1.1", "ol": "^6.2.1",
"ol-mapbox-style": "^5.0.2", "ol-mapbox-style": "^6.0.1",
"prop-types": "^15.7.2", "prop-types": "^15.7.2",
"react": "^16.12.0", "react": "^16.12.0",
"react-aria-menubutton": "^6.2.0", "react-aria-menubutton": "^6.3.0",
"react-aria-modal": "^4.0.0", "react-aria-modal": "^4.0.0",
"react-autobind": "^1.0.6", "react-autobind": "^1.0.6",
"react-autocomplete": "^1.8.1", "react-autocomplete": "^1.8.1",
@ -53,10 +54,10 @@
"react-dom": "^16.12.0", "react-dom": "^16.12.0",
"react-file-reader-input": "^2.0.0", "react-file-reader-input": "^2.0.0",
"react-icon-base": "^2.1.2", "react-icon-base": "^2.1.2",
"react-icons": "^3.8.0", "react-icons": "^3.9.0",
"react-motion": "^0.5.2", "react-motion": "^0.5.2",
"react-sortable-hoc": "^1.10.1", "react-sortable-hoc": "^1.11.0",
"reconnecting-websocket": "^4.2.0", "reconnecting-websocket": "^4.4.0",
"slugify": "^1.3.6", "slugify": "^1.3.6",
"url": "^0.11.0" "url": "^0.11.0"
}, },
@ -101,7 +102,7 @@
} }
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.6.3", "@babel/core": "^7.8.4",
"@babel/plugin-proposal-class-properties": "^7.5.5", "@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-transform-runtime": "^7.6.2", "@babel/plugin-transform-runtime": "^7.6.2",
"@babel/preset-env": "^7.6.3", "@babel/preset-env": "^7.6.3",
@ -116,38 +117,39 @@
"@wdio/sync": "^5.14.4", "@wdio/sync": "^5.14.4",
"babel-eslint": "^10.0.3", "babel-eslint": "^10.0.3",
"babel-loader": "8.0.6", "babel-loader": "8.0.6",
"babel-plugin-istanbul": "^5.2.0", "babel-plugin-istanbul": "^6.0.0",
"babel-plugin-static-fs": "^3.0.0", "babel-plugin-static-fs": "^3.0.0",
"copy-webpack-plugin": "^5.0.4", "copy-webpack-plugin": "^5.1.1",
"cors": "^2.8.5", "cors": "^2.8.5",
"cross-env": "^6.0.3", "cross-env": "^7.0.0",
"css-loader": "^3.2.0", "css-loader": "^3.4.2",
"eslint": "^6.5.1", "eslint": "^6.8.0",
"eslint-plugin-react": "^7.16.0", "eslint-plugin-react": "^7.18.3",
"express": "^4.17.1", "express": "^4.17.1",
"file-loader": "^4.2.0", "file-loader": "^5.1.0",
"html-webpack-inline-svg-plugin": "^1.3.0",
"html-webpack-plugin": "^3.2.0", "html-webpack-plugin": "^3.2.0",
"is-docker": "^2.0.0", "is-docker": "^2.0.0",
"istanbul": "^0.4.5", "istanbul": "^0.4.5",
"istanbul-lib-coverage": "^2.0.5", "istanbul-lib-coverage": "^3.0.0",
"mkdirp": "^0.5.1", "mkdirp": "^1.0.3",
"mocha": "^6.2.1", "mocha": "^7.0.1",
"node-sass": "^4.12.0", "node-sass": "^4.13.1",
"react-hot-loader": "^4.12.15", "react-hot-loader": "^4.12.19",
"sass-loader": "^8.0.0", "sass-loader": "^8.0.2",
"selenium-standalone": "^6.16.0", "selenium-standalone": "^6.17.0",
"style-loader": "^1.0.0", "style-loader": "^1.1.3",
"stylelint": "^11.0.0", "stylelint": "^13.2.0",
"stylelint-config-recommended-scss": "^4.0.0", "stylelint-config-recommended-scss": "^4.2.0",
"stylelint-scss": "^3.11.1", "stylelint-scss": "^3.14.2",
"svg-inline-loader": "^0.8.2", "svg-inline-loader": "^0.8.2",
"transform-loader": "^0.2.4", "transform-loader": "^0.2.4",
"uuid": "^3.3.3", "uuid": "^3.4.0",
"webdriverio": "^5.14.5", "webdriverio": "^5.18.7",
"webpack": "^4.41.0", "webpack": "^4.41.6",
"webpack-bundle-analyzer": "^3.5.2", "webpack-bundle-analyzer": "^3.6.0",
"webpack-cleanup-plugin": "^0.5.1", "webpack-cleanup-plugin": "^0.5.1",
"webpack-cli": "^3.3.9", "webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.8.2" "webpack-dev-server": "^3.10.3"
} }
} }

View file

@ -12,3 +12,6 @@ ReactDOM.render(
</IconContext.Provider>, </IconContext.Provider>,
document.querySelector("#app") document.querySelector("#app")
); );
// Hide the loader.
document.querySelector(".loading").style.display = "none";

View file

@ -9,63 +9,32 @@
html { html {
background-color: rgb(28, 31, 36); background-color: rgb(28, 31, 36);
} }
#loader,
#loader:before, .loading {
#loader:after { text-align: center;
border-radius: 50%;
width: 2.5em;
height: 2.5em;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-animation: pulseload 1.8s infinite ease-in-out;
animation: pulseload 1.8s infinite ease-in-out;
}
#loader {
color: #ffffff;
font-size: 10px;
margin: 80px auto;
position: relative;
text-indent: -9999em;
-webkit-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}
#loader:before,
#loader:after {
content: '';
position: absolute; position: absolute;
width: 100vw;
height: 100vh;
top: 0; top: 0;
left: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
} }
#loader:before {
left: -3.5em; .loading__logo svg {
-webkit-animation-delay: -0.32s; width: 200px;
animation-delay: -0.32s; height: 200px;
} }
#loader:after {
left: 3.5em; .loading__text {
} font-family: sans-serif;
@-webkit-keyframes pulseload { color: white;
0%, font-size: 1.2em;
80%, padding-bottom: 2em;
100% {
box-shadow: 0 2.5em 0 -1.3em;
}
40% {
box-shadow: 0 2.5em 0 0;
}
}
@keyframes pulseload {
0%,
80%,
100% {
box-shadow: 0 2.5em 0 -1.3em;
}
40% {
box-shadow: 0 2.5em 0 0;
}
} }
</style> </style>
</head> </head>
<body> <body>
@ -150,8 +119,13 @@
</defs> </defs>
</svg> </svg>
<div id="app"> <div id="app"></div>
<div id="loader">Loading...</div> <div class="loading">
<div class="loading__logo">
<!-- replaced by 'html-webpack-inline-svg-plugin' -->
<img inline src="node_modules/maputnik-design/logos/logo-loading.svg" />
</div>
<div class="loading__text">Loading&hellip;</div>
</div> </div>
</body> </body>
</html> </html>

View file

@ -6,8 +6,10 @@ var helper = require("../helper");
function closeModal(wdKey) { function closeModal(wdKey) {
const selector = wd.$(wdKey);
browser.waitUntil(function() { browser.waitUntil(function() {
const elem = $(wdKey); const elem = $(selector);
return elem.isDisplayedInViewport(); return elem.isDisplayedInViewport();
}); });
@ -15,8 +17,9 @@ function closeModal(wdKey) {
closeBtnSelector.click(); closeBtnSelector.click();
browser.waitUntil(function() { browser.waitUntil(function() {
const elem = $(wdKey); return browser.execute((selector) => {
return !elem.isDisplayed(); return !document.querySelector(selector);
}, selector);
}); });
} }