@opengeoweb/store 9.10.2 → 9.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -1,14 +1,15 @@
1
- import { webmapUtils, LayerType, webmapTestSettings, WMLayer, getWMJSMapById, getMapImageStore, getAlternativeImage, handleMomentISOString, getCapabilities } from '@opengeoweb/webmap';
1
+ import { webmapUtils, LayerType, webmapTestSettings, WMLayer, getWMJSMapById, getAlternativeImage, handleMomentISOString, getCapabilities } from '@opengeoweb/webmap';
2
2
  import { createAction, createSlice, createSelector, createEntityAdapter, createListenerMiddleware } from '@reduxjs/toolkit';
3
3
  import { getGeoJson, moveFeature, createInterSections, getLastEmptyFeatureIndex, defaultLayers, addSelectionTypeToGeoJSON, getFeatureCollection, emptyGeoJSON, defaultIntersectionStyleProperties } from '@opengeoweb/webmap-react';
4
4
  export { defaultLayers } from '@opengeoweb/webmap-react';
5
- import { dateUtils, metronome, withEggs } from '@opengeoweb/shared';
5
+ import { dateUtils, defaultDelay, withEggs } from '@opengeoweb/shared';
6
+ import { defaultTimeStep, defaultTimeSpan, defaultAnimationDelayAtStart, defaultSecondsPerPx, roundWithTimeStep, getSpeedDelay } from '@opengeoweb/timeslider';
6
7
  import { produce } from 'immer';
7
8
  import { isEqual, compact } from 'lodash';
8
9
  import { createStore as createStore$1 } from '@redux-eggs/redux-toolkit';
9
10
  import { getSagaExtension } from '@redux-eggs/saga-extension';
10
- import { call, takeEvery, takeLatest, select, put, all, take, delay } from 'redux-saga/effects';
11
- import { eventChannel } from 'redux-saga';
11
+ import { takeEvery, takeLatest, select, put, call, all, delay } from 'redux-saga/effects';
12
+ import { metronome } from '@opengeoweb/metronome';
12
13
  import React, { useCallback, useEffect } from 'react';
13
14
  import { Provider, useDispatch, useSelector } from 'react-redux';
14
15
 
@@ -533,89 +534,6 @@ var types$5 = /*#__PURE__*/Object.freeze({
533
534
  get LayerActionOrigin () { return LayerActionOrigin; }
534
535
  });
535
536
 
536
- /* *
537
- * Licensed under the Apache License, Version 2.0 (the "License");
538
- * you may not use this file except in compliance with the License.
539
- * You may obtain a copy of the License at
540
- *
541
- * http://www.apache.org/licenses/LICENSE-2.0
542
- *
543
- * Unless required by applicable law or agreed to in writing, software
544
- * distributed under the License is distributed on an "AS IS" BASIS,
545
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
546
- * See the License for the specific language governing permissions and
547
- * limitations under the License.
548
- *
549
- * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
550
- * Copyright 2023 - Finnish Meteorological Institute (FMI)
551
- * */
552
- var Scale;
553
- (function (Scale) {
554
- Scale[Scale["Minutes5"] = 0] = "Minutes5";
555
- Scale[Scale["Hour"] = 1] = "Hour";
556
- Scale[Scale["Hours3"] = 2] = "Hours3";
557
- Scale[Scale["Hours6"] = 3] = "Hours6";
558
- Scale[Scale["Day"] = 4] = "Day";
559
- Scale[Scale["Week"] = 5] = "Week";
560
- Scale[Scale["Month"] = 6] = "Month";
561
- Scale[Scale["Year"] = 7] = "Year";
562
- })(Scale || (Scale = {}));
563
- var AnimationLength$1;
564
- (function (AnimationLength) {
565
- AnimationLength[AnimationLength["Minutes15"] = 15] = "Minutes15";
566
- AnimationLength[AnimationLength["Minutes30"] = 30] = "Minutes30";
567
- AnimationLength[AnimationLength["Hours1"] = 60] = "Hours1";
568
- AnimationLength[AnimationLength["Hours2"] = 120] = "Hours2";
569
- AnimationLength[AnimationLength["Hours3"] = 180] = "Hours3";
570
- AnimationLength[AnimationLength["Hours6"] = 360] = "Hours6";
571
- AnimationLength[AnimationLength["Hours12"] = 720] = "Hours12";
572
- AnimationLength[AnimationLength["Hours24"] = 1440] = "Hours24";
573
- })(AnimationLength$1 || (AnimationLength$1 = {}));
574
- var MapActionOrigin;
575
- (function (MapActionOrigin) {
576
- MapActionOrigin["map"] = "map";
577
- })(MapActionOrigin || (MapActionOrigin = {}));
578
-
579
- var enums = /*#__PURE__*/Object.freeze({
580
- __proto__: null,
581
- get Scale () { return Scale; },
582
- get AnimationLength () { return AnimationLength$1; },
583
- get MapActionOrigin () { return MapActionOrigin; }
584
- });
585
-
586
- /* *
587
- * Licensed under the Apache License, Version 2.0 (the "License");
588
- * you may not use this file except in compliance with the License.
589
- * You may obtain a copy of the License at
590
- *
591
- * http://www.apache.org/licenses/LICENSE-2.0
592
- *
593
- * Unless required by applicable law or agreed to in writing, software
594
- * distributed under the License is distributed on an "AS IS" BASIS,
595
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
596
- * See the License for the specific language governing permissions and
597
- * limitations under the License.
598
- *
599
- * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
600
- * Copyright 2023 - Finnish Meteorological Institute (FMI)
601
- * */
602
- var defaultAnimationDelayAtStart = 250;
603
- var defaultDelay = 1000; // [ms]
604
- var defaultTimeStep = 60;
605
- var defaultSecondsPerPx = 80;
606
- var defaultTimeSpan = 24 * 3600;
607
- var IS_LEGEND_OPEN_BY_DEFAULT = false;
608
-
609
- var constants$1 = /*#__PURE__*/Object.freeze({
610
- __proto__: null,
611
- defaultAnimationDelayAtStart: defaultAnimationDelayAtStart,
612
- defaultDelay: defaultDelay,
613
- defaultTimeStep: defaultTimeStep,
614
- defaultSecondsPerPx: defaultSecondsPerPx,
615
- defaultTimeSpan: defaultTimeSpan,
616
- IS_LEGEND_OPEN_BY_DEFAULT: IS_LEGEND_OPEN_BY_DEFAULT
617
- });
618
-
619
537
  var dateFormat = "yyyy-MM-dd'T'HH:mm:ss'Z";
