diff --git a/src/dev-app/google-map/google-map-demo.ts b/src/dev-app/google-map/google-map-demo.ts index 6ecb4140f402..91050b832eaf 100644 --- a/src/dev-app/google-map/google-map-demo.ts +++ b/src/dev-app/google-map/google-map-demo.ts @@ -9,14 +9,22 @@ import {CommonModule} from '@angular/common'; import {Component, ViewChild} from '@angular/core'; import { - GoogleMapsModule, + GoogleMap, + MapBicyclingLayer, MapCircle, + MapDirectionsRenderer, MapDirectionsService, + MapGroundOverlay, + MapHeatmapLayer, MapInfoWindow, + MapKmlLayer, MapMarker, + MapMarkerClusterer, MapPolygon, MapPolyline, MapRectangle, + MapTrafficLayer, + MapTransitLayer, } from '@angular/google-maps'; const POLYLINE_PATH: google.maps.LatLngLiteral[] = [ @@ -52,7 +60,24 @@ let apiLoadingPromise: Promise | null = null; templateUrl: 'google-map-demo.html', styleUrls: ['google-map-demo.css'], standalone: true, - imports: [CommonModule, GoogleMapsModule], + imports: [ + CommonModule, + GoogleMap, + MapBicyclingLayer, + MapCircle, + MapDirectionsRenderer, + MapGroundOverlay, + MapHeatmapLayer, + MapInfoWindow, + MapKmlLayer, + MapMarker, + MapMarkerClusterer, + MapPolygon, + MapPolyline, + MapRectangle, + MapTrafficLayer, + MapTransitLayer, + ], }) export class GoogleMapDemo { @ViewChild(MapInfoWindow) infoWindow: MapInfoWindow; diff --git a/src/google-maps/README.md b/src/google-maps/README.md index acea33991e30..0115a5e1f078 100644 --- a/src/google-maps/README.md +++ b/src/google-maps/README.md @@ -21,7 +21,7 @@ method to make sure that the component doesn't load until after the API has load // google-maps-demo.module.ts import { NgModule } from '@angular/core'; -import { GoogleMapsModule } from '@angular/google-maps'; +import { GoogleMap } from '@angular/google-maps'; import { CommonModule } from '@angular/common'; import { HttpClientModule, HttpClientJsonpModule } from '@angular/common/http'; @@ -33,7 +33,7 @@ import { GoogleMapsDemoComponent } from './google-maps-demo.component'; ], imports: [ CommonModule, - GoogleMapsModule, + GoogleMap, HttpClientModule, HttpClientJsonpModule, ], diff --git a/src/google-maps/google-map/README.md b/src/google-maps/google-map/README.md index 4ebe44e9470a..d04e6083e832 100644 --- a/src/google-maps/google-map/README.md +++ b/src/google-maps/google-map/README.md @@ -8,14 +8,12 @@ The `GoogleMap` component wraps the [`google.maps.Map` class](https://developers // google-maps-demo.module.ts import {NgModule} from '@angular/core'; -import {GoogleMapsModule} from '@angular/google-maps'; +import {GoogleMap} from '@angular/google-maps'; import {GoogleMapDemo} from './google-map-demo'; @NgModule({ - imports: [ - GoogleMapsModule, - ], + imports: [GoogleMap], declarations: [GoogleMapDemo], }) export class GoogleMapDemoModule { diff --git a/src/google-maps/google-map/google-map.spec.ts b/src/google-maps/google-map/google-map.spec.ts index 98b99ca1fd5a..7d2327d7d81a 100644 --- a/src/google-maps/google-map/google-map.spec.ts +++ b/src/google-maps/google-map/google-map.spec.ts @@ -2,7 +2,6 @@ import {Component, ViewChild} from '@angular/core'; import {waitForAsync, TestBed} from '@angular/core/testing'; import {By} from '@angular/platform-browser'; -import {GoogleMapsModule} from '../google-maps-module'; import {createMapConstructorSpy, createMapSpy} from '../testing/fake-google-map-utils'; import {DEFAULT_HEIGHT, DEFAULT_OPTIONS, DEFAULT_WIDTH, GoogleMap} from './google-map'; @@ -26,7 +25,7 @@ describe('GoogleMap', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [GoogleMapsModule], + imports: [GoogleMap], declarations: [TestApp], }); })); diff --git a/src/google-maps/google-map/google-map.ts b/src/google-maps/google-map/google-map.ts index 4bddc61774c4..08416f3eed19 100644 --- a/src/google-maps/google-map/google-map.ts +++ b/src/google-maps/google-map/google-map.ts @@ -56,6 +56,7 @@ export const DEFAULT_WIDTH = '500px'; @Component({ selector: 'google-map', exportAs: 'googleMap', + standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: '
', encapsulation: ViewEncapsulation.None, diff --git a/src/google-maps/google-maps-module.ts b/src/google-maps/google-maps-module.ts index 45f354f11fdf..266e583b1d26 100644 --- a/src/google-maps/google-maps-module.ts +++ b/src/google-maps/google-maps-module.ts @@ -32,6 +32,7 @@ const COMPONENTS = [ MapCircle, MapDirectionsRenderer, MapGroundOverlay, + MapHeatmapLayer, MapInfoWindow, MapKmlLayer, MapMarker, @@ -41,11 +42,10 @@ const COMPONENTS = [ MapRectangle, MapTrafficLayer, MapTransitLayer, - MapHeatmapLayer, ]; @NgModule({ - declarations: COMPONENTS, + imports: COMPONENTS, exports: COMPONENTS, }) export class GoogleMapsModule {} diff --git a/src/google-maps/map-base-layer.ts b/src/google-maps/map-base-layer.ts index 782be10a703e..5448a9e5678b 100644 --- a/src/google-maps/map-base-layer.ts +++ b/src/google-maps/map-base-layer.ts @@ -16,9 +16,13 @@ import {GoogleMap} from './google-map/google-map'; @Directive({ selector: 'map-base-layer', exportAs: 'mapBaseLayer', + standalone: true, }) export class MapBaseLayer implements OnInit, OnDestroy { - constructor(protected readonly _map: GoogleMap, protected readonly _ngZone: NgZone) {} + constructor( + protected readonly _map: GoogleMap, + protected readonly _ngZone: NgZone, + ) {} ngOnInit() { if (this._map._isBrowser) { diff --git a/src/google-maps/map-bicycling-layer/map-bicycling-layer.spec.ts b/src/google-maps/map-bicycling-layer/map-bicycling-layer.spec.ts index a3669e85cc88..27a79887ee7a 100644 --- a/src/google-maps/map-bicycling-layer/map-bicycling-layer.spec.ts +++ b/src/google-maps/map-bicycling-layer/map-bicycling-layer.spec.ts @@ -1,8 +1,7 @@ import {Component} from '@angular/core'; import {waitForAsync, TestBed} from '@angular/core/testing'; -import {DEFAULT_OPTIONS} from '../google-map/google-map'; -import {GoogleMapsModule} from '../google-maps-module'; +import {DEFAULT_OPTIONS, GoogleMap} from '../google-map/google-map'; import { createBicyclingLayerConstructorSpy, createBicyclingLayerSpy, @@ -10,12 +9,14 @@ import { createMapSpy, } from '../testing/fake-google-map-utils'; +import {MapBicyclingLayer} from './map-bicycling-layer'; + describe('MapBicyclingLayer', () => { let mapSpy: jasmine.SpyObj; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [GoogleMapsModule], + imports: [GoogleMap, MapBicyclingLayer], declarations: [TestApp], }); })); diff --git a/src/google-maps/map-bicycling-layer/map-bicycling-layer.ts b/src/google-maps/map-bicycling-layer/map-bicycling-layer.ts index a329dd578ae5..bf1536f21605 100644 --- a/src/google-maps/map-bicycling-layer/map-bicycling-layer.ts +++ b/src/google-maps/map-bicycling-layer/map-bicycling-layer.ts @@ -21,6 +21,7 @@ import {MapBaseLayer} from '../map-base-layer'; @Directive({ selector: 'map-bicycling-layer', exportAs: 'mapBicyclingLayer', + standalone: true, }) export class MapBicyclingLayer extends MapBaseLayer { /** diff --git a/src/google-maps/map-circle/map-circle.spec.ts b/src/google-maps/map-circle/map-circle.spec.ts index 649d9636b8cd..1e54bbd96189 100644 --- a/src/google-maps/map-circle/map-circle.spec.ts +++ b/src/google-maps/map-circle/map-circle.spec.ts @@ -2,8 +2,7 @@ import {Component, ViewChild} from '@angular/core'; import {waitForAsync, TestBed} from '@angular/core/testing'; import {By} from '@angular/platform-browser'; -import {DEFAULT_OPTIONS} from '../google-map/google-map'; -import {GoogleMapsModule} from '../google-maps-module'; +import {DEFAULT_OPTIONS, GoogleMap} from '../google-map/google-map'; import { createCircleConstructorSpy, createCircleSpy, @@ -29,7 +28,7 @@ describe('MapCircle', () => { strokeOpacity: 0.8, }; TestBed.configureTestingModule({ - imports: [GoogleMapsModule], + imports: [GoogleMap, MapCircle], declarations: [TestApp], }); })); diff --git a/src/google-maps/map-circle/map-circle.ts b/src/google-maps/map-circle/map-circle.ts index 215c3420f4ce..a1ce7f6070ec 100644 --- a/src/google-maps/map-circle/map-circle.ts +++ b/src/google-maps/map-circle/map-circle.ts @@ -23,6 +23,7 @@ import {MapEventManager} from '../map-event-manager'; @Directive({ selector: 'map-circle', exportAs: 'mapCircle', + standalone: true, }) export class MapCircle implements OnInit, OnDestroy { private _eventManager = new MapEventManager(inject(NgZone)); @@ -147,7 +148,10 @@ export class MapCircle implements OnInit, OnDestroy { @Output() readonly circleRightclick: Observable = this._eventManager.getLazyEmitter('rightclick'); - constructor(private readonly _map: GoogleMap, private readonly _ngZone: NgZone) {} + constructor( + private readonly _map: GoogleMap, + private readonly _ngZone: NgZone, + ) {} ngOnInit() { if (this._map._isBrowser) { diff --git a/src/google-maps/map-directions-renderer/map-directions-renderer.spec.ts b/src/google-maps/map-directions-renderer/map-directions-renderer.spec.ts index 63116114d780..21c7e77da0ed 100644 --- a/src/google-maps/map-directions-renderer/map-directions-renderer.spec.ts +++ b/src/google-maps/map-directions-renderer/map-directions-renderer.spec.ts @@ -2,8 +2,7 @@ import {Component, ViewChild} from '@angular/core'; import {TestBed, waitForAsync} from '@angular/core/testing'; import {By} from '@angular/platform-browser'; import {MapDirectionsRenderer} from './map-directions-renderer'; -import {DEFAULT_OPTIONS} from '../google-map/google-map'; -import {GoogleMapsModule} from '../google-maps-module'; +import {DEFAULT_OPTIONS, GoogleMap} from '../google-map/google-map'; import { createDirectionsRendererConstructorSpy, createDirectionsRendererSpy, @@ -21,7 +20,7 @@ describe('MapDirectionsRenderer', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [GoogleMapsModule], + imports: [GoogleMap, MapDirectionsRenderer], declarations: [TestApp], }); })); diff --git a/src/google-maps/map-directions-renderer/map-directions-renderer.ts b/src/google-maps/map-directions-renderer/map-directions-renderer.ts index 26134199e4ed..c32f83f4f5db 100644 --- a/src/google-maps/map-directions-renderer/map-directions-renderer.ts +++ b/src/google-maps/map-directions-renderer/map-directions-renderer.ts @@ -33,6 +33,7 @@ import {MapEventManager} from '../map-event-manager'; @Directive({ selector: 'map-directions-renderer', exportAs: 'mapDirectionsRenderer', + standalone: true, }) export class MapDirectionsRenderer implements OnInit, OnChanges, OnDestroy { private _eventManager = new MapEventManager(inject(NgZone)); @@ -68,7 +69,10 @@ export class MapDirectionsRenderer implements OnInit, OnChanges, OnDestroy { /** The underlying google.maps.DirectionsRenderer object. */ directionsRenderer?: google.maps.DirectionsRenderer; - constructor(private readonly _googleMap: GoogleMap, private _ngZone: NgZone) {} + constructor( + private readonly _googleMap: GoogleMap, + private _ngZone: NgZone, + ) {} ngOnInit() { if (this._googleMap._isBrowser) { diff --git a/src/google-maps/map-directions-renderer/map-directions-service.spec.ts b/src/google-maps/map-directions-renderer/map-directions-service.spec.ts index 1844d8d053be..b2fcfb9a7741 100644 --- a/src/google-maps/map-directions-renderer/map-directions-service.spec.ts +++ b/src/google-maps/map-directions-renderer/map-directions-service.spec.ts @@ -1,6 +1,5 @@ import {TestBed} from '@angular/core/testing'; import {MapDirectionsResponse, MapDirectionsService} from './map-directions-service'; -import {GoogleMapsModule} from '../google-maps-module'; import { createDirectionsServiceConstructorSpy, createDirectionsServiceSpy, @@ -12,10 +11,6 @@ describe('MapDirectionsService', () => { let directionsServiceSpy: jasmine.SpyObj; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [GoogleMapsModule], - }); - directionsServiceSpy = createDirectionsServiceSpy(); directionsServiceConstructorSpy = createDirectionsServiceConstructorSpy(directionsServiceSpy).and.callThrough(); diff --git a/src/google-maps/map-geocoder/map-geocoder.spec.ts b/src/google-maps/map-geocoder/map-geocoder.spec.ts index e92a0c1d4838..57ec0ef3f807 100644 --- a/src/google-maps/map-geocoder/map-geocoder.spec.ts +++ b/src/google-maps/map-geocoder/map-geocoder.spec.ts @@ -1,6 +1,5 @@ import {TestBed} from '@angular/core/testing'; import {MapGeocoderResponse, MapGeocoder} from './map-geocoder'; -import {GoogleMapsModule} from '../google-maps-module'; import {createGeocoderConstructorSpy, createGeocoderSpy} from '../testing/fake-google-map-utils'; describe('MapGeocoder', () => { @@ -9,10 +8,6 @@ describe('MapGeocoder', () => { let geocoderSpy: jasmine.SpyObj; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [GoogleMapsModule], - }); - geocoderSpy = createGeocoderSpy(); geocoderConstructorSpy = createGeocoderConstructorSpy(geocoderSpy).and.callThrough(); geocoder = TestBed.inject(MapGeocoder); diff --git a/src/google-maps/map-ground-overlay/map-ground-overlay.spec.ts b/src/google-maps/map-ground-overlay/map-ground-overlay.spec.ts index 79a6fd481dcb..c7c6b1c14ac5 100644 --- a/src/google-maps/map-ground-overlay/map-ground-overlay.spec.ts +++ b/src/google-maps/map-ground-overlay/map-ground-overlay.spec.ts @@ -2,8 +2,7 @@ import {Component, ViewChild} from '@angular/core'; import {waitForAsync, TestBed} from '@angular/core/testing'; import {By} from '@angular/platform-browser'; -import {DEFAULT_OPTIONS} from '../google-map/google-map'; -import {GoogleMapsModule} from '../google-maps-module'; +import {DEFAULT_OPTIONS, GoogleMap} from '../google-map/google-map'; import { createGroundOverlayConstructorSpy, createGroundOverlaySpy, @@ -23,7 +22,7 @@ describe('MapGroundOverlay', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [GoogleMapsModule], + imports: [GoogleMap, MapGroundOverlay], declarations: [TestApp], }); })); diff --git a/src/google-maps/map-ground-overlay/map-ground-overlay.ts b/src/google-maps/map-ground-overlay/map-ground-overlay.ts index f827ea529ef9..c7adab03ea0f 100644 --- a/src/google-maps/map-ground-overlay/map-ground-overlay.ts +++ b/src/google-maps/map-ground-overlay/map-ground-overlay.ts @@ -24,6 +24,7 @@ import {MapEventManager} from '../map-event-manager'; @Directive({ selector: 'map-ground-overlay', exportAs: 'mapGroundOverlay', + standalone: true, }) export class MapGroundOverlay implements OnInit, OnDestroy { private _eventManager = new MapEventManager(inject(NgZone)); @@ -81,7 +82,10 @@ export class MapGroundOverlay implements OnInit, OnDestroy { @Output() readonly mapDblclick: Observable = this._eventManager.getLazyEmitter('dblclick'); - constructor(private readonly _map: GoogleMap, private readonly _ngZone: NgZone) {} + constructor( + private readonly _map: GoogleMap, + private readonly _ngZone: NgZone, + ) {} ngOnInit() { if (this._map._isBrowser) { diff --git a/src/google-maps/map-heatmap-layer/map-heatmap-layer.spec.ts b/src/google-maps/map-heatmap-layer/map-heatmap-layer.spec.ts index d9b8b6284092..d336bcb99c60 100644 --- a/src/google-maps/map-heatmap-layer/map-heatmap-layer.spec.ts +++ b/src/google-maps/map-heatmap-layer/map-heatmap-layer.spec.ts @@ -1,9 +1,8 @@ import {Component, ViewChild} from '@angular/core'; import {waitForAsync, TestBed} from '@angular/core/testing'; -import {DEFAULT_OPTIONS} from '../google-map/google-map'; +import {DEFAULT_OPTIONS, GoogleMap} from '../google-map/google-map'; -import {GoogleMapsModule} from '../google-maps-module'; import { createMapConstructorSpy, createMapSpy, @@ -20,7 +19,7 @@ describe('MapHeatmapLayer', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [GoogleMapsModule], + imports: [GoogleMap, MapHeatmapLayer], declarations: [TestApp], }); })); diff --git a/src/google-maps/map-heatmap-layer/map-heatmap-layer.ts b/src/google-maps/map-heatmap-layer/map-heatmap-layer.ts index 652cddedbed8..45566136d32c 100644 --- a/src/google-maps/map-heatmap-layer/map-heatmap-layer.ts +++ b/src/google-maps/map-heatmap-layer/map-heatmap-layer.ts @@ -28,6 +28,7 @@ export type HeatmapData = @Directive({ selector: 'map-heatmap-layer', exportAs: 'mapHeatmapLayer', + standalone: true, }) export class MapHeatmapLayer implements OnInit, OnChanges, OnDestroy { /** @@ -57,7 +58,10 @@ export class MapHeatmapLayer implements OnInit, OnChanges, OnDestroy { */ heatmap?: google.maps.visualization.HeatmapLayer; - constructor(private readonly _googleMap: GoogleMap, private _ngZone: NgZone) {} + constructor( + private readonly _googleMap: GoogleMap, + private _ngZone: NgZone, + ) {} ngOnInit() { if (this._googleMap._isBrowser) { diff --git a/src/google-maps/map-info-window/map-info-window.spec.ts b/src/google-maps/map-info-window/map-info-window.spec.ts index 61174af7cceb..bed4a5fe2ab3 100644 --- a/src/google-maps/map-info-window/map-info-window.spec.ts +++ b/src/google-maps/map-info-window/map-info-window.spec.ts @@ -2,9 +2,8 @@ import {Component, ViewChild} from '@angular/core'; import {waitForAsync, TestBed} from '@angular/core/testing'; import {By} from '@angular/platform-browser'; -import {DEFAULT_OPTIONS} from '../google-map/google-map'; +import {DEFAULT_OPTIONS, GoogleMap} from '../google-map/google-map'; -import {GoogleMapsModule} from '../google-maps-module'; import {MapMarker} from '../map-marker/map-marker'; import { createInfoWindowConstructorSpy, @@ -19,7 +18,7 @@ describe('MapInfoWindow', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [GoogleMapsModule], + imports: [GoogleMap, MapInfoWindow], declarations: [TestApp], }); })); diff --git a/src/google-maps/map-info-window/map-info-window.ts b/src/google-maps/map-info-window/map-info-window.ts index 64aeaf7840cd..bf82b0353de5 100644 --- a/src/google-maps/map-info-window/map-info-window.ts +++ b/src/google-maps/map-info-window/map-info-window.ts @@ -34,6 +34,7 @@ import {MapAnchorPoint} from '../map-anchor-point'; @Directive({ selector: 'map-info-window', exportAs: 'mapInfoWindow', + standalone: true, host: {'style': 'display: none'}, }) export class MapInfoWindow implements OnInit, OnDestroy { diff --git a/src/google-maps/map-kml-layer/map-kml-layer.spec.ts b/src/google-maps/map-kml-layer/map-kml-layer.spec.ts index 1c9fea03e4b9..9945673edee3 100644 --- a/src/google-maps/map-kml-layer/map-kml-layer.spec.ts +++ b/src/google-maps/map-kml-layer/map-kml-layer.spec.ts @@ -2,8 +2,7 @@ import {Component, ViewChild} from '@angular/core'; import {waitForAsync, TestBed} from '@angular/core/testing'; import {By} from '@angular/platform-browser'; -import {DEFAULT_OPTIONS} from '../google-map/google-map'; -import {GoogleMapsModule} from '../google-maps-module'; +import {DEFAULT_OPTIONS, GoogleMap} from '../google-map/google-map'; import { createKmlLayerConstructorSpy, createKmlLayerSpy, @@ -25,7 +24,7 @@ describe('MapKmlLayer', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [GoogleMapsModule], + imports: [GoogleMap, MapKmlLayer], declarations: [TestApp], }); })); diff --git a/src/google-maps/map-kml-layer/map-kml-layer.ts b/src/google-maps/map-kml-layer/map-kml-layer.ts index 56000f1561e5..d82926425e23 100644 --- a/src/google-maps/map-kml-layer/map-kml-layer.ts +++ b/src/google-maps/map-kml-layer/map-kml-layer.ts @@ -24,6 +24,7 @@ import {MapEventManager} from '../map-event-manager'; @Directive({ selector: 'map-kml-layer', exportAs: 'mapKmlLayer', + standalone: true, }) export class MapKmlLayer implements OnInit, OnDestroy { private _eventManager = new MapEventManager(inject(NgZone)); @@ -69,7 +70,10 @@ export class MapKmlLayer implements OnInit, OnDestroy { @Output() readonly statusChanged: Observable = this._eventManager.getLazyEmitter('status_changed'); - constructor(private readonly _map: GoogleMap, private _ngZone: NgZone) {} + constructor( + private readonly _map: GoogleMap, + private _ngZone: NgZone, + ) {} ngOnInit() { if (this._map._isBrowser) { diff --git a/src/google-maps/map-marker-clusterer/map-marker-clusterer.spec.ts b/src/google-maps/map-marker-clusterer/map-marker-clusterer.spec.ts index ed08e42e22b6..d4f6323a201d 100644 --- a/src/google-maps/map-marker-clusterer/map-marker-clusterer.spec.ts +++ b/src/google-maps/map-marker-clusterer/map-marker-clusterer.spec.ts @@ -1,8 +1,8 @@ import {Component, ViewChild} from '@angular/core'; import {waitForAsync, ComponentFixture, TestBed} from '@angular/core/testing'; -import {DEFAULT_OPTIONS} from '../google-map/google-map'; -import {GoogleMapsModule} from '../google-maps-module'; +import {DEFAULT_OPTIONS, GoogleMap} from '../google-map/google-map'; +import {MapMarker} from '../map-marker/map-marker'; import { createMapConstructorSpy, createMapSpy, @@ -30,7 +30,7 @@ describe('MapMarkerClusterer', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [GoogleMapsModule], + imports: [GoogleMap, MapMarker, MapMarkerClusterer], declarations: [TestApp], }); })); diff --git a/src/google-maps/map-marker-clusterer/map-marker-clusterer.ts b/src/google-maps/map-marker-clusterer/map-marker-clusterer.ts index be5abe567616..7f4f4446da67 100644 --- a/src/google-maps/map-marker-clusterer/map-marker-clusterer.ts +++ b/src/google-maps/map-marker-clusterer/map-marker-clusterer.ts @@ -58,6 +58,7 @@ declare const MarkerClusterer: typeof MarkerClustererInstance; selector: 'map-marker-clusterer', exportAs: 'mapMarkerClusterer', changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, template: '', encapsulation: ViewEncapsulation.None, }) @@ -206,7 +207,10 @@ export class MapMarkerClusterer implements OnInit, AfterContentInit, OnChanges, */ markerClusterer?: MarkerClustererInstance; - constructor(private readonly _googleMap: GoogleMap, private readonly _ngZone: NgZone) { + constructor( + private readonly _googleMap: GoogleMap, + private readonly _ngZone: NgZone, + ) { this._canInitialize = this._googleMap._isBrowser; } diff --git a/src/google-maps/map-marker/map-marker.spec.ts b/src/google-maps/map-marker/map-marker.spec.ts index e275fed500d3..b04dd2427799 100644 --- a/src/google-maps/map-marker/map-marker.spec.ts +++ b/src/google-maps/map-marker/map-marker.spec.ts @@ -1,9 +1,7 @@ import {Component, ViewChild} from '@angular/core'; import {waitForAsync, TestBed} from '@angular/core/testing'; -import {DEFAULT_OPTIONS} from '../google-map/google-map'; - -import {GoogleMapsModule} from '../google-maps-module'; +import {DEFAULT_OPTIONS, GoogleMap} from '../google-map/google-map'; import { createMapConstructorSpy, createMapSpy, @@ -17,7 +15,7 @@ describe('MapMarker', () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [GoogleMapsModule], + imports: [GoogleMap, MapMarker], declarations: [TestApp], }); })); diff --git a/src/google-maps/map-marker/map-marker.ts b/src/google-maps/map-marker/map-marker.ts index 5f96a74ae102..0785779c9e7c 100644 --- a/src/google-maps/map-marker/map-marker.ts +++ b/src/google-maps/map-marker/map-marker.ts @@ -42,6 +42,7 @@ export const DEFAULT_MARKER_OPTIONS = { @Directive({ selector: 'map-marker', exportAs: 'mapMarker', + standalone: true, }) export class MapMarker implements OnInit, OnChanges, OnDestroy, MapAnchorPoint { private _eventManager = new MapEventManager(inject(NgZone)); @@ -270,7 +271,10 @@ export class MapMarker implements OnInit, OnChanges, OnDestroy, MapAnchorPoint { */ marker?: google.maps.Marker; - constructor(private readonly _googleMap: GoogleMap, private _ngZone: NgZone) {} + constructor( + private readonly _googleMap: GoogleMap, + private _ngZone: NgZone, + ) {} ngOnInit() { if (this._googleMap._isBrowser) { diff --git a/src/google-maps/map-polygon/map-polygon.spec.ts b/src/google-maps/map-polygon/map-polygon.spec.ts index 2950b73e4ec4..2418159e312f 100644 --- a/src/google-maps/map-polygon/map-polygon.spec.ts +++ b/src/google-maps/map-polygon/map-polygon.spec.ts @@ -2,8 +2,7 @@ import {Component, ViewChild} from '@angular/core'; import {waitForAsync, TestBed} from '@angular/core/testing'; import {By} from '@angular/platform-browser'; -import {DEFAULT_OPTIONS} from '../google-map/google-map'; -import {GoogleMapsModule} from '../google-maps-module'; +import {DEFAULT_OPTIONS, GoogleMap} from '../google-map/google-map'; import { createMapConstructorSpy, createMapSpy, @@ -26,7 +25,7 @@ describe('MapPolygon', () => { ]; polygonOptions = {paths: polygonPath, strokeColor: 'grey', strokeOpacity: 0.8}; TestBed.configureTestingModule({ - imports: [GoogleMapsModule], + imports: [GoogleMap, MapPolygon], declarations: [TestApp], }); })); diff --git a/src/google-maps/map-polygon/map-polygon.ts b/src/google-maps/map-polygon/map-polygon.ts index a16b247dcc98..fca45ff94671 100644 --- a/src/google-maps/map-polygon/map-polygon.ts +++ b/src/google-maps/map-polygon/map-polygon.ts @@ -24,6 +24,7 @@ import {MapEventManager} from '../map-event-manager'; @Directive({ selector: 'map-polygon', exportAs: 'mapPolygon', + standalone: true, }) export class MapPolygon implements OnInit, OnDestroy { private _eventManager = new MapEventManager(inject(NgZone)); @@ -127,7 +128,10 @@ export class MapPolygon implements OnInit, OnDestroy { @Output() readonly polygonRightclick: Observable = this._eventManager.getLazyEmitter('rightclick'); - constructor(private readonly _map: GoogleMap, private readonly _ngZone: NgZone) {} + constructor( + private readonly _map: GoogleMap, + private readonly _ngZone: NgZone, + ) {} ngOnInit() { if (this._map._isBrowser) { diff --git a/src/google-maps/map-polyline/map-polyline.spec.ts b/src/google-maps/map-polyline/map-polyline.spec.ts index 30bbf9ae41e5..bb8d083dc132 100644 --- a/src/google-maps/map-polyline/map-polyline.spec.ts +++ b/src/google-maps/map-polyline/map-polyline.spec.ts @@ -2,8 +2,7 @@ import {Component, ViewChild} from '@angular/core'; import {waitForAsync, TestBed} from '@angular/core/testing'; import {By} from '@angular/platform-browser'; -import {DEFAULT_OPTIONS} from '../google-map/google-map'; -import {GoogleMapsModule} from '../google-maps-module'; +import {DEFAULT_OPTIONS, GoogleMap} from '../google-map/google-map'; import { createMapConstructorSpy, createMapSpy, @@ -30,7 +29,7 @@ describe('MapPolyline', () => { strokeOpacity: 0.8, }; TestBed.configureTestingModule({ - imports: [GoogleMapsModule], + imports: [GoogleMap, MapPolyline], declarations: [TestApp], }); })); diff --git a/src/google-maps/map-polyline/map-polyline.ts b/src/google-maps/map-polyline/map-polyline.ts index 5ba79ce7082a..19be67a89c72 100644 --- a/src/google-maps/map-polyline/map-polyline.ts +++ b/src/google-maps/map-polyline/map-polyline.ts @@ -24,6 +24,7 @@ import {MapEventManager} from '../map-event-manager'; @Directive({ selector: 'map-polyline', exportAs: 'mapPolyline', + standalone: true, }) export class MapPolyline implements OnInit, OnDestroy { private _eventManager = new MapEventManager(inject(NgZone)); @@ -125,7 +126,10 @@ export class MapPolyline implements OnInit, OnDestroy { @Output() readonly polylineRightclick: Observable = this._eventManager.getLazyEmitter('rightclick'); - constructor(private readonly _map: GoogleMap, private _ngZone: NgZone) {} + constructor( + private readonly _map: GoogleMap, + private _ngZone: NgZone, + ) {} ngOnInit() { if (this._map._isBrowser) { diff --git a/src/google-maps/map-rectangle/map-rectangle.spec.ts b/src/google-maps/map-rectangle/map-rectangle.spec.ts index 2c74d7c680ac..6dfc8b28e592 100644 --- a/src/google-maps/map-rectangle/map-rectangle.spec.ts +++ b/src/google-maps/map-rectangle/map-rectangle.spec.ts @@ -2,8 +2,7 @@ import {Component, ViewChild} from '@angular/core'; import {waitForAsync, TestBed} from '@angular/core/testing'; import {By} from '@angular/platform-browser'; -import {DEFAULT_OPTIONS} from '../google-map/google-map'; -import {GoogleMapsModule} from '../google-maps-module'; +import {DEFAULT_OPTIONS, GoogleMap} from '../google-map/google-map'; import { createMapConstructorSpy, createMapSpy, @@ -22,7 +21,7 @@ describe('MapRectangle', () => { rectangleBounds = {east: 30, north: 15, west: 10, south: -5}; rectangleOptions = {bounds: rectangleBounds, strokeColor: 'grey', strokeOpacity: 0.8}; TestBed.configureTestingModule({ - imports: [GoogleMapsModule], + imports: [GoogleMap, MapRectangle], declarations: [TestApp], }); })); diff --git a/src/google-maps/map-rectangle/map-rectangle.ts b/src/google-maps/map-rectangle/map-rectangle.ts index 38ed52e934a7..20ae89dea92c 100644 --- a/src/google-maps/map-rectangle/map-rectangle.ts +++ b/src/google-maps/map-rectangle/map-rectangle.ts @@ -24,6 +24,7 @@ import {MapEventManager} from '../map-event-manager'; @Directive({ selector: 'map-rectangle', exportAs: 'mapRectangle', + standalone: true, }) export class MapRectangle implements OnInit, OnDestroy { private _eventManager = new MapEventManager(inject(NgZone)); @@ -134,7 +135,10 @@ export class MapRectangle implements OnInit, OnDestroy { @Output() readonly rectangleRightclick: Observable = this._eventManager.getLazyEmitter('rightclick'); - constructor(private readonly _map: GoogleMap, private readonly _ngZone: NgZone) {} + constructor( + private readonly _map: GoogleMap, + private readonly _ngZone: NgZone, + ) {} ngOnInit() { if (this._map._isBrowser) { diff --git a/src/google-maps/map-traffic-layer/map-traffic-layer.spec.ts b/src/google-maps/map-traffic-layer/map-traffic-layer.spec.ts index 74ea28b97bac..94358d407340 100644 --- a/src/google-maps/map-traffic-layer/map-traffic-layer.spec.ts +++ b/src/google-maps/map-traffic-layer/map-traffic-layer.spec.ts @@ -1,8 +1,7 @@ import {Component} from '@angular/core'; import {waitForAsync, TestBed} from '@angular/core/testing'; -import {DEFAULT_OPTIONS} from '../google-map/google-map'; -import {GoogleMapsModule} from '../google-maps-module'; +import {DEFAULT_OPTIONS, GoogleMap} from '../google-map/google-map'; import { createMapConstructorSpy, createMapSpy, @@ -10,13 +9,15 @@ import { createTrafficLayerSpy, } from '../testing/fake-google-map-utils'; +import {MapTrafficLayer} from './map-traffic-layer'; + describe('MapTrafficLayer', () => { let mapSpy: jasmine.SpyObj; const trafficLayerOptions: google.maps.TrafficLayerOptions = {autoRefresh: false}; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [GoogleMapsModule], + imports: [GoogleMap, MapTrafficLayer], declarations: [TestApp], }); })); diff --git a/src/google-maps/map-traffic-layer/map-traffic-layer.ts b/src/google-maps/map-traffic-layer/map-traffic-layer.ts index a8d1e6f0f619..853d9eadca24 100644 --- a/src/google-maps/map-traffic-layer/map-traffic-layer.ts +++ b/src/google-maps/map-traffic-layer/map-traffic-layer.ts @@ -23,6 +23,7 @@ import {GoogleMap} from '../google-map/google-map'; @Directive({ selector: 'map-traffic-layer', exportAs: 'mapTrafficLayer', + standalone: true, }) export class MapTrafficLayer implements OnInit, OnDestroy { private readonly _autoRefresh = new BehaviorSubject(true); @@ -43,7 +44,10 @@ export class MapTrafficLayer implements OnInit, OnDestroy { this._autoRefresh.next(autoRefresh); } - constructor(private readonly _map: GoogleMap, private readonly _ngZone: NgZone) {} + constructor( + private readonly _map: GoogleMap, + private readonly _ngZone: NgZone, + ) {} ngOnInit() { if (this._map._isBrowser) { diff --git a/src/google-maps/map-transit-layer/map-transit-layer.spec.ts b/src/google-maps/map-transit-layer/map-transit-layer.spec.ts index 8847a468c909..ec8f2047d84c 100644 --- a/src/google-maps/map-transit-layer/map-transit-layer.spec.ts +++ b/src/google-maps/map-transit-layer/map-transit-layer.spec.ts @@ -1,8 +1,7 @@ import {Component} from '@angular/core'; import {waitForAsync, TestBed} from '@angular/core/testing'; -import {DEFAULT_OPTIONS} from '../google-map/google-map'; -import {GoogleMapsModule} from '../google-maps-module'; +import {DEFAULT_OPTIONS, GoogleMap} from '../google-map/google-map'; import { createMapConstructorSpy, createMapSpy, @@ -10,12 +9,14 @@ import { createTransitLayerSpy, } from '../testing/fake-google-map-utils'; +import {MapTransitLayer} from './map-transit-layer'; + describe('MapTransitLayer', () => { let mapSpy: jasmine.SpyObj; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ - imports: [GoogleMapsModule], + imports: [GoogleMap, MapTransitLayer], declarations: [TestApp], }); })); diff --git a/src/google-maps/map-transit-layer/map-transit-layer.ts b/src/google-maps/map-transit-layer/map-transit-layer.ts index f1ef5af085d4..bc1a760b54d6 100644 --- a/src/google-maps/map-transit-layer/map-transit-layer.ts +++ b/src/google-maps/map-transit-layer/map-transit-layer.ts @@ -21,6 +21,7 @@ import {MapBaseLayer} from '../map-base-layer'; @Directive({ selector: 'map-transit-layer', exportAs: 'mapTransitLayer', + standalone: true, }) export class MapTransitLayer extends MapBaseLayer { /** diff --git a/src/universal-app/kitchen-sink/kitchen-sink.ts b/src/universal-app/kitchen-sink/kitchen-sink.ts index 7de8d262d287..4ad7bf8f1ef1 100644 --- a/src/universal-app/kitchen-sink/kitchen-sink.ts +++ b/src/universal-app/kitchen-sink/kitchen-sink.ts @@ -38,7 +38,22 @@ import {MatFormFieldModule} from '@angular/material/form-field'; import {MatSortModule} from '@angular/material/sort'; import {MatStepperModule} from '@angular/material/stepper'; import {YouTubePlayer} from '@angular/youtube-player'; -import {GoogleMapsModule} from '@angular/google-maps'; +import { + GoogleMap, + MapBicyclingLayer, + MapCircle, + MapGroundOverlay, + MapHeatmapLayer, + MapInfoWindow, + MapKmlLayer, + MapMarker, + MapMarkerClusterer, + MapPolygon, + MapPolyline, + MapRectangle, + MapTrafficLayer, + MapTransitLayer, +} from '@angular/google-maps'; import {Observable, of as observableOf} from 'rxjs'; export class TableDataSource extends DataSource { @@ -107,7 +122,20 @@ export class TestEntryComponent {} // Other modules YouTubePlayer, - GoogleMapsModule, + GoogleMap, + MapBicyclingLayer, + MapCircle, + MapGroundOverlay, + MapHeatmapLayer, + MapInfoWindow, + MapKmlLayer, + MapMarker, + MapMarkerClusterer, + MapPolygon, + MapPolyline, + MapRectangle, + MapTrafficLayer, + MapTransitLayer, ], }) export class KitchenSink { diff --git a/tools/public_api_guard/google-maps/google-maps.md b/tools/public_api_guard/google-maps/google-maps.md index d1bb1e6c18bc..b32c058e215b 100644 --- a/tools/public_api_guard/google-maps/google-maps.md +++ b/tools/public_api_guard/google-maps/google-maps.md @@ -114,7 +114,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy { set zoom(zoom: number); readonly zoomChanged: Observable; // (undocumented) - static ɵcmp: i0.ɵɵComponentDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; } @@ -126,7 +126,7 @@ export class GoogleMapsModule { // (undocumented) static ɵinj: i0.ɵɵInjectorDeclaration; // (undocumented) - static ɵmod: i0.ɵɵNgModuleDeclaration; + static ɵmod: i0.ɵɵNgModuleDeclaration; } // @public @@ -156,7 +156,7 @@ export class MapBaseLayer implements OnInit, OnDestroy { // (undocumented) protected _unsetMap(): void; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; } @@ -171,7 +171,7 @@ export class MapBicyclingLayer extends MapBaseLayer { // (undocumented) protected _unsetMap(): void; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; } @@ -229,7 +229,7 @@ export class MapCircle implements OnInit, OnDestroy { // (undocumented) readonly radiusChanged: Observable; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; } @@ -251,7 +251,7 @@ export class MapDirectionsRenderer implements OnInit, OnChanges, OnDestroy { ngOnInit(): void; set options(options: google.maps.DirectionsRendererOptions); // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; } @@ -319,7 +319,7 @@ export class MapGroundOverlay implements OnInit, OnDestroy { set opacity(opacity: number); set url(url: string); // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; } @@ -338,7 +338,7 @@ export class MapHeatmapLayer implements OnInit, OnChanges, OnDestroy { ngOnInit(): void; set options(options: Partial); // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; } @@ -366,7 +366,7 @@ export class MapInfoWindow implements OnInit, OnDestroy { readonly positionChanged: Observable; readonly zindexChanged: Observable; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; } @@ -392,7 +392,7 @@ export class MapKmlLayer implements OnInit, OnDestroy { // (undocumented) set url(url: string); // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; } @@ -449,7 +449,7 @@ export class MapMarker implements OnInit, OnChanges, OnDestroy, MapAnchorPoint { readonly visibleChanged: Observable; readonly zindexChanged: Observable; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; } @@ -550,7 +550,7 @@ export class MapMarkerClusterer implements OnInit, AfterContentInit, OnChanges, // (undocumented) set zoomOnClick(zoomOnClick: boolean); // (undocumented) - static ɵcmp: i0.ɵɵComponentDeclaration; + static ɵcmp: i0.ɵɵComponentDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; } @@ -584,7 +584,7 @@ export class MapPolygon implements OnInit, OnDestroy { readonly polygonMouseup: Observable; readonly polygonRightclick: Observable; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; } @@ -617,7 +617,7 @@ export class MapPolyline implements OnInit, OnDestroy { readonly polylineMouseup: Observable; readonly polylineRightclick: Observable; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; } @@ -651,7 +651,7 @@ export class MapRectangle implements OnInit, OnDestroy { readonly rectangleMouseup: Observable; readonly rectangleRightclick: Observable; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; } @@ -666,7 +666,7 @@ export class MapTrafficLayer implements OnInit, OnDestroy { ngOnInit(): void; trafficLayer?: google.maps.TrafficLayer; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; } @@ -681,7 +681,7 @@ export class MapTransitLayer extends MapBaseLayer { // (undocumented) protected _unsetMap(): void; // (undocumented) - static ɵdir: i0.ɵɵDirectiveDeclaration; + static ɵdir: i0.ɵɵDirectiveDeclaration; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; }