@mappedin/react-sdk 6.0.1-beta.18 → 6.0.1-beta.19
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/THIRD_PARTY_LICENSES.txt +55 -3
- package/lib/esm/{GLTFExporter-NR3ERDGD.js → GLTFExporter-ID2VFRVN.js} +1 -1
- package/lib/esm/{GLTFLoader-ZHFOFTTC.js → GLTFLoader-X3ED3JHI.js} +1 -1
- package/lib/esm/{browser-TR4ROUCR.js → browser-JYF5VUBP.js} +1 -1
- package/lib/esm/chunk-NPRXXUN6.js +1 -0
- package/lib/esm/{chunk-UZHUBMVK.js → chunk-OQLRRFPP.js} +1 -1
- package/lib/esm/{chunk-GSZVCBBR.js → chunk-QQ53JNBN.js} +1 -1
- package/lib/esm/{chunk-GXZGLDW2.js → chunk-VT2X5G75.js} +1 -1
- package/lib/esm/{chunk-5DZS63US.js → chunk-Z7MNFX3S.js} +1 -1
- package/lib/esm/index.d.ts +173 -51
- package/lib/esm/index.js +1 -1
- package/lib/esm/{inspector-NJDKLZAR.js → inspector-KYCO6RVW.js} +1 -1
- package/lib/esm/{internal-5YBLP3J5.js → internal-QJ6OBFUT.js} +1 -1
- package/lib/esm/{outdoor-context-v4-4XPPMKR6.js → outdoor-context-v4-AVQNHL77.js} +1 -1
- package/package.json +2 -2
- package/lib/esm/chunk-R7NTW75J.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{M as B,N as y,q as w,r as x,s as b}from"./chunk-
|
|
1
|
+
import{M as B,N as y,q as w,r as x,s as b}from"./chunk-VT2X5G75.js";import{a as g,j as A}from"./chunk-OQLRRFPP.js";A();function R(o,l=!1){let r=o[0].index!==null,f=new Set(Object.keys(o[0].attributes)),i=new Set(Object.keys(o[0].morphAttributes)),c={},e={},h=o[0].morphTargetsRelative,u=new y,d=0;for(let t=0;t<o.length;++t){let s=o[t],a=0;if(r!==(s.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let n in s.attributes){if(!f.has(n))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+'. All geometries must have compatible attributes; make sure "'+n+'" attribute exists among all geometries, or in none of them.'),null;c[n]===void 0&&(c[n]=[]),c[n].push(s.attributes[n]),a++}if(a!==f.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". Make sure all geometries have the same number of attributes."),null;if(h!==s.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let n in s.morphAttributes){if(!i.has(n))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". .morphAttributes must be consistent throughout all geometries."),null;e[n]===void 0&&(e[n]=[]),e[n].push(s.morphAttributes[n])}if(l){let n;if(r)n=s.index.count;else if(s.attributes.position!==void 0)n=s.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+t+". The geometry must have either an index or a position attribute"),null;u.addGroup(d,n,t),d+=n}}if(r){let t=0,s=[];for(let a=0;a<o.length;++a){let n=o[a].index;for(let m=0;m<n.count;++m)s.push(n.getX(m)+t);t+=o[a].attributes.position.count}u.setIndex(s)}for(let t in c){let s=T(c[t]);if(!s)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+t+" attribute."),null;u.setAttribute(t,s)}for(let t in e){let s=e[t][0].length;if(s===0)break;u.morphAttributes=u.morphAttributes||{},u.morphAttributes[t]=[];for(let a=0;a<s;++a){let n=[];for(let p=0;p<e[t].length;++p)n.push(e[t][p][a]);let m=T(n);if(!m)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+t+" morphAttribute."),null;u.morphAttributes[t].push(m)}}return u}g(R,"mergeGeometries");function T(o){let l,r,f,i=-1,c=0;for(let d=0;d<o.length;++d){let t=o[d];if(l===void 0&&(l=t.array.constructor),l!==t.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(r===void 0&&(r=t.itemSize),r!==t.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(f===void 0&&(f=t.normalized),f!==t.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(i===-1&&(i=t.gpuType),i!==t.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;c+=t.count*r}let e=new l(c),h=new B(e,r,f),u=0;for(let d=0;d<o.length;++d){let t=o[d];if(t.isInterleavedBufferAttribute){let s=u/r;for(let a=0,n=t.count;a<n;a++)for(let m=0;m<r;m++){let p=t.getComponent(a,m);h.setComponent(a+s,m,p)}}else e.set(t.array,u);u+=t.count*r}return i!==void 0&&(h.gpuType=i),h}g(T,"mergeAttributes");function X(o,l){if(l===w)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),o;if(l===b||l===x){let r=o.getIndex();if(r===null){let e=[],h=o.getAttribute("position");if(h!==void 0){for(let u=0;u<h.count;u++)e.push(u);o.setIndex(e),r=o.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),o}let f=r.count-2,i=[];if(l===b)for(let e=1;e<=f;e++)i.push(r.getX(0)),i.push(r.getX(e)),i.push(r.getX(e+1));else for(let e=0;e<f;e++)e%2===0?(i.push(r.getX(e)),i.push(r.getX(e+1)),i.push(r.getX(e+2))):(i.push(r.getX(e+2)),i.push(r.getX(e+1)),i.push(r.getX(e)));i.length/3!==f&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let c=o.clone();return c.setIndex(i),c.clearGroups(),c}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",l),o}g(X,"toTrianglesDrawMode");export{R as a,X as b};
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// Generated by dts-bundle v0.7.3
|
|
2
2
|
// Dependencies for this module:
|
|
3
|
+
// ../react/react
|
|
3
4
|
// ../react/@packages/internal/mvf-utils
|
|
4
5
|
// ../react/@mappedin/mvf
|
|
5
6
|
// ../react/@packages/internal/common/pubsub
|
|
6
7
|
// ../react/@packages/internal/mvf-utils/mvf-utils
|
|
7
8
|
// ../react/@packages/internal/common/Mappedin.Logger
|
|
8
9
|
// ../react/geojson
|
|
9
|
-
// ../react/react
|
|
10
10
|
// ../react/@mappedin/mappedin-js
|
|
11
11
|
// ../react/@packages/internal/common
|
|
12
12
|
// ../react/@mappedin/core-sdk
|
|
@@ -33,18 +33,25 @@
|
|
|
33
33
|
|
|
34
34
|
declare module '@mappedin/react-sdk' {
|
|
35
35
|
import * as Mappedin from '@mappedin/react-sdk/mappedin-js/src';
|
|
36
|
-
export * from '@mappedin/react-sdk/react-sdk/src/Marker';
|
|
37
|
-
export * from '@mappedin/react-sdk/react-sdk/src/Label';
|
|
38
|
-
export * from '@mappedin/react-sdk/react-sdk/src/useEvent';
|
|
39
|
-
export * from '@mappedin/react-sdk/react-sdk/src/Path';
|
|
40
|
-
export * from '@mappedin/react-sdk/react-sdk/src/MapView';
|
|
41
|
-
export * from '@mappedin/react-sdk/react-sdk/src/Navigation';
|
|
42
|
-
export * from '@mappedin/react-sdk/react-sdk/src/Shape';
|
|
43
|
-
export * from '@mappedin/react-sdk/react-sdk/src/Model';
|
|
44
|
-
export * from '@mappedin/react-sdk/react-sdk/src/useMapData';
|
|
45
|
-
export { useMap } from '@mappedin/react-sdk/react-sdk/src/useMap';
|
|
46
|
-
export type { UseMapProps } from '@mappedin/react-sdk/react-sdk/src/useMap';
|
|
47
36
|
export default Mappedin;
|
|
37
|
+
export { Marker, AnimatedMarker } from '@mappedin/react-sdk/react-sdk/src/Marker';
|
|
38
|
+
export type { MarkerProps } from '@mappedin/react-sdk/react-sdk/src/Marker';
|
|
39
|
+
export { Label } from '@mappedin/react-sdk/react-sdk/src/Label';
|
|
40
|
+
export type { LabelProps } from '@mappedin/react-sdk/react-sdk/src/Label';
|
|
41
|
+
export { useEvent } from '@mappedin/react-sdk/react-sdk/src/useEvent';
|
|
42
|
+
export { Path } from '@mappedin/react-sdk/react-sdk/src/Path';
|
|
43
|
+
export type { PathProps } from '@mappedin/react-sdk/react-sdk/src/Path';
|
|
44
|
+
export { MapView } from '@mappedin/react-sdk/react-sdk/src/MapView';
|
|
45
|
+
export type { MapViewProps } from '@mappedin/react-sdk/react-sdk/src/MapView';
|
|
46
|
+
export { Navigation } from '@mappedin/react-sdk/react-sdk/src/Navigation';
|
|
47
|
+
export type { NavigationProps } from '@mappedin/react-sdk/react-sdk/src/Navigation';
|
|
48
|
+
export { Shape } from '@mappedin/react-sdk/react-sdk/src/Shape';
|
|
49
|
+
export type { ShapeProps } from '@mappedin/react-sdk/react-sdk/src/Shape';
|
|
50
|
+
export { Model } from '@mappedin/react-sdk/react-sdk/src/Model';
|
|
51
|
+
export type { ModelProps } from '@mappedin/react-sdk/react-sdk/src/Model';
|
|
52
|
+
export { useMapData } from '@mappedin/react-sdk/react-sdk/src/useMapData';
|
|
53
|
+
export { useMap } from '@mappedin/react-sdk/react-sdk/src/useMap';
|
|
54
|
+
export type { DetailedHTMLProps, HTMLAttributes, ClassAttributes } from 'react';
|
|
48
55
|
}
|
|
49
56
|
|
|
50
57
|
declare module '@mappedin/react-sdk/mappedin-js/src' {
|
|
@@ -403,11 +410,11 @@ declare module '@mappedin/react-sdk/react-sdk/src/Marker' {
|
|
|
403
410
|
children?: ReactNode | ReactElement;
|
|
404
411
|
onLoad?: (marker: Mappedin.Marker) => void;
|
|
405
412
|
}, 'contentHtml'>;
|
|
406
|
-
export type AnimatedMarkerProps = {
|
|
407
|
-
duration?: number;
|
|
408
|
-
};
|
|
409
413
|
/**
|
|
410
|
-
* Marker component
|
|
414
|
+
* Marker component.
|
|
415
|
+
*
|
|
416
|
+
* A Marker is a 2D component anchored to a position on the map.
|
|
417
|
+
* To animate the Marker when its target changes, see {@link AnimatedMarker}.
|
|
411
418
|
*
|
|
412
419
|
* @example
|
|
413
420
|
* ```tsx
|
|
@@ -418,10 +425,14 @@ declare module '@mappedin/react-sdk/react-sdk/src/Marker' {
|
|
|
418
425
|
*
|
|
419
426
|
* @category Components
|
|
420
427
|
*/
|
|
421
|
-
export
|
|
428
|
+
export function Marker(props: MarkerProps): React.ReactPortal | null;
|
|
422
429
|
/**
|
|
423
|
-
* AnimatedMarker component
|
|
430
|
+
* AnimatedMarker component.
|
|
431
|
+
* @experimental
|
|
432
|
+
*
|
|
433
|
+
* A {@link Marker} component that animates between positions when its target changes.
|
|
424
434
|
*
|
|
435
|
+
* @example
|
|
425
436
|
* ```tsx
|
|
426
437
|
* <AnimatedMarker target={mapData.getByType('space')[0]} duration={1000}>
|
|
427
438
|
* <div>Hello, world!</div>
|
|
@@ -430,7 +441,7 @@ declare module '@mappedin/react-sdk/react-sdk/src/Marker' {
|
|
|
430
441
|
*
|
|
431
442
|
* @category Components
|
|
432
443
|
*/
|
|
433
|
-
export
|
|
444
|
+
export function AnimatedMarker(props: MarkerProps & TAnimationOptions): React.JSX.Element;
|
|
434
445
|
export {};
|
|
435
446
|
}
|
|
436
447
|
|
|
@@ -446,23 +457,43 @@ declare module '@mappedin/react-sdk/react-sdk/src/Label' {
|
|
|
446
457
|
onLoad?: (label: Mappedin.Label) => void;
|
|
447
458
|
};
|
|
448
459
|
/**
|
|
449
|
-
* Label component
|
|
460
|
+
* Label component.
|
|
461
|
+
*
|
|
462
|
+
* A Label is a 2D text label anchored to a position on the map.
|
|
450
463
|
*
|
|
451
464
|
* @category Components
|
|
465
|
+
*
|
|
466
|
+
* @example
|
|
467
|
+
* ```tsx
|
|
468
|
+
* <Label target={mapData.getByType('space')[0]} text={"Hello, world!"} />
|
|
469
|
+
* ```
|
|
452
470
|
*/
|
|
453
471
|
export function Label(props: LabelProps): null;
|
|
454
472
|
export {};
|
|
455
473
|
}
|
|
456
474
|
|
|
457
475
|
declare module '@mappedin/react-sdk/react-sdk/src/useEvent' {
|
|
458
|
-
import type
|
|
476
|
+
import type { TEvents } from '@mappedin/mappedin-js';
|
|
459
477
|
/**
|
|
460
|
-
* @
|
|
478
|
+
* Hook to subscribe to an event on the {@link default.MapView | MapView}.
|
|
479
|
+
*
|
|
480
|
+
* @param event - The event to listen for.
|
|
481
|
+
* @param callback - The callback to call when the event is triggered.
|
|
482
|
+
*
|
|
483
|
+
* @category Hooks
|
|
484
|
+
*
|
|
485
|
+
* @example
|
|
486
|
+
* ```tsx
|
|
487
|
+
* useEvent('click', event => {
|
|
488
|
+
* const { coordinate } = event;
|
|
489
|
+
* const { latitude, longitude } = coordinate;
|
|
490
|
+
* console.log(`Map was clicked at ${latitude}, ${longitude}`);
|
|
491
|
+
* });
|
|
492
|
+
* ```
|
|
461
493
|
*/
|
|
462
|
-
export
|
|
463
|
-
export function useEvent<T extends keyof SDK_EVENTS>(event: T, callback: (payload: SDK_EVENTS[T] extends {
|
|
494
|
+
export function useEvent<T extends keyof TEvents>(event: T, callback: (payload: TEvents[T] extends {
|
|
464
495
|
data: null;
|
|
465
|
-
} ?
|
|
496
|
+
} ? TEvents[T]['data'] : TEvents[T]) => void): void;
|
|
466
497
|
}
|
|
467
498
|
|
|
468
499
|
declare module '@mappedin/react-sdk/react-sdk/src/Path' {
|
|
@@ -478,9 +509,20 @@ declare module '@mappedin/react-sdk/react-sdk/src/Path' {
|
|
|
478
509
|
onDrawComplete?: () => void;
|
|
479
510
|
};
|
|
480
511
|
/**
|
|
481
|
-
* Path component
|
|
512
|
+
* Path component.
|
|
513
|
+
*
|
|
514
|
+
* A Path indicates a route on the map.
|
|
482
515
|
*
|
|
483
516
|
* @category Components
|
|
517
|
+
*
|
|
518
|
+
* @example
|
|
519
|
+
* ```tsx
|
|
520
|
+
* const space1 = mapData.getByType('space')[0];
|
|
521
|
+
* const space2 = mapData.getByType('space')[1];
|
|
522
|
+
* const directions = mapView.getDirections(space1, space2);
|
|
523
|
+
*
|
|
524
|
+
* return directions ? <Path coordinate={directions.coordinates} options={{ color: 'blue' }} /> : null;
|
|
525
|
+
* ```
|
|
484
526
|
*/
|
|
485
527
|
export function Path(props: PathProps): null;
|
|
486
528
|
export {};
|
|
@@ -499,18 +541,27 @@ declare module '@mappedin/react-sdk/react-sdk/src/MapView' {
|
|
|
499
541
|
*/
|
|
500
542
|
export type MapViewProps = Omit<TupleToObjectWithPropNames<ParamsArray, StreamAgentParameterNames> & {
|
|
501
543
|
children?: ReactNode;
|
|
544
|
+
/**
|
|
545
|
+
* The fallback content to render while the map is loading.
|
|
546
|
+
*/
|
|
502
547
|
fallback?: ReactNode;
|
|
503
548
|
onLoad?: (mapView: Mappedin.MapView) => void;
|
|
504
549
|
}, 'el'>;
|
|
505
550
|
/**
|
|
506
|
-
* MapView component
|
|
551
|
+
* MapView component.
|
|
552
|
+
*
|
|
553
|
+
* The root component which renders the map and provides context to the hooks and child components.
|
|
507
554
|
*
|
|
508
555
|
* @category Components
|
|
509
556
|
*
|
|
510
557
|
* @example
|
|
511
|
-
* ```tsx
|
|
558
|
+
* ```tsx
|
|
512
559
|
* const { mapData } = useMapData({ key: '...', secret: '...', mapId: '...' });
|
|
513
|
-
* return
|
|
560
|
+
* return (
|
|
561
|
+
* <MapView mapData={mapData}>
|
|
562
|
+
* <Marker target={...} />
|
|
563
|
+
* </MapView>
|
|
564
|
+
* )
|
|
514
565
|
* ```
|
|
515
566
|
*/
|
|
516
567
|
export function MapView(props: MapViewProps & DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>): React.JSX.Element;
|
|
@@ -530,9 +581,20 @@ declare module '@mappedin/react-sdk/react-sdk/src/Navigation' {
|
|
|
530
581
|
onDrawComplete?: () => void;
|
|
531
582
|
};
|
|
532
583
|
/**
|
|
533
|
-
* Navigation component
|
|
584
|
+
* Navigation component.
|
|
585
|
+
*
|
|
586
|
+
* Navigation draws a route on the map with pre-defined Markers for connections and the start and end points.
|
|
534
587
|
*
|
|
535
588
|
* @category Components
|
|
589
|
+
*
|
|
590
|
+
* @example
|
|
591
|
+
* ```tsx
|
|
592
|
+
* const space1 = mapData.getByType('space')[0];
|
|
593
|
+
* const space2 = mapData.getByType('space')[1];
|
|
594
|
+
* const directions = mapView.getDirections(space1, space2);
|
|
595
|
+
*
|
|
596
|
+
* return directions ? <Navigation directions={directions} /> : null;
|
|
597
|
+
* ```
|
|
536
598
|
*/
|
|
537
599
|
export function Navigation(props: NavigationProps): null;
|
|
538
600
|
export {};
|
|
@@ -546,15 +608,22 @@ declare module '@mappedin/react-sdk/react-sdk/src/Shape' {
|
|
|
546
608
|
/**
|
|
547
609
|
* @interface
|
|
548
610
|
*/
|
|
549
|
-
export type
|
|
611
|
+
export type ShapeProps = TupleToObjectWithPropNames<ParamsArray, StreamAgentParameterNames> & {
|
|
550
612
|
onLoad?: (shape: Mappedin.Shape) => void;
|
|
551
613
|
};
|
|
552
614
|
/**
|
|
553
|
-
* Shape component
|
|
615
|
+
* Shape component.
|
|
616
|
+
*
|
|
617
|
+
* A Shape is a custom geometry on the map created from a GeoJSON feature collection.
|
|
554
618
|
*
|
|
555
619
|
* @category Components
|
|
620
|
+
*
|
|
621
|
+
* @example
|
|
622
|
+
* ```tsx
|
|
623
|
+
* <Shape geometry={geojson} style={{ color: 'blue', height: 2 }} />
|
|
624
|
+
* ```
|
|
556
625
|
*/
|
|
557
|
-
export function Shape(props:
|
|
626
|
+
export function Shape(props: ShapeProps): null;
|
|
558
627
|
export {};
|
|
559
628
|
}
|
|
560
629
|
|
|
@@ -570,9 +639,26 @@ declare module '@mappedin/react-sdk/react-sdk/src/Model' {
|
|
|
570
639
|
onLoad?: (models: Mappedin.Model[]) => void;
|
|
571
640
|
};
|
|
572
641
|
/**
|
|
573
|
-
* Model component
|
|
642
|
+
* Model component.
|
|
643
|
+
*
|
|
644
|
+
* A Model is a 3D model in GLTF or GLB format anchored to a position on the map.
|
|
574
645
|
*
|
|
575
646
|
* @category Components
|
|
647
|
+
*
|
|
648
|
+
* @example
|
|
649
|
+
* ```tsx
|
|
650
|
+
* <Model
|
|
651
|
+
* models={mapData.getByType('space').map(space => ({
|
|
652
|
+
* target: space,
|
|
653
|
+
* scale: [0.01, 0.01, 0.01],
|
|
654
|
+
* rotation: [90, 0, 0],
|
|
655
|
+
* opacity: 0.5,
|
|
656
|
+
* }))}
|
|
657
|
+
* options={{
|
|
658
|
+
* url: '...',
|
|
659
|
+
* }}
|
|
660
|
+
* />
|
|
661
|
+
* ```
|
|
576
662
|
*/
|
|
577
663
|
export function Model(props: ModelProps): null;
|
|
578
664
|
export {};
|
|
@@ -580,6 +666,16 @@ declare module '@mappedin/react-sdk/react-sdk/src/Model' {
|
|
|
580
666
|
|
|
581
667
|
declare module '@mappedin/react-sdk/react-sdk/src/useMapData' {
|
|
582
668
|
import type Mappedin from '@mappedin/react-sdk/react-sdk/src';
|
|
669
|
+
/**
|
|
670
|
+
* Hook to perform the fetch of the {@link default.MapData | MapData} and handle loading and error states.
|
|
671
|
+
*
|
|
672
|
+
* @category Hooks
|
|
673
|
+
*
|
|
674
|
+
* @example
|
|
675
|
+
* ```tsx
|
|
676
|
+
* const { mapData, isLoading, error } = useMapData(options);
|
|
677
|
+
* ```
|
|
678
|
+
*/
|
|
583
679
|
export function useMapData(options: Mappedin.TGetMapDataOptions): {
|
|
584
680
|
mapData?: Mappedin.MapData;
|
|
585
681
|
isLoading: boolean;
|
|
@@ -593,11 +689,20 @@ declare module '@mappedin/react-sdk/react-sdk/src/useMap' {
|
|
|
593
689
|
mapData?: Mappedin.MapData;
|
|
594
690
|
mapView?: Mappedin.MapView;
|
|
595
691
|
}>;
|
|
596
|
-
|
|
692
|
+
/**
|
|
693
|
+
* Hook to get the {@link default.MapData | MapData} and {@link default.MapView | MapView}.
|
|
694
|
+
*
|
|
695
|
+
* @category Hooks
|
|
696
|
+
*
|
|
697
|
+
* @example
|
|
698
|
+
* ```tsx
|
|
699
|
+
* const { mapData, mapView } = useMap();
|
|
700
|
+
* ```
|
|
701
|
+
*/
|
|
702
|
+
export function useMap(): {
|
|
597
703
|
mapData: Mappedin.MapData;
|
|
598
704
|
mapView: Mappedin.MapView;
|
|
599
705
|
};
|
|
600
|
-
export function useMap(): UseMapProps;
|
|
601
706
|
}
|
|
602
707
|
|
|
603
708
|
declare module '@mappedin/react-sdk/mappedin-js/src/map-data' {
|
|
@@ -2811,8 +2916,9 @@ declare module '@mappedin/react-sdk/mappedin-js/src/map-view-objects' {
|
|
|
2811
2916
|
|
|
2812
2917
|
declare module '@mappedin/react-sdk/mappedin-js/src/navigation' {
|
|
2813
2918
|
import { type TDirectionInstruction } from '@mappedin/react-sdk/mappedin-js/src';
|
|
2814
|
-
import type { Directions } from '@mappedin/react-sdk/mappedin-js/src/api-geojson';
|
|
2919
|
+
import type { Directions, GeoJsonApi } from '@mappedin/react-sdk/mappedin-js/src/api-geojson';
|
|
2815
2920
|
import type { GeojsonApiMapObject } from '@mappedin/react-sdk/mappedin-js/src/api-geojson/map-object';
|
|
2921
|
+
import type { FloorStack } from '@mappedin/react-sdk/mappedin-js/src/map-data-objects';
|
|
2816
2922
|
import { Path, Marker } from '@mappedin/react-sdk/mappedin-js/src/map-view-objects';
|
|
2817
2923
|
import type { RendererCore } from '@mappedin/core-sdk';
|
|
2818
2924
|
/**
|
|
@@ -2965,7 +3071,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/navigation' {
|
|
|
2965
3071
|
/**
|
|
2966
3072
|
* @internal
|
|
2967
3073
|
*/
|
|
2968
|
-
constructor(core: RendererCore, currentMapGetter: CurrentMapGetter);
|
|
3074
|
+
constructor(core: RendererCore, geoJSONApi: GeoJsonApi, currentMapGetter: CurrentMapGetter);
|
|
2969
3075
|
/**
|
|
2970
3076
|
* @internal
|
|
2971
3077
|
*/
|
|
@@ -2992,6 +3098,10 @@ declare module '@mappedin/react-sdk/mappedin-js/src/navigation' {
|
|
|
2992
3098
|
* The currently active path.
|
|
2993
3099
|
*/
|
|
2994
3100
|
get activePath(): Path | undefined;
|
|
3101
|
+
/**
|
|
3102
|
+
* The current list of floor stacks along the navigation paths.
|
|
3103
|
+
*/
|
|
3104
|
+
get floorStacks(): FloorStack[];
|
|
2995
3105
|
/**
|
|
2996
3106
|
* Sets the active path by index.
|
|
2997
3107
|
*/
|
|
@@ -3059,18 +3169,25 @@ declare module '@mappedin/react-sdk/react-sdk/src/type-utils' {
|
|
|
3059
3169
|
|
|
3060
3170
|
declare module '@mappedin/react-sdk/react-sdk/src' {
|
|
3061
3171
|
import * as Mappedin from '@mappedin/react-sdk/mappedin-js/src';
|
|
3062
|
-
export * from '@mappedin/react-sdk/react-sdk/src/Marker';
|
|
3063
|
-
export * from '@mappedin/react-sdk/react-sdk/src/Label';
|
|
3064
|
-
export * from '@mappedin/react-sdk/react-sdk/src/useEvent';
|
|
3065
|
-
export * from '@mappedin/react-sdk/react-sdk/src/Path';
|
|
3066
|
-
export * from '@mappedin/react-sdk/react-sdk/src/MapView';
|
|
3067
|
-
export * from '@mappedin/react-sdk/react-sdk/src/Navigation';
|
|
3068
|
-
export * from '@mappedin/react-sdk/react-sdk/src/Shape';
|
|
3069
|
-
export * from '@mappedin/react-sdk/react-sdk/src/Model';
|
|
3070
|
-
export * from '@mappedin/react-sdk/react-sdk/src/useMapData';
|
|
3071
|
-
export { useMap } from '@mappedin/react-sdk/react-sdk/src/useMap';
|
|
3072
|
-
export type { UseMapProps } from '@mappedin/react-sdk/react-sdk/src/useMap';
|
|
3073
3172
|
export default Mappedin;
|
|
3173
|
+
export { Marker, AnimatedMarker } from '@mappedin/react-sdk/react-sdk/src/Marker';
|
|
3174
|
+
export type { MarkerProps } from '@mappedin/react-sdk/react-sdk/src/Marker';
|
|
3175
|
+
export { Label } from '@mappedin/react-sdk/react-sdk/src/Label';
|
|
3176
|
+
export type { LabelProps } from '@mappedin/react-sdk/react-sdk/src/Label';
|
|
3177
|
+
export { useEvent } from '@mappedin/react-sdk/react-sdk/src/useEvent';
|
|
3178
|
+
export { Path } from '@mappedin/react-sdk/react-sdk/src/Path';
|
|
3179
|
+
export type { PathProps } from '@mappedin/react-sdk/react-sdk/src/Path';
|
|
3180
|
+
export { MapView } from '@mappedin/react-sdk/react-sdk/src/MapView';
|
|
3181
|
+
export type { MapViewProps } from '@mappedin/react-sdk/react-sdk/src/MapView';
|
|
3182
|
+
export { Navigation } from '@mappedin/react-sdk/react-sdk/src/Navigation';
|
|
3183
|
+
export type { NavigationProps } from '@mappedin/react-sdk/react-sdk/src/Navigation';
|
|
3184
|
+
export { Shape } from '@mappedin/react-sdk/react-sdk/src/Shape';
|
|
3185
|
+
export type { ShapeProps } from '@mappedin/react-sdk/react-sdk/src/Shape';
|
|
3186
|
+
export { Model } from '@mappedin/react-sdk/react-sdk/src/Model';
|
|
3187
|
+
export type { ModelProps } from '@mappedin/react-sdk/react-sdk/src/Model';
|
|
3188
|
+
export { useMapData } from '@mappedin/react-sdk/react-sdk/src/useMapData';
|
|
3189
|
+
export { useMap } from '@mappedin/react-sdk/react-sdk/src/useMap';
|
|
3190
|
+
export type { DetailedHTMLProps, HTMLAttributes, ClassAttributes } from 'react';
|
|
3074
3191
|
}
|
|
3075
3192
|
|
|
3076
3193
|
declare module '@mappedin/react-sdk/mappedin-js/src/map-data-objects/category' {
|
|
@@ -8097,8 +8214,9 @@ declare module '@mappedin/react-sdk/mappedin-js/src/api-geojson/paths' {
|
|
|
8097
8214
|
|
|
8098
8215
|
declare module '@mappedin/react-sdk/mappedin-js/src/navigation/index' {
|
|
8099
8216
|
import { type TDirectionInstruction } from '@mappedin/react-sdk/mappedin-js/src';
|
|
8100
|
-
import type { Directions } from '@mappedin/react-sdk/mappedin-js/src/api-geojson';
|
|
8217
|
+
import type { Directions, GeoJsonApi } from '@mappedin/react-sdk/mappedin-js/src/api-geojson';
|
|
8101
8218
|
import type { GeojsonApiMapObject } from '@mappedin/react-sdk/mappedin-js/src/api-geojson/map-object';
|
|
8219
|
+
import type { FloorStack } from '@mappedin/react-sdk/mappedin-js/src/map-data-objects';
|
|
8102
8220
|
import { Path, Marker } from '@mappedin/react-sdk/mappedin-js/src/map-view-objects';
|
|
8103
8221
|
import type { RendererCore } from '@mappedin/core-sdk';
|
|
8104
8222
|
/**
|
|
@@ -8251,7 +8369,7 @@ declare module '@mappedin/react-sdk/mappedin-js/src/navigation/index' {
|
|
|
8251
8369
|
/**
|
|
8252
8370
|
* @internal
|
|
8253
8371
|
*/
|
|
8254
|
-
constructor(core: RendererCore, currentMapGetter: CurrentMapGetter);
|
|
8372
|
+
constructor(core: RendererCore, geoJSONApi: GeoJsonApi, currentMapGetter: CurrentMapGetter);
|
|
8255
8373
|
/**
|
|
8256
8374
|
* @internal
|
|
8257
8375
|
*/
|
|
@@ -8278,6 +8396,10 @@ declare module '@mappedin/react-sdk/mappedin-js/src/navigation/index' {
|
|
|
8278
8396
|
* The currently active path.
|
|
8279
8397
|
*/
|
|
8280
8398
|
get activePath(): Path | undefined;
|
|
8399
|
+
/**
|
|
8400
|
+
* The current list of floor stacks along the navigation paths.
|
|
8401
|
+
*/
|
|
8402
|
+
get floorStacks(): FloorStack[];
|
|
8281
8403
|
/**
|
|
8282
8404
|
* Sets the active path by index.
|
|
8283
8405
|
*/
|
package/lib/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as x,d as
|
|
1
|
+
import{a as x,d as A,n as V,o as E,p as k}from"./chunk-NPRXXUN6.js";import"./chunk-QQ53JNBN.js";import"./chunk-Z7MNFX3S.js";import"./chunk-VT2X5G75.js";import{a as n,j as a}from"./chunk-OQLRRFPP.js";a();a();import U,{useCallback as Y,useMemo as $}from"react";import{useContext as C,useEffect as T,useRef as S,useState as D}from"react";import{createPortal as q}from"react-dom";a();import{createContext as I,useContext as z}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=I({mapData:void 0,mapView:void 0});function F(){let{mapData:e,mapView:t}=z(p);if(!e||!t)throw new m("useMap");return{mapData:e,mapView:t}}n(F,"useMap");a();import{useEffect as G}from"react";function s(e,t){G(()=>{t!=null&&typeof e=="function"&&e(t)},[e,t])}n(s,"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]),s(e.onLoad,o),t==null||o==null?null:q(e.children,o.contentEl,o.id)}n(O,"Marker");function B(e){let{mapView:t}=C(p),[r,o]=D(null),i=S(A()),u=S(e.target),f=Y(l=>{var M;o(l),(M=e.onLoad)==null||M.call(e,l)},[e.onLoad]);T(()=>{if(t==null)throw new m("Marker");if(r&&r.target!==e.target){let{duration:l=300,easing:M="linear"}=e;t.Markers.animateTo(r,e.target,{duration:l,easing:M})}},[t,e.target,r]);let c=$(()=>({...e,duration:void 0,easing:void 0}),[e.duration,e.easing]);return U.createElement(O,{...c,key:i.current,target:u.current,onLoad:f})}n(B,"AnimatedMarker");a();import{useContext as J,useEffect as R,useRef as K,useState as Q}from"react";function X(e){let{mapView:t}=J(p),r=K(),[o,i]=Q(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]),s(e.onLoad,o),null}n(X,"Label");a();import{useCallback as Z,useContext as _,useEffect as ee}from"react";function te(e,t){let{mapView:r}=_(p),o=Z(i=>t(i),[t]);ee(()=>{if(r==null)throw new m("useEvent");return r.on(e,o),()=>{r!=null&&r.off(e,o)}},[r,e,t])}n(te,"useEvent");a();import{useContext as re,useEffect as ae,useRef as oe,useState as ne}from"react";function ie(e){let{mapView:t}=re(p),r=oe(),[o,i]=ne(void 0);return ae(()=>{if(t==null)throw new m("Path");let u=t.Paths.add(e.coordinate,e.options);return u.animation.then(()=>{var f;(f=e.onDrawComplete)==null||f.call(e)}),i(u),r.current=u,()=>{r.current&&t.Paths.remove(r.current)}},[t,e.coordinate,e.options]),s(e.onLoad,o),null}n(ie,"Path");a();import w,{useCallback as pe,useEffect as me,useMemo as se,useRef as j,useState as W}from"react";var de={width:"100%",height:"100%",position:"relative"};function ue(e){let{mapData:t,options:r,style:o,fallback:i,children:u,...f}=e,c=j(!1),[l,M]=W(void 0),[h,P]=W(!0),y=j(null),b=se(()=>r,[]),v=pe(()=>{if(t&&(y!=null&&y.current)){if(l)return;E(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 me(()=>{c.current||(c.current=!0,v())},[v]),s(e.onLoad,l),w.createElement(p.Provider,{value:{mapData:t,mapView:l}},w.createElement("div",{"data-testid":"mappedin-map",ref:y,style:{...de,...o},...f}),h?w.createElement(w.Fragment,null,i):u)}n(ue,"MapView");a();import{useContext as le,useEffect as H,useState as fe}from"react";function ce(e){let{mapView:t}=le(p),[r,o]=fe(!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(ce,"Navigation");a();import{useContext as Me,useEffect as Pe,useRef as ye,useState as he}from"react";function xe(e){let{mapView:t}=Me(p),r=ye(),[o,i]=he(void 0);return Pe(()=>{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]),s(e.onLoad,o),null}n(xe,"Shape");a();import{useContext as we,useEffect as ge,useRef as Le,useState as Te}from"react";function Se(e){let{mapView:t}=we(p),r=Le(),[o,i]=Te(void 0);return ge(()=>{if(t==null)throw new m("Model");return r.current=t.Models.add(e.models,e.options),i(r.current),()=>{if(!(t==null||r.current==null))for(let u of r.current)t.Models.remove(u)}},[t,e.models,e.options]),s(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 Ve(e){let[t,r]=N(void 0),[o,i]=N(!0),[u,f]=N(void 0),c=Ae(0),l=ve(()=>e,[]),M=Ne(()=>{let h=++c.current;i(!0),f(void 0),V(l).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)})},[l]);return be(()=>{M()},[M]),{mapData:t,isLoading:o,error:u}}n(Ve,"useMapData");var Xt=k;export{B as AnimatedMarker,X as Label,ue as MapView,O as Marker,Se as Model,ce as Navigation,ie as Path,xe as Shape,Xt as default,te as useEvent,F as useMap,Ve as useMapData};
|