@mappedin/react-sdk 6.0.1-beta.42 → 6.0.1-beta.43

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.
@@ -10,6 +10,7 @@
10
10
  // ../react/@mappedin/mappedin-js
11
11
  // ../react/@packages/internal/common
12
12
  // ../react/@mappedin/core-sdk
13
+ // ../react/@packages/internal/mvf-utils/tokens/token-manager
13
14
  // ../react/@packages/internal/outdoor-context-v4
14
15
  // ../react/@packages/internal/geojson-navigator
15
16
  // ../react/@mappedin/mvf-core
@@ -412,7 +413,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src' {
412
413
  export type { Debug } from '@mappedin/react-sdk/mappedin-js/src/debug';
413
414
  export type { Navigation, TNavigationOptions } from '@mappedin/react-sdk/mappedin-js/src/navigation';
414
415
  export type { TSpaceType } from '@mappedin/react-sdk/mappedin-js/src/map-data-objects';
415
- export { Coordinate, Annotation, Connection, Door, Floor, FloorStack, MapObject, PointOfInterest, Space, Image as ImageData, Hyperlink, EnterpriseLocation, EnterpriseCategory, EnterpriseVenue, LocationProfile, LocationCategory, Facade, Node, Area, type Places, } from '@mappedin/react-sdk/mappedin-js/src/map-data-objects';
416
+ export { Coordinate, Annotation, Connection, Door, Floor, FloorStack, MapObject, PointOfInterest, Space, ImageMetaData, Hyperlink, EnterpriseLocation, EnterpriseCategory, EnterpriseVenue, LocationProfile, LocationCategory, Facade, Node, Area, type Places, } from '@mappedin/react-sdk/mappedin-js/src/map-data-objects';
416
417
  export type { Camera, Models, Labels, BlueDot, Markers, Paths, Exporter, Directions, Style, Shapes, Outdoor, Images, StackedMaps, DynamicFocus, } from '@mappedin/react-sdk/mappedin-js/src/api-geojson';
417
418
  export type { SearchResult, SearchResultItem, SearchResultEnterpriseCategory, SearchResultEnterpriseLocations, SearchResultPlaces, SearchOptions, Search, Suggestion, MatchInfo, } from '@mappedin/react-sdk/mappedin-js/src/search';
418
419
  export type { TFindNearestOptions, TFindNearestResult, TQueriables, Query } from '@mappedin/react-sdk/mappedin-js/src/query';
@@ -800,13 +801,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-data' {
800
801
  *
801
802
  * @returns {string} The current access token
802
803
  */
803
- getAccessToken(): Promise<string | undefined>;
804
- /**
805
- * Get a SAS token for fetching images on non-public maps.
806
- *
807
- * @returns {string} The SAS token
808
- */
809
- getSasToken(): Promise<string | undefined>;
804
+ getAccessToken(): string | undefined;
810
805
  /**
811
806
  * The name of the map.
812
807
  *
@@ -1231,7 +1226,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-data-objects' {
1231
1226
  import PointOfInterest from '@mappedin/react-sdk/mappedin-js/src/map-data-objects/poi';
1232
1227
  import Annotation from '@mappedin/react-sdk/mappedin-js/src/map-data-objects/annotation';
1233
1228
  import Hyperlink from '@mappedin/react-sdk/mappedin-js/src/map-data-objects/hyperlink';
1234
- import Image from '@mappedin/react-sdk/mappedin-js/src/map-data-objects/image';
1229
+ import ImageMetaData from '@mappedin/react-sdk/mappedin-js/src/map-data-objects/image';
1235
1230
  import FloorStack from '@mappedin/react-sdk/mappedin-js/src/map-data-objects/floor-stack';
1236
1231
  import Facade from '@mappedin/react-sdk/mappedin-js/src/map-data-objects/facade';
1237
1232
  import type { MapDataRecords, EnterpriseMapDataRecords } from '@mappedin/react-sdk/mappedin-js/src/utils/data-creation';
@@ -1250,6 +1245,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-data-objects' {
1250
1245
  import { Query } from '@mappedin/react-sdk/mappedin-js/src/query';
1251
1246
  import LocationProfile from '@mappedin/react-sdk/mappedin-js/src/map-data-objects/location-profile';
1252
1247
  import LocationCategory from '@mappedin/react-sdk/mappedin-js/src/map-data-objects/location-category';
1248
+ import type { TokenManager } from '@packages/internal/mvf-utils/tokens/token-manager';
1253
1249
  /**
1254
1250
  * Internal class representing detailed map data.
1255
1251
  *
@@ -1285,7 +1281,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-data-objects' {
1285
1281
  */
1286
1282
  readonly obstructionIdByEntranceId: Record<string, string>;
1287
1283
  readonly venue?: EnterpriseVenue;
1288
- readonly sasToken?: string;
1284
+ readonly tokenManager?: TokenManager;
1289
1285
  directions: DirectionsInternal;
