From 4e84564e21b8b527f57ad970da435029559c750f Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Tue, 3 Feb 2026 22:43:43 +0100 Subject: [PATCH] Drop Biome.js for oxfmt and oxlint --- .github/PULL_REQUEST_TEMPLATE.md | 3 +- .github/workflows/close-pull-request.yml | 30 +++---- .symfony.bundle.yaml | 6 +- CHANGELOG.md | 87 +++++++++--------- README.md | 8 +- assets/README.md | 8 +- assets/dist/abstract_map_controller.d.ts | 12 +-- assets/dist/abstract_map_controller.js | 6 +- assets/package.json | 4 +- assets/src/abstract_map_controller.ts | 108 +++++++++++++++++++---- 10 files changed, 175 insertions(+), 97 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index df3b474..887284e 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,5 +1,4 @@ -Please do not submit any Pull Requests here. They will be closed. ---- +## Please do not submit any Pull Requests here. They will be closed. Please submit your PR here instead: https://github.com/symfony/ux diff --git a/.github/workflows/close-pull-request.yml b/.github/workflows/close-pull-request.yml index 57e4e3f..8150a6a 100644 --- a/.github/workflows/close-pull-request.yml +++ b/.github/workflows/close-pull-request.yml @@ -1,20 +1,20 @@ name: Close Pull Request on: - pull_request_target: - types: [opened] + pull_request_target: + types: [opened] jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: | - Thanks for your Pull Request! We love contributions. - - However, you should instead open your PR on the main repository: - https://github.com/symfony/ux - - This repository is what we call a "subtree split": a read-only subset of that main repository. - We're looking forward to your PR there! + run: + runs-on: ubuntu-latest + steps: + - uses: superbrothers/close-pull-request@v3 + with: + comment: | + Thanks for your Pull Request! We love contributions. + + However, you should instead open your PR on the main repository: + https://github.com/symfony/ux + + This repository is what we call a "subtree split": a read-only subset of that main repository. + We're looking forward to your PR there! diff --git a/.symfony.bundle.yaml b/.symfony.bundle.yaml index 6d9a74a..5662042 100644 --- a/.symfony.bundle.yaml +++ b/.symfony.bundle.yaml @@ -1,3 +1,3 @@ -branches: ["2.x"] -maintained_branches: ["2.x"] -doc_dir: "doc" +branches: ['2.x'] +maintained_branches: ['2.x'] +doc_dir: 'doc' diff --git a/CHANGELOG.md b/CHANGELOG.md index a6a0ee6..73a748f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,33 +2,34 @@ ## 2.32 -- Add `Map::removeAllMarkers()`, `Map::removeAllPolygons()`, `Map::removeAllPolylines()`, `Map::removeAllCircles()` and `Map::removeAllRectangles()` methods +- Add `Map::removeAllMarkers()`, `Map::removeAllPolygons()`, `Map::removeAllPolylines()`, `Map::removeAllCircles()` and `Map::removeAllRectangles()` methods ## 2.31 -- Add `fitBoundsToMarkers` parameter to `ux_map()` Twig function +- Add `fitBoundsToMarkers` parameter to `ux_map()` Twig function ## 2.30 -- Ensure compatibility with PHP 8.5 -- Deprecate option `title` from `Polygon`, `Polyline`, `Rectangle` and `Circle` in favor of `infoWindow` +- Ensure compatibility with PHP 8.5 +- Deprecate option `title` from `Polygon`, `Polyline`, `Rectangle` and `Circle` in favor of `infoWindow` ## 2.29.0 -- Add Symfony 8 support -- Add `Cluster` class and `ClusteringAlgorithmInterface` with two implementations `GridClusteringAlgorithm` and `MortonClusteringAlgorithm` +- Add Symfony 8 support +- Add `Cluster` class and `ClusteringAlgorithmInterface` with two implementations `GridClusteringAlgorithm` and `MortonClusteringAlgorithm` ## 2.28 -- Add `minZoom` and `maxZoom` options to `Map` to set the minimum and maximum zoom levels +- Add `minZoom` and `maxZoom` options to `Map` to set the minimum and maximum zoom levels ## 2.27 -- The `fitBoundsToMarkers` option is not overridden anymore when using the `Map` LiveComponent, but now respects the value you defined. - You may encounter unwanted behavior when adding/removing elements to the map. - To use the previous behavior, you must call `$this->getMap()->fitBoundsToMarkers(false)` in your LiveComponent's live actions +- The `fitBoundsToMarkers` option is not overridden anymore when using the `Map` LiveComponent, but now respects the value you defined. + You may encounter unwanted behavior when adding/removing elements to the map. + To use the previous behavior, you must call `$this->getMap()->fitBoundsToMarkers(false)` in your LiveComponent's live actions + +- Add support for creating `Circle` by passing a `Point` and a radius (in meters) to the `Circle` constructor, e.g.: -- Add support for creating `Circle` by passing a `Point` and a radius (in meters) to the `Circle` constructor, e.g.: ```php $map->addCircle(new Circle( center: new Point(48.856613, 2.352222), // Paris @@ -36,7 +37,8 @@ $map->addCircle(new Circle( )); ``` -- Add support for creating `Rectangle` by passing two `Point` instances to the `Rectangle` constructor, e.g.: +- Add support for creating `Rectangle` by passing two `Point` instances to the `Rectangle` constructor, e.g.: + ```php $map->addRectangle(new Rectangle( southWest: new Point(48.856613, 2.352222), // Paris @@ -44,8 +46,9 @@ $map->addRectangle(new Rectangle( )); ``` -- Deprecate property `rawOptions` from `ux:map:*:before-create` events, in favor of `bridgeOptions` instead. -- Map options can now be configured and overridden through the `ux:map:pre-connect` event: +- Deprecate property `rawOptions` from `ux:map:*:before-create` events, in favor of `bridgeOptions` instead. +- Map options can now be configured and overridden through the `ux:map:pre-connect` event: + ```js this.element.addEventListener('ux:map:pre-connect', (event) => { // Override the map center and zoom @@ -61,11 +64,13 @@ this.element.addEventListener('ux:map:pre-connect', (event) => { }; }); ``` -- Add `extra` data support to `Map`, which can be accessed in `ux:map:pre-connect` and `ux:map:connect` events + +- Add `extra` data support to `Map`, which can be accessed in `ux:map:pre-connect` and `ux:map:connect` events ## 2.26 -- Add support for creating `Polygon` with holes, by passing an array of `array` as `points` parameter to the `Polygon` constructor, e.g.: +- Add support for creating `Polygon` with holes, by passing an array of `array` as `points` parameter to the `Polygon` constructor, e.g.: + ```php // Draw a polygon with a hole in it, on the French map $map->addPolygon(new Polygon(points: [ @@ -89,43 +94,43 @@ $map->addPolygon(new Polygon(points: [ ## 2.25 -- Downgrade PHP requirement from 8.3 to 8.1 +- Downgrade PHP requirement from 8.3 to 8.1 ## 2.24 -- Installing the package in a Symfony app using Flex won't add the `@symfony/ux-map` dependency to the `package.json` file anymore. -- Add `Icon` to customize a `Marker` icon (URL or SVG content) -- Add parameter `id` to `Marker`, `Polygon` and `Polyline` constructors -- Add method `Map::removeMarker(string|Marker $markerOrId)` -- Add method `Map::removePolygon(string|Polygon $polygonOrId)` -- Add method `Map::removePolyline(string|Polyline $polylineOrId)` +- Installing the package in a Symfony app using Flex won't add the `@symfony/ux-map` dependency to the `package.json` file anymore. +- Add `Icon` to customize a `Marker` icon (URL or SVG content) +- Add parameter `id` to `Marker`, `Polygon` and `Polyline` constructors +- Add method `Map::removeMarker(string|Marker $markerOrId)` +- Add method `Map::removePolygon(string|Polygon $polygonOrId)` +- Add method `Map::removePolyline(string|Polyline $polylineOrId)` ## 2.23 -- Add `DistanceUnit` to represent distance units (`m`, `km`, `miles`, `nmi`) and - ease conversion between units. -- Add `DistanceCalculatorInterface` interface and three implementations: - `HaversineDistanceCalculator`, `SphericalCosineDistanceCalculator` and `VincentyDistanceCalculator`. -- Add `CoordinateUtils` helper, to convert decimal coordinates (`43.2109`) in DMS (`56° 78' 90"`) +- Add `DistanceUnit` to represent distance units (`m`, `km`, `miles`, `nmi`) and + ease conversion between units. +- Add `DistanceCalculatorInterface` interface and three implementations: + `HaversineDistanceCalculator`, `SphericalCosineDistanceCalculator` and `VincentyDistanceCalculator`. +- Add `CoordinateUtils` helper, to convert decimal coordinates (`43.2109`) in DMS (`56° 78' 90"`) ## 2.22 -- Add method `Symfony\UX\Map\Renderer\AbstractRenderer::tapOptions()`, to allow Renderer to modify options before rendering a Map. -- Add `ux_map.google_maps.default_map_id` configuration to set the Google ``Map ID`` -- Add `ComponentWithMapTrait` to ease maps integration in [Live Components](https://symfony.com/bundles/ux-live-component/current/index.html) -- Add `Polyline` support +- Add method `Symfony\UX\Map\Renderer\AbstractRenderer::tapOptions()`, to allow Renderer to modify options before rendering a Map. +- Add `ux_map.google_maps.default_map_id` configuration to set the Google `Map ID` +- Add `ComponentWithMapTrait` to ease maps integration in [Live Components](https://symfony.com/bundles/ux-live-component/current/index.html) +- Add `Polyline` support ## 2.20 -- Deprecate `render_map` Twig function (will be removed in 2.21). Use - `ux_map` or the `` Twig component instead. -- Add `ux_map` Twig function (replaces `render_map` with a more flexible - interface) -- Add `` Twig component -- The importmap entry `@symfony/ux-map/abstract-map-controller` can be removed - from your importmap, it is no longer needed. -- Add `Polygon` support +- Deprecate `render_map` Twig function (will be removed in 2.21). Use + `ux_map` or the `` Twig component instead. +- Add `ux_map` Twig function (replaces `render_map` with a more flexible + interface) +- Add `` Twig component +- The importmap entry `@symfony/ux-map/abstract-map-controller` can be removed + from your importmap, it is no longer needed. +- Add `Polygon` support ## 2.19 -- Component added +- Component added diff --git a/README.md b/README.md index 6086414..086e1d6 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ https://github.com/symfony/ux to create issues or submit pull requests. ## Resources -- [Documentation](https://symfony.com/bundles/ux-map/current/index.html) -- [Report issues](https://github.com/symfony/ux/issues) and - [send Pull Requests](https://github.com/symfony/ux/pulls) - in the [main Symfony UX repository](https://github.com/symfony/ux) +- [Documentation](https://symfony.com/bundles/ux-map/current/index.html) +- [Report issues](https://github.com/symfony/ux/issues) and + [send Pull Requests](https://github.com/symfony/ux/pulls) + in the [main Symfony UX repository](https://github.com/symfony/ux) diff --git a/assets/README.md b/assets/README.md index df8d4de..f9b6ce8 100644 --- a/assets/README.md +++ b/assets/README.md @@ -6,7 +6,7 @@ This package is private and is not intended to be published on npm or installed. ## Resources -- [Documentation](https://symfony.com/bundles/ux-map/current/index.html) -- [Report issues](https://github.com/symfony/ux/issues) and - [send Pull Requests](https://github.com/symfony/ux/pulls) - in the [main Symfony UX repository](https://github.com/symfony/ux) +- [Documentation](https://symfony.com/bundles/ux-map/current/index.html) +- [Report issues](https://github.com/symfony/ux/issues) and + [send Pull Requests](https://github.com/symfony/ux/pulls) + in the [main Symfony UX repository](https://github.com/symfony/ux) diff --git a/assets/dist/abstract_map_controller.d.ts b/assets/dist/abstract_map_controller.d.ts index 42e7649..63043bd 100644 --- a/assets/dist/abstract_map_controller.d.ts +++ b/assets/dist/abstract_map_controller.d.ts @@ -158,27 +158,27 @@ declare abstract class export_default; }): BridgeMap; protected abstract doFitBoundsToMarkers(): void; - protected abstract doCreateMarker({ definition }: { + protected abstract doCreateMarker({ definition, }: { definition: MarkerDefinition; }): BridgeMarker; protected abstract doRemoveMarker(marker: BridgeMarker): void; - protected abstract doCreatePolygon({ definition }: { + protected abstract doCreatePolygon({ definition, }: { definition: PolygonDefinition; }): BridgePolygon; protected abstract doRemovePolygon(polygon: BridgePolygon): void; - protected abstract doCreatePolyline({ definition }: { + protected abstract doCreatePolyline({ definition, }: { definition: PolylineDefinition; }): BridgePolyline; protected abstract doRemovePolyline(polyline: BridgePolyline): void; - protected abstract doCreateCircle({ definition }: { + protected abstract doCreateCircle({ definition, }: { definition: CircleDefinition; }): BridgeCircle; protected abstract doRemoveCircle(circle: BridgeCircle): void; - protected abstract doCreateRectangle({ definition }: { + protected abstract doCreateRectangle({ definition, }: { definition: RectangleDefinition; }): BridgeRectangle; protected abstract doRemoveRectangle(rectangle: BridgeRectangle): void; diff --git a/assets/dist/abstract_map_controller.js b/assets/dist/abstract_map_controller.js index 9e91d68..2bb9b5b 100644 --- a/assets/dist/abstract_map_controller.js +++ b/assets/dist/abstract_map_controller.js @@ -31,7 +31,11 @@ var abstract_map_controller_default = class extends Controller { this.createPolygon = this.createDrawingFactory("polygon", this.polygons, this.doCreatePolygon.bind(this)); this.createPolyline = this.createDrawingFactory("polyline", this.polylines, this.doCreatePolyline.bind(this)); this.createCircle = this.createDrawingFactory("circle", this.circles, this.doCreateCircle.bind(this)); - this.createRectangle = this.createDrawingFactory("rectangle", this.rectangles, this.doCreateRectangle.bind(this)); + this.createRectangle = this.createDrawingFactory( + "rectangle", + this.rectangles, + this.doCreateRectangle.bind(this) + ); this.map = this.doCreateMap({ definition: mapDefinition }); this.markersValue.forEach((definition) => { this.createMarker({ definition }); diff --git a/assets/package.json b/assets/package.json index ea9d130..d21be00 100644 --- a/assets/package.json +++ b/assets/package.json @@ -22,9 +22,7 @@ "build": "tsx ../../../bin/build_package.ts .", "watch": "tsx ../../../bin/build_package.ts . --watch", "test": "pnpm run test:unit", - "test:unit": "../../../bin/unit_test_package.sh .", - "check": "biome check", - "ci": "biome ci" + "test:unit": "../../../bin/unit_test_package.sh ." }, "symfony": { "needsPackageAsADependency": false, diff --git a/assets/src/abstract_map_controller.ts b/assets/src/abstract_map_controller.ts index cc41de0..2afe6fc 100644 --- a/assets/src/abstract_map_controller.ts +++ b/assets/src/abstract_map_controller.ts @@ -282,11 +282,31 @@ export default abstract class< protected infoWindows: Array = []; private isConnected = false; - private createMarker: ({ definition }: { definition: MarkerDefinition }) => BridgeMarker; - private createPolygon: ({ definition }: { definition: PolygonDefinition }) => BridgePolygon; - private createPolyline: ({ definition }: { definition: PolylineDefinition }) => BridgePolyline; - private createCircle: ({ definition }: { definition: CircleDefinition }) => BridgeCircle; - private createRectangle: ({ definition }: { definition: RectangleDefinition }) => BridgeRectangle; + private createMarker: ({ + definition, + }: { + definition: MarkerDefinition; + }) => BridgeMarker; + private createPolygon: ({ + definition, + }: { + definition: PolygonDefinition; + }) => BridgePolygon; + private createPolyline: ({ + definition, + }: { + definition: PolylineDefinition; + }) => BridgePolyline; + private createCircle: ({ + definition, + }: { + definition: CircleDefinition; + }) => BridgeCircle; + private createRectangle: ({ + definition, + }: { + definition: RectangleDefinition; + }) => BridgeRectangle; protected abstract dispatchEvent(name: string, payload: Record): void; @@ -306,7 +326,11 @@ export default abstract class< this.createPolygon = this.createDrawingFactory('polygon', this.polygons, this.doCreatePolygon.bind(this)); this.createPolyline = this.createDrawingFactory('polyline', this.polylines, this.doCreatePolyline.bind(this)); this.createCircle = this.createDrawingFactory('circle', this.circles, this.doCreateCircle.bind(this)); - this.createRectangle = this.createDrawingFactory('rectangle', this.rectangles, this.doCreateRectangle.bind(this)); + this.createRectangle = this.createDrawingFactory( + 'rectangle', + this.rectangles, + this.doCreateRectangle.bind(this) + ); this.map = this.doCreateMap({ definition: mapDefinition }); this.markersValue.forEach((definition) => { @@ -418,27 +442,51 @@ export default abstract class< //endregion //region Abstract factory methods to be implemented by the concrete classes, they are specific to the map provider - protected abstract doCreateMap({ definition }: { definition: MapDefinition }): BridgeMap; + protected abstract doCreateMap({ + definition, + }: { + definition: MapDefinition; + }): BridgeMap; protected abstract doFitBoundsToMarkers(): void; - protected abstract doCreateMarker({ definition }: { definition: MarkerDefinition }): BridgeMarker; + protected abstract doCreateMarker({ + definition, + }: { + definition: MarkerDefinition; + }): BridgeMarker; protected abstract doRemoveMarker(marker: BridgeMarker): void; - protected abstract doCreatePolygon({ definition }: { definition: PolygonDefinition }): BridgePolygon; + protected abstract doCreatePolygon({ + definition, + }: { + definition: PolygonDefinition; + }): BridgePolygon; protected abstract doRemovePolygon(polygon: BridgePolygon): void; - protected abstract doCreatePolyline({ definition }: { definition: PolylineDefinition }): BridgePolyline; + protected abstract doCreatePolyline({ + definition, + }: { + definition: PolylineDefinition; + }): BridgePolyline; protected abstract doRemovePolyline(polyline: BridgePolyline): void; - protected abstract doCreateCircle({ definition }: { definition: CircleDefinition }): BridgeCircle; + protected abstract doCreateCircle({ + definition, + }: { + definition: CircleDefinition; + }): BridgeCircle; protected abstract doRemoveCircle(circle: BridgeCircle): void; - protected abstract doCreateRectangle({ definition }: { definition: RectangleDefinition }): BridgeRectangle; + protected abstract doCreateRectangle({ + definition, + }: { + definition: RectangleDefinition; + }): BridgeRectangle; protected abstract doRemoveRectangle(rectangle: BridgeRectangle): void; @@ -454,11 +502,31 @@ export default abstract class< //endregion //region Private APIs - private createDrawingFactory(type: 'marker', draws: typeof this.markers, factory: typeof this.doCreateMarker): typeof this.doCreateMarker; - private createDrawingFactory(type: 'polygon', draws: typeof this.polygons, factory: typeof this.doCreatePolygon): typeof this.doCreatePolygon; - private createDrawingFactory(type: 'polyline', draws: typeof this.polylines, factory: typeof this.doCreatePolyline): typeof this.doCreatePolyline; - private createDrawingFactory(type: 'circle', draws: typeof this.circles, factory: typeof this.doCreateCircle): typeof this.doCreateCircle; - private createDrawingFactory(type: 'rectangle', draws: typeof this.rectangles, factory: typeof this.doCreateRectangle): typeof this.doCreateRectangle; + private createDrawingFactory( + type: 'marker', + draws: typeof this.markers, + factory: typeof this.doCreateMarker + ): typeof this.doCreateMarker; + private createDrawingFactory( + type: 'polygon', + draws: typeof this.polygons, + factory: typeof this.doCreatePolygon + ): typeof this.doCreatePolygon; + private createDrawingFactory( + type: 'polyline', + draws: typeof this.polylines, + factory: typeof this.doCreatePolyline + ): typeof this.doCreatePolyline; + private createDrawingFactory( + type: 'circle', + draws: typeof this.circles, + factory: typeof this.doCreateCircle + ): typeof this.doCreateCircle; + private createDrawingFactory( + type: 'rectangle', + draws: typeof this.rectangles, + factory: typeof this.doCreateRectangle + ): typeof this.doCreateRectangle; private createDrawingFactory< Factory extends | typeof this.doCreateMarker @@ -467,7 +535,11 @@ export default abstract class< | typeof this.doCreateCircle | typeof this.doCreateRectangle, Draw extends ReturnType, - >(type: 'marker' | 'polygon' | 'polyline' | 'circle' | 'rectangle', draws: globalThis.Map, Draw>, factory: Factory): Factory { + >( + type: 'marker' | 'polygon' | 'polyline' | 'circle' | 'rectangle', + draws: globalThis.Map, Draw>, + factory: Factory + ): Factory { const eventBefore = `${type}:before-create`; const eventAfter = `${type}:after-create`;