@mappedin/react-sdk 6.3.1 → 6.5.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.
@@ -1,432 +1,1027 @@
1
- // Generated by dts-bundle v0.7.3
2
- // Dependencies for this module:
3
- // ../react/react
4
- // ../react/@mappedin/mappedin-js
5
- // ../react/@packages/internal/common/extensions
6
-
7
- declare module '@mappedin/react-sdk' {
8
- /**
9
- * @module @mappedin/react-sdk
10
- */
11
- export { MapDataProvider } from '@mappedin/react-sdk/react-sdk/src/MapDataProvider';
12
- export type { MapDataProviderProps } from '@mappedin/react-sdk/react-sdk/src/MapDataProvider';
13
- export { useMapData } from '@mappedin/react-sdk/react-sdk/src/hooks/useMapData';
14
- export { useMapDataEvent } from '@mappedin/react-sdk/react-sdk/src/hooks/useMapDataEvent';
15
- export { MapView } from '@mappedin/react-sdk/react-sdk/src/MapView';
16
- export type { MapViewProps } from '@mappedin/react-sdk/react-sdk/src/MapView';
17
- export { useMapViewEvent } from '@mappedin/react-sdk/react-sdk/src/hooks/useMapViewEvent';
18
- export { useMapViewExtension } from '@mappedin/react-sdk/react-sdk/src/hooks/useMapViewExtension';
19
- export { Path } from '@mappedin/react-sdk/react-sdk/src/Path';
20
- export type { PathProps } from '@mappedin/react-sdk/react-sdk/src/Path';
21
- export { Navigation } from '@mappedin/react-sdk/react-sdk/src/Navigation';
22
- export type { NavigationProps } from '@mappedin/react-sdk/react-sdk/src/Navigation';
23
- export { Shape } from '@mappedin/react-sdk/react-sdk/src/Shape';
24
- export type { ShapeProps } from '@mappedin/react-sdk/react-sdk/src/Shape';
25
- export { Model } from '@mappedin/react-sdk/react-sdk/src/Model';
26
- export type { ModelProps } from '@mappedin/react-sdk/react-sdk/src/Model';
27
- export { useMap } from '@mappedin/react-sdk/react-sdk/src/hooks/useMap';
28
- export { Marker, AnimatedMarker } from '@mappedin/react-sdk/react-sdk/src/Marker';
29
- export type { MarkerProps } from '@mappedin/react-sdk/react-sdk/src/Marker';
30
- export { Label } from '@mappedin/react-sdk/react-sdk/src/Label';
31
- export type { LabelProps } from '@mappedin/react-sdk/react-sdk/src/Label';
32
- import type * as React from 'react';
33
- export type { React };
34
- }
1
+ import * as _mappedin_mappedin_js0 from "@mappedin/mappedin-js";
2
+ import { Label as Label$1, MapData, MapView as MapView$1, Marker as Marker$1, Model as Model$1, Path as Path$1, Shape as Shape$1, TAnimationOptions, TEvents, TGetMapDataOptions, TMapDataEvents, TShow3DMapOptions } from "@mappedin/mappedin-js";
3
+ import * as react1 from "react";
4
+ import React, { PropsWithChildren, ReactNode } from "react";
35
5
 
36
- declare module '@mappedin/react-sdk/react-sdk/src/MapDataProvider' {
37
- import type { MapData, TGetMapDataOptions } from '@mappedin/mappedin-js';
38
- import type { PropsWithChildren } from 'react';
39
- import React from 'react';
40
- export type CachedMapDataEntry = {
41
- mapData: MapData;
42
- options: TGetMapDataOptions;
43
- };
44
- export type MapDataContextType = {
45
- getCache: () => CachedMapDataEntry | undefined;
46
- setCache: (entry: CachedMapDataEntry) => void;
47
- };
48
- export const MapDataContext: React.Context<MapDataContextType>;
49
- export type MapDataProviderProps = {
50
- mapData: MapData;
51
- };
52
- export function MapDataProvider({ mapData, children }: PropsWithChildren<MapDataProviderProps>): React.JSX.Element;
53
- }
6
+ //#region src/MapDataProvider.d.ts
54
7
 
55
- declare module '@mappedin/react-sdk/react-sdk/src/hooks/useMapData' {
56
- import type { MapData, TGetMapDataOptions } from '@mappedin/mappedin-js';
57
- /**
58
- * Hook to get the MapData and handle loading and error states.
59
- *
60
- * If used outside of a {@link MapDataProvider} or {@link MapView} component, options are required to fetch the MapData.
61
- * If used within a {@link MapDataProvider} or {@link MapView} component, options are optional and will use the MapData from the context if available.
62
- *
63
- * @category Hooks
64
- *
65
- * @example
66
- * ```tsx
67
- * const { mapData, isLoading, error } = useMapData(options);
68
- * ```
69
- */
70
- export function useMapData(options?: TGetMapDataOptions): {
71
- mapData?: MapData;
72
- isLoading: boolean;
73
- error?: Error;
74
- };
75
- }
8
+ type MapDataProviderProps = {
9
+ mapData: MapData;
10
+ };
11
+ declare function MapDataProvider({
12
+ mapData,
13
+ children
14
+ }: PropsWithChildren<MapDataProviderProps>): React.JSX.Element;
15
+ //#endregion
16
+ //#region src/hooks/useMapData.d.ts
17
+ /**
18
+ * Hook to get the MapData and handle loading and error states.
19
+ *
20
+ * If used outside of a {@link MapDataProvider} or {@link MapView} component, options are required to fetch the MapData.
21
+ * If used within a {@link MapDataProvider} or {@link MapView} component, options are optional and will use the MapData from the context if available.
22
+ *
23
+ * @category Hooks
24
+ *
25
+ * @example
26
+ * ```tsx
27
+ * const { mapData, isLoading, error } = useMapData(options);
28
+ * ```
29
+ */
30
+ declare function useMapData(options?: TGetMapDataOptions): {
31
+ mapData?: MapData;
32
+ isLoading: boolean;
33
+ error?: Error;
34
+ };
35
+ //#endregion
36
+ //#region src/hooks/useMapDataEvent.d.ts
37
+ /**
38
+ * Hook to subscribe to an event on the MapData.
39
+ *
40
+ * Must be used within a {@link MapDataProvider} or {@link MapView} component.
41
+ * @throws If used outside of a {@link MapDataProvider} or {@link MapView} component.
42
+ *
43
+ * @param event - The event to listen for.
44
+ * @param callback - The callback to call when the event is triggered.
45
+ *
46
+ * @category Hooks
47
+ *
48
+ * @example
49
+ * ```tsx
50
+ * useMapDataEvent('language-change', event => {
51
+ * console.log(`Map language changed to ${event.name} (${event.code})`);
52
+ * });
53
+ * ```
54
+ */
55
+ declare function useMapDataEvent<T extends keyof TMapDataEvents>(event: T, callback: (payload: TMapDataEvents[T] extends {
56
+ data: null;
57
+ } ? TMapDataEvents[T]['data'] : TMapDataEvents[T]) => void): void;
58
+ //#endregion
59
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/primitive.d.ts
60
+ /**
61
+ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
76
62
 
77
- declare module '@mappedin/react-sdk/react-sdk/src/hooks/useMapDataEvent' {
78
- import type { TMapDataEvents } from '@mappedin/mappedin-js';
79
- /**
80
- * Hook to subscribe to an event on the MapData.
81
- *
82
- * Must be used within a {@link MapDataProvider} or {@link MapView} component.
83
- * @throws If used outside of a {@link MapDataProvider} or {@link MapView} component.
84
- *
85
- * @param event - The event to listen for.
86
- * @param callback - The callback to call when the event is triggered.
87
- *
88
- * @category Hooks
89
- *
90
- * @example
91
- * ```tsx
92
- * useMapDataEvent('language-change', event => {
93
- * console.log(`Map language changed to ${event.name} (${event.code})`);
94
- * });
95
- * ```
96
- */
97
- export function useMapDataEvent<T extends keyof TMapDataEvents>(event: T, callback: (payload: TMapDataEvents[T] extends {
98
- data: null;
99
- } ? TMapDataEvents[T]['data'] : TMapDataEvents[T]) => void): void;
63
+ @category Type
64
+ */
65
+ type Primitive = null | undefined | string | number | boolean | symbol | bigint;
66
+ //#endregion
67
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/observable-like.d.ts
68
+ declare global {
69
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
70
+ interface SymbolConstructor {
71
+ readonly observable: symbol;
72
+ }
100
73
  }
