@@ -43,9 +43,15 @@ export type MarkerDefinition<BridgeMarkerOptions, BridgeInfoWindowOptions> = Wit
4343 infoWindow ?: Omit < InfoWindowDefinition < BridgeInfoWindowOptions > , 'position' > ;
4444 icon ?: Icon ;
4545 /**
46+ * @deprecated Use "bridgeOptions" instead.
4647 * Raw options passed to the marker constructor, specific to the map provider (e.g.: `L.marker()` for Leaflet).
4748 */
4849 rawOptions ?: BridgeMarkerOptions ;
50+ /**
51+ * Additional options passed to the Marker constructor.
52+ * These options are specific to the Map Bridge, and can be defined through `ux:map:marker:before-create` event.
53+ */
54+ bridgeOptions ?: BridgeMarkerOptions ;
4955 /**
5056 * Extra data defined by the developer.
5157 * They are not directly used by the Stimulus controller, but they can be used by the developer with event listeners:
@@ -55,14 +61,20 @@ export type MarkerDefinition<BridgeMarkerOptions, BridgeInfoWindowOptions> = Wit
5561 extra : Record < string , unknown > ;
5662} > ;
5763
58- export type PolygonDefinition < PolygonOptions , BridgeInfoWindowOptions > = WithIdentifier < {
64+ export type PolygonDefinition < BridgePolygonOptions , BridgeInfoWindowOptions > = WithIdentifier < {
5965 infoWindow ?: Omit < InfoWindowDefinition < BridgeInfoWindowOptions > , 'position' > ;
6066 points : Array < Point > | Array < Array < Point > > ;
6167 title : string | null ;
6268 /**
63- * Raw options passed to the marker constructor, specific to the map provider (e.g.: `L.marker()` for Leaflet).
69+ * @deprecated Use "bridgeOptions" instead.
70+ * Raw options passed to the polygon constructor, specific to the map provider (e.g.: `L.polygon()` for Leaflet).
71+ */
72+ rawOptions ?: BridgePolygonOptions ;
73+ /**
74+ * Additional options passed to the Polygon constructor.
75+ * These options are specific to the Map Bridge, and can be defined through `ux:map:polygon:before-create` event.
6476 */
65- rawOptions ?: PolygonOptions ;
77+ bridgeOptions ?: BridgePolygonOptions ;
6678 /**
6779 * Extra data defined by the developer.
6880 * They are not directly used by the Stimulus controller, but they can be used by the developer with event listeners:
@@ -72,14 +84,20 @@ export type PolygonDefinition<PolygonOptions, BridgeInfoWindowOptions> = WithIde
7284 extra : Record < string , unknown > ;
7385} > ;
7486
75- export type PolylineDefinition < PolylineOptions , BridgeInfoWindowOptions > = WithIdentifier < {
87+ export type PolylineDefinition < BridgePolylineOptions , BridgeInfoWindowOptions > = WithIdentifier < {
7688 infoWindow ?: Omit < InfoWindowDefinition < BridgeInfoWindowOptions > , 'position' > ;
7789 points : Array < Point > ;
7890 title : string | null ;
7991 /**
80- * Raw options passed to the marker constructor, specific to the map provider (e.g.: `L.marker()` for Leaflet).
92+ * @deprecated Use "bridgeOptions" instead.
93+ * Raw options passed to the polyline constructor, specific to the map provider (e.g.: `L.polyline()` for Leaflet).
94+ */
95+ rawOptions ?: BridgePolylineOptions ;
96+ /**
97+ * Additional options passed to the Polyline constructor.
98+ * These options are specific to the Map Bridge, and can be defined through `ux:map:polyline:before-create` event.
8199 */
82- rawOptions ?: PolylineOptions ;
100+ bridgeOptions ?: BridgePolylineOptions ;
83101 /**
84102 * Extra data defined by the developer.
85103 * They are not directly used by the Stimulus controller, but they can be used by the developer with event listeners:
@@ -89,15 +107,21 @@ export type PolylineDefinition<PolylineOptions, BridgeInfoWindowOptions> = WithI
89107 extra : Record < string , unknown > ;
90108} > ;
91109
92- export type CircleDefinition < CircleOptions , BridgeInfoWindowOptions > = WithIdentifier < {
110+ export type CircleDefinition < BridgeCircleOptions , BridgeInfoWindowOptions > = WithIdentifier < {
93111 infoWindow ?: Omit < InfoWindowDefinition < BridgeInfoWindowOptions > , 'position' > ;
94112 center : Point ;
95113 radius : number ;
96114 title : string | null ;
97115 /**
116+ * @deprecated Use "bridgeOptions" instead.
98117 * Raw options passed to the circle constructor, specific to the map provider (e.g.: `L.circle()` for Leaflet).
99118 */
100- rawOptions ?: CircleOptions ;
119+ rawOptions ?: BridgeCircleOptions ;
120+ /**
121+ * Additional options passed to the Circle constructor.
122+ * These options are specific to the Map Bridge, and can be defined through `ux:map:circle:before-create` event.
123+ */
124+ bridgeOptions ?: BridgeCircleOptions ;
101125 /**
102126 * Extra data defined by the developer.
103127 * They are not directly used by the Stimulus controller, but they can be used by the developer with event listeners:
@@ -107,15 +131,21 @@ export type CircleDefinition<CircleOptions, BridgeInfoWindowOptions> = WithIdent
107131 extra : Record < string , unknown > ;
108132} > ;
109133
110- export type RectangleDefinition < RectangleOptions , BridgeInfoWindowOptions > = WithIdentifier < {
134+ export type RectangleDefinition < BridgeRectangleOptions , BridgeInfoWindowOptions > = WithIdentifier < {
111135 infoWindow ?: Omit < InfoWindowDefinition < BridgeInfoWindowOptions > , 'position' > ;
112136 southWest : Point ;
113137 northEast : Point ;
114138 title : string | null ;
115139 /**
140+ * @deprecated Use "bridgeOptions" instead.
116141 * Raw options passed to the rectangle constructor, specific to the map provider (e.g.: `L.rectangle()` for Leaflet).
117142 */
118- rawOptions ?: RectangleOptions ;
143+ rawOptions ?: BridgeRectangleOptions ;
144+ /**
145+ * Additional options passed to the Rectangle constructor.
146+ * These options are specific to the Map Bridge, and can be defined through `ux:map:rectangle:before-create` event.
147+ */
148+ bridgeOptions ?: BridgeRectangleOptions ;
119149 /**
120150 * Extra data defined by the developer.
121151 * They are not directly used by the Stimulus controller, but they can be used by the developer with event listeners:
@@ -132,10 +162,15 @@ export type InfoWindowDefinition<BridgeInfoWindowOptions> = {
132162 opened : boolean ;
133163 autoClose : boolean ;
134164 /**
135- * Raw options passed to the info window constructor,
136- * specific to the map provider (e.g.: `google.maps.InfoWindow()` for Google Maps).
165+ * @deprecated Use "bridgeOptions" instead.
166+ * Raw options passed to the info window constructor, specific to the map provider (e.g.: `google.maps.InfoWindow()` for Google Maps).
137167 */
138168 rawOptions ?: BridgeInfoWindowOptions ;
169+ /**
170+ * Additional options passed to the InfoWindow constructor.
171+ * These options are specific to the Map Bridge, and can be defined through `ux:map:info-window:before-create` event.
172+ */
173+ bridgeOptions ?: BridgeInfoWindowOptions ;
139174 /**
140175 * Extra data defined by the developer.
141176 * They are not directly used by the Stimulus controller, but they can be used by the developer with event listeners:
@@ -378,6 +413,14 @@ export default abstract class<
378413 // 'Factory' could be instantiated with an arbitrary type which could be unrelated to '({ definition }: { definition: WithIdentifier<any>; }) => Draw'
379414 return ( { definition } : { definition : WithIdentifier < any > } ) => {
380415 this . dispatchEvent ( eventBefore , { definition } ) ;
416+
417+ if ( typeof definition . rawOptions !== 'undefined' ) {
418+ console . warn (
419+ `[Symfony UX Map] The event "${ eventBefore } " added a deprecated "rawOptions" property to the definition, it will be removed in a next major version, replace it with "bridgeOptions" instead.` ,
420+ definition
421+ ) ;
422+ }
423+
381424 const drawing = factory ( { definition } ) as Draw ;
382425 this . dispatchEvent ( eventAfter , { [ type ] : drawing , definition } ) ;
383426
0 commit comments