@optimum-intelligence/opti-ui 0.7.4 → 0.7.6

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/CHANGELOG.md CHANGED
@@ -3,6 +3,27 @@
3
3
  All notable changes to `@optimum-intelligence/opti-ui`. Versions follow [semver](https://semver.org/); while
4
4
  the version is `0.x`, minor releases may contain breaking changes, which are marked **Breaking**.
5
5
 
6
+ ## 0.7.6 (2026-11-05)
7
+
8
+ ### Added
9
+
10
+ - `Map.Points`: `labelMinZoom` (default 12). Below it labelled points draw as plain dots and the label layer
11
+ is skipped, so wide views of thousands of numbered stops stay readable and pan smoothly.
12
+ - `Map.Points`: optional `cluster` (`true` or `{ radius, maxZoom }`, off by default) merges nearby points into
13
+ count bubbles that split as you zoom in; clicking one zooms to where it splits. Bubbles never reach
14
+ `onItemClick`/`onItemHover`. New tokens `--oui-map-cluster-color` and `--oui-map-cluster-text-color`.
15
+
16
+ ### Changed
17
+
18
+ - `Map.Points`: labels are hidden below zoom 12 by default. Pass `labelMinZoom={0}` to always show them.
19
+
20
+ ## 0.7.5 (2026-11-05)
21
+
22
+ ### Fixed
23
+
24
+ - `Map.Routes`, `Map.Points`, `Map.Areas`: re-rendering with unchanged `items` no longer re-validates every
25
+ coordinate, recomputes bounds or rebuilds the GeoJSON source data, so dense tracks stay cheap to re-render.
26
+
6
27
  ## 0.7.4 (2026-11-04)
7
28
 
8
29
  ### Added
package/README.md CHANGED
@@ -245,7 +245,10 @@ the satellite layer in the showcase is for the demo only. Data parts (`Map.Route
245
245
  `Map.Points`) take arrays and draw each array as one layer set, so thousands of items are fine; their
246
246
  colours follow the `--oui-*` tokens and dark mode. `Map.Points` items with a `label` (such as stop numbers)
247
247
  draw it in the point; text needs a style with a `glyphs` URL, which OpenFreeMap styles and `rasterStyle()`
248
- provide (`rasterStyle` points at OpenFreeMap's font server unless you pass your own `glyphs` URL).
248
+ provide (`rasterStyle` points at OpenFreeMap's font server unless you pass your own `glyphs` URL). Labels
249
+ show from `labelMinZoom` (12 by default); below it the points are plain dots, so wide views stay readable
250
+ and fast. For dense data, `cluster` merges nearby points into count bubbles (`--oui-map-cluster-color`)
251
+ that split as you zoom in or click them.
249
252
 
250
253
  ## Customization
251
254
 
@@ -231,9 +231,29 @@ export interface MapPointItem {
231
231
  */
232
232
  label?: string | number;
233
233
  }
234
+ /** Clustering settings of `Map.Points`. */
235
+ export interface MapClusterOptions {
236
+ /** Distance in pixels within which points merge into one cluster. */
237
+ radius?: number;
238
+ /** Last zoom at which points are clustered; from the next zoom on every point is drawn on its own. */
239
+ maxZoom?: number;
240
+ }
234
241
  export interface MapPointsProps {
235
242
  /** Points to draw, all in one GeoJSON source and one circle layer. */
236
243
  items: MapPointItem[];
244
+ /**
245
+ * Zoom from which item `label`s are drawn. Below it labelled points render as plain dots and MapLibre
246
+ * skips the label layer, so wide views stay readable and pan as fast as unlabelled points. `0` always
247
+ * shows labels.
248
+ */
249
+ labelMinZoom?: number;
250
+ /**
251
+ * Merges nearby points into count bubbles that split as you zoom in, using MapLibre's built-in
252
+ * clustering; a click on a bubble zooms to where it splits. `true` uses a 50 px radius up to zoom 14.
253
+ * Bubbles are not items, so they never reach `onItemClick` or `onItemHover`, and a selected point inside
254
+ * one is not highlighted until it splits. The counts need a style with a `glyphs` URL, like `label`.
255
+ */
256
+ cluster?: boolean | MapClusterOptions;
237
257
  /** Ids of selected points. While it is not empty, other points fade to `--oui-map-dim-opacity`. */
238
258
  selectedIds?: string[];
239
259
  /** Called with the clicked point. */
@@ -243,8 +263,9 @@ export interface MapPointsProps {
243
263
  }
244
264
  /**
245
265
  * Many simple points (sensors, stops, events) as one circle layer. Items with a `label` get it drawn in
246
- * the circle by a symbol layer on the same source, so thousands of numbered stops stay fast. For a few
247
- * dozen styled pins with HTML content, use `Map.Marker` instead.
266
+ * the circle by a symbol layer on the same source from `labelMinZoom` on, so thousands of numbered stops
267
+ * stay fast. With `cluster`, dense areas become count bubbles. For a few dozen styled pins with HTML
268
+ * content, use `Map.Marker` instead.
248
269
  *
249
270
  * @example
250
271
  * <Map.Points items={sensors.map((s) => ({ id: s.id, coordinates: s.position, tone: s.ok ? 'success' : 'danger' }))} />
@@ -255,9 +276,14 @@ export interface MapPointsProps {
255
276
  * items={trucks.flatMap((truck, t) =>
256
277
  * truck.stops.map((stop, i) => ({ id: stop.id, coordinates: stop.position, colorIndex: t, label: i + 1 })),
257
278
  * )}
279
+ * labelMinZoom={11}
258
280
  * />
281
+ *
282
+ * @example
283
+ * // A fleet's stops over two months, merged into count bubbles at low zoom.
284
+ * <Map.Points items={stops} cluster={{ radius: 40 }} onItemClick={(stop) => setPicked(stop)} />
259
285
  */
260
- declare function MapPoints({ items, selectedIds, onItemClick, onItemHover }: MapPointsProps): React.JSX.Element;
286
+ declare function MapPoints({ items, selectedIds, labelMinZoom, cluster, onItemClick, onItemHover }: MapPointsProps): React.JSX.Element;
261
287
  export interface MapMarkerProps {
262
288
  /** `[longitude, latitude]` of the pin. */
263
289
  position: MapPosition;