101
74
 
102
- declare module '@mappedin/react-sdk/react-sdk/src/MapView' {
103
- import type { ReactNode } from 'react';
104
- import React from 'react';
105
- import type { MapView as MapViewJS, MapData, TShow3DMapOptions } from '@mappedin/mappedin-js';
106
- import type { ExtensionRegistry } from '@packages/internal/common/extensions';
107
- type MapViewContextType = {
108
- mapView?: MapViewJS;
109
- extensions: ExtensionRegistry;
110
- };
111
- export const MapViewContext: React.Context<MapViewContextType>;
112
- /**
113
- * @interface
114
- */
115
- export type MapViewProps = {
116
- mapData: MapData;
117
- options?: TShow3DMapOptions;
118
- /**
119
- * The fallback content to render while the map is loading.
120
- */
121
- fallback?: ReactNode;
122
- };
123
- /**
124
- * MapView component.
125
- *
126
- * The root component which renders the map and provides context to the hooks and child components.
127
- *
128
- * @category Components
129
- *
130
- * @example
131
- * ```tsx
132
- * const { mapData } = useMapData({ key: '...', secret: '...', mapId: '...' });
133
- * return (
134
- * <MapView mapData={mapData}>
135
- * <Marker target={...} />
136
- * </MapView>
137
- * )
138
- * ```
139
- */
140
- export const MapView: React.ForwardRefExoticComponent<MapViewProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof MapViewProps> & React.RefAttributes<MapViewJS | undefined>>;
141
- export {};
142
- }
75
+ /**
76
+ @remarks
77
+ The TC39 observable proposal defines a `closed` property, but some implementations (such as xstream) do not as of 10/08/2021.
78
+ As well, some guidance on making an `Observable` to not include `closed` property.
79
+ @see https://github.com/tc39/proposal-observable/blob/master/src/Observable.js#L129-L130
80
+ @see https://github.com/staltz/xstream/blob/6c22580c1d84d69773ee4b0905df44ad464955b3/src/index.ts#L79-L85
81
+ @see https://github.com/benlesh/symbol-observable#making-an-object-observable
143
82
 
144
- declare module '@mappedin/react-sdk/react-sdk/src/hooks/useMapViewEvent' {
145
- import type { TEvents } from '@mappedin/mappedin-js';
146
- /**
147
- * Hook to subscribe to an event on the {@link MapView}.
148
- *
149
- * Must be used within a {@link MapView} component.
150
- * @throws If used outside of a {@link MapView} component.
151
- *
152
- * @param event - The event to listen for.
153
- * @param callback - The callback to call when the event is triggered.
154
- *
155
- * @category Hooks
156
- *
157
- * @example
158
- * ```tsx
159
- * useMapViewEvent('click', event => {
160
- * const { coordinate } = event;
161
- * const { latitude, longitude } = coordinate;
162
- * console.log(`Map was clicked at ${latitude}, ${longitude}`);
163
- * });
164
- * ```
165
- */
166
- export function useMapViewEvent<T extends keyof TEvents>(event: T, callback: (payload: TEvents[T] extends {
167
- data: null;
168
- } ? TEvents[T]['data'] : TEvents[T]) => void): void;
169
- }
83
+ @category Observable
84
+ */
85
+
86
+ //#endregion
87
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/optional-keys-of.d.ts
88
+ /**
89
+ Extract all optional keys from the given type.
90
+
91
+ This is useful when you want to create a new type that contains different type values for the optional keys only.
92
+
93
+ @example
94
+ ```
95
+ import type {OptionalKeysOf, Except} from 'type-fest';
170
96
 
171
- declare module '@mappedin/react-sdk/react-sdk/src/hooks/useMapViewExtension' {
172
- import type { MapViewExtension, MapViewExtensionName } from '@packages/internal/common/extensions';
173
- type MapViewExtensionOptions<T extends MapViewExtension<unknown>> = {
174
- /**
175
- * Callback to be fired when the extension is registered.
176
- * This will not be called on subsequent calls to register until the extension is deregistered again.
177
- **/
178
- onRegister: () => T;
179
- /**
180
- * Callback to be fired when the extension is deregistered.
181
- * This will not be called if the extension is not registered.
182
- **/
183
- onDeregister: (extension: T) => void;
184
- };
185
- type MapViewExtensionResult<T extends MapViewExtension<unknown>> = {
186
- /**
187
- * Register the extension or return the existing instance if it is already registered.
188
- */
189
- register: () => T;
190
- /**
191
- * Deregister the extension.
192
- */
193
- deregister: () => void;
194
- };
195
- /**
196
- * @internal
197
- * Register an extension to the mapView context.
198
- * @param name - The name of the extension.
199
- * @returns An object with a register and deregister function.
200
- */
201
- export function useMapViewExtension<T extends MapViewExtension<unknown> = MapViewExtension<unknown>>(name: MapViewExtensionName, options: MapViewExtensionOptions<T>): MapViewExtensionResult<T>;
202
- export {};
97
+ interface User {
98
+ name: string;
99
+ surname: string;
100
+
101
+ luckyNumber?: number;
203
102
  }
204
103
 
