@mappedin/viewer 0.0.0-alpha → 0.3.0

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.
Files changed (158) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +54 -18
  3. package/assets/fonts/Roboto-400.ttf +0 -0
  4. package/assets/fonts/Roboto-500.ttf +0 -0
  5. package/assets/fonts/Roboto-700.ttf +0 -0
  6. package/dist/browser-35S22BS6-756afc48.js +229 -0
  7. package/dist/index-7cb8f3c5.js +89817 -0
  8. package/dist/index.js +4 -2
  9. package/dist/outdoor-context-XG4VPE4D-ab82b7cf.js +17268 -0
  10. package/dist/types/src/App.d.ts +9 -0
  11. package/dist/types/src/components/animations/animated-resize.d.ts +13 -0
  12. package/dist/types/src/components/animations/animation-context.d.ts +22 -0
  13. package/dist/types/src/components/animations/animation.stories.d.ts +2 -0
  14. package/dist/types/src/components/animations/utils.d.ts +1 -0
  15. package/dist/types/src/components/button/button.stories.d.ts +3 -0
  16. package/dist/types/src/components/button/index.d.ts +8 -0
  17. package/dist/types/src/components/caret/caret.stories.d.ts +2 -0
  18. package/dist/types/src/components/caret/index.d.ts +7 -0
  19. package/dist/types/src/components/categories/categories.stories.d.ts +3 -0
  20. package/dist/types/src/components/categories/category.d.ts +9 -0
  21. package/dist/types/src/components/categories/index.d.ts +11 -0
  22. package/dist/types/src/components/common/theme-provider.d.ts +6 -0
  23. package/dist/types/src/components/common/typography.d.ts +10 -0
  24. package/dist/types/src/components/common/utils.d.ts +1 -0
  25. package/dist/types/src/components/connection-marker/connection-marker.stories.d.ts +3 -0
  26. package/dist/types/src/components/connection-marker/index.d.ts +9 -0
  27. package/dist/types/src/components/directions/departure-modes.d.ts +8 -0
  28. package/dist/types/src/components/directions/directions-button.d.ts +8 -0
  29. package/dist/types/src/components/directions/directions-search-bar.d.ts +11 -0
  30. package/dist/types/src/components/directions/directions.stories.d.ts +5 -0
  31. package/dist/types/src/components/directions/index.d.ts +17 -0
  32. package/dist/types/src/components/dropped-pin-marker/dropped-pin-hover.d.ts +7 -0
  33. package/dist/types/src/components/dropped-pin-marker/dropped-pin-marker.stories.d.ts +3 -0
  34. package/dist/types/src/components/dropped-pin-marker/index.d.ts +6 -0
  35. package/dist/types/src/components/dropped-pin-marker/use-follow-cursor.d.ts +17 -0
  36. package/dist/types/src/components/dropped-pin-marker/utils.d.ts +8 -0
  37. package/dist/types/src/components/hint/hint.stories.d.ts +2 -0
  38. package/dist/types/src/components/hint/index.d.ts +6 -0
  39. package/dist/types/src/components/hover/hover-element-with-arrow.d.ts +7 -0
  40. package/dist/types/src/components/hover/hover.stories.d.ts +2 -0
  41. package/dist/types/src/components/hover/index.d.ts +16 -0
  42. package/dist/types/src/components/hover/use-hover-element.d.ts +14 -0
  43. package/dist/types/src/components/hover/utils.d.ts +20 -0
  44. package/dist/types/src/components/hover/utils.test.d.ts +1 -0
  45. package/dist/types/src/components/icon/icon.stories.d.ts +2 -0
  46. package/dist/types/src/components/icon/index.d.ts +9 -0
  47. package/dist/types/src/components/input/index.d.ts +6 -0
  48. package/dist/types/src/components/input/input.stories.d.ts +2 -0
  49. package/dist/types/src/components/level-change-notification/index.d.ts +8 -0
  50. package/dist/types/src/components/level-change-notification/level-change-notification.stories.d.ts +2 -0
  51. package/dist/types/src/components/level-selector/index.d.ts +9 -0
  52. package/dist/types/src/components/level-selector/level-selector-menu.d.ts +10 -0
  53. package/dist/types/src/components/level-selector/level-selector.stories.d.ts +3 -0
  54. package/dist/types/src/components/level-selector/utils.d.ts +4 -0
  55. package/dist/types/src/components/main/index.d.ts +28 -0
  56. package/dist/types/src/components/main/main.stories.d.ts +3 -0
  57. package/dist/types/src/components/map-controls/index.d.ts +12 -0
  58. package/dist/types/src/components/map-controls/map-controls.stories.d.ts +2 -0
  59. package/dist/types/src/components/open-app-button/index.d.ts +6 -0
  60. package/dist/types/src/components/open-app-button/open-app-button.stories.d.ts +2 -0
  61. package/dist/types/src/components/panel/index.d.ts +8 -0
  62. package/dist/types/src/components/positioner/index.d.ts +274 -0
  63. package/dist/types/src/components/search-bar/index.d.ts +19 -0
  64. package/dist/types/src/components/search-bar/search.stories.d.ts +4 -0
  65. package/dist/types/src/components/search-bar/use-search-bar.d.ts +11 -0
  66. package/dist/types/src/components/search-bar/use-search-bar.test.d.ts +1 -0
  67. package/dist/types/src/components/search-bar/utils.d.ts +0 -0
  68. package/dist/types/src/components/search-results/index.d.ts +10 -0
  69. package/dist/types/src/components/search-results/search-fallback.d.ts +4 -0
  70. package/dist/types/src/components/search-results/search-results.stories.d.ts +2 -0
  71. package/dist/types/src/components/search-results/use-search-results.d.ts +12 -0
  72. package/dist/types/src/components/search-results/use-search-results.test.d.ts +1 -0
  73. package/dist/types/src/components/share/index.d.ts +7 -0
  74. package/dist/types/src/components/share/share.stories.d.ts +2 -0
  75. package/dist/types/src/components/share/use-share.d.ts +8 -0
  76. package/dist/types/src/components/share/use-share.test.d.ts +1 -0
  77. package/dist/types/src/components/spinner/index.d.ts +8 -0
  78. package/dist/types/src/components/spinner/spinner.stories.d.ts +2 -0
  79. package/dist/types/src/components/tilt-controls/index.d.ts +9 -0
  80. package/dist/types/src/components/tilt-controls/tilt-axes.d.ts +3 -0
  81. package/dist/types/src/components/tilt-controls/tilt-controls.stories.d.ts +2 -0
  82. package/dist/types/src/components/tilt-controls/use-drag-tilt.d.ts +16 -0
  83. package/dist/types/src/components/tilt-controls/utils.d.ts +4 -0
  84. package/dist/types/src/components/title/index.d.ts +7 -0
  85. package/dist/types/src/components/title/title.stories.d.ts +2 -0
  86. package/dist/types/src/components/zoom-controls/index.d.ts +8 -0
  87. package/dist/types/src/components/zoom-controls/zoom-controls.stories.d.ts +2 -0
  88. package/dist/types/src/icons.d.ts +3 -0
  89. package/dist/types/src/index.d.ts +4 -0
  90. package/dist/types/src/lib/canvas/drag-physics.d.ts +27 -0
  91. package/dist/types/src/lib/canvas/drag-physics.test.d.ts +1 -0
  92. package/dist/types/src/lib/canvas/hi-res-canvas.d.ts +33 -0
  93. package/dist/types/src/lib/canvas/hi-res-canvas.test.d.ts +1 -0
  94. package/dist/types/src/lib/hooks/use-app-data.d.ts +8 -0
  95. package/dist/types/src/lib/hooks/use-app-data.test.d.ts +1 -0
  96. package/dist/types/src/lib/hooks/use-callback-ref.d.ts +2 -0
  97. package/dist/types/src/lib/hooks/use-deep-focus.d.ts +13 -0
  98. package/dist/types/src/lib/hooks/use-venue-mvf.d.ts +6 -0
  99. package/dist/types/src/lib/i18n.d.ts +2 -0
  100. package/dist/types/src/lib/logger.d.ts +17 -0
  101. package/dist/types/src/lib/logger.test.d.ts +1 -0
  102. package/dist/types/src/lib/types/directions.d.ts +5 -0
  103. package/dist/types/src/lib/types/map.d.ts +4 -0
  104. package/dist/types/src/lib/types/options.d.ts +18 -0
  105. package/dist/types/src/lib/types/search.d.ts +12 -0
  106. package/dist/types/src/lib/types/state.d.ts +4 -0
  107. package/dist/types/src/lib/types/theme.d.ts +35 -0
  108. package/dist/types/src/lib/types/utils.d.ts +3 -0
  109. package/dist/types/src/lib/utils/color-utils.d.ts +3 -0
  110. package/dist/types/src/lib/utils/color-utils.test.d.ts +1 -0
  111. package/dist/types/src/lib/utils/number-utils.d.ts +1 -0
  112. package/dist/types/src/lib/utils/search-utils.d.ts +1 -0
  113. package/dist/types/src/lib/utils/url-parsing.d.ts +7 -0
  114. package/dist/types/src/lib/utils/url-parsing.test.d.ts +1 -0
  115. package/dist/types/src/states/global.d.ts +5 -0
  116. package/dist/types/src/states/loading.d.ts +6 -0
  117. package/dist/types/src/states/map.d.ts +3 -0
  118. package/dist/types/src/states/not-found.d.ts +3 -0
  119. package/dist/types/src/stores/analytics-store/analytics-store.test.d.ts +1 -0
  120. package/dist/types/src/stores/analytics-store/index.d.ts +9 -0
  121. package/dist/types/src/stores/map-store/controllers/camera.d.ts +27 -0
  122. package/dist/types/src/stores/map-store/controllers/directions.d.ts +17 -0
  123. package/dist/types/src/stores/map-store/controllers/hover.d.ts +25 -0
  124. package/dist/types/src/stores/map-store/controllers/labels.d.ts +16 -0
  125. package/dist/types/src/stores/map-store/controllers/map.d.ts +14 -0
  126. package/dist/types/src/stores/map-store/controllers/markers.d.ts +19 -0
  127. package/dist/types/src/stores/map-store/controllers/polygons.d.ts +17 -0
  128. package/dist/types/src/stores/map-store/index.d.ts +32 -0
  129. package/dist/types/src/stores/map-store/map-store.test.d.ts +1 -0
  130. package/dist/types/src/stores/root-store/index.d.ts +60 -0
  131. package/dist/types/src/stores/root-store/root-store.test.d.ts +1 -0
  132. package/dist/types/src/stores/router-store/index.d.ts +27 -0
  133. package/dist/types/src/stores/router-store/router-store.test.d.ts +1 -0
  134. package/dist/types/src/stores/ui-store/index.d.ts +49 -0
  135. package/dist/types/src/stores/ui-store/ui-store.test.d.ts +1 -0
  136. package/dist/types/src/test-utils/test-setup.d.ts +1 -0
  137. package/dist/types/src/theme.d.ts +3 -0
  138. package/package.json +23 -10
  139. package/tsconfig.build.json +4 -0
  140. package/dist/browser-42K2OAVV-5c10d96e.js +0 -1214
  141. package/dist/index-eb1e9c14.js +0 -72347
  142. package/dist/index.umd.cjs +0 -5116
  143. package/types/src/App.d.ts +0 -4
  144. package/types/src/hooks/useMapView.d.ts +0 -4
  145. package/types/src/hooks/useVenueMVF.d.ts +0 -4
  146. package/types/src/index.d.ts +0 -3
  147. package/types/src/types.d.ts +0 -4
  148. package/types/vite.config.d.ts +0 -2
  149. /package/dist/{Arrival-7GULGCVJ-80c3f73a.js → Arrival-QPP25QX7-80c3f73a.js} +0 -0
  150. /package/dist/{Chalet-4E7PX7WT-42db0054.js → Chalet-IPOAT24L-42db0054.js} +0 -0
  151. /package/dist/{HelveticaNeue-UEVLJKVU-fe724012.js → HelveticaNeue-KPKR5RFE-fe724012.js} +0 -0
  152. /package/dist/{Helvetiker-SNVJCSDR-166d1e4d.js → Helvetiker-UCLF3OSY-166d1e4d.js} +0 -0
  153. /package/dist/{Lato-FDCJ5GCG-c22f98b3.js → Lato-EVVL3OTB-c22f98b3.js} +0 -0
  154. /package/dist/{MyriadPro-NQ2DCXFB-4794df78.js → MyriadPro-ROUUJ4QH-4794df78.js} +0 -0
  155. /package/dist/{ProximaNova-MIBCMRZX-e1c5fad4.js → ProximaNova-QLMZHWWE-e1c5fad4.js} +0 -0
  156. /package/dist/{SimonCircular-B2HEOOJY-12a4d531.js → SimonCircular-POYFCICM-12a4d531.js} +0 -0
  157. /package/{types/src/globalStyles.d.ts → dist/types/src/components/common/global-styles.d.ts} +0 -0
  158. /package/{types/src/hooks/useMapView.test.d.ts → dist/types/src/components/hover/use-hover-element.test.d.ts} +0 -0
