@mappedin/blue-dot 6.0.1-beta.55 → 6.0.1-beta.57

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.
@@ -0,0 +1,194 @@
1
+ import type { Coordinate, Floor } from '@mappedin/mappedin-js';
2
+ import type { EasingCurve } from '../../packages/common';
3
+ export type FollowMode =
4
+ /** Camera position follows the Blue Dot's position. */
5
+ 'position-only'
6
+ /** Camera position follows the Blue Dot's position. Camera bearing matches the Blue Dot's heading. */
7
+ | 'position-and-heading'
8
+ /** Camera position follows the Blue Dot's position. Camera bearing is calculated based on the Navigation path. */
9
+ | 'position-and-path-direction'
10
+ /** Disables follow mode */
11
+ | false;
12
+ export type FollowCameraOptions = {
13
+ /**
14
+ * @default 21
15
+ */
16
+ zoomLevel?: number;
17
+ /**
18
+ * @default 45
19
+ */
20
+ pitch?: number;
21
+ /**
22
+ * Camera bearing in degrees clockwise from North. 0 is North, 90 is East, 180 is South, 270 is West.
23
+ * This option is only available in 'position-only' mode. In all other modes, the bearing will be calculated automatically.
24
+ * @default undefined
25
+ */
26
+ bearing?: number;
27
+ /**
28
+ * @default undefined
29
+ */
30
+ elevation?: number;
31
+ /**
32
+ * @default 1000
33
+ */
34
+ duration?: number;
35
+ /**
36
+ * @default 'ease-in-out'
37
+ */
38
+ easing?: EasingCurve;
39
+ };
40
+ export type BlueDotEventPayloads = {
41
+ /**
42
+ * Emitted when the Blue Dot's position is updated.
43
+ */
44
+ 'position-update': {
45
+ floor: Floor | undefined;
46
+ heading: GeolocationPosition['coords']['heading'] | undefined;
47
+ accuracy: GeolocationPosition['coords']['accuracy'] | undefined;
48
+ coordinate: Coordinate;
49
+ };
50
+ /**
51
+ * Emitted when the Blue Dot's state changes.
52
+ */
53
+ 'state-change': {
54
+ /**
55
+ * The new state of the Blue Dot.
56
+ */
57
+ state: BlueDotState;
58
+ /**
59
+ * The action that caused the state change.
60
+ */
61
+ action: BlueDotAction;
62
+ };
63
+ /**
64
+ * Emitted when the Blue Dot encounters an error.
65
+ */
66
+ error: GeolocationPositionError;
67
+ /**
68
+ * Emitted when the Blue Dot's following state changes.
69
+ */
70
+ 'follow-change': {
71
+ /**
72
+ * Whether the Blue Dot is following the user.
73
+ */
74
+ following: boolean;
75
+ /**
76
+ * The mode the Blue Dot is following the user in.
77
+ */
78
+ mode?: FollowMode;
79
+ };
80
+ /**
81
+ * Emitted when the user clicks on the Blue Dot.
82
+ */
83
+ click: {
84
+ coordinate: Coordinate;
85
+ };
86
+ /**
87
+ * Emitted when the user hovers over the Blue Dot.
88
+ */
89
+ hover: undefined;
90
+ };
91
+ export type BlueDotEvents = keyof BlueDotEventPayloads;
92
+ export type BlueDotState = 'hidden' | 'active' | 'inactive' | 'disabled';
93
+ export type BlueDotAction = 'timeout' | 'error' | 'position-update' | 'enable' | 'disable' | 'initialize';
94
+ export type BlueDotOptions = {
95
+ /**
96
+ * The radius of the BlueDot in pixels. The BlueDot will maintain this size clamped to a minimum of 0.35 metres.
97
+ * @default 10
98
+ */
99
+ radius?: number;
100
+ /**
101
+ * The color of the BlueDot core element.
102
+ * @default #2266ff
103
+ */
104
+ color?: string;
105
+ /**
106
+ * The color of the BlueDot when it has timed out and gone inactive.
107
+ * @default #808080
108
+ */
109
+ inactiveColor?: string;
110
+ /**
111
+ * Options for the accuracy ring around the BlueDot.
112
+ */
113
+ accuracyRing?: {
114
+ /**
115
+ * The color of the accuracy ring.
116
+ * @default #2266ff
117
+ */
118
+ color?: string;
119
+ /**
120
+ * The opacity of the accuracy ring.
121
+ * @default 0.3
122
+ */
123
+ opacity?: number;
124
+ };
125
+ /**
126
+ * Options for the heading directional indicator.
127
+ */
128
+ heading?: {
129
+ /**
130
+ * The color of the heading cone.
131
+ * @default #2266ff
132
+ */
133
+ color?: string;
134
+ /**
135
+ * The opacity of the heading cone.
136
+ * @default 0.7
137
+ */
138
+ opacity?: number;
139
+ };
140
+ /**
141
+ * The duration of the timeout in milliseconds.
142
+ * If the BlueDot does not receive a position update within this time, it will grey out until a position is received.
143
+ * @default 30000
144
+ */
145
+ timeout?: number;
146
+ /**
147
+ * Whether to watch the device's position.
148
+ * @default true
149
+ */
150
+ watchDevicePosition?: boolean;
151
+ /**
152
+ * Whether to log debug messages.
153
+ * @default false
154
+ */
155
+ debug?: boolean;
156
+ /**
157
+ * The maximum acceptable accuracy in meters. Position updates with accuracy exceeding this value will be dropped.
158
+ * @default 50
159
+ */
160
+ accuracyThreshold?: number;
161
+ };
162
+ /**
163
+ * Position update options for the {@link BlueDot.update} method.
164
+ */
165
+ export type BlueDotPositionUpdate = {
166
+ /**
167
+ * Latitude to override.
168
+ * Set to `'device'` to reset to the device's latitude.
169
+ */
170
+ latitude?: GeolocationPosition['coords']['latitude'] | 'device' | undefined;
171
+ /**
172
+ * Longitude to override.
173
+ * Set to `'device'` to reset to the device's longitude.
174
+ */
175
+ longitude?: GeolocationPosition['coords']['longitude'] | 'device' | undefined;
176
+ /**
177
+ * Accuracy to override.
178
+ * Set to `'device'` to reset to the device's accuracy.
179
+ * Set to `undefined` to disable the accuracy ring.
180
+ */
181
+ accuracy?: GeolocationPosition['coords']['accuracy'] | 'device' | undefined;
182
+ /**
183
+ * Heading to override.
184
+ * Set to `'device'` to reset to the device's heading.
185
+ * Set to `undefined` to disable the heading indicator.
186
+ */
187
+ heading?: GeolocationPosition['coords']['heading'] | 'device' | undefined;
188
+ /**
189
+ * Floor or floorId to override.
190
+ * Set to `'device'` to reset to the device's floor level.
191
+ * Set to `undefined` to disable floor level and show the BlueDot on all floors.
192
+ */
193
+ floorOrFloorId?: Floor | string | 'device' | undefined;
194
+ };
package/package.json CHANGED
@@ -1,12 +1,31 @@
1
1
  {
2
2
  "name": "@mappedin/blue-dot",
3
- "version": "6.0.1-beta.55",
3
+ "version": "6.0.1-beta.57",
4
4
  "homepage": "https://developer.mappedin.com/",
5
5
  "private": false,
6
6
  "main": "lib/esm/index.js",
7
7
  "module": "lib/esm/index.js",
8
8
  "browser": "lib/esm/index.js",
9
9
  "types": "lib/esm/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "import": "./lib/esm/index.js",
13
+ "require": "./lib/esm/index.js",
14
+ "types": "./lib/esm/index.d.ts"
15
+ },
16
+ "./rn": {
17
+ "import": "./lib/rn/index-rn.js",
18
+ "require": "./lib/rn/index-rn.js",
19
+ "types": "./lib/rn/index-rn.d.ts"
20
+ }
21
+ },
22
+ "typesVersions": {
23
+ "*": {
24
+ "rn": [
25
+ "lib/rn/index-rn.d.ts"
26
+ ]
27
+ }
28
+ },
10
29
  "files": [
11
30
  "lib",
12
31
  "README.md",
@@ -14,21 +33,35 @@
14
33
  "THIRD_PARTY_LICENSES.txt"
15
34
  ],
