From 80e6e601604ad96bbc74de77740bdb37d3c98e88 Mon Sep 17 00:00:00 2001 From: Alexandre Ardhuin Date: Fri, 27 Sep 2024 21:50:26 +0200 Subject: [PATCH] replace .dartify() by .toDart.map(.toDart).toList() --- README-dev.md | 6 ----- lib/google_maps_core.dart | 1 + lib/src/generated/3d_map.dart | 25 +++++++++++++------ .../generated/3d_map/center_change_event.dart | 18 ------------- lib/src/generated/3d_map/click_event.dart | 20 --------------- .../3d_map/heading_change_event.dart | 18 ------------- lib/src/generated/3d_map/map_3_delement.dart | 8 ++++++ .../3d_map/map_3_delement_options.dart | 2 ++ .../generated/3d_map/polygon_3_delement.dart | 2 -- .../3d_map/polygon_3_delement_options.dart | 4 --- .../generated/3d_map/polyline_3_delement.dart | 2 -- .../3d_map/polyline_3_delement_options.dart | 4 --- .../generated/3d_map/range_change_event.dart | 18 ------------- .../generated/3d_map/roll_change_event.dart | 18 ------------- .../generated/3d_map/tilt_change_event.dart | 18 ------------- .../autocomplete_request.dart | 4 +-- .../autocomplete_data/place_prediction.dart | 2 +- lib/src/generated/control.dart | 1 + lib/src/generated/coordinates.dart | 4 +++ lib/src/generated/data/data_data_options.dart | 3 ++- .../directions_geocoded_waypoint.dart | 2 +- .../directions/directions_route.dart | 6 +++-- .../distance_matrix_response.dart | 4 +-- .../geocoder/geocoder_address_component.dart | 2 +- .../generated/geocoder/geocoder_result.dart | 4 +-- lib/src/generated/geocoder/landmark.dart | 2 +- .../vehicle.dart | 3 ++- lib/src/generated/map.dart | 2 ++ lib/src/generated/map/map_options.dart | 6 +++++ lib/src/generated/marker/marker_shape.dart | 11 ++++---- .../generated/place/address_component.dart | 2 +- .../generated/place/fetch_fields_request.dart | 2 +- lib/src/generated/place/opening_hours.dart | 2 +- lib/src/generated/place/place.dart | 6 ++++- .../place/search_by_text_request.dart | 2 +- .../place/search_nearby_request.dart | 12 +++++---- .../autocomplete_prediction.dart | 2 +- .../autocompletion_request.dart | 2 +- .../find_place_from_phone_number_request.dart | 2 +- .../find_place_from_query_request.dart | 2 +- .../places_service/place_details_request.dart | 3 ++- .../places_service/place_opening_hours.dart | 3 ++- .../generated/places_service/place_photo.dart | 2 +- .../places_service/place_result.dart | 4 +-- .../places_widget/autocomplete_options.dart | 5 ++-- .../place_autocomplete_element.dart | 2 +- .../place_autocomplete_element_options.dart | 2 +- .../visualization/heatmap_layer_options.dart | 3 ++- tool/generate_lib.dart | 11 +++++--- 49 files changed, 108 insertions(+), 181 deletions(-) delete mode 100644 lib/src/generated/3d_map/center_change_event.dart delete mode 100644 lib/src/generated/3d_map/click_event.dart delete mode 100644 lib/src/generated/3d_map/heading_change_event.dart delete mode 100644 lib/src/generated/3d_map/range_change_event.dart delete mode 100644 lib/src/generated/3d_map/roll_change_event.dart delete mode 100644 lib/src/generated/3d_map/tilt_change_event.dart diff --git a/README-dev.md b/README-dev.md index 48e46153..b9eacff3 100644 --- a/README-dev.md +++ b/README-dev.md @@ -4,12 +4,6 @@ Most of the lib is generated from the [online documentation](https://developers.google.com/maps/documentation/javascript/reference). -There are 2 steps: - -1. Generate template class from documentation -2. Generate real code with [js_wrapping_generator](https://pub.dev/packages/js_wrapping_generator) - ``` dart tool/generate_lib.dart -dart run build_runner build --delete-conflicting-outputs -v lib ``` \ No newline at end of file diff --git a/lib/google_maps_core.dart b/lib/google_maps_core.dart index 3686ecfc..7a79ccf8 100644 --- a/lib/google_maps_core.dart +++ b/lib/google_maps_core.dart @@ -17,5 +17,6 @@ export 'src/generated/coordinates.dart'; export 'src/generated/directions.dart'; export 'src/generated/errors.dart'; export 'src/generated/event.dart'; +export 'src/generated/map.dart'; export 'src/generated/marker.dart'; export 'src/generated/settings.dart'; \ No newline at end of file diff --git a/lib/src/generated/3d_map.dart b/lib/src/generated/3d_map.dart index a039200b..e356bbeb 100644 --- a/lib/src/generated/3d_map.dart +++ b/lib/src/generated/3d_map.dart @@ -22,19 +22,30 @@ import 'coordinates.dart' LatLngAltitude, LatLngAltitudeLiteral, LatLngBoundsOrLatLngBoundsLiteral, - LatLngLiteral; + LatLngLiteral, + Orientation3D, + Orientation3DLiteral, + Vector3D, + Vector3DLiteral; +import 'marker.dart' show CollisionBehavior; +import 'place.dart' show Place; part '3d_map/altitude_mode.dart'; -part '3d_map/center_change_event.dart'; -part '3d_map/click_event.dart'; -part '3d_map/heading_change_event.dart'; +part '3d_map/camera_options.dart'; +part '3d_map/fly_around_animation_options.dart'; +part '3d_map/fly_to_animation_options.dart'; +part '3d_map/location_click_event.dart'; part '3d_map/map_3_delement.dart'; part '3d_map/map_3_delement_options.dart'; +part '3d_map/marker_3_delement.dart'; +part '3d_map/marker_3_delement_options.dart'; +part '3d_map/marker_3_dinteractive_element.dart'; +part '3d_map/marker_3_dinteractive_element_options.dart'; +part '3d_map/model_3_delement.dart'; +part '3d_map/model_3_delement_options.dart'; +part '3d_map/place_click_event.dart'; part '3d_map/polygon_3_delement.dart'; part '3d_map/polygon_3_delement_options.dart'; part '3d_map/polyline_3_delement.dart'; part '3d_map/polyline_3_delement_options.dart'; -part '3d_map/range_change_event.dart'; -part '3d_map/roll_change_event.dart'; part '3d_map/steady_change_event.dart'; -part '3d_map/tilt_change_event.dart'; diff --git a/lib/src/generated/3d_map/center_change_event.dart b/lib/src/generated/3d_map/center_change_event.dart deleted file mode 100644 index fe8f051a..00000000 --- a/lib/src/generated/3d_map/center_change_event.dart +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2015, Alexandre Ardhuin -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -part of '../3d_map.dart'; - -@JS('google.maps.maps3d.CenterChangeEvent') -extension type CenterChangeEvent._(Event _) implements Event {} diff --git a/lib/src/generated/3d_map/click_event.dart b/lib/src/generated/3d_map/click_event.dart deleted file mode 100644 index 5e6ee74f..00000000 --- a/lib/src/generated/3d_map/click_event.dart +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2015, Alexandre Ardhuin -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -part of '../3d_map.dart'; - -@JS('google.maps.maps3d.ClickEvent') -extension type ClickEvent._(Event _) implements Event { - external LatLngAltitude? position; -} diff --git a/lib/src/generated/3d_map/heading_change_event.dart b/lib/src/generated/3d_map/heading_change_event.dart deleted file mode 100644 index a6e735a7..00000000 --- a/lib/src/generated/3d_map/heading_change_event.dart +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2015, Alexandre Ardhuin -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -part of '../3d_map.dart'; - -@JS('google.maps.maps3d.HeadingChangeEvent') -extension type HeadingChangeEvent._(Event _) implements Event {} diff --git a/lib/src/generated/3d_map/map_3_delement.dart b/lib/src/generated/3d_map/map_3_delement.dart index 6d0842c5..67726fab 100644 --- a/lib/src/generated/3d_map/map_3_delement.dart +++ b/lib/src/generated/3d_map/map_3_delement.dart @@ -23,6 +23,7 @@ extension type Map3DElement._(HTMLElement _) external LatLngBoundsOrLatLngBoundsLiteral? bounds; external JSAny? /*(LatLngAltitude|LatLngAltitudeLiteral)?*/ center; external bool? defaultLabelsDisabled; + external bool? defaultUIDisabled; external num? heading; external num? maxAltitude; external num? maxHeading; @@ -38,9 +39,16 @@ extension type Map3DElement._(HTMLElement _) JSAny /*EventListener|EventListenerObject*/ listener, [ JSAny? /*(boolean|AddEventListenerOptions)?*/ options, ]); + external void flyCameraAround( + FlyAroundAnimationOptions options, + ); + external void flyCameraTo( + FlyToAnimationOptions options, + ); external void removeEventListener( String type, JSAny /*EventListener|EventListenerObject*/ listener, [ JSAny? /*(boolean|EventListenerOptions)?*/ options, ]); + external void stopCameraAnimation(); } diff --git a/lib/src/generated/3d_map/map_3_delement_options.dart b/lib/src/generated/3d_map/map_3_delement_options.dart index c931b7a5..96ae36a4 100644 --- a/lib/src/generated/3d_map/map_3_delement_options.dart +++ b/lib/src/generated/3d_map/map_3_delement_options.dart @@ -19,6 +19,7 @@ extension type Map3DElementOptions._(JSObject _) implements JSObject { LatLngBoundsOrLatLngBoundsLiteral? bounds, JSAny? /*(LatLngAltitude|LatLngAltitudeLiteral)?*/ center, bool? defaultLabelsDisabled, + bool? defaultUIDisabled, num? heading, num? maxAltitude, num? maxHeading, @@ -33,6 +34,7 @@ extension type Map3DElementOptions._(JSObject _) implements JSObject { external LatLngBoundsOrLatLngBoundsLiteral? bounds; external JSAny? /*(LatLngAltitude|LatLngAltitudeLiteral)?*/ center; external bool? defaultLabelsDisabled; + external bool? defaultUIDisabled; external num? heading; external num? maxAltitude; external num? maxHeading; diff --git a/lib/src/generated/3d_map/polygon_3_delement.dart b/lib/src/generated/3d_map/polygon_3_delement.dart index 19b885ce..d9929db9 100644 --- a/lib/src/generated/3d_map/polygon_3_delement.dart +++ b/lib/src/generated/3d_map/polygon_3_delement.dart @@ -24,7 +24,6 @@ extension type Polygon3DElement._(HTMLElement _) external bool? drawsOccludedSegments; external bool? extruded; external String? fillColor; - external num? fillOpacity; external bool? geodesic; external JSIterable< JSIterable< @@ -34,7 +33,6 @@ extension type Polygon3DElement._(HTMLElement _) JSAny /*LatLngAltitude|LatLngAltitudeLiteral|LatLngLiteral*/ >? outerCoordinates; external String? strokeColor; - external num? strokeOpacity; external num? strokeWidth; external num? zIndex; external void addEventListener( diff --git a/lib/src/generated/3d_map/polygon_3_delement_options.dart b/lib/src/generated/3d_map/polygon_3_delement_options.dart index 40c94c77..82d3e825 100644 --- a/lib/src/generated/3d_map/polygon_3_delement_options.dart +++ b/lib/src/generated/3d_map/polygon_3_delement_options.dart @@ -20,7 +20,6 @@ extension type Polygon3DElementOptions._(JSObject _) implements JSObject { bool? drawsOccludedSegments, bool? extruded, String? fillColor, - num? fillOpacity, bool? geodesic, JSIterable< JSAny /*Iterable|Iterable*/ >? @@ -28,7 +27,6 @@ extension type Polygon3DElementOptions._(JSObject _) implements JSObject { JSIterable? outerCoordinates, String? strokeColor, - num? strokeOpacity, num? strokeWidth, num? zIndex, }); @@ -36,7 +34,6 @@ extension type Polygon3DElementOptions._(JSObject _) implements JSObject { external bool? drawsOccludedSegments; external bool? extruded; external String? fillColor; - external num? fillOpacity; external bool? geodesic; external JSIterable< JSAny /*Iterable|Iterable*/ >? @@ -45,7 +42,6 @@ extension type Polygon3DElementOptions._(JSObject _) implements JSObject { JSAny /*LatLngAltitude|LatLngAltitudeLiteral|LatLngLiteral*/ >? outerCoordinates; external String? strokeColor; - external num? strokeOpacity; external num? strokeWidth; external num? zIndex; } diff --git a/lib/src/generated/3d_map/polyline_3_delement.dart b/lib/src/generated/3d_map/polyline_3_delement.dart index 5138ce77..7684104d 100644 --- a/lib/src/generated/3d_map/polyline_3_delement.dart +++ b/lib/src/generated/3d_map/polyline_3_delement.dart @@ -28,10 +28,8 @@ extension type Polyline3DElement._(HTMLElement _) external bool? extruded; external bool? geodesic; external String? outerColor; - external num? outerOpacity; external num? outerWidth; external String? strokeColor; - external num? strokeOpacity; external num? strokeWidth; external num? zIndex; external void addEventListener( diff --git a/lib/src/generated/3d_map/polyline_3_delement_options.dart b/lib/src/generated/3d_map/polyline_3_delement_options.dart index 3c1ffec6..196115ca 100644 --- a/lib/src/generated/3d_map/polyline_3_delement_options.dart +++ b/lib/src/generated/3d_map/polyline_3_delement_options.dart @@ -23,10 +23,8 @@ extension type Polyline3DElementOptions._(JSObject _) implements JSObject { bool? extruded, bool? geodesic, String? outerColor, - num? outerOpacity, num? outerWidth, String? strokeColor, - num? strokeOpacity, num? strokeWidth, num? zIndex, }); @@ -38,10 +36,8 @@ extension type Polyline3DElementOptions._(JSObject _) implements JSObject { external bool? extruded; external bool? geodesic; external String? outerColor; - external num? outerOpacity; external num? outerWidth; external String? strokeColor; - external num? strokeOpacity; external num? strokeWidth; external num? zIndex; } diff --git a/lib/src/generated/3d_map/range_change_event.dart b/lib/src/generated/3d_map/range_change_event.dart deleted file mode 100644 index 49296c61..00000000 --- a/lib/src/generated/3d_map/range_change_event.dart +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2015, Alexandre Ardhuin -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -part of '../3d_map.dart'; - -@JS('google.maps.maps3d.RangeChangeEvent') -extension type RangeChangeEvent._(Event _) implements Event {} diff --git a/lib/src/generated/3d_map/roll_change_event.dart b/lib/src/generated/3d_map/roll_change_event.dart deleted file mode 100644 index 037314fc..00000000 --- a/lib/src/generated/3d_map/roll_change_event.dart +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2015, Alexandre Ardhuin -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -part of '../3d_map.dart'; - -@JS('google.maps.maps3d.RollChangeEvent') -extension type RollChangeEvent._(Event _) implements Event {} diff --git a/lib/src/generated/3d_map/tilt_change_event.dart b/lib/src/generated/3d_map/tilt_change_event.dart deleted file mode 100644 index 0deb87bd..00000000 --- a/lib/src/generated/3d_map/tilt_change_event.dart +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2015, Alexandre Ardhuin -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -part of '../3d_map.dart'; - -@JS('google.maps.maps3d.TiltChangeEvent') -extension type TiltChangeEvent._(Event _) implements Event {} diff --git a/lib/src/generated/autocomplete_data/autocomplete_request.dart b/lib/src/generated/autocomplete_data/autocomplete_request.dart index 4eb63124..47cf2f01 100644 --- a/lib/src/generated/autocomplete_data/autocomplete_request.dart +++ b/lib/src/generated/autocomplete_data/autocomplete_request.dart @@ -31,13 +31,13 @@ extension type AutocompleteRequest._(JSObject _) implements JSObject { @JS('includedPrimaryTypes') external JSArray? _includedPrimaryTypes; List? get includedPrimaryTypes => - _includedPrimaryTypes.dartify() as List?; + _includedPrimaryTypes?.toDart.map((type) => type.toDart).toList(); set includedPrimaryTypes(List? value) => _includedPrimaryTypes = value.jsify() as JSArray?; @JS('includedRegionCodes') external JSArray? _includedRegionCodes; List? get includedRegionCodes => - _includedRegionCodes.dartify() as List?; + _includedRegionCodes?.toDart.map((type) => type.toDart).toList(); set includedRegionCodes(List? value) => _includedRegionCodes = value.jsify() as JSArray?; external num? inputOffset; diff --git a/lib/src/generated/autocomplete_data/place_prediction.dart b/lib/src/generated/autocomplete_data/place_prediction.dart index 7dbb017d..603ab7c7 100644 --- a/lib/src/generated/autocomplete_data/place_prediction.dart +++ b/lib/src/generated/autocomplete_data/place_prediction.dart @@ -23,7 +23,7 @@ extension type PlacePrediction._(JSObject _) implements JSObject { external FormattableText text; @JS('types') external JSArray _types; - List get types => _types.dartify() as List; + List get types => _types.toDart.map((type) => type.toDart).toList(); set types(List value) => _types = value.jsify() as JSArray; external Place toPlace(); } diff --git a/lib/src/generated/control.dart b/lib/src/generated/control.dart index 88dccecf..607087ee 100644 --- a/lib/src/generated/control.dart +++ b/lib/src/generated/control.dart @@ -15,6 +15,7 @@ import 'dart:js_interop'; import '/src/js/iterable.dart' show JSIterable; import 'street_view_service.dart' show StreetViewSource; +part 'control/camera_control_options.dart'; part 'control/control_position.dart'; part 'control/fullscreen_control_options.dart'; part 'control/map_type_control_options.dart'; diff --git a/lib/src/generated/coordinates.dart b/lib/src/generated/coordinates.dart index 01d8e2eb..def83431 100644 --- a/lib/src/generated/coordinates.dart +++ b/lib/src/generated/coordinates.dart @@ -21,6 +21,10 @@ part 'coordinates/lat_lng_altitude_literal.dart'; part 'coordinates/lat_lng_bounds.dart'; part 'coordinates/lat_lng_bounds_literal.dart'; part 'coordinates/lat_lng_literal.dart'; +part 'coordinates/orientation_3.dart'; +part 'coordinates/orientation_3_dliteral.dart'; part 'coordinates/padding.dart'; part 'coordinates/point.dart'; part 'coordinates/size.dart'; +part 'coordinates/vector_3.dart'; +part 'coordinates/vector_3_dliteral.dart'; diff --git a/lib/src/generated/data/data_data_options.dart b/lib/src/generated/data/data_data_options.dart index e530e411..f40c256e 100644 --- a/lib/src/generated/data/data_data_options.dart +++ b/lib/src/generated/data/data_data_options.dart @@ -27,7 +27,8 @@ extension type DataDataOptions._(JSObject _) implements JSObject { external ControlPosition? controlPosition; @JS('controls') external JSArray? _controls; - List? get controls => _controls.dartify() as List?; + List? get controls => + _controls?.toDart.map((type) => type.toDart).toList(); set controls(List? value) => _controls = value.jsify() as JSArray?; external String? drawingMode; diff --git a/lib/src/generated/directions/directions_geocoded_waypoint.dart b/lib/src/generated/directions/directions_geocoded_waypoint.dart index c60a4cd0..7bf6b808 100644 --- a/lib/src/generated/directions/directions_geocoded_waypoint.dart +++ b/lib/src/generated/directions/directions_geocoded_waypoint.dart @@ -30,7 +30,7 @@ extension type DirectionsGeocodedWaypoint._(JSObject _) implements JSObject { set placeId(String? value) => _placeId = value; @JS('types') external JSArray? _types; - List? get types => _types.dartify() as List?; + List? get types => _types?.toDart.map((type) => type.toDart).toList(); set types(List? value) => _types = value.jsify() as JSArray?; } diff --git a/lib/src/generated/directions/directions_route.dart b/lib/src/generated/directions/directions_route.dart index 0aee2967..82ae1ff9 100644 --- a/lib/src/generated/directions/directions_route.dart +++ b/lib/src/generated/directions/directions_route.dart @@ -43,12 +43,14 @@ extension type DirectionsRoute._(JSObject _) implements JSObject { external String summary; @JS('warnings') external JSArray _warnings; - List get warnings => _warnings.dartify() as List; + List get warnings => + _warnings.toDart.map((type) => type.toDart).toList(); set warnings(List value) => _warnings = value.jsify() as JSArray; @JS('waypoint_order') external JSArray _waypointOrder; - List get waypointOrder => _waypointOrder.dartify() as List; + List get waypointOrder => + _waypointOrder.toDart.map((type) => type.toDartInt).toList(); set waypointOrder(List value) => _waypointOrder = value.jsify() as JSArray; external TransitFare? fare; diff --git a/lib/src/generated/distance_matrix/distance_matrix_response.dart b/lib/src/generated/distance_matrix/distance_matrix_response.dart index 8e0dd109..ff7b37de 100644 --- a/lib/src/generated/distance_matrix/distance_matrix_response.dart +++ b/lib/src/generated/distance_matrix/distance_matrix_response.dart @@ -23,13 +23,13 @@ extension type DistanceMatrixResponse._(JSObject _) implements JSObject { @JS('destinationAddresses') external JSArray _destinationAddresses; List get destinationAddresses => - _destinationAddresses.dartify() as List; + _destinationAddresses.toDart.map((type) => type.toDart).toList(); set destinationAddresses(List value) => _destinationAddresses = value.jsify() as JSArray; @JS('originAddresses') external JSArray _originAddresses; List get originAddresses => - _originAddresses.dartify() as List; + _originAddresses.toDart.map((type) => type.toDart).toList(); set originAddresses(List value) => _originAddresses = value.jsify() as JSArray; @JS('rows') diff --git a/lib/src/generated/geocoder/geocoder_address_component.dart b/lib/src/generated/geocoder/geocoder_address_component.dart index 3ed7b943..47fd771b 100644 --- a/lib/src/generated/geocoder/geocoder_address_component.dart +++ b/lib/src/generated/geocoder/geocoder_address_component.dart @@ -30,6 +30,6 @@ extension type GeocoderAddressComponent._(JSObject _) implements JSObject { set shortName(String value) => _shortName = value; @JS('types') external JSArray _types; - List get types => _types.dartify() as List; + List get types => _types.toDart.map((type) => type.toDart).toList(); set types(List value) => _types = value.jsify() as JSArray; } diff --git a/lib/src/generated/geocoder/geocoder_result.dart b/lib/src/generated/geocoder/geocoder_result.dart index aa1d28bb..61079f3d 100644 --- a/lib/src/generated/geocoder/geocoder_result.dart +++ b/lib/src/generated/geocoder/geocoder_result.dart @@ -43,7 +43,7 @@ extension type GeocoderResult._(JSObject _) implements JSObject { set placeId(String value) => _placeId = value; @JS('types') external JSArray _types; - List get types => _types.dartify() as List; + List get types => _types.toDart.map((type) => type.toDart).toList(); set types(List value) => _types = value.jsify() as JSArray; @JS('address_descriptor') external AddressDescriptor? _addressDescriptor; @@ -60,7 +60,7 @@ extension type GeocoderResult._(JSObject _) implements JSObject { @JS('postcode_localities') external JSArray? _postcodeLocalities; List? get postcodeLocalities => - _postcodeLocalities.dartify() as List?; + _postcodeLocalities?.toDart.map((type) => type.toDart).toList(); set postcodeLocalities(List? value) => _postcodeLocalities = value.jsify() as JSArray?; } diff --git a/lib/src/generated/geocoder/landmark.dart b/lib/src/generated/geocoder/landmark.dart index 7adb0366..e02fa92c 100644 --- a/lib/src/generated/geocoder/landmark.dart +++ b/lib/src/generated/geocoder/landmark.dart @@ -48,7 +48,7 @@ extension type Landmark._(JSObject _) implements JSObject { _straightLineDistanceMeters = value; @JS('types') external JSArray _types; - List get types => _types.dartify() as List; + List get types => _types.toDart.map((type) => type.toDart).toList(); set types(List value) => _types = value.jsify() as JSArray; @JS('travel_distance_meters') external num? _travelDistanceMeters; diff --git a/lib/src/generated/journey_sharing_fleet_engine_entities/vehicle.dart b/lib/src/generated/journey_sharing_fleet_engine_entities/vehicle.dart index 6a3fc05f..6ab45ce3 100644 --- a/lib/src/generated/journey_sharing_fleet_engine_entities/vehicle.dart +++ b/lib/src/generated/journey_sharing_fleet_engine_entities/vehicle.dart @@ -42,7 +42,8 @@ extension type Vehicle._(JSObject _) implements JSObject { external Date? currentRouteSegmentVersion; @JS('currentTrips') external JSArray? _currentTrips; - List? get currentTrips => _currentTrips.dartify() as List?; + List? get currentTrips => + _currentTrips?.toDart.map((type) => type.toDart).toList(); set currentTrips(List? value) => _currentTrips = value.jsify() as JSArray?; external Date? etaToFirstWaypoint; diff --git a/lib/src/generated/map.dart b/lib/src/generated/map.dart index b2c1afdc..4c15129e 100644 --- a/lib/src/generated/map.dart +++ b/lib/src/generated/map.dart @@ -20,6 +20,7 @@ import 'package:web/web.dart' show Event, HTMLElement; import 'control.dart' show + CameraControlOptions, ControlPosition, FullscreenControlOptions, MapTypeControlOptions, @@ -44,6 +45,7 @@ import 'street_view.dart' show StreetViewPanorama; part 'map/bicycling_layer.dart'; part 'map/camera_options.dart'; +part 'map/color_scheme.dart'; part 'map/icon_mouse_event.dart'; part 'map/map.dart'; part 'map/map_capabilities.dart'; diff --git a/lib/src/generated/map/map_options.dart b/lib/src/generated/map/map_options.dart index 55a2c762..584e3cbe 100644 --- a/lib/src/generated/map/map_options.dart +++ b/lib/src/generated/map/map_options.dart @@ -17,8 +17,11 @@ part of '../map.dart'; extension type MapOptions._(JSObject _) implements JSObject { external MapOptions({ String? backgroundColor, + bool? cameraControl, + CameraControlOptions? cameraControlOptions, LatLngOrLatLngLiteral? center, bool? clickableIcons, + JSAny? /*(ColorScheme|string)?*/ colorScheme, num? controlSize, bool? disableDefaultUI, bool? disableDoubleClickZoom, @@ -59,8 +62,11 @@ extension type MapOptions._(JSObject _) implements JSObject { ZoomControlOptions? zoomControlOptions, }); external String? backgroundColor; + external bool? cameraControl; + external CameraControlOptions? cameraControlOptions; external LatLngOrLatLngLiteral? center; external bool? clickableIcons; + external JSAny? /*(ColorScheme|string)?*/ colorScheme; external num? controlSize; external bool? disableDefaultUI; external bool? disableDoubleClickZoom; diff --git a/lib/src/generated/marker/marker_shape.dart b/lib/src/generated/marker/marker_shape.dart index bad03a1a..64331f2c 100644 --- a/lib/src/generated/marker/marker_shape.dart +++ b/lib/src/generated/marker/marker_shape.dart @@ -16,12 +16,13 @@ part of '../marker.dart'; extension type MarkerShape._(JSObject _) implements JSObject { external MarkerShape({ - JSArray coords, String type, + JSArray? coords, }); - @JS('coords') - external JSArray _coords; - List get coords => _coords.dartify() as List; - set coords(List value) => _coords = value.jsify() as JSArray; external String type; + @JS('coords') + external JSArray? _coords; + List? get coords => + _coords?.toDart.map((type) => type.toDartInt).toList(); + set coords(List? value) => _coords = value.jsify() as JSArray?; } diff --git a/lib/src/generated/place/address_component.dart b/lib/src/generated/place/address_component.dart index 1966a8ba..5e684c98 100644 --- a/lib/src/generated/place/address_component.dart +++ b/lib/src/generated/place/address_component.dart @@ -20,6 +20,6 @@ extension type AddressComponent._(JSObject _) implements JSObject { external String? shortText; @JS('types') external JSArray _types; - List get types => _types.dartify() as List; + List get types => _types.toDart.map((type) => type.toDart).toList(); set types(List value) => _types = value.jsify() as JSArray; } diff --git a/lib/src/generated/place/fetch_fields_request.dart b/lib/src/generated/place/fetch_fields_request.dart index f422fc0c..8873d7a9 100644 --- a/lib/src/generated/place/fetch_fields_request.dart +++ b/lib/src/generated/place/fetch_fields_request.dart @@ -20,7 +20,7 @@ extension type FetchFieldsRequest._(JSObject _) implements JSObject { }); @JS('fields') external JSArray _fields; - List get fields => _fields.dartify() as List; + List get fields => _fields.toDart.map((type) => type.toDart).toList(); set fields(List value) => _fields = value.jsify() as JSArray; } diff --git a/lib/src/generated/place/opening_hours.dart b/lib/src/generated/place/opening_hours.dart index 5969de72..66045b1c 100644 --- a/lib/src/generated/place/opening_hours.dart +++ b/lib/src/generated/place/opening_hours.dart @@ -23,7 +23,7 @@ extension type OpeningHours._(JSObject _) implements JSObject { @JS('weekdayDescriptions') external JSArray _weekdayDescriptions; List get weekdayDescriptions => - _weekdayDescriptions.dartify() as List; + _weekdayDescriptions.toDart.map((type) => type.toDart).toList(); set weekdayDescriptions(List value) => _weekdayDescriptions = value.jsify() as JSArray; } diff --git a/lib/src/generated/place/place.dart b/lib/src/generated/place/place.dart index 1d6116b1..709fe335 100644 --- a/lib/src/generated/place/place.dart +++ b/lib/src/generated/place/place.dart @@ -33,6 +33,7 @@ extension type Place._(JSObject _) implements JSObject { set attributions(List? value) => _attributions = value?.toJS; external BusinessStatus? businessStatus; external String? displayName; + external String? displayNameLanguageCode; external String? editorialSummary; external String? editorialSummaryLanguageCode; external EVChargeOptions? evChargeOptions; @@ -65,6 +66,9 @@ extension type Place._(JSObject _) implements JSObject { set photos(List? value) => _photos = value?.toJS; external PlusCode? plusCode; external PriceLevel? priceLevel; + external String? primaryType; + external String? primaryTypeDisplayName; + external String? primaryTypeDisplayNameLanguageCode; external num? rating; external OpeningHours? regularOpeningHours; external String? requestedLanguage; @@ -86,7 +90,7 @@ extension type Place._(JSObject _) implements JSObject { external String? svgIconMaskURI; @JS('types') external JSArray? _types; - List? get types => _types.dartify() as List?; + List? get types => _types?.toDart.map((type) => type.toDart).toList(); set types(List? value) => _types = value.jsify() as JSArray?; external num? userRatingCount; diff --git a/lib/src/generated/place/search_by_text_request.dart b/lib/src/generated/place/search_by_text_request.dart index a7a52f5c..e89cb5b7 100644 --- a/lib/src/generated/place/search_by_text_request.dart +++ b/lib/src/generated/place/search_by_text_request.dart @@ -36,7 +36,7 @@ extension type SearchByTextRequest._(JSObject _) implements JSObject { }); @JS('fields') external JSArray _fields; - List get fields => _fields.dartify() as List; + List get fields => _fields.toDart.map((type) => type.toDart).toList(); set fields(List value) => _fields = value.jsify() as JSArray; external EVSearchOptions? evSearchOptions; diff --git a/lib/src/generated/place/search_nearby_request.dart b/lib/src/generated/place/search_nearby_request.dart index 6a05b5b5..0fdefe53 100644 --- a/lib/src/generated/place/search_nearby_request.dart +++ b/lib/src/generated/place/search_nearby_request.dart @@ -29,30 +29,32 @@ extension type SearchNearbyRequest._(JSObject _) implements JSObject { }); @JS('fields') external JSArray _fields; - List get fields => _fields.dartify() as List; + List get fields => _fields.toDart.map((type) => type.toDart).toList(); set fields(List value) => _fields = value.jsify() as JSArray; external JSAny /*Circle|CircleLiteral*/ locationRestriction; @JS('excludedPrimaryTypes') external JSArray? _excludedPrimaryTypes; List? get excludedPrimaryTypes => - _excludedPrimaryTypes.dartify() as List?; + _excludedPrimaryTypes?.toDart.map((type) => type.toDart).toList(); set excludedPrimaryTypes(List? value) => _excludedPrimaryTypes = value.jsify() as JSArray?; @JS('excludedTypes') external JSArray? _excludedTypes; - List? get excludedTypes => _excludedTypes.dartify() as List?; + List? get excludedTypes => + _excludedTypes?.toDart.map((type) => type.toDart).toList(); set excludedTypes(List? value) => _excludedTypes = value.jsify() as JSArray?; @JS('includedPrimaryTypes') external JSArray? _includedPrimaryTypes; List? get includedPrimaryTypes => - _includedPrimaryTypes.dartify() as List?; + _includedPrimaryTypes?.toDart.map((type) => type.toDart).toList(); set includedPrimaryTypes(List? value) => _includedPrimaryTypes = value.jsify() as JSArray?; @JS('includedTypes') external JSArray? _includedTypes; - List? get includedTypes => _includedTypes.dartify() as List?; + List? get includedTypes => + _includedTypes?.toDart.map((type) => type.toDart).toList(); set includedTypes(List? value) => _includedTypes = value.jsify() as JSArray?; external String? language; diff --git a/lib/src/generated/places_autocomplete_service/autocomplete_prediction.dart b/lib/src/generated/places_autocomplete_service/autocomplete_prediction.dart index 80cf96e3..7e3f5b52 100644 --- a/lib/src/generated/places_autocomplete_service/autocomplete_prediction.dart +++ b/lib/src/generated/places_autocomplete_service/autocomplete_prediction.dart @@ -45,7 +45,7 @@ extension type AutocompletePrediction._(JSObject _) implements JSObject { set terms(List value) => _terms = value.toJS; @JS('types') external JSArray _types; - List get types => _types.dartify() as List; + List get types => _types.toDart.map((type) => type.toDart).toList(); set types(List value) => _types = value.jsify() as JSArray; @JS('distance_meters') external num? _distanceMeters; diff --git a/lib/src/generated/places_autocomplete_service/autocompletion_request.dart b/lib/src/generated/places_autocomplete_service/autocompletion_request.dart index d3fa382f..39a5032a 100644 --- a/lib/src/generated/places_autocomplete_service/autocompletion_request.dart +++ b/lib/src/generated/places_autocomplete_service/autocompletion_request.dart @@ -44,7 +44,7 @@ extension type AutocompletionRequest._(JSObject _) implements JSObject { external AutocompleteSessionToken? sessionToken; @JS('types') external JSArray? _types; - List? get types => _types.dartify() as List?; + List? get types => _types?.toDart.map((type) => type.toDart).toList(); set types(List? value) => _types = value.jsify() as JSArray?; } diff --git a/lib/src/generated/places_service/find_place_from_phone_number_request.dart b/lib/src/generated/places_service/find_place_from_phone_number_request.dart index 61fbb220..51fda8b7 100644 --- a/lib/src/generated/places_service/find_place_from_phone_number_request.dart +++ b/lib/src/generated/places_service/find_place_from_phone_number_request.dart @@ -24,7 +24,7 @@ extension type FindPlaceFromPhoneNumberRequest._(JSObject _) }); @JS('fields') external JSArray _fields; - List get fields => _fields.dartify() as List; + List get fields => _fields.toDart.map((type) => type.toDart).toList(); set fields(List value) => _fields = value.jsify() as JSArray; external String phoneNumber; diff --git a/lib/src/generated/places_service/find_place_from_query_request.dart b/lib/src/generated/places_service/find_place_from_query_request.dart index e72a5046..07bc37dc 100644 --- a/lib/src/generated/places_service/find_place_from_query_request.dart +++ b/lib/src/generated/places_service/find_place_from_query_request.dart @@ -23,7 +23,7 @@ extension type FindPlaceFromQueryRequest._(JSObject _) implements JSObject { }); @JS('fields') external JSArray _fields; - List get fields => _fields.dartify() as List; + List get fields => _fields.toDart.map((type) => type.toDart).toList(); set fields(List value) => _fields = value.jsify() as JSArray; external String query; diff --git a/lib/src/generated/places_service/place_details_request.dart b/lib/src/generated/places_service/place_details_request.dart index 95daed10..9290a88b 100644 --- a/lib/src/generated/places_service/place_details_request.dart +++ b/lib/src/generated/places_service/place_details_request.dart @@ -25,7 +25,8 @@ extension type PlaceDetailsRequest._(JSObject _) implements JSObject { external String placeId; @JS('fields') external JSArray? _fields; - List? get fields => _fields.dartify() as List?; + List? get fields => + _fields?.toDart.map((type) => type.toDart).toList(); set fields(List? value) => _fields = value.jsify() as JSArray?; external String? language; diff --git a/lib/src/generated/places_service/place_opening_hours.dart b/lib/src/generated/places_service/place_opening_hours.dart index ede84e52..f94f4e2a 100644 --- a/lib/src/generated/places_service/place_opening_hours.dart +++ b/lib/src/generated/places_service/place_opening_hours.dart @@ -30,7 +30,8 @@ extension type PlaceOpeningHours._(JSObject _) implements JSObject { set periods(List? value) => _periods = value?.toJS; @JS('weekday_text') external JSArray? _weekdayText; - List? get weekdayText => _weekdayText.dartify() as List?; + List? get weekdayText => + _weekdayText?.toDart.map((type) => type.toDart).toList(); set weekdayText(List? value) => _weekdayText = value.jsify() as JSArray?; external bool? isOpen([ diff --git a/lib/src/generated/places_service/place_photo.dart b/lib/src/generated/places_service/place_photo.dart index a3df77c5..238cc626 100644 --- a/lib/src/generated/places_service/place_photo.dart +++ b/lib/src/generated/places_service/place_photo.dart @@ -24,7 +24,7 @@ extension type PlacePhoto._(JSObject _) implements JSObject { @JS('html_attributions') external JSArray _htmlAttributions; List get htmlAttributions => - _htmlAttributions.dartify() as List; + _htmlAttributions.toDart.map((type) => type.toDart).toList(); set htmlAttributions(List value) => _htmlAttributions = value.jsify() as JSArray; external num width; diff --git a/lib/src/generated/places_service/place_result.dart b/lib/src/generated/places_service/place_result.dart index f4905a5b..2106d33a 100644 --- a/lib/src/generated/places_service/place_result.dart +++ b/lib/src/generated/places_service/place_result.dart @@ -75,7 +75,7 @@ extension type PlaceResult._(JSObject _) implements JSObject { @JS('html_attributions') external JSArray? _htmlAttributions; List? get htmlAttributions => - _htmlAttributions.dartify() as List?; + _htmlAttributions?.toDart.map((type) => type.toDart).toList(); set htmlAttributions(List? value) => _htmlAttributions = value.jsify() as JSArray?; external String? icon; @@ -124,7 +124,7 @@ extension type PlaceResult._(JSObject _) implements JSObject { set reviews(List? value) => _reviews = value?.toJS; @JS('types') external JSArray? _types; - List? get types => _types.dartify() as List?; + List? get types => _types?.toDart.map((type) => type.toDart).toList(); set types(List? value) => _types = value.jsify() as JSArray?; external String? url; diff --git a/lib/src/generated/places_widget/autocomplete_options.dart b/lib/src/generated/places_widget/autocomplete_options.dart index ecc9b529..97083447 100644 --- a/lib/src/generated/places_widget/autocomplete_options.dart +++ b/lib/src/generated/places_widget/autocomplete_options.dart @@ -27,14 +27,15 @@ extension type AutocompleteOptions._(JSObject _) implements JSObject { external ComponentRestrictions? componentRestrictions; @JS('fields') external JSArray? _fields; - List? get fields => _fields.dartify() as List?; + List? get fields => + _fields?.toDart.map((type) => type.toDart).toList(); set fields(List? value) => _fields = value.jsify() as JSArray?; external bool? placeIdOnly; external bool? strictBounds; @JS('types') external JSArray? _types; - List? get types => _types.dartify() as List?; + List? get types => _types?.toDart.map((type) => type.toDart).toList(); set types(List? value) => _types = value.jsify() as JSArray?; } diff --git a/lib/src/generated/places_widget/place_autocomplete_element.dart b/lib/src/generated/places_widget/place_autocomplete_element.dart index 44e14f3b..eb7efb5d 100644 --- a/lib/src/generated/places_widget/place_autocomplete_element.dart +++ b/lib/src/generated/places_widget/place_autocomplete_element.dart @@ -28,7 +28,7 @@ extension type PlaceAutocompleteElement._(HTMLElement _) external String? requestedRegion; @JS('types') external JSArray? _types; - List? get types => _types.dartify() as List?; + List? get types => _types?.toDart.map((type) => type.toDart).toList(); set types(List? value) => _types = value.jsify() as JSArray?; external void addEventListener( diff --git a/lib/src/generated/places_widget/place_autocomplete_element_options.dart b/lib/src/generated/places_widget/place_autocomplete_element_options.dart index 73d48081..ff6719d3 100644 --- a/lib/src/generated/places_widget/place_autocomplete_element_options.dart +++ b/lib/src/generated/places_widget/place_autocomplete_element_options.dart @@ -31,7 +31,7 @@ extension type PlaceAutocompleteElementOptions._(JSObject _) external String? requestedRegion; @JS('types') external JSArray? _types; - List? get types => _types.dartify() as List?; + List? get types => _types?.toDart.map((type) => type.toDart).toList(); set types(List? value) => _types = value.jsify() as JSArray?; } diff --git a/lib/src/generated/visualization/heatmap_layer_options.dart b/lib/src/generated/visualization/heatmap_layer_options.dart index caf46a64..e46d919f 100644 --- a/lib/src/generated/visualization/heatmap_layer_options.dart +++ b/lib/src/generated/visualization/heatmap_layer_options.dart @@ -30,7 +30,8 @@ extension type HeatmapLayerOptions._(JSObject _) implements JSObject { external bool? dissipating; @JS('gradient') external JSArray? _gradient; - List? get gradient => _gradient.dartify() as List?; + List? get gradient => + _gradient?.toDart.map((type) => type.toDart).toList(); set gradient(List? value) => _gradient = value.jsify() as JSArray?; external Map? map; diff --git a/tool/generate_lib.dart b/tool/generate_lib.dart index 9316393c..d5bb90ca 100644 --- a/tool/generate_lib.dart +++ b/tool/generate_lib.dart @@ -90,8 +90,7 @@ List buildImports(List libs, Lib lib) { .where((l) => l.elements.expand((e) => e.names).contains(dep)) .firstOrNull); return [ - for (final (libName, elements) in depsBylib.entries - .whereNotNull() + for (final (libName, elements) in depsBylib.entries.nonNulls .where((e) => e.key != lib) .where((e) => e.key != null) .map((e) { @@ -1049,10 +1048,15 @@ class Property { _ => throw Error(), }; final dartType = 'List<$parameterType>${optional ? '?' : ''}'; + final convertion = switch (paramJSType) { + 'string' => 'toDart', + 'number' => 'toDartInt', + _ => throw Error(), + }; return """ @JS('$name') external $type _$accessorName; - $dartType get $accessorName => _$accessorName.dartify() as $dartType; + $dartType get $accessorName => _$accessorName${optional ? '?' : ''}.toDart.map((type) => type.$convertion).toList(); set $accessorName($dartType value) => _$accessorName = value.jsify() as $type;"""; }(), _ => () { @@ -1197,6 +1201,7 @@ String toDartType(AType value, bool isJS) => switch (value) { 'Iterable' => 'JSIterable', 'Error' => 'JSError', 'Object' => 'JSObject', + 'undefined' => 'void', final v => () { final parts = v.split('.'); if (parts.last.startsWith(RegExp(r'[a-z]'))) {