620
538
  var createMap = function createMap(_ref) {
621
539
  var id = _ref.id,
@@ -870,45 +788,6 @@ var getSpeedFactor = function getSpeedFactor(speedDelay) {
870
788
  var getAnimationDuration = function getAnimationDuration(animationEndTime, animationStartTime) {
871
789
  return animationEndTime && animationStartTime ? dateUtils.differenceInMinutes(new Date(animationEndTime), new Date(animationStartTime)) : 0;
872
790
  };
873
- /**
874
- * Returns speed delay for given speedFactor. For options, see defined above in "speedFactors"
875
- */
876
- var getSpeedDelay = function getSpeedDelay(speedFactor) {
877
- return defaultDelay / speedFactor;
878
- };
879
- var roundWithTimeStep = function roundWithTimeStep(unixTime, timeStep, type) {
880
- var adjustedTimeStep = timeStep * 60;
881
- if (!type || type === 'round') {
882
- return Math.round(unixTime / adjustedTimeStep) * adjustedTimeStep;
883
- }
884
- if (type === 'floor') {
885
- return Math.floor(unixTime / adjustedTimeStep) * adjustedTimeStep;
886
- }
887
- if (type === 'ceil') {
888
- return Math.ceil(unixTime / adjustedTimeStep) * adjustedTimeStep;
889
- }
890
- return undefined;
891
- };
892
- /**
893
- * In this Map collection all fundamental scales
894
- * (Scale.Minutes5 ... Scale.Year) are mapped with their corresponding
895
- * secondsPerPx numbers.
896
- * @returns a Map including information explained above
897
- */
898
- var secondsPerPxToScale = new Map([[2.5, Scale.Minutes5], [30, Scale.Hour], [3 * 30, Scale.Hours3], [6 * 30, Scale.Hours6], [24 * 30, Scale.Day], [7 * 24 * 30, Scale.Week], [30 * 24 * 30, Scale.Month], [365 * 24 * 30, Scale.Year]]);
899
- /**
900
- * Creates a reverse mapping of scales to their corresponding secondsPerPx
901
- * values to make it easier in some parts GeoWeb to fetch a secondsPerpx for
902
- * a certain fundamental scale (Scale.Minutes5 ... Scale.year)
903
- * @returns an Object, where names are fundamental scale values (0 - 7) and
904
- * values are their corresponding secondsPerPx numbers.
905
- */
906
- var scaleToSecondsPerPx = Object.fromEntries(Array.from(secondsPerPxToScale.entries()).map(function (_ref2) {
907
- var _ref3 = _slicedToArray(_ref2, 2),
908
- k = _ref3[0],
909
- v = _ref3[1];
910
- return [v, k];
911
- }));
912
791
 
913
792
  var utils$3 = /*#__PURE__*/Object.freeze({
914
793
  __proto__: null,
@@ -922,11 +801,7 @@ var utils$3 = /*#__PURE__*/Object.freeze({
922
801
  moveArrayElements: moveArrayElements,
923
802
  getTimeStepFromDataInterval: getTimeStepFromDataInterval,
924
803
  getSpeedFactor: getSpeedFactor,
925
- getAnimationDuration: getAnimationDuration,
926
- getSpeedDelay: getSpeedDelay,
927
- roundWithTimeStep: roundWithTimeStep,
928
- secondsPerPxToScale: secondsPerPxToScale,
929
- scaleToSecondsPerPx: scaleToSecondsPerPx
804
+ getAnimationDuration: getAnimationDuration
930
805
  });
931
806
 
932
807
  /* *
@@ -1231,7 +1106,7 @@ var createLayer = function createLayer(_a) {
1231
1106
  useLatestReferenceTime: useLatestReferenceTime
1232
1107
  });
1233
1108
  };
1234
- var initialState$7 = {
1109
+ var initialState$6 = {
1235
1110
  byId: {},
1236
1111
  allIds: [],
1237
1112
  availableBaseLayers: {
@@ -1240,7 +1115,7 @@ var initialState$7 = {
1240
1115
  }
1241
1116
  };
1242
1117
  var slice$7 = createSlice({
1243
- initialState: initialState$7,
1118
+ initialState: initialState$6,
1244
1119
  name: 'layerReducer',
1245
1120
  reducers: {
1246
1121
  addLayer: function addLayer(draft, action) {
@@ -1724,7 +1599,7 @@ var slice$7 = createSlice({
1724
1599
  type: source && source.type
1725
1600
  };
1726
1601
  /* Handle the Layer action with the same logic, using the same reducer */
1727
- return reducer$7(prevState, action);
1602
+ return reducer$6(prevState, action);
1728
1603
  }, draft);
1729
1604
  }).addCase(setMapPreset, function (draft, action) {
1730
1605
  var mapId = action.payload.mapId;
@@ -1744,7 +1619,7 @@ var slice$7 = createSlice({
1744
1619
  });
1745
1620
  }
1746
1621
  });
1747
- var reducer$7 = slice$7.reducer;
1622
+ var reducer$6 = slice$7.reducer;
1748
1623
  var layerActions = slice$7.actions;
1749
1624
 
