gta-v-map 2.0.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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +47 -0
  3. package/dist/components/gta-v-map.d.ts +126 -0
  4. package/dist/components/gta-v-map.d.ts.map +1 -0
  5. package/dist/components/gta-v-map.styles.d.ts +3 -0
  6. package/dist/components/gta-v-map.styles.d.ts.map +1 -0
  7. package/dist/components/index.d.ts +2 -0
  8. package/dist/components/index.d.ts.map +1 -0
  9. package/dist/constants/crs.constants.d.ts +9 -0
  10. package/dist/constants/crs.constants.d.ts.map +1 -0
  11. package/dist/constants/index.d.ts +5 -0
  12. package/dist/constants/index.d.ts.map +1 -0
  13. package/dist/constants/map.constants.d.ts +14 -0
  14. package/dist/constants/map.constants.d.ts.map +1 -0
  15. package/dist/constants/tile.constants.d.ts +8 -0
  16. package/dist/constants/tile.constants.d.ts.map +1 -0
  17. package/dist/constants/water.constants.d.ts +5 -0
  18. package/dist/constants/water.constants.d.ts.map +1 -0
  19. package/dist/gta-v-map.es.js +8544 -0
  20. package/dist/gta-v-map.umd.js +59 -0
  21. package/dist/index.d.ts +7 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/types/event.types.d.ts +28 -0
  24. package/dist/types/event.types.d.ts.map +1 -0
  25. package/dist/types/index.d.ts +6 -0
  26. package/dist/types/index.d.ts.map +1 -0
  27. package/dist/types/map.types.d.ts +13 -0
  28. package/dist/types/map.types.d.ts.map +1 -0
  29. package/dist/types/marker.types.d.ts +27 -0
  30. package/dist/types/marker.types.d.ts.map +1 -0
  31. package/dist/types/shape.types.d.ts +44 -0
  32. package/dist/types/shape.types.d.ts.map +1 -0
  33. package/dist/utils/crs.utils.d.ts +8 -0
  34. package/dist/utils/crs.utils.d.ts.map +1 -0
  35. package/dist/utils/id.utils.d.ts +3 -0
  36. package/dist/utils/id.utils.d.ts.map +1 -0
  37. package/dist/utils/index.d.ts +5 -0
  38. package/dist/utils/index.d.ts.map +1 -0
  39. package/dist/utils/marker.utils.d.ts +25 -0
  40. package/dist/utils/marker.utils.d.ts.map +1 -0
  41. package/dist/utils/shape.utils.d.ts +35 -0
  42. package/dist/utils/shape.utils.d.ts.map +1 -0
  43. package/package.json +56 -0
