updated leaflet version and tree-shaked deps

This commit is contained in:
Fedor Katurov 2020-01-16 17:08:55 +07:00
parent 973f934614
commit d8d448bcf7
7 changed files with 22 additions and 10 deletions

8
package-lock.json generated
View file

@ -7943,9 +7943,9 @@
}
},
"leaflet": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.4.0.tgz",
"integrity": "sha512-x9j9tGY1+PDLN9pcWTx9/y6C5nezoTMB8BLK5jTakx+H7bPlnbCHfi9Hjg+Qt36sgDz/cb9lrSpNQXmk45Tvhw=="
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.6.0.tgz",
"integrity": "sha512-CPkhyqWUKZKFJ6K8umN5/D2wrJ2+/8UIpXppY7QDnUZW5bZL5+SEI2J7GBpwh4LIupOKqbNSQXgqmrEJopHVNQ=="
},
"leaflet-editable": {
"version": "1.2.0",
@ -7960,7 +7960,7 @@
"resolved": "https://registry.npmjs.org/leaflet-geometryutil/-/leaflet-geometryutil-0.9.1.tgz",
"integrity": "sha512-DKYLzFBsEcmZSl1fXLM+Pd+7t5IHmY6Ps7XeSnWL1ngr1qxQfcVzhkJT9gxfZrmFWiL96c23xQ0aLcHocV2tVA==",
"requires": {
"leaflet": "1.4.0"
"leaflet": "1.6.0"
}
},
"leaflet-routing-machine": {

View file

@ -69,7 +69,7 @@
"history": "^4.7.2",
"http-errors": "~1.6.2",
"js-md5": "^0.7.3",
"leaflet": "^1.4.0",
"leaflet": "^1.6.0",
"leaflet-editable": "^1.1.0",
"leaflet-editable-polyline": "muerwre/leaflet-editable-polyline#master",
"leaflet-geometryutil": "^0.9.0",

View file

@ -1,4 +1,4 @@
import createReducer from 'reduxsauce/lib/createReducer';
import { createReducer } from '~/utils/reducer';
import { IDialogs } from '~/constants/dialogs';
import { MODES } from '~/constants/modes';
import { EDITOR_HANDLERS } from './handlers';

View file

@ -1,4 +1,4 @@
import createReducer from 'reduxsauce/lib/createReducer';
import { createReducer } from '~/utils/reducer';
import { MAP_HANDLERS } from './handlers';
import { DEFAULT_PROVIDER } from '~/constants/providers';
import { IMapRoute } from './types';

View file

@ -1,4 +1,4 @@
import createReducer from 'reduxsauce/lib/createReducer';
import { createReducer } from '~/utils/reducer';
import { DEFAULT_USER, IUser } from '~/constants/auth';
import { USER_HANDLERS } from './handlers';

View file

@ -89,10 +89,9 @@ class KmMarksLayer extends LayerGroup {
html: `
<div
class="leaflet-km-dist ${allwaysPositiveAngleDeg(angle) !== angle ? 'reverse' : ''}"
style="transform: translate(-50%, -50%) rotate(${allwaysPositiveAngleDeg(angle)}deg);"
>
${distance}
<svg width="48" height="48" preserveAspectRatio="xMidYMid" transform="rotate(0deg)">
<svg width="48" height="48" preserveAspectRatio="xMidYMid">
<image xlink:href="${arrow_image}" x="0" y="0" width="48" height="48"/>
</svg>
</div>

13
src/utils/reducer.ts Normal file
View file

@ -0,0 +1,13 @@
// create-reducer.ts
import { Action } from 'redux';
type Handlers<State, Types extends string, Actions extends Action<Types>> = {
readonly [Type in Types]: (state: State, action: Actions) => State
}
export const createReducer = (
initialState,
handlers,
) => (state = initialState, action) => (handlers.hasOwnProperty(action.type)
? handlers[action.type](state, action)
: state);