@rio-cloud/rio-uikit 0.16.4-beta.35 → 0.16.4-beta.38

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/.DS_Store CHANGED
Binary file
Binary file
Binary file
@@ -95,6 +95,14 @@ const Map = (props) => {
95
95
  platform,
96
96
  ui: hereUi,
97
97
  utils: createUtils(hereMap),
98
+ // Put settings back into the map API object so the invoking service
99
+ // can check on these settings for instance inside a test
100
+ settings: {
101
+ enableWebGL,
102
+ baseLayer,
103
+ activeLayers,
104
+ showCluster,
105
+ },
98
106
  });
99
107
  // If the base layer changed, re-add all previous objects again,
100
108
  // otherwise the map would be empty
@@ -152,10 +160,12 @@ const Map = (props) => {
152
160
  // due to the nature of the AssetTree with it's hundreds DOM nodes, applying the CSS selectors
153
161
  // takes time.
154
162
  const handleMapInteractionStart = () => {
155
- document.body.classList.add('pointer-events-none');
163
+ var _a;
164
+ (_a = document.querySelector('.AssetTree')) === null || _a === void 0 ? void 0 : _a.classList.add('pointer-events-none');
156
165
  };
157
166
  const handleMapInteractionEnd = () => {
158
- document.body.classList.remove('pointer-events-none');
167
+ var _a;
168
+ (_a = document.querySelector('.AssetTree')) === null || _a === void 0 ? void 0 : _a.classList.remove('pointer-events-none');
159
169
  };
160
170
  const style = {};
161
171
  if (height) {
@@ -2,6 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useState, useEffect, useContext } from 'react';
3
3
  import { MapContext } from '../../MapContext';
4
4
  // TODO: apparently it is not used
5
+ // Consider Using a Group Layer: If you have additional map objects or want to
6
+ // control visibility/z-index of the cluster layer separately, using a group layer can be beneficial.
5
7
  const MapLayerGroup = (props) => {
6
8
  const { minZoom = Number.NEGATIVE_INFINITY, maxZoom = Number.POSITIVE_INFINITY, isVisible = true, children, } = props;
7
9
  const context = useContext(MapContext);
@@ -90,6 +90,12 @@ export type MapApi = {
90
90
  ui?: H.ui.UI;
91
91
  utils?: MapUtils;
92
92
  group?: H.map.Group;
93
+ settings?: {
94
+ enableWebGL?: boolean;
95
+ baseLayer?: MapType;
96
+ activeLayers?: MapLayer[];
97
+ showCluster?: boolean;
98
+ };
93
99
  };
94
100
  export type MapIncidents = {
95
101
  sourceUpdated: string;
@@ -1,4 +1,4 @@
1
- import type { BoundingBox } from '../../../mapTypes';
1
+ import type { BoundingBox, Position } from '../../../mapTypes';
2
2
  export declare const isValidBoundingBox: (box: BoundingBox) => boolean;
3
3
  export declare const calculateBoundingBox: (positions: {
4
4
  lat: number;
@@ -8,3 +8,21 @@ export declare const parsePositionFromString: (value: string) => {
8
8
  lat: number;
9
9
  lng: number;
10
10
  } | undefined;
11
+ /**
12
+ * Ease function that can be used to animate positions on the map.
13
+ *
14
+ * See: https://developer.here.com/documentation/examples/maps-js/markers/markers-update-position-with-animation
15
+ *
16
+ * @param {H.geo.IPoint} startCoord start geo coordinate
17
+ * @param {H.geo.IPoint} endCoord end geo coordinate
18
+ * @param number durationMs duration of animation between start & end coordinates
19
+ * @param function onStep callback executed each step
20
+ * @param function onStep callback executed at the end
21
+ */
22
+ export declare const ease: (startCoord?: {
23
+ lat: number;
24
+ lng: number;
25
+ }, endCoord?: {
26
+ lat: number;
27
+ lng: number;
28
+ }, durationMs?: number, onStep?: (pos: Position) => void, onComplete?: () => void) => void;
@@ -34,3 +34,38 @@ export const parsePositionFromString = (value) => {
34
34
  }
35
35
  }
36
36
  };
37
+ /**
38
+ * Ease function that can be used to animate positions on the map.
39
+ *
40
+ * See: https://developer.here.com/documentation/examples/maps-js/markers/markers-update-position-with-animation
41
+ *
42
+ * @param {H.geo.IPoint} startCoord start geo coordinate
43
+ * @param {H.geo.IPoint} endCoord end geo coordinate
44
+ * @param number durationMs duration of animation between start & end coordinates
45
+ * @param function onStep callback executed each step
46
+ * @param function onStep callback executed at the end
47
+ */
48
+ export const ease = (startCoord = { lat: 0, lng: 0 }, endCoord = { lat: 1, lng: 1 }, durationMs = 200, onStep = (pos) => { }, onComplete = () => { }) => {
49
+ const raf = window.requestAnimationFrame;
50
+ const stepCount = durationMs / 16;
51
+ const valueIncrementLat = (endCoord.lat - startCoord.lat) / stepCount;
52
+ const valueIncrementLng = (endCoord.lng - startCoord.lng) / stepCount;
53
+ const sinValueIncrement = Math.PI / stepCount;
54
+ let currentValueLat = startCoord.lat;
55
+ let currentValueLng = startCoord.lng;
56
+ let currentSinValue = 0;
57
+ const step = () => {
58
+ currentSinValue += sinValueIncrement;
59
+ currentValueLat += valueIncrementLat * Math.pow(Math.sin(currentSinValue), 2) * 2;
60
+ currentValueLng += valueIncrementLng * Math.pow(Math.sin(currentSinValue), 2) * 2;
61
+ if (currentSinValue < Math.PI) {
62
+ onStep({ lat: currentValueLat, lng: currentValueLng });
63
+ raf(step);
64
+ }
65
+ else {
66
+ onStep(endCoord);
67
+ onComplete();
68
+ }
69
+ };
70
+ raf(step);
71
+ };
package/lib/.DS_Store CHANGED
Binary file
package/lib/es/.DS_Store CHANGED
Binary file
Binary file
@@ -98,6 +98,14 @@ const Map = (props) => {
98
98
  platform,
99
99
  ui: hereUi,
100
100
  utils: (0, mapUtils_1.createUtils)(hereMap),
101
+ // Put settings back into the map API object so the invoking service
102
+ // can check on these settings for instance inside a test
103
+ settings: {
104
+ enableWebGL,
105
+ baseLayer,
106
+ activeLayers,
107
+ showCluster,
108
+ },
101
109
  });
102
110
  // If the base layer changed, re-add all previous objects again,
103
111
  // otherwise the map would be empty
@@ -155,10 +163,12 @@ const Map = (props) => {
155
163
  // due to the nature of the AssetTree with it's hundreds DOM nodes, applying the CSS selectors
156
164
  // takes time.
157
165
  const handleMapInteractionStart = () => {
158
- document.body.classList.add('pointer-events-none');
166
+ var _a;
167
+ (_a = document.querySelector('.AssetTree')) === null || _a === void 0 ? void 0 : _a.classList.add('pointer-events-none');
159
168
  };
160
169
  const handleMapInteractionEnd = () => {
161
- document.body.classList.remove('pointer-events-none');
170
+ var _a;
171
+ (_a = document.querySelector('.AssetTree')) === null || _a === void 0 ? void 0 : _a.classList.remove('pointer-events-none');
162
172
  };
163
173
  const style = {};
164
174
  if (height) {
@@ -4,6 +4,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
4
4
  const react_1 = require("react");
5
5
  const MapContext_1 = require("../../MapContext");
6
6
  // TODO: apparently it is not used
7
+ // Consider Using a Group Layer: If you have additional map objects or want to
8
+ // control visibility/z-index of the cluster layer separately, using a group layer can be beneficial.
7
9
  const MapLayerGroup = (props) => {
8
10
  const { minZoom = Number.NEGATIVE_INFINITY, maxZoom = Number.POSITIVE_INFINITY, isVisible = true, children, } = props;
9
11
  const context = (0, react_1.useContext)(MapContext_1.MapContext);
@@ -90,6 +90,12 @@ export type MapApi = {
90
90
  ui?: H.ui.UI;
91
91
  utils?: MapUtils;
92
92
  group?: H.map.Group;
93
+ settings?: {
94
+ enableWebGL?: boolean;
95
+ baseLayer?: MapType;
96
+ activeLayers?: MapLayer[];
97
+ showCluster?: boolean;
98
+ };
93
99
  };
94
100
  export type MapIncidents = {
95
101
  sourceUpdated: string;
@@ -1,4 +1,4 @@
1
- import type { BoundingBox } from '../../../mapTypes';
1
+ import type { BoundingBox, Position } from '../../../mapTypes';
2
2
  export declare const isValidBoundingBox: (box: BoundingBox) => boolean;
3
3
  export declare const calculateBoundingBox: (positions: {
4
4
  lat: number;
@@ -8,3 +8,21 @@ export declare const parsePositionFromString: (value: string) => {
8
8
  lat: number;
9
9
  lng: number;
10
10
  } | undefined;
11
+ /**
12
+ * Ease function that can be used to animate positions on the map.
13
+ *
14
+ * See: https://developer.here.com/documentation/examples/maps-js/markers/markers-update-position-with-animation
15
+ *
16
+ * @param {H.geo.IPoint} startCoord start geo coordinate
17
+ * @param {H.geo.IPoint} endCoord end geo coordinate
18
+ * @param number durationMs duration of animation between start & end coordinates
19
+ * @param function onStep callback executed each step
20
+ * @param function onStep callback executed at the end
21
+ */
22
+ export declare const ease: (startCoord?: {
23
+ lat: number;
24
+ lng: number;
25
+ }, endCoord?: {
26
+ lat: number;
27
+ lng: number;
28
+ }, durationMs?: number, onStep?: (pos: Position) => void, onComplete?: () => void) => void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parsePositionFromString = exports.calculateBoundingBox = exports.isValidBoundingBox = void 0;
3
+ exports.ease = exports.parsePositionFromString = exports.calculateBoundingBox = exports.isValidBoundingBox = void 0;
4
4
  const createBoundingBox = () => ({
5
5
  top: Number.NEGATIVE_INFINITY,
6
6
  right: Number.NEGATIVE_INFINITY,
@@ -40,3 +40,39 @@ const parsePositionFromString = (value) => {
40
40
  }
41
41
  };
42
42
  exports.parsePositionFromString = parsePositionFromString;
43
+ /**
44
+ * Ease function that can be used to animate positions on the map.
45
+ *
46
+ * See: https://developer.here.com/documentation/examples/maps-js/markers/markers-update-position-with-animation
47
+ *
48
+ * @param {H.geo.IPoint} startCoord start geo coordinate
49
+ * @param {H.geo.IPoint} endCoord end geo coordinate
50
+ * @param number durationMs duration of animation between start & end coordinates
51
+ * @param function onStep callback executed each step
52
+ * @param function onStep callback executed at the end
53
+ */
54
+ const ease = (startCoord = { lat: 0, lng: 0 }, endCoord = { lat: 1, lng: 1 }, durationMs = 200, onStep = (pos) => { }, onComplete = () => { }) => {
55
+ const raf = window.requestAnimationFrame;
56
+ const stepCount = durationMs / 16;
57
+ const valueIncrementLat = (endCoord.lat - startCoord.lat) / stepCount;
58
+ const valueIncrementLng = (endCoord.lng - startCoord.lng) / stepCount;
59
+ const sinValueIncrement = Math.PI / stepCount;
60
+ let currentValueLat = startCoord.lat;
61
+ let currentValueLng = startCoord.lng;
62
+ let currentSinValue = 0;
63
+ const step = () => {
64
+ currentSinValue += sinValueIncrement;
65
+ currentValueLat += valueIncrementLat * Math.pow(Math.sin(currentSinValue), 2) * 2;
66
+ currentValueLng += valueIncrementLng * Math.pow(Math.sin(currentSinValue), 2) * 2;
67
+ if (currentSinValue < Math.PI) {
68
+ onStep({ lat: currentValueLat, lng: currentValueLng });
69
+ raf(step);
70
+ }
71
+ else {
72
+ onStep(endCoord);
73
+ onComplete();
74
+ }
75
+ };
76
+ raf(step);
77
+ };
78
+ exports.ease = ease;
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "0.16.4-beta.35"
2
+ "version": "0.16.4-beta.38"
3
3
  }
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@rio-cloud/rio-uikit",
3
- "version": "0.16.4-beta.35",
3
+ "version": "0.16.4-beta.38",
4
4
  "description": "The RIO UIKIT component library",
5
5
  "repository": "https://bitbucket.collaboration-man.com/projects/RIOFRONT/repos/uikit-web/browse",
6
6
  "scripts": {
7
7
  "build": "npm run build:font && npm run build:styles && npm run build:vite && npm run format-code && echo '\nšŸ‘‰ For an npm release use build:npm šŸ‘ˆ'",
8
- "build:npm": "npm run build:cjs && npm run build:esm && npm run copy-to-package && npm run fixEsmImports && echo '\nšŸ“¦ Publish to npm only from within 'package' folder šŸ“¦'",
8
+ "build:npm": "npm run build:cjs && npm run build:esm && npm run copy-to-package && echo '\nšŸ“¦ Publish to npm only from within 'package' folder šŸ“¦'",
9
9
  "build:cjs": "tsc -p tsconfig.cjs.json && copyfiles --up 1 src/*.d.ts src/version.json src/styles/variables/colors/colors.json package/lib/es",
10
10
  "build:esm": "tsc -p tsconfig.esm.json && copyfiles --up 1 src/*.d.ts src/version.json src/styles/variables/colors/colors.json package",
11
11
  "build:vite": "vite build",
@@ -22,7 +22,6 @@
22
22
  "build:style-traton": "vite build --mode style-traton",
23
23
  "build:style-xmas": "vite build --mode style-xmas",
24
24
  "build:font": "svgo -f webfont/svgs && vite build --mode font",
25
- "fixEsmImports": "node tools/fixEsmImportsInDeclarations.mjs",
26
25
  "fixCssMinified": "node tools/fixCssMinified.mjs",
27
26
  "format-code": "npm run format-code:uikit && npm run format-code:demo",
28
27
  "format-code:uikit": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,md}\"",
@@ -40,13 +39,11 @@
40
39
  },
41
40
  "author": "TB Digital Services GmbH",
42
41
  "license": "Apache-2.0",
43
- "main": "./lib/es/index.js",
44
- "module": "./index.js",
45
- "types": "./lib/es/index.d.ts",
42
+ "main": "lib/es/index.js",
43
+ "module": "index.js",
44
+ "types": "index.d.ts",
46
45
  "less": "./styles/css/rio-uikit.less",
47
- "files": [
48
- "**/*.*"
49
- ],
46
+ "files": ["**/*.*"],
50
47
  "devDependencies": {
51
48
  "@testing-library/dom": "9.3.3",
52
49
  "@testing-library/jest-dom": "5.17.0",
@@ -132,12 +129,6 @@
132
129
  "recharts": "2.10.3",
133
130
  "tslib": "2.6.2"
134
131
  },
135
- "pre-commit": [
136
- "format-code"
137
- ],
138
- "browserslist": [
139
- "> 0.5%",
140
- "Firefox ESR",
141
- "not dead"
142
- ]
132
+ "pre-commit": ["format-code"],
133
+ "browserslist": ["> 0.5%", "Firefox ESR", "not dead"]
143
134
  }
package/version.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "0.16.4-beta.35"
2
+ "version": "0.16.4-beta.38"
3
3
  }