@@ -0,0 +1,7 @@
1
+ export { GtaVMap } from './components/index.js';
2
+ export type { GtaMarker, GtaMarkerEntry, GtaShape, GtaShapeEntry, ShapeLabel, MapStyle, LatLngBoundsTuple, TileConfig, MapClickDetail, MarkerClickDetail, MarkerPlacedDetail, MapReadyDetail, GtaVMapEventMap, } from './types/index.js';
3
+ export { SHAPE_DEFAULTS } from './types/index.js';
4
+ export { WATER_COLOR, WATER_TILE_DATA_URI, TILE_CONFIGS, STYLE_LABELS, MAP_STYLES, DEFAULT_MAP_CONFIG, GTA_CRS_CONFIG, } from './constants/index.js';
5
+ export { createGtaCRS, generateId, upsertMarkerEntry, updateLeafletMarker, DEFAULT_MARKER_GROUP, } from './utils/index.js';
6
+ export { createShapeEntry, upsertShapeEntry, computeCentroid, createLabelIcon, } from './utils/shape.utils.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGhD,YAAY,EACV,SAAS,EACT,cAAc,EACd,QAAQ,EACR,aAAa,EACb,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,eAAe,GAChB,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type L from 'leaflet';
2
+ import type { GtaMarker } from './marker.types.js';
3
+ /** Payload emitted when the map background is clicked. */
4
+ export interface MapClickDetail {
5
+ readonly x: number;
6
+ readonly y: number;
7
+ }
8
+ /** Payload emitted when a marker is clicked. */
9
+ export interface MarkerClickDetail extends GtaMarker {
10
+ readonly id: string;
11
+ }
12
+ /** Payload emitted in place-mode when a position is selected. */
13
+ export interface MarkerPlacedDetail {
14
+ readonly x: number;
15
+ readonly y: number;
16
+ }
17
+ /** Payload emitted once the Leaflet map instance is ready. */
18
+ export interface MapReadyDetail {
19
+ readonly map: L.Map;
20
+ }
21
+ /** Custom event map for the `<gta-v-map>` element. */
22
+ export interface GtaVMapEventMap {
23
+ 'map-ready': CustomEvent<MapReadyDetail>;
24
+ 'map-click': CustomEvent<MapClickDetail>;
25
+ 'marker-click': CustomEvent<MarkerClickDetail>;
26
+ 'marker-placed': CustomEvent<MarkerPlacedDetail>;
27
+ }
28
+ //# sourceMappingURL=event.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event.types.d.ts","sourceRoot":"","sources":["../../src/types/event.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,0DAA0D;AAC1D,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,gDAAgD;AAChD,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IAClD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED,iEAAiE;AACjE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,8DAA8D;AAC9D,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC;CACrB;AAED,sDAAsD;AACtD,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC;IACzC,WAAW,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC;IACzC,cAAc,EAAE,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAC/C,eAAe,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC;CAClD"}
@@ -0,0 +1,6 @@
1
+ export type { GtaMarker, GtaMarkerEntry } from './marker.types.js';
2
+ export type { MapStyle, LatLngBoundsTuple, TileConfig } from './map.types.js';
3
+ export type { MapClickDetail, MarkerClickDetail, MarkerPlacedDetail, MapReadyDetail, GtaVMapEventMap, } from './event.types.js';
4
+ export type { GtaShape, GtaShapeEntry, ShapeLabel } from './shape.types.js';
5
+ export { SHAPE_DEFAULTS } from './shape.types.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnE,YAAY,EAAE,QAAQ,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC9E,YAAY,EACV,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /** Available visual styles for the GTA V map. */
2
+ export type MapStyle = 'satellite' | 'atlas' | 'grid';
3
+ /** Bounding box expressed as [[south, west], [north, east]]. */
4
+ export type LatLngBoundsTuple = [[number, number], [number, number]];
5
+ /** Configuration for a single tile layer style. */
6
+ export interface TileConfig {
7
+ readonly url: string;
8
+ readonly minZoom: number;
9
+ readonly maxZoom: number;
10
+ readonly extension: string;
11
+ readonly folder: string;
12
+ }
13
+ //# sourceMappingURL=map.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map.types.d.ts","sourceRoot":"","sources":["../../src/types/map.types.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAEtD,gEAAgE;AAChE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAErE,mDAAmD;AACnD,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB"}
@@ -0,0 +1,27 @@
1
+ import type L from 'leaflet';
2
+ /** Input marker definition provided by the consumer. */
3
+ export interface GtaMarker {
4
+ /** X coordinate (longitude) in GTA V game units. */
5
+ x: number;
6
+ /** Y coordinate (latitude) in GTA V game units. */
7
+ y: number;
8
+ /** Blip icon number corresponding to a sprite in the blips folder. */
9
+ icon: number;
10
+ /** Accepts plain text or HTML strings */
11
+ popup?: string;
12
+ /** Optional consumer-provided id. If omitted, auto-generated. */
13
+ id?: string;
14
+ /** Optional group name. Markers in the same group share a layer toggle in the control. Defaults to "Markers". */
15
+ group?: string;
16
+ }
17
+ /** Internal marker entry with a guaranteed id, group, and optional Leaflet instance. */
18
+ export interface GtaMarkerEntry {
19
+ readonly id: string;
20
+ x: number;
21
+ y: number;
22
+ icon: number;
23
+ popup?: string;
24
+ group: string;
25
+ _leaflet?: L.Marker;
26
+ }
27
+ //# sourceMappingURL=marker.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marker.types.d.ts","sourceRoot":"","sources":["../../src/types/marker.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,wDAAwD;AACxD,MAAM,WAAW,SAAS;IACxB,oDAAoD;IACpD,CAAC,EAAE,MAAM,CAAC;IACV,mDAAmD;IACnD,CAAC,EAAE,MAAM,CAAC;IACV,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,iHAAiH;IACjH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wFAAwF;AACxF,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC;CACrB"}
@@ -0,0 +1,44 @@
1
+ import type L from 'leaflet';
2
+ /** Configuration for a text label displayed at a shape's centroid. */
3
+ export interface ShapeLabel {
4
+ text: string;
5
+ className?: string;
6
+ fontSize?: number;
7
+ color?: string;
8
+ }
9
+ /** Input shape definition provided by the consumer. */
10
+ export interface GtaShape {
11
+ type: 'polyline' | 'polygon';
12
+ points: [number, number][];
13
+ color?: string;
14
+ weight?: number;
15
+ opacity?: number;
16
+ fillColor?: string;
17
+ fillOpacity?: number;
18
+ popup?: string;
19
+ group?: string;
20
+ id?: string;
21
+ label?: ShapeLabel;
22
+ }
23
+ /** Internal shape entry with defaults applied and optional Leaflet instances. */
24
+ export interface GtaShapeEntry extends Required<Pick<GtaShape, 'type' | 'points' | 'id' | 'group'>> {
25
+ color: string;
26
+ weight: number;
27
+ opacity: number;
28
+ fillColor: string;
29
+ fillOpacity: number;
30
+ popup?: string;
31
+ label?: ShapeLabel;
32
+ _leaflet?: L.Polyline | L.Polygon;
33
+ _labelMarker?: L.Marker;
34
+ }
35
+ /** Default style values applied to shapes when the consumer omits them. */
36
+ export declare const SHAPE_DEFAULTS: {
37
+ readonly color: "#3388ff";
38
+ readonly weight: 3;
39
+ readonly opacity: 1;
40
+ readonly fillColor: "#3388ff";
41
+ readonly fillOpacity: 0.2;
42
+ readonly group: "Shapes";
43
+ };
44
+ //# sourceMappingURL=shape.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shape.types.d.ts","sourceRoot":"","sources":["../../src/types/shape.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,sEAAsE;AACtE,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,uDAAuD;AACvD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;IAC7B,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAED,iFAAiF;AACjF,MAAM,WAAW,aAAc,SAAQ,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,GAAG,OAAO,CAAC,CAAC;IACjG,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,OAAO,CAAC;IAClC,YAAY,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC;CACzB;AAED,2EAA2E;AAC3E,eAAO,MAAM,cAAc;;;;;;;CAOjB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import L from 'leaflet';
2
+ /**
3
+ * Creates a custom CRS for GTA V map coordinates.
4
+ * Uses Object.assign intentionally — L.CRS.Simple is a Leaflet CRS object
5
+ * that requires prototype chain preservation, which spread syntax cannot provide.
6
+ */
7
+ export declare function createGtaCRS(): L.CRS;
8
+ //# sourceMappingURL=crs.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crs.utils.d.ts","sourceRoot":"","sources":["../../src/utils/crs.utils.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,SAAS,CAAC;AAGxB;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,CAAC,CAAC,GAAG,CAkBpC"}
@@ -0,0 +1,3 @@
1
+ /** Generates a random UUID v4 string. */
2
+ export declare function generateId(): string;
3
+ //# sourceMappingURL=id.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id.utils.d.ts","sourceRoot":"","sources":["../../src/utils/id.utils.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,wBAAgB,UAAU,IAAI,MAAM,CAEnC"}
@@ -0,0 +1,5 @@
1
+ export { generateId } from './id.utils.js';
2
+ export { createGtaCRS } from './crs.utils.js';
3
+ export { upsertMarkerEntry, updateLeafletMarker, DEFAULT_MARKER_GROUP } from './marker.utils.js';
4
+ export { createShapeEntry, upsertShapeEntry, computeCentroid, createLabelIcon } from './shape.utils.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACjG,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,25 @@
1
+ import L from 'leaflet';
2
+ import type { GtaMarker, GtaMarkerEntry } from '../types/index.js';
3
+ /** Fallback group name when a marker has no explicit group. */
4
+ export declare const DEFAULT_MARKER_GROUP = "Markers";
5
+ /**
6
+ * Creates or updates a marker entry.
7
+ * If an entry with the same id exists, updates it in place and returns it.
8
+ * Otherwise creates a new entry.
9
+ *
10
+ * @param entries - Mutable array of existing marker entries.
11
+ * @param marker - The consumer-provided marker to upsert.
12
+ * @returns The resolved entry and whether it was an update.
13
+ */
14
+ export declare function upsertMarkerEntry(entries: GtaMarkerEntry[], marker: GtaMarker): {
15
+ entry: GtaMarkerEntry;
16
+ isUpdate: boolean;
17
+ };
18
+ /**
19
+ * Updates a Leaflet marker's position, icon, and popup to match the entry.
20
+ *
21
+ * @param entry - The marker entry whose `_leaflet` instance should be updated.
22
+ * @param createIcon - Factory that returns a Leaflet Icon for the given icon number.
23
+ */
24
+ export declare function updateLeafletMarker(entry: GtaMarkerEntry, createIcon: (iconNum: number) => L.Icon): void;
25
+ //# sourceMappingURL=marker.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marker.utils.d.ts","sourceRoot":"","sources":["../../src/utils/marker.utils.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,SAAS,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnE,+DAA+D;AAC/D,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAE9C;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,cAAc,EAAE,EACzB,MAAM,EAAE,SAAS,GAChB;IAAE,KAAK,EAAE,cAAc,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAwB9C;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,cAAc,EACrB,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,CAAC,CAAC,IAAI,GACtC,IAAI,CAYN"}
@@ -0,0 +1,35 @@
1
+ import L from 'leaflet';
2
+ import type { GtaShape, GtaShapeEntry, ShapeLabel } from '../types/index.js';
3
+ /**
4
+ * Normalizes a GtaShape into a full GtaShapeEntry with defaults applied.
5
+ *
6
+ * @param shape - The consumer-provided shape definition.
7
+ * @returns A fully-resolved shape entry.
8
+ */
9
+ export declare function createShapeEntry(shape: GtaShape): GtaShapeEntry;
10
+ /**
11
+ * Upserts a shape entry into the entries array.
12
+ *
13
+ * @param entries - Mutable array of existing shape entries.
14
+ * @param shape - The consumer-provided shape to upsert.
15
+ * @returns The resolved entry and whether it was an update.
16
+ */
17
+ export declare function upsertShapeEntry(entries: GtaShapeEntry[], shape: GtaShape): {
18
+ entry: GtaShapeEntry;
19
+ isUpdate: boolean;
20
+ };
21
+ /**
22
+ * Computes the centroid (arithmetic mean) of a set of [x, y] points.
23
+ *
24
+ * @param points - Array of [x, y] coordinate pairs.
25
+ * @returns The centroid as [x, y]. Returns [0, 0] for an empty array.
26
+ */
27
+ export declare function computeCentroid(points: [number, number][]): [number, number];
28
+ /**
29
+ * Creates a Leaflet DivIcon for a shape label at the centroid.
30
+ *
31
+ * @param label - Label configuration (text, color, font size, etc.).
32
+ * @returns A zero-size DivIcon containing the styled label text.
33
+ */
34
+ export declare function createLabelIcon(label: ShapeLabel): L.DivIcon;
35
+ //# sourceMappingURL=shape.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shape.utils.d.ts","sourceRoot":"","sources":["../../src/utils/shape.utils.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,SAAS,CAAC;AACxB,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI7E;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,QAAQ,GAAG,aAAa,CAc/D;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,aAAa,EAAE,EACxB,KAAK,EAAE,QAAQ,GACd;IAAE,KAAK,EAAE,aAAa,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAe7C;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAU5E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,CAAC,CAAC,OAAO,CAiB5D"}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "gta-v-map",
3
+ "version": "2.0.0",
4
+ "description": "GTA V interactive map as a Lit web component",
5
+ "license": "MIT",
6
+ "author": "RiceaRaul",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/RiceaRaul/gta-v-map-leaflet.git"
10
+ },
11
+ "keywords": [
12
+ "gta",
13
+ "gta-v",
14
+ "map",
15
+ "leaflet",
16
+ "web-component",
17
+ "lit"
18
+ ],
19
+ "type": "module",
20
+ "main": "dist/gta-v-map.umd.js",
21
+ "module": "dist/gta-v-map.es.js",
22
+ "types": "dist/index.d.ts",
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "import": "./dist/gta-v-map.es.js",
27
+ "require": "./dist/gta-v-map.umd.js"
28
+ }
29
+ },
30
+ "files": [
31
+ "dist"
32
+ ],
33
+ "scripts": {
34
+ "dev": "vite",
35
+ "dev:react": "vite --config demo/react/vite.config.ts",
36
+ "build": "vite build && tsc --emitDeclarationOnly --outDir dist",
37
+ "preview": "vite preview"
38
+ },
39
+ "dependencies": {
40
+ "leaflet": "^1.7.0",
41
+ "leaflet.heat": "^0.2.0",
42
+ "leaflet.markercluster": "^1.5.3",
43
+ "lit": "^3.1.0"
44
+ },
45
+ "devDependencies": {
46
+ "@types/leaflet": "^1.9.0",
47
+ "@types/leaflet.markercluster": "^1.5.6",
48
+ "@types/react": "^19.2.14",
49
+ "@types/react-dom": "^19.2.3",
50
+ "@vitejs/plugin-react": "^4.7.0",
51
+ "react": "^19.2.4",
52
+ "react-dom": "^19.2.4",
53
+ "typescript": "^5.4.0",
54
+ "vite": "^5.4.0"
55
+ }
56
+ }