@@ -43,9 +43,15 @@ export type MarkerDefinition<BridgeMarkerOptions, BridgeInfoWindowOptions> = Wit
43
43
infoWindow ?: Omit < InfoWindowDefinition < BridgeInfoWindowOptions > , 'position' > ;
44
44
icon ?: Icon ;
45
45
/**
46
+ * @deprecated Use "bridgeOptions" instead.
46
47
* Raw options passed to the marker constructor, specific to the map provider (e.g.: `L.marker()` for Leaflet).
47
48
*/
48
49
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 ;
49
55
/**
50
56
* Extra data defined by the developer.
51
57
* 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
55
61
extra : Record < string , unknown > ;
56
62
} > ;
57
63
58
- export type PolygonDefinition < PolygonOptions , BridgeInfoWindowOptions > = WithIdentifier < {
64
+ export type PolygonDefinition < BridgePolygonOptions , BridgeInfoWindowOptions > = WithIdentifier < {
59
65
infoWindow ?: Omit < InfoWindowDefinition < BridgeInfoWindowOptions > , 'position' > ;
60
66
points : Array < Point > | Array < Array < Point > > ;
61
67
title : string | null ;
62
68
/**
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.
64
76
*/
65
- rawOptions ?: PolygonOptions ;
77
+ bridgeOptions ?: BridgePolygonOptions ;
66
78
/**
67
79
* Extra data defined by the developer.
68
80
* 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
72
84
extra : Record < string , unknown > ;
73
85
} > ;
74
86
75
- export type PolylineDefinition < PolylineOptions , BridgeInfoWindowOptions > = WithIdentifier < {
87
+ export type PolylineDefinition < BridgePolylineOptions , BridgeInfoWindowOptions > = WithIdentifier < {
76
88
infoWindow ?: Omit < InfoWindowDefinition < BridgeInfoWindowOptions > , 'position' > ;
77
89
points : Array < Point > ;
78
90
title : string | null ;
79
91
/**
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.
81
99
*/
82
- rawOptions ?: PolylineOptions ;
100
+ bridgeOptions ?: BridgePolylineOptions ;
83
101
/**
84
102
* Extra data defined by the developer.
85
103
* 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
89
107
extra : Record < string , unknown > ;
90
108
} > ;
91
109
92
- export type CircleDefinition < CircleOptions , BridgeInfoWindowOptions > = WithIdentifier < {
110
+ export type CircleDefinition < BridgeCircleOptions , BridgeInfoWindowOptions > = WithIdentifier < {
93
111
infoWindow ?: Omit < InfoWindowDefinition < BridgeInfoWindowOptions > , 'position' > ;
94
112
center : Point ;
95
113
radius : number ;
96
114
title : string | null ;
97
115
/**
116
+ * @deprecated Use "bridgeOptions" instead.
98
117
* Raw options passed to the circle constructor, specific to the map provider (e.g.: `L.circle()` for Leaflet).
99
118
*/
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 ;
101
125
/**
102
126
* Extra data defined by the developer.
103
127
* 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
107
131
extra : Record < string , unknown > ;
108
132
} > ;
109
133
110
- export type RectangleDefinition < RectangleOptions , BridgeInfoWindowOptions > = WithIdentifier < {
134
+ export type RectangleDefinition < BridgeRectangleOptions , BridgeInfoWindowOptions > = WithIdentifier < {
111
135
infoWindow ?: Omit < InfoWindowDefinition < BridgeInfoWindowOptions > , 'position' > ;
112
136
southWest : Point ;
113
137
northEast : Point ;
114
138
title : string | null ;
115
139
/**
140
+ * @deprecated Use "bridgeOptions" instead.
116
141
* Raw options passed to the rectangle constructor, specific to the map provider (e.g.: `L.rectangle()` for Leaflet).
117
142
*/
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 ;
119
149
/**
120
150
* Extra data defined by the developer.
121
151
* 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> = {
132
162
opened : boolean ;
133
163
autoClose : boolean ;
134
164
/**
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).
137
167
*/
138
168
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 ;
139
174
/**
140
175
* Extra data defined by the developer.
141
176
* 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<
378
413
// 'Factory' could be instantiated with an arbitrary type which could be unrelated to '({ definition }: { definition: WithIdentifier<any>; }) => Draw'
379
414
return ( { definition } : { definition : WithIdentifier < any > } ) => {
380
415
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
+
381
424
const drawing = factory ( { definition } ) as Draw ;
382
425
this . dispatchEvent ( eventAfter , { [ type ] : drawing , definition } ) ;
383
426
0 commit comments