1750
1625
  /* *
@@ -2164,7 +2039,7 @@ var getTimeStepForLayerId = createSelector(getLayerTimeDimension, function (time
2164
2039
  return timeDimension && timeDimension.timeInterval ? getTimeStepFromDataInterval(timeDimension.timeInterval) : undefined;
2165
2040
  }, selectorMemoizationOptions);
2166
2041
 
2167
- var selectors$6 = /*#__PURE__*/Object.freeze({
2042
+ var selectors$7 = /*#__PURE__*/Object.freeze({
2168
2043
  __proto__: null,
2169
2044
  getLayerById: getLayerById,
2170
2045
  getLayerByIdWithoutTimeDimension: getLayerByIdWithoutTimeDimension,
@@ -2356,13 +2231,13 @@ var createUIDialogElement = function createUIDialogElement(_ref) {
2356
2231
  focused: false
2357
2232
  };
2358
2233
  };
2359
- var initialState$6 = {
2234
+ var initialState$5 = {
2360
2235
  order: [],
2361
2236
  dialogs: {},
2362
2237
  activeWindowId: undefined
2363
2238
  };
2364
2239
  var slice$6 = createSlice({
2365
- initialState: initialState$6,
2240
+ initialState: initialState$5,
2366
2241
  name: 'uiReducer',
2367
2242
  reducers: {
2368
2243
  registerDialog: function registerDialog(draft, action) {
@@ -2454,7 +2329,7 @@ var slice$6 = createSlice({
2454
2329
  }
2455
2330
  }
2456
2331
  });
2457
- var reducer$6 = slice$6.reducer;
2332
+ var reducer$5 = slice$6.reducer;
2458
2333
  var uiActions = slice$6.actions;
2459
2334
 
2460
2335
  /**
@@ -2502,12 +2377,12 @@ var createLayersWithIds = function createLayersWithIds(state, layers) {
2502
2377
  }
2503
2378
  });
2504
2379
  };
2505
- var initialState$5 = {
2380
+ var initialState$4 = {
2506
2381
  byId: {},
2507
2382
  allIds: []
2508
2383
  };
2509
2384
  var slice$5 = createSlice({
2510
- initialState: initialState$5,
2385
+ initialState: initialState$4,
2511
2386
  name: 'mapReducer',
2512
2387
  reducers: {
2513
2388
  registerMap: function registerMap(draft, action) {
@@ -3070,7 +2945,7 @@ var slice$5 = createSlice({
3070
2945
  type: source && source.type
3071
2946
  };
3072
2947
  /* Handle the Layer action with the same logic, using the same reducer */
3073
- return reducer$5(prevState, action);
2948
+ return reducer$4(prevState, action);
3074
2949
  }, draft);
3075
2950
  }).addCase(layerActions.onUpdateLayerInformation, function (draft, action) {
3076
2951
  var mapDimensions = action.payload.mapDimensions;
@@ -3120,7 +2995,7 @@ var mapActions = Object.assign(Object.assign({}, slice$5.actions), {
3120
2995
  setMapPreset: setMapPreset,
3121
2996
  mapChangeDimension: mapChangeDimension
3122
2997
  });
3123
- var reducer$5 = slice$5.reducer;
2998
+ var reducer$4 = slice$5.reducer;
3124
2999
 
3125
3000
  /* *
3126
3001
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -3247,7 +3122,7 @@ var getDialogError = createSelector(getDialogDetailsByType, function (details) {
3247
3122
  return details && details.error || '';
3248
3123
  }, selectorMemoizationOptions);
3249
3124
 
3250
- var selectors$5 = /*#__PURE__*/Object.freeze({
3125
+ var selectors$6 = /*#__PURE__*/Object.freeze({
3251
3126
  __proto__: null,
3252
3127
  getUiStore: getUiStore,
3253
3128
  getDialogDetailsByType: getDialogDetailsByType,
@@ -3386,7 +3261,7 @@ var removeInPlace = function removeInPlace(inDraftArray, condition) {
3386
3261
  * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3387
3262
  * Copyright 2020 - Finnish Meteorological Institute (FMI)
3388
3263
  * */
3389
- var initialState$4 = {
3264
+ var initialState$3 = {
3390
3265
  sources: {
3391
3266
  byId: {},
3392
3267
  allIds: []
@@ -3411,7 +3286,7 @@ var initialState$4 = {
3411
3286
  }
3412
3287
  };
3413
3288
  var slice$4 = createSlice({
3414
- initialState: initialState$4,
3289
+ initialState: initialState$3,
3415
3290
  name: 'synchronizationGroupsReducer',
3416
3291
  reducers: {
3417
3292
  syncGroupAddSource: function syncGroupAddSource(draft, action) {
@@ -3537,7 +3412,7 @@ var slice$4 = createSlice({
3537
3412
  });
3538
3413
  },
3539
3414
  syncGroupClear: function syncGroupClear() {
3540
- return initialState$4;
3415
+ return initialState$3;
3541
3416
  },
3542
3417
  syncGroupSetViewState: function syncGroupSetViewState(draft, action) {
3543
3418
  var viewState = action.payload.viewState;
@@ -3607,7 +3482,7 @@ var _slice$actions = slice$4.actions,
3607
3482
  syncGroupRemoveTarget = _slice$actions.syncGroupRemoveTarget,
3608
3483
  syncGroupSetViewState = _slice$actions.syncGroupSetViewState;
3609
3484
  var actions = slice$4.actions,
3610
- reducer$4 = slice$4.reducer;
3485
+ reducer$3 = slice$4.reducer;
3611
3486
 
3612
3487
  /* *
3613
3488
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -3767,7 +3642,7 @@ var getAllTargetGroupsForSource = createSelector([syncGroupStore, getSourceId],
3767
3642
  return [];
3768
3643
  }, selectorMemoizationOptions);
3769
3644
  var syncGroupGetViewState = createSelector(syncGroupStore, function (store) {
3770
- return store.viewState;
3645
+ return store && store.viewState;
3771
3646
  }, selectorMemoizationOptions);
3772
3647
  var getSyncedMapIdsForTimeslider = createSelector(syncGroupStore, function (store) {
3773
3648
  var _a, _b;
@@ -3789,7 +3664,7 @@ var getSyncGroupTargets = createSelector(syncGroupStore, function (store) {
3789
3664
  }, []);
3790
3665
  }, selectorMemoizationOptions);
3791
3666
 
3792
- var selectors$4 = /*#__PURE__*/Object.freeze({
3667
+ var selectors$5 = /*#__PURE__*/Object.freeze({
3793
3668
  __proto__: null,
3794
3669
  syncGroupStore: syncGroupStore,
3795
3670
  getSynchronizationGroupState: getSynchronizationGroupState,
@@ -3923,7 +3798,7 @@ var synchronizationGroupStore = function synchronizationGroupStore(store) {
3923
3798
  };
3924
3799
  var getSynchronizationGroupStore = createSelector(synchronizationGroupStore, function (store) {
3925
3800
  return store;
3926
- });
3801
+ }, selectorMemoizationOptions);
3927
3802
  /**
3928
3803
  * Returns the synchronization source by id
3929
3804
  * @param store The app store
@@ -3940,9 +3815,9 @@ var getSyncSourceBySourceId = function getSyncSourceBySourceId(state, id) {
3940
3815
  };
3941
3816
  var getTime = createSelector(getSyncSourceBySourceId, function (store) {
3942
3817
  return store && store.payloadByType && store.payloadByType[SYNCGROUPS_TYPE_SETTIME] ? store.payloadByType[SYNCGROUPS_TYPE_SETTIME].value : null;
3943
- });
3818
+ }, selectorMemoizationOptions);
3944
3819
 
3945
- var selectors$3 = /*#__PURE__*/Object.freeze({
3820
+ var selectors$4 = /*#__PURE__*/Object.freeze({
3946
3821
  __proto__: null,
3947
3822
  getSynchronizationGroupStore: getSynchronizationGroupStore,
3948
3823
  getTime: getTime
@@ -3969,6 +3844,97 @@ var types$1 = /*#__PURE__*/Object.freeze({
3969
3844
  __proto__: null
3970
3845
  });
3971
3846
 
3847
+ /* *
3848
+ * Licensed under the Apache License, Version 2.0 (the "License");
3849
+ * you may not use this file except in compliance with the License.
3850
+ * You may obtain a copy of the License at
3851
+ *
3852
+ * http://www.apache.org/licenses/LICENSE-2.0
3853
+ *
3854
+ * Unless required by applicable law or agreed to in writing, software
3855
+ * distributed under the License is distributed on an "AS IS" BASIS,
3856
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3857
+ * See the License for the specific language governing permissions and
3858
+ * limitations under the License.
3859
+ *
3860
+ * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3861
+ * Copyright 2024 - Finnish Meteorological Institute (FMI)
3862
+ * */
3863
+ var loadingIndicatorAdapter = createEntityAdapter();
3864
+ var initLoadingIndicatorStateForId = function initLoadingIndicatorStateForId(draft, id) {
3865
+ if (!draft.entities[id]) {
3866
+ loadingIndicatorAdapter.addOne(draft, {
3867
+ id: id,
3868
+ isGetMapLoading: false,
3869
+ isGetCapabilitiesLoading: false
3870
+ });
3871
+ }
3872
+ };
3873
+ var slice$3 = createSlice({
3874
+ initialState: loadingIndicatorAdapter.getInitialState(),
3875
+ name: 'loadingIndicatorReducer',
3876
+ reducers: {
3877
+ setGetMapIsLoading: function setGetMapIsLoading(draft, action) {
3878
+ var _action$payload = action.payload,
3879
+ id = _action$payload.id,
3880
+ isGetMapLoading = _action$payload.isGetMapLoading;
3881
+ initLoadingIndicatorStateForId(draft, id);
3882
+ draft.entities[id].isGetMapLoading = isGetMapLoading;
3883
+ },
3884
+ setGetCapabilitiesIsLoading: function setGetCapabilitiesIsLoading(draft, action) {
3885
+ var _action$payload2 = action.payload,
3886
+ id = _action$payload2.id,
3887
+ isGetCapabilitiesLoading = _action$payload2.isGetCapabilitiesLoading;
3888
+ initLoadingIndicatorStateForId(draft, id);
3889
+ draft.entities[id].isGetCapabilitiesLoading = isGetCapabilitiesLoading;
3890
+ }
3891
+ }
3892
+ });
3893
+ var loadingIndicatorActions = slice$3.actions,
3894
+ loadingIndicatorReducer = slice$3.reducer;
3895
+
3896
+ /* *
3897
+ * Licensed under the Apache License, Version 2.0 (the "License");
3898
+ * you may not use this file except in compliance with the License.
3899
+ * You may obtain a copy of the License at
3900
+ *
3901
+ * http://www.apache.org/licenses/LICENSE-2.0
3902
+ *
3903
+ * Unless required by applicable law or agreed to in writing, software
3904
+ * distributed under the License is distributed on an "AS IS" BASIS,
3905
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3906
+ * See the License for the specific language governing permissions and
3907
+ * limitations under the License.
3908
+ *
3909
+ * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3910
+ * Copyright 2024 - Finnish Meteorological Institute (FMI)
3911
+ * */
3912
+ var _loadingIndicatorAdap = loadingIndicatorAdapter.getSelectors(function (state) {
3913
+ var _a;
3914
+ return (_a = state === null || state === void 0 ? void 0 : state.loadingIndicatorStore) !== null && _a !== void 0 ? _a : {
3915
+ entities: {},
3916
+ ids: []
3917
+ };
3918
+ }),
3919
+ selectLoadingIndicatorById = _loadingIndicatorAdap.selectById;
3920
+ var isGetMapLoading = createSelector(selectLoadingIndicatorById, function (loadingIndicator) {
3921
+ return (loadingIndicator === null || loadingIndicator === void 0 ? void 0 : loadingIndicator.isGetMapLoading) || false;
3922
+ }, selectorMemoizationOptions);
3923
+ var isGetCapabilitiesLoading = createSelector(selectLoadingIndicatorById, function (loadingIndicator) {
3924
+ return (loadingIndicator === null || loadingIndicator === void 0 ? void 0 : loadingIndicator.isGetCapabilitiesLoading) || false;
3925
+ }, selectorMemoizationOptions);
3926
+ var isLoading = createSelector([isGetMapLoading, isGetCapabilitiesLoading], function (isGetMapLoading, isGetCapabilitiesLoading) {
3927
+ return isGetMapLoading || isGetCapabilitiesLoading;
3928
+ }, selectorMemoizationOptions);
3929
+
3930
+ var selectors$3 = /*#__PURE__*/Object.freeze({
3931
+ __proto__: null,
3932
+ selectLoadingIndicatorById: selectLoadingIndicatorById,
3933
+ isGetMapLoading: isGetMapLoading,
3934
+ isGetCapabilitiesLoading: isGetCapabilitiesLoading,
3935
+ isLoading: isLoading
3936
+ });
3937
+
3972
3938
  /* *
3973
3939
  * Licensed under the Apache License, Version 2.0 (the "License");
3974
3940
  * you may not use this file except in compliance with the License.
@@ -4816,6 +4782,50 @@ var selectors$2 = /*#__PURE__*/Object.freeze({
4816
4782
  getAnimationList: getAnimationList
4817
4783
  });
4818
4784
 
4785
+ /* *
4786
+ * Licensed under the Apache License, Version 2.0 (the "License");
4787
+ * you may not use this file except in compliance with the License.
4788
+ * You may obtain a copy of the License at
4789
+ *
4790
+ * http://www.apache.org/licenses/LICENSE-2.0
4791
+ *
4792
+ * Unless required by applicable law or agreed to in writing, software
4793
+ * distributed under the License is distributed on an "AS IS" BASIS,
4794
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4795
+ * See the License for the specific language governing permissions and
4796
+ * limitations under the License.
4797
+ *
4798
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4799
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
4800
+ * */
4801
+ var MapActionOrigin;
4802
+ (function (MapActionOrigin) {
4803
+ MapActionOrigin["map"] = "map";
4804
+ })(MapActionOrigin || (MapActionOrigin = {}));
4805
+
4806
+ var enums = /*#__PURE__*/Object.freeze({
4807
+ __proto__: null,
4808
+ get MapActionOrigin () { return MapActionOrigin; }
4809
+ });
4810
+
4811
+ /* *
4812
+ * Licensed under the Apache License, Version 2.0 (the "License");
4813
+ * you may not use this file except in compliance with the License.
4814
+ * You may obtain a copy of the License at
4815
+ *
4816
+ * http://www.apache.org/licenses/LICENSE-2.0
4817
+ *
4818
+ * Unless required by applicable law or agreed to in writing, software
4819
+ * distributed under the License is distributed on an "AS IS" BASIS,
4820
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4821
+ * See the License for the specific language governing permissions and
4822
+ * limitations under the License.
4823
+ *
4824
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4825
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
4826
+ * */
4827
+ var IS_LEGEND_OPEN_BY_DEFAULT = false;
4828
+
4819
4829
  /* *
4820
4830
  * Licensed under the Apache License, Version 2.0 (the "License");
4821
4831
  * you may not use this file except in compliance with the License.
@@ -4928,12 +4938,12 @@ var mapUtils = Object.assign(Object.assign({}, utils$3), {
4928
4938
  * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4929
4939
  * Copyright 2020 - Finnish Meteorological Institute (FMI)
4930
4940
  * */
4931
- var initialState$3 = {
4941
+ var initialState$2 = {
4932
4942
  byId: {},
4933
4943
  allIds: []
4934
4944
  };
4935
- var slice$3 = createSlice({
4936
- initialState: initialState$3,
4945
+ var slice$2 = createSlice({
4946
+ initialState: initialState$2,
4937
4947
  name: 'serviceReducer',
4938
4948
  reducers: {
4939
4949
  serviceSetLayers: function serviceSetLayers(draft, action) {
@@ -4962,8 +4972,8 @@ var slice$3 = createSlice({
4962
4972
  action) {}
4963
4973
  }
4964
4974
  });
4965
- var reducer$3 = slice$3.reducer;
4966
- var serviceActions = slice$3.actions;
4975
+ var reducer$2 = slice$2.reducer;
4976
+ var serviceActions = slice$2.actions;
4967
4977
 
4968
4978
  /* *
4969
4979
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -5311,7 +5321,7 @@ var MAX_NUMBER_OF_PARALLEL_LOADING_IMAGES = 8;
5311
5321
  * @param targets List of targets to check
5312
5322
  * @returns True if all maps are ready to go forward, false if the map has no data to display yet.
5313
5323
  */
5314
- var prefetchAnimationTargetsForSaga = function prefetchAnimationTargetsForSaga(timerId, animationListValues, targets) {
5324
+ var prefetchAnimationTargetsForMetronome = function prefetchAnimationTargetsForMetronome(timerId, animationListValues, targets) {
5315
5325
  var timerShouldStepForward = true;
5316
5326
  // The following code prefetches/buffers for all maps in the group
5317
5327
  for (var numPrefetch = 0; numPrefetch < MAX_NUMBER_STEPS_FORWARD_TO_PREFETCH; numPrefetch += 1) {
@@ -5334,13 +5344,13 @@ var prefetchAnimationTargetsForSaga = function prefetchAnimationTargetsForSaga(t
5334
5344
  try {
5335
5345
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
5336
5346
  var layersImageUrl = _step2.value;
5337
- var image = getMapImageStore.getImage(layersImageUrl.url);
5347
+ var image = wmMap.getMapImageStore.getImage(layersImageUrl.url);
5338
5348
  if (!image.isLoaded()) {
5339
- if (getMapImageStore.getNumImagesLoading() < MAX_NUMBER_OF_PARALLEL_LOADING_IMAGES) {
5349
+ if (wmMap.getMapImageStore.getNumImagesLoading() < MAX_NUMBER_OF_PARALLEL_LOADING_IMAGES) {
5340
5350
  image.load();
5341
5351
  }
5342
5352
  if (numPrefetch === 0) {
5343
- var altImage = getAlternativeImage(layersImageUrl.url, getMapImageStore, wmMap.getBBOX());
5353
+ var altImage = getAlternativeImage(layersImageUrl.url, wmMap.getMapImageStore, wmMap.getBBOX());
5344
5354
  // No alternative image available yet, so skipping animation.
5345
5355
  if (!altImage) {
5346
5356
  // This is useful to indicate that the map is loading and has nothing yet to display.
@@ -5370,9 +5380,7 @@ var prefetchAnimationTargetsForSaga = function prefetchAnimationTargetsForSaga(t
5370
5380
 
5371
5381
  var _marked$5 = /*#__PURE__*/_regeneratorRuntime().mark(updateAnimation),
5372
5382
  _marked2$3 = /*#__PURE__*/_regeneratorRuntime().mark(handleBaseLayersSaga),
5373
- _marked3$1 = /*#__PURE__*/_regeneratorRuntime().mark(metronomeSaga),
5374
- _marked4 = /*#__PURE__*/_regeneratorRuntime().mark(metronomeSagaWithChannel),
5375
- _marked5 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$4);
5383
+ _marked3$1 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$4);
5376
5384
  // Expects start, end time as Date object and interval in minutes
5377
5385
  var getAnimationEndTime = function getAnimationEndTime(animationEndTime) {
5378
5386
  var ISOtime = dateUtils.parseISO(animationEndTime);
@@ -6140,13 +6148,13 @@ function setStepBackwardOrForwardSaga(_ref8) {
6140
6148
  }
6141
6149
  makeForwardStep = function makeForwardStep() {
6142
6150
  var nextTime = currentTime + timeStep;
6143
- var roundedTime = mapUtils.roundWithTimeStep(nextTime, timeStep, 'ceil');
6151
+ var roundedTime = roundWithTimeStep(nextTime, timeStep, 'ceil');
6144
6152
  var newTime = Math.min(roundedTime, dataEndTime || roundedTime);
6145
6153
  return dateUtils.fromUnix(newTime).toISOString();
6146
6154
  };
6147
6155
  makeBackwardStep = function makeBackwardStep() {
6148
6156
  var nextTime = currentTime - timeStep;
6149
- var roundedTime = mapUtils.roundWithTimeStep(nextTime, timeStep, 'floor');
6157
+ var roundedTime = roundWithTimeStep(nextTime, timeStep, 'floor');
6150
6158
  var newTime = Math.max(roundedTime, dataStartTime || roundedTime);
6151
6159
  return dateUtils.fromUnix(newTime).toISOString();
6152
6160
  };
@@ -6176,180 +6184,38 @@ function setStepBackwardOrForwardSaga(_ref8) {
6176
6184
  }, _callee8);
6177
6185
  })();
6178
6186
  }
6179
- /**
6180
- * This saga is triggered by the metronome. An array of timerIds is given as argument.
6181
- * It will update the animation loop of multiple maps and sliders
6182
- * It will prefetch images for maps
6183
- * @param timerIds string[] array of timerIds
6184
- */
6185
- function metronomeSaga(timerIds) {
6186
- var targetsWithUpdateValue, _iterator, _step, _loop;
6187
- return _regeneratorRuntime().wrap(function metronomeSaga$(_context12) {
6188
- while (1) switch (_context12.prev = _context12.next) {
6189
- case 0:
6190
- targetsWithUpdateValue = [];
6191
- _iterator = _createForOfIteratorHelper(timerIds);
6192
- _context12.prev = 2;
6193
- _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
6194
- var timerId, animationListValuesNameAndValue, animationListValues, targets, timerShouldStepForward, timerStep, updatedValue, speedDelay, speed;
6195
- return _regeneratorRuntime().wrap(function _loop$(_context11) {
6196
- while (1) switch (_context11.prev = _context11.next) {
6197
- case 0:
6198
- timerId = _step.value;
6199
- _context11.next = 3;
6200
- return select(getAnimationList, timerId);
6201
- case 3:
6202
- animationListValuesNameAndValue = _context11.sent;
6203
- animationListValues = animationListValuesNameAndValue.map(function (nameAndValue) {
6204
- return nameAndValue.value;
6205
- });
6206
- _context11.next = 7;
6207
- return select(getTargets, {
6208
- sourceId: timerId,
6209
- origin: timerId
6210
- }, SYNCGROUPS_TYPE_SETTIME);
6211
- case 7:
6212
- targets = _context11.sent;
6213
- if (targets.length === 0) {
6214
- // When there are no targets, default to one
6215
- targets.push({
6216
- targetId: timerId,
6217
- value: ''
6218
- });
6219
- }
6220
- timerShouldStepForward = prefetchAnimationTargetsForSaga(timerId, animationListValues, targets); // Determine the next step
6221
- timerStep = timerShouldStepForward ? getNextStep(timerId, animationListValues.length) : getCurrentStep(timerId);
6222
- setStep(timerId, timerStep);
6223
- updatedValue = animationListValues[timerStep];
6224
- targetsWithUpdateValue.push.apply(targetsWithUpdateValue, _toConsumableArray(targets.map(function (target) {
6225
- return Object.assign(Object.assign({}, target), {
6226
- value: updatedValue
6227
- });
6228
- })));
6229
- _context11.next = 16;
6230
- return select(getMapAnimationDelay, timerId);
6231
- case 16:
6232
- speedDelay = _context11.sent;
6233
- speed = 1000 / (speedDelay || 1);
6234
- metronome.setSpeed(timerId, speed);
6235
- case 19:
6236
- case "end":
6237
- return _context11.stop();
6238
- }
6239
- }, _loop);
6240
- });
6241
- _iterator.s();
6242
- case 5:
6243
- if ((_step = _iterator.n()).done) {
6244
- _context12.next = 9;
6245
- break;
6246
- }
6247
- return _context12.delegateYield(_loop(), "t0", 7);
6248
- case 7:
6249
- _context12.next = 5;
6250
- break;
6251
- case 9:
6252
- _context12.next = 14;
6253
- break;
6254
- case 11:
6255
- _context12.prev = 11;
6256
- _context12.t1 = _context12["catch"](2);
6257
- _iterator.e(_context12.t1);
6258
- case 14:
6259
- _context12.prev = 14;
6260
- _iterator.f();
6261
- return _context12.finish(14);
6262
- case 17:
6263
- if (!(targetsWithUpdateValue.length > 0)) {
6264
- _context12.next = 20;
6265
- break;
6266
- }
6267
- _context12.next = 20;
6268
- return put(setTimeSync(null, targetsWithUpdateValue, ['metronomesaga']));
6269
- case 20:
6270
- case "end":
6271
- return _context12.stop();
6272
- }
6273
- }, _marked3$1, null, [[2, 11, 14, 17]]);
6274
- }
6275
- /**
6276
- * Creates a channel for the metronome
6277
- * @returns
6278
- */
6279
- function metronomeTicker() {
6280
- return eventChannel(function (emitter) {
6281
- metronome.handleTimerTicks = function (timerIds) {
6282
- emitter(timerIds);
6283
- };
6284
- // The subscriber must return an unsubscribe function
6285
- return function () {
6286
- metronome.unregisterAllTimers();
6287
- };
6288
- });
6289
- }
6290
- /**
6291
- * Makes a saga channel for the metronome ticker
6292
- */
6293
- function metronomeSagaWithChannel() {
6294
- var channel, metronomeHandler;
6295
- return _regeneratorRuntime().wrap(function metronomeSagaWithChannel$(_context13) {
6296
- while (1) switch (_context13.prev = _context13.next) {
6297
- case 0:
6298
- _context13.next = 2;
6299
- return call(metronomeTicker);
6300
- case 2:
6301
- channel = _context13.sent;
6302
- case 3:
6303
- _context13.next = 6;
6304
- return take(channel);
6305
- case 6:
6306
- metronomeHandler = _context13.sent;
6307
- _context13.next = 9;
6308
- return call(metronomeSaga, metronomeHandler);
6309
- case 9:
6310
- _context13.next = 3;
6311
- break;
6312
- case 11:
6313
- case "end":
6314
- return _context13.stop();
6315
- }
6316
- }, _marked4);
6317
- }
6318
6187
  function rootSaga$4() {
6319
- return _regeneratorRuntime().wrap(function rootSaga$(_context14) {
6320
- while (1) switch (_context14.prev = _context14.next) {
6188
+ return _regeneratorRuntime().wrap(function rootSaga$(_context11) {
6189
+ while (1) switch (_context11.prev = _context11.next) {
6321
6190
  case 0:
6322
- _context14.next = 2;
6191
+ _context11.next = 2;
6323
6192
  return takeLatest(mapActions.mapStopAnimation.type, stopAnimationSaga);
6324
6193
  case 2:
6325
- _context14.next = 4;
6194
+ _context11.next = 4;
6326
6195
  return takeLatest(mapActions.mapStartAnimation.type, startAnimationSaga);
6327
6196
  case 4:
6328
- _context14.next = 6;
6197
+ _context11.next = 6;
6329
6198
  return takeLatest(layerActions.layerDelete.type, deleteLayerSaga);
6330
6199
  case 6:
6331
- _context14.next = 8;
6200
+ _context11.next = 8;
6332
6201
  return takeLatest(layerActions.onUpdateLayerInformation.type, updateAnimationWithLatestUpdate);
6333
6202
  case 8:
6334
- _context14.next = 10;
6203
+ _context11.next = 10;
6335
6204
  return takeLatest(mapActions.toggleAutoUpdate.type, toggleAutoUpdateSaga);
6336
6205
  case 10:
6337
- _context14.next = 12;
6206
+ _context11.next = 12;
6338
6207
  return takeEvery(mapActions.setMapPreset.type, setMapPresetSaga);
6339
6208
  case 12:
6340
- _context14.next = 14;
6209
+ _context11.next = 14;
6341
6210
  return takeEvery(mapActions.unregisterMap.type, unregisterMapSaga);
6342
6211
  case 14:
6343
- _context14.next = 16;
6212
+ _context11.next = 16;
6344
6213
  return takeEvery(mapActions.setStepBackwardOrForward.type, setStepBackwardOrForwardSaga);
6345
6214
  case 16:
6346
- _context14.next = 18;
6347
- return call(metronomeSagaWithChannel);
6348
- case 18:
6349
6215
  case "end":
6350
- return _context14.stop();
6216
+ return _context11.stop();
6351
6217
  }
6352
- }, _marked5);
6218
+ }, _marked3$1);
6353
6219
  }
6354
6220
 
6355
6221
  var _marked$4 = /*#__PURE__*/_regeneratorRuntime().mark(fetchServiceSaga),
@@ -6412,19 +6278,97 @@ function rootSaga$3() {
6412
6278
  }, _marked2$2);
6413
6279
  }
6414
6280
 
6281
+ /**
6282
+ * This handler is triggered by the metronome. An array of timerIds is given as argument.
6283
+ * It will update the animation loop of multiple maps and sliders
6284
+ * It will prefetch images for maps
6285
+ * @param timerIds string[] array of timerIds
6286
+ * @param listenerApi ListenerEffectAPI<CoreAppStore, Dispatch, unknown> listenerApi as received from listener
6287
+ */
6288
+ var metronomeHandler = function metronomeHandler(timerIds, listenerApi) {
6289
+ var targetsWithUpdateValue = [];
6290
+ var _iterator = _createForOfIteratorHelper(timerIds),
6291
+ _step;
6292
+ try {
6293
+ var _loop = function _loop() {
6294
+ var timerId = _step.value;
6295
+ var animationListValuesNameAndValue = getAnimationList(listenerApi.getState(), timerId);
6296
+ var animationListValues = animationListValuesNameAndValue.map(function (nameAndValue) {
6297
+ return nameAndValue.value;
6298
+ });
6299
+ var targets = getTargets(listenerApi.getState(), {
6300
+ sourceId: timerId,
6301
+ origin: timerId
6302
+ }, SYNCGROUPS_TYPE_SETTIME);
6303
+ if (targets.length === 0) {
6304
+ // When there are no targets, default to one
6305
+ targets.push({
6306
+ targetId: timerId,
6307
+ value: ''
6308
+ });
6309
+ }
6310
+ var timerShouldStepForward = prefetchAnimationTargetsForMetronome(timerId, animationListValues, targets);
6311
+ // Determine the next step
6312
+ var timerStep = timerShouldStepForward ? getNextStep(timerId, animationListValues.length) : getCurrentStep(timerId);
6313
+ setStep(timerId, timerStep);
6314
+ var updatedValue = animationListValues[timerStep];
6315
+ targetsWithUpdateValue.push.apply(targetsWithUpdateValue, _toConsumableArray(targets.map(function (target) {
6316
+ return Object.assign(Object.assign({}, target), {
6317
+ value: updatedValue
6318
+ });
6319
+ })));
6320
+ var speedDelay = getMapAnimationDelay(listenerApi.getState(), timerId);
6321
+ var speed = 1000 / (speedDelay || 1);
6322
+ metronome.setSpeed(timerId, speed);
6323
+ };
6324
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
6325
+ _loop();
6326
+ }
6327
+ // Update all targets of all sync groups in one action.
6328
+ } catch (err) {
6329
+ _iterator.e(err);
6330
+ } finally {
6331
+ _iterator.f();
6332
+ }
6333
+ if (targetsWithUpdateValue.length > 0) {
6334
+ listenerApi.dispatch(setTimeSync(null, targetsWithUpdateValue, ['metronomesaga']));
6335
+ }
6336
+ };
6337
+ var metronomeListener = createListenerMiddleware();
6338
+ metronomeListener.startListening({
6339
+ actionCreator: mapActions.mapStartAnimation,
6340
+ effect: function effect(_, listenerApi) {
6341
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
6342
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
6343
+ while (1) switch (_context.prev = _context.next) {
6344
+ case 0:
6345
+ // register handler with access to listenerApi
6346
+ metronome.handleTimerTicks = function (timerIds) {
6347
+ metronomeHandler(timerIds, listenerApi);
6348
+ };
6349
+ case 1:
6350
+ case "end":
6351
+ return _context.stop();
6352
+ }
6353
+ }, _callee);
6354
+ }));
6355
+ }
6356
+ });
6357
+
6415
6358
  // TODO: This fixes typecheck errors but maybe there is a better way to do that
6416
6359
  createStore$1({
6417
6360
  extensions: [getSagaExtension()]
6418
6361
  });
6419
6362
  var mapStoreReducers = {
6420
- webmap: reducer$5,
6421
- services: reducer$3,
6422
- layers: reducer$7
6363
+ webmap: reducer$4,
6364
+ services: reducer$2,
6365
+ layers: reducer$6
6423
6366
  };
6424
6367
  var mapStoreModuleConfig = {
6425
6368
  id: 'webmap-module',
6426
6369
  reducersMap: mapStoreReducers,
6427
- sagas: [rootSaga$4, rootSaga$3]
6370
+ sagas: [rootSaga$4, rootSaga$3],
6371
+ middlewares: [metronomeListener.middleware]
6428
6372
  };
6429
6373
 
6430
6374
  /* *
@@ -6985,9 +6929,9 @@ function rootSaga$2() {
6985
6929
  * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
6986
6930
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
6987
6931
  * */
6988
- var initialState$2 = {};
6989
- var slice$2 = createSlice({
6990
- initialState: initialState$2,
6932
+ var initialState$1 = {};
6933
+ var slice$1 = createSlice({
6934
+ initialState: initialState$1,
6991
6935
  name: 'router',
6992
6936
  reducers: {
6993
6937
  navigateToUrl: function navigateToUrl(
@@ -6997,8 +6941,8 @@ var slice$2 = createSlice({
6997
6941
  action) {}
6998
6942
  }
6999
6943
  });
7000
- var reducer$2 = slice$2.reducer;
7001
- var routerActions = slice$2.actions;
6944
+ var reducer$1 = slice$1.reducer;
6945
+ var routerActions = slice$1.actions;
7002
6946
 
7003
6947
  /* *
7004
6948
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -7075,65 +7019,11 @@ function rootSaga$1() {
7075
7019
  var routerModuleConfig = {
7076
7020
  id: 'router',
7077
7021
  reducersMap: {
7078
- router: reducer$2
7022
+ router: reducer$1
7079
7023
  },
7080
7024
  sagas: [rootSaga$1]
7081
7025
  };
7082
7026
 
7083
- /* *
7084
- * Licensed under the Apache License, Version 2.0 (the "License");
7085
- * you may not use this file except in compliance with the License.
7086
- * You may obtain a copy of the License at
7087
- *
7088
- * http://www.apache.org/licenses/LICENSE-2.0
7089
- *
7090
- * Unless required by applicable law or agreed to in writing, software
7091
- * distributed under the License is distributed on an "AS IS" BASIS,
7092
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7093
- * See the License for the specific language governing permissions and
7094
- * limitations under the License.
7095
- *
7096
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
7097
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
7098
- * */
7099
- var initialState$1 = {
7100
- isInitialised: false
7101
- };
7102
- var slice$1 = createSlice({
7103
- initialState: initialState$1,
7104
- name: 'app',
7105
- reducers: {
7106
- initialiseApp: function initialiseApp(draft) {
7107
- draft.isInitialised = true;
7108
- }
7109
- }
7110
- });
7111
- var reducer$1 = slice$1.reducer;
7112
- var appActions = slice$1.actions;
7113
-
7114
- /* *
7115
- * Licensed under the Apache License, Version 2.0 (the "License");
7116
- * you may not use this file except in compliance with the License.
7117
- * You may obtain a copy of the License at
7118
- *
7119
- * http://www.apache.org/licenses/LICENSE-2.0
7120
- *
7121
- * Unless required by applicable law or agreed to in writing, software
7122
- * distributed under the License is distributed on an "AS IS" BASIS,
7123
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7124
- * See the License for the specific language governing permissions and
7125
- * limitations under the License.
7126
- *
7127
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
7128
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
7129
- * */
7130
- var appModuleConfig = {
7131
- id: 'app-module',
7132
- reducersMap: {
7133
- app: reducer$1
7134
- }
7135
- };
7136
-
7137
7027
  /* *
7138
7028
  * Licensed under the Apache License, Version 2.0 (the "License");
7139
7029
  * you may not use this file except in compliance with the License.
@@ -7563,7 +7453,7 @@ function changeDrawToolSaga(_ref2) {
7563
7453
  currentSelectionType = (_b = (_a = currentGeoJSON === null || currentGeoJSON === void 0 ? void 0 : currentGeoJSON.features[selectedFeatureIndex]) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.selectionType;
7564
7454
  newSelectionType = newDrawMode.selectionType;
7565
7455
  isNewToolSelected = currentSelectionType !== newSelectionType;
7566
- shouldUpdateNewShape = !((_c = currentGeoJSON === null || currentGeoJSON === void 0 ? void 0 : currentGeoJSON.features) === null || _c === void 0 ? void 0 : _c.length) || isNewToolSelected; // don't change anything if same tool is selected again
7456
+ shouldUpdateNewShape = !((_c = currentGeoJSON === null || currentGeoJSON === void 0 ? void 0 : currentGeoJSON.features) === null || _c === void 0 ? void 0 : _c.length) || isNewToolSelected || !newDrawMode.isSelectable && shouldAllowMultipleShapes; // don't change anything if same tool is selected again
7567
7457
  if (!(shouldUpdateNewShape && shouldUpdateShape)) {
7568
7458
  _context2.next = 50;
7569
7459
  break;
@@ -8164,7 +8054,8 @@ function rootSaga() {
8164
8054
  var synchronizationGroupConfig = {
8165
8055
  id: 'syncronizationGroupStore-module',
8166
8056
  reducersMap: {
8167
- syncronizationGroupStore: reducer$4
8057
+ syncronizationGroupStore: reducer$3,
8058
+ loadingIndicatorStore: loadingIndicatorReducer
8168
8059
  },
8169
8060
  sagas: [rootSaga$2, rootSaga]
8170
8061
  };
@@ -8247,7 +8138,7 @@ uiListener.startListening({
8247
8138
  var uiModuleConfig = {
8248
8139
  id: 'ui-module',
8249
8140
  reducersMap: {
8250
- ui: reducer$6
8141
+ ui: reducer$5
8251
8142
  },
8252
8143
  middlewares: [uiListener.middleware]
8253
8144
  };
@@ -8288,7 +8179,9 @@ var coreModuleConfig = [mapStoreModuleConfig, synchronizationGroupConfig, uiModu
8288
8179
  * */
8289
8180
  var createStore = function createStore() {
8290
8181
  return createStore$1({
8291
- extensions: [getSagaExtension({})]
8182
+ extensions: [getSagaExtension({}), {
8183
+ middlewares: [metronomeListener.middleware]
8184
+ }]
8292
8185
  });
8293
8186
  };
8294
8187
  var WrapperWithModules = withEggs(coreModuleConfig)(function (_ref) {
@@ -8410,4 +8303,4 @@ var useSetupDialog = function useSetupDialog(dialogType) {
8410
8303
  };
8411
8304
  };
8412
8305
 
8413
- export { StoreProvider, appActions, appModuleConfig, coreModuleConfig, createStore, drawtoolActions, drawtoolModuleConfig, reducer as drawtoolReducer, selectors as drawtoolSelectors, filterLayers$1 as filterLayers, genericActions, rootSaga$2 as genericSaga, selectors$3 as genericSelectors, types$1 as genericTypes, getSingularDrawtoolDrawLayerId, initialState$4 as initialState, layerActions, reducer$7 as layerReducer, selectors$6 as layerSelectors, types$5 as layerTypes, utils$2 as layerUtils, mapActions, constants$1 as mapConstants, enums as mapEnums, rootSaga$4 as mapSaga, selectors$2 as mapSelectors, mapStoreActions, mapStoreModuleConfig, mapStoreReducers, types$4 as mapTypes, mapUtils, routerActions, routerModuleConfig, utils as routerUtils, selectorMemoizationOptions, serviceActions, selectors$1 as serviceSelectors, types as serviceTypes, storeTestSettings, storeTestUtils, utils$1 as storeUtils, constants as syncConstants, actions as syncGroupsActions, reducer$4 as syncGroupsReducer, selector as syncGroupsSelector, selectors$4 as syncGroupsSelectors, types$2 as syncGroupsTypes, types$2 as types, uiActions, uiModuleConfig, reducer$6 as uiReducer, selectors$5 as uiSelectors, types$3 as uiTypes, useSetupDialog, reducer$5 as webmapReducer };
8306
+ export { IS_LEGEND_OPEN_BY_DEFAULT, StoreProvider, coreModuleConfig, createStore, drawtoolActions, drawtoolModuleConfig, reducer as drawtoolReducer, selectors as drawtoolSelectors, filterLayers$1 as filterLayers, genericActions, rootSaga$2 as genericSaga, selectors$4 as genericSelectors, types$1 as genericTypes, getSingularDrawtoolDrawLayerId, initialState$3 as initialState, layerActions, reducer$6 as layerReducer, selectors$7 as layerSelectors, types$5 as layerTypes, utils$2 as layerUtils, loadingIndicatorActions, loadingIndicatorReducer, selectors$3 as loadingIndicatorSelectors, mapActions, enums as mapEnums, rootSaga$4 as mapSaga, selectors$2 as mapSelectors, mapStoreActions, mapStoreModuleConfig, mapStoreReducers, types$4 as mapTypes, mapUtils, routerActions, routerModuleConfig, utils as routerUtils, selectorMemoizationOptions, serviceActions, selectors$1 as serviceSelectors, types as serviceTypes, storeTestSettings, storeTestUtils, utils$1 as storeUtils, constants as syncConstants, actions as syncGroupsActions, reducer$3 as syncGroupsReducer, selector as syncGroupsSelector, selectors$5 as syncGroupsSelectors, types$2 as syncGroupsTypes, types$2 as types, uiActions, uiModuleConfig, reducer$5 as uiReducer, selectors$6 as uiSelectors, types$3 as uiTypes, useSetupDialog, reducer$4 as webmapReducer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/store",
3
- "version": "9.10.2",
3
+ "version": "9.11.0",
4
4
  "description": "GeoWeb Store library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -18,7 +18,9 @@
18
18
  "immer": "^10.0.3",
19
19
  "@redux-eggs/redux-toolkit": "^2.2.0",
20
20
  "@redux-eggs/saga-extension": "^2.2.0",
21
- "lodash": "^4.17.21"
21
+ "lodash": "^4.17.21",
22
+ "@opengeoweb/metronome": "*",
23
+ "@opengeoweb/timeslider": "*"
22
24
  },
23
25
  "peerDependencies": {
24
26
  "react": "18"
@@ -14,3 +14,4 @@ export declare const genericActions: {
14
14
  export * as genericSelectors from './selectors';
15
15
  export * from './synchronizationGroups';
16
16
  export * as genericTypes from './types';
17
+ export * from './loadingIndicator';
@@ -0,0 +1,2 @@
1
+ export { loadingIndicatorActions, loadingIndicatorReducer } from './reducer';
2
+ export * as loadingIndicatorSelectors from './selectors';
@@ -0,0 +1,11 @@
1
+ import { PayloadAction, EntityState } from '@reduxjs/toolkit';
2
+ import { LoadingIndicatorType, SetIsGetCapabilitiesLoadingPayload, SetIsGetMapLoadingPayload } from './types';
3
+ export declare const loadingIndicatorAdapter: import("@reduxjs/toolkit").EntityAdapter<LoadingIndicatorType>;
4
+ export declare const slice: import("@reduxjs/toolkit").Slice<EntityState<LoadingIndicatorType>, {
5
+ setGetMapIsLoading: (draft: EntityState<LoadingIndicatorType>, action: PayloadAction<SetIsGetMapLoadingPayload>) => void;
6
+ setGetCapabilitiesIsLoading: (draft: EntityState<LoadingIndicatorType>, action: PayloadAction<SetIsGetCapabilitiesLoadingPayload>) => void;
7
+ }, "loadingIndicatorReducer">;
8
+ export declare const loadingIndicatorActions: import("@reduxjs/toolkit").CaseReducerActions<{
9
+ setGetMapIsLoading: (draft: EntityState<LoadingIndicatorType>, action: PayloadAction<SetIsGetMapLoadingPayload>) => void;
10
+ setGetCapabilitiesIsLoading: (draft: EntityState<LoadingIndicatorType>, action: PayloadAction<SetIsGetCapabilitiesLoadingPayload>) => void;
11
+ }, "loadingIndicatorReducer">, loadingIndicatorReducer: import("redux").Reducer<EntityState<LoadingIndicatorType>, import("redux").AnyAction>;
@@ -0,0 +1,17 @@
1
+ import { LoadingIndicatorModuleState, LoadingIndicatorType } from './types';
2
+ export declare const selectLoadingIndicatorById: (state: LoadingIndicatorModuleState, id: import("@reduxjs/toolkit").EntityId) => LoadingIndicatorType | undefined;
3
+ export declare const isGetMapLoading: ((state: LoadingIndicatorModuleState, id: import("@reduxjs/toolkit").EntityId) => boolean) & import("reselect").OutputSelectorFields<(args_0: LoadingIndicatorType | undefined) => boolean, {
4
+ clearCache: () => void;
5
+ }> & {
6
+ clearCache: () => void;
7
+ };
8
+ export declare const isGetCapabilitiesLoading: ((state: LoadingIndicatorModuleState, id: import("@reduxjs/toolkit").EntityId) => boolean) & import("reselect").OutputSelectorFields<(args_0: LoadingIndicatorType | undefined) => boolean, {
9
+ clearCache: () => void;
10
+ }> & {
11
+ clearCache: () => void;
12
+ };
13
+ export declare const isLoading: ((state: LoadingIndicatorModuleState, id: import("@reduxjs/toolkit").EntityId) => boolean) & import("reselect").OutputSelectorFields<(args_0: boolean, args_1: boolean) => boolean, {
14
+ clearCache: () => void;
15
+ }> & {
16
+ clearCache: () => void;
17
+ };
@@ -0,0 +1,17 @@
1
+ import { EntityState } from '@reduxjs/toolkit';
2
+ export interface LoadingIndicatorType {
3
+ id: string;
4
+ isGetMapLoading: boolean;
5
+ isGetCapabilitiesLoading: boolean;
6
+ }
7
+ export interface LoadingIndicatorModuleState {
8
+ loadingIndicatorStore?: EntityState<LoadingIndicatorType>;
9
+ }
10
+ export interface SetIsGetMapLoadingPayload {
11
+ id: string;
12
+ isGetMapLoading: boolean;
13
+ }
14
+ export interface SetIsGetCapabilitiesLoadingPayload {
15
+ id: string;
16
+ isGetCapabilitiesLoading: boolean;
17
+ }
@@ -3,7 +3,6 @@ export * from './ui';
3
3
  export * from './generic';
4
4
  export { rootSaga as genericSaga } from './generic/sagas';
5
5
  export * from './router';
6
- export * from './app';
7
6
  export * from './drawingtool';
8
7
  export * from './types';
9
8
  export * as storeTestUtils from './mapStore/storeTestUtils';
@@ -1,6 +1 @@
1
- export declare const defaultAnimationDelayAtStart = 250;
2
- export declare const defaultDelay = 1000;
3
- export declare const defaultTimeStep = 60;
4
- export declare const defaultSecondsPerPx = 80;
5
- export declare const defaultTimeSpan: number;
6
1
  export declare const IS_LEGEND_OPEN_BY_DEFAULT = false;
@@ -1,23 +1,3 @@
1
- export declare enum Scale {
2
- Minutes5 = 0,
3
- Hour = 1,
4
- Hours3 = 2,
5
- Hours6 = 3,
6
- Day = 4,
7
- Week = 5,
8
- Month = 6,
9
- Year = 7
10
- }
11
- export declare enum AnimationLength {
12
- Minutes15 = 15,
13
- Minutes30 = 30,
14
- Hours1 = 60,
15
- Hours2 = 120,
16
- Hours3 = 180,
17
- Hours6 = 360,
18
- Hours12 = 720,
19
- Hours24 = 1440
20
- }
21
1
  export declare enum MapActionOrigin {
22
2
  map = "map"
23
3
  }
@@ -11,26 +11,13 @@ export declare const mapUtils: {
11
11
  findMapIdFromLayerId: (mapState?: mapTypes.WebMapState | undefined, layerId?: string | undefined) => string | null;
12
12
  produceDraftStateSetMapDimensionFromLayerChangeDimension: (draft: mapTypes.WebMapState, layerId: string, dimension: mapTypes.Dimension) => void;
13
13
  getTimeStepFromDataInterval: (timeInterval: import("dist/libs/webmap/src").TimeInterval) => number;
14
- getSpeedFactor: (speedDelay: number) => mapTypes.SpeedFactorType;
14
+ getSpeedFactor: (speedDelay: number) => import("dist/libs/timeslider/src").SpeedFactorType;
15
15
  getAnimationDuration: (animationEndTime: string | undefined, animationStartTime: string | undefined) => number;
16
- getSpeedDelay: (speedFactor: mapTypes.SpeedFactorType) => number;
17
- roundWithTimeStep: (unixTime: number, timeStep: number, type?: string | undefined) => number;
18
- secondsPerPxToScale: Map<number, import("./enums").Scale>;
19
- scaleToSecondsPerPx: {
20
- 0: number;
21
- 1: number;
22
- 2: number;
23
- 3: number;
24
- 4: number;
25
- 5: number;
26
- 6: number;
27
- 7: number;
28
- };
29
16
  };
30
17
  export { mapTypes };
31
18
  export { mapActions, reducer as webmapReducer } from './reducer';
32
19
  export * as mapSelectors from './selectors';
33
20
  export * as mapEnums from './enums';
34
- export * as mapConstants from './constants';
21
+ export * from './constants';
35
22
  export { defaultLayers } from '@opengeoweb/webmap-react';
36
23
  export * as filterLayers from './filterLayers';
@@ -0,0 +1,2 @@
1
+ import { CoreAppStore } from '../../types';
2
+ export declare const metronomeListener: import("@reduxjs/toolkit").ListenerMiddlewareInstance<CoreAppStore, import("@reduxjs/toolkit").ThunkDispatch<CoreAppStore, unknown, import("redux").AnyAction>, unknown>;
@@ -27,4 +27,4 @@ export declare const MAX_NUMBER_STEPS_FORWARD_TO_PREFETCH = 2;
27
27
  * @param targets List of targets to check
28
28
  * @returns True if all maps are ready to go forward, false if the map has no data to display yet.
29
29
  */
30
- export declare const prefetchAnimationTargetsForSaga: (timerId: string, animationListValues: string[], targets: SetTimeSyncPayload[]) => boolean;
30
+ export declare const prefetchAnimationTargetsForMetronome: (timerId: string, animationListValues: string[], targets: SetTimeSyncPayload[]) => boolean;
@@ -1,4 +1,4 @@
1
- import { EventChannel, SagaIterator } from 'redux-saga';
1
+ import { SagaIterator } from 'redux-saga';
2
2
  import { mapActions } from '.';
3
3
  import { layerActions } from '../layers';
4
4
  import { Layer } from '../layers/types';
@@ -14,21 +14,5 @@ export declare function handleBaseLayersSaga(mapId: string, baseLayers: Layer[])
14
14
  export declare function setMapPresetSaga({ payload, }: ReturnType<typeof mapActions.setMapPreset>): SagaIterator;
15
15
  export declare function unregisterMapSaga({ payload, }: ReturnType<typeof mapActions.unregisterMap>): Generator;
16
16
  export declare function setStepBackwardOrForwardSaga({ payload, }: ReturnType<typeof mapActions.setStepBackwardOrForward>): Generator;
17
- /**
18
- * This saga is triggered by the metronome. An array of timerIds is given as argument.
19
- * It will update the animation loop of multiple maps and sliders
20
- * It will prefetch images for maps
21
- * @param timerIds string[] array of timerIds
22
- */
23
- export declare function metronomeSaga(timerIds: string[]): SagaIterator;
24
- /**
25
- * Creates a channel for the metronome
26
- * @returns
27
- */
28
- export declare function metronomeTicker(): EventChannel<string[]>;
29
- /**
30
- * Makes a saga channel for the metronome ticker
31
- */
32
- export declare function metronomeSagaWithChannel(): SagaIterator;
33
17
  export declare function rootSaga(): SagaIterator;
34
18
  export default rootSaga;
@@ -1,5 +1,6 @@
1
1
  import { TimeInterval } from '@opengeoweb/webmap';
2
2
  import { MapLocation } from '@opengeoweb/webmap-react';
3
+ import { SpeedFactorType } from '@opengeoweb/timeslider';
3
4
  import type { Layer, LayerActionOrigin } from '../types';
4
5
  import { MapActionOrigin } from './enums';
5
6
  export interface Dimension {
@@ -73,7 +74,6 @@ export declare enum AnimationLength {
73
74
  Hours12 = 720,
74
75
  Hours24 = 1440
75
76
  }
76
- export type SpeedFactorType = 0.1 | 0.2 | 0.5 | 1 | 2 | 4 | 8 | 16;
77
77
  export interface AnimationPayloadType {
78
78
  duration?: number;
79
79
  interval?: number;
@@ -1,7 +1,7 @@
1
1
  import { TimeInterval } from '@opengeoweb/webmap';
2
+ import { SpeedFactorType } from '@opengeoweb/timeslider';
2
3
  import { Bbox, Dimension } from './types';
3
- import { Scale } from './enums';
4
- import type { WebMapState, WebMap, SpeedFactorType } from '../types';
4
+ import type { WebMapState, WebMap } from '../types';
5
5
  import type { Layer } from '../layers/types';
6
6
  export declare const dateFormat = "yyyy-MM-dd'T'HH:mm:ss'Z";
7
7
  export interface CreateMapProps {
@@ -70,25 +70,3 @@ export declare function moveArrayElements<T>(array: T[], oldIndex: number, newIn
70
70
  export declare const getTimeStepFromDataInterval: (timeInterval: TimeInterval) => number;
71
71
  export declare const getSpeedFactor: (speedDelay: number) => SpeedFactorType;
72
72
  export declare const getAnimationDuration: (animationEndTime: string | undefined, animationStartTime: string | undefined) => number;
73
- /**
74
- * Returns speed delay for given speedFactor. For options, see defined above in "speedFactors"
75
- */
76
- export declare const getSpeedDelay: (speedFactor: SpeedFactorType) => number;
77
- export declare const roundWithTimeStep: (unixTime: number, timeStep: number, type?: string) => number;
78
- /**
79
- * In this Map collection all fundamental scales
80
- * (Scale.Minutes5 ... Scale.Year) are mapped with their corresponding
81
- * secondsPerPx numbers.
82
- * @returns a Map including information explained above
83
- */
84
- export declare const secondsPerPxToScale: Map<number, Scale>;
85
- /**
86
- * Creates a reverse mapping of scales to their corresponding secondsPerPx
87
- * values to make it easier in some parts GeoWeb to fetch a secondsPerpx for
88
- * a certain fundamental scale (Scale.Minutes5 ... Scale.year)
89
- * @returns an Object, where names are fundamental scale values (0 - 7) and
90
- * values are their corresponding secondsPerPx numbers.
91
- */
92
- export declare const scaleToSecondsPerPx: {
93
- [x in Scale]: number;
94
- };
@@ -2,5 +2,6 @@ import type { WebMapStateModuleState } from './mapStore/types';
2
2
  import type { SynchronizationGroupModuleState } from './generic/synchronizationGroups/types';
3
3
  import type { uiTypes } from '.';
4
4
  import type { DrawtoolModuleStore } from './drawingtool';
5
- export interface CoreAppStore extends SynchronizationGroupModuleState, uiTypes.UIModuleState, WebMapStateModuleState, DrawtoolModuleStore {
5
+ import type { LoadingIndicatorModuleState } from './generic/loadingIndicator/types';
6
+ export interface CoreAppStore extends SynchronizationGroupModuleState, LoadingIndicatorModuleState, uiTypes.UIModuleState, WebMapStateModuleState, DrawtoolModuleStore {
6
7
  }
@@ -1,4 +0,0 @@
1
- import { Store } from '@reduxjs/toolkit';
2
- import { Egg } from '@redux-eggs/core';
3
- import { AppModuleStore } from './types';
4
- export declare const appModuleConfig: Egg<Store<AppModuleStore>>;
@@ -1,2 +0,0 @@
1
- export { appActions } from './reducer';
2
- export * from './config';
@@ -1,15 +0,0 @@
1
- import { Draft } from '@reduxjs/toolkit';
2
- interface InitialState {
3
- isInitialised: boolean;
4
- }
5
- export declare const initialState: {
6
- isInitialised: boolean;
7
- };
8
- export declare const reducer: import("redux").Reducer<{
9
- isInitialised: boolean;
10
- }, import("redux").AnyAction>;
11
- export declare const appActions: import("@reduxjs/toolkit").CaseReducerActions<{
12
- initialiseApp: (draft: Draft<InitialState>) => void;
13
- }, "app">;
14
- export type AppActions = ReturnType<typeof appActions.initialiseApp>;
15
- export {};
@@ -1,6 +0,0 @@
1
- export interface AppStoreState {
2
- isInitialised: boolean;
3
- }
4
- export interface AppModuleStore {
5
- app?: AppStoreState;
6
- }