@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.
- package/README.md +122 -0
- package/lib/blue-dot.iife.js.map +7 -0
- package/lib/esm/index.d.ts +4 -43
- package/lib/esm/index.js +234 -1
- package/lib/esm/index.js.map +7 -0
- package/lib/rn/index-rn.d.ts +4 -0
- package/lib/rn/index-rn.js +295 -0
- package/lib/rn/index-rn.js.map +7 -0
- package/lib/rn/rn/extension-augmentation.d.ts +15 -0
- package/lib/rn/rn/extension-source.d.ts +6 -0
- package/lib/rn/rn/use-blue-dot-events.d.ts +40 -0
- package/lib/rn/rn/use-blue-dot-registration.d.ts +16 -0
- package/lib/rn/rn/use-blue-dot.d.ts +131 -0
- package/lib/rn/types.d.ts +194 -0
- package/package.json +45 -12
package/README.md
CHANGED
|
@@ -115,3 +115,125 @@ export type BlueDotOptions = {
|
|
|
115
115
|
debug?: boolean;
|
|
116
116
|
};
|
|
117
117
|
```
|
|
118
|
+
|
|
119
|
+
### React Native
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
import React, { useEffect, useCallback } from 'react';
|
|
123
|
+
import { View, Text, TouchableOpacity } from 'react-native';
|
|
124
|
+
import { MapView, useMapData } from '@mappedin/react-native-sdk';
|
|
125
|
+
import { useBlueDot, useBlueDotEvent } from '@mappedin/blue-dot/rn';
|
|
126
|
+
|
|
127
|
+
function MyComponent() {
|
|
128
|
+
const { mapData } = useMapData({
|
|
129
|
+
key: 'your-api-key',
|
|
130
|
+
secret: 'your-api-secret',
|
|
131
|
+
mapId: 'your-map-id',
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<MapView mapData={mapData}>
|
|
136
|
+
<BlueDotDisplay />
|
|
137
|
+
</MapView>
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function BlueDotDisplay() {
|
|
142
|
+
// All methods are async and return Promises
|
|
143
|
+
const {
|
|
144
|
+
isReady,
|
|
145
|
+
isEnabled,
|
|
146
|
+
state,
|
|
147
|
+
position,
|
|
148
|
+
floor,
|
|
149
|
+
following,
|
|
150
|
+
accuracy,
|
|
151
|
+
heading,
|
|
152
|
+
enable,
|
|
153
|
+
disable,
|
|
154
|
+
update,
|
|
155
|
+
follow,
|
|
156
|
+
unfollow,
|
|
157
|
+
} = useBlueDot();
|
|
158
|
+
|
|
159
|
+
// Listen for position updates
|
|
160
|
+
useBlueDotEvent(
|
|
161
|
+
'position-update',
|
|
162
|
+
useCallback(event => {
|
|
163
|
+
console.log('Position updated:', event.coordinate, event.floor);
|
|
164
|
+
}, []),
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
// Listen for state changes
|
|
168
|
+
useBlueDotEvent(
|
|
169
|
+
'state-change',
|
|
170
|
+
useCallback(event => {
|
|
171
|
+
console.log('State changed:', event.state);
|
|
172
|
+
}, []),
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
// Listen for follow mode changes
|
|
176
|
+
useBlueDotEvent(
|
|
177
|
+
'follow-change',
|
|
178
|
+
useCallback(event => {
|
|
179
|
+
console.log('Follow mode:', event.following);
|
|
180
|
+
}, []),
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
useEffect(() => {
|
|
184
|
+
if (isReady && !isEnabled) {
|
|
185
|
+
// All methods are async - use await or .then()
|
|
186
|
+
enable({
|
|
187
|
+
radius: 15,
|
|
188
|
+
color: '#ff0000',
|
|
189
|
+
watchDevicePosition: false,
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}, [isReady, isEnabled, enable]);
|
|
193
|
+
|
|
194
|
+
const handleUpdatePosition = useCallback(async () => {
|
|
195
|
+
try {
|
|
196
|
+
// Update position manually
|
|
197
|
+
await update({
|
|
198
|
+
latitude: 43.6532,
|
|
199
|
+
longitude: -79.3832,
|
|
200
|
+
accuracy: 5,
|
|
201
|
+
heading: 90,
|
|
202
|
+
floorOrFloorId: floor,
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
// Enable follow mode
|
|
206
|
+
await follow('position-and-heading', {
|
|
207
|
+
zoomLevel: 19,
|
|
208
|
+
});
|
|
209
|
+
} catch (error) {
|
|
210
|
+
console.error('Failed to update position:', error);
|
|
211
|
+
}
|
|
212
|
+
}, [update, follow, floor]);
|
|
213
|
+
|
|
214
|
+
return (
|
|
215
|
+
<View>
|
|
216
|
+
<Text>Is Ready: {isReady ? 'Yes' : 'No'}</Text>
|
|
217
|
+
<Text>Is Enabled: {isEnabled ? 'Yes' : 'No'}</Text>
|
|
218
|
+
<Text>State: {state}</Text>
|
|
219
|
+
<Text>Following: {following ? 'Yes' : 'No'}</Text>
|
|
220
|
+
{position && (
|
|
221
|
+
<Text>
|
|
222
|
+
Position: {position.latitude.toFixed(4)}, {position.longitude.toFixed(4)}
|
|
223
|
+
</Text>
|
|
224
|
+
)}
|
|
225
|
+
{accuracy && <Text>Accuracy: {accuracy.toFixed(1)}m</Text>}
|
|
226
|
+
{heading && <Text>Heading: {heading.toFixed(0)}°</Text>}
|
|
227
|
+
<TouchableOpacity onPress={handleUpdatePosition}>
|
|
228
|
+
<Text>Update Position & Follow</Text>
|
|
229
|
+
</TouchableOpacity>
|
|
230
|
+
</View>
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
**Key Differences from Vanilla JS:**
|
|
236
|
+
|
|
237
|
+
- **All methods are async**: `enable()`, `disable()`, `update()`, `follow()`, and `unfollow()` return Promises
|
|
238
|
+
- **Rich state**: Hook returns `isReady`, `state`, `position`, `floor`, `following`, `accuracy`, `heading` for real-time updates
|
|
239
|
+
- **Separate event hook**: Use `useBlueDotEvent` for listening to position-update, state-change, and follow-change events
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts", "../../packages/common/pubsub.ts", "../src/blue-dot.ts"],
|
|
4
|
+
"sourcesContent": ["export { BlueDot } from './blue-dot';\nexport type {\n\tBlueDotEvents,\n\tBlueDotEventPayloads,\n\tBlueDotPositionUpdate,\n\tBlueDotState,\n\tBlueDotAction,\n\tFollowMode,\n\tFollowCameraOptions,\n\tBlueDotOptions,\n} from './types';\n", "/**\n * Generic PubSub class implementing the Publish-Subscribe pattern for event handling.\n *\n * @template EVENT_PAYLOAD - The type of the event payload.\n * @template EVENT - The type of the event.\n */\nexport class PubSub<EVENT_PAYLOAD, EVENT extends keyof EVENT_PAYLOAD = keyof EVENT_PAYLOAD> {\n\t/**\n\t * @private\n\t * @internal\n\t */\n\tprivate _subscribers: any = {};\n\t/**\n\t * @private\n\t * @internal\n\t */\n\tprivate _destroyed = false;\n\n\t/**\n\t * @private\n\t * @internal\n\t */\n\tpublish<EVENT_NAME extends EVENT>(eventName: EVENT_NAME, data?: EVENT_PAYLOAD[EVENT_NAME]) {\n\t\tif (!this._subscribers || !this._subscribers[eventName] || this._destroyed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._subscribers[eventName]!.forEach(function (fn) {\n\t\t\tif (typeof fn !== 'function') {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfn(data);\n\t\t});\n\t}\n\n\t/**\n\t * Subscribe a function to an event.\n\t *\n\t * @param eventName An event name which, when fired, will call the provided\n\t * function.\n\t * @param fn A callback that gets called when the corresponding event is fired. The\n\t * callback will get passed an argument with a type that's one of event payloads.\n\t * @example\n\t * // Subscribe to the 'click' event\n\t * const handler = (event) => {\n\t * const { coordinate } = event;\n\t * const { latitude, longitude } = coordinate;\n\t * \tconsole.log(`Map was clicked at ${latitude}, ${longitude}`);\n\t * };\n\t * map.on('click', handler);\n\t */\n\ton<EVENT_NAME extends EVENT>(\n\t\teventName: EVENT_NAME,\n\t\tfn: (\n\t\t\tpayload: EVENT_PAYLOAD[EVENT_NAME] extends {\n\t\t\t\tdata: null;\n\t\t\t}\n\t\t\t\t? EVENT_PAYLOAD[EVENT_NAME]['data']\n\t\t\t\t: EVENT_PAYLOAD[EVENT_NAME],\n\t\t) => void,\n\t) {\n\t\tif (!this._subscribers || this._destroyed) {\n\t\t\tthis._subscribers = {};\n\t\t}\n\t\tthis._subscribers[eventName] = this._subscribers[eventName] || [];\n\t\tthis._subscribers[eventName]!.push(fn);\n\t}\n\n\t/**\n\t * Unsubscribe a function previously subscribed with {@link on}\n\t *\n\t * @param eventName An event name to which the provided function was previously\n\t * subscribed.\n\t * @param fn A function that was previously passed to {@link on}. The function must\n\t * have the same reference as the function that was subscribed.\n\t * @example\n\t * // Unsubscribe from the 'click' event\n\t * const handler = (event) => {\n\t * \tconsole.log('Map was clicked', event);\n\t * };\n\t * map.off('click', handler);\n\t */\n\toff<EVENT_NAME extends EVENT>(\n\t\teventName: EVENT_NAME,\n\t\tfn: (\n\t\t\tpayload: EVENT_PAYLOAD[EVENT_NAME] extends {\n\t\t\t\tdata: null;\n\t\t\t}\n\t\t\t\t? EVENT_PAYLOAD[EVENT_NAME]['data']\n\t\t\t\t: EVENT_PAYLOAD[EVENT_NAME],\n\t\t) => void,\n\t) {\n\t\tif (!this._subscribers || this._subscribers[eventName] == null || this._destroyed) {\n\t\t\treturn;\n\t\t}\n\t\tconst itemIdx = this._subscribers[eventName]!.indexOf(fn);\n\n\t\tif (itemIdx !== -1) {\n\t\t\tthis._subscribers[eventName]!.splice(itemIdx, 1);\n\t\t}\n\t}\n\t/**\n\t * @private\n\t * @internal\n\t */\n\tdestroy() {\n\t\tthis._destroyed = true;\n\t\tthis._subscribers = {};\n\t}\n}\n", "import { PubSub } from '@packages/internal/common/pubsub';\nimport type { MapView } from '@mappedin/mappedin-js';\nimport type {\n\tBlueDotEventPayloads,\n\tBlueDotOptions,\n\tBlueDotPositionUpdate,\n\tBlueDotState,\n\tFollowCameraOptions,\n\tFollowMode,\n} from './types';\n\n/**\n * Show a Blue Dot indicating the device's position on the map.\n *\n * @example\n * ```ts\n * import { show3dMap } from '@mappedin/mappedin-js';\n * import { BlueDot } from '@mappedin/blue-dot';\n *\n * const mapView = await show3dMap(...);\n *\n * // Enable BlueDot\n * new BlueDot(mapView).enable();\n *\n * // Option 1: Listen for position updates from the device\n * mapView.BlueDot.on('position-update', (position) => {\n * console.log('User position:', position);\n * });\n *\n * // Option 2: Update position manually\n * new BlueDot(mapView).update({ latitude, longitude, accuracy, floorOrFloorId });\n *\n * ```\n */\nexport class BlueDot {\n\t#pubsub = new PubSub<BlueDotEventPayloads>();\n\t#mapView: MapView;\n\n\t/**\n\t * Create a new {@link BlueDot} instance.\n\t */\n\tconstructor(mapView: MapView) {\n\t\tthis.#mapView = mapView;\n\t\tthis.#mapView.__BlueDot.on('blue-dot-position-error', e => {\n\t\t\tthis.#pubsub.publish('error', e);\n\t\t});\n\t\tthis.#mapView.__BlueDot.on('blue-dot-position-update', e => {\n\t\t\tthis.#pubsub.publish('position-update', e);\n\t\t});\n\t\tthis.#mapView.__BlueDot.on('blue-dot-state-change', e => {\n\t\t\tthis.#pubsub.publish('state-change', e);\n\t\t});\n\t\tthis.#mapView.__BlueDot.on('blue-dot-follow-change', e => {\n\t\t\tthis.#pubsub.publish('follow-change', e);\n\t\t});\n\t\tthis.#mapView.__BlueDot.on('click', e => {\n\t\t\tthis.#pubsub.publish('click', e);\n\t\t});\n\t\tthis.#mapView.__BlueDot.on('hover', () => {\n\t\t\tthis.#pubsub.publish('hover');\n\t\t});\n\t}\n\n\t/**\n\t * The current state of the BlueDot. Can be 'hidden', 'active', 'inactive', or 'disabled'.\n\t * Listen for state changes using the 'state-change' event.\n\t *\n\t * @example\n\t * mapView.BlueDot.on('state-change', ({ state }) => {\n\t * if (state === 'active') {\n\t * // BlueDot is visible and tracking\n\t * }\n\t * });\n\t */\n\tget state(): BlueDotState {\n\t\treturn this.#mapView.__BlueDot.state;\n\t}\n\n\t/**\n\t * Whether the BlueDot is currently following the user (camera follow mode).\n\t */\n\tget following() {\n\t\treturn this.#mapView.__BlueDot.following;\n\t}\n\n\t/**\n\t * The direction the user is facing in degrees from north clockwise.\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/GeolocationCoordinates/heading\n\t */\n\tget heading() {\n\t\treturn this.#mapView.__BlueDot.heading;\n\t}\n\n\t/**\n\t * The accuracy of the current position in metres.\n\t */\n\tget accuracy() {\n\t\treturn this.#mapView.__BlueDot.accuracy;\n\t}\n\n\t/**\n\t * The coordinate of the current position.\n\t */\n\tget coordinate() {\n\t\treturn this.#mapView.__BlueDot.coordinate;\n\t}\n\n\t/**\n\t * The floor the Blue Dot is currently on. If undefined, the Blue Dot will appear on every floor.\n\t */\n\tget floor() {\n\t\treturn this.#mapView.__BlueDot.floor;\n\t}\n\n\t/**\n\t * Enable the Blue Dot. It will be hidden until a position is received either from the browser or by calling {@link BlueDot.update}.\n\t * @param options - The options to setup the Blue Dot (see {@link BlueDotOptions}).\n\t *\n\t * @example Enable with default options\n\t * mapView.BlueDot.enable();\n\t *\n\t * @example Enable with custom color and accuracy ring\n\t * mapView.BlueDot.enable({ color: '#00ff00', accuracyRing: { color: '#00ff00', opacity: 0.2 } });\n\t *\n\t * @see See the [BlueDot Guide](https://developer.mappedin.com/web-sdk/blue-dot) for more information.\n\t */\n\tenable = (options?: BlueDotOptions) => {\n\t\tthis.#mapView.__BlueDot.enable(options);\n\t};\n\n\t/**\n\t * Disable the Blue Dot. It will be hidden and no longer update.\n\t */\n\tdisable = () => {\n\t\tthis.#mapView.__BlueDot.disable();\n\t};\n\n\ton: PubSub<BlueDotEventPayloads>['on'] = (eventName, fn) => {\n\t\tthis.#pubsub.on(eventName, fn);\n\t};\n\n\toff: PubSub<BlueDotEventPayloads>['off'] = (eventName, fn) => {\n\t\tthis.#pubsub.off(eventName, fn);\n\t};\n\n\t/**\n\t * Enable or disable the devices's geolocation listener to automatically position the Blue Dot.\n\t * If enabled, the device will request permission to access the user's precise location.\n\t * @param watch - Whether to enable or disable the listener.\n\t */\n\twatchDevicePosition = (watch = true) => {\n\t\tthis.#mapView.__BlueDot.watchDevicePosition(watch);\n\t};\n\n\t/**\n\t * Manually override some position properties of the Blue Dot.\n\t * Accepts a full GeolocationPosition object or a partial {@link BlueDotPositionUpdate} object.\n\t * @example Manually set the accuracy and heading\n\t * ```ts\n\t * api.BlueDot.update({ accuracy: 10, heading: 90 });\n\t * ```\n\t * @example Reset accuracy and heading to device values\n\t * ```ts\n\t * api.BlueDot.update({ accuracy: 'device', heading: 'device' });\n\t * ```\n\t */\n\tupdate = (position: BlueDotPositionUpdate) => {\n\t\tthis.#mapView.__BlueDot.update(position);\n\t};\n\n\t/**\n\t * Set the camera to follow the BlueDot in various modes. User interaction will cancel following automatically.\n\t * @param mode The follow mode ('position-only', 'position-and-heading', 'position-and-path-direction', or false to disable).\n\t * @param cameraOptions Optional camera options (zoom, pitch, etc.).\n\t *\n\t * @example\n\t * mapView.BlueDot.follow('position-and-heading', { zoomLevel: 21, pitch: 45 });\n\t */\n\tfollow = (mode: FollowMode, cameraOptions?: FollowCameraOptions) => {\n\t\tthis.#mapView.__BlueDot.follow(mode, cameraOptions);\n\t};\n\n\tdestroy = () => {\n\t\tthis.#pubsub.destroy();\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;67BAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,ICMO,IAAMC,EAAN,MAAMA,CAA+E,CAArF,cAKNC,EAAA,KAAQ,eAAoB,CAAC,GAK7BA,EAAA,KAAQ,aAAa,IAMrB,QAAkCC,EAAuBC,EAAkC,CACtF,CAAC,KAAK,cAAgB,CAAC,KAAK,aAAaD,CAAS,GAAK,KAAK,YAIhE,KAAK,aAAaA,CAAS,EAAG,QAAQ,SAAUE,EAAI,CAC/C,OAAOA,GAAO,YAGlBA,EAAGD,CAAI,CACR,CAAC,CACF,CAkBA,GACCD,EACAE,EAOC,EACG,CAAC,KAAK,cAAgB,KAAK,cAC9B,KAAK,aAAe,CAAC,GAEtB,KAAK,aAAaF,CAAS,EAAI,KAAK,aAAaA,CAAS,GA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AMe,EAANf",
|
|
6
|
+
"names": ["index_exports", "__export", "BlueDot", "_PubSub", "__publicField", "eventName", "data", "fn", "itemIdx", "__name", "PubSub", "_pubsub", "_mapView", "_BlueDot", "mapView", "__privateAdd", "PubSub", "__publicField", "__name", "options", "__privateGet", "eventName", "fn", "watch", "position", "mode", "cameraOptions", "__privateSet", "BlueDot"]
|
|
7
|
+
}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// Generated by dts-bundle v0.7.3
|
|
2
2
|
// Dependencies for this module:
|
|
3
|
-
// ../blue-dot/@packages/internal/common
|
|
3
|
+
// ../blue-dot/@packages/internal/common/pubsub
|
|
4
4
|
// ../blue-dot/@mappedin/mappedin-js
|
|
5
5
|
// ../blue-dot/three
|
|
6
|
-
// ../blue-dot/type-fest
|
|
7
6
|
|
|
8
7
|
declare module '@mappedin/blue-dot' {
|
|
9
8
|
export { BlueDot } from '@mappedin/blue-dot/blue-dot/src/blue-dot';
|
|
@@ -11,7 +10,7 @@ declare module '@mappedin/blue-dot' {
|
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
declare module '@mappedin/blue-dot/blue-dot/src/blue-dot' {
|
|
14
|
-
import { PubSub } from '@packages/internal/common';
|
|
13
|
+
import { PubSub } from '@packages/internal/common/pubsub';
|
|
15
14
|
import type { MapView } from '@mappedin/mappedin-js';
|
|
16
15
|
import type { BlueDotEventPayloads, BlueDotOptions, BlueDotPositionUpdate, BlueDotState, FollowCameraOptions, FollowMode } from '@mappedin/blue-dot/blue-dot/src/types';
|
|
17
16
|
/**
|
|
@@ -220,7 +219,7 @@ declare module '@mappedin/blue-dot/blue-dot/src/types' {
|
|
|
220
219
|
};
|
|
221
220
|
export type BlueDotEvents = keyof BlueDotEventPayloads;
|
|
222
221
|
export type BlueDotState = 'hidden' | 'active' | 'inactive' | 'disabled';
|
|
223
|
-
export type BlueDotAction = 'timeout' | 'error' | 'position-update' | 'enable' | 'disable';
|
|
222
|
+
export type BlueDotAction = 'timeout' | 'error' | 'position-update' | 'enable' | 'disable' | 'initialize';
|
|
224
223
|
export type BlueDotOptions = {
|
|
225
224
|
/**
|
|
226
225
|
* The radius of the BlueDot in pixels. The BlueDot will maintain this size clamped to a minimum of 0.35 metres.
|
|
@@ -336,7 +335,6 @@ declare module '@mappedin/blue-dot/packages/common' {
|
|
|
336
335
|
export { Logger };
|
|
337
336
|
export * from '@mappedin/blue-dot/packages/common/color';
|
|
338
337
|
export * from '@mappedin/blue-dot/packages/common/interpolate';
|
|
339
|
-
export * from '@mappedin/blue-dot/packages/common/type-utils';
|
|
340
338
|
}
|
|
341
339
|
|
|
342
340
|
declare module '@mappedin/blue-dot/packages/common/Mappedin.Logger' {
|
|
@@ -517,6 +515,7 @@ declare module '@mappedin/blue-dot/packages/common/random-id' {
|
|
|
517
515
|
*/
|
|
518
516
|
export const randomId: () => string;
|
|
519
517
|
export function cyrb53(str: string, seed?: number): number;
|
|
518
|
+
export function shortId(): string;
|
|
520
519
|
}
|
|
521
520
|
|
|
522
521
|
declare module '@mappedin/blue-dot/packages/common/pubsub' {
|
|
@@ -669,44 +668,6 @@ declare module '@mappedin/blue-dot/packages/common/interpolate' {
|
|
|
669
668
|
export function interpolateMulti(value: number, inputRange: number[], outputRange: number[], easeFunc?: EasingCurve | ((t: number) => number)): number;
|
|
670
669
|
}
|
|
671
670
|
|
|
672
|
-
declare module '@mappedin/blue-dot/packages/common/type-utils' {
|
|
673
|
-
import type { SetOptional } from 'type-fest';
|
|
674
|
-
type Primitive = string | number | boolean | null | undefined;
|
|
675
|
-
export type PartialExcept<T, K extends string> = {
|
|
676
|
-
[P in keyof T as P extends K ? P : never]: T[P];
|
|
677
|
-
} & {
|
|
678
|
-
[P in keyof T as P extends K ? never : P]?: T[P] extends Primitive ? T[P] : T[P] extends (infer U)[] ? PartialExcept<U, K>[] : PartialExcept<T[P], K>;
|
|
679
|
-
};
|
|
680
|
-
/**
|
|
681
|
-
* Utility type that extracts nested values matching a specific type with recursion depth limit
|
|
682
|
-
* @example
|
|
683
|
-
* type A = ExtractDeep<{ a: { b: string; c: number; }; d: string; e: number; }, number>;
|
|
684
|
-
* // { a: { c: number; } e: number; }
|
|
685
|
-
*/
|
|
686
|
-
export type ExtractDeep<T, U, Depth extends readonly number[] = []> = Depth['length'] extends 3 ? any : {
|
|
687
|
-
[K in keyof T as T[K] extends U ? K : T[K] extends object | undefined ? ExtractDeep<NonNullable<T[K]>, U, [...Depth, 0]> extends never ? never : K : never]: T[K] extends object | undefined ? undefined extends T[K] ? ExtractDeep<NonNullable<T[K]>, U, [...Depth, 0]> | undefined : ExtractDeep<NonNullable<T[K]>, U, [...Depth, 0]> : T[K] extends U ? T[K] : never;
|
|
688
|
-
};
|
|
689
|
-
/**
|
|
690
|
-
* Utility type that makes all properties of a type required, but allows undefined values
|
|
691
|
-
* to satisfy the required type.
|
|
692
|
-
* https://medium.com/terria/typescript-transforming-optional-properties-to-required-properties-that-may-be-undefined-7482cb4e1585
|
|
693
|
-
* @example
|
|
694
|
-
* type A = Complete<{ a: string; b: number; c: undefined; }>;
|
|
695
|
-
* // { a: string; b: number; c: undefined; }
|
|
696
|
-
*/
|
|
697
|
-
export type Complete<T> = {
|
|
698
|
-
[P in keyof Required<T>]: Pick<T, P> extends Required<Pick<T, P>> ? T[P] : T[P] | undefined;
|
|
699
|
-
};
|
|
700
|
-
/**
|
|
701
|
-
* Utility type that makes all properties required except for the ones specified in the second argument.
|
|
702
|
-
* @example
|
|
703
|
-
* type A = RequiredExcept<{ a: string; b: number; c: undefined; }, 'c'>;
|
|
704
|
-
* // { a: string; b: number; c?: undefined; }
|
|
705
|
-
*/
|
|
706
|
-
export type RequiredExcept<T, K extends keyof T> = SetOptional<Required<T>, K>;
|
|
707
|
-
export {};
|
|
708
|
-
}
|
|
709
|
-
|
|
710
671
|
declare module '@mappedin/blue-dot/packages/common/math-utils' {
|
|
711
672
|
/**
|
|
712
673
|
* Clamp a number between lower and upper bounds with a warning
|