16
35
  "license": "SEE LICENSE IN LICENSE.txt",
36
+ "dependencies": {},
37
+ "peerDependencies": {
38
+ "react": ">=16.8.0",
39
+ "@mappedin/mappedin-js": "^6.0.0-rc.4",
40
+ "@mappedin/react-native-sdk": "^6.0.0-beta.1"
41
+ },
42
+ "peerDependenciesMeta": {
43
+ "@mappedin/react-native-sdk": {
44
+ "optional": true
45
+ },
46
+ "react": {
47
+ "optional": true
48
+ }
49
+ },
50
+ "devDependencies": {},
51
+ "volta": {
52
+ "extends": "../../package.json"
53
+ },
17
54
  "scripts": {
18
55
  "start": "pnpm build && concurrently \"node scripts/build.mjs --watchChanges\" \"node scripts/start.mjs\"",
56
+ "build:deps": "RN_BUILD=true npx turbo build --filter=@mappedin/blue-dot --ui stream",
19
57
  "build": "pnpm clean && tsc -b && node scripts/build.mjs",
20
- "build:prod": "cross-env NODE_ENV=production pnpm build",
58
+ "build:prod": "cross-env NODE_ENV=production pnpm build && pnpm build:rn",
59
+ "build:rn": "cross-env RN_BUILD=true pnpm build",
21
60
  "types": "tsc -b",
22
- "test": "NODE_ENV=test jest",
61
+ "version:ci": "pnpm version --no-commit-hooks --no-git-tag-version",
62
+ "test": "pnpm -w test blue-dot",
23
63
  "test:cov": "NODE_ENV=test jest --coverage",
24
64
  "clean": "rm -rf lib/** && rm -rf examples/dist/**",
25
65
  "docs": "pnpm build && typedoc"
26
- },
27
- "peerDependencies": {
28
- "@mappedin/mappedin-js": "^6.0.1-beta.42"
29
- },
30
- "volta": {
31
- "extends": "../../package.json"
32
- },
33
- "gitHead": "6f653df01e872470753a4ddfeb213b6e28c50f93"
34
- }
66
+ }
67
+ }