205
- declare module '@mappedin/react-sdk/react-sdk/src/Path' {
206
- import type { TupleToObjectWithPropNames } from '@mappedin/react-sdk/react-sdk/src/type-utils';
207
- import type { MapView, Path as PathJS } from '@mappedin/mappedin-js';
208
- type ParamsArray = Parameters<MapView['Paths']['add']>;
209
- type StreamAgentParameterNames = ['coordinate', 'options'];
210
- /**
211
- * @interface
212
- */
213
- export type PathProps = TupleToObjectWithPropNames<ParamsArray, StreamAgentParameterNames> & {
214
- onDrawComplete?: () => void;
215
- };
216
- /**
217
- * Path component.
218
- *
219
- * A Path indicates a route on the map.
220
- *
221
- * @category Components
222
- *
223
- * @example
224
- * ```tsx
225
- * const space1 = mapData.getByType('space')[0];
226
- * const space2 = mapData.getByType('space')[1];
227
- * const directions = mapView.getDirections(space1, space2);
228
- *
229
- * return directions ? <Path coordinate={directions.coordinates} options={{ color: 'blue' }} /> : null;
230
- * ```
231
- */
232
- export const Path: import("react").ForwardRefExoticComponent<TupleToObjectWithPropNames<[coordinates: import("@mappedin/mappedin-js").Coordinate[], options?: ({
233
- id?: string;
234
- } & import("@mappedin/mappedin-js").TAddPathOptions) | undefined], StreamAgentParameterNames> & {
235
- onDrawComplete?: () => void;
236
- } & import("react").RefAttributes<PathJS | undefined>>;
237
- export {};
104
+ const REMOVE_FIELD = Symbol('remove field symbol');
105
+ type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKeysOf<Entity>> & {
106
+ [Key in OptionalKeysOf<Entity>]?: Entity[Key] | typeof REMOVE_FIELD;
107
+ };
108
+
109
+ const update1: UpdateOperation<User> = {
110
+ name: 'Alice'
111
+ };
112
+
113
+ const update2: UpdateOperation<User> = {
114
+ name: 'Bob',
115
+ luckyNumber: REMOVE_FIELD
116
+ };
117
+ ```
118
+
119
+ @category Utilities
120
+ */
121
+ type OptionalKeysOf<BaseType extends object> = BaseType extends unknown // For distributing `BaseType`
122
+ ? (keyof { [Key in keyof BaseType as BaseType extends Record<Key, BaseType[Key]> ? never : Key]: never }) & (keyof BaseType) // Intersect with `keyof BaseType` to ensure result of `OptionalKeysOf<BaseType>` is always assignable to `keyof BaseType`
123
+ : never;
124
+ //#endregion
125
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/required-keys-of.d.ts
126
+ /**
127
+ Extract all required keys from the given type.
128
+
129
+ This is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc...
130
+
131
+ @example
132
+ ```
133
+ import type {RequiredKeysOf} from 'type-fest';
134
+
135
+ declare function createValidation<Entity extends object, Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>>(field: Key, validator: (value: Entity[Key]) => boolean): ValidatorFn;
136
+
137
+ interface User {
138
+ name: string;
139
+ surname: string;
140
+
141
+ luckyNumber?: number;
238
142
  }
239
143
 
240
- declare module '@mappedin/react-sdk/react-sdk/src/Navigation' {
241
- import type { TupleToObjectWithPropNames } from '@mappedin/react-sdk/react-sdk/src/type-utils';
242
- import type { MapView } from '@mappedin/mappedin-js';
243
- type ParamsArray = Parameters<MapView['Navigation']['draw']>;
244
- type StreamAgentParameterNames = ['directions', 'options'];
245
- /**
246
- * @interface
247
- */
248
- export type NavigationProps = TupleToObjectWithPropNames<ParamsArray, StreamAgentParameterNames> & {
249
- onDrawComplete?: () => void;
250
- };
251
- /**
252
- * Navigation component.
253
- *
254
- * Navigation draws a route on the map with pre-defined Markers for connections and the start and end points.
255
- *
256
- * @category Components
257
- *
258
- * @example
259
- * ```tsx
260
- * const space1 = mapData.getByType('space')[0];
261
- * const space2 = mapData.getByType('space')[1];
262
- * const directions = mapView.getDirections(space1, space2);
263
- *
264
- * return directions ? <Navigation directions={directions} /> : null;
265
- * ```
266
- */
267
- export function Navigation(props: NavigationProps): null;
268
- export {};
144
+ const validator1 = createValidation<User>('name', value => value.length < 25);
145
+ const validator2 = createValidation<User>('surname', value => value.length < 25);
146
+ ```
147
+
148
+ @category Utilities
149
+ */
150
+ type RequiredKeysOf<BaseType extends object> = BaseType extends unknown // For distributing `BaseType`
151
+ ? Exclude<keyof BaseType, OptionalKeysOf<BaseType>> : never;
152
+ //#endregion
153
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-never.d.ts
154
+ /**
155
+ Returns a boolean for whether the given type is `never`.
156
+
157
+ @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
158
+ @link https://stackoverflow.com/a/53984913/10292952
159
+ @link https://www.zhenghao.io/posts/ts-never
160
+
161
+ Useful in type utilities, such as checking if something does not occur.
162
+
163
+ @example
164
+ ```
165
+ import type {IsNever, And} from 'type-fest';
166
+
167
+ // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
168
+ type AreStringsEqual<A extends string, B extends string> =
169
+ And<
170
+ IsNever<Exclude<A, B>> extends true ? true : false,
171
+ IsNever<Exclude<B, A>> extends true ? true : false
172
+ >;
173
+
174
+ type EndIfEqual<I extends string, O extends string> =
175
+ AreStringsEqual<I, O> extends true
176
+ ? never
177
+ : void;
178
+
179
+ function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
180
+ if (input === output) {
181
+ process.exit(0);
182
+ }
269
183
  }
270
184
 
271
- declare module '@mappedin/react-sdk/react-sdk/src/Shape' {
272
- import type { TupleToObjectWithPropNames } from '@mappedin/react-sdk/react-sdk/src/type-utils';
273
- import type { MapView, Shape as ShapeJS } from '@mappedin/mappedin-js';
274
- type ParamsArray = Parameters<MapView['Shapes']['add']>;
275
- type StreamAgentParameterNames = ['geometry', 'style', 'floor'];
276
- /**
277
- * @interface
278
- */
279
- export type ShapeProps = TupleToObjectWithPropNames<ParamsArray, StreamAgentParameterNames>;
280
- /**
281
- * Shape component.
282
- *
283
- * A Shape is a custom geometry on the map created from a GeoJSON feature collection.
284
- *
285
- * @category Components
286
- *
287
- * @example
288
- * ```tsx
289
- * <Shape geometry={geojson} style={{ color: 'blue', height: 2 }} />
290
- * ```
291
- */
292
- export const Shape: import("react").ForwardRefExoticComponent<ShapeProps & import("react").RefAttributes<ShapeJS | undefined>>;
293
- export {};
185
+ endIfEqual('abc', 'abc');
186
+ //=> never
187
+
188
+ endIfEqual('abc', '123');
189
+ //=> void
190
+ ```
191
+
192
+ @category Type Guard
193
+ @category Utilities
194
+ */
195
+ type IsNever<T> = [T] extends [never] ? true : false;
196
+ //#endregion
197
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/if-never.d.ts
198
+ /**
199
+ An if-else-like type that resolves depending on whether the given type is `never`.
200
+
201
+ @see {@link IsNever}
202
+
203
+ @example
204
+ ```
205
+ import type {IfNever} from 'type-fest';
206
+
207
+ type ShouldBeTrue = IfNever<never>;
208
+ //=> true
209
+
210
+ type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>;
211
+ //=> 'bar'
212
+ ```
213
+
214
+ @category Type Guard
215
+ @category Utilities
216
+ */
217
+ type IfNever<T, TypeIfNever = true, TypeIfNotNever = false> = (IsNever<T> extends true ? TypeIfNever : TypeIfNotNever);
218
+ //#endregion
219
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-any.d.ts
220
+ // Can eventually be replaced with the built-in once this library supports
221
+ // TS5.4+ only. Tracked in https://github.com/sindresorhus/type-fest/issues/848
222
+ type NoInfer<T> = T extends infer U ? U : never;
223
+
224
+ /**
225
+ Returns a boolean for whether the given type is `any`.
226
+
227
+ @link https://stackoverflow.com/a/49928360/1490091
228
+
229
+ Useful in type utilities, such as disallowing `any`s to be passed to a function.
230
+
231
+ @example
232
+ ```
233
+ import type {IsAny} from 'type-fest';
234
+
235
+ const typedObject = {a: 1, b: 2} as const;
236
+ const anyObject: any = {a: 1, b: 2};
237
+
238
+ function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(obj: O, key: K) {
239
+ return obj[key];
294
240
  }
295
241
 
296
- declare module '@mappedin/react-sdk/react-sdk/src/Model' {
297
- import type { TupleToObjectWithPropNames } from '@mappedin/react-sdk/react-sdk/src/type-utils';
298
- import type { MapView, Model as ModelJS } from '@mappedin/mappedin-js';
299
- type ParamsArray = Parameters<MapView['Models']['add']>;
300
- type StreamAgentParameterNames = ['coordinate', 'url', 'options'];
301
- /**
302
- * @interface
303
- */
304
- export type ModelProps = TupleToObjectWithPropNames<ParamsArray, StreamAgentParameterNames>;
305
- /**
306
- * Model component.
307
- *
308
- * A Model is a 3D model in GLTF or GLB format anchored to a Coordinate on the map.
309
- *
310
- * @category Components
311
- *
312
- * @example
313
- * ```tsx
314
- * <Model
315
- * coordinate={coordinate}
316
- * url={'/path/to/model.glb'}
317
- * options={{
318
- * scale: [0.01, 0.01, 0.01],
319
- * rotation: [90, 0, 0],
320
- * opacity: 0.5,
321
- * }}
322
- * />
323
- * ```
324
- */
325
- export const Model: import("react").ForwardRefExoticComponent<ModelProps & import("react").RefAttributes<ModelJS | undefined>>;
326
- export {};
242
+ const typedA = get(typedObject, 'a');
243
+ //=> 1
244
+
245
+ const anyA = get(anyObject, 'a');
246
+ //=> any
247
+ ```
248
+
249
+ @category Type Guard
250
+ @category Utilities
251
+ */
252
+ type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
253
+ //#endregion
254
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/simplify.d.ts
255
+ /**
256
+ Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
257
+
258
+ @example
259
+ ```
260
+ import type {Simplify} from 'type-fest';
261
+
262
+ type PositionProps = {
263
+ top: number;
264
+ left: number;
265
+ };
266
+
267
+ type SizeProps = {
268
+ width: number;
269
+ height: number;
270
+ };
271
+
272
+ // In your editor, hovering over `Props` will show a flattened object with all the properties.
273
+ type Props = Simplify<PositionProps & SizeProps>;
274
+ ```
275
+
276
+ Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.
277
+
278
+ If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.
279
+
280
+ @example
281
+ ```
282
+ import type {Simplify} from 'type-fest';
283
+
284
+ interface SomeInterface {
285
+ foo: number;
286
+ bar?: string;
287
+ baz: number | undefined;
327
288
  }
328
289
 
329
- declare module '@mappedin/react-sdk/react-sdk/src/hooks/useMap' {
330
- import type { MapData, MapView } from '@mappedin/mappedin-js';
331
- /**
332
- * Hook to get the MapData and MapView from the current MapView context.
333
- *
334
- * Must be used within a {@link MapView} component.
335
- * @throws If used outside of a {@link MapView} component.
336
- *
337
- * @category Hooks
338
- *
339
- * @example
340
- * ```tsx
341
- * const { mapData, mapView } = useMap();
342
- * ```
343
- */
344
- export function useMap(): {
345
- mapData: MapData;
346
- mapView: MapView;
347
- };
290
+ type SomeType = {
291
+ foo: number;
292
+ bar?: string;
293
+ baz: number | undefined;
294
+ };
295
+
296
+ const literal = {foo: 123, bar: 'hello', baz: 456};
297
+ const someType: SomeType = literal;
298
+ const someInterface: SomeInterface = literal;
299
+
300
+ function fn(object: Record<string, unknown>): void {}
301
+
302
+ fn(literal); // Good: literal object type is sealed
303
+ fn(someType); // Good: type is sealed
304
+ fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
305
+ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
306
+ ```
307
+
308
+ @link https://github.com/microsoft/TypeScript/issues/15300
309
+ @see SimplifyDeep
310
+ @category Object
311
+ */
312
+ type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
313
+ //#endregion
314
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/omit-index-signature.d.ts
315
+ /**
316
+ Omit any index signatures from the given object type, leaving only explicitly defined properties.
317
+
318
+ This is the counterpart of `PickIndexSignature`.
319
+
320
+ Use-cases:
321
+ - Remove overly permissive signatures from third-party types.
322
+
323
+ This type was taken from this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
324
+
325
+ It relies on the fact that an empty object (`{}`) is assignable to an object with just an index signature, like `Record<string, unknown>`, but not to an object with explicitly defined keys, like `Record<'foo' | 'bar', unknown>`.
326
+
327
+ (The actual value type, `unknown`, is irrelevant and could be any type. Only the key type matters.)
328
+
329
+ ```
330
+ const indexed: Record<string, unknown> = {}; // Allowed
331
+
332
+ const keyed: Record<'foo', unknown> = {}; // Error
333
+ // => TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
334
+ ```
335
+
336
+ Instead of causing a type error like the above, you can also use a [conditional type](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) to test whether a type is assignable to another:
337
+
338
+ ```
339
+ type Indexed = {} extends Record<string, unknown>
340
+ ? '✅ `{}` is assignable to `Record<string, unknown>`'
341
+ : '❌ `{}` is NOT assignable to `Record<string, unknown>`';
342
+ // => '✅ `{}` is assignable to `Record<string, unknown>`'
343
+
344
+ type Keyed = {} extends Record<'foo' | 'bar', unknown>
345
+ ? "✅ `{}` is assignable to `Record<'foo' | 'bar', unknown>`"
346
+ : "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`";
347
+ // => "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`"
348
+ ```
349
+
350
+ Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`...
351
+
352
+ ```
353
+ import type {OmitIndexSignature} from 'type-fest';
354
+
355
+ type OmitIndexSignature<ObjectType> = {
356
+ [KeyType in keyof ObjectType // Map each key of `ObjectType`...
357
+ ]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
358
+ };
359
+ ```
360
+
361
+ ...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
362
+
363
+ ```
364
+ import type {OmitIndexSignature} from 'type-fest';
365
+
366
+ type OmitIndexSignature<ObjectType> = {
367
+ [KeyType in keyof ObjectType
368
+ // Is `{}` assignable to `Record<KeyType, unknown>`?
369
+ as {} extends Record<KeyType, unknown>
370
+ ? ... // ✅ `{}` is assignable to `Record<KeyType, unknown>`
371
+ : ... // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
372
+ ]: ObjectType[KeyType];
373
+ };
374
+ ```
375
+
376
+ If `{}` is assignable, it means that `KeyType` is an index signature and we want to remove it. If it is not assignable, `KeyType` is a "real" key and we want to keep it.
377
+
378
+ @example
379
+ ```
380
+ import type {OmitIndexSignature} from 'type-fest';
381
+
382
+ interface Example {
383
+ // These index signatures will be removed.
384
+ [x: string]: any
385
+ [x: number]: any
386
+ [x: symbol]: any
387
+ [x: `head-${string}`]: string
388
+ [x: `${string}-tail`]: string
389
+ [x: `head-${string}-tail`]: string
390
+ [x: `${bigint}`]: string
391
+ [x: `embedded-${number}`]: string
392
+
393
+ // These explicitly defined keys will remain.
394
+ foo: 'bar';
395
+ qux?: 'baz';
348
396
  }
349
397
 
350
- declare module '@mappedin/react-sdk/react-sdk/src/Marker' {
351
- import React from 'react';
352
- import type { TupleToObjectWithPropNames } from '@mappedin/react-sdk/react-sdk/src/type-utils';
353
- import type { MapView, TAnimationOptions, Marker as MarkerJS } from '@mappedin/mappedin-js';
354
- type ParamsArray = Parameters<MapView['Markers']['add']>;
355
- type StreamAgentParameterNames = ['target', 'contentHtml', 'options'];
356
- /**
357
- * @interface
358
- */
359
- export type MarkerProps = Omit<TupleToObjectWithPropNames<ParamsArray, StreamAgentParameterNames>, 'contentHtml'>;
360
- /**
361
- * Marker component.
362
- *
363
- * A Marker is a 2D component anchored to a position on the map.
364
- * To animate the Marker when its target changes, see {@link AnimatedMarker}.
365
- *
366
- * @example
367
- * ```tsx
368
- * <Marker target={mapData.getByType('space')[0]}>
369
- * <div>Hello, world!</div>
370
- * </Marker>
371
- * ```
372
- *
373
- * @category Components
374
- */
375
- export const Marker: React.ForwardRefExoticComponent<MarkerProps & {
376
- children?: React.ReactNode | undefined;
377
- } & React.RefAttributes<MarkerJS | undefined>>;
378
- /**
379
- * AnimatedMarker component.
380
- * @experimental
381
- *
382
- * A {@link Marker} component that animates between positions when its target changes.
383
- *
384
- * @example
385
- * ```tsx
386
- * <AnimatedMarker target={mapData.getByType('space')[0]} duration={1000}>
387
- * <div>Hello, world!</div>
388
- * </AnimatedMarker>
389
- * ```
390
- *
391
- * @category Components
392
- */
393
- export const AnimatedMarker: React.ForwardRefExoticComponent<MarkerProps & TAnimationOptions & {
394
- children?: React.ReactNode | undefined;
395
- } & React.RefAttributes<MarkerJS | undefined>>;
396
- export {};
398
+ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
399
+ // => { foo: 'bar'; qux?: 'baz' | undefined; }
400
+ ```
401
+
402
+ @see PickIndexSignature
403
+ @category Object
404
+ */
405
+ type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
406
+ //#endregion
407
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/pick-index-signature.d.ts
408
+ /**
409
+ Pick only index signatures from the given object type, leaving out all explicitly defined properties.
410
+
411
+ This is the counterpart of `OmitIndexSignature`.
412
+
413
+ @example
414
+ ```
415
+ import type {PickIndexSignature} from 'type-fest';
416
+
417
+ declare const symbolKey: unique symbol;
418
+
419
+ type Example = {
420
+ // These index signatures will remain.
421
+ [x: string]: unknown;
422
+ [x: number]: unknown;
423
+ [x: symbol]: unknown;
424
+ [x: `head-${string}`]: string;
425
+ [x: `${string}-tail`]: string;
426
+ [x: `head-${string}-tail`]: string;
427
+ [x: `${bigint}`]: string;
428
+ [x: `embedded-${number}`]: string;
429
+
430
+ // These explicitly defined keys will be removed.
431
+ ['kebab-case-key']: string;
432
+ [symbolKey]: string;
433
+ foo: 'bar';
434
+ qux?: 'baz';
435
+ };
436
+
437
+ type ExampleIndexSignature = PickIndexSignature<Example>;
438
+ // {
439
+ // [x: string]: unknown;
440
+ // [x: number]: unknown;
441
+ // [x: symbol]: unknown;
442
+ // [x: `head-${string}`]: string;
443
+ // [x: `${string}-tail`]: string;
444
+ // [x: `head-${string}-tail`]: string;
445
+ // [x: `${bigint}`]: string;
446
+ // [x: `embedded-${number}`]: string;
447
+ // }
448
+ ```
449
+
450
+ @see OmitIndexSignature
451
+ @category Object
452
+ */
453
+ type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
454
+ //#endregion
455
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/merge.d.ts
456
+ // Merges two objects without worrying about index signatures.
457
+ type SimpleMerge<Destination, Source> = { [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source;
458
+
459
+ /**
460
+ Merge two types into a new type. Keys of the second type overrides keys of the first type.
461
+
462
+ @example
463
+ ```
464
+ import type {Merge} from 'type-fest';
465
+
466
+ interface Foo {
467
+ [x: string]: unknown;
468
+ [x: number]: unknown;
469
+ foo: string;
470
+ bar: symbol;
397
471
  }
398
472
 
399
- declare module '@mappedin/react-sdk/react-sdk/src/Label' {
400
- import type { TupleToObjectWithPropNames } from '@mappedin/react-sdk/react-sdk/src/type-utils';
401
- import type { MapView, Label as LabelJS } from '@mappedin/mappedin-js';
402
- type ParamsArray = Parameters<MapView['Labels']['add']>;
403
- type StreamAgentParameterNames = ['target', 'text', 'options'];
404
- /**
405
- * @interface
406
- */
407
- export type LabelProps = TupleToObjectWithPropNames<ParamsArray, StreamAgentParameterNames>;
408
- /**
409
- * Label component.
410
- *
411
- * A Label is a 2D text label anchored to a position on the map.
412
- *
413
- * @category Components
414
- *
415
- * @example
416
- * ```tsx
417
- * <Label target={mapData.getByType('space')[0]} text={"Hello, world!"} />
418
- * ```
419
- */
420
- export const Label: import("react").ForwardRefExoticComponent<LabelProps & import("react").RefAttributes<LabelJS | undefined>>;
421
- export {};
473
+ type Bar = {
474
+ [x: number]: number;
475
+ [x: symbol]: unknown;
476
+ bar: Date;
477
+ baz: boolean;
478
+ };
479
+
480
+ export type FooBar = Merge<Foo, Bar>;
481
+ // => {
482
+ // [x: string]: unknown;
483
+ // [x: number]: number;
484
+ // [x: symbol]: unknown;
485
+ // foo: string;
486
+ // bar: Date;
487
+ // baz: boolean;
488
+ // }
489
+ ```
490
+
491
+ @category Object
492
+ */
493
+ type Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
494
+ //#endregion
495
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/if-any.d.ts
496
+ /**
497
+ An if-else-like type that resolves depending on whether the given type is `any`.
498
+
499
+ @see {@link IsAny}
500
+
501
+ @example
502
+ ```
503
+ import type {IfAny} from 'type-fest';
504
+
505
+ type ShouldBeTrue = IfAny<any>;
506
+ //=> true
507
+
508
+ type ShouldBeBar = IfAny<'not any', 'foo', 'bar'>;
509
+ //=> 'bar'
510
+ ```
511
+
512
+ @category Type Guard
513
+ @category Utilities
514
+ */
515
+ type IfAny<T, TypeIfAny = true, TypeIfNotAny = false> = (IsAny<T> extends true ? TypeIfAny : TypeIfNotAny);
516
+ //#endregion
517
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/type.d.ts
518
+ /**
519
+ Matches any primitive, `void`, `Date`, or `RegExp` value.
520
+ */
521
+ type BuiltIns = Primitive | void | Date | RegExp;
522
+ //#endregion
523
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/object.d.ts
524
+
525
+ /**
526
+ Merges user specified options with default options.
527
+
528
+ @example
529
+ ```
530
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
531
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
532
+ type SpecifiedOptions = {leavesOnly: true};
533
+
534
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
535
+ //=> {maxRecursionDepth: 10; leavesOnly: true}
536
+ ```
537
+
538
+ @example
539
+ ```
540
+ // Complains if default values are not provided for optional options
541
+
542
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
543
+ type DefaultPathsOptions = {maxRecursionDepth: 10};
544
+ type SpecifiedOptions = {};
545
+
546
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
547
+ // ~~~~~~~~~~~~~~~~~~~
548
+ // Property 'leavesOnly' is missing in type 'DefaultPathsOptions' but required in type '{ maxRecursionDepth: number; leavesOnly: boolean; }'.
549
+ ```
550
+
551
+ @example
552
+ ```
553
+ // Complains if an option's default type does not conform to the expected type
554
+
555
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
556
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: 'no'};
557
+ type SpecifiedOptions = {};
558
+
559
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
560
+ // ~~~~~~~~~~~~~~~~~~~
561
+ // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
562
+ ```
563
+
564
+ @example
565
+ ```
566
+ // Complains if an option's specified type does not conform to the expected type
567
+
568
+ type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
569
+ type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
570
+ type SpecifiedOptions = {leavesOnly: 'yes'};
571
+
572
+ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
573
+ // ~~~~~~~~~~~~~~~~
574
+ // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
575
+ ```
576
+ */
577
+ type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = IfAny<SpecifiedOptions, Defaults, IfNever<SpecifiedOptions, Defaults, Simplify<Merge<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? Extract<SpecifiedOptions[Key], undefined> extends never ? Key : never : Key]: SpecifiedOptions[Key] }> & Required<Options>> // `& Required<Options>` ensures that `ApplyDefaultOptions<SomeOption, ...>` is always assignable to `Required<SomeOption>`
578
+ >>;
579
+ //#endregion
580
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/partial-deep.d.ts
581
+ /**
582
+ @see {@link PartialDeep}
583
+ */
584
+ type PartialDeepOptions = {
585
+ /**
586
+ Whether to affect the individual elements of arrays and tuples.
587
+ @default false
588
+ */
589
+ readonly recurseIntoArrays?: boolean;
590
+
591
+ /**
592
+ Allows `undefined` values in non-tuple arrays.
593
+ - When set to `true`, elements of non-tuple arrays can be `undefined`.
594
+ - When set to `false`, only explicitly defined elements are allowed in non-tuple arrays, ensuring stricter type checking.
595
+ @default true
596
+ @example
597
+ You can prevent `undefined` values in non-tuple arrays by passing `{recurseIntoArrays: true; allowUndefinedInNonTupleArrays: false}` as the second type argument:
598
+ ```
599
+ import type {PartialDeep} from 'type-fest';
600
+ type Settings = {
601
+ languages: string[];
602
+ };
603
+ declare const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true; allowUndefinedInNonTupleArrays: false}>;
604
+ partialSettings.languages = [undefined]; // Error
605
+ partialSettings.languages = []; // Ok
606
+ ```
607
+ */
608
+ readonly allowUndefinedInNonTupleArrays?: boolean;
609
+ };
610
+ type DefaultPartialDeepOptions = {
611
+ recurseIntoArrays: false;
612
+ allowUndefinedInNonTupleArrays: true;
613
+ };
614
+
615
+ /**
616
+ Create a type from another type with all keys and nested keys set to optional.
617
+
618
+ Use-cases:
619
+ - Merging a default settings/config object with another object, the second object would be a deep partial of the default object.
620
+ - Mocking and testing complex entities, where populating an entire object with its keys would be redundant in terms of the mock or test.
621
+
622
+ @example
623
+ ```
624
+ import type {PartialDeep} from 'type-fest';
625
+
626
+ const settings: Settings = {
627
+ textEditor: {
628
+ fontSize: 14,
629
+ fontColor: '#000000',
630
+ fontWeight: 400
631
+ },
632
+ autocomplete: false,
633
+ autosave: true
634
+ };
635
+
636
+ const applySavedSettings = (savedSettings: PartialDeep<Settings>) => {
637
+ return {...settings, ...savedSettings};
422
638
  }
423
639
 
424
- declare module '@mappedin/react-sdk/react-sdk/src/type-utils' {
425
- export type TupleToObject<T extends any[]> = {
426
- [K in keyof T as Exclude<K, keyof any[]>]: T[K];
427
- };
428
- export type TupleToObjectWithPropNames<T extends any[], N extends Record<keyof TupleToObject<T>, PropertyKey>> = {
429
- [K in keyof TupleToObject<T> as N[K]]: T[K];
430
- };
640
+ settings = applySavedSettings({textEditor: {fontWeight: 500}});
641
+ ```
642
+
643
+ By default, this does not affect elements in array and tuple types. You can change this by passing `{recurseIntoArrays: true}` as the second type argument:
644
+
645
+ ```
646
+ import type {PartialDeep} from 'type-fest';
647
+
648
+ type Settings = {
649
+ languages: string[];
431
650
  }
432
651
 
652
+ const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true}> = {
653
+ languages: [undefined]
654
+ };
655
+ ```
656
+
657
+ @see {@link PartialDeepOptions}
658
+
659
+ @category Object
660
+ @category Array
661
+ @category Set
662
+ @category Map
663
+ */
664
+ type PartialDeep<T, Options extends PartialDeepOptions = {}> = _PartialDeep<T, ApplyDefaultOptions<PartialDeepOptions, DefaultPartialDeepOptions, Options>>;
665
+ type _PartialDeep<T, Options extends Required<PartialDeepOptions>> = T extends BuiltIns | ((new (...arguments_: any[]) => unknown)) ? T : IsNever<keyof T> extends true // For functions with no properties
666
+ ? T : T extends Map<infer KeyType, infer ValueType> ? PartialMapDeep<KeyType, ValueType, Options> : T extends Set<infer ItemType> ? PartialSetDeep<ItemType, Options> : T extends ReadonlyMap<infer KeyType, infer ValueType> ? PartialReadonlyMapDeep<KeyType, ValueType, Options> : T extends ReadonlySet<infer ItemType> ? PartialReadonlySetDeep<ItemType, Options> : T extends object ? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
667
+ ? Options['recurseIntoArrays'] extends true ? ItemType[] extends T // Test for arrays (non-tuples) specifically
668
+ ? readonly ItemType[] extends T // Differentiate readonly and mutable arrays
669
+ ? ReadonlyArray<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>> : Array<_PartialDeep<Options['allowUndefinedInNonTupleArrays'] extends false ? ItemType : ItemType | undefined, Options>> : PartialObjectDeep<T, Options> // Tuples behave properly
670
+ : T // If they don't opt into array testing, just use the original type
671
+ : PartialObjectDeep<T, Options> : unknown;
672
+
673
+ /**
674
+ Same as `PartialDeep`, but accepts only `Map`s and as inputs. Internal helper for `PartialDeep`.
675
+ */
676
+ type PartialMapDeep<KeyType$1, ValueType$1, Options extends Required<PartialDeepOptions>> = {} & Map<_PartialDeep<KeyType$1, Options>, _PartialDeep<ValueType$1, Options>>;
677
+
678
+ /**
679
+ Same as `PartialDeep`, but accepts only `Set`s as inputs. Internal helper for `PartialDeep`.
680
+ */
681
+ type PartialSetDeep<T, Options extends Required<PartialDeepOptions>> = {} & Set<_PartialDeep<T, Options>>;
682
+
683
+ /**
684
+ Same as `PartialDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `PartialDeep`.
685
+ */
686
+ type PartialReadonlyMapDeep<KeyType$1, ValueType$1, Options extends Required<PartialDeepOptions>> = {} & ReadonlyMap<_PartialDeep<KeyType$1, Options>, _PartialDeep<ValueType$1, Options>>;
687
+
688
+ /**
689
+ Same as `PartialDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `PartialDeep`.
690
+ */
691
+ type PartialReadonlySetDeep<T, Options extends Required<PartialDeepOptions>> = {} & ReadonlySet<_PartialDeep<T, Options>>;
692
+
693
+ /**
694
+ Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
695
+ */
696
+ type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> = (ObjectType extends ((...arguments_: any) => unknown) ? (...arguments_: Parameters<ObjectType>) => ReturnType<ObjectType> : {}) & ({ [KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options> });
697
+ //#endregion
698
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/literal-union.d.ts
699
+ /**
700
+ Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
701
+
702
+ Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.
703
+
704
+ This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.
705
+
706
+ @example
707
+ ```
708
+ import type {LiteralUnion} from 'type-fest';
709
+
710
+ // Before
711
+
712
+ type Pet = 'dog' | 'cat' | string;
713
+
714
+ const pet: Pet = '';
715
+ // Start typing in your TypeScript-enabled IDE.
716
+ // You **will not** get auto-completion for `dog` and `cat` literals.
717
+
718
+ // After
719
+
720
+ type Pet2 = LiteralUnion<'dog' | 'cat', string>;
721
+
722
+ const pet: Pet2 = '';
723
+ // You **will** get auto-completion for `dog` and `cat` literals.
724
+ ```
725
+
726
+ @category Type
727
+ */
728
+ type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
729
+ //#endregion
730
+ //#region ../packages/common/extensions.d.ts
731
+ declare const KNOWN_EXTENSIONS: readonly ["dynamic-focus", "blue-dot"];
732
+ type MapViewExtensionName = LiteralUnion<(typeof KNOWN_EXTENSIONS)[number], string>;
733
+ interface MapViewExtension<T> {
734
+ enable(options?: PartialDeep<T>): void;
735
+ disable(): void;
736
+ get isEnabled(): boolean;
737
+ destroy(): void;
738
+ }
739
+ //#endregion
740
+ //#region src/MapView.d.ts
741
+ /**
742
+ * TypeScript can't seem to handle these parameters when wrapped in forwardRef, but it's unlikely
743
+ * that we'll ever add more parameters to show3dMap.
744
+ */
745
+ /**
746
+ * @interface
747
+ */
748
+ type MapViewProps = {
749
+ mapData: MapData;
750
+ options?: TShow3DMapOptions;
751
+ /**
752
+ * The fallback content to render while the map is loading.
753
+ */
754
+ fallback?: ReactNode;
755
+ };
756
+ /**
757
+ * MapView component.
758
+ *
759
+ * The root component which renders the map and provides context to the hooks and child components.
760
+ *
761
+ * @category Components
762
+ *
763
+ * @example
764
+ * ```tsx
765
+ * const { mapData } = useMapData({ key: '...', secret: '...', mapId: '...' });
766
+ * return (
767
+ * <MapView mapData={mapData}>
768
+ * <Marker target={...} />
769
+ * </MapView>
770
+ * )
771
+ * ```
772
+ */
773
+ declare const MapView: React.ForwardRefExoticComponent<MapViewProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, keyof MapViewProps> & React.RefAttributes<MapView$1 | undefined>>;
774
+ //#endregion
775
+ //#region src/hooks/useMapViewEvent.d.ts
776
+ /**
777
+ * Hook to subscribe to an event on the {@link MapView}.
778
+ *
779
+ * Must be used within a {@link MapView} component.
780
+ * @throws If used outside of a {@link MapView} component.
781
+ *
782
+ * @param event - The event to listen for.
783
+ * @param callback - The callback to call when the event is triggered.
784
+ *
785
+ * @category Hooks
786
+ *
787
+ * @example
788
+ * ```tsx
789
+ * useMapViewEvent('click', event => {
790
+ * const { coordinate } = event;
791
+ * const { latitude, longitude } = coordinate;
792
+ * console.log(`Map was clicked at ${latitude}, ${longitude}`);
793
+ * });
794
+ * ```
795
+ */
796
+ declare function useMapViewEvent<T extends keyof TEvents>(event: T, callback: (payload: TEvents[T] extends {
797
+ data: null;
798
+ } ? TEvents[T]['data'] : TEvents[T]) => void): void;
799
+ //#endregion
800
+ //#region src/hooks/useMapViewExtension.d.ts
801
+ type MapViewExtensionOptions<T extends MapViewExtension<unknown>> = {
802
+ /**
803
+ * Callback to be fired when the extension is registered.
804
+ * This will not be called on subsequent calls to register until the extension is deregistered again.
805
+ **/
806
+ onRegister: () => T;
807
+ /**
808
+ * Callback to be fired when the extension is deregistered.
809
+ * This will not be called if the extension is not registered.
810
+ **/
811
+ onDeregister: (extension: T) => void;
812
+ };
813
+ type MapViewExtensionResult<T extends MapViewExtension<unknown>> = {
814
+ /**
815
+ * Register the extension or return the existing instance if it is already registered.
816
+ */
817
+ register: () => T;
818
+ /**
819
+ * Deregister the extension.
820
+ */
821
+ deregister: () => void;
822
+ };
823
+ /**
824
+ * @internal
825
+ * Register an extension to the mapView context.
826
+ * @param name - The name of the extension.
827
+ * @returns An object with a register and deregister function.
828
+ */
829
+ declare function useMapViewExtension<T extends MapViewExtension<unknown> = MapViewExtension<unknown>>(name: MapViewExtensionName, options: MapViewExtensionOptions<T>): MapViewExtensionResult<T>;
830
+ //#endregion
831
+ //#region src/type-utils.d.ts
832
+ type TupleToObject<T extends any[]> = { [K in keyof T as Exclude<K, keyof any[]>]: T[K] };
833
+ type TupleToObjectWithPropNames<T extends any[], N extends Record<keyof TupleToObject<T>, PropertyKey>> = { [K in keyof TupleToObject<T> as N[K]]: T[K] };
834
+ //#endregion
835
+ //#region src/Path.d.ts
836
+ type ParamsArray$5 = Parameters<MapView$1['Paths']['add']>;
837
+ type StreamAgentParameterNames$5 = ['coordinate', 'options'];
838
+ /**
839
+ * @interface
840
+ */
841
+ type PathProps = TupleToObjectWithPropNames<ParamsArray$5, StreamAgentParameterNames$5> & {
842
+ onDrawComplete?: () => void;
843
+ };
844
+ /**
845
+ * Path component.
846
+ *
847
+ * A Path indicates a route on the map.
848
+ *
849
+ * @category Components
850
+ *
851
+ * @example
852
+ * ```tsx
853
+ * const space1 = mapData.getByType('space')[0];
854
+ * const space2 = mapData.getByType('space')[1];
855
+ * const directions = mapView.getDirections(space1, space2);
856
+ *
857
+ * return directions ? <Path coordinate={directions.coordinates} options={{ color: 'blue' }} /> : null;
858
+ * ```
859
+ */
860
+ declare const Path: react1.ForwardRefExoticComponent<TupleToObjectWithPropNames<[coordinates: _mappedin_mappedin_js0.Coordinate[], options?: ({
861
+ id?: string;
862
+ } & _mappedin_mappedin_js0.TAddPathOptions) | undefined], StreamAgentParameterNames$5> & {
863
+ onDrawComplete?: () => void;
864
+ } & react1.RefAttributes<Path$1 | undefined>>;
865
+ //#endregion
866
+ //#region src/Navigation.d.ts
867
+ type ParamsArray$4 = Parameters<MapView$1['Navigation']['draw']>;
868
+ type StreamAgentParameterNames$4 = ['directions', 'options'];
869
+ /**
870
+ * @interface
871
+ */
872
+ type NavigationProps = TupleToObjectWithPropNames<ParamsArray$4, StreamAgentParameterNames$4> & {
873
+ onDrawComplete?: () => void;
874
+ };
875
+ /**
876
+ * Navigation component.
877
+ *
878
+ * Navigation draws a route on the map with pre-defined Markers for connections and the start and end points.
879
+ *
880
+ * @category Components
881
+ *
882
+ * @example
883
+ * ```tsx
884
+ * const space1 = mapData.getByType('space')[0];
885
+ * const space2 = mapData.getByType('space')[1];
886
+ * const directions = mapView.getDirections(space1, space2);
887
+ *
888
+ * return directions ? <Navigation directions={directions} /> : null;
889
+ * ```
890
+ */
891
+ declare function Navigation(props: NavigationProps): null;
892
+ //#endregion
893
+ //#region src/Shape.d.ts
894
+ type ParamsArray$3 = Parameters<MapView$1['Shapes']['add']>;
895
+ type StreamAgentParameterNames$3 = ['geometry', 'style', 'floor'];
896
+ /**
897
+ * @interface
898
+ */
899
+ type ShapeProps = TupleToObjectWithPropNames<ParamsArray$3, StreamAgentParameterNames$3>;
900
+ /**
901
+ * Shape component.
902
+ *
903
+ * A Shape is a custom geometry on the map created from a GeoJSON feature collection.
904
+ *
905
+ * @category Components
906
+ *
907
+ * @example
908
+ * ```tsx
909
+ * <Shape geometry={geojson} style={{ color: 'blue', height: 2 }} />
910
+ * ```
911
+ */
912
+ declare const Shape: react1.ForwardRefExoticComponent<ShapeProps & react1.RefAttributes<Shape$1 | undefined>>;
913
+ //#endregion
914
+ //#region src/Model.d.ts
915
+ type ParamsArray$2 = Parameters<MapView$1['Models']['add']>;
916
+ type StreamAgentParameterNames$2 = ['coordinate', 'url', 'options'];
917
+ /**
918
+ * @interface
919
+ */
920
+ type ModelProps = TupleToObjectWithPropNames<ParamsArray$2, StreamAgentParameterNames$2>;
921
+ /**
922
+ * Model component.
923
+ *
924
+ * A Model is a 3D model in GLTF or GLB format anchored to a Coordinate on the map.
925
+ *
926
+ * @category Components
927
+ *
928
+ * @example
929
+ * ```tsx
930
+ * <Model
931
+ * coordinate={coordinate}
932
+ * url={'/path/to/model.glb'}
933
+ * options={{
934
+ * scale: [0.01, 0.01, 0.01],
935
+ * rotation: [90, 0, 0],
936
+ * opacity: 0.5,
937
+ * }}
938
+ * />
939
+ * ```
940
+ */
941
+ declare const Model: react1.ForwardRefExoticComponent<ModelProps & react1.RefAttributes<Model$1 | undefined>>;
942
+ //#endregion
943
+ //#region src/hooks/useMap.d.ts
944
+ /**
945
+ * Hook to get the MapData and MapView from the current MapView context.
946
+ *
947
+ * Must be used within a {@link MapView} component.
948
+ * @throws If used outside of a {@link MapView} component.
949
+ *
950
+ * @category Hooks
951
+ *
952
+ * @example
953
+ * ```tsx
954
+ * const { mapData, mapView } = useMap();
955
+ * ```
956
+ */
957
+ declare function useMap(): {
958
+ mapData: MapData;
959
+ mapView: MapView$1;
960
+ };
961
+ //#endregion
962
+ //#region src/Marker.d.ts
963
+ type ParamsArray$1 = Parameters<MapView$1['Markers']['add']>;
964
+ type StreamAgentParameterNames$1 = ['target', 'contentHtml', 'options'];
965
+ /**
966
+ * @interface
967
+ */
968
+ type MarkerProps = Omit<TupleToObjectWithPropNames<ParamsArray$1, StreamAgentParameterNames$1>, 'contentHtml'>;
969
+ /**
970
+ * Marker component.
971
+ *
972
+ * A Marker is a 2D component anchored to a position on the map.
973
+ * To animate the Marker when its target changes, see {@link AnimatedMarker}.
974
+ *
975
+ * @example
976
+ * ```tsx
977
+ * <Marker target={mapData.getByType('space')[0]}>
978
+ * <div>Hello, world!</div>
979
+ * </Marker>
980
+ * ```
981
+ *
982
+ * @category Components
983
+ */
984
+ declare const Marker: React.ForwardRefExoticComponent<MarkerProps & {
985
+ children?: React.ReactNode | undefined;
986
+ } & React.RefAttributes<Marker$1 | undefined>>;
987
+ /**
988
+ * AnimatedMarker component.
989
+ * @experimental
990
+ *
991
+ * A {@link Marker} component that animates between positions when its target changes.
992
+ *
993
+ * @example
994
+ * ```tsx
995
+ * <AnimatedMarker target={mapData.getByType('space')[0]} duration={1000}>
996
+ * <div>Hello, world!</div>
997
+ * </AnimatedMarker>
998
+ * ```
999
+ *
1000
+ * @category Components
1001
+ */
1002
+ declare const AnimatedMarker: React.ForwardRefExoticComponent<MarkerProps & TAnimationOptions & {
1003
+ children?: React.ReactNode | undefined;
1004
+ } & React.RefAttributes<Marker$1 | undefined>>;
1005
+ //#endregion
1006
+ //#region src/Label.d.ts
1007
+ type ParamsArray = Parameters<MapView$1['Labels']['add']>;
1008
+ type StreamAgentParameterNames = ['target', 'text', 'options'];
1009
+ /**
1010
+ * @interface
1011
+ */
1012
+ type LabelProps = TupleToObjectWithPropNames<ParamsArray, StreamAgentParameterNames>;
1013
+ /**
1014
+ * Label component.
1015
+ *
1016
+ * A Label is a 2D text label anchored to a position on the map.
1017
+ *
1018
+ * @category Components
1019
+ *
1020
+ * @example
1021
+ * ```tsx
1022
+ * <Label target={mapData.getByType('space')[0]} text={"Hello, world!"} />
1023
+ * ```
1024
+ */
1025
+ declare const Label: react1.ForwardRefExoticComponent<LabelProps & react1.RefAttributes<Label$1 | undefined>>;
1026
+ //#endregion
1027
+ export { AnimatedMarker, Label, type LabelProps, MapDataProvider, type MapDataProviderProps, MapView, type MapViewProps, Marker, type MarkerProps, Model, type ModelProps, Navigation, type NavigationProps, Path, type PathProps, Shape, type ShapeProps, useMap, useMapData, useMapDataEvent, useMapViewEvent, useMapViewExtension };