@mapvx/web-js 4.0.2 → 4.0.3-dev.2
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/README.md +7 -7
- 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 +12 -6
- 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
package/dist/es/sdk.js
CHANGED
|
@@ -4,11 +4,6 @@ import { Loggeable } from "./domain/models/loggeable";
|
|
|
4
4
|
import { InternalGetRouteConfiguration, } from "./domain/models/routeConfiguration";
|
|
5
5
|
import { CacheManager } from "./infrastructure/cache/CacheManager";
|
|
6
6
|
import { Repository } from "./repository/repository";
|
|
7
|
-
/**
|
|
8
|
-
* Normalize the argument accepted by the place-detail methods into a
|
|
9
|
-
* {@link PlaceQuery}. A plain string is treated as the place id/alias with no
|
|
10
|
-
* building/floor disambiguation, preserving backward compatibility.
|
|
11
|
-
*/
|
|
12
7
|
function normalizePlaceQuery(place) {
|
|
13
8
|
return typeof place === "string" ? { id: place } : place;
|
|
14
9
|
}
|
|
@@ -27,16 +22,7 @@ export function initializeSDK(token, config) {
|
|
|
27
22
|
const sdk = new InternalMapVXSDK(token, sdkConfig);
|
|
28
23
|
return sdk;
|
|
29
24
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Main class to access the SDK functionalities.
|
|
32
|
-
* @category Main
|
|
33
|
-
*/
|
|
34
25
|
export class InternalMapVXSDK extends Loggeable {
|
|
35
|
-
/**
|
|
36
|
-
* Create a new MapVXSDK object.
|
|
37
|
-
* @param token The secret API token that you obtained from MapVX.
|
|
38
|
-
* @param config Configuration object for SDK customization
|
|
39
|
-
*/
|
|
40
26
|
constructor(token, config) {
|
|
41
27
|
var _a, _b, _c;
|
|
42
28
|
super();
|
|
@@ -45,7 +31,6 @@ export class InternalMapVXSDK extends Loggeable {
|
|
|
45
31
|
this.headingListeners = [];
|
|
46
32
|
this.token = token;
|
|
47
33
|
this.config = config;
|
|
48
|
-
// Create cache manager with user configuration
|
|
49
34
|
const cacheManager = new CacheManager({
|
|
50
35
|
persistent: (_a = config.cache) === null || _a === void 0 ? void 0 : _a.persistent,
|
|
51
36
|
maxStorageBytes: (_b = config.cache) === null || _b === void 0 ? void 0 : _b.maxStorageBytes,
|
|
@@ -60,12 +45,8 @@ export class InternalMapVXSDK extends Loggeable {
|
|
|
60
45
|
this.cachePlaces();
|
|
61
46
|
this.logEvent("initSDK");
|
|
62
47
|
}
|
|
63
|
-
/**
|
|
64
|
-
* Fetch and save on cache the data from the available places.
|
|
65
|
-
*/
|
|
66
48
|
cachePlaces() {
|
|
67
49
|
this.repository.fetchAndParseAvailablePlaces().catch(() => {
|
|
68
|
-
// Error already logged in repository
|
|
69
50
|
});
|
|
70
51
|
}
|
|
71
52
|
setSdkLang(lang) {
|
|
@@ -110,9 +91,6 @@ export class InternalMapVXSDK extends Loggeable {
|
|
|
110
91
|
mapConfig.apiUrl = this.config.apiUrl;
|
|
111
92
|
mapConfig.portalApiUrl = this.config.portalApiUrl;
|
|
112
93
|
mapConfig.mapvxRequestContext = this.config.mapvxRequestContext;
|
|
113
|
-
// Routing endpoints go through the map's own Repository, so forward the
|
|
114
|
-
// (possibly overridden) hosts too — otherwise routes would fall back to
|
|
115
|
-
// the hardcoded api.mapvx.com even when the SDK was pointed at an edge.
|
|
116
94
|
mapConfig.routeApiUrl = this.config.routeApiUrl;
|
|
117
95
|
mapConfig.healthApiUrl = this.config.healthApiUrl;
|
|
118
96
|
mapConfig.legacyApiUrl = this.config.legacyApiUrl;
|
|
@@ -268,7 +246,6 @@ export class InternalMapVXSDK extends Loggeable {
|
|
|
268
246
|
}
|
|
269
247
|
async getPlacesByInput(input, institutionId, parentPlaceId, otherParentPlacesIds, origin, lat, lng, floor) {
|
|
270
248
|
try {
|
|
271
|
-
// TODO: se debe cambiar a usar un solo parámetro en la siguiente version major.
|
|
272
249
|
const parentPlaces = parentPlaceId
|
|
273
250
|
? otherParentPlacesIds
|
|
274
251
|
? [parentPlaceId, ...otherParentPlacesIds]
|
|
@@ -308,8 +285,6 @@ export class InternalMapVXSDK extends Loggeable {
|
|
|
308
285
|
}
|
|
309
286
|
async getPlacesByCategory(category) {
|
|
310
287
|
try {
|
|
311
|
-
// TODO: Implement proper category-based search when API endpoint is available
|
|
312
|
-
// For now, return an empty array as a placeholder implementation
|
|
313
288
|
this.logEvent("getPlacesByCategory");
|
|
314
289
|
return [];
|
|
315
290
|
}
|
|
@@ -354,11 +329,9 @@ export class InternalMapVXSDK extends Loggeable {
|
|
|
354
329
|
}
|
|
355
330
|
let heading = null;
|
|
356
331
|
if (event.webkitCompassHeading !== undefined) {
|
|
357
|
-
// Para iOS
|
|
358
332
|
heading = event.webkitCompassHeading || null;
|
|
359
333
|
}
|
|
360
334
|
else if (event.absolute && event.alpha !== null) {
|
|
361
|
-
// Para Android y otros navegadores
|
|
362
335
|
heading = 360 - event.alpha;
|
|
363
336
|
}
|
|
364
337
|
if (heading !== null) {
|
|
@@ -370,22 +343,15 @@ export class InternalMapVXSDK extends Loggeable {
|
|
|
370
343
|
};
|
|
371
344
|
this.headingListeners.push(listener);
|
|
372
345
|
if ("ondeviceorientationabsolute" in window) {
|
|
373
|
-
// We can listen for the new deviceorientationabsolute event.
|
|
374
346
|
window.addEventListener("deviceorientationabsolute", listener);
|
|
375
347
|
}
|
|
376
348
|
else if ("ondeviceorientation" in window) {
|
|
377
|
-
// We can still listen for deviceorientation events.
|
|
378
|
-
// The `absolute` property of the event tells us whether
|
|
379
|
-
// or not the degrees are absolute.
|
|
380
349
|
const w = window;
|
|
381
350
|
w.addEventListener("deviceorientation", listener);
|
|
382
351
|
}
|
|
383
352
|
}
|
|
384
353
|
unwatchUserHeading() {
|
|
385
354
|
this.headingListeners.forEach((listener) => {
|
|
386
|
-
// It is safe to call with both events
|
|
387
|
-
// since the call with the event that has no listener
|
|
388
|
-
// will simply do nothing.
|
|
389
355
|
window.removeEventListener("deviceorientationabsolute", listener);
|
|
390
356
|
window.removeEventListener("deviceorientation", listener);
|
|
391
357
|
});
|
|
@@ -430,4 +396,3 @@ export class InternalMapVXSDK extends Loggeable {
|
|
|
430
396
|
}
|
|
431
397
|
}
|
|
432
398
|
}
|
|
433
|
-
//# sourceMappingURL=sdk.js.map
|
package/dist/es/utils/3d.d.ts
CHANGED
package/dist/es/utils/3d.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
/** Default LOD hysteresis (zoom units) when {@link Models3DLodConfig.hysteresis} is unset. */
|
|
2
1
|
export const DEFAULT_LOD_HYSTERESIS = 0.5;
|
|
3
|
-
/**
|
|
4
|
-
* Computes the unload/reload zoom boundaries from {@link Models3DConfig.lod}, or `null` when LOD is
|
|
5
|
-
* disabled (no `lod`, no models, or a non-finite `minZoom`). Pure — safe to unit-test without WebGL.
|
|
6
|
-
*/
|
|
7
2
|
export const resolveModels3DLodThresholds = (models) => {
|
|
8
3
|
const lod = models === null || models === void 0 ? void 0 : models.lod;
|
|
9
4
|
if (!models ||
|
|
@@ -21,12 +16,6 @@ export const resolveModels3DLodThresholds = (models) => {
|
|
|
21
16
|
unloadBelow: lod.minZoom - hysteresis,
|
|
22
17
|
};
|
|
23
18
|
};
|
|
24
|
-
/**
|
|
25
|
-
* Decides what the LOD controller should do at the current zoom given whether the models are
|
|
26
|
-
* currently unloaded. Returns `"unload"` when they are loaded but the camera is below the unload
|
|
27
|
-
* boundary, `"reload"` when they are unloaded but the camera has returned to/above the reload
|
|
28
|
-
* boundary, and `"none"` otherwise (including within the hysteresis band). Pure/testable.
|
|
29
|
-
*/
|
|
30
19
|
export const lodActionForZoom = (zoom, thresholds, currentlyUnloaded) => {
|
|
31
20
|
if (!currentlyUnloaded && zoom < thresholds.unloadBelow) {
|
|
32
21
|
return "unload";
|
|
@@ -36,28 +25,12 @@ export const lodActionForZoom = (zoom, thresholds, currentlyUnloaded) => {
|
|
|
36
25
|
}
|
|
37
26
|
return "none";
|
|
38
27
|
};
|
|
39
|
-
/**
|
|
40
|
-
* Conservative defaults that bound each deck.gl overlay layer's in-memory tile cache. Chosen to
|
|
41
|
-
* favor low RAM: only the visible working set (plus a small margin) stays parsed in memory; the
|
|
42
|
-
* raw tile bytes remain on disk in the Service Worker cache, so an evicted tile is re-parsed
|
|
43
|
-
* rather than re-downloaded. Raise `maxCacheSize` only if profiling shows flashing at the
|
|
44
|
-
* viewport edge while panning.
|
|
45
|
-
* @internal
|
|
46
|
-
*/
|
|
47
28
|
export const DEFAULT_DECK_TILE_CACHE = {
|
|
48
|
-
// Per layer; with four overlay layers this caps the parsed-tile set at ~4x this number.
|
|
49
29
|
maxCacheSize: 64,
|
|
50
30
|
maxRequests: 6,
|
|
51
|
-
// Drop parent tiles once children cover the viewport — keeps the resident set smallest.
|
|
52
31
|
refinementStrategy: "no-overlap",
|
|
53
|
-
// Byte budget is opt-in (deck.gl only enforces it when a tile's byte size is known).
|
|
54
32
|
maxCacheByteSize: undefined,
|
|
55
33
|
};
|
|
56
|
-
/**
|
|
57
|
-
* Merges an optional {@link DeckTileCacheConfig} over {@link DEFAULT_DECK_TILE_CACHE}, ignoring
|
|
58
|
-
* `undefined`/`null` fields and clamping numeric bounds to at least 1. The result is always
|
|
59
|
-
* bounded — passing `undefined` yields the defaults, never an unlimited cache.
|
|
60
|
-
*/
|
|
61
34
|
export const resolveDeckTileCache = (config) => {
|
|
62
35
|
var _a;
|
|
63
36
|
const clampPositive = (value, fallback) => typeof value === "number" && Number.isFinite(value) && value >= 1 ? Math.floor(value) : fallback;
|
|
@@ -73,10 +46,6 @@ export const resolveDeckTileCache = (config) => {
|
|
|
73
46
|
maxCacheByteSize,
|
|
74
47
|
};
|
|
75
48
|
};
|
|
76
|
-
/**
|
|
77
|
-
* Default lights matching the legacy escalator scene when {@link Models3DConfig.lights} is unset.
|
|
78
|
-
* @internal
|
|
79
|
-
*/
|
|
80
49
|
export const DEFAULT_SCENE3D_LIGHTS = [
|
|
81
50
|
{ type: "directional", color: 0xffffff, intensity: 2, position: { x: 50, y: 100, z: 80 } },
|
|
82
51
|
{ type: "directional", color: 0xffffff, intensity: 1.5, position: { x: -50, y: 80, z: -60 } },
|
|
@@ -103,18 +72,12 @@ export const hexToRgba = (hex) => {
|
|
|
103
72
|
const a = matches.length >= 4 ? Number.parseInt(matches[3], 16) : 255;
|
|
104
73
|
return [r, g, b, a];
|
|
105
74
|
};
|
|
106
|
-
/**
|
|
107
|
-
* Resolves lights for the declarative GLB scene: {@link Models3DConfig.lights} when set, otherwise SDK defaults.
|
|
108
|
-
*/
|
|
109
75
|
export function resolveModels3DLights(models) {
|
|
110
76
|
if (models.lights && models.lights.length > 0) {
|
|
111
77
|
return [...models.lights];
|
|
112
78
|
}
|
|
113
79
|
return [...DEFAULT_SCENE3D_LIGHTS];
|
|
114
80
|
}
|
|
115
|
-
/**
|
|
116
|
-
* Merges two partial rotations by adding each axis in degrees.
|
|
117
|
-
*/
|
|
118
81
|
export function mergeRotation3D(a, b) {
|
|
119
82
|
var _a, _b, _c, _d, _e, _f;
|
|
120
83
|
return {
|
|
@@ -123,9 +86,6 @@ export function mergeRotation3D(a, b) {
|
|
|
123
86
|
roll: ((_e = a === null || a === void 0 ? void 0 : a.roll) !== null && _e !== void 0 ? _e : 0) + ((_f = b === null || b === void 0 ? void 0 : b.roll) !== null && _f !== void 0 ? _f : 0),
|
|
124
87
|
};
|
|
125
88
|
}
|
|
126
|
-
/**
|
|
127
|
-
* Normalizes a uniform or per-axis scale; undefined uses `fallback` on all axes.
|
|
128
|
-
*/
|
|
129
89
|
export function normalizeScale(scale, fallback) {
|
|
130
90
|
if (scale === undefined) {
|
|
131
91
|
return [fallback, fallback, fallback];
|
|
@@ -135,9 +95,6 @@ export function normalizeScale(scale, fallback) {
|
|
|
135
95
|
}
|
|
136
96
|
return [scale[0], scale[1], scale[2]];
|
|
137
97
|
}
|
|
138
|
-
/**
|
|
139
|
-
* Placement scale overrides asset default when provided; otherwise asset (or 1) applies.
|
|
140
|
-
*/
|
|
141
98
|
export function mergeGlbScale(assetDefault, placementOverride) {
|
|
142
99
|
const base = normalizeScale(assetDefault, 1);
|
|
143
100
|
if (placementOverride === undefined) {
|
|
@@ -145,72 +102,37 @@ export function mergeGlbScale(assetDefault, placementOverride) {
|
|
|
145
102
|
}
|
|
146
103
|
return normalizeScale(placementOverride, 1);
|
|
147
104
|
}
|
|
148
|
-
/**
|
|
149
|
-
* Resolves the effective zoom-based transparency for a placement, applying precedence:
|
|
150
|
-
* placement > asset > global. Returns `undefined` when none is configured.
|
|
151
|
-
*/
|
|
152
105
|
export function resolveZoomTransparency(models, asset, placement) {
|
|
153
106
|
var _a, _b;
|
|
154
107
|
return (_b = (_a = placement.zoomTransparency) !== null && _a !== void 0 ? _a : asset === null || asset === void 0 ? void 0 : asset.zoomTransparency) !== null && _b !== void 0 ? _b : models.zoomTransparency;
|
|
155
108
|
}
|
|
156
|
-
/**
|
|
157
|
-
* Opacity for a given zoom under a hard-threshold {@link ZoomTransparencyConfig}.
|
|
158
|
-
* Returns `cfg.opacity` when `zoom >= cfg.zoom`, otherwise `1` (fully opaque).
|
|
159
|
-
* With no config, returns `1`.
|
|
160
|
-
*/
|
|
161
109
|
export function opacityForZoom(cfg, zoom) {
|
|
162
110
|
if (!cfg) {
|
|
163
111
|
return 1;
|
|
164
112
|
}
|
|
165
113
|
return zoom >= cfg.zoom ? cfg.opacity : 1;
|
|
166
114
|
}
|
|
167
|
-
/**
|
|
168
|
-
* Resolves the effective route-based transparency for a placement, applying precedence:
|
|
169
|
-
* placement > asset > global. Returns `undefined` when none is configured, which disables
|
|
170
|
-
* route transparency for that model (a route crossing it leaves its opacity unchanged).
|
|
171
|
-
*/
|
|
172
115
|
export function resolveRouteTransparency(models, asset, placement) {
|
|
173
116
|
var _a, _b;
|
|
174
117
|
return (_b = (_a = placement.routeTransparency) !== null && _a !== void 0 ? _a : asset === null || asset === void 0 ? void 0 : asset.routeTransparency) !== null && _b !== void 0 ? _b : models.routeTransparency;
|
|
175
118
|
}
|
|
176
|
-
/**
|
|
177
|
-
* Whether a point already expressed in the model's local space falls within its x/z footprint.
|
|
178
|
-
* @internal
|
|
179
|
-
*/
|
|
180
119
|
export function pointInFootprint(footprint, localX, localZ) {
|
|
181
120
|
return (localX >= footprint.minX &&
|
|
182
121
|
localX <= footprint.maxX &&
|
|
183
122
|
localZ >= footprint.minZ &&
|
|
184
123
|
localZ <= footprint.maxZ);
|
|
185
124
|
}
|
|
186
|
-
/**
|
|
187
|
-
* Effective opacity for a placed model: the more transparent of its zoom-based value and, when a
|
|
188
|
-
* route currently crosses it, its route-based value. Route transparency only participates when a
|
|
189
|
-
* {@link RouteTransparencyConfig} is configured (`routeCfg` present) and the model is currently
|
|
190
|
-
* crossed by a route (`routeAffected`).
|
|
191
|
-
* @internal
|
|
192
|
-
*/
|
|
193
125
|
export function effectiveModelOpacity(zoomCfg, routeCfg, zoom, routeAffected) {
|
|
194
126
|
const zoomOpacity = opacityForZoom(zoomCfg, zoom);
|
|
195
127
|
const routeOpacity = routeAffected && routeCfg ? routeCfg.opacity : 1;
|
|
196
128
|
return Math.min(zoomOpacity, routeOpacity);
|
|
197
129
|
}
|
|
198
|
-
/**
|
|
199
|
-
* Whether a GLB placement should be visible for the given floor key.
|
|
200
|
-
*/
|
|
201
130
|
export function isPlacementVisibleOnFloor(placement, floorKey) {
|
|
202
131
|
if (placement.visibility.mode === "allFloors") {
|
|
203
132
|
return true;
|
|
204
133
|
}
|
|
205
134
|
return placement.visibility.floorKey === floorKey;
|
|
206
135
|
}
|
|
207
|
-
/**
|
|
208
|
-
* Computes a GLB pivot's scene-space position (in metres) from a placement's Mercator target and a
|
|
209
|
-
* Mercator reference origin, plus the asset-level and placement-level offsets.
|
|
210
|
-
*
|
|
211
|
-
* X/Z come from the Mercator delta divided by the metre scale; Y comes only from the offsets (the
|
|
212
|
-
* model is bottom-aligned separately). All offsets are in map-space metres.
|
|
213
|
-
*/
|
|
214
136
|
export function computeScenePosition(target, ref, meterScale, assetOffset, placementOffset) {
|
|
215
137
|
var _a, _b, _c, _d, _e, _f;
|
|
216
138
|
const sx = (target.x - ref.x) / meterScale;
|
|
@@ -223,4 +145,3 @@ export function computeScenePosition(target, ref, meterScale, assetOffset, place
|
|
|
223
145
|
const pz = (_f = placementOffset === null || placementOffset === void 0 ? void 0 : placementOffset.z) !== null && _f !== void 0 ? _f : 0;
|
|
224
146
|
return [sx + ax + px, ay + py, sz + az + pz];
|
|
225
147
|
}
|
|
226
|
-
//# sourceMappingURL=3d.js.map
|
|
@@ -48,4 +48,3 @@ export declare function buildStoreLogoData(features: Feature[], floorKey: string
|
|
|
48
48
|
* per-logo scale factor. Returns a fallback of `10` when the icon is missing from the sprite atlas.
|
|
49
49
|
*/
|
|
50
50
|
export declare function computeStoreLogoSize(mapping: Record<string, SpriteIconData>, icon: string, logoScale: Record<string, number>): number;
|
|
51
|
-
//# sourceMappingURL=deckLayers.d.ts.map
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure data builders for the deck.gl indoor overlay sublayers.
|
|
3
|
-
*
|
|
4
|
-
* These functions contain the feature-filtering and coordinate/height mapping logic used inside the
|
|
5
|
-
* deck.gl `renderSubLayers` callbacks in {@link InternalMapVXMap}. They are kept free of any deck.gl
|
|
6
|
-
* / WebGL imports so the logic is unit-testable without a GL context.
|
|
7
|
-
*
|
|
8
|
-
* @group Utils
|
|
9
|
-
*/
|
|
10
|
-
/** Extracts polygon coordinate rings from a GeoJSON geometry (Polygon or MultiPolygon). */
|
|
11
1
|
export function extractPolygonRings(geom) {
|
|
12
2
|
if (geom.type === "Polygon") {
|
|
13
3
|
return [geom.coordinates];
|
|
@@ -17,10 +7,6 @@ export function extractPolygonRings(geom) {
|
|
|
17
7
|
}
|
|
18
8
|
return [];
|
|
19
9
|
}
|
|
20
|
-
/**
|
|
21
|
-
* Builds elevated room-outline paths from indoor "room" features on the given floor.
|
|
22
|
-
* Each ring is lifted to `z` (feature `height` when present, otherwise `defaultHeight`).
|
|
23
|
-
*/
|
|
24
10
|
export function buildElevatedPaths(features, floorKey, defaultHeight) {
|
|
25
11
|
var _a;
|
|
26
12
|
const rooms = features.filter((f) => {
|
|
@@ -40,10 +26,6 @@ export function buildElevatedPaths(features, floorKey, defaultHeight) {
|
|
|
40
26
|
}
|
|
41
27
|
return paths;
|
|
42
28
|
}
|
|
43
|
-
/**
|
|
44
|
-
* Builds indoor label text data from `area_name` / `poi` point features on the given floor.
|
|
45
|
-
* A feature is skipped when a matching `logo-{name}` sprite exists (icon takes priority over text).
|
|
46
|
-
*/
|
|
47
29
|
export function buildLabelData(features, floorKey, hasImage, defaultHeight) {
|
|
48
30
|
const labelFeatures = features.filter((f) => {
|
|
49
31
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -57,7 +39,7 @@ export function buildLabelData(features, floorKey, hasImage, defaultHeight) {
|
|
|
57
39
|
if (((_f = f.properties) === null || _f === void 0 ? void 0 : _f.floor_key) && f.properties.floor_key !== floorKey)
|
|
58
40
|
return false;
|
|
59
41
|
if (hasImage("logo-" + name))
|
|
60
|
-
return false;
|
|
42
|
+
return false;
|
|
61
43
|
return true;
|
|
62
44
|
});
|
|
63
45
|
return labelFeatures.map((f) => {
|
|
@@ -71,7 +53,6 @@ export function buildLabelData(features, floorKey, hasImage, defaultHeight) {
|
|
|
71
53
|
});
|
|
72
54
|
});
|
|
73
55
|
}
|
|
74
|
-
/** Resolves the POI icon id from a feature's `tags` and `subclass`. */
|
|
75
56
|
export function resolvePoiIcon(tags, subclass) {
|
|
76
57
|
if (tags.includes("wheelchair"))
|
|
77
58
|
return "accessible_toilets";
|
|
@@ -79,7 +60,6 @@ export function resolvePoiIcon(tags, subclass) {
|
|
|
79
60
|
return "changing_table";
|
|
80
61
|
return subclass;
|
|
81
62
|
}
|
|
82
|
-
/** Builds POI icon data (elevators / toilets) from point features on the given floor. */
|
|
83
63
|
export function buildPoiIconData(features, floorKey, defaultHeight) {
|
|
84
64
|
const poi = features.filter((f) => {
|
|
85
65
|
var _a, _b, _c;
|
|
@@ -101,7 +81,6 @@ export function buildPoiIconData(features, floorKey, defaultHeight) {
|
|
|
101
81
|
});
|
|
102
82
|
});
|
|
103
83
|
}
|
|
104
|
-
/** Builds store-logo icon data from point features that have a matching `logo-{name}` sprite. */
|
|
105
84
|
export function buildStoreLogoData(features, floorKey, spriteMapping, defaultHeight) {
|
|
106
85
|
const logos = features.filter((f) => {
|
|
107
86
|
var _a, _b, _c;
|
|
@@ -127,10 +106,6 @@ export function buildStoreLogoData(features, floorKey, spriteMapping, defaultHei
|
|
|
127
106
|
};
|
|
128
107
|
});
|
|
129
108
|
}
|
|
130
|
-
/**
|
|
131
|
-
* Computes the display size for a store-logo icon from its sprite dimensions and an optional
|
|
132
|
-
* per-logo scale factor. Returns a fallback of `10` when the icon is missing from the sprite atlas.
|
|
133
|
-
*/
|
|
134
109
|
export function computeStoreLogoSize(mapping, icon, logoScale) {
|
|
135
110
|
const m = mapping[icon];
|
|
136
111
|
if (!m)
|
|
@@ -141,4 +116,3 @@ export function computeStoreLogoSize(mapping, icon, logoScale) {
|
|
|
141
116
|
const base = 10 * (h / Math.max(w, h));
|
|
142
117
|
return base * (logoScale[icon] || 1);
|
|
143
118
|
}
|
|
144
|
-
//# sourceMappingURL=deckLayers.js.map
|
package/dist/es/utils/error.d.ts
CHANGED
package/dist/es/utils/error.js
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Convert an unknown error to an Error object.
|
|
3
|
-
* @group Utils
|
|
4
|
-
* @param error - The unknown error.
|
|
5
|
-
* @returns An Error object.
|
|
6
|
-
*/
|
|
7
1
|
export function convertToError(error) {
|
|
8
2
|
if (error instanceof Error) {
|
|
9
3
|
return error;
|
|
@@ -13,4 +7,3 @@ export function convertToError(error) {
|
|
|
13
7
|
return new Error(text);
|
|
14
8
|
}
|
|
15
9
|
}
|
|
16
|
-
//# sourceMappingURL=error.js.map
|
package/dist/es/utils/images.js
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Load an image as a data URL.
|
|
3
|
-
* @group Utils
|
|
4
|
-
* @param imgUrl - The URL of the image to load.
|
|
5
|
-
* @returns A promise that resolves to the data URL of the image.
|
|
6
|
-
*/
|
|
7
1
|
export function loadImageAsDataUrl(imgUrl) {
|
|
8
2
|
return new Promise((resolve, reject) => {
|
|
9
3
|
fetch(imgUrl)
|
|
@@ -19,4 +13,3 @@ export function loadImageAsDataUrl(imgUrl) {
|
|
|
19
13
|
.catch(reject);
|
|
20
14
|
});
|
|
21
15
|
}
|
|
22
|
-
//# sourceMappingURL=images.js.map
|
package/dist/es/utils/loadGlb.js
CHANGED
|
@@ -1,26 +1,7 @@
|
|
|
1
1
|
import { DEFAULT_DRACO_DECODER_PATH, DEFAULT_KTX2_TRANSCODER_PATH } from "../config/draco";
|
|
2
2
|
import { loadMeshoptDecoder, loadThree, memoizeImport } from "./three";
|
|
3
|
-
/**
|
|
4
|
-
* Builds a stand-in meshopt decoder that defers importing the real module (and instantiating its
|
|
5
|
-
* WASM) until the first `EXT_meshopt_compression` buffer actually needs decoding. GLBs without the
|
|
6
|
-
* extension never trigger the import, so the decoder stays off the critical path of the first 3D
|
|
7
|
-
* frame — it used to be part of the eager three.js import chain, delaying every scene load.
|
|
8
|
-
*
|
|
9
|
-
* `supported` mirrors the real module's own gate — it returns a bare `{ supported: false }` when
|
|
10
|
-
* `typeof WebAssembly !== "object"` — so the answer is reproduced synchronously here without
|
|
11
|
-
* importing anything. Reporting a flat `true` instead would break the platforms it claims to
|
|
12
|
-
* support: `GLTFLoader` reads `supported` before deciding to decode, and on `false` with meshopt
|
|
13
|
-
* merely OPTIONAL it returns `null` and falls back to the GLB's uncompressed buffer
|
|
14
|
-
* (`GLTFLoader.js` `GLTFMeshoptCompression.loadBufferView`). Claiming support on a WASM-less
|
|
15
|
-
* platform discards that fallback and fails the whole asset with a `TypeError` from this shim,
|
|
16
|
-
* since `decodeGltfBufferAsync` does not exist on the real module there.
|
|
17
|
-
*
|
|
18
|
-
* @param load Injectable module loader, for tests. Defaults to the cached {@link loadMeshoptDecoder}.
|
|
19
|
-
* @internal
|
|
20
|
-
*/
|
|
21
3
|
export function createLazyMeshoptDecoder(load = loadMeshoptDecoder) {
|
|
22
4
|
return {
|
|
23
|
-
// Same condition the real decoder uses, evaluated without loading it.
|
|
24
5
|
supported: typeof WebAssembly === "object",
|
|
25
6
|
decodeGltfBufferAsync: async (count, size, source, mode, filter) => {
|
|
26
7
|
const decoder = await load();
|
|
@@ -29,20 +10,6 @@ export function createLazyMeshoptDecoder(load = loadMeshoptDecoder) {
|
|
|
29
10
|
},
|
|
30
11
|
};
|
|
31
12
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Lazily-initialized, cached GLTF loader configured with Draco + KTX2 support.
|
|
34
|
-
*
|
|
35
|
-
* The loaders (and their WebGLRenderer for KTX2 support detection) are heavy and pull in Three.js,
|
|
36
|
-
* so they are created on first use inside the dynamic-import boundary rather than at module load.
|
|
37
|
-
*
|
|
38
|
-
* Memoized through {@link memoizeImport} for the same reason the loaders in `three.ts` are: a plain
|
|
39
|
-
* `cached ??=` also caches a rejection. Fixing the three loaders was not enough, because this is a
|
|
40
|
-
* SECOND cache wrapped around `loadThree()` — so a transient failure was evicted there and then
|
|
41
|
-
* replayed from here forever, and `loadGlbRoot` awaits both, meaning every GLB kept failing with
|
|
42
|
-
* the stale error long after `loadThree()` had recovered. Not only network: the `.then` below
|
|
43
|
-
* constructs a `WebGLRenderer` for KTX2 support detection, and a failed context creation was
|
|
44
|
-
* cached just the same.
|
|
45
|
-
*/
|
|
46
13
|
const getGltfLoader = memoizeImport(() => loadThree().then((mod) => {
|
|
47
14
|
const dracoLoader = new mod.DRACOLoader();
|
|
48
15
|
dracoLoader.setDecoderPath(DEFAULT_DRACO_DECODER_PATH);
|
|
@@ -52,81 +19,25 @@ const getGltfLoader = memoizeImport(() => loadThree().then((mod) => {
|
|
|
52
19
|
ktx2Loader.setTranscoderPath(DEFAULT_KTX2_TRANSCODER_PATH);
|
|
53
20
|
gltfLoader.setKTX2Loader(ktx2Loader);
|
|
54
21
|
ktx2Loader.detectSupport(new mod.THREE.WebGLRenderer({ antialias: true }));
|
|
55
|
-
// Enable EXT_meshopt_compression so meshopt-compressed GLBs decode, without paying for the
|
|
56
|
-
// decoder module up front: the lazy stand-in imports it (and instantiates its WASM) only when
|
|
57
|
-
// the first meshopt-compressed buffer is actually decoded. Assets that don't use the extension
|
|
58
|
-
// never load it. The cast is safe — with `decodeGltfBufferAsync` present, GLTFLoader touches
|
|
59
|
-
// only `supported` and `decodeGltfBufferAsync` (see LazyMeshoptDecoder).
|
|
60
22
|
gltfLoader.setMeshoptDecoder(createLazyMeshoptDecoder());
|
|
61
23
|
return gltfLoader;
|
|
62
24
|
}));
|
|
63
|
-
/**
|
|
64
|
-
* Default per-asset timeout for {@link loadGlbRoot}.
|
|
65
|
-
*
|
|
66
|
-
* Guards against loaders that hang instead of throwing — a GLB whose binary chunk is truncated
|
|
67
|
-
* (see {@link loadGlbRoot}'s completeness check) or otherwise malformed can put Three.js's
|
|
68
|
-
* `DRACOLoader` into an undefined state: sometimes a decode error, sometimes no callback at all.
|
|
69
|
-
* Without a timeout, one such asset never settles and blocks every other load queued behind it.
|
|
70
|
-
*
|
|
71
|
-
* Declarative GLB scenes can legitimately include very large assets — a client's ground-mesh
|
|
72
|
-
* "Suelo" model measured at ~400 MB took ~26s to download alone on a solid connection, before any
|
|
73
|
-
* Draco decode time, and totem hardware/networks in the field are often slower than that. The
|
|
74
|
-
* timeout only needs to be long enough that no realistically-sized valid asset ever hits it; a
|
|
75
|
-
* truly hung load (the actual failure this guards against) would still hang forever whether this
|
|
76
|
-
* is 30 seconds or 500 seconds, so there is no tradeoff in keeping it generous.
|
|
77
|
-
*
|
|
78
|
-
* @group Configuration
|
|
79
|
-
*/
|
|
80
25
|
export const DEFAULT_GLB_LOAD_TIMEOUT_MS = 500000;
|
|
81
|
-
/**
|
|
82
|
-
* Magic number ("glTF" read little-endian) at byte offset 0 of every binary glTF (`.glb`)
|
|
83
|
-
* container. Used only to tell a binary GLB apart from a plain JSON `.gltf` payload — the latter
|
|
84
|
-
* has no such header and skips the completeness check in {@link assertGlbBufferComplete}.
|
|
85
|
-
*/
|
|
86
26
|
const GLB_MAGIC = 0x46546c67;
|
|
87
|
-
/**
|
|
88
|
-
* Rejects a GLB download that was cut short before it reaches Three.js's `GLTFLoader`/`DRACOLoader`,
|
|
89
|
-
* whose behavior on truncated input ranges from a cryptic decode error (e.g. "Unexpected geometry
|
|
90
|
-
* type") to an outright hang, rather than a clear message pointing at the actual problem.
|
|
91
|
-
*
|
|
92
|
-
* The binary glTF container format requires the 12-byte header's declared total length to equal
|
|
93
|
-
* the file's real byte length (see the {@link https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#binary-header | spec}).
|
|
94
|
-
* A mismatch means the response body was truncated — a dropped connection, or the object stored at
|
|
95
|
-
* `url` is itself incomplete — so every buffer-view offset past that point reads garbage. This is
|
|
96
|
-
* exactly what was found in the field for one "Suelo" asset that both threw a decode error and (in
|
|
97
|
-
* a larger sibling file) hung: the file's own header declared a ~383 MB binary chunk while only
|
|
98
|
-
* ~8.7 MB had actually been received.
|
|
99
|
-
*/
|
|
100
27
|
function assertGlbBufferComplete(buffer, url) {
|
|
101
28
|
if (buffer.byteLength < 12)
|
|
102
|
-
return;
|
|
29
|
+
return;
|
|
103
30
|
const header = new DataView(buffer, 0, 12);
|
|
104
31
|
if (header.getUint32(0, true) !== GLB_MAGIC)
|
|
105
|
-
return;
|
|
32
|
+
return;
|
|
106
33
|
const declaredLength = header.getUint32(8, true);
|
|
107
34
|
if (declaredLength !== buffer.byteLength) {
|
|
108
35
|
throw new Error(`GLB download is truncated or corrupt: header declares ${declaredLength} bytes, received ${buffer.byteLength}: ${url}`);
|
|
109
36
|
}
|
|
110
37
|
}
|
|
111
|
-
/**
|
|
112
|
-
* Loads a GLB/GLTF from URL and returns the root scene group.
|
|
113
|
-
* Central entry point so the loader implementation can be swapped later (e.g. Draco, KTX2, custom fetch).
|
|
114
|
-
*
|
|
115
|
-
* Fetches the raw bytes itself (rather than deferring to `GLTFLoader.load`) so a truncated download
|
|
116
|
-
* can be caught and rejected clearly — see {@link assertGlbBufferComplete} — before it ever reaches
|
|
117
|
-
* the Draco/KTX2 decoders.
|
|
118
|
-
*
|
|
119
|
-
* @param url - GLB URL
|
|
120
|
-
* @returns Root `THREE.Group` from the loaded glTF scene
|
|
121
|
-
* @group Utils
|
|
122
|
-
*/
|
|
123
38
|
export async function loadGlbRoot(url, options = {}) {
|
|
124
39
|
const { timeoutMs = DEFAULT_GLB_LOAD_TIMEOUT_MS, onProgress } = options;
|
|
125
40
|
const [gltfLoader, { THREE: three }] = await Promise.all([getGltfLoader(), loadThree()]);
|
|
126
|
-
// Set once the caller has stopped waiting (success, failure, or timeout) so any callback three
|
|
127
|
-
// fires afterwards — e.g. a timed-out fetch/decode that keeps running in the background — is a
|
|
128
|
-
// no-op instead of resolving/rejecting an already-settled promise or emitting a stray progress
|
|
129
|
-
// event after the batch this asset belongs to already reported `done: true`.
|
|
130
41
|
let settled = false;
|
|
131
42
|
const fileLoader = new three.FileLoader();
|
|
132
43
|
fileLoader.setResponseType("arraybuffer");
|
|
@@ -175,11 +86,6 @@ export async function loadGlbRoot(url, options = {}) {
|
|
|
175
86
|
finally {
|
|
176
87
|
settled = true;
|
|
177
88
|
clearTimeout(timer);
|
|
178
|
-
// Cancels the underlying fetch (and, by never delivering its buffer, the Draco/KTX2 decode)
|
|
179
|
-
// so a timed-out asset actually frees its network/CPU usage instead of running to completion
|
|
180
|
-
// unattended — otherwise GLB_LOAD_CONCURRENCY only bounds how many loads the caller awaits,
|
|
181
|
-
// not how many are truly in flight. A no-op if `load` already won the race.
|
|
182
89
|
fileLoader.abort();
|
|
183
90
|
}
|
|
184
91
|
}
|
|
185
|
-
//# sourceMappingURL=loadGlb.js.map
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns whether a URL hostname is part of the MapVX API domain tree.
|
|
3
|
-
* Matches `mapvx.com` and `mapvx.dev` plus any subdomain (`api.mapvx.com`,
|
|
4
|
-
* `public-api.mapvx.com`, `api.mapvx.dev`, `portal.mapvx.dev`, etc.).
|
|
5
|
-
* Does not match lookalike domains (e.g. `notmapvx.com`).
|
|
6
|
-
*
|
|
7
|
-
* @param hostname - Value from `URL.hostname` (no port)
|
|
8
|
-
* @returns True if context headers should be attached for this host
|
|
9
|
-
* @group Utils
|
|
10
|
-
*/
|
|
11
1
|
export function isMapVxRequestHostname(hostname) {
|
|
12
2
|
const h = hostname.trim().toLowerCase();
|
|
13
3
|
if (!h) {
|
|
@@ -15,4 +5,3 @@ export function isMapVxRequestHostname(hostname) {
|
|
|
15
5
|
}
|
|
16
6
|
return /^(?:[a-z0-9-]+\.)*mapvx\.(?:com|dev)$/.test(h);
|
|
17
7
|
}
|
|
18
|
-
//# sourceMappingURL=mapvxHostname.js.map
|