1290
1286
  enterpriseMode: boolean;
1291
1287
  nodesById: MapDataRecords['nodesById'];
@@ -1432,8 +1428,6 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-data-objects' {
1432
1428
  get locationCategories(): LocationCategory[];
1433
1429
  get mvfFloors(): MVFFloor[];
1434
1430
  get mvfFloorStacks(): MVFFloorStack[];
1435
- getAccessToken(): Promise<string | undefined>;
1436
- getSasToken(): Promise<string | undefined>;
1437
1431
  getByType(type: string): object[];
1438
1432
  getByType(type: 'location-profile'): LocationProfile[];
1439
1433
  getByType(type: 'location-category'): LocationCategory[];
@@ -1510,7 +1504,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-data-objects' {
1510
1504
  */
1511
1505
  destroy(): void;
1512
1506
  }
1513
- export { Node, Area, MapDataInternal, Space, Floor, FloorStack, Facade, Connection, MapObject, Door, Coordinate, PointOfInterest, Annotation, Hyperlink, Image, EnterpriseLocation, EnterpriseCategory, EnterpriseVenue, LocationCategory, LocationProfile, };
1507
+ export { Node, Area, MapDataInternal, Space, Floor, FloorStack, Facade, Connection, MapObject, Door, Coordinate, PointOfInterest, Annotation, Hyperlink, ImageMetaData, EnterpriseLocation, EnterpriseCategory, EnterpriseVenue, LocationCategory, LocationProfile, };
1514
1508
  export type { TSpaceType } from '@mappedin/react-sdk/mappedin-js/src/map-data-objects/space';
1515
1509
  export type { Places };
1516
1510
  }
@@ -3904,6 +3898,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-data-objects/types' {
3904
3898
  import type { LocalePackUrls } from '@packages/internal/mvf-utils';
3905
3899
  import type { LanguagePackHydrationItem } from '@mappedin/react-sdk/mappedin-js/src/types';
3906
3900
  import type { EnvControl, TGetMapDataOptions } from '@packages/internal/mvf-utils/mvf-utils';
3901
+ import { TokenManager } from '@packages/internal/mvf-utils/tokens/token-manager';
3907
3902
  /**
3908
3903
  * Places are the main objects that can be searched for.
3909
3904
  */
@@ -3933,7 +3928,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-data-objects/types' {
3933
3928
  localePacksUrls?: LocalePackUrls;
3934
3929
  languagePacks?: LanguagePackHydrationItem[];
3935
3930
  binaryBundle?: Uint8Array;
3936
- sasToken?: string;
3931
+ tokenManager?: TokenManager;
3937
3932
  getMapDataOptions?: TGetMapDataOptions;
3938
3933
  };
3939
3934
  /**
@@ -5121,10 +5116,11 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-data-objects/hyperlink'
5121
5116
  declare module '@mappedin/react-sdk/mappedin-js/src/map-data-objects/image' {
5122
5117
  import type { Image as MVFImage } from '@mappedin/mvf';
5123
5118
  import BaseMetaData from '@mappedin/react-sdk/mappedin-js/src/map-data-objects/base-metadata-object';
5119
+ import type { MapDataInternal } from '@mappedin/react-sdk/mappedin-js/src/map-data-objects';
5124
5120
  /**
5125
5121
  * A class representing image link data within the map.
5126
5122
  */
5127
- class Image extends BaseMetaData {
5123
+ class ImageMetaData extends BaseMetaData {
5128
5124
  #private;
5129
5125
  /**
5130
5126
  * @internal
@@ -5136,12 +5132,13 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-data-objects/image' {
5136
5132
  * @param instance The instance to check.
5137
5133
  * @returns {boolean} True if the instance is a Image, false otherwise.
5138
5134
  */
5139
- static is(instance: object): instance is Image;
5135
+ static is(instance: object): instance is ImageMetaData;
5140
5136
  /**
5141
5137
  * @internal
5142
5138
  */
5143
5139
  constructor(options: {
5144
5140
  mvfData: MVFImage;
5141
+ mapData: MapDataInternal;
5145
5142
  });
5146
5143
  /**
5147
5144
  * Gets the url of the image.
@@ -5180,7 +5177,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-data-objects/image' {
5180
5177
  */
5181
5178
  destroy(): void;
5182
5179
  }
5183
- export default Image;
5180
+ export default ImageMetaData;
5184
5181
  }
5185
5182
 
