Skip to content

Commit e2aaec5

Browse files
committed
[Map] Remove InfoWindowWithoutPositionDefinition type (it was always kinda weird)
1 parent 29e53aa commit e2aaec5

File tree

6 files changed

+40
-25
lines changed

6 files changed

+40
-25
lines changed

src/Map/assets/dist/abstract_map_controller.d.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,35 +29,35 @@ export type Icon = {
2929
export type MarkerDefinition<BridgeMarkerOptions, BridgeInfoWindowOptions> = WithIdentifier<{
3030
position: Point;
3131
title: string | null;
32-
infoWindow?: InfoWindowWithoutPositionDefinition<BridgeInfoWindowOptions>;
32+
infoWindow?: Omit<InfoWindowDefinition<BridgeInfoWindowOptions>, 'position'>;
3333
icon?: Icon;
3434
rawOptions?: BridgeMarkerOptions;
3535
extra: Record<string, unknown>;
3636
}>;
3737
export type PolygonDefinition<PolygonOptions, BridgeInfoWindowOptions> = WithIdentifier<{
38-
infoWindow?: InfoWindowWithoutPositionDefinition<BridgeInfoWindowOptions>;
38+
infoWindow?: Omit<InfoWindowDefinition<BridgeInfoWindowOptions>, 'position'>;
3939
points: Array<Point> | Array<Array<Point>>;
4040
title: string | null;
4141
rawOptions?: PolygonOptions;
4242
extra: Record<string, unknown>;
4343
}>;
4444
export type PolylineDefinition<PolylineOptions, BridgeInfoWindowOptions> = WithIdentifier<{
45-
infoWindow?: InfoWindowWithoutPositionDefinition<BridgeInfoWindowOptions>;
45+
infoWindow?: Omit<InfoWindowDefinition<BridgeInfoWindowOptions>, 'position'>;
4646
points: Array<Point>;
4747
title: string | null;
4848
rawOptions?: PolylineOptions;
4949
extra: Record<string, unknown>;
5050
}>;
5151
export type CircleDefinition<CircleOptions, BridgeInfoWindowOptions> = WithIdentifier<{
52-
infoWindow?: InfoWindowWithoutPositionDefinition<BridgeInfoWindowOptions>;
52+
infoWindow?: Omit<InfoWindowDefinition<BridgeInfoWindowOptions>, 'position'>;
5353
center: Point;
5454
radius: number;
5555
title: string | null;
5656
rawOptions?: CircleOptions;
5757
extra: Record<string, unknown>;
5858
}>;
5959
export type RectangleDefinition<RectangleOptions, BridgeInfoWindowOptions> = WithIdentifier<{
60-
infoWindow?: InfoWindowWithoutPositionDefinition<BridgeInfoWindowOptions>;
60+
infoWindow?: Omit<InfoWindowDefinition<BridgeInfoWindowOptions>, 'position'>;
6161
southWest: Point;
6262
northEast: Point;
6363
title: string | null;
@@ -73,7 +73,6 @@ export type InfoWindowDefinition<BridgeInfoWindowOptions> = {
7373
rawOptions?: BridgeInfoWindowOptions;
7474
extra: Record<string, unknown>;
7575
};
76-
export type InfoWindowWithoutPositionDefinition<BridgeInfoWindowOptions> = Omit<InfoWindowDefinition<BridgeInfoWindowOptions>, 'position'>;
7776
export default abstract class<MapOptions, BridgeMap, BridgeMarkerOptions, BridgeMarker, BridgeInfoWindowOptions, BridgeInfoWindow, BridgePolygonOptions, BridgePolygon, BridgePolylineOptions, BridgePolyline, BridgeCircleOptions, BridgeCircle, BridgeRectangleOptions, BridgeRectangle> extends Controller<HTMLElement> {
7877
static values: {
7978
providerOptions: ObjectConstructor;
@@ -121,7 +120,7 @@ export default abstract class<MapOptions, BridgeMap, BridgeMarkerOptions, Bridge
121120
protected abstract dispatchEvent(name: string, payload: Record<string, unknown>): void;
122121
connect(): void;
123122
createInfoWindow({ definition, element, }: {
124-
definition: InfoWindowWithoutPositionDefinition<BridgeInfoWindowOptions>;
123+
definition: Omit<InfoWindowDefinition<BridgeInfoWindowOptions>, 'position'>;
125124
element: BridgeMarker | BridgePolygon | BridgePolyline | BridgeCircle | BridgeRectangle;
126125
}): BridgeInfoWindow;
127126
abstract centerValueChanged(): void;
@@ -158,7 +157,7 @@ export default abstract class<MapOptions, BridgeMap, BridgeMarkerOptions, Bridge
158157
}): BridgeRectangle;
159158
protected abstract doRemoveRectangle(rectangle: BridgeRectangle): void;
160159
protected abstract doCreateInfoWindow({ definition, element, }: {
161-
definition: InfoWindowWithoutPositionDefinition<BridgeInfoWindowOptions>;
160+
definition: Omit<InfoWindowDefinition<BridgeInfoWindowOptions>, 'position'>;
162161
element: BridgeMarker | BridgePolygon | BridgePolyline | BridgeCircle | BridgeRectangle;
163162
}): BridgeInfoWindow;
164163
protected abstract doCreateIcon({ definition, element }: {

src/Map/assets/src/abstract_map_controller.ts

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* This file is part of the Symfony package.
3+
*
4+
* (c) Fabien Potencier <[email protected]>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
110
import { Controller } from '@hotwired/stimulus';
211

312
export type Point = { lat: number; lng: number };
@@ -31,7 +40,7 @@ export type Icon = {
3140
export type MarkerDefinition<BridgeMarkerOptions, BridgeInfoWindowOptions> = WithIdentifier<{
3241
position: Point;
3342
title: string | null;
34-
infoWindow?: InfoWindowWithoutPositionDefinition<BridgeInfoWindowOptions>;
43+
infoWindow?: Omit<InfoWindowDefinition<BridgeInfoWindowOptions>, 'position'>;
3544
icon?: Icon;
3645
/**
3746
* Raw options passed to the marker constructor, specific to the map provider (e.g.: `L.marker()` for Leaflet).
@@ -47,7 +56,7 @@ export type MarkerDefinition<BridgeMarkerOptions, BridgeInfoWindowOptions> = Wit
4756
}>;
4857

4958
export type PolygonDefinition<PolygonOptions, BridgeInfoWindowOptions> = WithIdentifier<{
50-
infoWindow?: InfoWindowWithoutPositionDefinition<BridgeInfoWindowOptions>;
59+
infoWindow?: Omit<InfoWindowDefinition<BridgeInfoWindowOptions>, 'position'>;
5160
points: Array<Point> | Array<Array<Point>>;
5261
title: string | null;
5362
/**
@@ -64,7 +73,7 @@ export type PolygonDefinition<PolygonOptions, BridgeInfoWindowOptions> = WithIde
6473
}>;
6574

6675
export type PolylineDefinition<PolylineOptions, BridgeInfoWindowOptions> = WithIdentifier<{
67-
infoWindow?: InfoWindowWithoutPositionDefinition<BridgeInfoWindowOptions>;
76+
infoWindow?: Omit<InfoWindowDefinition<BridgeInfoWindowOptions>, 'position'>;
6877
points: Array<Point>;
6978
title: string | null;
7079
/**
@@ -81,7 +90,7 @@ export type PolylineDefinition<PolylineOptions, BridgeInfoWindowOptions> = WithI
8190
}>;
8291

8392
export type CircleDefinition<CircleOptions, BridgeInfoWindowOptions> = WithIdentifier<{
84-
infoWindow?: InfoWindowWithoutPositionDefinition<BridgeInfoWindowOptions>;
93+
infoWindow?: Omit<InfoWindowDefinition<BridgeInfoWindowOptions>, 'position'>;
8594
center: Point;
8695
radius: number;
8796
title: string | null;
@@ -99,7 +108,7 @@ export type CircleDefinition<CircleOptions, BridgeInfoWindowOptions> = WithIdent
99108
}>;
100109

101110
export type RectangleDefinition<RectangleOptions, BridgeInfoWindowOptions> = WithIdentifier<{
102-
infoWindow?: InfoWindowWithoutPositionDefinition<BridgeInfoWindowOptions>;
111+
infoWindow?: Omit<InfoWindowDefinition<BridgeInfoWindowOptions>, 'position'>;
103112
southWest: Point;
104113
northEast: Point;
105114
title: string | null;
@@ -136,8 +145,6 @@ export type InfoWindowDefinition<BridgeInfoWindowOptions> = {
136145
extra: Record<string, unknown>;
137146
};
138147

139-
export type InfoWindowWithoutPositionDefinition<BridgeInfoWindowOptions> = Omit<InfoWindowDefinition<BridgeInfoWindowOptions>, 'position'>;
140-
141148
export default abstract class<
142149
MapOptions, // Normalized `*Options` PHP class from Bridge (to not be confused with the JS Map class options)
143150
BridgeMap, // The JavaScript Map class from Bridge (e.g.: `L.Map` for Leaflet, `google.maps.Map` for Google Maps)
@@ -248,7 +255,7 @@ export default abstract class<
248255
definition,
249256
element,
250257
}: {
251-
definition: InfoWindowWithoutPositionDefinition<BridgeInfoWindowOptions>;
258+
definition: Omit<InfoWindowDefinition<BridgeInfoWindowOptions>, 'position'>;
252259
element: BridgeMarker | BridgePolygon | BridgePolyline | BridgeCircle | BridgeRectangle;
253260
}): BridgeInfoWindow {
254261
this.dispatchEvent('info-window:before-create', { definition, element });
@@ -342,7 +349,7 @@ export default abstract class<
342349
definition,
343350
element,
344351
}: {
345-
definition: InfoWindowWithoutPositionDefinition<BridgeInfoWindowOptions>;
352+
definition: Omit<InfoWindowDefinition<BridgeInfoWindowOptions>, 'position'>;
346353
element: BridgeMarker | BridgePolygon | BridgePolyline | BridgeCircle | BridgeRectangle;
347354
}): BridgeInfoWindow;
348355
protected abstract doCreateIcon({ definition, element }: { definition: Icon; element: BridgeMarker }): void;

src/Map/src/Bridge/Google/assets/dist/map_controller.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { LoaderOptions } from '@googlemaps/js-api-loader';
2-
import type { CircleDefinition, Icon, InfoWindowWithoutPositionDefinition, MarkerDefinition, Point, PolygonDefinition, PolylineDefinition, RectangleDefinition } from '@symfony/ux-map';
2+
import type { CircleDefinition, Icon, InfoWindowDefinition, MarkerDefinition, Point, PolygonDefinition, PolylineDefinition, RectangleDefinition } from '@symfony/ux-map';
33
import AbstractMapController from '@symfony/ux-map';
44
type MapOptions = Pick<google.maps.MapOptions, 'mapId' | 'gestureHandling' | 'backgroundColor' | 'disableDoubleClickZoom' | 'zoomControl' | 'zoomControlOptions' | 'mapTypeControl' | 'mapTypeControlOptions' | 'streetViewControl' | 'streetViewControlOptions' | 'fullscreenControl' | 'fullscreenControlOptions'>;
55
export default class extends AbstractMapController<MapOptions, google.maps.Map, google.maps.marker.AdvancedMarkerElementOptions, google.maps.marker.AdvancedMarkerElement, google.maps.InfoWindowOptions, google.maps.InfoWindow, google.maps.PolygonOptions, google.maps.Polygon, google.maps.PolylineOptions, google.maps.Polyline, google.maps.CircleOptions, google.maps.Circle, google.maps.RectangleOptions, google.maps.Rectangle> {
@@ -36,7 +36,7 @@ export default class extends AbstractMapController<MapOptions, google.maps.Map,
3636
}): google.maps.Rectangle;
3737
protected doRemoveRectangle(rectangle: google.maps.Rectangle): void;
3838
protected doCreateInfoWindow({ definition, element, }: {
39-
definition: InfoWindowWithoutPositionDefinition<google.maps.InfoWindowOptions>;
39+
definition: Omit<InfoWindowDefinition<google.maps.InfoWindowOptions>, 'position'>;
4040
element: google.maps.marker.AdvancedMarkerElement | google.maps.Polygon | google.maps.Polyline | google.maps.Circle | google.maps.Rectangle;
4141
}): google.maps.InfoWindow;
4242
protected doFitBoundsToMarkers(): void;

src/Map/src/Bridge/Google/assets/src/map_controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { Loader } from '@googlemaps/js-api-loader';
1212
import type {
1313
CircleDefinition,
1414
Icon,
15-
InfoWindowWithoutPositionDefinition,
15+
InfoWindowDefinition,
1616
MarkerDefinition,
1717
Point,
1818
PolygonDefinition,
@@ -295,7 +295,7 @@ export default class extends AbstractMapController<
295295
definition,
296296
element,
297297
}: {
298-
definition: InfoWindowWithoutPositionDefinition<google.maps.InfoWindowOptions>;
298+
definition: Omit<InfoWindowDefinition<google.maps.InfoWindowOptions>, 'position'>;
299299
element: google.maps.marker.AdvancedMarkerElement | google.maps.Polygon | google.maps.Polyline | google.maps.Circle | google.maps.Rectangle;
300300
}): google.maps.InfoWindow {
301301
const { headerContent, content, opened, autoClose, rawOptions = {} } = definition;

src/Map/src/Bridge/Leaflet/assets/dist/map_controller.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { CircleDefinition, Icon, InfoWindowWithoutPositionDefinition, MarkerDefinition, Point, PolygonDefinition, PolylineDefinition, RectangleDefinition } from '@symfony/ux-map';
1+
import type { CircleDefinition, Icon, InfoWindowDefinition, MarkerDefinition, Point, PolygonDefinition, PolylineDefinition, RectangleDefinition } from '@symfony/ux-map';
22
import AbstractMapController from '@symfony/ux-map';
33
import 'leaflet/dist/leaflet.min.css';
44
import type { CircleOptions, ControlPosition, MapOptions as LeafletMapOptions, MarkerOptions, PolylineOptions as PolygonOptions, PolylineOptions, PopupOptions, PolylineOptions as RectangleOptions } from 'leaflet';
@@ -53,7 +53,7 @@ export default class extends AbstractMapController<MapOptions, L.Map, MarkerOpti
5353
}): L.Rectangle;
5454
protected doRemoveRectangle(rectangle: L.Rectangle): void;
5555
protected doCreateInfoWindow({ definition, element, }: {
56-
definition: InfoWindowWithoutPositionDefinition<PopupOptions>;
56+
definition: Omit<InfoWindowDefinition<PopupOptions>, 'position'>;
5757
element: L.Marker | L.Polygon | L.Polyline | L.Circle | L.Rectangle;
5858
}): L.Popup;
5959
protected doCreateIcon({ definition, element }: {

src/Map/src/Bridge/Leaflet/assets/src/map_controller.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1+
/*
2+
* This file is part of the Symfony package.
3+
*
4+
* (c) Fabien Potencier <[email protected]>
5+
*
6+
* For the full copyright and license information, please view the LICENSE
7+
* file that was distributed with this source code.
8+
*/
9+
110
import type {
211
CircleDefinition,
312
Icon,
4-
InfoWindowWithoutPositionDefinition,
13+
InfoWindowDefinition,
514
MarkerDefinition,
615
Point,
716
PolygonDefinition,
@@ -224,7 +233,7 @@ export default class extends AbstractMapController<
224233
definition,
225234
element,
226235
}: {
227-
definition: InfoWindowWithoutPositionDefinition<PopupOptions>;
236+
definition: Omit<InfoWindowDefinition<PopupOptions>, 'position'>;
228237
element: L.Marker | L.Polygon | L.Polyline | L.Circle | L.Rectangle;
229238
}): L.Popup {
230239
const { headerContent, content, rawOptions = {}, ...otherOptions } = definition;

0 commit comments

Comments
 (0)