@ruckc/truss-ol 1.28.0 → 1.29.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/dist/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type OLMap from 'ol/Map.js';
1
2
  export type MarkerKind = 'neutral' | 'primary' | 'success' | 'warning' | 'danger';
2
3
  export type MapMarker = {
3
4
  id: string;
@@ -7,11 +8,18 @@ export type MapMarker = {
7
8
  description?: string;
8
9
  kind?: MarkerKind;
9
10
  };
10
- /** Basemap: OpenStreetMap tiles, none (themed graticule — works offline), or any XYZ tile source. */
11
+ /**
12
+ * Basemap: OpenStreetMap tiles (`'osm'`), none (themed graticule, works offline), any XYZ tile source, or
13
+ * `{ osm: true }` for OSM tiles with your own `attribution` and/or `maxZoom`.
14
+ */
11
15
  export type Basemap = 'osm' | 'none' | {
12
16
  url: string;
13
17
  attribution?: string;
14
18
  maxZoom?: number;
19
+ } | {
20
+ osm: true;
21
+ attribution?: string;
22
+ maxZoom?: number;
15
23
  };
16
24
  export type MapSelection = {
17
25
  type: 'marker';
@@ -21,3 +29,44 @@ export type MapSelection = {
21
29
  id?: string | number;
22
30
  properties: Record<string, unknown>;
23
31
  };
32
+ /** A GeoJSON or point feature as the popup and selection report it. */
33
+ export type MapFeatureInfo = {
34
+ /** The feature's `id` (GeoJSON `id`, `properties.id`, or a generated `geo:<n>` / `pt:<n>`). Selecting by it works through `selected`. */
35
+ id: string;
36
+ properties: Record<string, unknown>;
37
+ /** Where the popup is anchored. */
38
+ lonLat: [number, number];
39
+ };
40
+ /** The view as `getView()` reports it and `setView()` accepts. */
41
+ export type MapViewState = {
42
+ /** `[lon, lat]` */
43
+ center: [number, number];
44
+ zoom: number;
45
+ /** Visible lon/lat extent `[west, south, east, north]`. Read-only. */
46
+ extent?: [number, number, number, number];
47
+ };
48
+ export type FitOptions = {
49
+ /** Pixels kept free around the fitted extent. A number applies to all four sides. Default 56. */
50
+ padding?: number | [number, number, number, number];
51
+ /** Animation duration in ms; 0 jumps. Default 300. */
52
+ duration?: number;
53
+ /** Do not zoom closer than this. Default 12. */
54
+ maxZoom?: number;
55
+ };
56
+ /** What `fit()` accepts: a lon/lat extent `[west, south, east, north]`, an array of `{ lon, lat }` points (e.g. markers), or GeoJSON. Without an argument, everything on the map is fitted. */
57
+ export type FitTarget = [number, number, number, number] | {
58
+ lon: number;
59
+ lat: number;
60
+ }[] | object;
61
+ /** Imperative handle, passed to `onready` and available as methods on the component instance (`bind:this`). */
62
+ export type MapApi = {
63
+ /** The underlying OpenLayers map. */
64
+ map: OLMap;
65
+ fit(target?: FitTarget, options?: FitOptions): void;
66
+ setView(view: Partial<Pick<MapViewState, 'center' | 'zoom'>> & {
67
+ duration?: number;
68
+ }): void;
69
+ getView(): MapViewState;
70
+ /** Re-measure the container (call after resizing it yourself; the map already does this when its container resizes). */
71
+ updateSize(): void;
72
+ };
package/dist/util.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import type OLMap from 'ol/Map.js';
2
+ export * from './style.js';
3
+ export * from './points.js';
2
4
  /** Where a standalone control sits inside its (positioned) parent. `none` leaves placement to you. */
3
5
  export type ControlPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'none';
4
6
  export type ScaleUnit = 'metric' | 'imperial';
package/dist/util.js CHANGED
@@ -1,3 +1,5 @@
1
+ export * from './style.js';
2
+ export * from './points.js';
1
3
  const LADDER = {
2
4
  metric: [['km', 1000], ['m', 1], ['cm', 0.01]],
3
5
  imperial: [['mi', 1609.344], ['ft', 0.3048], ['in', 0.0254]]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ruckc/truss-ol",
3
- "version": "1.28.0",
3
+ "version": "1.29.0",
4
4
  "description": "OpenLayers map styled with Truss UI",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -8,7 +8,8 @@
8
8
  "package": "svelte-package -i src/lib -o dist"
9
9
  },
10
10
  "files": [
11
- "dist"
11
+ "dist",
12
+ "README.md"
12
13
  ],
13
14
  "sideEffects": [
14
15
  "**/*.css"