@mappedin/viewer 0.35.2-9c5b2e5.0 → 0.35.2-c86a413.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.
- package/dist/index.js +37064 -36470
- package/dist/types/src/components/collapsible/collapsible.stories.d.ts +2 -0
- package/dist/types/src/components/collapsible/index.d.ts +20 -0
- package/dist/types/src/components/metadata-card/utils.d.ts +5 -0
- package/dist/types/src/components/operation-hours/hours-list.d.ts +9 -0
- package/dist/types/src/components/operation-hours/index.d.ts +7 -0
- package/dist/types/src/components/operation-hours/open-status.d.ts +9 -0
- package/dist/types/src/components/operation-hours/operation-hours.stories.d.ts +4 -0
- package/dist/types/src/lib/sdk/types.d.ts +1 -0
- package/dist/types/src/lib/time/time.d.ts +2 -0
- package/dist/types/src/lib/types/theme.d.ts +2 -0
- package/dist/types/src/lib/utils/array-utils.d.ts +4 -0
- package/dist/types/src/lib/utils/data-utils.d.ts +13 -2
- package/dist/types/src/stores/map-store/controllers/camera.d.ts +2 -2
- package/dist/types/src/stores/root-store/index.d.ts +8 -1
- package/dist/types/src/stores/ui-store/index.d.ts +2 -0
- package/dist/types/src/test-utils/custom-matchers.test.d.ts +1 -0
- package/dist/types/src/test-utils/test-place-types.d.ts +43 -0
- package/dist/types/src/test-utils/test-place-types.test.d.ts +1 -0
- package/dist/types/src/test-utils/test-suite.d.ts +8 -1
- package/dist/types/src/test-utils/test-with-map.d.ts +2 -1
- package/package.json +2 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
type TCollapsibleProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Whether the content should be collapsible. If false, the full content will always be shown.
|
|
5
|
+
*/
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* The height of the collapsed content.
|
|
9
|
+
*/
|
|
10
|
+
collapsedHeight?: number;
|
|
11
|
+
/**
|
|
12
|
+
* The maximum height of the content when expanded. If the content is shorter than this, it will only
|
|
13
|
+
* expand as much as needed. If the content is taller, it will scroll. If undefined, the content will
|
|
14
|
+
* expand to its natural height.
|
|
15
|
+
*/
|
|
16
|
+
maxHeight?: number | string;
|
|
17
|
+
style?: React.CSSProperties;
|
|
18
|
+
};
|
|
19
|
+
declare const Collapsible: React.FC<PropsWithChildren<TCollapsibleProps>>;
|
|
20
|
+
export default Collapsible;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ComponentProps } from 'react';
|
|
2
2
|
import { TOnClickOrPressPayload } from '../button';
|
|
3
3
|
import SocialsItem from '../socials-item';
|
|
4
|
+
import OpeningHours from '../../lib/time/opening-hours';
|
|
4
5
|
export declare const METADATA_CARD_WIDTH = 320;
|
|
5
6
|
export declare const METADATA_CARD_PADDING = 20;
|
|
6
7
|
export declare const HERO_IMAGE_HEIGHT = 200;
|
|
@@ -50,6 +51,10 @@ export type TMetadataCardProps = {
|
|
|
50
51
|
id: string;
|
|
51
52
|
name: string;
|
|
52
53
|
}[];
|
|
54
|
+
/**
|
|
55
|
+
* Opening hours to show in the card.
|
|
56
|
+
*/
|
|
57
|
+
hours?: OpeningHours;
|
|
53
58
|
/**
|
|
54
59
|
* URL to show on a button just above the directions button.
|
|
55
60
|
*/
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import OpeningHours from '../../lib/time/opening-hours';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export declare const HOURS_LIST_HEIGHT = 24;
|
|
4
|
+
type THoursListProps = {
|
|
5
|
+
hours: OpeningHours;
|
|
6
|
+
date?: Date;
|
|
7
|
+
};
|
|
8
|
+
declare const HoursList: React.FC<THoursListProps>;
|
|
9
|
+
export default HoursList;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import OpeningHours from '../../lib/time/opening-hours';
|
|
2
|
+
type TOpenStatusProps = {
|
|
3
|
+
hours: OpeningHours;
|
|
4
|
+
onClick?: () => void;
|
|
5
|
+
chevron?: 'right' | 'down';
|
|
6
|
+
date?: Date;
|
|
7
|
+
};
|
|
8
|
+
declare const OpenStatus: React.FC<TOpenStatusProps>;
|
|
9
|
+
export default OpenStatus;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Space, MapObject, PointOfInterest, Connection, Annotation, Coordinate, Door, CameraTransform as _CameraTransform, TEventPayload as _TEventPayload, TEvents } from './mappedin-js';
|
|
2
2
|
export declare const PLACE_TYPES: (typeof Space | typeof PointOfInterest | typeof Connection | typeof MapObject | typeof Door | typeof Coordinate | typeof Annotation)[];
|
|
3
3
|
export declare const PLACE_TYPE_STRINGS: ("annotation" | "space" | "point-of-interest" | "connection" | "object" | "door" | "coordinate")[];
|
|
4
|
+
export type PlaceTypeString = (typeof PLACE_TYPE_STRINGS)[number];
|
|
4
5
|
export type PlaceType = (typeof PLACE_TYPES)[number];
|
|
5
6
|
export type Place = InstanceType<PlaceType>;
|
|
6
7
|
export declare const GEOMETRY_TYPES: (typeof Space | typeof MapObject)[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
declare const customInspectSymbol: unique symbol;
|
|
1
2
|
/**
|
|
2
3
|
* A time in minutes and hours, without a date.
|
|
3
4
|
*/
|
|
@@ -19,6 +20,7 @@ declare class Time {
|
|
|
19
20
|
* Get the minutes of this time.
|
|
20
21
|
*/
|
|
21
22
|
get minutes(): number;
|
|
23
|
+
[customInspectSymbol](): string;
|
|
22
24
|
/**
|
|
23
25
|
* Returns true if this time is midnight. This can be either 00:00 or 24:00.
|
|
24
26
|
*/
|
|
@@ -37,6 +37,7 @@ export type TTheme = {
|
|
|
37
37
|
inverted: string;
|
|
38
38
|
link: string;
|
|
39
39
|
error: string;
|
|
40
|
+
error2: string;
|
|
40
41
|
};
|
|
41
42
|
map: {
|
|
42
43
|
labels: {
|
|
@@ -81,6 +82,7 @@ export type TTheme = {
|
|
|
81
82
|
normal: number;
|
|
82
83
|
large: number;
|
|
83
84
|
xlarge: number;
|
|
85
|
+
title: number;
|
|
84
86
|
};
|
|
85
87
|
fontWeight: {
|
|
86
88
|
light: number;
|
|
@@ -13,4 +13,8 @@ export declare const isLength: <L extends number, T>(arr: T[], length: L) => arr
|
|
|
13
13
|
* Utility function to typecheck if an array has a specific length or more.
|
|
14
14
|
*/
|
|
15
15
|
export declare const isAtLeastLength: <L extends number, T>(arr: T[], length: L) => arr is ArrayWithAtLeastLength<L, T>;
|
|
16
|
+
/**
|
|
17
|
+
* Small utility to avoid needing to write `arr.filter((item) => !exclude.includes(item))` everywhere.
|
|
18
|
+
*/
|
|
19
|
+
export declare const exclude: <T>(arr: T[], exclude: T[]) => T[];
|
|
16
20
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Annotation, Place, TNavigationTarget } from '../sdk';
|
|
1
|
+
import { Annotation, Place, TNavigationTarget, Floor } from '../sdk';
|
|
2
2
|
/**
|
|
3
3
|
* Whether the location can be assumed to be a washroom
|
|
4
4
|
*/
|
|
@@ -7,11 +7,18 @@ export declare const isWashroom: (place: Place) => boolean;
|
|
|
7
7
|
* Whether the location can be assumed to be a parking spot
|
|
8
8
|
*/
|
|
9
9
|
export declare const isParking: (place: Place) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the location has a name
|
|
12
|
+
*/
|
|
13
|
+
export declare const hasName: (place: Place) => boolean;
|
|
10
14
|
/**
|
|
11
15
|
* Whether the location has any metadata other than name
|
|
12
|
-
* @returns
|
|
13
16
|
*/
|
|
14
17
|
export declare const hasMetaData: (place: Place) => boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the location has a name or any other metadata
|
|
20
|
+
*/
|
|
21
|
+
export declare const hasNameOrMetaData: (place: Place) => boolean;
|
|
15
22
|
export declare const getCategoryName: (place: Place) => string;
|
|
16
23
|
export declare const getAnnotationName: (annotation: Annotation) => string;
|
|
17
24
|
export type TGetDisplayNameForPlaceOptions = {
|
|
@@ -39,3 +46,7 @@ export declare const isValidPlace: (place: Place) => boolean;
|
|
|
39
46
|
export declare const getNavigationTargetForPlaces: (places: Place[]) => TNavigationTarget | TNavigationTarget[];
|
|
40
47
|
export declare const getSearchIdForPlace: (place: Place) => string | undefined;
|
|
41
48
|
export declare const getCategoryIdForPlace: (place: Place) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Check if a place is on a floor.
|
|
51
|
+
*/
|
|
52
|
+
export declare const isOnFloor: (place: Place, floor: Floor | string | undefined) => boolean;
|
|
@@ -22,8 +22,7 @@ declare class CameraController {
|
|
|
22
22
|
private cameraChangeTimeout;
|
|
23
23
|
private cameraMovingStartTime;
|
|
24
24
|
/**
|
|
25
|
-
* The camera
|
|
26
|
-
* enough for most purposes
|
|
25
|
+
* The camera transform that shows the map in it's default state.
|
|
27
26
|
*/
|
|
28
27
|
private defaultCameraByFloorId;
|
|
29
28
|
/**
|
|
@@ -41,6 +40,7 @@ declare class CameraController {
|
|
|
41
40
|
rootStore: RootStore;
|
|
42
41
|
mapStore: MapStore;
|
|
43
42
|
});
|
|
43
|
+
private updateDefaultCameraForCurrentFloor;
|
|
44
44
|
private getPadding;
|
|
45
45
|
private getCoordinateFromScreenCenter;
|
|
46
46
|
private handleKeyDown;
|
|
@@ -104,7 +104,15 @@ declare class RootStore {
|
|
|
104
104
|
get isAccessible(): boolean;
|
|
105
105
|
get isSafetyModeEnabled(): boolean;
|
|
106
106
|
get isOutdoorsVisible(): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* The initial pitch from the router params. To get the initial pitch with defaults from the theme,
|
|
109
|
+
* use {@link UIStore.theme.map.initialPitch}.
|
|
110
|
+
*/
|
|
107
111
|
get initialPitch(): number | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* The initial bearing from the router params or MVF. To get the initial bearing with defaults from
|
|
114
|
+
* the theme, use {@link UIStore.theme.map.initialBearing}.
|
|
115
|
+
*/
|
|
108
116
|
get initialBearing(): number | undefined;
|
|
109
117
|
get exteriorDoors(): {
|
|
110
118
|
"__#15@#private": any;
|
|
@@ -191,7 +199,6 @@ declare class RootStore {
|
|
|
191
199
|
}>): Coordinate | undefined;
|
|
192
200
|
setYouAreHere(coordinate: Coordinate | undefined): void;
|
|
193
201
|
setState(state: E_APP_STATE): void;
|
|
194
|
-
isPlaceOnFloor(place: Place, floor: Floor | undefined): boolean;
|
|
195
202
|
setSelectedPlaces(places: Place[] | undefined | typeof YOU_ARE_HERE_ROUTER_PARAM): void;
|
|
196
203
|
/**
|
|
197
204
|
* Only use this from within the editor preview.
|
|
@@ -58,6 +58,7 @@ declare class UIStore {
|
|
|
58
58
|
inverted: string;
|
|
59
59
|
link: string;
|
|
60
60
|
error: string;
|
|
61
|
+
error2: string;
|
|
61
62
|
}>;
|
|
62
63
|
map: Partial<{
|
|
63
64
|
labels: Partial<{
|
|
@@ -102,6 +103,7 @@ declare class UIStore {
|
|
|
102
103
|
normal: number;
|
|
103
104
|
large: number;
|
|
104
105
|
xlarge: number;
|
|
106
|
+
title: number;
|
|
105
107
|
}>;
|
|
106
108
|
fontWeight: Partial<{
|
|
107
109
|
light: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Place, PlaceTypeString } from '../lib/sdk';
|
|
2
|
+
import { TMapViewWithTestUtilities } from './test-mocks';
|
|
3
|
+
import { testWithMap, TTestWithMapOptions } from './test-with-map';
|
|
4
|
+
type TTestPlaceTypeCallback<P extends Place = Place> = (test: Awaited<ReturnType<typeof testWithMap<TMapViewWithTestUtilities>>>, places: P[], type: PlaceTypeString) => void;
|
|
5
|
+
/**
|
|
6
|
+
* Options for testing all place types.
|
|
7
|
+
*/
|
|
8
|
+
type TTestPlaceTypeOptions = Partial<{
|
|
9
|
+
/**
|
|
10
|
+
* The name of the fixture to use for the test.
|
|
11
|
+
*/
|
|
12
|
+
fixture: string;
|
|
13
|
+
/**
|
|
14
|
+
* Options to pass to {@link testWithMap}.
|
|
15
|
+
*/
|
|
16
|
+
testWithMapOptions: TTestWithMapOptions | ((type: PlaceTypeString) => TTestWithMapOptions);
|
|
17
|
+
/**
|
|
18
|
+
* Limit the test for places on the current floor.
|
|
19
|
+
*/
|
|
20
|
+
limitPlacesToCurrentFloor: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* By default, the callback will be passed all places of a given type. Specify a predicate to
|
|
23
|
+
* filter the places to test.
|
|
24
|
+
*/
|
|
25
|
+
predicate: (place: Place) => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* If specified, the test will only be run for the given types. This overrides {@link exclude}.
|
|
28
|
+
*/
|
|
29
|
+
only: PlaceTypeString[];
|
|
30
|
+
/**
|
|
31
|
+
* If specified, the test will not be run for the given types. This is overridden by {@link only}.
|
|
32
|
+
*/
|
|
33
|
+
exclude: PlaceTypeString[];
|
|
34
|
+
}>;
|
|
35
|
+
export declare const runTest: <P extends Place = Place>(type: PlaceTypeString, cb: TTestPlaceTypeCallback<P>, options?: TTestPlaceTypeOptions) => Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Run a test suite by executing a test function for all types that a {@link Place} could be.
|
|
38
|
+
*/
|
|
39
|
+
declare const testPlaceTypes: {
|
|
40
|
+
<P extends Place = Place>(name: string, cb: TTestPlaceTypeCallback<P>, options?: TTestPlaceTypeOptions): void;
|
|
41
|
+
only: <P extends Place = Place>(name: string, cb: TTestPlaceTypeCallback<P>, options?: TTestPlaceTypeOptions) => void;
|
|
42
|
+
};
|
|
43
|
+
export default testPlaceTypes;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -10,9 +10,16 @@ export type TTestCase<Given, Expected> = [string, readonly TTestCondition<Given,
|
|
|
10
10
|
* A suite of {@link TTestCase}s.
|
|
11
11
|
*/
|
|
12
12
|
export type TTestSuite<Given, Expected> = readonly TTestCase<Given, Expected>[];
|
|
13
|
+
/**
|
|
14
|
+
* A callback for running tests in a {@link TTestSuite}.
|
|
15
|
+
*/
|
|
16
|
+
export type TTestSuiteCallback<Given, Expected> = (testName: string, value: TTestCondition<Given, Expected>) => void;
|
|
13
17
|
/**
|
|
14
18
|
* Run a callback with tests for each {@link TTestCase} in a {@link TTestSuite}. This is useful for
|
|
15
19
|
* running many tests with the same exact format, where the input and output can be easily abstracted.
|
|
16
20
|
*/
|
|
17
|
-
declare const testSuite:
|
|
21
|
+
declare const testSuite: {
|
|
22
|
+
<Given, Expected>(name: string, config: TTestSuite<Given, Expected>, cb: TTestSuiteCallback<Given, Expected>): void;
|
|
23
|
+
only: <Given, Expected>(name: string, config: TTestSuite<Given, Expected>, cb: TTestSuiteCallback<Given, Expected>) => void;
|
|
24
|
+
};
|
|
18
25
|
export default testSuite;
|
|
@@ -5,7 +5,7 @@ import { MapData } from '../lib/sdk';
|
|
|
5
5
|
import { TStartViewerOptions, TStartViewerWithLocalDataOptions } from '../lib/types/options';
|
|
6
6
|
import { TMapViewWithTestUtilities } from './test-mocks';
|
|
7
7
|
export declare const loadTestVenueData: (venueFileName?: string) => Promise<ParsedMVF>;
|
|
8
|
-
type TTestWithMapOptions = {
|
|
8
|
+
export type TTestWithMapOptions = {
|
|
9
9
|
startupOptions?: TStartViewerOptions | TStartViewerWithLocalDataOptions;
|
|
10
10
|
initialState?: string | ((data: MapData, mvf: ParsedMVF) => string);
|
|
11
11
|
isMobile?: boolean;
|
|
@@ -24,6 +24,7 @@ type TTestWithMapResult<MV = TMapViewWithTestUtilities> = {
|
|
|
24
24
|
waitForMapInitialized: () => Promise<void>;
|
|
25
25
|
waitForCameraSettled: () => Promise<void>;
|
|
26
26
|
setNextCameraState: TMapViewWithTestUtilities['__test']['setNextCameraState'];
|
|
27
|
+
waitForPinDrop: () => Promise<void>;
|
|
27
28
|
};
|
|
28
29
|
export declare const testWithMap: <MV = TMapViewWithTestUtilities>(venueFileName?: string, options?: TTestWithMapOptions) => Promise<TTestWithMapResult<MV>>;
|
|
29
30
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mappedin/viewer",
|
|
3
|
-
"version": "0.35.2-
|
|
3
|
+
"version": "0.35.2-c86a413.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"browser": "./dist/index.js",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@ladle/react": "^2.17.2",
|
|
21
|
-
"@mappedin/mappedin-js": "6.0.1-beta.
|
|
21
|
+
"@mappedin/mappedin-js": "6.0.1-beta.31",
|
|
22
22
|
"@mappedin/mvf": "2.0.1-a2db810.0",
|
|
23
23
|
"@mappedin/self-serve-icons": "1.70.1-alpha.bl-SRV-2032.1739993160",
|
|
24
24
|
"@testing-library/jest-dom": "^6.6.2",
|