@mapvx/web-js 4.0.3 → 4.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +4 -2
- package/dist/es/assets/icons.d.ts +0 -1
- package/dist/es/assets/icons.js +0 -50
- package/dist/es/config/draco.d.ts +0 -1
- package/dist/es/config/draco.js +0 -10
- package/dist/es/config/sdkConfig.d.ts +0 -1
- package/dist/es/config/sdkConfig.js +0 -1
- package/dist/es/controllers/markerLayoutController.d.ts +0 -1
- package/dist/es/controllers/markerLayoutController.js +0 -103
- package/dist/es/controllers/routeController.d.ts +0 -1
- package/dist/es/controllers/routeController.js +1 -473
- package/dist/es/domain/models/_internal.d.ts +0 -1
- package/dist/es/domain/models/_internal.js +0 -8
- package/dist/es/domain/models/animation.d.ts +0 -1
- package/dist/es/domain/models/animation.js +0 -6
- package/dist/es/domain/models/banner.d.ts +0 -1
- package/dist/es/domain/models/banner.js +0 -10
- package/dist/es/domain/models/campaign.d.ts +0 -1
- package/dist/es/domain/models/campaign.js +0 -29
- package/dist/es/domain/models/categories.d.ts +0 -1
- package/dist/es/domain/models/categories.js +0 -20
- package/dist/es/domain/models/circle.d.ts +0 -1
- package/dist/es/domain/models/circle.js +0 -118
- package/dist/es/domain/models/cityFilterOption.d.ts +0 -1
- package/dist/es/domain/models/cityFilterOption.js +0 -1
- package/dist/es/domain/models/configuration.d.ts +0 -1
- package/dist/es/domain/models/configuration.js +0 -1
- package/dist/es/domain/models/cssCustomization.d.ts +0 -1
- package/dist/es/domain/models/cssCustomization.js +0 -1
- package/dist/es/domain/models/fitOptions.d.ts +0 -1
- package/dist/es/domain/models/fitOptions.js +0 -1
- package/dist/es/domain/models/innerFloors.d.ts +0 -1
- package/dist/es/domain/models/innerFloors.js +0 -1
- package/dist/es/domain/models/institution.d.ts +0 -1
- package/dist/es/domain/models/institution.js +0 -26
- package/dist/es/domain/models/latLng.d.ts +0 -1
- package/dist/es/domain/models/latLng.js +0 -1
- package/dist/es/domain/models/location.d.ts +0 -1
- package/dist/es/domain/models/location.js +0 -1
- package/dist/es/domain/models/loggeable.d.ts +0 -1
- package/dist/es/domain/models/loggeable.js +0 -24
- package/dist/es/domain/models/mapCamera.d.ts +0 -1
- package/dist/es/domain/models/mapCamera.js +0 -1
- package/dist/es/domain/models/mapConfig.d.ts +0 -1
- package/dist/es/domain/models/mapConfig.js +1 -17
- package/dist/es/domain/models/marker.d.ts +0 -1
- package/dist/es/domain/models/marker.js +0 -292
- package/dist/es/domain/models/multilanguage.d.ts +0 -1
- package/dist/es/domain/models/multilanguage.js +0 -10
- package/dist/es/domain/models/openingHours.d.ts +0 -1
- package/dist/es/domain/models/openingHours.js +0 -1
- package/dist/es/domain/models/place.d.ts +0 -1
- package/dist/es/domain/models/place.js +0 -68
- package/dist/es/domain/models/platform.d.ts +0 -1
- package/dist/es/domain/models/platform.js +0 -1
- package/dist/es/domain/models/popover.d.ts +0 -1
- package/dist/es/domain/models/popover.js +0 -1
- package/dist/es/domain/models/product.d.ts +0 -1
- package/dist/es/domain/models/product.js +0 -1
- package/dist/es/domain/models/property.d.ts +0 -1
- package/dist/es/domain/models/property.js +0 -16
- package/dist/es/domain/models/route.d.ts +0 -1
- package/dist/es/domain/models/route.js +0 -71
- package/dist/es/domain/models/routeConfiguration.d.ts +0 -1
- package/dist/es/domain/models/routeConfiguration.js +0 -36
- package/dist/es/domain/models/routeInstance.d.ts +0 -1
- package/dist/es/domain/models/routeInstance.js +0 -8
- package/dist/es/domain/models/routeStyle.d.ts +0 -1
- package/dist/es/domain/models/routeStyle.js +0 -1
- package/dist/es/domain/models/scene3D.d.ts +0 -1
- package/dist/es/domain/models/scene3D.js +0 -1
- package/dist/es/domain/models/transport.d.ts +0 -1
- package/dist/es/domain/models/transport.js +0 -12
- package/dist/es/domain/ports/ICache.d.ts +0 -1
- package/dist/es/domain/ports/ICache.js +0 -1
- package/dist/es/domain/ports/IHttpClient.d.ts +0 -1
- package/dist/es/domain/ports/IHttpClient.js +0 -1
- package/dist/es/domain/ports/ILogger.d.ts +0 -1
- package/dist/es/domain/ports/ILogger.js +0 -9
- package/dist/es/domain/ports/index.d.ts +0 -1
- package/dist/es/domain/ports/index.js +0 -5
- package/dist/es/index.d.ts +0 -1
- package/dist/es/index.js +1 -28
- package/dist/es/infrastructure/cache/CacheManager.d.ts +0 -1
- package/dist/es/infrastructure/cache/CacheManager.js +0 -94
- package/dist/es/infrastructure/cache/LRUCache.d.ts +0 -1
- package/dist/es/infrastructure/cache/LRUCache.js +0 -57
- package/dist/es/infrastructure/cache/PersistentCache.d.ts +0 -1
- package/dist/es/infrastructure/cache/PersistentCache.js +0 -51
- package/dist/es/infrastructure/cache/cacheConfig.d.ts +0 -1
- package/dist/es/infrastructure/cache/cacheConfig.js +8 -27
- package/dist/es/infrastructure/http/FetchHttpClient.d.ts +0 -1
- package/dist/es/infrastructure/http/FetchHttpClient.js +0 -36
- package/dist/es/infrastructure/logging/MVXLogger.d.ts +0 -1
- package/dist/es/infrastructure/logging/MVXLogger.js +0 -37
- package/dist/es/interfaces/cache.d.ts +0 -1
- package/dist/es/interfaces/cache.js +0 -1
- package/dist/es/interfaces/healthResponse.d.ts +0 -1
- package/dist/es/interfaces/healthResponse.js +0 -1
- package/dist/es/interfaces/institutionResponse.d.ts +0 -1
- package/dist/es/interfaces/institutionResponse.js +0 -1
- package/dist/es/interfaces/metadata.d.ts +0 -1
- package/dist/es/interfaces/metadata.js +0 -1
- package/dist/es/interfaces/placeResponse.d.ts +0 -1
- package/dist/es/interfaces/placeResponse.js +0 -1
- package/dist/es/interfaces/routeCacheResponse.d.ts +0 -1
- package/dist/es/interfaces/routeCacheResponse.js +0 -1
- package/dist/es/interfaces/routeResponse.d.ts +0 -1
- package/dist/es/interfaces/routeResponse.js +0 -1
- package/dist/es/interfaces/styleResponse.d.ts +0 -1
- package/dist/es/interfaces/styleResponse.js +0 -1
- package/dist/es/logger/logger.d.ts +0 -1
- package/dist/es/logger/logger.js +0 -10
- package/dist/es/logger/sentry.d.ts +0 -1
- package/dist/es/logger/sentry.js +1 -39
- package/dist/es/map/fitCamera.d.ts +0 -1
- package/dist/es/map/fitCamera.js +0 -44
- package/dist/es/map/generated/maplibreWorkerSource.d.ts +0 -1
- package/dist/es/map/generated/maplibreWorkerSource.js +0 -12
- package/dist/es/map/installMapLibreWorker.d.ts +0 -1
- package/dist/es/map/installMapLibreWorker.js +0 -100
- package/dist/es/map/liveMapFitTransform.d.ts +0 -1
- package/dist/es/map/liveMapFitTransform.js +0 -82
- package/dist/es/map/map.d.ts +0 -1
- package/dist/es/map/map.js +4 -681
- package/dist/es/map/mapInteractionOptions.d.ts +0 -1
- package/dist/es/map/mapInteractionOptions.js +0 -35
- package/dist/es/map/scene3DController.d.ts +0 -1
- package/dist/es/map/scene3DController.js +0 -221
- package/dist/es/repository/repository.d.ts +0 -1
- package/dist/es/repository/repository.js +0 -56
- package/dist/es/repository/requester.d.ts +0 -1
- package/dist/es/repository/requester.js +0 -233
- package/dist/es/sdk.d.ts +0 -1
- package/dist/es/sdk.js +0 -35
- package/dist/es/utils/3d.d.ts +0 -1
- package/dist/es/utils/3d.js +0 -79
- package/dist/es/utils/deckLayers.d.ts +0 -1
- package/dist/es/utils/deckLayers.js +1 -27
- package/dist/es/utils/error.d.ts +0 -1
- package/dist/es/utils/error.js +0 -7
- package/dist/es/utils/images.d.ts +0 -1
- package/dist/es/utils/images.js +0 -7
- package/dist/es/utils/loadGlb.d.ts +0 -1
- package/dist/es/utils/loadGlb.js +2 -96
- package/dist/es/utils/mapvxHostname.d.ts +0 -1
- package/dist/es/utils/mapvxHostname.js +0 -11
- package/dist/es/utils/nav-functions.d.ts +0 -1
- package/dist/es/utils/nav-functions.js +0 -82
- package/dist/es/utils/opening-hours-helper.d.ts +0 -1
- package/dist/es/utils/opening-hours-helper.js +6 -382
- package/dist/es/utils/preconnect.d.ts +0 -1
- package/dist/es/utils/preconnect.js +0 -61
- package/dist/es/utils/route-utils.d.ts +0 -1
- package/dist/es/utils/route-utils.js +0 -25
- package/dist/es/utils/semaphore.d.ts +0 -1
- package/dist/es/utils/semaphore.js +0 -78
- package/dist/es/utils/three.d.ts +0 -1
- package/dist/es/utils/three.js +0 -43
- package/dist/es/utils/threeScene.d.ts +0 -1
- package/dist/es/utils/threeScene.js +0 -38
- package/dist/es/utils/update-css.d.ts +0 -1
- package/dist/es/utils/update-css.js +0 -26
- package/dist/es/utils/utils.d.ts +0 -1
- package/dist/es/utils/utils.js +0 -53
- package/dist/umd/index.js +4 -29240
- package/dist/umd/index.js.LICENSE.txt +1 -0
- package/dist/umd/styles.css +0 -1
- package/dist/umd/styles.js +3 -32
- package/package.json +11 -5
- package/dist/cjs/index.js.map +0 -1
- package/dist/es/assets/icons.d.ts.map +0 -1
- package/dist/es/assets/icons.js.map +0 -1
- package/dist/es/config/draco.d.ts.map +0 -1
- package/dist/es/config/draco.js.map +0 -1
- package/dist/es/config/sdkConfig.d.ts.map +0 -1
- package/dist/es/config/sdkConfig.js.map +0 -1
- package/dist/es/controllers/markerLayoutController.d.ts.map +0 -1
- package/dist/es/controllers/markerLayoutController.js.map +0 -1
- package/dist/es/controllers/routeController.d.ts.map +0 -1
- package/dist/es/controllers/routeController.js.map +0 -1
- package/dist/es/domain/models/_internal.d.ts.map +0 -1
- package/dist/es/domain/models/_internal.js.map +0 -1
- package/dist/es/domain/models/animation.d.ts.map +0 -1
- package/dist/es/domain/models/animation.js.map +0 -1
- package/dist/es/domain/models/banner.d.ts.map +0 -1
- package/dist/es/domain/models/banner.js.map +0 -1
- package/dist/es/domain/models/campaign.d.ts.map +0 -1
- package/dist/es/domain/models/campaign.js.map +0 -1
- package/dist/es/domain/models/categories.d.ts.map +0 -1
- package/dist/es/domain/models/categories.js.map +0 -1
- package/dist/es/domain/models/circle.d.ts.map +0 -1
- package/dist/es/domain/models/circle.js.map +0 -1
- package/dist/es/domain/models/cityFilterOption.d.ts.map +0 -1
- package/dist/es/domain/models/cityFilterOption.js.map +0 -1
- package/dist/es/domain/models/configuration.d.ts.map +0 -1
- package/dist/es/domain/models/configuration.js.map +0 -1
- package/dist/es/domain/models/cssCustomization.d.ts.map +0 -1
- package/dist/es/domain/models/cssCustomization.js.map +0 -1
- package/dist/es/domain/models/fitOptions.d.ts.map +0 -1
- package/dist/es/domain/models/fitOptions.js.map +0 -1
- package/dist/es/domain/models/innerFloors.d.ts.map +0 -1
- package/dist/es/domain/models/innerFloors.js.map +0 -1
- package/dist/es/domain/models/institution.d.ts.map +0 -1
- package/dist/es/domain/models/institution.js.map +0 -1
- package/dist/es/domain/models/latLng.d.ts.map +0 -1
- package/dist/es/domain/models/latLng.js.map +0 -1
- package/dist/es/domain/models/location.d.ts.map +0 -1
- package/dist/es/domain/models/location.js.map +0 -1
- package/dist/es/domain/models/loggeable.d.ts.map +0 -1
- package/dist/es/domain/models/loggeable.js.map +0 -1
- package/dist/es/domain/models/mapCamera.d.ts.map +0 -1
- package/dist/es/domain/models/mapCamera.js.map +0 -1
- package/dist/es/domain/models/mapConfig.d.ts.map +0 -1
- package/dist/es/domain/models/mapConfig.js.map +0 -1
- package/dist/es/domain/models/marker.d.ts.map +0 -1
- package/dist/es/domain/models/marker.js.map +0 -1
- package/dist/es/domain/models/multilanguage.d.ts.map +0 -1
- package/dist/es/domain/models/multilanguage.js.map +0 -1
- package/dist/es/domain/models/openingHours.d.ts.map +0 -1
- package/dist/es/domain/models/openingHours.js.map +0 -1
- package/dist/es/domain/models/place.d.ts.map +0 -1
- package/dist/es/domain/models/place.js.map +0 -1
- package/dist/es/domain/models/platform.d.ts.map +0 -1
- package/dist/es/domain/models/platform.js.map +0 -1
- package/dist/es/domain/models/popover.d.ts.map +0 -1
- package/dist/es/domain/models/popover.js.map +0 -1
- package/dist/es/domain/models/product.d.ts.map +0 -1
- package/dist/es/domain/models/product.js.map +0 -1
- package/dist/es/domain/models/property.d.ts.map +0 -1
- package/dist/es/domain/models/property.js.map +0 -1
- package/dist/es/domain/models/route.d.ts.map +0 -1
- package/dist/es/domain/models/route.js.map +0 -1
- package/dist/es/domain/models/routeConfiguration.d.ts.map +0 -1
- package/dist/es/domain/models/routeConfiguration.js.map +0 -1
- package/dist/es/domain/models/routeInstance.d.ts.map +0 -1
- package/dist/es/domain/models/routeInstance.js.map +0 -1
- package/dist/es/domain/models/routeStyle.d.ts.map +0 -1
- package/dist/es/domain/models/routeStyle.js.map +0 -1
- package/dist/es/domain/models/scene3D.d.ts.map +0 -1
- package/dist/es/domain/models/scene3D.js.map +0 -1
- package/dist/es/domain/models/transport.d.ts.map +0 -1
- package/dist/es/domain/models/transport.js.map +0 -1
- package/dist/es/domain/ports/ICache.d.ts.map +0 -1
- package/dist/es/domain/ports/ICache.js.map +0 -1
- package/dist/es/domain/ports/IHttpClient.d.ts.map +0 -1
- package/dist/es/domain/ports/IHttpClient.js.map +0 -1
- package/dist/es/domain/ports/ILogger.d.ts.map +0 -1
- package/dist/es/domain/ports/ILogger.js.map +0 -1
- package/dist/es/domain/ports/index.d.ts.map +0 -1
- package/dist/es/domain/ports/index.js.map +0 -1
- package/dist/es/index.d.ts.map +0 -1
- package/dist/es/index.js.map +0 -1
- package/dist/es/infrastructure/cache/CacheManager.d.ts.map +0 -1
- package/dist/es/infrastructure/cache/CacheManager.js.map +0 -1
- package/dist/es/infrastructure/cache/LRUCache.d.ts.map +0 -1
- package/dist/es/infrastructure/cache/LRUCache.js.map +0 -1
- package/dist/es/infrastructure/cache/PersistentCache.d.ts.map +0 -1
- package/dist/es/infrastructure/cache/PersistentCache.js.map +0 -1
- package/dist/es/infrastructure/cache/cacheConfig.d.ts.map +0 -1
- package/dist/es/infrastructure/cache/cacheConfig.js.map +0 -1
- package/dist/es/infrastructure/http/FetchHttpClient.d.ts.map +0 -1
- package/dist/es/infrastructure/http/FetchHttpClient.js.map +0 -1
- package/dist/es/infrastructure/logging/MVXLogger.d.ts.map +0 -1
- package/dist/es/infrastructure/logging/MVXLogger.js.map +0 -1
- package/dist/es/interfaces/cache.d.ts.map +0 -1
- package/dist/es/interfaces/cache.js.map +0 -1
- package/dist/es/interfaces/healthResponse.d.ts.map +0 -1
- package/dist/es/interfaces/healthResponse.js.map +0 -1
- package/dist/es/interfaces/institutionResponse.d.ts.map +0 -1
- package/dist/es/interfaces/institutionResponse.js.map +0 -1
- package/dist/es/interfaces/metadata.d.ts.map +0 -1
- package/dist/es/interfaces/metadata.js.map +0 -1
- package/dist/es/interfaces/placeResponse.d.ts.map +0 -1
- package/dist/es/interfaces/placeResponse.js.map +0 -1
- package/dist/es/interfaces/routeCacheResponse.d.ts.map +0 -1
- package/dist/es/interfaces/routeCacheResponse.js.map +0 -1
- package/dist/es/interfaces/routeResponse.d.ts.map +0 -1
- package/dist/es/interfaces/routeResponse.js.map +0 -1
- package/dist/es/interfaces/styleResponse.d.ts.map +0 -1
- package/dist/es/interfaces/styleResponse.js.map +0 -1
- package/dist/es/logger/logger.d.ts.map +0 -1
- package/dist/es/logger/logger.js.map +0 -1
- package/dist/es/logger/sentry.d.ts.map +0 -1
- package/dist/es/logger/sentry.js.map +0 -1
- package/dist/es/map/fitCamera.d.ts.map +0 -1
- package/dist/es/map/fitCamera.js.map +0 -1
- package/dist/es/map/generated/maplibreWorkerSource.d.ts.map +0 -1
- package/dist/es/map/generated/maplibreWorkerSource.js.map +0 -1
- package/dist/es/map/installMapLibreWorker.d.ts.map +0 -1
- package/dist/es/map/installMapLibreWorker.js.map +0 -1
- package/dist/es/map/liveMapFitTransform.d.ts.map +0 -1
- package/dist/es/map/liveMapFitTransform.js.map +0 -1
- package/dist/es/map/map.d.ts.map +0 -1
- package/dist/es/map/map.js.map +0 -1
- package/dist/es/map/mapInteractionOptions.d.ts.map +0 -1
- package/dist/es/map/mapInteractionOptions.js.map +0 -1
- package/dist/es/map/scene3DController.d.ts.map +0 -1
- package/dist/es/map/scene3DController.js.map +0 -1
- package/dist/es/repository/repository.d.ts.map +0 -1
- package/dist/es/repository/repository.js.map +0 -1
- package/dist/es/repository/requester.d.ts.map +0 -1
- package/dist/es/repository/requester.js.map +0 -1
- package/dist/es/sdk.d.ts.map +0 -1
- package/dist/es/sdk.js.map +0 -1
- package/dist/es/utils/3d.d.ts.map +0 -1
- package/dist/es/utils/3d.js.map +0 -1
- package/dist/es/utils/deckLayers.d.ts.map +0 -1
- package/dist/es/utils/deckLayers.js.map +0 -1
- package/dist/es/utils/error.d.ts.map +0 -1
- package/dist/es/utils/error.js.map +0 -1
- package/dist/es/utils/images.d.ts.map +0 -1
- package/dist/es/utils/images.js.map +0 -1
- package/dist/es/utils/loadGlb.d.ts.map +0 -1
- package/dist/es/utils/loadGlb.js.map +0 -1
- package/dist/es/utils/mapvxHostname.d.ts.map +0 -1
- package/dist/es/utils/mapvxHostname.js.map +0 -1
- package/dist/es/utils/nav-functions.d.ts.map +0 -1
- package/dist/es/utils/nav-functions.js.map +0 -1
- package/dist/es/utils/opening-hours-helper.d.ts.map +0 -1
- package/dist/es/utils/opening-hours-helper.js.map +0 -1
- package/dist/es/utils/preconnect.d.ts.map +0 -1
- package/dist/es/utils/preconnect.js.map +0 -1
- package/dist/es/utils/route-utils.d.ts.map +0 -1
- package/dist/es/utils/route-utils.js.map +0 -1
- package/dist/es/utils/semaphore.d.ts.map +0 -1
- package/dist/es/utils/semaphore.js.map +0 -1
- package/dist/es/utils/three.d.ts.map +0 -1
- package/dist/es/utils/three.js.map +0 -1
- package/dist/es/utils/threeScene.d.ts.map +0 -1
- package/dist/es/utils/threeScene.js.map +0 -1
- package/dist/es/utils/update-css.d.ts.map +0 -1
- package/dist/es/utils/update-css.js.map +0 -1
- package/dist/es/utils/utils.d.ts.map +0 -1
- package/dist/es/utils/utils.js.map +0 -1
- package/dist/umd/index.js.map +0 -1
- package/dist/umd/styles.css.map +0 -1
- package/dist/umd/styles.js.map +0 -1
|
@@ -1,86 +1,26 @@
|
|
|
1
1
|
import { Marker } from "maplibre-gl";
|
|
2
2
|
import { generateHexadecimalKey } from "../../utils/utils";
|
|
3
|
-
/**
|
|
4
|
-
* Represents the possible placements of text elements in a marker container.
|
|
5
|
-
* Defines the relative positioning of text labels around marker icons.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* const markerConfig: MarkerConfig = {
|
|
10
|
-
* text: "Coffee Shop",
|
|
11
|
-
* textPosition: TextPosition.right,
|
|
12
|
-
* coordinate: { lat: 40.7128, lng: -74.0060 }
|
|
13
|
-
* };
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* @group Markers
|
|
17
|
-
*/
|
|
18
3
|
export var TextPosition;
|
|
19
4
|
(function (TextPosition) {
|
|
20
|
-
/** Text positioned to the left of the icon */
|
|
21
5
|
TextPosition[TextPosition["left"] = 0] = "left";
|
|
22
|
-
/** Text positioned to the right of the icon */
|
|
23
6
|
TextPosition[TextPosition["right"] = 1] = "right";
|
|
24
|
-
/** Text positioned above the icon */
|
|
25
7
|
TextPosition[TextPosition["top"] = 2] = "top";
|
|
26
|
-
/** Text positioned below the icon */
|
|
27
8
|
TextPosition[TextPosition["bottom"] = 3] = "bottom";
|
|
28
9
|
})(TextPosition || (TextPosition = {}));
|
|
29
|
-
/**
|
|
30
|
-
* Fallback icon width/height, in pixels, used whenever a marker is created
|
|
31
|
-
* without explicit `iconProperties`.
|
|
32
|
-
*
|
|
33
|
-
* @group Markers
|
|
34
|
-
*/
|
|
35
10
|
export const DEFAULT_ICON_SIZE_PX = 40;
|
|
36
|
-
/**
|
|
37
|
-
* Fallback maximum label width, in pixels, used whenever neither the marker
|
|
38
|
-
* nor the map's `markerLayout` configuration specifies one.
|
|
39
|
-
*
|
|
40
|
-
* @group Markers
|
|
41
|
-
*/
|
|
42
11
|
export const DEFAULT_MAX_LABEL_WIDTH_PX = 200;
|
|
43
|
-
/**
|
|
44
|
-
* Utility class for creating and manipulating marker elements on a map.
|
|
45
|
-
* Provides static methods for marker element creation and styling.
|
|
46
|
-
*/
|
|
47
12
|
export class MarkerUtils {
|
|
48
|
-
/**
|
|
49
|
-
* Creates a container element for the marker and adds the icon and text
|
|
50
|
-
* according to the properties specified in the `MarkerConfig` object.
|
|
51
|
-
*
|
|
52
|
-
* @param marker - `MarkerConfig` object containing the marker configuration
|
|
53
|
-
* @returns Marker container element ready to be added to the map
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```typescript
|
|
57
|
-
* const markerElement = MarkerUtils.createMarkerElement(markerConfig);
|
|
58
|
-
* map.addLayer(markerElement);
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
13
|
static createMarkerElement(marker) {
|
|
62
14
|
var _a, _b, _c, _d;
|
|
63
15
|
const markerContainer = document.createElement("div");
|
|
64
|
-
// Configure specific marker dimensions
|
|
65
16
|
const iconWidth = (_b = (_a = marker.iconProperties) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : DEFAULT_ICON_SIZE_PX;
|
|
66
17
|
const iconHeight = (_d = (_c = marker.iconProperties) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : DEFAULT_ICON_SIZE_PX;
|
|
67
|
-
// Apply base class. The container's own box is always the icon's box (or
|
|
68
|
-
// the custom `element`'s natural box) — the label is positioned
|
|
69
|
-
// absolutely (see .text-container in styles.css) so it never affects
|
|
70
|
-
// this box, which is exactly what MapLibre anchors the marker to.
|
|
71
18
|
markerContainer.className = "mapvx-marker";
|
|
72
19
|
markerContainer.addEventListener("click", () => {
|
|
73
20
|
var _a;
|
|
74
21
|
(_a = marker.onClick) === null || _a === void 0 ? void 0 : _a.call(marker);
|
|
75
22
|
});
|
|
76
|
-
// Custom element replaces icon entirely; the label (if any) still gets
|
|
77
|
-
// appended, positioned absolutely relative to it.
|
|
78
23
|
if (marker.element) {
|
|
79
|
-
// Only force a box when the caller declared the footprint. Otherwise
|
|
80
|
-
// the container is left to size itself to the custom element, and
|
|
81
|
-
// automatic label collision avoidance measures that real box from the
|
|
82
|
-
// DOM instead of assuming the default icon size — see
|
|
83
|
-
// {@link MarkerAttribute.measureIconFromDom}.
|
|
84
24
|
if (marker.iconProperties) {
|
|
85
25
|
markerContainer.style.width = `${iconWidth}px`;
|
|
86
26
|
markerContainer.style.height = `${iconHeight}px`;
|
|
@@ -94,14 +34,6 @@ export class MarkerUtils {
|
|
|
94
34
|
markerContainer.appendChild(iconElement);
|
|
95
35
|
return this.setAndCreateText(marker, markerContainer);
|
|
96
36
|
}
|
|
97
|
-
/**
|
|
98
|
-
* Appends the marker's text label (if any) to the container, positioned
|
|
99
|
-
* around whichever element (icon or custom `element`) is already there.
|
|
100
|
-
*
|
|
101
|
-
* @param markerConfig - Configuration object containing text properties
|
|
102
|
-
* @param container - Container element to append the label to
|
|
103
|
-
* @returns The same container, with the label appended when text is present
|
|
104
|
-
*/
|
|
105
37
|
static setAndCreateText(markerConfig, container) {
|
|
106
38
|
if (markerConfig.text) {
|
|
107
39
|
const textElement = typeof markerConfig.text === "string"
|
|
@@ -112,14 +44,6 @@ export class MarkerUtils {
|
|
|
112
44
|
}
|
|
113
45
|
return container;
|
|
114
46
|
}
|
|
115
|
-
/**
|
|
116
|
-
* Creates an icon element with proper styling.
|
|
117
|
-
*
|
|
118
|
-
* @param marker - Marker configuration
|
|
119
|
-
* @param iconWidth - Width of the icon
|
|
120
|
-
* @param iconHeight - Height of the icon
|
|
121
|
-
* @returns Icon element ready to be added to the container
|
|
122
|
-
*/
|
|
123
47
|
static createIconElement(marker, iconWidth, iconHeight) {
|
|
124
48
|
if (typeof marker.icon === "string") {
|
|
125
49
|
return this.createIcon(marker);
|
|
@@ -133,7 +57,6 @@ export class MarkerUtils {
|
|
|
133
57
|
return marker.icon;
|
|
134
58
|
}
|
|
135
59
|
else {
|
|
136
|
-
// Create default element if no icon is provided
|
|
137
60
|
const defaultIcon = document.createElement("div");
|
|
138
61
|
defaultIcon.className = "icon-default";
|
|
139
62
|
defaultIcon.style.width = `${iconWidth}px`;
|
|
@@ -141,19 +64,8 @@ export class MarkerUtils {
|
|
|
141
64
|
return defaultIcon;
|
|
142
65
|
}
|
|
143
66
|
}
|
|
144
|
-
/**
|
|
145
|
-
* Creates a text container, absolutely positioned around the marker's icon
|
|
146
|
-
* via CSS (see `.text-container` in styles.css), so the label never affects
|
|
147
|
-
* the container's own box.
|
|
148
|
-
*
|
|
149
|
-
* @param textElement - The text element to contain
|
|
150
|
-
* @param textPosition - Desired position relative to the icon
|
|
151
|
-
* @param maxLabelWidthPx - Maximum label width in pixels before truncation
|
|
152
|
-
* @returns Container with text positioned using CSS classes
|
|
153
|
-
*/
|
|
154
67
|
static createTextContainer(textElement, textPosition, maxLabelWidthPx) {
|
|
155
68
|
const textContainer = document.createElement("div");
|
|
156
|
-
// Apply base class
|
|
157
69
|
textContainer.className = "text-container";
|
|
158
70
|
textContainer.style.maxWidth = `${maxLabelWidthPx !== null && maxLabelWidthPx !== void 0 ? maxLabelWidthPx : DEFAULT_MAX_LABEL_WIDTH_PX}px`;
|
|
159
71
|
this.setTextPositionClass(textContainer, this.resolveTextPosition(textPosition));
|
|
@@ -162,55 +74,17 @@ export class MarkerUtils {
|
|
|
162
74
|
textContainer.appendChild(textElement);
|
|
163
75
|
return textContainer;
|
|
164
76
|
}
|
|
165
|
-
/**
|
|
166
|
-
* Resolves an optional {@link TextPosition} to its default (`right`), the
|
|
167
|
-
* same default `createTextContainer` has always applied.
|
|
168
|
-
*/
|
|
169
77
|
static resolveTextPosition(textPosition) {
|
|
170
78
|
return textPosition !== null && textPosition !== void 0 ? textPosition : TextPosition.right;
|
|
171
79
|
}
|
|
172
|
-
/**
|
|
173
|
-
* Swaps a text container's position class, keeping exactly one of
|
|
174
|
-
* `top|bottom|left|right` applied at a time.
|
|
175
|
-
*/
|
|
176
80
|
static setTextPositionClass(textContainer, position) {
|
|
177
81
|
textContainer.classList.remove("top", "bottom", "left", "right");
|
|
178
82
|
textContainer.classList.add(TextPosition[position]);
|
|
179
83
|
}
|
|
180
|
-
/**
|
|
181
|
-
* Repositions (or hides) a marker's already-rendered text label at
|
|
182
|
-
* runtime, without rebuilding any DOM. Used both by automatic collision
|
|
183
|
-
* avoidance and by anything else that needs to move a label after
|
|
184
|
-
* creation.
|
|
185
|
-
*
|
|
186
|
-
* @param textContainer - The `.text-container` element to reposition
|
|
187
|
-
* @param position - Side of the icon the label should render on
|
|
188
|
-
* @param hidden - Whether the label should be hidden (kept measurable via
|
|
189
|
-
* `visibility`, never removed via `display`, so it can be measured again
|
|
190
|
-
* to decide whether it fits once something else changes)
|
|
191
|
-
*
|
|
192
|
-
* @example
|
|
193
|
-
* ```typescript
|
|
194
|
-
* MarkerUtils.applyTextPosition(textEl, TextPosition.left, false);
|
|
195
|
-
* ```
|
|
196
|
-
*/
|
|
197
84
|
static applyTextPosition(textContainer, position, hidden) {
|
|
198
85
|
this.setTextPositionClass(textContainer, position);
|
|
199
86
|
textContainer.style.visibility = hidden ? "hidden" : "";
|
|
200
87
|
}
|
|
201
|
-
/**
|
|
202
|
-
* Creates and returns an icon element for the marker, using the image URL
|
|
203
|
-
* specified in the `MarkerConfig` object.
|
|
204
|
-
*
|
|
205
|
-
* @param marker - `MarkerConfig` object containing the marker configuration
|
|
206
|
-
* @returns Marker icon element with proper styling and dimensions
|
|
207
|
-
*
|
|
208
|
-
* @example
|
|
209
|
-
* ```typescript
|
|
210
|
-
* const iconElement = MarkerUtils.createIcon(markerConfig);
|
|
211
|
-
* container.appendChild(iconElement);
|
|
212
|
-
* ```
|
|
213
|
-
*/
|
|
214
88
|
static createIcon(marker) {
|
|
215
89
|
var _a, _b, _c, _d;
|
|
216
90
|
const image = document.createElement("img");
|
|
@@ -221,22 +95,6 @@ export class MarkerUtils {
|
|
|
221
95
|
image.style.filter = "drop-shadow(0px 4px 4px rgba(0, 0, 0, 0.25))";
|
|
222
96
|
return image;
|
|
223
97
|
}
|
|
224
|
-
/**
|
|
225
|
-
* Creates and returns a text element for the marker container, applying
|
|
226
|
-
* custom text styles if provided in the marker properties.
|
|
227
|
-
*
|
|
228
|
-
* @param text - Text content to display
|
|
229
|
-
* @param properties - Optional text styling properties
|
|
230
|
-
* @returns Text element with applied styles
|
|
231
|
-
*
|
|
232
|
-
* @example
|
|
233
|
-
* ```typescript
|
|
234
|
-
* const textElement = MarkerUtils.createTextElement("Coffee Shop", {
|
|
235
|
-
* fontSize: "14px",
|
|
236
|
-
* color: "#333333"
|
|
237
|
-
* });
|
|
238
|
-
* ```
|
|
239
|
-
*/
|
|
240
98
|
static createTextElement(text, properties) {
|
|
241
99
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
242
100
|
const textElement = document.createElement("p");
|
|
@@ -252,36 +110,7 @@ export class MarkerUtils {
|
|
|
252
110
|
return textElement;
|
|
253
111
|
}
|
|
254
112
|
}
|
|
255
|
-
/**
|
|
256
|
-
* Custom implementation of a MapLibre Marker with additional functionality.
|
|
257
|
-
* Extends the base MapLibre Marker class with MapVX-specific features.
|
|
258
|
-
*
|
|
259
|
-
* @example
|
|
260
|
-
* ```typescript
|
|
261
|
-
* const marker = new MarkerAttribute({
|
|
262
|
-
* id: "place-1",
|
|
263
|
-
* coordinate: { lat: 40.7128, lng: -74.0060 },
|
|
264
|
-
* icon: "https://example.com/icon.png"
|
|
265
|
-
* });
|
|
266
|
-
* marker.addToMap(map);
|
|
267
|
-
* ```
|
|
268
|
-
*/
|
|
269
113
|
export class MarkerAttribute extends Marker {
|
|
270
|
-
/**
|
|
271
|
-
* Constructs a new `MarkerAttribute` object with the specified properties.
|
|
272
|
-
*
|
|
273
|
-
* @param markerConfig - `MarkerConfig` object containing the configuration properties
|
|
274
|
-
*
|
|
275
|
-
* @example
|
|
276
|
-
* ```typescript
|
|
277
|
-
* const marker = new MarkerAttribute({
|
|
278
|
-
* id: "coffee-shop",
|
|
279
|
-
* coordinate: { lat: 40.7128, lng: -74.0060 },
|
|
280
|
-
* floorId: "ground-floor",
|
|
281
|
-
* icon: "coffee-icon.png"
|
|
282
|
-
* });
|
|
283
|
-
* ```
|
|
284
|
-
*/
|
|
285
114
|
constructor(markerConfig) {
|
|
286
115
|
var _a, _b, _c, _d, _e;
|
|
287
116
|
super({
|
|
@@ -290,20 +119,6 @@ export class MarkerAttribute extends Marker {
|
|
|
290
119
|
anchor: (_a = markerConfig.anchor) !== null && _a !== void 0 ? _a : "center",
|
|
291
120
|
offset: [0, 0],
|
|
292
121
|
});
|
|
293
|
-
/**
|
|
294
|
-
* True while this marker is hidden on purpose, via {@link hide} (or {@link changeFloor}
|
|
295
|
-
* resolving to a floor this marker is not on).
|
|
296
|
-
*
|
|
297
|
-
* DOM connectivity cannot answer this: {@link hide} works by calling maplibre's
|
|
298
|
-
* `Marker.remove()`, which detaches the element, so a hidden marker and one that never got
|
|
299
|
-
* attached look identical from `getElement().isConnected`. Anything that re-attaches a marker
|
|
300
|
-
* it does not own — the route animation re-attaches its arrow when a step transition drops it —
|
|
301
|
-
* has to consult this flag, or it silently un-hides the marker on its next frame.
|
|
302
|
-
*
|
|
303
|
-
* Any attach clears it — see the {@link addTo} override — so "attached" and "not hidden"
|
|
304
|
-
* never disagree, whichever entry point put the marker back on the map.
|
|
305
|
-
* @internal
|
|
306
|
-
*/
|
|
307
122
|
this.hiddenOnPurpose = false;
|
|
308
123
|
this.setLngLat([markerConfig.coordinate.lng, markerConfig.coordinate.lat]);
|
|
309
124
|
this.setRotationAlignment((_b = markerConfig.rotationAlignment) !== null && _b !== void 0 ? _b : "viewport");
|
|
@@ -314,21 +129,10 @@ export class MarkerAttribute extends Marker {
|
|
|
314
129
|
this.id = (_c = markerConfig.id) !== null && _c !== void 0 ? _c : generateHexadecimalKey();
|
|
315
130
|
this.coordinate = markerConfig.coordinate;
|
|
316
131
|
this.floorId = (_d = markerConfig.floorId) !== null && _d !== void 0 ? _d : "";
|
|
317
|
-
// MapLibre resolves the anchor once, in the `super()` call above, and
|
|
318
|
-
// offers no way to change it afterwards — so this mirror is set here and
|
|
319
|
-
// never touched by `updateIcon`.
|
|
320
132
|
this.anchorType = (_e = markerConfig.anchor) !== null && _e !== void 0 ? _e : "center";
|
|
321
133
|
this.currentConfig = markerConfig;
|
|
322
134
|
this.applyLayoutState(markerConfig);
|
|
323
135
|
}
|
|
324
|
-
/**
|
|
325
|
-
* Derives the state automatic label collision avoidance reads (icon box,
|
|
326
|
-
* preferred label side, priority, label element) from a fully-resolved
|
|
327
|
-
* config. It is what assigns the fields declared with `!` above — the
|
|
328
|
-
* constructor always calls it, but TypeScript can't see through the
|
|
329
|
-
* indirection. Shared by the constructor and {@link updateIcon} so the two can
|
|
330
|
-
* never drift apart.
|
|
331
|
-
*/
|
|
332
136
|
applyLayoutState(config) {
|
|
333
137
|
var _a, _b, _c, _d, _e;
|
|
334
138
|
this.iconSize = {
|
|
@@ -340,58 +144,17 @@ export class MarkerAttribute extends Marker {
|
|
|
340
144
|
this.measureIconFromDom = config.element != null && config.iconProperties == null;
|
|
341
145
|
this.textContainerEl = this.findTextContainerEl();
|
|
342
146
|
}
|
|
343
|
-
/**
|
|
344
|
-
* Merges an update on top of the marker's current config, so a partial
|
|
345
|
-
* update such as `{ id, coordinate, icon }` keeps the marker's existing
|
|
346
|
-
* icon dimensions, label side and priority.
|
|
347
|
-
*
|
|
348
|
-
* `element` is deliberately *not* carried forward: it and `icon` are
|
|
349
|
-
* mutually exclusive rendering paths, and `updateIcon` has always chosen
|
|
350
|
-
* the path named by the update itself.
|
|
351
|
-
*/
|
|
352
147
|
mergeConfig(update) {
|
|
353
148
|
return Object.assign(Object.assign(Object.assign({}, this.currentConfig), update), { element: update.element });
|
|
354
149
|
}
|
|
355
|
-
/**
|
|
356
|
-
* Finds this marker's `.text-container` child element, if it has one.
|
|
357
|
-
*/
|
|
358
150
|
findTextContainerEl() {
|
|
359
151
|
return Array.from(this._element.children).find((child) => child instanceof HTMLElement && child.classList.contains("text-container"));
|
|
360
152
|
}
|
|
361
|
-
/**
|
|
362
|
-
* Adds the marker attribute to the specified map.
|
|
363
|
-
*
|
|
364
|
-
* @param map - The map instance where the marker attribute will be added
|
|
365
|
-
*
|
|
366
|
-
* @example
|
|
367
|
-
* ```typescript
|
|
368
|
-
* const marker = new MarkerAttribute(markerConfig);
|
|
369
|
-
* marker.addToMap(mapInstance);
|
|
370
|
-
* ```
|
|
371
|
-
*/
|
|
372
153
|
addToMap(map) {
|
|
373
154
|
if (!map)
|
|
374
155
|
return;
|
|
375
156
|
this.addTo(map);
|
|
376
157
|
}
|
|
377
|
-
/**
|
|
378
|
-
* Updates the icon of the marker attribute based on the specified marker configuration.
|
|
379
|
-
*
|
|
380
|
-
* The config is merged on top of the one the marker currently renders
|
|
381
|
-
* from, so a partial update keeps every property it omits — passing only
|
|
382
|
-
* `{ icon }` no longer resets the marker's icon dimensions, preferred
|
|
383
|
-
* label side or label priority to their defaults.
|
|
384
|
-
*
|
|
385
|
-
* @param marker - `MarkerConfig` object containing the new marker configuration
|
|
386
|
-
*
|
|
387
|
-
* @example
|
|
388
|
-
* ```typescript
|
|
389
|
-
* marker.updateIcon({
|
|
390
|
-
* icon: "new-icon.png",
|
|
391
|
-
* text: "Updated Text"
|
|
392
|
-
* });
|
|
393
|
-
* ```
|
|
394
|
-
*/
|
|
395
158
|
updateIcon(marker) {
|
|
396
159
|
var _a, _b;
|
|
397
160
|
const config = this.mergeConfig(marker);
|
|
@@ -415,76 +178,22 @@ export class MarkerAttribute extends Marker {
|
|
|
415
178
|
this.currentConfig = config;
|
|
416
179
|
this.applyLayoutState(config);
|
|
417
180
|
}
|
|
418
|
-
/**
|
|
419
|
-
* Sets the current floor ID for the marker.
|
|
420
|
-
* Marker will be shown if and only if such floor is displayed.
|
|
421
|
-
*
|
|
422
|
-
* @param floorId - The ID of the floor to set for the marker.
|
|
423
|
-
* This parameter is optional and defaults to `undefined` if not provided.
|
|
424
|
-
*
|
|
425
|
-
* @example
|
|
426
|
-
* ```typescript
|
|
427
|
-
* marker.setFloor("ground-floor");
|
|
428
|
-
* ```
|
|
429
|
-
*/
|
|
430
181
|
setFloor(floorId) {
|
|
431
182
|
this.floorId = floorId;
|
|
432
183
|
}
|
|
433
|
-
/**
|
|
434
|
-
* Hides the marker element from the map without deleting it.
|
|
435
|
-
* The marker can be shown again using the {@link show} method.
|
|
436
|
-
*
|
|
437
|
-
* @example
|
|
438
|
-
* ```typescript
|
|
439
|
-
* marker.hide();
|
|
440
|
-
* ```
|
|
441
|
-
*/
|
|
442
184
|
hide() {
|
|
443
185
|
this.hiddenOnPurpose = true;
|
|
444
186
|
this.remove();
|
|
445
187
|
}
|
|
446
|
-
/**
|
|
447
|
-
* Makes the marker visible again after it has been hidden.
|
|
448
|
-
*
|
|
449
|
-
* @param map - The map instance where the marker should be shown
|
|
450
|
-
*
|
|
451
|
-
* @example
|
|
452
|
-
* ```typescript
|
|
453
|
-
* marker.show(mapInstance);
|
|
454
|
-
* ```
|
|
455
|
-
*/
|
|
456
188
|
show(map) {
|
|
457
189
|
if (!map)
|
|
458
190
|
return;
|
|
459
191
|
this.addTo(map);
|
|
460
192
|
}
|
|
461
|
-
/**
|
|
462
|
-
* Attaches the marker, clearing {@link hiddenOnPurpose}.
|
|
463
|
-
*
|
|
464
|
-
* Overridden so every attach path agrees on visibility: {@link show}, {@link addToMap} and a
|
|
465
|
-
* direct `addTo` all funnel through here, so a marker cannot end up on the map while still
|
|
466
|
-
* flagged as deliberately hidden — which would make the route animation refuse to restore an
|
|
467
|
-
* arrow that is in fact visible.
|
|
468
|
-
*
|
|
469
|
-
* @param map - The map instance to attach the marker to.
|
|
470
|
-
* @returns This marker, for chaining, as maplibre's `Marker.addTo` does.
|
|
471
|
-
*/
|
|
472
193
|
addTo(map) {
|
|
473
194
|
this.hiddenOnPurpose = false;
|
|
474
195
|
return super.addTo(map);
|
|
475
196
|
}
|
|
476
|
-
/**
|
|
477
|
-
* Hides marker if currentFloor is different from the marker floor.
|
|
478
|
-
* Used for floor-based marker visibility management.
|
|
479
|
-
*
|
|
480
|
-
* @param floorId - The current floor ID to compare against
|
|
481
|
-
* @param map - The map instance for showing/hiding the marker
|
|
482
|
-
*
|
|
483
|
-
* @example
|
|
484
|
-
* ```typescript
|
|
485
|
-
* marker.changeFloor("first-floor", mapInstance);
|
|
486
|
-
* ```
|
|
487
|
-
*/
|
|
488
197
|
changeFloor(floorId, map, isOutdoor = false) {
|
|
489
198
|
if (floorId == this.floorId || (isOutdoor && !this.floorId)) {
|
|
490
199
|
this.show(map);
|
|
@@ -494,4 +203,3 @@ export class MarkerAttribute extends Marker {
|
|
|
494
203
|
}
|
|
495
204
|
}
|
|
496
205
|
}
|
|
497
|
-
//# sourceMappingURL=marker.js.map
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns the string corresponding to the given language prefix.
|
|
3
|
-
* If the requested language is not available, falls back to the default language.
|
|
4
|
-
*
|
|
5
|
-
* @param multiLangString Multilanguage string to localize
|
|
6
|
-
* @param lang Local language prefix for translations (e.g., "en", "es", "fr")
|
|
7
|
-
* @returns Localized string in the requested language or default if not available
|
|
8
|
-
* @group Places & Locations
|
|
9
|
-
*/
|
|
10
1
|
export function getString(multiLangString, lang) {
|
|
11
2
|
var _a, _b;
|
|
12
3
|
return (_b = (_a = multiLangString[lang]) !== null && _a !== void 0 ? _a : multiLangString.default) !== null && _b !== void 0 ? _b : "";
|
|
13
4
|
}
|
|
14
|
-
//# sourceMappingURL=multilanguage.js.map
|
|
@@ -1,31 +1,6 @@
|
|
|
1
1
|
import { Banner } from "./banner";
|
|
2
2
|
import { PropertyUtils } from "./property";
|
|
3
|
-
/**
|
|
4
|
-
* MapVX place object, is a custom object containing data of a specific real place.
|
|
5
|
-
* Represents a physical location with all its associated metadata and properties.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* const place = new MVXPlace(placeResponse);
|
|
10
|
-
* console.log(place.title); // "Coffee Shop"
|
|
11
|
-
* console.log(place.position); // { lat: 40.7128, lng: -74.0060 }
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* @group Places & Locations
|
|
15
|
-
*/
|
|
16
3
|
export class MVXPlace {
|
|
17
|
-
/**
|
|
18
|
-
* Creates a new place instance with the parameters specified in the data.
|
|
19
|
-
*
|
|
20
|
-
* @param rawPlace - JSON configuration parameters for the place from API response
|
|
21
|
-
* @returns A new instance of MVXPlace
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```typescript
|
|
25
|
-
* const placeResponse = await fetchPlaceData(placeId);
|
|
26
|
-
* const place = new MVXPlace(placeResponse);
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
4
|
constructor(rawPlace) {
|
|
30
5
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
31
6
|
const tagsAndKeywords = ((_a = rawPlace.tags) !== null && _a !== void 0 ? _a : []).concat((_b = rawPlace.keywords) !== null && _b !== void 0 ? _b : []);
|
|
@@ -35,7 +10,6 @@ export class MVXPlace {
|
|
|
35
10
|
this.hidePlace = tagsAndKeywords.includes("hide_search");
|
|
36
11
|
this.description = rawPlace.description;
|
|
37
12
|
this.shortDescription = rawPlace.shortDescription;
|
|
38
|
-
// @ts-expect-error - lon is not in the type but search results have it
|
|
39
13
|
this.position = { lat: rawPlace.lat, lng: rawPlace.lng || rawPlace.lon };
|
|
40
14
|
this.category = rawPlace.category;
|
|
41
15
|
this.tags = (_d = rawPlace.tags) !== null && _d !== void 0 ? _d : [];
|
|
@@ -62,25 +36,6 @@ export class MVXPlace {
|
|
|
62
36
|
this.metadata = rawPlace.metadata;
|
|
63
37
|
this.visibility = (_k = rawPlace.visibility) !== null && _k !== void 0 ? _k : "public";
|
|
64
38
|
}
|
|
65
|
-
/**
|
|
66
|
-
* Rebuilds an {@link MVXPlace} from a value that has lost its prototype — e.g. a
|
|
67
|
-
* place rehydrated from the persistent (localStorage) cache, where `JSON.parse`
|
|
68
|
-
* produces a plain object stripped of the class methods.
|
|
69
|
-
*
|
|
70
|
-
* The place's methods only read its own data fields, so restoring the prototype is
|
|
71
|
-
* sufficient; the raw API {@link PlaceResponse} shape is not needed (and would not
|
|
72
|
-
* fit, since a serialized place already carries the mapped `MVXPlace` fields). Live
|
|
73
|
-
* instances and non-object values are returned unchanged.
|
|
74
|
-
*
|
|
75
|
-
* @param value - A cached place value (plain object) or an existing instance.
|
|
76
|
-
* @returns An MVXPlace whose methods (e.g. {@link inFloor}) work again.
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* ```typescript
|
|
80
|
-
* const place = MVXPlace.fromCache(cachedValue);
|
|
81
|
-
* place.inFloor(parentFloors); // no longer throws
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
84
39
|
static fromCache(value) {
|
|
85
40
|
if (value instanceof MVXPlace)
|
|
86
41
|
return value;
|
|
@@ -88,36 +43,13 @@ export class MVXPlace {
|
|
|
88
43
|
return value;
|
|
89
44
|
return Object.assign(Object.create(MVXPlace.prototype), value);
|
|
90
45
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Returns the floor in which the place exists as an InnerFloor object.
|
|
93
|
-
* If no matching available floor is found or if the place is not indoor,
|
|
94
|
-
* an undefined value will be returned.
|
|
95
|
-
*
|
|
96
|
-
* @param parentPlaceFloors - Array of existing parent place floors to search in
|
|
97
|
-
* @returns The matching InnerFloor object or undefined if not found
|
|
98
|
-
*
|
|
99
|
-
* @example
|
|
100
|
-
* ```typescript
|
|
101
|
-
* const buildingFloors = getBuildingFloors();
|
|
102
|
-
* const placeFloor = place.inFloor(buildingFloors);
|
|
103
|
-
* if (placeFloor) {
|
|
104
|
-
* console.log(`Place is on floor: ${placeFloor.name}`);
|
|
105
|
-
* }
|
|
106
|
-
* ```
|
|
107
|
-
*/
|
|
108
46
|
inFloor(parentPlaceFloors) {
|
|
109
47
|
if (!this.inFloors || this.inFloors.length === 0) {
|
|
110
|
-
// outdoor place
|
|
111
48
|
return parentPlaceFloors.find((floor) => floor.reachableFromGPS);
|
|
112
49
|
}
|
|
113
50
|
return parentPlaceFloors.find((floor) => { var _a; return floor.key === ((_a = this.inFloors) === null || _a === void 0 ? void 0 : _a[0]); });
|
|
114
51
|
}
|
|
115
|
-
/**
|
|
116
|
-
* Returns a string representation of the place
|
|
117
|
-
* @returns String in format "MVXPlace {mapvxId}"
|
|
118
|
-
*/
|
|
119
52
|
toString() {
|
|
120
53
|
return `MVXPlace ${this.mapvxId}`;
|
|
121
54
|
}
|
|
122
55
|
}
|
|
123
|
-
//# sourceMappingURL=place.js.map
|
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
import { MVXPlace } from "./place";
|
|
2
|
-
/**
|
|
3
|
-
* Utility class for processing and converting properties from API responses.
|
|
4
|
-
* Provides methods to parse different property structures.
|
|
5
|
-
* @group Places & Locations
|
|
6
|
-
*/
|
|
7
2
|
export class PropertyUtils {
|
|
8
|
-
/**
|
|
9
|
-
* Converts an array of PropertyResponse to a typed Property array.
|
|
10
|
-
* Handles nested properties recursively and different property types.
|
|
11
|
-
*
|
|
12
|
-
* @param response Array of PropertyResponse from the API
|
|
13
|
-
* @returns Processed and typed Property array
|
|
14
|
-
*/
|
|
15
3
|
static parseProperties(response) {
|
|
16
4
|
try {
|
|
17
5
|
const properties = [];
|
|
@@ -32,11 +20,9 @@ export class PropertyUtils {
|
|
|
32
20
|
};
|
|
33
21
|
childPlaces.forEach((element) => {
|
|
34
22
|
if (typeof element === "string") {
|
|
35
|
-
// Add id to the array of childPlaces
|
|
36
23
|
childPlacesProperty.childPlaces.push(element);
|
|
37
24
|
}
|
|
38
25
|
else {
|
|
39
|
-
// Transform object to MVXPlace and add to childPlaces array
|
|
40
26
|
const mvxPlace = new MVXPlace(element);
|
|
41
27
|
childPlacesProperty.childPlaces.push(mvxPlace);
|
|
42
28
|
}
|
|
@@ -44,7 +30,6 @@ export class PropertyUtils {
|
|
|
44
30
|
properties.push(childPlacesProperty);
|
|
45
31
|
}
|
|
46
32
|
else if (item.child_properties) {
|
|
47
|
-
// Parsing child properties with recursive call
|
|
48
33
|
const childProperties = item.child_properties;
|
|
49
34
|
const childPropertiesProperty = {
|
|
50
35
|
childProperties: [],
|
|
@@ -97,4 +82,3 @@ export class PropertyUtils {
|
|
|
97
82
|
}
|
|
98
83
|
}
|
|
99
84
|
}
|
|
100
|
-
//# sourceMappingURL=property.js.map
|