@@ -0,0 +1,18 @@
1
+ import { TTheme } from 'lib/types/theme';
2
+ import { DeepPartial } from './utils';
3
+ import type { hydrateVenueMVF } from '@mappedin/mappedin-js/get-venue';
4
+ type ParsedMVF = Parameters<typeof hydrateVenueMVF>[0];
5
+ export type TStartViewerCommonOptions = {
6
+ root?: HTMLElement;
7
+ themeOverride?: DeepPartial<TTheme>;
8
+ overrideShareButtonHandler?: () => void;
9
+ disableAnalytics?: boolean;
10
+ };
11
+ export type TStartViewerOptions = {
12
+ venue?: string;
13
+ dataUrl?: string;
14
+ } & TStartViewerCommonOptions;
15
+ export type TStartViewerWithLocalDataOptions = {
16
+ data: ParsedMVF;
17
+ } & TStartViewerCommonOptions;
18
+ export {};
@@ -0,0 +1,12 @@
1
+ export type TSearchResult = {
2
+ id: string;
3
+ label: string;
4
+ type: string;
5
+ floorName: string;
6
+ floorShortName?: string;
7
+ };
8
+ export type TCategory = {
9
+ id: string;
10
+ name: string;
11
+ results: TSearchResult[];
12
+ };
@@ -0,0 +1,4 @@
1
+ export declare enum E_APP_STATE {
2
+ START = "/",
3
+ DIRECTIONS = "/directions"
4
+ }
@@ -0,0 +1,35 @@
1
+ export type TTheme = {
2
+ colors: {
3
+ accent: {
4
+ primary: string;
5
+ neutral: string;
6
+ navigation: string;
7
+ success: string;
8
+ };
9
+ background: string;
10
+ text: {
11
+ primary: string;
12
+ secondary: string;
13
+ placeholder: string;
14
+ };
15
+ map: {
16
+ highlight: string;
17
+ departure: string;
18
+ path: string;
19
+ hover: string;
20
+ background: string;
21
+ };
22
+ };
23
+ font: string;
24
+ fontSize: {
25
+ small: number;
26
+ normal: number;
27
+ large: number;
28
+ };
29
+ map: {
30
+ minZoom: number;
31
+ pathSize: number;
32
+ streetMapVisible: boolean;
33
+ watermarkVisible: boolean;
34
+ };
35
+ };
@@ -0,0 +1,3 @@
1
+ export type DeepPartial<T> = T extends object ? {
2
+ [P in keyof T]?: DeepPartial<T[P]>;
3
+ } : T;
@@ -0,0 +1,3 @@
1
+ export declare const hexToRGB: (hex: string) => [number, number, number];
2
+ export declare const RGBToHex: (color: [number, number, number]) => string;
3
+ export declare const mixColors: (color1: string, color2: string, ratio: number) => string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare const clamp: (value: any, min: any, max: any) => number;
@@ -0,0 +1 @@
1
+ export declare const getFilteredSearchResults: <T extends Record<string, string>>(searchQuery: string, searchResults: T[], showAllResultsByDefault?: boolean) => T[];
@@ -0,0 +1,7 @@
1
+ export declare const tryConvertToUrl: (source: string) => URL | null;
2
+ export declare enum FindVenueError {
3
+ InvalidUrl = 0,
4
+ MissingVenueId = 1,
5
+ InvalidVenueId = 2
6
+ }
7
+ export declare const findVenueId: (source?: Location | string) => string | FindVenueError;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ declare const Start: (() => import("react").JSX.Element) & {
3
+ displayName: string;
4
+ };
5
+ export default Start;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ type TLoadingProps = {
3
+ visible?: boolean;
4
+ };
5
+ declare const Loading: React.FC<TLoadingProps>;
6
+ export default Loading;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const Map: React.FC;
3
+ export default Map;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const NotFound: React.FC;
3
+ export default NotFound;
@@ -0,0 +1,9 @@
1
+ import type RootStore from '../root-store';
2
+ declare class AnalyticsStore {
3
+ private rootStore;
4
+ constructor({ rootStore }: {
5
+ rootStore: RootStore;
6
+ });
7
+ init(): void;
8
+ }
9
+ export default AnalyticsStore;
@@ -0,0 +1,27 @@
1
+ import type RootStore from '../../root-store';
2
+ import type MapStore from '..';
3
+ import { MapView, TCameraAnimationOptions } from '@mappedin/mappedin-js';
4
+ export declare const ZOOM_FACTOR = 1.5;
5
+ export declare const TILT_FACTOR = 0.025;
6
+ export declare const CAMERA_ANIMATION_OPTIONS: TCameraAnimationOptions;
7
+ declare class CameraController {
8
+ private rootStore;
9
+ private mapStore;
10
+ private reactionDisposers;
11
+ private firstLoad;
12
+ constructor({ rootStore, mapStore }: {
13
+ rootStore: RootStore;
14
+ mapStore: MapStore;
15
+ });
16
+ focusOn(targets: Parameters<MapView['Camera']['focusOn']>[0], options?: Parameters<MapView['Camera']['focusOn']>[1]): Promise<void>;
17
+ zoomIn(): Promise<void>;
18
+ zoomOut(): Promise<void>;
19
+ zoomAll(): Promise<void>;
20
+ tiltCamera({ x, y }: {
21
+ x: number;
22
+ y: number;
23
+ }): void;
24
+ updateCamera(): void;
25
+ cleanup(): void;
26
+ }
27
+ export default CameraController;
@@ -0,0 +1,17 @@
1
+ /// <reference types="@mappedin/mappedin-js" />
2
+ import type RootStore from '../../root-store';
3
+ import type MapStore from '..';
4
+ declare class DirectionsController {
5
+ private rootStore;
6
+ private mapStore;
7
+ private reactionDisposers;
8
+ constructor({ rootStore, mapStore }: {
9
+ rootStore: RootStore;
10
+ mapStore: MapStore;
11
+ });
12
+ private updateJourney;
13
+ get mapsInDirections(): import("@mappedin/mappedin-js").MappedinMap[];
14
+ get directions(): import("@mappedin/mappedin-js").MappedinDirections | undefined;
15
+ cleanup(): void;
16
+ }
17
+ export default DirectionsController;
@@ -0,0 +1,25 @@
1
+ import MapStore from '..';
2
+ import RootStore from '../../root-store';
3
+ import { MappedinMap } from '@mappedin/mappedin-js';
4
+ declare class HoverController {
5
+ private rootStore;
6
+ private mapStore;
7
+ private reactionDisposers;
8
+ cursorPosition: {
9
+ x: number;
10
+ y: number;
11
+ } | undefined;
12
+ private isPinHoveringOverPolygons;
13
+ constructor({ rootStore, mapStore }: {
14
+ rootStore: RootStore;
15
+ mapStore: MapStore;
16
+ });
17
+ private attachListener;
18
+ private handleContainerMouseMove;
19
+ private getPolygonsUnderHoverPin;
20
+ get droppedPinHoverVisible(): boolean;
21
+ canDropPinNow(): boolean;
22
+ dropPinOnMap(map: MappedinMap): void;
23
+ cleanup(): void;
24
+ }
25
+ export default HoverController;
@@ -0,0 +1,16 @@
1
+ import type MapStore from '..';
2
+ import type RootStore from '../../root-store';
3
+ declare class LabelsController {
4
+ private rootStore;
5
+ private mapStore;
6
+ private reactionDisposers;
7
+ constructor({ rootStore, mapStore }: {
8
+ rootStore: RootStore;
9
+ mapStore: MapStore;
10
+ });
11
+ private labelLocationsOfCategory;
12
+ updateLabels(): void;
13
+ updateLabelPriorities(): void;
14
+ cleanup(): void;
15
+ }
16
+ export default LabelsController;
@@ -0,0 +1,14 @@
1
+ import type MapStore from '..';
2
+ import type RootStore from '../../root-store';
3
+ declare class MapsController {
4
+ private rootStore;
5
+ private mapStore;
6
+ private reactionDisposers;
7
+ constructor({ rootStore, mapStore }: {
8
+ rootStore: RootStore;
9
+ mapStore: MapStore;
10
+ });
11
+ private updateCurrentMap;
12
+ cleanup(): void;
13
+ }
14
+ export default MapsController;
@@ -0,0 +1,19 @@
1
+ import type RootStore from '../../root-store';
2
+ import type MapStore from '..';
3
+ declare class MarkersController {
4
+ private rootStore;
5
+ private mapStore;
6
+ private reactionDisposers;
7
+ constructor({ rootStore, mapStore }: {
8
+ rootStore: RootStore;
9
+ mapStore: MapStore;
10
+ });
11
+ private isVortexAction;
12
+ private getActionDirection;
13
+ private get connectionMarkers();
14
+ private get directionsConnectionMarkers();
15
+ private get markers();
16
+ private updateMarkers;
17
+ cleanup(): void;
18
+ }
19
+ export default MarkersController;
@@ -0,0 +1,17 @@
1
+ import type MapStore from '..';
2
+ import RootStore from '../../root-store';
3
+ declare class PolygonsController {
4
+ private rootStore;
5
+ private mapStore;
6
+ private reactionDisposers;
7
+ constructor({ rootStore, mapStore }: {
8
+ rootStore: RootStore;
9
+ mapStore: MapStore;
10
+ });
11
+ private get highlightedPolygons();
12
+ private makeLocationsOfCategoryInteractive;
13
+ private updateInteractivePolygons;
14
+ private updateHighlightedPolygons;
15
+ cleanup(): void;
16
+ }
17
+ export default PolygonsController;
@@ -0,0 +1,32 @@
1
+ import type RootStore from '../root-store';
2
+ import { E_SDK_EVENT, E_SDK_EVENT_PAYLOAD, MapView } from '@mappedin/mappedin-js';
3
+ import MarkersReaction from './controllers/markers';
4
+ import { E_MAP_INTERACTION_MODE } from '../../lib/types/map';
5
+ import PolygonsController from './controllers/polygons';
6
+ import DirectionsController from './controllers/directions';
7
+ import CameraController from './controllers/camera';
8
+ import MapsController from './controllers/map';
9
+ import LabelsController from './controllers/labels';
10
+ import HoverController from './controllers/hover';
11
+ declare class MapStore {
12
+ readonly interactiveLocationCategories: string[];
13
+ private rootStore;
14
+ container: HTMLElement | null;
15
+ mapView: MapView | null;
16
+ markers: MarkersReaction;
17
+ polygons: PolygonsController;
18
+ directions: DirectionsController;
19
+ camera: CameraController;
20
+ maps: MapsController;
21
+ labels: LabelsController;
22
+ hover: HoverController;
23
+ constructor({ rootStore }: {
24
+ rootStore: RootStore;
25
+ });
26
+ private handlePolygonsClicked;
27
+ get interactionMode(): E_MAP_INTERACTION_MODE;
28
+ init(container: HTMLElement): Promise<void>;
29
+ handleMapClick({ polygons }: E_SDK_EVENT_PAYLOAD[E_SDK_EVENT.CLICK]): void;
30
+ cleanup(): void;
31
+ }
32
+ export default MapStore;
@@ -0,0 +1,60 @@
1
+ /// <reference types="react" />
2
+ import { Mappedin, MappedinCoordinate, MappedinLocation, MappedinMap, MappedinPolygon } from '@mappedin/mappedin-js';
3
+ import UIStore from '../ui-store';
4
+ import MapStore from '../map-store';
5
+ import { E_DEPARTURE_MODE } from '../../lib/types/directions';
6
+ import { E_APP_STATE } from '../../lib/types/state';
7
+ import RouterStore from '../router-store';
8
+ import { ParsedMVF } from '@mappedin/mvf';
9
+ import AnalyticsStore from '../analytics-store';
10
+ import { TStartViewerOptions, TStartViewerWithLocalDataOptions } from '../../lib/types/options';
11
+ export declare const RootStoreContext: import("react").Context<RootStore>;
12
+ declare class RootStore {
13
+ private reactionDisposers;
14
+ private currentMapId;
15
+ /**
16
+ * This should not be exposed outside the root store. Root store observables, derived from the router
17
+ * should be the source of truth for the rest of the application.
18
+ */
19
+ private routerStore;
20
+ readonly data: Mappedin;
21
+ private startupOptions;
22
+ /**
23
+ * This is only populated if the viewer is hydrated with local data (i.e. in Maker's preview).
24
+ */
25
+ __mvfData: ParsedMVF | undefined;
26
+ uiStore: UIStore;
27
+ mapStore: MapStore;
28
+ analyticsStore: AnalyticsStore;
29
+ departureMode: E_DEPARTURE_MODE;
30
+ constructor({ router, data, startupOptions, }: {
31
+ router: RouterStore;
32
+ data: Mappedin;
33
+ startupOptions: TStartViewerOptions | TStartViewerWithLocalDataOptions;
34
+ });
35
+ private getInitialDepartureMode;
36
+ private serializeCoordinate;
37
+ private deserializeCoordinate;
38
+ private syncState;
39
+ private syncCurrentMap;
40
+ get __mvfFeaturesByExternalId(): Record<string, import("@mappedin/mvf").Feature<import("@mappedin/mvf").Polygon | import("@mappedin/mvf").LineString | import("@mappedin/mvf").Point, import("@mappedin/mvf").SpaceProperties> | import("@mappedin/mvf").Feature<import("@mappedin/mvf").Polygon | import("@mappedin/mvf").LineString, import("@mappedin/mvf").ObstructionProperties>>;
41
+ get areNodesAvailable(): boolean;
42
+ get exteriorEntrancesLocation(): MappedinLocation | undefined;
43
+ get selectedLocation(): MappedinLocation | undefined;
44
+ get departure(): MappedinLocation | MappedinCoordinate | undefined;
45
+ get currentMap(): MappedinMap | undefined;
46
+ get interactivePolygons(): MappedinPolygon[];
47
+ private syncDeparture;
48
+ get isAppEmbedded(): boolean;
49
+ get state(): E_APP_STATE;
50
+ setState(state: E_APP_STATE): void;
51
+ isLocationOnMap(location: MappedinLocation, map: MappedinMap): boolean;
52
+ setSelectedLocationId(id: string | undefined): void;
53
+ clearDeparture(): void;
54
+ setDepartureLocationId(id: string): void;
55
+ setDepartureCoordinate(coordinate: MappedinCoordinate): void;
56
+ setCurrentMapId(id: string | undefined): void;
57
+ setDepartureMode(mode: E_DEPARTURE_MODE): void;
58
+ cleanup(): void;
59
+ }
60
+ export default RootStore;
@@ -0,0 +1,27 @@
1
+ import { History } from 'history';
2
+ export declare const EMBED_ROUTER_PARAM = "embedded";
3
+ type TRouterGoOptions = {
4
+ clearExistingParams?: boolean;
5
+ };
6
+ declare class RouterStore {
7
+ private base;
8
+ private path;
9
+ private params;
10
+ private history;
11
+ private disposer;
12
+ constructor({ history, base }: {
13
+ history: History;
14
+ base?: string;
15
+ });
16
+ private getParams;
17
+ private update;
18
+ private getPath;
19
+ get state(): {
20
+ path: string;
21
+ params: Record<string, string>;
22
+ };
23
+ go(state: string, newParams: Record<string, string | undefined>, options?: TRouterGoOptions): void;
24
+ back(): void;
25
+ cleanup(): void;
26
+ }
27
+ export default RouterStore;
@@ -0,0 +1,49 @@
1
+ import type RootStore from '../root-store';
2
+ import { TCategory, TSearchResult } from 'lib/types/search';
3
+ import { TLevelSelectorLevel } from '../../components/level-selector/utils';
4
+ import { TTheme } from 'lib/types/theme';
5
+ import { E_DEPARTURE_MODE } from '../../lib/types/directions';
6
+ declare class UIStore {
7
+ private rootStore;
8
+ private reactionDisposers;
9
+ theme: TTheme;
10
+ searchQuery: string;
11
+ departureSearchQuery: string;
12
+ overrideShareButtonHandler?: () => void;
13
+ constructor({ rootStore }: {
14
+ rootStore: RootStore;
15
+ });
16
+ private get searchableLocations();
17
+ private get searchResultsById();
18
+ private get searchCategoriesById();
19
+ private syncSearchQueryWithSelectedLocation;
20
+ private syncDepartureSearchQueryWithDepartureLocation;
21
+ get searchResults(): TSearchResult[];
22
+ get departureSearchResults(): TSearchResult[];
23
+ get searchCategories(): TCategory[];
24
+ get levels(): TLevelSelectorLevel[];
25
+ get levelSelectorVisible(): boolean;
26
+ get directionsButtonVisible(): boolean;
27
+ get directionsButtonDisabled(): boolean;
28
+ get directionsUIVisible(): boolean;
29
+ get directionsWarningVisible(): boolean;
30
+ get openAppLink(): string;
31
+ get openAppButtonVisible(): boolean;
32
+ get tiltControlsVisible(): boolean;
33
+ get shareButtonVisible(): boolean;
34
+ get mainUIVisible(): boolean;
35
+ get logoPosition(): "top-left" | "bottom-center";
36
+ get appPadding(): 12 | 20;
37
+ setTheme(theme: TTheme): void;
38
+ setOverrideShareButtonHandler(handler?: () => void): void;
39
+ setSearchQuery(query: string): void;
40
+ setDepartureSearchQuery(query: string): void;
41
+ handleMainUIBlur(): void;
42
+ handleSearchResultSelected(result: TSearchResult): void;
43
+ handleDepartureSearchResultSelected(result: TSearchResult): void;
44
+ handleLevelSelected(level: TLevelSelectorLevel): void;
45
+ handleDirectionsButtonClick(): void;
46
+ handleDepartureModeSelected(mode: E_DEPARTURE_MODE): void;
47
+ cleanup(): void;
48
+ }
49
+ export default UIStore;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { TTheme } from './lib/types/theme';
2
+ export declare const defaultTheme: TTheme;
3
+ export declare const defaultThemeEmbedded: TTheme;
package/package.json CHANGED
@@ -1,26 +1,28 @@
1
1
  {
2
2
  "name": "@mappedin/viewer",
3
- "version": "0.0.0-alpha",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "browser": "./dist/index.js",
6
6
  "license": "UNLICENSED",
7
7
  "exports": {
8
8
  ".": {
9
- "import": "./dist/index.js",
10
- "require": "./dist/index.umd.cjs",
11
- "types": "./types/src/index.d.ts"
9
+ "import": {
10
+ "types": "./dist/types/src/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ }
12
13
  }
13
14
  },
15
+ "types": "./dist/types/src/index.d.ts",
14
16
  "volta": {
15
17
  "extends": "../../package.json"
16
18
  },
17
19
  "dependencies": {
18
- "@mappedin/mappedin-js": "^5.16.1-fe0354d.0",
19
- "react": "^18.2.0",
20
- "react-dom": "^18.2.0",
21
- "styled-components": "^6.0.7"
20
+ "posthog-js": "^1.78.1"
22
21
  },
23
22
  "devDependencies": {
23
+ "@ladle/react": "^2.17.2",
24
+ "@mappedin/mappedin-js": "5.17.1-cef0746.0",
25
+ "@mappedin/mvf": "2.0.1-1bfe7ea.0",
24
26
  "@testing-library/react-hooks": "^8.0.1",
25
27
  "@types/react": "^18.2.15",
26
28
  "@types/react-dom": "^18.2.7",
@@ -32,17 +34,28 @@
32
34
  "eslint-plugin-react-hooks": "^4.6.0",
33
35
  "eslint-plugin-react-refresh": "^0.4.3",
34
36
  "happy-dom": "^10.9.0",
37
+ "history": "^5.3.0",
38
+ "i18next": "^23.4.4",
39
+ "lodash.merge": "^4.6.2",
40
+ "mobx": "^6.10.0",
41
+ "mobx-react-lite": "^4.0.3",
42
+ "react": "18.2.0",
43
+ "react-dom": "18.2.0",
44
+ "react-i18next": "^13.1.2",
45
+ "styled-components": "6.0.7",
35
46
  "typescript": "^5.0.2",
36
47
  "vite": "^4.4.5",
37
48
  "vite-plugin-css-injected-by-js": "^3.3.0",
49
+ "vite-plugin-mkcert": "^1.16.0",
38
50
  "vitest": "^0.34.1"
39
51
  },
40
52
  "scripts": {
41
53
  "dev": "vite",
42
- "build": "vite build && tsc",
54
+ "build": "vite build && tsc --project tsconfig.build.json",
43
55
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
44
56
  "preview": "vite preview",
45
- "test": "cross-env NODE_ENV=test vitest run",
57
+ "stories": "pnpm ladle serve",
58
+ "test": "cross-env NODE_ENV=test vitest run --allowOnly",
46
59
  "test:watch": "cross-env NODE_ENV=test vitest",
47
60
  "test:cover": "cross-env NODE_ENV=test vitest run --coverage"
48
61
  }
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "include": ["src"]
4
+ }