@rio-cloud/rio-uikit 2.3.0-beta.2 → 2.3.0-beta.3

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.
Files changed (102) hide show
  1. package/Marker.js +9 -5
  2. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.d.ts +38 -3
  3. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.js +104 -109
  4. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.js.map +1 -1
  5. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.d.ts +24 -5
  6. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.js +60 -56
  7. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.js.map +1 -1
  8. package/components/datepicker/DayPicker.js +72 -70
  9. package/components/datepicker/DayPicker.js.map +1 -1
  10. package/components/datepicker/DayPickerDropdown.d.ts +1 -0
  11. package/components/datepicker/DayPickerDropdown.js +61 -48
  12. package/components/datepicker/DayPickerDropdown.js.map +1 -1
  13. package/components/datepicker/useStackedDayPickerCalendars.js +26 -26
  14. package/components/datepicker/useStackedDayPickerCalendars.js.map +1 -1
  15. package/components/listMenu/ListMenu.d.ts +8 -0
  16. package/components/listMenu/ListMenu.js +74 -66
  17. package/components/listMenu/ListMenu.js.map +1 -1
  18. package/components/map/components/Map.js +189 -157
  19. package/components/map/components/Map.js.map +1 -1
  20. package/components/map/components/MapContext.d.ts +1 -0
  21. package/components/map/components/MapContext.js +8 -7
  22. package/components/map/components/MapContext.js.map +1 -1
  23. package/components/map/components/features/Route.d.ts +65 -1
  24. package/components/map/components/features/Route.js +184 -98
  25. package/components/map/components/features/Route.js.map +1 -1
  26. package/components/map/components/features/basics/Marker.d.ts +21 -1
  27. package/components/map/components/features/basics/Marker.js +99 -40
  28. package/components/map/components/features/basics/Marker.js.map +1 -1
  29. package/components/map/components/features/basics/Polygon.d.ts +24 -1
  30. package/components/map/components/features/basics/Polygon.js +72 -19
  31. package/components/map/components/features/basics/Polygon.js.map +1 -1
  32. package/components/map/components/features/basics/Polyline.d.ts +29 -0
  33. package/components/map/components/features/basics/Polyline.js +69 -39
  34. package/components/map/components/features/basics/Polyline.js.map +1 -1
  35. package/components/map/components/features/layers/MarkerLayer.js +8 -8
  36. package/components/map/components/features/layers/MarkerLayer.js.map +1 -1
  37. package/components/map/components/features/layers/clustering/SimpleClusterLayer.js +13 -6
  38. package/components/map/components/features/layers/clustering/SimpleClusterLayer.js.map +1 -1
  39. package/components/map/utils/clustering.d.ts +1 -1
  40. package/components/map/utils/clustering.js +30 -30
  41. package/components/map/utils/clustering.js.map +1 -1
  42. package/components/map/utils/mapTypes.d.ts +135 -0
  43. package/components/map/utils/mapTypes.js.map +1 -1
  44. package/components/mapMarker/ClusterMapMarker.d.ts +2 -0
  45. package/components/mapMarker/ClusterMapMarker.js.map +1 -1
  46. package/components/mapMarker/SingleMapMarker.d.ts +2 -0
  47. package/components/mapMarker/SingleMapMarker.js.map +1 -1
  48. package/components/selects/ClearButton.js +9 -7
  49. package/components/selects/ClearButton.js.map +1 -1
  50. package/components/table/Table.js +208 -205
  51. package/components/table/Table.js.map +1 -1
  52. package/components/table/Table.types.d.ts +13 -4
  53. package/components/table/TableColumn.d.ts +8 -1
  54. package/components/table/TableColumn.js +66 -64
  55. package/components/table/TableColumn.js.map +1 -1
  56. package/components/table/TableExpandedRow.js +11 -11
  57. package/components/table/TableExpandedRow.js.map +1 -1
  58. package/components/table/TableHeader.d.ts +17 -0
  59. package/components/table/TableHeader.js +89 -76
  60. package/components/table/TableHeader.js.map +1 -1
  61. package/components/table/TableHeaderColumn.d.ts +11 -1
  62. package/components/table/TableHeaderColumn.js +63 -58
  63. package/components/table/TableHeaderColumn.js.map +1 -1
  64. package/components/table/TableRow.d.ts +6 -0
  65. package/components/table/TableRow.js +49 -48
  66. package/components/table/TableRow.js.map +1 -1
  67. package/components/table/context/TableLayoutContext.d.ts +1 -0
  68. package/components/table/context/TableLayoutContext.js.map +1 -1
  69. package/components/table/layout/useHorizontalSectionSync.d.ts +2 -1
  70. package/components/table/layout/useHorizontalSectionSync.js +32 -31
  71. package/components/table/layout/useHorizontalSectionSync.js.map +1 -1
  72. package/components/table/layout/useTableLayout.d.ts +2 -1
  73. package/components/table/layout/useTableLayout.js +37 -30
  74. package/components/table/layout/useTableLayout.js.map +1 -1
  75. package/components/table/render/header/TableDraggableHeaderCell.js +38 -36
  76. package/components/table/render/header/TableDraggableHeaderCell.js.map +1 -1
  77. package/components/table/render/header/TableHeader.types.d.ts +2 -0
  78. package/components/table/render/header/TableHeaderCellContent.js +16 -16
  79. package/components/table/render/header/TableHeaderCellContent.js.map +1 -1
  80. package/components/table/render/header/TableStaticHeaderCell.js +31 -29
  81. package/components/table/render/header/TableStaticHeaderCell.js.map +1 -1
  82. package/components/table/render/header/resolveHeaderCellClassName.d.ts +1 -0
  83. package/components/table/render/header/resolveHeaderCellClassName.js +10 -9
  84. package/components/table/render/header/resolveHeaderCellClassName.js.map +1 -1
  85. package/components/table/runtime/useResolvedRenderColumns.d.ts +4 -4
  86. package/components/table/runtime/useResolvedRenderColumns.js +13 -13
  87. package/components/table/runtime/useResolvedRenderColumns.js.map +1 -1
  88. package/components/table/runtime/useResolvedRenderHeader.d.ts +1 -1
  89. package/components/table/runtime/useResolvedRenderHeader.js.map +1 -1
  90. package/hooks/useDraggableElement.d.ts +27 -5
  91. package/hooks/useDraggableElement.js +100 -23
  92. package/hooks/useDraggableElement.js.map +1 -1
  93. package/hooks/usePopperDropdown.d.ts +1 -0
  94. package/hooks/usePopperDropdown.js +15 -12
  95. package/hooks/usePopperDropdown.js.map +1 -1
  96. package/package.json +1 -1
  97. package/utils/analytics/createAnalyticsOverlayTooltip.js.map +1 -1
  98. package/utils/init/initConfig.js +5 -5
  99. package/utils/init/initConfig.js.map +1 -1
  100. package/version.d.ts +1 -1
  101. package/version.js +1 -1
  102. package/version.js.map +1 -1
@@ -1,11 +1,34 @@
1
+ import { CSSProperties } from 'react';
1
2
  import { Position } from '../../../utils/mapTypes';
2
3
  import { EventListenerMap } from '../../../utils/eventHandling';
3
4
  export { colorMapColdplay, colorMapWarmup, colorMapGray, colorMapBrand, colorMapStatus, colorMapMarker, colorMapRating, colorMapHighlight, } from './polygonColors';
4
5
  export type PolygonPoints = Position[] & Record<string, any>;
6
+ export type PolygonStyle = H.map.SpatialStyle | H.map.SpatialStyle.Options;
5
7
  export type PolygonProps = {
8
+ /**
9
+ * Ordered geographic positions that define the polygon geometry.
10
+ */
6
11
  points: PolygonPoints;
7
- style?: H.map.SpatialStyle;
12
+ /**
13
+ * Visual style applied to the polygon.
14
+ *
15
+ * @default H.map.SpatialStyle.DEFAULT_STYLE
16
+ *
17
+ */
18
+ style?: PolygonStyle;
19
+ /**
20
+ * Style overrides applied while the polygon is hovered.
21
+ */
22
+ hoverStyle?: PolygonStyle;
23
+ /**
24
+ * Event handlers attached to the polygon.
25
+ */
8
26
  eventListenerMap?: EventListenerMap;
27
+ /**
28
+ * Cursor shown while hovering the polygon.
29
+ * If omitted, clickable polygons automatically use `pointer`.
30
+ */
31
+ cursor?: CSSProperties['cursor'];
9
32
  };
10
33
  declare const Polygon: (props: PolygonProps) => null;
11
34
  export default Polygon;
