@@ -3,30 +3,31 @@ export type Point = {
33 lat : number ;
44 lng : number ;
55} ;
6- export type MarkerDefinition < MarkerOptions , InfoWindowOptions > = {
7- '@id' : string ;
6+ export type Identifier = string ;
7+ export type WithIdentifier < T extends Record < string , unknown > > = T & {
8+ '@id' : Identifier ;
9+ } ;
10+ export type MarkerDefinition < MarkerOptions , InfoWindowOptions > = WithIdentifier < {
811 position : Point ;
912 title : string | null ;
10- infoWindow ?: Omit < InfoWindowDefinition < InfoWindowOptions > , 'position' > ;
13+ infoWindow ?: InfoWindowWithoutPositionDefinition < InfoWindowOptions > ;
1114 rawOptions ?: MarkerOptions ;
1215 extra : Record < string , unknown > ;
13- } ;
14- export type PolygonDefinition < PolygonOptions , InfoWindowOptions > = {
15- '@id' : string ;
16- infoWindow ?: Omit < InfoWindowDefinition < InfoWindowOptions > , 'position' > ;
16+ } > ;
17+ export type PolygonDefinition < PolygonOptions , InfoWindowOptions > = WithIdentifier < {
18+ infoWindow ?: InfoWindowWithoutPositionDefinition < InfoWindowOptions > ;
1719 points : Array < Point > ;
1820 title : string | null ;
1921 rawOptions ?: PolygonOptions ;
2022 extra : Record < string , unknown > ;
21- } ;
22- export type PolylineDefinition < PolylineOptions , InfoWindowOptions > = {
23- '@id' : string ;
24- infoWindow ?: Omit < InfoWindowDefinition < InfoWindowOptions > , 'position' > ;
23+ } > ;
24+ export type PolylineDefinition < PolylineOptions , InfoWindowOptions > = WithIdentifier < {
25+ infoWindow ?: InfoWindowWithoutPositionDefinition < InfoWindowOptions > ;
2526 points : Array < Point > ;
2627 title : string | null ;
2728 rawOptions ?: PolylineOptions ;
2829 extra : Record < string , unknown > ;
29- } ;
30+ } > ;
3031export type InfoWindowDefinition < InfoWindowOptions > = {
3132 headerContent : string | null ;
3233 content : string | null ;
@@ -36,6 +37,7 @@ export type InfoWindowDefinition<InfoWindowOptions> = {
3637 rawOptions ?: InfoWindowOptions ;
3738 extra : Record < string , unknown > ;
3839} ;
40+ export type InfoWindowWithoutPositionDefinition < InfoWindowOptions > = Omit < InfoWindowDefinition < InfoWindowOptions > , 'position' > ;
3941export default abstract class < MapOptions , Map , MarkerOptions , Marker , InfoWindowOptions , InfoWindow , PolygonOptions , Polygon , PolylineOptions , Polyline > extends Controller < HTMLElement > {
4042 static values : {
4143 providerOptions : ObjectConstructor ;
@@ -55,50 +57,39 @@ export default abstract class<MapOptions, Map, MarkerOptions, Marker, InfoWindow
5557 polylinesValue: Array < PolylineDefinition < PolylineOptions , InfoWindowOptions > > ;
5658 optionsValue: MapOptions ;
5759 protected map : Map ;
58- protected markers : globalThis . Map < any , any > ;
60+ protected markers : globalThis . Map < string , Marker > ;
61+ protected polygons : globalThis . Map < string , Polygon > ;
62+ protected polylines: globalThis . Map < string , Polyline > ;
5963 protected infoWindows: Array < InfoWindow > ;
60- protected polygons : globalThis . Map < any , any > ;
61- protected polylines: globalThis . Map < any , any > ;
64+ private isConnected ;
65+ protected abstract dispatchEvent ( name : string , payload : Record < string , unknown > ) : void ;
6266 connect ( ) : void ;
67+ createMarker ( definition : MarkerDefinition < MarkerOptions , InfoWindowOptions > ) : Marker ;
68+ createPolygon ( definition : PolygonDefinition < PolygonOptions , InfoWindowOptions > ) : Polygon ;
69+ createPolyline ( definition : PolylineDefinition < PolylineOptions , InfoWindowOptions > ) : Polyline ;
70+ createInfoWindow ( { definition, element, } : {
71+ definition : InfoWindowWithoutPositionDefinition < InfoWindowOptions > ;
72+ element: Marker | Polygon | Polyline ;
73+ } ) : InfoWindow ;
74+ abstract centerValueChanged ( ) : void ;
75+ abstract zoomValueChanged ( ) : void ;
76+ markersValueChanged ( ) : void ;
77+ polygonsValueChanged ( ) : void ;
78+ polylinesValueChanged ( ) : void ;
6379 protected abstract doCreateMap ( { center, zoom, options, } : {
6480 center : Point | null ;
6581 zoom: number | null ;
6682 options: MapOptions ;
6783 } ) : Map ;
68- createMarker ( definition : MarkerDefinition < MarkerOptions , InfoWindowOptions > ) : Marker ;
69- protected abstract removeMarker ( marker : Marker ) : void ;
84+ protected abstract doFitBoundsToMarkers ( ) : void ;
7085 protected abstract doCreateMarker ( definition : MarkerDefinition < MarkerOptions , InfoWindowOptions > ) : Marker ;
71- createPolygon ( definition : PolygonDefinition < PolygonOptions , InfoWindowOptions > ) : Polygon ;
72- protected abstract removePolygon ( polygon : Polygon ) : void ;
86+ protected abstract doRemoveMarker ( marker : Marker ) : void ;
7387 protected abstract doCreatePolygon ( definition : PolygonDefinition < PolygonOptions , InfoWindowOptions > ) : Polygon ;
74- createPolyline ( definition : PolylineDefinition < PolylineOptions , InfoWindowOptions > ) : Polyline ;
75- protected abstract removePolyline ( polyline : Polyline ) : void ;
88+ protected abstract doRemovePolygon ( polygon : Polygon ) : void ;
7689 protected abstract doCreatePolyline ( definition : PolylineDefinition < PolylineOptions , InfoWindowOptions > ) : Polyline ;
77- protected createInfoWindow ( { definition, element, } : {
78- definition : MarkerDefinition < MarkerOptions , InfoWindowOptions > [ 'infoWindow' ] ;
79- element: Marker ;
80- } | {
81- definition: PolygonDefinition < PolygonOptions , InfoWindowOptions > [ 'infoWindow' ] ;
82- element: Polygon ;
83- } | {
84- definition: PolylineDefinition < PolylineOptions , InfoWindowOptions > [ 'infoWindow' ] ;
85- element: Polyline ;
86- } ) : InfoWindow ;
90+ protected abstract doRemovePolyline ( polyline : Polyline ) : void ;
8791 protected abstract doCreateInfoWindow ( { definition, element, } : {
88- definition : MarkerDefinition < MarkerOptions , InfoWindowOptions > [ 'infoWindow' ] ;
89- element: Marker ;
90- } | {
91- definition: PolygonDefinition < PolygonOptions , InfoWindowOptions > [ 'infoWindow' ] ;
92- element: Polygon ;
93- } | {
94- definition: PolylineDefinition < PolylineOptions , InfoWindowOptions > [ 'infoWindow' ] ;
95- element: Polyline ;
92+ definition : InfoWindowWithoutPositionDefinition < InfoWindowOptions > ;
93+ element: Marker | Polygon | Polyline ;
9694 } ) : InfoWindow ;
97- protected abstract doFitBoundsToMarkers ( ) : void ;
98- protected abstract dispatchEvent ( name : string , payload : Record < string , unknown > ) : void ;
99- abstract centerValueChanged ( ) : void ;
100- abstract zoomValueChanged ( ) : void ;
101- markersValueChanged ( ) : void ;
102- polygonsValueChanged ( ) : void ;
103- polylinesValueChanged ( ) : void ;
10495}
0 commit comments