5186
5183
  declare module '@mappedin/react-sdk/mappedin-js/src/map-data-objects/floor-stack' {
@@ -5839,10 +5836,11 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-data-objects/location-pr
5839
5836
  import type { TFocusTarget, TNavigationTarget, IFocusable, INavigatable } from '@mappedin/react-sdk/mappedin-js/src/types';
5840
5837
  import { OpeningHours } from '@mappedin/react-sdk/mappedin-js/src/map-data-objects/opening-hours';
5841
5838
  import Hyperlink from '@mappedin/react-sdk/mappedin-js/src/map-data-objects/hyperlink';
5842
- import Image from '@mappedin/react-sdk/mappedin-js/src/map-data-objects/image';
5843
- type LocationData = Omit<MVFLocation, 'categories' | 'spaces' | 'obstructions' | 'entrances' | 'shapes' | 'connections' | 'annotations' | 'areas' | 'openingHoursSpecification' | 'links' | 'pictures' | 'website'> & {
5839
+ import ImageMetaData from '@mappedin/react-sdk/mappedin-js/src/map-data-objects/image';
5840
+ type LocationData = Omit<MVFLocation, 'categories' | 'spaces' | 'obstructions' | 'entrances' | 'shapes' | 'connections' | 'annotations' | 'areas' | 'openingHoursSpecification' | 'links' | 'pictures' | 'website' | 'icon'> & {
5844
5841
  links: Hyperlink[];
5845
- images: Image[];
5842
+ images: ImageMetaData[];
5843
+ icon?: ImageMetaData;
5846
5844
  };
5847
5845
  class LocationProfile extends BaseMetaData implements LocationData, IFocusable, INavigatable {
5848
5846
  #private;
@@ -5879,7 +5877,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-data-objects/location-pr
5879
5877
  /**
5880
5878
  * The location's pictures
5881
5879
  */
5882
- images: Image[];
5880
+ images: ImageMetaData[];
5883
5881
  /**
5884
5882
  * Web links for the location
5885
5883
  */
@@ -5893,7 +5891,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-data-objects/location-pr
5893
5891
  *
5894
5892
  * @format uri
5895
5893
  */
5896
- icon?: string;
5894
+ icon?: ImageMetaData;
5897
5895
  constructor(data: MapDataInternal, options: {
5898
5896
  mvfData: MVFLocation;
5899
5897
  });
@@ -11663,7 +11661,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-data-objects/detailed-ma
11663
11661
  import type LocationProfile from '@mappedin/react-sdk/mappedin-js/src/map-data-objects/location-profile';
11664
11662
  import Hyperlink from '@mappedin/react-sdk/mappedin-js/src/map-data-objects/hyperlink';
11665
11663
  import type { MapDataInternal } from '@mappedin/react-sdk/mappedin-js/src/map-data-objects';
11666
- import Image from '@mappedin/react-sdk/mappedin-js/src/map-data-objects/image';
11664
+ import ImageMetaData from '@mappedin/react-sdk/mappedin-js/src/map-data-objects/image';
11667
11665
  import BaseMapData from '@mappedin/react-sdk/mappedin-js/src/map-data-objects/base-object';
11668
11666
  type PropertiesWithDetails = {
11669
11667
  id: string;
@@ -11692,11 +11690,11 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-data-objects/detailed-ma
11692
11690
  */
11693
11691
  get description(): string;
11694
11692
  /**
11695
- * Gets the array of {@link Image}s associated with this map feature.
11693
+ * Gets the array of {@link ImageMetaData}s associated with this map feature.
11696
11694
  *
11697
- * @returns {Image[]} An array of Image objects, or an empty array if no images exist.
11695
+ * @returns {ImageMetaData[]} An array of Image objects, or an empty array if no images exist.
11698
11696
  */
11699
- get images(): Image[];
11697
+ get images(): ImageMetaData[];
11700
11698
  /**
11701
11699
  * Gets the array of {@link Hyperlink}s associated with this map feature.
11702
11700
  *
@@ -11834,7 +11832,7 @@ declare module '@mappedin/react-sdk/geojson/src/systems/collisions/system' {
11834
11832
 
11835
11833
  declare module '@mappedin/react-sdk/geojson/src/entities/geometry3d' {
11836
11834
  import { Object3D } from 'three';
11837
- import type { Mesh, Object3DEventMap, ShaderMaterial, Texture, TubeGeometry, Color, Vector2 } from 'three';
11835
+ import type { Mesh, Object3DEventMap, ShaderMaterial, Texture, TubeGeometry, Color, Vector2, Raycaster } from 'three';
11838
11836
  import type { InteractionComponent } from '@mappedin/react-sdk/geojson/src/components/interaction';
11839
11837
  import type { MeshComponent } from '@mappedin/react-sdk/geojson/src/components/mesh';
11840
11838
  import type { ModelComponent } from '@mappedin/react-sdk/geojson/src/components/model';
@@ -11848,42 +11846,48 @@ declare module '@mappedin/react-sdk/geojson/src/entities/geometry3d' {
11848
11846
  import type { Text3DComponent } from '@mappedin/react-sdk/geojson/src/components/text3d';
11849
11847
  import type { ModelStyleComponnet, Text3DStyleComponent } from '@mappedin/react-sdk/geojson/src/components/styles';
11850
11848
  export enum Geometry3DComponents {
11851
- Mesh = 0,
11852
- Style = 1,
11853
- Interaction = 2
11849
+ Mesh = 0,
11850
+ Style = 1,
11851
+ Interaction = 2
11854
11852
  }
11855
11853
  type Geometry3DObjectTypes = 'geometry' | 'path' | 'model' | 'custom-geometry' | 'image' | 'text3d';
11856
11854
  export class Geometry3DObject3D extends Object3D {
11857
- type: Geometry3DObjectTypes;
11858
- userData: {
11859
- entityId: string;
11860
- /**
11861
- * TODO: remove this when proper instancing is handled
11862
- */
11863
- isSingleModel?: boolean;
11864
11855
  type: Geometry3DObjectTypes;
11865
- };
11856
+ userData: {
11857
+ entityId: string;
11858
+ /**
11859
+ * TODO: remove this when proper instancing is handled
11860
+ */
11861
+ isSingleModel?: boolean;
11862
+ type: Geometry3DObjectTypes;
11863
+ };
11864
+ /**
11865
+ * Custom raycast implementation for model objects only.
11866
+ * This selectively enables recursive raycasting just for models, which have complex hierarchies,
11867
+ * while avoiding the performance cost of recursive raycasting for other object types.
11868
+ */
11869
+ raycast(raycaster: Raycaster, intersects: any[]): void;
11866
11870
  }
11867
11871
  export type PathMaterial = ShaderMaterial & {
11868
- uniforms: PathUniforms;
11872
+ uniforms: PathUniforms;
11869
11873
  };
11870
11874
  export type PathMesh = Mesh<TubeGeometry, PathMaterial, Object3DEventMap>;
11871
11875
  export class PatMeshContainer extends Geometry3DObject3D {
11872
- children: [PathMesh, PathMesh];
11876
+ children: [PathMesh, PathMesh];
11873
11877
  }
11874
11878
  export type MeshComponentTypes = MeshComponent | PathComponent | ModelComponent | CustomGeometryComponent | Text3DComponent | ImageComponent;
11875
11879
  type MappedComponentType<M> = M extends MeshComponent ? 'geometry' : M extends PathComponent ? 'path' : M extends ModelComponent ? 'model' : M extends CustomGeometryComponent ? 'custom-geometry' : M extends ImageComponent ? 'image' : M extends Text3DComponent ? 'text3d' : never;
11876
11880
  export class Geometry3D<M extends MeshComponentTypes = MeshComponent, S extends StyleComponent | Text3DStyleComponent | ModelStyleComponnet = StyleComponent, I extends InteractionComponent = InteractionComponent, T extends MappedComponentType<M> = MappedComponentType<M>> {
11877
- id: string | number;
11878
- components: [M, S, I?];
11879
- get object3d(): M["mesh"];
11880
- get parentObject3D(): GroupContainerObject3D | GeometryGroupObject3D | null;
11881
- get type(): T;
11882
- entities2D: Map<string | number, Geometry2D>;
11883
- constructor(meshComponent: M, styleComponent: S);
11884
- addEntity(entity: Geometry2D): void;
11885
- removeEntity(entity: Geometry2D): void;
11886
- removeAllEntities(): void;
11881
+ id: string | number;
11882
+ components: [M, S, I?];
11883
+ get object3d(): M["mesh"];
11884
+ get parentObject3D(): GroupContainerObject3D | GeometryGroupObject3D | null;
11885
+ get type(): T;
11886
+ entities2D: Map<string | number, Geometry2D>;
11887
+ constructor(meshComponent: M, styleComponent: S);
11888
+ addEntity(entity: Geometry2D): void;
11889
+ removeEntity(entity: Geometry2D): void;
11890
+ removeAllEntities(): void;
11887
11891
  }
11888
11892
  export type TextGeometry3D = Geometry3D<Text3DComponent, Text3DStyleComponent, InteractionComponent, 'text3d'>;
11889
11893
  export type CustomGeometry3D = Geometry3D<CustomGeometryComponent, StyleComponent, InteractionComponent, 'custom-geometry'>;
@@ -11893,86 +11897,86 @@ declare module '@mappedin/react-sdk/geojson/src/entities/geometry3d' {
11893
11897
  export type MeshGeometry3D = Geometry3D<MeshComponent, StyleComponent, InteractionComponent, 'geometry'>;
11894
11898
  export type Geometry3DTypes = TextGeometry3D | CustomGeometry3D | PathGeometry3D | ImageGeometry3D | MeshGeometry3D | ModelGeometry3D;
11895
11899
  export interface PathUniforms {
11896
- vertexes: {
11897
- type: 'f';
11898
- value: number;
11899
- };
11900
- resolution: {
11901
- type: 'v2';
11902
- value: Vector2;
11903
- };
11904
- cameraParameters: {
11905
- type: 'v2';
11906
- value: Vector2;
11907
- };
11908
- complete: {
11909
- type: 'f';
11910
- value: number;
11911
- };
11912
- color: {
11913
- type: 'c';
11914
- value: Color;
11915
- };
11916
- pathLength: {
11917
- type: 'f';
11918
- value: number;
11919
- };
11920
- nearRadius: {
11921
- type: 'f';
11922
- value: number;
11923
- };
11924
- farRadius: {
11925
- type: 'f';
11926
- value: number;
11927
- };
11928
- nearZoom: {
11929
- type: 'f';
11930
- value: number;
11931
- };
11932
- farZoom: {
11933
- type: 'f';
11934
- value: number;
11935
- };
11936
- pulseColor: {
11937
- type: 'c';
11938
- value: Color;
11939
- };
11940
- pulse: {
11941
- type: 'f';
11942
- value: number;
11943
- };
11944
- pulseLength: {
11945
- type: 'f';
11946
- value: number;
11947
- };
11948
- pathIsVertical: {
11949
- type: 'b';
11950
- value: boolean;
11951
- };
11952
- arrowAnimationTimer: {
11953
- type: 'f';
11954
- value: number;
11955
- };
11956
- arrowTexture: {
11957
- type: 't';
11958
- value: Texture;
11959
- };
11960
- displayArrowsOnPath: {
11961
- type: 'b';
11962
- value: boolean;
11963
- };
11964
- flattenFactor: {
11965
- type: 'f';
11966
- value: number;
11967
- };
11968
- showPulse: {
11969
- type: 'b';
11970
- value: boolean;
11971
- };
11972
- opacityMultiplier: {
11973
- type: 'f';
11974
- value: number;
11975
- };
11900
+ vertexes: {
11901
+ type: 'f';
11902
+ value: number;
11903
+ };
11904
+ resolution: {
11905
+ type: 'v2';
11906
+ value: Vector2;
11907
+ };
11908
+ cameraParameters: {
11909
+ type: 'v2';
11910
+ value: Vector2;
11911
+ };
11912
+ complete: {
11913
+ type: 'f';
11914
+ value: number;
11915
+ };
11916
+ color: {
11917
+ type: 'c';
11918
+ value: Color;
11919
+ };
11920
+ pathLength: {
11921
+ type: 'f';
11922
+ value: number;
11923
+ };
11924
+ nearRadius: {
11925
+ type: 'f';
11926
+ value: number;
11927
+ };
11928
+ farRadius: {
11929
+ type: 'f';
11930
+ value: number;
11931
+ };
11932
+ nearZoom: {
11933
+ type: 'f';
11934
+ value: number;
11935
+ };
11936
+ farZoom: {
11937
+ type: 'f';
11938
+ value: number;
11939
+ };
11940
+ pulseColor: {
11941
+ type: 'c';
11942
+ value: Color;
11943
+ };
11944
+ pulse: {
11945
+ type: 'f';
11946
+ value: number;
11947
+ };
11948
+ pulseLength: {
11949
+ type: 'f';
11950
+ value: number;
11951
+ };
11952
+ pathIsVertical: {
11953
+ type: 'b';
11954
+ value: boolean;
11955
+ };
11956
+ arrowAnimationTimer: {
11957
+ type: 'f';
11958
+ value: number;
11959
+ };
11960
+ arrowTexture: {
11961
+ type: 't';
11962
+ value: Texture;
11963
+ };
11964
+ displayArrowsOnPath: {
11965
+ type: 'b';
11966
+ value: boolean;
11967
+ };
11968
+ flattenFactor: {
11969
+ type: 'f';
11970
+ value: number;
11971
+ };
11972
+ showPulse: {
11973
+ type: 'b';
11974
+ value: boolean;
11975
+ };
11976
+ opacityMultiplier: {
11977
+ type: 'f';
11978
+ value: number;
11979
+ };
11976
11980
  }
11977
11981
  export {};
11978
11982
  }
@@ -13632,8 +13636,8 @@ declare module '@mappedin/react-sdk/geojson/src/systems/collisions/collider-proc
13632
13636
  }
13633
13637
 
13634
13638
  declare module '@mappedin/react-sdk/geojson/src/systems/interactions/system' {
13635
- import { PerspectiveCamera, Vector3, Object3D, Mesh, Intersection, Object3DEventMap } from 'three';
13636
- import { Raycaster, Vector2 } from 'three';
13639
+ import type { PerspectiveCamera, Vector3, Object3D, Intersection, Object3DEventMap } from 'three';
13640
+ import { Mesh, Raycaster, Vector2 } from 'three';
13637
13641
  import type { Geometry2D } from '@mappedin/react-sdk/geojson/src/entities/geometry2d';
13638
13642
  import { QuadTree } from '@packages/internal/quad-tree';
13639
13643
  import type { Geometry3D } from '@mappedin/react-sdk/geojson/src/entities/geometry3d';
package/lib/esm/index.js CHANGED
@@ -1 +1 @@
1
- import{i as E,j as V,k}from"./chunk-EQZ3UB6Q.js";import{c as x,n as A}from"./chunk-NHEEUK2X.js";import"./chunk-O6T6MDFA.js";import"./chunk-O4IEKC42.js";import"./chunk-VNZGIPVW.js";import{a}from"./chunk-LR45PLR2.js";import{a as n}from"./chunk-BYMKRV3A.js";a();a();import Y,{useCallback as $,useMemo as q}from"react";import{useContext as C,useEffect as T,useRef as S,useState as D}from"react";import{createPortal as B}from"react-dom";a();import{createContext as z,useContext as F}from"react";a();var L=class L extends Error{constructor(t){super("".concat(t," must be used within a MapView component."))}};n(L,"MapViewNullError");var m=L;var p=z({mapData:void 0,mapView:void 0});function G(){let{mapData:e,mapView:t}=F(p);if(!e||!t)throw new m("useMap");return{mapData:e,mapView:t}}n(G,"useMap");a();import{useEffect as U}from"react";function u(e,t){U(()=>{t!=null&&typeof e=="function"&&e(t)},[e,t])}n(u,"useOnLoad");function O(e){let{mapView:t}=C(p),r=S(),[o,i]=D(null);return T(()=>{if(t==null)throw new m("Marker");return r.current=t.Markers.add(e.target,"",{...e.options,dynamicResize:!0}),i(r.current),()=>{t==null||r.current==null||t.Markers.remove(r.current)}},[t,e.target]),T(()=>{o&&(t==null||t.updateState(o,{...e.options}))},[e.options]),u(e.onLoad,o),t==null||o==null?null:B(e.children,o.contentEl,o.id)}n(O,"Marker");function J(e){let{mapView:t}=C(p),[r,o]=D(null),i=S(A()),l=S(e.target),f=$(s=>{var M;o(s),(M=e.onLoad)==null||M.call(e,s)},[e.onLoad]);T(()=>{if(t==null)throw new m("Marker");if(r&&r.target!==e.target){let{duration:s=300,easing:M="linear"}=e;t.Markers.animateTo(r,e.target,{duration:s,easing:M})}},[t,e.target,r]);let c=q(()=>({...e,duration:void 0,easing:void 0}),[e.duration,e.easing]);return Y.createElement(O,{...c,key:i.current,target:l.current,onLoad:f})}n(J,"AnimatedMarker");a();import{useContext as K,useEffect as R,useRef as Q,useState as X}from"react";function Z(e){let{mapView:t}=K(p),r=Q(),[o,i]=X(void 0);return R(()=>{if(t==null)throw new m("Label");return r.current=t.Labels.add(e.target,e.text,e.options),i(r.current),()=>{t==null||r.current==null||t.Labels.remove(r.current)}},[t,e.target]),R(()=>{r.current&&(t==null||t.updateState(r.current,{text:e.text,...e.options}))},[e.text,e.options]),u(e.onLoad,o),null}n(Z,"Label");a();import{useCallback as _,useContext as ee,useEffect as te}from"react";function re(e,t){let{mapView:r}=ee(p),o=_(i=>t(i),[t]);te(()=>{if(r==null)throw new m("useEvent");return r.on(e,o),()=>{r!=null&&r.off(e,o)}},[r,e,t])}n(re,"useEvent");a();import{useContext as ae,useEffect as oe,useRef as ne,useState as ie}from"react";function pe(e){let{mapView:t}=ae(p),r=ne(),[o,i]=ie(void 0);return oe(()=>{if(t==null)throw new m("Path");let l=t.Paths.add(e.coordinate,e.options);return l.animation.then(()=>{var f;(f=e.onDrawComplete)==null||f.call(e)}),i(l),r.current=l,()=>{r.current&&t.Paths.remove(r.current)}},[t,e.coordinate,e.options]),u(e.onLoad,o),null}n(pe,"Path");a();import w,{useCallback as me,useEffect as ue,useMemo as de,useRef as j,useState as W}from"react";var se={width:"100%",height:"100%",position:"relative"};function le(e){let{mapData:t,options:r,style:o,fallback:i,children:l,...f}=e,c=j(!1),[s,M]=W(void 0),[h,P]=W(!0),y=j(null),b=de(()=>r,[]),v=me(()=>{if(t&&(y!=null&&y.current)){if(s)return;V(y.current,t,b).then(g=>{M(g)}).catch(g=>{x.error("Failed to render MapView",g)}).finally(()=>{P(!1)})}},[t,y.current,b]);return ue(()=>{c.current||(c.current=!0,v())},[v]),u(e.onLoad,s),w.createElement(p.Provider,{value:{mapData:t,mapView:s}},w.createElement("div",{"data-testid":"mappedin-map",ref:y,style:{...se,...o},...f}),h?w.createElement(w.Fragment,null,i):l)}n(le,"MapView");a();import{useContext as fe,useEffect as H,useState as ce}from"react";function Me(e){let{mapView:t}=fe(p),[r,o]=ce(!1);return H(()=>{if(t==null)throw new m("Navigation");return t.Navigation.draw(e.directions,e.options).then(()=>{var i;o(!0),(i=e.onDrawComplete)==null||i.call(e)}),()=>{t.Navigation.clear()}},[t,e.directions,e.options]),H(()=>{r!==!1&&typeof e.onLoad=="function"&&e.onLoad()},[e.onLoad,r]),null}n(Me,"Navigation");a();import{useContext as Pe,useEffect as ye,useRef as he,useState as xe}from"react";function we(e){let{mapView:t}=Pe(p),r=he(),[o,i]=xe(void 0);return ye(()=>{if(t==null)throw new Error("MapView not initialized");return r.current=t.Shapes.add(e.geometry,e.style,e.floor),i(r.current),()=>{t==null||r.current==null||t.Shapes.remove(r.current)}},[t,e.geometry,e.style,e.floor]),u(e.onLoad,o),null}n(we,"Shape");a();import{useContext as ge,useEffect as I,useRef as Le,useState as Te}from"react";function Se(e){let{mapView:t}=ge(p),r=Le(),[o,i]=Te(void 0);return I(()=>{if(t==null)throw new m("Model");return r.current=t.Models.add(e.target,e.url,e.options),i(r.current),()=>{t==null||r.current==null||t.Models.remove(r.current)}},[t,e.url]),I(()=>{r.current&&(t==null||t.updateState(r.current,{position:e.target,...e.options}))},[e.options,e.target]),u(e.onLoad,o),null}n(Se,"Model");a();import{useCallback as Ne,useEffect as be,useMemo as ve,useRef as Ae,useState as N}from"react";function Ee(e){let[t,r]=N(void 0),[o,i]=N(!0),[l,f]=N(void 0),c=Ae(0),s=ve(()=>e,[]),M=Ne(()=>{let h=++c.current;i(!0),f(void 0),E(s).then(P=>{c.current===h&&r(P)}).catch(P=>{c.current===h&&(x.error("Failed to fetch MapData",P),f(P))}).finally(()=>{c.current===h&&i(!1)})},[s]);return be(()=>{M()},[M]),{mapData:t,isLoading:o,error:l}}n(Ee,"useMapData");var Xt=k;export{J as AnimatedMarker,Z as Label,le as MapView,O as Marker,Se as Model,Me as Navigation,pe as Path,we as Shape,Xt as default,re as useEvent,G as useMap,Ee as useMapData};
1
+ import{i as E,j as V,k}from"./chunk-WMO54VQZ.js";import{c as x,n as A}from"./chunk-OPU32TFR.js";import"./chunk-RV2X5GSW.js";import"./chunk-VTOSGJTF.js";import"./chunk-DOOA5SBB.js";import{a}from"./chunk-BVQ2DBMP.js";import{a as n}from"./chunk-BYMKRV3A.js";a();a();import Y,{useCallback as $,useMemo as q}from"react";import{useContext as C,useEffect as T,useRef as S,useState as D}from"react";import{createPortal as B}from"react-dom";a();import{createContext as z,useContext as F}from"react";a();var L=class L extends Error{constructor(t){super("".concat(t," must be used within a MapView component."))}};n(L,"MapViewNullError");var m=L;var p=z({mapData:void 0,mapView:void 0});function G(){let{mapData:e,mapView:t}=F(p);if(!e||!t)throw new m("useMap");return{mapData:e,mapView:t}}n(G,"useMap");a();import{useEffect as U}from"react";function u(e,t){U(()=>{t!=null&&typeof e=="function"&&e(t)},[e,t])}n(u,"useOnLoad");function O(e){let{mapView:t}=C(p),r=S(),[o,i]=D(null);return T(()=>{if(t==null)throw new m("Marker");return r.current=t.Markers.add(e.target,"",{...e.options,dynamicResize:!0}),i(r.current),()=>{t==null||r.current==null||t.Markers.remove(r.current)}},[t,e.target]),T(()=>{o&&(t==null||t.updateState(o,{...e.options}))},[e.options]),u(e.onLoad,o),t==null||o==null?null:B(e.children,o.contentEl,o.id)}n(O,"Marker");function J(e){let{mapView:t}=C(p),[r,o]=D(null),i=S(A()),l=S(e.target),f=$(s=>{var M;o(s),(M=e.onLoad)==null||M.call(e,s)},[e.onLoad]);T(()=>{if(t==null)throw new m("Marker");if(r&&r.target!==e.target){let{duration:s=300,easing:M="linear"}=e;t.Markers.animateTo(r,e.target,{duration:s,easing:M})}},[t,e.target,r]);let c=q(()=>({...e,duration:void 0,easing:void 0}),[e.duration,e.easing]);return Y.createElement(O,{...c,key:i.current,target:l.current,onLoad:f})}n(J,"AnimatedMarker");a();import{useContext as K,useEffect as R,useRef as Q,useState as X}from"react";function Z(e){let{mapView:t}=K(p),r=Q(),[o,i]=X(void 0);return R(()=>{if(t==null)throw new m("Label");return r.current=t.Labels.add(e.target,e.text,e.options),i(r.current),()=>{t==null||r.current==null||t.Labels.remove(r.current)}},[t,e.target]),R(()=>{r.current&&(t==null||t.updateState(r.current,{text:e.text,...e.options}))},[e.text,e.options]),u(e.onLoad,o),null}n(Z,"Label");a();import{useCallback as _,useContext as ee,useEffect as te}from"react";function re(e,t){let{mapView:r}=ee(p),o=_(i=>t(i),[t]);te(()=>{if(r==null)throw new m("useEvent");return r.on(e,o),()=>{r!=null&&r.off(e,o)}},[r,e,t])}n(re,"useEvent");a();import{useContext as ae,useEffect as oe,useRef as ne,useState as ie}from"react";function pe(e){let{mapView:t}=ae(p),r=ne(),[o,i]=ie(void 0);return oe(()=>{if(t==null)throw new m("Path");let l=t.Paths.add(e.coordinate,e.options);return l.animation.then(()=>{var f;(f=e.onDrawComplete)==null||f.call(e)}),i(l),r.current=l,()=>{r.current&&t.Paths.remove(r.current)}},[t,e.coordinate,e.options]),u(e.onLoad,o),null}n(pe,"Path");a();import w,{useCallback as me,useEffect as ue,useMemo as de,useRef as j,useState as W}from"react";var se={width:"100%",height:"100%",position:"relative"};function le(e){let{mapData:t,options:r,style:o,fallback:i,children:l,...f}=e,c=j(!1),[s,M]=W(void 0),[h,P]=W(!0),y=j(null),b=de(()=>r,[]),v=me(()=>{if(t&&(y!=null&&y.current)){if(s)return;V(y.current,t,b).then(g=>{M(g)}).catch(g=>{x.error("Failed to render MapView",g)}).finally(()=>{P(!1)})}},[t,y.current,b]);return ue(()=>{c.current||(c.current=!0,v())},[v]),u(e.onLoad,s),w.createElement(p.Provider,{value:{mapData:t,mapView:s}},w.createElement("div",{"data-testid":"mappedin-map",ref:y,style:{...se,...o},...f}),h?w.createElement(w.Fragment,null,i):l)}n(le,"MapView");a();import{useContext as fe,useEffect as H,useState as ce}from"react";function Me(e){let{mapView:t}=fe(p),[r,o]=ce(!1);return H(()=>{if(t==null)throw new m("Navigation");return t.Navigation.draw(e.directions,e.options).then(()=>{var i;o(!0),(i=e.onDrawComplete)==null||i.call(e)}),()=>{t.Navigation.clear()}},[t,e.directions,e.options]),H(()=>{r!==!1&&typeof e.onLoad=="function"&&e.onLoad()},[e.onLoad,r]),null}n(Me,"Navigation");a();import{useContext as Pe,useEffect as ye,useRef as he,useState as xe}from"react";function we(e){let{mapView:t}=Pe(p),r=he(),[o,i]=xe(void 0);return ye(()=>{if(t==null)throw new Error("MapView not initialized");return r.current=t.Shapes.add(e.geometry,e.style,e.floor),i(r.current),()=>{t==null||r.current==null||t.Shapes.remove(r.current)}},[t,e.geometry,e.style,e.floor]),u(e.onLoad,o),null}n(we,"Shape");a();import{useContext as ge,useEffect as I,useRef as Le,useState as Te}from"react";function Se(e){let{mapView:t}=ge(p),r=Le(),[o,i]=Te(void 0);return I(()=>{if(t==null)throw new m("Model");return r.current=t.Models.add(e.target,e.url,e.options),i(r.current),()=>{t==null||r.current==null||t.Models.remove(r.current)}},[t,e.url]),I(()=>{r.current&&(t==null||t.updateState(r.current,{position:e.target,...e.options}))},[e.options,e.target]),u(e.onLoad,o),null}n(Se,"Model");a();import{useCallback as Ne,useEffect as be,useMemo as ve,useRef as Ae,useState as N}from"react";function Ee(e){let[t,r]=N(void 0),[o,i]=N(!0),[l,f]=N(void 0),c=Ae(0),s=ve(()=>e,[]),M=Ne(()=>{let h=++c.current;i(!0),f(void 0),E(s).then(P=>{c.current===h&&r(P)}).catch(P=>{c.current===h&&(x.error("Failed to fetch MapData",P),f(P))}).finally(()=>{c.current===h&&i(!1)})},[s]);return be(()=>{M()},[M]),{mapData:t,isLoading:o,error:l}}n(Ee,"useMapData");var Xt=k;export{J as AnimatedMarker,Z as Label,le as MapView,O as Marker,Se as Model,Me as Navigation,pe as Path,we as Shape,Xt as default,re as useEvent,G as useMap,Ee as useMapData};