@@ -1,24 +1,77 @@
1
- import { useState as g, useEffect as a } from "react";
2
- import { isNil as l } from "es-toolkit/predicate";
3
- import { useMapContext as u } from "../../MapContext.js";
4
- import { useUpdateProp as c, useUpdateEventListenerMap as f } from "../../../utils/hooks.js";
5
- const i = (s) => {
6
- const t = new H.geo.LineString();
7
- return s.forEach((e) => {
8
- l(e.lat) || l(e.lng) || Number.isNaN(e.lat) || Number.isNaN(e.lng) || t.pushLatLngAlt(e.lat, e.lng, 0);
9
- }), new H.geo.Polygon(t);
10
- }, S = (s) => {
11
- const { points: t, style: e = H.map.SpatialStyle.DEFAULT_STYLE, eventListenerMap: m } = s, { api: n } = u(), [r, p] = g();
12
- return a(() => {
13
- const o = new H.map.Polygon(i(t), { style: e });
14
- return n.map?.addObject(o), p(o), () => {
15
- n.map?.getObjects().includes(o) && n.map?.removeObject(o), o.dispose();
1
+ import { useState as v, useRef as y, useMemo as C, useEffect as E } from "react";
2
+ import { isNil as S } from "es-toolkit/predicate";
3
+ import { useMapContext as R } from "../../MapContext.js";
4
+ import { useUpdateEventListenerMap as h } from "../../../utils/hooks.js";
5
+ import { EventUtils as a } from "../../../utils/eventHandling.js";
6
+ const T = (e) => {
7
+ const p = new H.geo.LineString();
8
+ return e.forEach((r) => {
9
+ S(r.lat) || S(r.lng) || Number.isNaN(r.lat) || Number.isNaN(r.lng) || p.pushLatLngAlt(r.lat, r.lng, 0);
10
+ }), new H.geo.Polygon(p);
11
+ }, L = (e) => {
12
+ if (e)
13
+ return e instanceof H.map.SpatialStyle ? {
14
+ strokeColor: e.strokeColor,
15
+ fillColor: e.fillColor,
16
+ lineWidth: e.lineWidth,
17
+ lineCap: e.lineCap,
18
+ lineHeadCap: e.lineHeadCap,
19
+ lineTailCap: e.lineTailCap,
20
+ lineJoin: e.lineJoin,
21
+ miterLimit: e.miterLimit,
22
+ lineDash: e.lineDash,
23
+ lineDashOffset: e.lineDashOffset
24
+ } : e;
25
+ }, M = (e) => {
26
+ const { points: p, style: r = H.map.SpatialStyle.DEFAULT_STYLE, hoverStyle: f, eventListenerMap: o, cursor: g } = e, { api: i } = R(), [n, P] = v(), m = y(!1), l = C(() => {
27
+ if (g)
28
+ return g;
29
+ if (o?.[a.TAP] || o?.[a.DBL_TAP] || o?.[a.CONTEXTMENU])
30
+ return "pointer";
31
+ }, [g, o]), s = C(() => {
32
+ if (f)
33
+ return new H.map.SpatialStyle({
34
+ ...L(r),
35
+ ...L(f)
36
+ });
37
+ }, [f, r]), u = (t, N) => {
38
+ t.setStyle(N && s ? s : r);
39
+ }, c = (t) => {
40
+ if (!i.map)
41
+ return;
42
+ const N = i.map.getElement(), O = i.map.getViewPort().element;
43
+ N.style.cursor = t, O.style.cursor = t;
44
+ };
45
+ E(() => {
46
+ const t = new H.map.Polygon(T(p), { style: r });
47
+ return i.map?.addObject(t), P(t), () => {
48
+ i.map?.getObjects().includes(t) && i.map?.removeObject(t), t.dispose();
16
49
  };
17
- }, [n.map]), a(() => {
18
- r && r.setGeometry(i(t));
19
- }, [t]), c(r, "setStyle", e), f(r, m), null;
50
+ }, [i.map]), E(() => {
51
+ n && n.setGeometry(T(p));
52
+ }, [p]), E(() => {
53
+ n && u(n, m.current);
54
+ }, [n, r, s]), E(
55
+ () => () => {
56
+ l && c("");
57
+ },
58
+ [i.map, l]
59
+ );
60
+ const d = C(() => o || f || l ? {
61
+ ...o,
62
+ [a.POINTER_ENTER]: (...t) => {
63
+ n && s && (m.current = !0, u(n, !0)), l && c(l), o?.[a.POINTER_ENTER]?.(...t);
64
+ },
65
+ [a.POINTER_LEAVE]: (...t) => {
66
+ n && s && (m.current = !1, u(n, !1)), l && c(""), o?.[a.POINTER_LEAVE]?.(...t);
67
+ },
68
+ [a.POINTER_CANCEL]: (...t) => {
69
+ n && s && (m.current = !1, u(n, !1)), l && c(""), o?.[a.POINTER_CANCEL]?.(...t);
70
+ }
71
+ } : o, [i.map, o, n, s, l]);
72
+ return h(n, d), null;
20
73
  };
21
74
  export {
22
- S as default
75
+ M as default
23
76
  };
24
77
  //# sourceMappingURL=Polygon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Polygon.js","sources":["../../../../../../src/components/map/components/features/basics/Polygon.tsx"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { isNil } from 'es-toolkit/predicate';\n\nimport { useMapContext } from '../../MapContext';\nimport { useUpdateProp, useUpdateEventListenerMap } from '../../../utils/hooks';\nimport type { Position } from '../../../utils/mapTypes';\nimport type { EventListenerMap } from '../../../utils/eventHandling';\n\nexport {\n colorMapColdplay,\n colorMapWarmup,\n colorMapGray,\n colorMapBrand,\n colorMapStatus,\n colorMapMarker,\n colorMapRating,\n colorMapHighlight,\n} from './polygonColors';\n\nconst createGeometry = (points: Position[]) => {\n const lineString = new H.geo.LineString();\n\n points.forEach(p => {\n if (isNil(p.lat) || isNil(p.lng) || Number.isNaN(p.lat) || Number.isNaN(p.lng)) {\n return;\n }\n lineString.pushLatLngAlt(p.lat, p.lng, 0);\n });\n\n return new H.geo.Polygon(lineString);\n};\n\nexport type PolygonPoints = Position[] & Record<string, any>;\n\nexport type PolygonProps = {\n points: PolygonPoints;\n style?: H.map.SpatialStyle;\n eventListenerMap?: EventListenerMap;\n};\n\nconst Polygon = (props: PolygonProps) => {\n const { points, style = H.map.SpatialStyle.DEFAULT_STYLE, eventListenerMap } = props;\n\n const { api } = useMapContext();\n const [polygon, setPolygon] = useState<H.map.Polygon>();\n\n useEffect(() => {\n const newPolygon = new H.map.Polygon(createGeometry(points), { style });\n api.map?.addObject(newPolygon);\n\n setPolygon(newPolygon);\n\n return () => {\n if (api.map?.getObjects().includes(newPolygon)) {\n api.map?.removeObject(newPolygon);\n }\n newPolygon.dispose();\n };\n }, [api.map]);\n\n useEffect(() => {\n if (polygon) {\n polygon.setGeometry(createGeometry(points));\n }\n }, [points]);\n\n useUpdateProp(polygon, 'setStyle', style);\n useUpdateEventListenerMap(polygon, eventListenerMap);\n\n return null;\n};\n\nexport default Polygon;\n"],"names":["createGeometry","points","lineString","p","isNil","Polygon","props","style","eventListenerMap","api","useMapContext","polygon","setPolygon","useState","useEffect","newPolygon","useUpdateProp","useUpdateEventListenerMap"],"mappings":";;;;AAmBA,MAAMA,IAAiB,CAACC,MAAuB;AAC3C,QAAMC,IAAa,IAAI,EAAE,IAAI,WAAA;AAE7B,SAAAD,EAAO,QAAQ,CAAAE,MAAK;AAChB,IAAIC,EAAMD,EAAE,GAAG,KAAKC,EAAMD,EAAE,GAAG,KAAK,OAAO,MAAMA,EAAE,GAAG,KAAK,OAAO,MAAMA,EAAE,GAAG,KAG7ED,EAAW,cAAcC,EAAE,KAAKA,EAAE,KAAK,CAAC;AAAA,EAC5C,CAAC,GAEM,IAAI,EAAE,IAAI,QAAQD,CAAU;AACvC,GAUMG,IAAU,CAACC,MAAwB;AACrC,QAAM,EAAE,QAAAL,GAAQ,OAAAM,IAAQ,EAAE,IAAI,aAAa,eAAe,kBAAAC,MAAqBF,GAEzE,EAAE,KAAAG,EAAA,IAAQC,EAAA,GACV,CAACC,GAASC,CAAU,IAAIC,EAAA;AAE9B,SAAAC,EAAU,MAAM;AACZ,UAAMC,IAAa,IAAI,EAAE,IAAI,QAAQf,EAAeC,CAAM,GAAG,EAAE,OAAAM,GAAO;AACtE,WAAAE,EAAI,KAAK,UAAUM,CAAU,GAE7BH,EAAWG,CAAU,GAEd,MAAM;AACT,MAAIN,EAAI,KAAK,WAAA,EAAa,SAASM,CAAU,KACzCN,EAAI,KAAK,aAAaM,CAAU,GAEpCA,EAAW,QAAA;AAAA,IACf;AAAA,EACJ,GAAG,CAACN,EAAI,GAAG,CAAC,GAEZK,EAAU,MAAM;AACZ,IAAIH,KACAA,EAAQ,YAAYX,EAAeC,CAAM,CAAC;AAAA,EAElD,GAAG,CAACA,CAAM,CAAC,GAEXe,EAAcL,GAAS,YAAYJ,CAAK,GACxCU,EAA0BN,GAASH,CAAgB,GAE5C;AACX;"}
1
+ {"version":3,"file":"Polygon.js","sources":["../../../../../../src/components/map/components/features/basics/Polygon.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef, useState, type CSSProperties } from 'react';\nimport { isNil } from 'es-toolkit/predicate';\n\nimport { useMapContext } from '../../MapContext';\nimport { useUpdateEventListenerMap } from '../../../utils/hooks';\nimport type { Position } from '../../../utils/mapTypes';\nimport { EventUtils, type EventListenerMap } from '../../../utils/eventHandling';\n\nexport {\n colorMapColdplay,\n colorMapWarmup,\n colorMapGray,\n colorMapBrand,\n colorMapStatus,\n colorMapMarker,\n colorMapRating,\n colorMapHighlight,\n} from './polygonColors';\n\nconst createGeometry = (points: Position[]) => {\n const lineString = new H.geo.LineString();\n\n points.forEach(p => {\n if (isNil(p.lat) || isNil(p.lng) || Number.isNaN(p.lat) || Number.isNaN(p.lng)) {\n return;\n }\n lineString.pushLatLngAlt(p.lat, p.lng, 0);\n });\n\n return new H.geo.Polygon(lineString);\n};\n\nexport type PolygonPoints = Position[] & Record<string, any>;\nexport type PolygonStyle = H.map.SpatialStyle | H.map.SpatialStyle.Options;\n\nconst toSpatialStyleOptions = (style?: PolygonStyle): H.map.SpatialStyle.Options | undefined => {\n if (!style) {\n return;\n }\n\n if (style instanceof H.map.SpatialStyle) {\n return {\n strokeColor: style.strokeColor,\n fillColor: style.fillColor,\n lineWidth: style.lineWidth,\n lineCap: style.lineCap,\n lineHeadCap: style.lineHeadCap,\n lineTailCap: style.lineTailCap,\n lineJoin: style.lineJoin,\n miterLimit: style.miterLimit,\n lineDash: style.lineDash,\n lineDashOffset: style.lineDashOffset,\n };\n }\n\n return style;\n};\n\nexport type PolygonProps = {\n /**\n * Ordered geographic positions that define the polygon geometry.\n */\n points: PolygonPoints;\n\n /**\n * Visual style applied to the polygon.\n *\n * @default H.map.SpatialStyle.DEFAULT_STYLE\n *\n */\n style?: PolygonStyle;\n\n /**\n * Style overrides applied while the polygon is hovered.\n */\n hoverStyle?: PolygonStyle;\n\n /**\n * Event handlers attached to the polygon.\n */\n eventListenerMap?: EventListenerMap;\n\n /**\n * Cursor shown while hovering the polygon.\n * If omitted, clickable polygons automatically use `pointer`.\n */\n cursor?: CSSProperties['cursor'];\n};\n\nconst Polygon = (props: PolygonProps) => {\n const { points, style = H.map.SpatialStyle.DEFAULT_STYLE, hoverStyle, eventListenerMap, cursor } = props;\n\n const { api } = useMapContext();\n const [polygon, setPolygon] = useState<H.map.Polygon>();\n const isHoveredRef = useRef(false);\n\n const resolvedCursor = useMemo(() => {\n if (cursor) {\n return cursor;\n }\n\n if (\n eventListenerMap?.[EventUtils.TAP] ||\n eventListenerMap?.[EventUtils.DBL_TAP] ||\n eventListenerMap?.[EventUtils.CONTEXTMENU]\n ) {\n return 'pointer';\n }\n }, [cursor, eventListenerMap]);\n\n const mergedHoverStyle = useMemo(() => {\n if (!hoverStyle) {\n return;\n }\n\n return new H.map.SpatialStyle({\n ...toSpatialStyleOptions(style),\n ...toSpatialStyleOptions(hoverStyle),\n });\n }, [hoverStyle, style]);\n\n const applyPolygonStyle = (nextPolygon: H.map.Polygon, hovered: boolean) => {\n nextPolygon.setStyle(hovered && mergedHoverStyle ? mergedHoverStyle : style);\n };\n\n const applyCursor = (nextCursor: string) => {\n if (!api.map) {\n return;\n }\n\n const mapElement = api.map.getElement() as HTMLElement;\n const viewportElement = api.map.getViewPort().element as HTMLElement;\n\n mapElement.style.cursor = nextCursor;\n viewportElement.style.cursor = nextCursor;\n };\n\n useEffect(() => {\n const newPolygon = new H.map.Polygon(createGeometry(points), { style });\n api.map?.addObject(newPolygon);\n\n setPolygon(newPolygon);\n\n return () => {\n if (api.map?.getObjects().includes(newPolygon)) {\n api.map?.removeObject(newPolygon);\n }\n newPolygon.dispose();\n };\n }, [api.map]);\n\n useEffect(() => {\n if (polygon) {\n polygon.setGeometry(createGeometry(points));\n }\n }, [points]);\n\n useEffect(() => {\n if (polygon) {\n applyPolygonStyle(polygon, isHoveredRef.current);\n }\n }, [polygon, style, mergedHoverStyle]);\n\n useEffect(\n () => () => {\n if (resolvedCursor) {\n applyCursor('');\n }\n },\n [api.map, resolvedCursor]\n );\n\n const resolvedEventListenerMap = useMemo(() => {\n if (!(eventListenerMap || hoverStyle || resolvedCursor)) {\n return eventListenerMap;\n }\n\n return {\n ...eventListenerMap,\n [EventUtils.POINTER_ENTER]: (...args: unknown[]) => {\n if (polygon && mergedHoverStyle) {\n isHoveredRef.current = true;\n applyPolygonStyle(polygon, true);\n }\n\n if (resolvedCursor) {\n applyCursor(resolvedCursor);\n }\n\n eventListenerMap?.[EventUtils.POINTER_ENTER]?.(...args);\n },\n [EventUtils.POINTER_LEAVE]: (...args: unknown[]) => {\n if (polygon && mergedHoverStyle) {\n isHoveredRef.current = false;\n applyPolygonStyle(polygon, false);\n }\n\n if (resolvedCursor) {\n applyCursor('');\n }\n\n eventListenerMap?.[EventUtils.POINTER_LEAVE]?.(...args);\n },\n [EventUtils.POINTER_CANCEL]: (...args: unknown[]) => {\n if (polygon && mergedHoverStyle) {\n isHoveredRef.current = false;\n applyPolygonStyle(polygon, false);\n }\n\n if (resolvedCursor) {\n applyCursor('');\n }\n\n eventListenerMap?.[EventUtils.POINTER_CANCEL]?.(...args);\n },\n } satisfies EventListenerMap;\n }, [api.map, eventListenerMap, polygon, mergedHoverStyle, resolvedCursor]);\n\n useUpdateEventListenerMap(polygon, resolvedEventListenerMap);\n\n return null;\n};\n\nexport default Polygon;\n"],"names":["createGeometry","points","lineString","p","isNil","toSpatialStyleOptions","style","Polygon","props","hoverStyle","eventListenerMap","cursor","api","useMapContext","polygon","setPolygon","useState","isHoveredRef","useRef","resolvedCursor","useMemo","EventUtils","mergedHoverStyle","applyPolygonStyle","nextPolygon","hovered","applyCursor","nextCursor","mapElement","viewportElement","useEffect","newPolygon","resolvedEventListenerMap","args","useUpdateEventListenerMap"],"mappings":";;;;;AAmBA,MAAMA,IAAiB,CAACC,MAAuB;AAC3C,QAAMC,IAAa,IAAI,EAAE,IAAI,WAAA;AAE7B,SAAAD,EAAO,QAAQ,CAAAE,MAAK;AAChB,IAAIC,EAAMD,EAAE,GAAG,KAAKC,EAAMD,EAAE,GAAG,KAAK,OAAO,MAAMA,EAAE,GAAG,KAAK,OAAO,MAAMA,EAAE,GAAG,KAG7ED,EAAW,cAAcC,EAAE,KAAKA,EAAE,KAAK,CAAC;AAAA,EAC5C,CAAC,GAEM,IAAI,EAAE,IAAI,QAAQD,CAAU;AACvC,GAKMG,IAAwB,CAACC,MAAiE;AAC5F,MAAKA;AAIL,WAAIA,aAAiB,EAAE,IAAI,eAChB;AAAA,MACH,aAAaA,EAAM;AAAA,MACnB,WAAWA,EAAM;AAAA,MACjB,WAAWA,EAAM;AAAA,MACjB,SAASA,EAAM;AAAA,MACf,aAAaA,EAAM;AAAA,MACnB,aAAaA,EAAM;AAAA,MACnB,UAAUA,E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AGY,CAAI;AAAA,IAC3D;AAAA,EAAA,IAxCOvB,GA0CZ,CAACE,EAAI,KAAKF,GAAkBI,GAASQ,GAAkBH,CAAc,CAAC;AAEzE,SAAAe,EAA0BpB,GAASkB,CAAwB,GAEpD;AACX;"}
@@ -5,13 +5,42 @@ export type ArrowStyle = {
5
5
  fillColor?: string;
6
6
  strokeColor?: string;
7
7
  };
8
+ export type PolylineObjects = {
9
+ group: H.map.Group;
10
+ line: H.map.Polyline;
11
+ routeArrows?: H.map.Polyline;
12
+ };
8
13
  export type PolylineProps = {
14
+ /**
15
+ * Controls whether directional arrows are rendered on the polyline.
16
+ */
9
17
  hasArrows?: boolean;
18
+ /**
19
+ * Defines the arrow appearance when arrows are rendered.
20
+ */
10
21
  arrowStyle?: ArrowStyle;
22
+ /**
23
+ * Geometry used to render the polyline.
24
+ */
11
25
  geometry: H.geo.LineString;
26
+ /**
27
+ * Visual style applied to the main polyline.
28
+ *
29
+ * @default H.map.SpatialStyle.DEFAULT_STYLE
30
+ */
12
31
  style?: H.map.SpatialStyle;
32
+ /**
33
+ * Custom payload forwarded to the rendered polyline objects and their events.
34
+ */
13
35
  customData?: object;
36
+ /**
37
+ * Event handlers attached to the polyline.
38
+ */
14
39
  eventListenerMap?: EventListenerMap;
40
+ /**
41
+ * Receives the created HERE polyline objects once they are mounted and `undefined` on cleanup.
42
+ */
43
+ onReady?: (objects?: PolylineObjects) => void;
15
44
  };
16
45
  declare const Polyline: (props: PolylineProps) => null;
17
46
  export default Polyline;
@@ -1,65 +1,95 @@
1
- import { useState as u, useEffect as b } from "react";
2
- import { useMapContext as O } from "../../MapContext.js";
3
- import s from "../../../exceptions/MapException.js";
4
- import { useUpdateEventListenerMap as P } from "../../../utils/hooks.js";
5
- import { removeEventListenerMap as g } from "../../../utils/eventHandling.js";
6
- import { isVectorBased as h } from "../../../utils/rendering.js";
7
- const M = "Error in Polyline: Polyline without geometry makes no sense", C = "Error in Polyline: property geometry must be of type H.geo.LineString", v = (p) => {
1
+ import { useState as M, useRef as h, useEffect as d, useMemo as S } from "react";
2
+ import { useMapContext as I } from "../../MapContext.js";
3
+ import b from "../../../exceptions/MapException.js";
4
+ import { EventUtils as i, removeEventListenerMap as p, addEventListenerMap as w } from "../../../utils/eventHandling.js";
5
+ import { isVectorBased as v } from "../../../utils/rendering.js";
6
+ const j = "Error in Polyline: Polyline without geometry makes no sense", A = "Error in Polyline: property geometry must be of type H.geo.LineString", V = (T) => {
8
7
  const {
9
- geometry: t,
10
- hasArrows: n,
11
- arrowStyle: a,
12
- style: l = H.map.SpatialStyle.DEFAULT_STYLE,
13
- customData: m,
14
- eventListenerMap: y
15
- } = p, { api: r, enableWebGL: c, baseLayer: d } = O(), [f, S] = u();
16
- if (!t)
17
- throw new s(M);
18
- if (!(t instanceof H.geo.LineString))
19
- throw new s(C);
20
- return b(() => {
21
- const e = new H.map.Group({ data: m }), i = new H.map.Polyline(t, { style: l });
22
- if (n) {
23
- let o;
24
- if (h(c, d))
25
- o = new H.map.Polyline(t, {
8
+ geometry: r,
9
+ hasArrows: y,
10
+ arrowStyle: E,
11
+ style: O = H.map.SpatialStyle.DEFAULT_STYLE,
12
+ customData: u,
13
+ eventListenerMap: n,
14
+ onReady: m
15
+ } = T, { api: o, enableWebGL: L, baseLayer: _ } = I(), [l, N] = M(), s = h([]), f = h(m);
16
+ d(() => {
17
+ f.current = m;
18
+ }, [m]);
19
+ const g = S(() => {
20
+ if (!n)
21
+ return;
22
+ const e = Object.entries(n).filter(
23
+ ([t]) => [i.POINTER_ENTER, i.POINTER_LEAVE, i.POINTER_CANCEL].includes(t)
24
+ );
25
+ if (e.length !== 0)
26
+ return Object.fromEntries(e);
27
+ }, [n]), P = S(() => {
28
+ if (!n)
29
+ return;
30
+ const e = Object.entries(n).filter(
31
+ ([t]) => ![i.POINTER_ENTER, i.POINTER_LEAVE, i.POINTER_CANCEL].includes(t)
32
+ );
33
+ if (e.length !== 0)
34
+ return Object.fromEntries(e);
35
+ }, [n]);
36
+ if (!r)
37
+ throw new b(j);
38
+ if (!(r instanceof H.geo.LineString))
39
+ throw new b(A);
40
+ return d(() => {
41
+ const e = new H.map.Group({ data: u }), t = new H.map.Polyline(r, { style: O });
42
+ let a;
43
+ t.setData(u);
44
+ const R = [t];
45
+ if (y) {
46
+ if (v(L, _))
47
+ a = new H.map.Polyline(r, {
26
48
  style: {
27
49
  strokeColor: "rgba(42, 55, 64, 1)",
28
50
  lineWidth: 5,
29
51
  lineDash: [1.8, 4],
30
52
  // @ts-expect-error-next-line - the types are outdated here
31
53
  lineDashImage: H.map.SpatialStyle.DashImage.ARROW,
32
- ...a
54
+ ...E
33
55
  }
34
56
  });
35
57
  else {
36
- const w = {
58
+ const c = {
37
59
  lineWidth: 2,
38
60
  fillColor: "rgba(42, 55, 64, 1)",
39
61
  strokeColor: "rgba(0, 0, 0, 0.8)",
40
62
  lineDash: [0, 4],
41
63
  lineTailCap: "arrow-tail",
42
64
  lineHeadCap: "arrow-head",
43
- ...a
44
- }, E = new H.map.SpatialStyle({
65
+ ...E
66
+ }, C = new H.map.SpatialStyle({
45
67
  lineWidth: 10,
46
68
  strokeColor: "rgba(255, 255, 255, 0)"
47
69
  });
48
- o = new H.map.Polyline(t, { style: E, arrows: w });
70
+ a = new H.map.Polyline(r, { style: C, arrows: c });
49
71
  }
50
- e.addObjects([i, o]);
72
+ a.setData(u), R.push(a), e.addObjects([t, a]);
51
73
  } else
52
- e.addObjects([i]);
53
- return r.map?.addObject(e), S(e), () => {
54
- g(e), e.forEach((o) => {
55
- e.removeObject(o), o.dispose();
56
- }), r.map?.getObjects().includes(e) && r.map.removeObject(e), e.dispose();
74
+ e.addObjects([t]);
75
+ return o.map?.addObject(e), s.current = R, N(e), f.current?.({ group: e, line: t, routeArrows: a }), () => {
76
+ f.current?.(), p(e), s.current.forEach(p), s.current = [], e.forEach((c) => {
77
+ e.removeObject(c), c.dispose();
78
+ }), o.map?.getObjects().includes(e) && o.map.removeObject(e), e.dispose();
57
79
  };
58
- }, [r.map, t, l, n, a]), P(f, y), null;
80
+ }, [o.map, r, O, y, E]), d(() => {
81
+ const e = o.map;
82
+ if (l && e)
83
+ return w(l, P, e), s.current.forEach((t) => {
84
+ w(t, g, e);
85
+ }), () => {
86
+ p(l), s.current.forEach(p);
87
+ };
88
+ }, [o.map, l, P, g]), null;
59
89
  };
60
90
  export {
61
- M as MISSING_GEOMETRY_PROPS_EXCEPTION_MSG,
62
- C as WRONG_GEOMETRY_PROPS_EXCEPTION_MSG,
63
- v as default
91
+ j as MISSING_GEOMETRY_PROPS_EXCEPTION_MSG,
92
+ A as WRONG_GEOMETRY_PROPS_EXCEPTION_MSG,
93
+ V as default
64
94
  };
65
95
  //# sourceMappingURL=Polyline.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Polyline.js","sources":["../../../../../../src/components/map/components/features/basics/Polyline.tsx"],"sourcesContent":["import { useState, useEffect } from 'react';\n\nimport { useMapContext } from '../../MapContext';\nimport MapException from '../../../exceptions/MapException';\n\nimport { useUpdateEventListenerMap } from '../../../utils/hooks';\nimport { removeEventListenerMap, type EventListenerMap } from '../../../utils/eventHandling';\nimport { isVectorBased } from '../../../utils/rendering';\n\nexport const MISSING_GEOMETRY_PROPS_EXCEPTION_MSG = 'Error in Polyline: Polyline without geometry makes no sense';\nexport const WRONG_GEOMETRY_PROPS_EXCEPTION_MSG =\n 'Error in Polyline: property geometry must be of type H.geo.LineString';\n\nexport type ArrowStyle = {\n fillColor?: string;\n strokeColor?: string;\n};\n\nexport type PolylineProps = {\n hasArrows?: boolean;\n arrowStyle?: ArrowStyle;\n geometry: H.geo.LineString;\n style?: H.map.SpatialStyle;\n customData?: object;\n eventListenerMap?: EventListenerMap;\n};\n\nconst Polyline = (props: PolylineProps) => {\n const {\n geometry,\n hasArrows,\n arrowStyle,\n style = H.map.SpatialStyle.DEFAULT_STYLE,\n customData,\n eventListenerMap,\n } = props;\n\n const { api, enableWebGL, baseLayer } = useMapContext();\n\n const [polyline, setPolyline] = useState<H.map.Group>();\n\n if (!geometry) {\n throw new MapException(MISSING_GEOMETRY_PROPS_EXCEPTION_MSG);\n }\n\n if (!(geometry instanceof H.geo.LineString)) {\n throw new MapException(WRONG_GEOMETRY_PROPS_EXCEPTION_MSG);\n }\n\n useEffect(() => {\n const lineGroup = new H.map.Group({ data: customData });\n const line = new H.map.Polyline(geometry, { style });\n\n if (hasArrows) {\n let routeArrows: H.map.Polyline;\n\n if (isVectorBased(enableWebGL, baseLayer)) {\n // WebGL way - Create a patterned polyline\n routeArrows = new H.map.Polyline(geometry, {\n style: {\n strokeColor: 'rgba(42, 55, 64, 1)',\n lineWidth: 5,\n lineDash: [1.8, 4],\n // @ts-expect-error-next-line - the types are outdated here\n lineDashImage: H.map.SpatialStyle.DashImage.ARROW,\n ...arrowStyle,\n },\n });\n } else {\n // Pixel map way - Create a patterned polyline\n const defaultArrowStyle = {\n lineWidth: 2,\n fillColor: 'rgba(42, 55, 64, 1)',\n strokeColor: 'rgba(0, 0, 0, 0.8)',\n lineDash: [0, 4],\n lineTailCap: 'arrow-tail',\n lineHeadCap: 'arrow-head',\n ...arrowStyle,\n };\n\n const arrowLineStyle = new H.map.SpatialStyle({\n lineWidth: 10,\n strokeColor: 'rgba(255, 255, 255, 0)',\n });\n\n routeArrows = new H.map.Polyline(geometry, { style: arrowLineStyle, arrows: defaultArrowStyle });\n }\n\n // create a group that represents the route line and contains\n // outline and the pattern\n lineGroup.addObjects([line, routeArrows]);\n } else {\n lineGroup.addObjects([line]);\n }\n\n api.map?.addObject(lineGroup);\n setPolyline(lineGroup);\n\n return () => {\n removeEventListenerMap(lineGroup);\n\n lineGroup.forEach(singleLine => {\n lineGroup.removeObject(singleLine);\n singleLine.dispose();\n });\n\n if (api.map?.getObjects().includes(lineGroup)) {\n api.map.removeObject(lineGroup);\n }\n lineGroup.dispose();\n };\n }, [api.map, geometry, style, hasArrows, arrowStyle]);\n\n useUpdateEventListenerMap(polyline, eventListenerMap);\n\n return null;\n};\n\nexport default Polyline;\n"],"names":["MISSING_GEOMETRY_PROPS_EXCEPTION_MSG","WRONG_GEOMETRY_PROPS_EXCEPTION_MSG","Polyline","props","geometry","hasArrows","arrowStyle","style","customData","eventListenerMap","api","enableWebGL","baseLayer","useMapContext","polyline","setPolyline","useState","MapException","useEffect","lineGroup","line","routeArrows","isVectorBased","defaultArrowStyle","arrowLineStyle","removeEventListenerMap","singleLine","useUpdateEventListenerMap"],"mappings":";;;;;;AASO,MAAMA,IAAuC,+DACvCC,IACT,yEAgBEC,IAAW,CAACC,MAAyB;AACvC,QAAM;AAAA,IACF,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,YAAAC;AAAA,IACA,OAAAC,IAAQ,EAAE,IAAI,aAAa;AAAA,IAC3B,YAAAC;AAAA,IACA,kBAAAC;AAAA,EAAA,IACAN,GAEE,EAAE,KAAAO,GAAK,aAAAC,GAAa,WAAAC,EAAA,IAAcC,EAAA,GAElC,CAACC,GAAUC,CAAW,IAAIC,EAAA;AAEhC,MAAI,CAACZ;AACD,UAAM,IAAIa,EAAajB,CAAoC;AAG/D,MAAI,EAAEI,aAAoB,EAAE,IAAI;AAC5B,UAAM,IAAIa,EAAahB,CAAkC;AAG7D,SAAAiB,EAAU,MAAM;AACZ,UAAMC,IAAY,IAAI,EAAE,IAAI,MAAM,EAAE,MAAMX,GAAY,GAChDY,IAAO,IAAI,EAAE,IAAI,SAAShB,GAAU,EAAE,OAAAG,GAAO;AAEnD,QAAIF,GAAW;AACX,UAAIgB;AAEJ,UAAIC,EAAcX,GAAaC,CAAS;AAEpC,QAAAS,IAAc,IAAI,EAAE,IAAI,SAASjB,GAAU;AAAA,UACvC,OAAO;AAAA,YACH,aAAa;AAAA,YACb,WAAW;AAAA,YACX,UAAU,CAAC,KAAK,CAAC;AAAA;AAAA,YAEjB,eAAe,EAAE,IAAI,aAAa,UAAU;AAAA,YAC5C,GAAGE;AAAA,UAAA;AAAA,QACP,CACH;AAAA,WACE;AAEH,cAAMiB,IAAoB;AAAA,UACtB,WAAW;AAAA,UACX,WAAW;AAAA,UACX,aAAa;AAAA,UACb,UAAU,CAAC,GAAG,CAAC;AAAA,UACf,aAAa;AAAA,UACb,aAAa;AAAA,UACb,GAAGjB;AAAA,QAAA,GAGDkB,IAAiB,IAAI,EAAE,IAAI,aAAa;AAAA,UAC1C,WAAW;AAAA,UACX,aAAa;AAAA,QAAA,CAChB;AAED,QAAAH,IAAc,IAAI,EAAE,IAAI,SAASjB,GAAU,EAAE,OAAOoB,GAAgB,QAAQD,GAAmB;AAAA,MACnG;AAIA,MAAAJ,EAAU,WAAW,CAACC,GAAMC,CAAW,CAAC;AAAA,IAC5C;AACI,MAAAF,EAAU,WAAW,CAACC,CAAI,CAAC;AAG/B,WAAAV,EAAI,KAAK,UAAUS,CAAS,GAC5BJ,EAAYI,CAAS,GAEd,MAAM;AACT,MAAAM,EAAuBN,CAAS,GAEhCA,EAAU,QAAQ,CAAAO,MAAc;AAC5B,QAAAP,EAAU,aAAaO,CAAU,GACjCA,EAAW,QAAA;AAAA,MACf,CAAC,GAEGhB,EAAI,KAAK,WAAA,EAAa,SAASS,CAAS,KACxCT,EAAI,IAAI,aAAaS,CAAS,GAElCA,EAAU,QAAA;AAAA,IACd;AAAA,EACJ,GAAG,CAACT,EAAI,KAAKN,GAAUG,GAAOF,GAAWC,CAAU,CAAC,GAEpDqB,EAA0Bb,GAAUL,CAAgB,GAE7C;AACX;"}
1
+ {"version":3,"file":"Polyline.js","sources":["../../../../../../src/components/map/components/features/basics/Polyline.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef, useState } from 'react';\n\nimport { useMapContext } from '../../MapContext';\nimport MapException from '../../../exceptions/MapException';\n\nimport {\n EventUtils,\n addEventListenerMap,\n removeEventListenerMap,\n type EventListenerMap,\n} from '../../../utils/eventHandling';\nimport { isVectorBased } from '../../../utils/rendering';\n\nexport const MISSING_GEOMETRY_PROPS_EXCEPTION_MSG = 'Error in Polyline: Polyline without geometry makes no sense';\nexport const WRONG_GEOMETRY_PROPS_EXCEPTION_MSG =\n 'Error in Polyline: property geometry must be of type H.geo.LineString';\n\nexport type ArrowStyle = {\n fillColor?: string;\n strokeColor?: string;\n};\n\nexport type PolylineObjects = {\n group: H.map.Group;\n line: H.map.Polyline;\n routeArrows?: H.map.Polyline;\n};\n\nexport type PolylineProps = {\n /**\n * Controls whether directional arrows are rendered on the polyline.\n */\n hasArrows?: boolean;\n\n /**\n * Defines the arrow appearance when arrows are rendered.\n */\n arrowStyle?: ArrowStyle;\n\n /**\n * Geometry used to render the polyline.\n */\n geometry: H.geo.LineString;\n\n /**\n * Visual style applied to the main polyline.\n *\n * @default H.map.SpatialStyle.DEFAULT_STYLE\n */\n style?: H.map.SpatialStyle;\n\n /**\n * Custom payload forwarded to the rendered polyline objects and their events.\n */\n customData?: object;\n\n /**\n * Event handlers attached to the polyline.\n */\n eventListenerMap?: EventListenerMap;\n\n /**\n * Receives the created HERE polyline objects once they are mounted and `undefined` on cleanup.\n */\n onReady?: (objects?: PolylineObjects) => void;\n};\n\nconst Polyline = (props: PolylineProps) => {\n const {\n geometry,\n hasArrows,\n arrowStyle,\n style = H.map.SpatialStyle.DEFAULT_STYLE,\n customData,\n eventListenerMap,\n onReady,\n } = props;\n\n const { api, enableWebGL, baseLayer } = useMapContext();\n\n const [polyline, setPolyline] = useState<H.map.Group>();\n const directEventTargetsRef = useRef<H.map.Polyline[]>([]);\n const onReadyRef = useRef(onReady);\n\n useEffect(() => {\n onReadyRef.current = onReady;\n }, [onReady]);\n\n const directEventListenerMap = useMemo(() => {\n if (!eventListenerMap) {\n return;\n }\n\n const directEntries = Object.entries(eventListenerMap).filter(([key]) =>\n [EventUtils.POINTER_ENTER, EventUtils.POINTER_LEAVE, EventUtils.POINTER_CANCEL].includes(key)\n );\n\n if (directEntries.length === 0) {\n return;\n }\n\n return Object.fromEntries(directEntries) satisfies EventListenerMap;\n }, [eventListenerMap]);\n\n const groupEventListenerMap = useMemo(() => {\n if (!eventListenerMap) {\n return;\n }\n\n const groupEntries = Object.entries(eventListenerMap).filter(\n ([key]) => ![EventUtils.POINTER_ENTER, EventUtils.POINTER_LEAVE, EventUtils.POINTER_CANCEL].includes(key)\n );\n\n if (groupEntries.length === 0) {\n return;\n }\n\n return Object.fromEntries(groupEntries) satisfies EventListenerMap;\n }, [eventListenerMap]);\n\n if (!geometry) {\n throw new MapException(MISSING_GEOMETRY_PROPS_EXCEPTION_MSG);\n }\n\n if (!(geometry instanceof H.geo.LineString)) {\n throw new MapException(WRONG_GEOMETRY_PROPS_EXCEPTION_MSG);\n }\n\n useEffect(() => {\n const lineGroup = new H.map.Group({ data: customData });\n const line = new H.map.Polyline(geometry, { style });\n\n let routeArrows: H.map.Polyline | undefined;\n line.setData(customData);\n\n const directEventTargets = [line];\n\n if (hasArrows) {\n if (isVectorBased(enableWebGL, baseLayer)) {\n // WebGL way - Create a patterned polyline\n routeArrows = new H.map.Polyline(geometry, {\n style: {\n strokeColor: 'rgba(42, 55, 64, 1)',\n lineWidth: 5,\n lineDash: [1.8, 4],\n // @ts-expect-error-next-line - the types are outdated here\n lineDashImage: H.map.SpatialStyle.DashImage.ARROW,\n ...arrowStyle,\n },\n });\n } else {\n // Pixel map way - Create a patterned polyline\n const defaultArrowStyle = {\n lineWidth: 2,\n fillColor: 'rgba(42, 55, 64, 1)',\n strokeColor: 'rgba(0, 0, 0, 0.8)',\n lineDash: [0, 4],\n lineTailCap: 'arrow-tail',\n lineHeadCap: 'arrow-head',\n ...arrowStyle,\n };\n\n const arrowLineStyle = new H.map.SpatialStyle({\n lineWidth: 10,\n strokeColor: 'rgba(255, 255, 255, 0)',\n });\n\n routeArrows = new H.map.Polyline(geometry, { style: arrowLineStyle, arrows: defaultArrowStyle });\n }\n\n routeArrows.setData(customData);\n directEventTargets.push(routeArrows);\n\n // create a group that represents the route line and contains\n // outline and the pattern\n lineGroup.addObjects([line, routeArrows]);\n } else {\n lineGroup.addObjects([line]);\n }\n\n api.map?.addObject(lineGroup);\n directEventTargetsRef.current = directEventTargets;\n setPolyline(lineGroup);\n onReadyRef.current?.({ group: lineGroup, line, routeArrows });\n\n return () => {\n onReadyRef.current?.();\n removeEventListenerMap(lineGroup);\n directEventTargetsRef.current.forEach(removeEventListenerMap);\n directEventTargetsRef.current = [];\n\n lineGroup.forEach(singleLine => {\n lineGroup.removeObject(singleLine);\n singleLine.dispose();\n });\n\n if (api.map?.getObjects().includes(lineGroup)) {\n api.map.removeObject(lineGroup);\n }\n lineGroup.dispose();\n };\n }, [api.map, geometry, style, hasArrows, arrowStyle]);\n\n useEffect(() => {\n const map = api.map;\n\n if (!(polyline && map)) {\n return;\n }\n\n addEventListenerMap(polyline, groupEventListenerMap, map);\n directEventTargetsRef.current.forEach(target => {\n addEventListenerMap(target, directEventListenerMap, map);\n });\n\n return () => {\n removeEventListenerMap(polyline);\n directEventTargetsRef.current.forEach(removeEventListenerMap);\n };\n }, [api.map, polyline, groupEventListenerMap, directEventListenerMap]);\n\n return null;\n};\n\nexport default Polyline;\n"],"names":["MISSING_GEOMETRY_PROPS_EXCEPTION_MSG","WRONG_GEOMETRY_PROPS_EXCEPTION_MSG","Polyline","props","geometry","hasArrows","arrowStyle","style","customData","eventListenerMap","onReady","api","enableWebGL","baseLayer","useMapContext","polyline","setPolyline","useState","directEventTargetsRef","useRef","onReadyRef","useEffect","directEventListenerMap","useMemo","directEntries","key","EventUtils","groupEventListenerMap","groupEntries","MapException","lineGroup","line","routeArrows","directEventTargets","isVectorBased","defaultArrowStyle","arrowLineStyle","removeEventListenerMap","singleLine","map","addEventListenerMap","target"],"mappings":";;;;;AAaO,MAAMA,IAAuC,+DACvCC,IACT,yEAoDEC,IAAW,CAACC,MAAyB;AACvC,QAAM;AAAA,IACF,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,YAAAC;AAAA,IACA,OAAAC,IAAQ,EAAE,IAAI,aAAa;AAAA,IAC3B,YAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,SAAAC;AAAA,EAAA,IACAP,GAEE,E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,CAAC,GAEG3B,EAAI,KAAK,WAAA,EAAa,SAASmB,CAAS,KACxCnB,EAAI,IAAI,aAAamB,CAAS,GAElCA,EAAU,QAAA;AAAA,IACd;AAAA,EACJ,GAAG,CAACnB,EAAI,KAAKP,GAAUG,GAAOF,GAAWC,CAAU,CAAC,GAEpDe,EAAU,MAAM;AACZ,UAAMkB,IAAM5B,EAAI;AAEhB,QAAMI,KAAYwB;AAIlB,aAAAC,EAAoBzB,GAAUY,GAAuBY,CAAG,GACxDrB,EAAsB,QAAQ,QAAQ,CAAAuB,MAAU;AAC5C,QAAAD,EAAoBC,GAAQnB,GAAwBiB,CAAG;AAAA,MAC3D,CAAC,GAEM,MAAM;AACT,QAAAF,EAAuBtB,CAAQ,GAC/BG,EAAsB,QAAQ,QAAQmB,CAAsB;AAAA,MAChE;AAAA,EACJ,GAAG,CAAC1B,EAAI,KAAKI,GAAUY,GAAuBL,CAAsB,CAAC,GAE9D;AACX;"}
@@ -1,15 +1,15 @@
1
- import { jsx as i } from "react/jsx-runtime";
1
+ import { jsx as n } from "react/jsx-runtime";
2
2
  import l from "./clustering/ClusterLayer.js";
3
- import { wrapSimpleTheme as n } from "../../../utils/clustering.js";
4
- import { useMapContext as a } from "../../MapContext.js";
5
- const C = (r) => {
6
- const t = a(), { simpleTheme: e, clusterDissolvable: o = !0, ...s } = r, m = !o || t.showCluster, p = {
7
- clusterTheme: e && n(e),
3
+ import { wrapSimpleTheme as p } from "../../../utils/clustering.js";
4
+ import { useMapContext as i } from "../../MapContext.js";
5
+ const f = (t) => {
6
+ const e = i(), { simpleTheme: r, clusterDissolvable: o = !0, ...s } = t, m = !o || e.showCluster, a = {
7
+ clusterTheme: r && p(r, e.enableMarkerIconCache),
8
8
  ...s
9
9
  };
10
- return /* @__PURE__ */ i(l, { ...p, minWeight: m ? void 0 : 1e9 });
10
+ return /* @__PURE__ */ n(l, { ...a, minWeight: m ? void 0 : 1e9 });
11
11
  };
12
12
  export {
13
- C as default
13
+ f as default
14
14
  };
15
15
  //# sourceMappingURL=MarkerLayer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MarkerLayer.js","sources":["../../../../../../src/components/map/components/features/layers/MarkerLayer.tsx"],"sourcesContent":["import type React from 'react';\n\nimport ClusterLayer, { type ClusterTheme } from './clustering/ClusterLayer';\nimport { wrapSimpleTheme, type SimpleClusterTheme } from '../../../utils/clustering';\nimport { useMapContext } from '../../MapContext';\n\nexport type { ClusterTheme, SimpleClusterTheme };\n\nexport type MarkerLayerProps = React.ComponentProps<typeof ClusterLayer> & {\n simpleTheme?: SimpleClusterTheme;\n clusterDissolvable?: boolean;\n clusterStrategy?: 'FASTGRID' | 'GRID' | 'DYNAMICGRID';\n eps?: number;\n};\n\n/*\n * Not very different to the SimpleClusterLayer, but with a different intention.\n */\nconst MarkerLayer = (props: MarkerLayerProps) => {\n const mapContext = useMapContext();\n\n const { simpleTheme, clusterDissolvable = true, ...rest } = props;\n\n // Norbert: Not an ideal solution\n const showCluster = !clusterDissolvable || mapContext.showCluster;\n const newProps = {\n clusterTheme: simpleTheme && wrapSimpleTheme(simpleTheme),\n ...rest,\n };\n return <ClusterLayer {...newProps} minWeight={showCluster ? undefined : 1000000000} />;\n};\n\nexport default MarkerLayer;\n"],"names":["MarkerLayer","props","mapContext","useMapContext","simpleTheme","clusterDissolvable","rest","showCluster","newProps","wrapSimpleTheme","ClusterLayer"],"mappings":";;;;AAkBA,MAAMA,IAAc,CAACC,MAA4B;AAC7C,QAAMC,IAAaC,EAAA,GAEb,EAAE,aAAAC,GAAa,oBAAAC,IAAqB,IAAM,GAAGC,MAASL,GAGtDM,IAAc,CAACF,KAAsBH,EAAW,aAChDM,IAAW;AAAA,IACb,cAAcJ,KAAeK,EAAgBL,CAAW;AAAA,IACxD,GAAGE;AAAA,EAAA;AAEP,2BAAQI,GAAA,EAAc,GAAGF,GAAU,WAAWD,IAAc,SAAY,KAAY;AACxF;"}
1
+ {"version":3,"file":"MarkerLayer.js","sources":["../../../../../../src/components/map/components/features/layers/MarkerLayer.tsx"],"sourcesContent":["import type React from 'react';\n\nimport ClusterLayer, { type ClusterTheme } from './clustering/ClusterLayer';\nimport { wrapSimpleTheme, type SimpleClusterTheme } from '../../../utils/clustering';\nimport { useMapContext } from '../../MapContext';\n\nexport type { ClusterTheme, SimpleClusterTheme };\n\nexport type MarkerLayerProps = React.ComponentProps<typeof ClusterLayer> & {\n simpleTheme?: SimpleClusterTheme;\n clusterDissolvable?: boolean;\n clusterStrategy?: 'FASTGRID' | 'GRID' | 'DYNAMICGRID';\n eps?: number;\n};\n\n/*\n * Not very different to the SimpleClusterLayer, but with a different intention.\n */\nconst MarkerLayer = (props: MarkerLayerProps) => {\n const mapContext = useMapContext();\n\n const { simpleTheme, clusterDissolvable = true, ...rest } = props;\n\n // Norbert: Not an ideal solution\n const showCluster = !clusterDissolvable || mapContext.showCluster;\n const newProps = {\n clusterTheme: simpleTheme && wrapSimpleTheme(simpleTheme, mapContext.enableMarkerIconCache),\n ...rest,\n };\n return <ClusterLayer {...newProps} minWeight={showCluster ? undefined : 1000000000} />;\n};\n\nexport default MarkerLayer;\n"],"names":["MarkerLayer","props","mapContext","useMapContext","simpleTheme","clusterDissolvable","rest","showCluster","newProps","wrapSimpleTheme","ClusterLayer"],"mappings":";;;;AAkBA,MAAMA,IAAc,CAACC,MAA4B;AAC7C,QAAMC,IAAaC,EAAA,GAEb,EAAE,aAAAC,GAAa,oBAAAC,IAAqB,IAAM,GAAGC,MAASL,GAGtDM,IAAc,CAACF,KAAsBH,EAAW,aAChDM,IAAW;AAAA,IACb,cAAcJ,KAAeK,EAAgBL,GAAaF,EAAW,qBAAqB;AAAA,IAC1F,GAAGI;AAAA,EAAA;AAEP,2BAAQI,GAAA,EAAc,GAAGF,GAAU,WAAWD,IAAc,SAAY,KAAY;AACxF;"}
@@ -1,11 +1,18 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import o from "./ClusterLayer.js";
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import p from "./ClusterLayer.js";
3
3
  import { wrapSimpleTheme as s } from "../../../../utils/clustering.js";
4
- const a = (r) => {
5
- const { simpleTheme: e, ...m } = r;
6
- return /* @__PURE__ */ t(o, { ...m, clusterTheme: e && s(e) });
4
+ import { useMapContext as a } from "../../../MapContext.js";
5
+ const u = (r) => {
6
+ const t = a(), { simpleTheme: e, ...m } = r;
7
+ return /* @__PURE__ */ o(
8
+ p,
9
+ {
10
+ ...m,
11
+ clusterTheme: e && s(e, t.enableMarkerIconCache)
12
+ }
13
+ );
7
14
  };
8
15
  export {
9
- a as default
16
+ u as default
10
17
  };
11
18
  //# sourceMappingURL=SimpleClusterLayer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SimpleClusterLayer.js","sources":["../../../../../../../src/components/map/components/features/layers/clustering/SimpleClusterLayer.tsx"],"sourcesContent":["import ClusterLayer, { type ClusterLayerProps } from './ClusterLayer';\nimport { type SimpleClusterTheme, wrapSimpleTheme } from '../../../../utils/clustering';\n\nexport type SimpleClusterLayerProps = Omit<ClusterLayerProps, 'clusterTheme'> & {\n simpleTheme?: SimpleClusterTheme;\n};\n\nconst SimpleClusterLayer = (props: SimpleClusterLayerProps) => {\n const { simpleTheme, ...rest } = props;\n return <ClusterLayer {...rest} clusterTheme={simpleTheme && wrapSimpleTheme(simpleTheme)} />;\n};\n\nexport default SimpleClusterLayer;\n"],"names":["SimpleClusterLayer","props","simpleTheme","rest","jsx","ClusterLayer","wrapSimpleTheme"],"mappings":";;;AAOA,MAAMA,IAAqB,CAACC,MAAmC;AAC3D,QAAM,EAAE,aAAAC,GAAa,GAAGC,EAAA,IAASF;AACjC,SAAO,gBAAAG,EAACC,KAAc,GAAGF,GAAM,cAAcD,KAAeI,EAAgBJ,CAAW,GAAG;AAC9F;"}
1
+ {"version":3,"file":"SimpleClusterLayer.js","sources":["../../../../../../../src/components/map/components/features/layers/clustering/SimpleClusterLayer.tsx"],"sourcesContent":["import ClusterLayer, { type ClusterLayerProps } from './ClusterLayer';\nimport { type SimpleClusterTheme, wrapSimpleTheme } from '../../../../utils/clustering';\nimport { useMapContext } from '../../../MapContext';\n\nexport type SimpleClusterLayerProps = Omit<ClusterLayerProps, 'clusterTheme'> & {\n simpleTheme?: SimpleClusterTheme;\n};\n\nconst SimpleClusterLayer = (props: SimpleClusterLayerProps) => {\n const mapContext = useMapContext();\n const { simpleTheme, ...rest } = props;\n return (\n <ClusterLayer\n {...rest}\n clusterTheme={simpleTheme && wrapSimpleTheme(simpleTheme, mapContext.enableMarkerIconCache)}\n />\n );\n};\n\nexport default SimpleClusterLayer;\n"],"names":["SimpleClusterLayer","props","mapContext","useMapContext","simpleTheme","rest","jsx","ClusterLayer","wrapSimpleTheme"],"mappings":";;;;AAQA,MAAMA,IAAqB,CAACC,MAAmC;AAC3D,QAAMC,IAAaC,EAAA,GACb,EAAE,aAAAC,GAAa,GAAGC,EAAA,IAASJ;AACjC,SACI,gBAAAK;AAAA,IAACC;AAAA,IAAA;AAAA,MACI,GAAGF;AAAA,MACJ,cAAcD,KAAeI,EAAgBJ,GAAaF,EAAW,qBAAqB;AAAA,IAAA;AAAA,EAAA;AAGtG;"}
@@ -11,4 +11,4 @@ export type SimpleClusterTheme<T = any> = {
11
11
  export declare const ClusterUtils: {
12
12
  getBoundingBoxForCluster: (cluster: Cluster) => H.geo.Rect;
13
13
  };
14
- export declare const wrapSimpleTheme: (theme: SimpleClusterTheme) => ClusterTheme;
14
+ export declare const wrapSimpleTheme: (theme: SimpleClusterTheme, cacheEnabled?: boolean) => ClusterTheme;
@@ -1,47 +1,47 @@
1
- import { getOrCreateIcon as i, isDomMakerNeeded as l } from "../components/features/basics/Marker.js";
2
- const g = (a) => {
3
- let t = null, n = null, e = null, r = null;
1
+ import { getOrCreateIcon as l, isDomMakerNeeded as c } from "../components/features/basics/Marker.js";
2
+ const m = (a) => {
3
+ let e = null, t = null, o = null, r = null;
4
4
  return a.forEachDataPoint((s) => {
5
- const o = s.getPosition();
6
- (t === null || t > o.lat) && (t = o.lat), (n === null || n > o.lng) && (n = o.lng), (e === null || e < o.lat) && (e = o.lat), (r === null || r < o.lng) && (r = o.lng);
5
+ const n = s.getPosition();
6
+ (e === null || e > n.lat) && (e = n.lat), (t === null || t > n.lng) && (t = n.lng), (o === null || o < n.lat) && (o = n.lat), (r === null || r < n.lng) && (r = n.lng);
7
7
  }), new H.geo.Rect(
8
- e,
9
- n,
8
+ o,
10
9
  t,
10
+ e,
11
11
  r
12
12
  );
13
- }, M = {
14
- getBoundingBoxForCluster: g
15
- }, m = (a) => (t) => {
16
- const n = [];
17
- t.forEachDataPoint((c) => n.push(c.getData()));
18
- const e = a(n, t.getPosition());
19
- if (e instanceof H.map.Object)
20
- return e;
21
- const r = i(e), s = l(r) ? H.map.DomMarker : H.map.Marker, o = new s(t.getPosition(), {
22
- icon: r,
13
+ }, f = {
14
+ getBoundingBoxForCluster: m
15
+ }, u = (a, e) => (t) => {
16
+ const o = [];
17
+ t.forEachDataPoint((g) => o.push(g.getData()));
18
+ const r = a(o, t.getPosition());
19
+ if (r instanceof H.map.Object)
20
+ return r;
21
+ const s = l(r, { cacheEnabled: e }), n = c(s) ? H.map.DomMarker : H.map.Marker, i = new n(t.getPosition(), {
22
+ icon: s,
23
23
  // Set min/max zoom with values from the cluster, otherwise
24
24
  // clusters will be shown at all zoom levels
25
25
  min: t.getMinZoom(),
26
26
  max: t.getMaxZoom()
27
27
  });
28
- return o.setData(t), o;
29
- }, u = (a) => (t) => {
30
- const n = a(t.getData(), t.getPosition());
31
- if (n instanceof H.map.Object)
32
- return n;
33
- const e = i(n), r = l(e) ? H.map.DomMarker : H.map.Marker, s = new r(t.getPosition(), {
34
- icon: e,
28
+ return i.setData(t), i;
29
+ }, p = (a, e) => (t) => {
30
+ const o = a(t.getData(), t.getPosition());
31
+ if (o instanceof H.map.Object)
32
+ return o;
33
+ const r = l(o, { cacheEnabled: e }), s = c(r) ? H.map.DomMarker : H.map.Marker, n = new s(t.getPosition(), {
34
+ icon: r,
35
35
  // Use min zoom from a noise point to show it correctly at certain zoom levels
36
36
  min: t.getMinZoom()
37
37
  });
38
- return s.setData(t), s;
39
- }, f = (a) => ({
40
- getClusterPresentation: m(a.getClusterPresentation),
41
- getNoisePresentation: u(a.getNoisePresentation)
38
+ return n.setData(t), n;
39
+ }, k = (a, e) => ({
40
+ getClusterPresentation: u(a.getClusterPresentation, e),
41
+ getNoisePresentation: p(a.getNoisePresentation, e)
42
42
  });
43
43
  export {
44
- M as ClusterUtils,
45
- f as wrapSimpleTheme
44
+ f as ClusterUtils,
45
+ k as wrapSimpleTheme
46
46
  };
47
47
  //# sourceMappingURL=clustering.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clustering.js","sources":["../../../../src/components/map/utils/clustering.ts"],"sourcesContent":["import { getOrCreateIcon, isDomMakerNeeded, type MarkerIcon } from '../components/features/basics/Marker';\nimport type { ClusterTheme } from '../components/features/layers/clustering/ClusterLayer';\n\nexport type Cluster = H.clustering.ICluster;\nexport type DataPoint = H.clustering.DataPoint;\nexport type NoisePoint = H.clustering.INoisePoint;\n\nexport type Theme = H.clustering.ITheme | undefined;\n\n// biome-ignore lint/suspicious/noExplicitAny: keep it less strict\nexport type SimpleClusterTheme<T = any> = {\n getClusterPresentation: (data: T[], position: H.geo.Point) => H.map.Object | MarkerIcon;\n getNoisePresentation: (data: T, position: H.geo.Point) => H.map.Object | MarkerIcon;\n};\n\nconst getBoundingBoxForCluster = (cluster: Cluster): H.geo.Rect => {\n let minLat: number | null = null;\n let minLng: number | null = null;\n let maxLat: number | null = null;\n let maxLng: number | null = null;\n\n cluster.forEachDataPoint((dataPoint: NoisePoint) => {\n const position = dataPoint.getPosition();\n if (minLat === null || minLat > position.lat) {\n minLat = position.lat;\n }\n if (minLng === null || minLng > position.lng) {\n minLng = position.lng;\n }\n if (maxLat === null || maxLat < position.lat) {\n maxLat = position.lat;\n }\n if (maxLng === null || maxLng < position.lng) {\n maxLng = position.lng;\n }\n });\n\n return new H.geo.Rect(\n maxLat as unknown as number,\n minLng as unknown as number,\n minLat as unknown as number,\n maxLng as unknown as number\n );\n};\n\nexport const ClusterUtils = {\n getBoundingBoxForCluster,\n};\n\nconst wrapClusterPresentation = <T>(\n func: (clusterElements: T[], position: H.geo.Point) => H.map.Object | MarkerIcon\n) => {\n return (cluster: Cluster): H.map.Marker => {\n const clusterElements: T[] = [];\n\n cluster.forEachDataPoint((point: NoisePoint) => clusterElements.push(point.getData()));\n\n const presentation = func(clusterElements, cluster.getPosition());\n if (presentation instanceof H.map.Object) {\n return presentation as H.map.Marker;\n }\n\n const clusterIcon = getOrCreateIcon(presentation);\n const MarkerConstructor = isDomMakerNeeded(clusterIcon) ? H.map.DomMarker : H.map.Marker;\n\n const clusterMarker = new MarkerConstructor(cluster.getPosition(), {\n icon: clusterIcon,\n\n // Set min/max zoom with values from the cluster, otherwise\n // clusters will be shown at all zoom levels\n min: cluster.getMinZoom(),\n max: cluster.getMaxZoom(),\n });\n\n // Bind cluster data to the marker\n clusterMarker.setData(cluster);\n\n return clusterMarker;\n };\n};\n\nconst wrapNoisePresentation = <T>(func: (data: T, position: H.geo.Point) => H.map.Object | MarkerIcon) => {\n return (noisePoint: NoisePoint): H.map.Marker => {\n const presentation = func(noisePoint.getData(), noisePoint.getPosition());\n if (presentation instanceof H.map.Object) {\n return presentation as H.map.Marker;\n }\n\n const noiseIcon = getOrCreateIcon(presentation);\n const MarkerConstructor = isDomMakerNeeded(noiseIcon) ? H.map.DomMarker : H.map.Marker;\n\n const noiseMarker = new MarkerConstructor(noisePoint.getPosition(), {\n icon: noiseIcon,\n\n // Use min zoom from a noise point to show it correctly at certain zoom levels\n min: noisePoint.getMinZoom(),\n });\n\n // Bind noise point data to the marker:\n noiseMarker.setData(noisePoint);\n\n return noiseMarker;\n };\n};\n\nexport const wrapSimpleTheme = (theme: SimpleClusterTheme): ClusterTheme => ({\n getClusterPresentation: wrapClusterPresentation(theme.getClusterPresentation),\n getNoisePresentation: wrapNoisePresentation(theme.getNoisePresentation),\n});\n"],"names":["getBoundingBoxForCluster","cluster","minLat","minLng","maxLat","maxLng","dataPoint","position","ClusterUtils","wrapClusterPresentation","func","clusterElements","point","presentation","clusterIcon","getOrCreateIcon","MarkerConstructor","isDomMakerNeeded","clusterMarker","wrapNoisePresentation","noisePoint","noiseIcon","noiseMarker","wrapSimpleTheme","theme"],"mappings":";AAeA,MAAMA,IAA2B,CAACC,MAAiC;AAC/D,MAAIC,IAAwB,MACxBC,IAAwB,MACxBC,IAAwB,MACxBC,IAAwB;AAE5B,SAAAJ,EAAQ,iBAAiB,CAACK,MAA0B;AAChD,UAAMC,IAAWD,EAAU,YAAA;AAC3B,KAAIJ,MAAW,QAAQA,IAASK,EAAS,SACrCL,IAASK,EAAS,OAElBJ,MAAW,QAAQA,IAASI,EAAS,SACrCJ,IAASI,EAAS,OAElBH,MAAW,QAAQA,IAASG,EAAS,SACrCH,IAASG,EAAS,OAElBF,MAAW,QAAQA,IAASE,EAAS,SACrCF,IAASE,EAAS;AAAA,EAE1B,CAAC,GAEM,IAAI,EAAE,IAAI;AAAA,IACbH;AAAA,IACAD;AAAA,IACAD;AAAA,IACAG;AAAA,EAAA;AAER,GAEaG,IAAe;AAAA,EACxB,0BAAAR;AACJ,GAEMS,IAA0B,CAC5BC,MAEO,CAACT,MAAmC;AACvC,QAAMU,IAAuB,CAAA;AAE7B,EAAAV,EAAQ,iBAAiB,CAACW,MAAsBD,EAAgB,KAAKC,EAAM,QAAA,CAAS,CAAC;AAErF,QAAMC,IAAeH,EAAKC,GAAiBV,EAAQ,aAAa;AAChE,MAAIY,aAAwB,EAAE,IAAI;AAC9B,WAAOA;AAGX,QAAMC,IAAcC,EAAgBF,CAAY,GAC1CG,IAAoBC,EAAiBH,CAAW,IAAI,EAAE,IAAI,YAAY,EAAE,IAAI,QAE5EI,IAAgB,IAAIF,EAAkBf,EAAQ,eAAe;AAAA,IAC/D,MAAMa;AAAA;AAAA;AAAA,IAIN,KAAKb,EAAQ,WAAA;AAAA,IACb,KAAKA,EAAQ,WAAA;AAAA,EAAW,CAC3B;AAGD,SAAAiB,EAAc,QAAQjB,CAAO,GAEtBiB;AACX,GAGEC,IAAwB,CAAIT,MACvB,CAACU,MAAyC;AAC7C,QAAMP,IAAeH,EAAKU,EAAW,WAAWA,EAAW,aAAa;AACxE,MAAIP,aAAwB,EAAE,IAAI;AAC9B,WAAOA;AAGX,QAAMQ,IAAYN,EAAgBF,CAAY,GACxCG,IAAoBC,EAAiBI,CAAS,IAAI,EAAE,IAAI,YAAY,EAAE,IAAI,QAE1EC,IAAc,IAAIN,EAAkBI,EAAW,eAAe;AAAA,IAChE,MAAMC;AAAA;AAAA,IAGN,KAAKD,EAAW,WAAA;AAAA,EAAW,CAC9B;AAGD,SAAAE,EAAY,QAAQF,CAAU,GAEvBE;AACX,GAGSC,IAAkB,CAACC,OAA6C;AAAA,EACzE,wBAAwBf,EAAwBe,EAAM,sBAAsB;AAAA,EAC5E,sBAAsBL,EAAsBK,EAAM,oBAAoB;AAC1E;"}
1
+ {"version":3,"file":"clustering.js","sources":["../../../../src/components/map/utils/clustering.ts"],"sourcesContent":["import { getOrCreateIcon, isDomMakerNeeded, type MarkerIcon } from '../components/features/basics/Marker';\nimport type { ClusterTheme } from '../components/features/layers/clustering/ClusterLayer';\n\nexport type Cluster = H.clustering.ICluster;\nexport type DataPoint = H.clustering.DataPoint;\nexport type NoisePoint = H.clustering.INoisePoint;\n\nexport type Theme = H.clustering.ITheme | undefined;\n\n// biome-ignore lint/suspicious/noExplicitAny: keep it less strict\nexport type SimpleClusterTheme<T = any> = {\n getClusterPresentation: (data: T[], position: H.geo.Point) => H.map.Object | MarkerIcon;\n getNoisePresentation: (data: T, position: H.geo.Point) => H.map.Object | MarkerIcon;\n};\n\nconst getBoundingBoxForCluster = (cluster: Cluster): H.geo.Rect => {\n let minLat: number | null = null;\n let minLng: number | null = null;\n let maxLat: number | null = null;\n let maxLng: number | null = null;\n\n cluster.forEachDataPoint((dataPoint: NoisePoint) => {\n const position = dataPoint.getPosition();\n if (minLat === null || minLat > position.lat) {\n minLat = position.lat;\n }\n if (minLng === null || minLng > position.lng) {\n minLng = position.lng;\n }\n if (maxLat === null || maxLat < position.lat) {\n maxLat = position.lat;\n }\n if (maxLng === null || maxLng < position.lng) {\n maxLng = position.lng;\n }\n });\n\n return new H.geo.Rect(\n maxLat as unknown as number,\n minLng as unknown as number,\n minLat as unknown as number,\n maxLng as unknown as number\n );\n};\n\nexport const ClusterUtils = {\n getBoundingBoxForCluster,\n};\n\nconst wrapClusterPresentation = <T>(\n func: (clusterElements: T[], position: H.geo.Point) => H.map.Object | MarkerIcon,\n cacheEnabled?: boolean\n) => {\n return (cluster: Cluster): H.map.Marker => {\n const clusterElements: T[] = [];\n\n cluster.forEachDataPoint((point: NoisePoint) => clusterElements.push(point.getData()));\n\n const presentation = func(clusterElements, cluster.getPosition());\n if (presentation instanceof H.map.Object) {\n return presentation as H.map.Marker;\n }\n\n const clusterIcon = getOrCreateIcon(presentation, { cacheEnabled });\n const MarkerConstructor = isDomMakerNeeded(clusterIcon) ? H.map.DomMarker : H.map.Marker;\n\n const clusterMarker = new MarkerConstructor(cluster.getPosition(), {\n icon: clusterIcon,\n\n // Set min/max zoom with values from the cluster, otherwise\n // clusters will be shown at all zoom levels\n min: cluster.getMinZoom(),\n max: cluster.getMaxZoom(),\n });\n\n // Bind cluster data to the marker\n clusterMarker.setData(cluster);\n\n return clusterMarker;\n };\n};\n\nconst wrapNoisePresentation = <T>(\n func: (data: T, position: H.geo.Point) => H.map.Object | MarkerIcon,\n cacheEnabled?: boolean\n) => {\n return (noisePoint: NoisePoint): H.map.Marker => {\n const presentation = func(noisePoint.getData(), noisePoint.getPosition());\n if (presentation instanceof H.map.Object) {\n return presentation as H.map.Marker;\n }\n\n const noiseIcon = getOrCreateIcon(presentation, { cacheEnabled });\n const MarkerConstructor = isDomMakerNeeded(noiseIcon) ? H.map.DomMarker : H.map.Marker;\n\n const noiseMarker = new MarkerConstructor(noisePoint.getPosition(), {\n icon: noiseIcon,\n\n // Use min zoom from a noise point to show it correctly at certain zoom levels\n min: noisePoint.getMinZoom(),\n });\n\n // Bind noise point data to the marker:\n noiseMarker.setData(noisePoint);\n\n return noiseMarker;\n };\n};\n\nexport const wrapSimpleTheme = (theme: SimpleClusterTheme, cacheEnabled?: boolean): ClusterTheme => ({\n getClusterPresentation: wrapClusterPresentation(theme.getClusterPresentation, cacheEnabled),\n getNoisePresentation: wrapNoisePresentation(theme.getNoisePresentation, cacheEnabled),\n});\n"],"names":["getBoundingBoxForCluster","cluster","minLat","minLng","maxLat","maxLng","dataPoint","position","ClusterUtils","wrapClusterPresentation","func","cacheEnabled","clusterElements","point","presentation","clusterIcon","getOrCreateIcon","MarkerConstructor","isDomMakerNeeded","clusterMarker","wrapNoisePresentation","noisePoint","noiseIcon","noiseMarker","wrapSimpleTheme","theme"],"mappings":";AAeA,MAAMA,IAA2B,CAACC,MAAiC;AAC/D,MAAIC,IAAwB,MACxBC,IAAwB,MACxBC,IAAwB,MACxBC,IAAwB;AAE5B,SAAAJ,EAAQ,iBAAiB,CAACK,MAA0B;AAChD,UAAMC,IAAWD,EAAU,YAAA;AAC3B,KAAIJ,MAAW,QAAQA,IAASK,EAAS,SACrCL,IAASK,EAAS,OAElBJ,MAAW,QAAQA,IAASI,EAAS,SACrCJ,IAASI,EAAS,OAElBH,MAAW,QAAQA,IAASG,EAAS,SACrCH,IAASG,EAAS,OAElBF,MAAW,QAAQA,IAASE,EAAS,SACrCF,IAASE,EAAS;AAAA,EAE1B,CAAC,GAEM,IAAI,EAAE,IAAI;AAAA,IACbH;AAAA,IACAD;AAAA,IACAD;AAAA,IACAG;AAAA,EAAA;AAER,GAEaG,IAAe;AAAA,EACxB,0BAAAR;AACJ,GAEMS,IAA0B,CAC5BC,GACAC,MAEO,CAACV,MAAmC;AACvC,QAAMW,IAAuB,CAAA;AAE7B,EAAAX,EAAQ,iBAAiB,CAACY,MAAsBD,EAAgB,KAAKC,EAAM,QAA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