@mappedin/react-sdk 6.13.0 → 6.14.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.
@@ -56,7 +56,7 @@ declare function useMapDataEvent<T extends keyof TMapDataEvents>(event: T, callb
56
56
  data: null;
57
57
  } ? TMapDataEvents[T]['data'] : TMapDataEvents[T]) => void): void;
58
58
  //#endregion
59
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/primitive.d.ts
59
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/primitive.d.ts
60
60
  /**
61
61
  Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
62
62
 
@@ -64,7 +64,7 @@ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/
64
64
  */
65
65
  type Primitive = null | undefined | string | number | boolean | symbol | bigint;
66
66
  //#endregion
67
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-any.d.ts
67
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/is-any.d.ts
68
68
  /**
69
69
  Returns a boolean for whether the given type is `any`.
70
70
 
@@ -79,8 +79,8 @@ import type {IsAny} from 'type-fest';
79
79
  const typedObject = {a: 1, b: 2} as const;
80
80
  const anyObject: any = {a: 1, b: 2};
81
81
 
82
- function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(obj: O, key: K) {
83
- return obj[key];
82
+ function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(object: O, key: K) {
83
+ return object[key];
84
84
  }
85
85
 
86
86
  const typedA = get(typedObject, 'a');
@@ -95,7 +95,7 @@ const anyA = get(anyObject, 'a');
95
95
  */
96
96
  type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
97
97
  //#endregion
98
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-optional-key-of.d.ts
98
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/is-optional-key-of.d.ts
99
99
  /**
100
100
  Returns a boolean for whether the given key is an optional key of type.
101
101
 
@@ -105,17 +105,17 @@ This is useful when writing utility types or schema validators that need to diff
105
105
  ```
106
106
  import type {IsOptionalKeyOf} from 'type-fest';
107
107
 
108
- interface User {
108
+ type User = {
109
109
  name: string;
110
110
  surname: string;
111
111
 
112
112
  luckyNumber?: number;
113
- }
113
+ };
114
114
 
115
- interface Admin {
115
+ type Admin = {
116
116
  name: string;
117
117
  surname?: string;
118
- }
118
+ };
119
119
 
120
120
  type T1 = IsOptionalKeyOf<User, 'luckyNumber'>;
121
121
  //=> true
@@ -138,7 +138,7 @@ type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
138
138
  */
139
139
  type IsOptionalKeyOf<Type extends object, Key$1 extends keyof Type> = IsAny<Type | Key$1> extends true ? never : Key$1 extends keyof Type ? Type extends Record<Key$1, Type[Key$1]> ? false : true : false;
140
140
  //#endregion
141
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/optional-keys-of.d.ts
141
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/optional-keys-of.d.ts
142
142
  /**
143
143
  Extract all optional keys from the given type.
144
144
 
@@ -148,12 +148,12 @@ This is useful when you want to create a new type that contains different type v
148
148
  ```
149
149
  import type {OptionalKeysOf, Except} from 'type-fest';
150
150
 
151
- interface User {
151
+ type User = {
152
152
  name: string;
153
153
  surname: string;
154
154
 
155
155
  luckyNumber?: number;
156
- }
156
+ };
157
157
 
158
158
  const REMOVE_FIELD = Symbol('remove field symbol');
159
159
  type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKeysOf<Entity>> & {
@@ -161,12 +161,12 @@ type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKe
161
161
  };
162
162
 
163
163
  const update1: UpdateOperation<User> = {
164
- name: 'Alice'
164
+ name: 'Alice',
165
165
  };
166
166
 
167
167
  const update2: UpdateOperation<User> = {
168
168
  name: 'Bob',
169
- luckyNumber: REMOVE_FIELD
169
+ luckyNumber: REMOVE_FIELD,
170
170
  };
171
171
  ```
172
172
 
@@ -176,7 +176,7 @@ type OptionalKeysOf<Type extends object> = Type extends unknown // For distribut
176
176
  ? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
177
177
  : never;
178
178
  //#endregion
179
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/required-keys-of.d.ts
179
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/required-keys-of.d.ts
180
180
  /**
181
181
  Extract all required keys from the given type.
182
182
 
@@ -186,17 +186,23 @@ This is useful when you want to create a new type that contains different type v
186
186
  ```
187
187
  import type {RequiredKeysOf} from 'type-fest';
188
188
 
189
- declare function createValidation<Entity extends object, Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>>(field: Key, validator: (value: Entity[Key]) => boolean): ValidatorFn;
189
+ declare function createValidation<
190
+ Entity extends object,
191
+ Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>,
192
+ >(field: Key, validator: (value: Entity[Key]) => boolean): (entity: Entity) => boolean;
190
193
 
191
- interface User {
194
+ type User = {
192
195
  name: string;
193
196
  surname: string;
194
-
195
197
  luckyNumber?: number;
196
- }
198
+ };
197
199
 
198
200
  const validator1 = createValidation<User>('name', value => value.length < 25);
199
201
  const validator2 = createValidation<User>('surname', value => value.length < 25);
202
+
203
+ // @ts-expect-error
204
+ const validator3 = createValidation<User>('luckyNumber', value => value > 0);
205
+ // Error: Argument of type '"luckyNumber"' is not assignable to parameter of type '"name" | "surname"'.
200
206
  ```
201
207
 
202
208
  @category Utilities
@@ -204,7 +210,7 @@ const validator2 = createValidation<User>('surname', value => value.length < 25)
204
210
  type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
205
211
  ? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
206
212
  //#endregion
207
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-never.d.ts
213
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/is-never.d.ts
208
214
  /**
209
215
  Returns a boolean for whether the given type is `never`.
210
216
 
@@ -218,29 +224,41 @@ Useful in type utilities, such as checking if something does not occur.
218
224
  ```
219
225
  import type {IsNever, And} from 'type-fest';
220
226
 
221
- // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts
222
- type AreStringsEqual<A extends string, B extends string> =
223
- And<
224
- IsNever<Exclude<A, B>> extends true ? true : false,
225
- IsNever<Exclude<B, A>> extends true ? true : false
226
- >;
227
-
228
- type EndIfEqual<I extends string, O extends string> =
229
- AreStringsEqual<I, O> extends true
230
- ? never
231
- : void;
232
-
233
- function endIfEqual<I extends string, O extends string>(input: I, output: O): EndIfEqual<I, O> {
234
- if (input === output) {
235
- process.exit(0);
236
- }
237
- }
227
+ type A = IsNever<never>;
228
+ //=> true
238
229
 
239
- endIfEqual('abc', 'abc');
230
+ type B = IsNever<any>;
231
+ //=> false
232
+
233
+ type C = IsNever<unknown>;
234
+ //=> false
235
+
236
+ type D = IsNever<never[]>;
237
+ //=> false
238
+
239
+ type E = IsNever<object>;
240
+ //=> false
241
+
242
+ type F = IsNever<string>;
243
+ //=> false
244
+ ```
245
+
246
+ @example
247
+ ```
248
+ import type {IsNever} from 'type-fest';
249
+
250
+ type IsTrue<T> = T extends true ? true : false;
251
+
252
+ // When a distributive conditional is instantiated with `never`, the entire conditional results in `never`.
253
+ type A = IsTrue<never>;
240
254
  //=> never
241
255
 
242
- endIfEqual('abc', '123');
243
- //=> void
256
+ // If you don't want that behaviour, you can explicitly add an `IsNever` check before the distributive conditional.
257
+ type IsTrueFixed<T> =
258
+ IsNever<T> extends true ? false : T extends true ? true : false;
259
+
260
+ type B = IsTrueFixed<never>;
261
+ //=> false
244
262
  ```
245
263
 
246
264
  @category Type Guard
@@ -248,7 +266,7 @@ endIfEqual('abc', '123');
248
266
  */
249
267
  type IsNever<T> = [T] extends [never] ? true : false;
250
268
  //#endregion
251
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/if.d.ts
269
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/if.d.ts
252
270
  /**
253
271
  An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
254
272
 
@@ -261,7 +279,7 @@ Note:
261
279
 
262
280
  @example
263
281
  ```
264
- import {If} from 'type-fest';
282
+ import type {If} from 'type-fest';
265
283
 
266
284
  type A = If<true, 'yes', 'no'>;
267
285
  //=> 'yes'
@@ -281,7 +299,7 @@ type E = If<never, 'yes', 'no'>;
281
299
 
282
300
  @example
283
301
  ```
284
- import {If, IsAny, IsNever} from 'type-fest';
302
+ import type {If, IsAny, IsNever} from 'type-fest';
285
303
 
286
304
  type A = If<IsAny<unknown>, 'is any', 'not any'>;
287
305
  //=> 'not any'
@@ -292,7 +310,7 @@ type B = If<IsNever<never>, 'is never', 'not never'>;
292
310
 
293
311
  @example
294
312
  ```
295
- import {If, IsEqual} from 'type-fest';
313
+ import type {If, IsEqual} from 'type-fest';
296
314
 
297
315
  type IfEqual<T, U, IfBranch, ElseBranch> = If<IsEqual<T, U>, IfBranch, ElseBranch>;
298
316
 
@@ -343,7 +361,7 @@ type Works = IncludesWithoutIf<HundredZeroes, '1'>;
343
361
  */
344
362
  type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
345
363
  //#endregion
346
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/internal/type.d.ts
364
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/internal/type.d.ts
347
365
  /**
348
366
  Matches any primitive, `void`, `Date`, or `RegExp` value.
349
367
  */
@@ -361,7 +379,7 @@ type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> = T
361
379
  (...arguments_: infer B): unknown;
362
380
  } ? B extends A ? A extends B ? false : true : true : false;
363
381
  //#endregion
364
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/simplify.d.ts
382
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/simplify.d.ts
365
383
  /**
366
384
  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.
367
385
 
@@ -407,10 +425,11 @@ const literal = {foo: 123, bar: 'hello', baz: 456};
407
425
  const someType: SomeType = literal;
408
426
  const someInterface: SomeInterface = literal;
409
427
 
410
- function fn(object: Record<string, unknown>): void {}
428
+ declare function fn(object: Record<string, unknown>): void;
411
429
 
412
430
  fn(literal); // Good: literal object type is sealed
413
431
  fn(someType); // Good: type is sealed
432
+ // @ts-expect-error
414
433
  fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
415
434
  fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
416
435
  ```
@@ -421,7 +440,7 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
421
440
  */
422
441
  type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
423
442
  //#endregion
424
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/omit-index-signature.d.ts
443
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/omit-index-signature.d.ts
425
444
  /**
426
445
  Omit any index signatures from the given object type, leaving only explicitly defined properties.
427
446
 
@@ -439,8 +458,9 @@ It relies on the fact that an empty object (`{}`) is assignable to an object wit
439
458
  ```
440
459
  const indexed: Record<string, unknown> = {}; // Allowed
441
460
 
461
+ // @ts-expect-error
442
462
  const keyed: Record<'foo', unknown> = {}; // Error
443
- // => TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
463
+ // TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
444
464
  ```
445
465
 
446
466
  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:
@@ -449,19 +469,21 @@ Instead of causing a type error like the above, you can also use a [conditional
449
469
  type Indexed = {} extends Record<string, unknown>
450
470
  ? '✅ `{}` is assignable to `Record<string, unknown>`'
451
471
  : '❌ `{}` is NOT assignable to `Record<string, unknown>`';
452
- // => '✅ `{}` is assignable to `Record<string, unknown>`'
472
+
473
+ type IndexedResult = Indexed;
474
+ //=> '✅ `{}` is assignable to `Record<string, unknown>`'
453
475
 
454
476
  type Keyed = {} extends Record<'foo' | 'bar', unknown>
455
- ? "✅ `{}` is assignable to `Record<'foo' | 'bar', unknown>`"
456
- : "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`";
457
- // => "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`"
477
+ ? '✅ `{}` is assignable to `Record<\'foo\' | \'bar\', unknown>`'
478
+ : '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`';
479
+
480
+ type KeyedResult = Keyed;
481
+ //=> '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`'
458
482
  ```
459
483
 
460
484
  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`...
461
485
 
462
486
  ```
463
- import type {OmitIndexSignature} from 'type-fest';
464
-
465
487
  type OmitIndexSignature<ObjectType> = {
466
488
  [KeyType in keyof ObjectType // Map each key of `ObjectType`...
467
489
  ]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
@@ -471,14 +493,12 @@ type OmitIndexSignature<ObjectType> = {
471
493
  ...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
472
494
 
473
495
  ```
474
- import type {OmitIndexSignature} from 'type-fest';
475
-
476
496
  type OmitIndexSignature<ObjectType> = {
477
497
  [KeyType in keyof ObjectType
478
- // Is `{}` assignable to `Record<KeyType, unknown>`?
479
- as {} extends Record<KeyType, unknown>
480
- ? ... // ✅ `{}` is assignable to `Record<KeyType, unknown>`
481
- : ... // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
498
+ // Is `{}` assignable to `Record<KeyType, unknown>`?
499
+ as {} extends Record<KeyType, unknown>
500
+ ? never // ✅ `{}` is assignable to `Record<KeyType, unknown>`
501
+ : KeyType // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
482
502
  ]: ObjectType[KeyType];
483
503
  };
484
504
  ```
@@ -489,24 +509,24 @@ If `{}` is assignable, it means that `KeyType` is an index signature and we want
489
509
  ```
490
510
  import type {OmitIndexSignature} from 'type-fest';
491
511
 
492
- interface Example {
512
+ type Example = {
493
513
  // These index signatures will be removed.
494
- [x: string]: any
495
- [x: number]: any
496
- [x: symbol]: any
497
- [x: `head-${string}`]: string
498
- [x: `${string}-tail`]: string
499
- [x: `head-${string}-tail`]: string
500
- [x: `${bigint}`]: string
501
- [x: `embedded-${number}`]: string
514
+ [x: string]: any;
515
+ [x: number]: any;
516
+ [x: symbol]: any;
517
+ [x: `head-${string}`]: string;
518
+ [x: `${string}-tail`]: string;
519
+ [x: `head-${string}-tail`]: string;
520
+ [x: `${bigint}`]: string;
521
+ [x: `embedded-${number}`]: string;
502
522
 
503
523
  // These explicitly defined keys will remain.
504
524
  foo: 'bar';
505
525
  qux?: 'baz';
506
- }
526
+ };
507
527
 
508
528
  type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
509
- // => { foo: 'bar'; qux?: 'baz' | undefined; }
529
+ //=> {foo: 'bar'; qux?: 'baz'}
510
530
  ```
511
531
 
512
532
  @see {@link PickIndexSignature}
@@ -514,7 +534,7 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
514
534
  */
515
535
  type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
516
536
  //#endregion
517
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/pick-index-signature.d.ts
537
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/pick-index-signature.d.ts
518
538
  /**
519
539
  Pick only index signatures from the given object type, leaving out all explicitly defined properties.
520
540
 
@@ -562,9 +582,9 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
562
582
  */
563
583
  type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
564
584
  //#endregion
565
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/merge.d.ts
585
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/merge.d.ts
566
586
  // Merges two objects without worrying about index signatures.
567
- type SimpleMerge<Destination, Source> = { [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source;
587
+ type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source>;
568
588
 
569
589
  /**
570
590
  Merge two types into a new type. Keys of the second type overrides keys of the first type.
@@ -573,12 +593,12 @@ Merge two types into a new type. Keys of the second type overrides keys of the f
573
593
  ```
574
594
  import type {Merge} from 'type-fest';
575
595
 
576
- interface Foo {
596
+ type Foo = {
577
597
  [x: string]: unknown;
578
598
  [x: number]: unknown;
579
599
  foo: string;
580
600
  bar: symbol;
581
- }
601
+ };
582
602
 
583
603
  type Bar = {
584
604
  [x: number]: number;
@@ -588,7 +608,7 @@ type Bar = {
588
608
  };
589
609
 
590
610
  export type FooBar = Merge<Foo, Bar>;
591
- // => {
611
+ //=> {
592
612
  // [x: string]: unknown;
593
613
  // [x: number]: number;
594
614
  // [x: symbol]: unknown;
@@ -598,11 +618,18 @@ export type FooBar = Merge<Foo, Bar>;
598
618
  // }
599
619
  ```
600
620
 
621
+ Note: If you want a merge type that more accurately reflects the runtime behavior of object spread or `Object.assign`, refer to the {@link ObjectMerge} type.
622
+
623
+ @see {@link ObjectMerge}
601
624
  @category Object
602
625
  */
603
- type Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
626
+ type Merge<Destination, Source> = Destination extends unknown // For distributing `Destination`
627
+ ? Source extends unknown // For distributing `Source`
628
+ ? Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>> : never // Should never happen
629
+ : never;
604
630
  //#endregion
605
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/internal/object.d.ts
631
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/internal/object.d.ts
632
+
606
633
  /**
607
634
  Merges user specified options with default options.
608
635
 
@@ -657,7 +684,7 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
657
684
  */
658
685
  type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Simplify<Merge<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? undefined extends SpecifiedOptions[Key] ? never : Key : Key]: SpecifiedOptions[Key] }> & Required<Options>>>>;
659
686
  //#endregion
660
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/partial-deep.d.ts
687
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/partial-deep.d.ts
661
688
  /**
662
689
  @see {@link PartialDeep}
663
690
  */
@@ -776,7 +803,7 @@ Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for
776
803
  */
777
804
  type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> = { [KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options> };
778
805
  //#endregion
779
- //#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/literal-union.d.ts
806
+ //#region ../../node_modules/.pnpm/type-fest@5.4.2/node_modules/type-fest/source/literal-union.d.ts
780
807
  /**
781
808
  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.
782
809
 
@@ -792,7 +819,7 @@ import type {LiteralUnion} from 'type-fest';
792
819
 
793
820
  type Pet = 'dog' | 'cat' | string;
794
821
 
795
- const pet: Pet = '';
822
+ const petWithoutAutocomplete: Pet = '';
796
823
  // Start typing in your TypeScript-enabled IDE.
797
824
  // You **will not** get auto-completion for `dog` and `cat` literals.
798
825
 
@@ -800,7 +827,7 @@ const pet: Pet = '';
800
827
 
801
828
  type Pet2 = LiteralUnion<'dog' | 'cat', string>;
802
829
 
803
- const pet: Pet2 = '';
830
+ const petWithAutoComplete: Pet2 = '';
804
831
  // You **will** get auto-completion for `dog` and `cat` literals.
805
832
  ```
806
833
 
package/lib/esm/index.js CHANGED
@@ -1 +1 @@
1
- var le=Object.create;var k=Object.defineProperty,Me=Object.defineProperties,xe=Object.getOwnPropertyDescriptor,ye=Object.getOwnPropertyDescriptors,we=Object.getOwnPropertyNames,L=Object.getOwnPropertySymbols,he=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var z=(e,r,t)=>r in e?k(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,y=(e,r)=>{for(var t in r||(r={}))A.call(r,t)&&z(e,t,r[t]);if(L)for(var t of L(r))H.call(r,t)&&z(e,t,r[t]);return e},C=(e,r)=>Me(e,ye(r)),p=(e,r)=>k(e,"name",{value:r,configurable:!0});var U=(e,r)=>{var t={};for(var a in e)A.call(e,a)&&r.indexOf(a)<0&&(t[a]=e[a]);if(e!=null&&L)for(var a of L(e))r.indexOf(a)<0&&H.call(e,a)&&(t[a]=e[a]);return t};var Ee=(e,r)=>()=>(e&&(r=e(e=0)),r);var Pe=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var ge=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of we(r))!A.call(e,o)&&o!==t&&k(e,o,{get:()=>r[o],enumerable:!(a=xe(r,o))||a.enumerable});return e};var q=(e,r,t)=>(t=e!=null?le(he(e)):{},ge(r||!e||!e.__esModule?k(t,"default",{value:e,enumerable:!0}):t,e));var u,n=Ee(()=>{u={env:{NODE_ENV:"production",npm_package_version:"6.13.0"}}});var I=Pe((Ht,K)=>{"use strict";n();K.exports=p(function e(r,t){if(r===t)return!0;if(r&&t&&typeof r=="object"&&typeof t=="object"){if(r.constructor!==t.constructor)return!1;var a,o,s;if(Array.isArray(r)){if(a=r.length,a!=t.length)return!1;for(o=a;o--!==0;)if(!e(r[o],t[o]))return!1;return!0}if(r.constructor===RegExp)return r.source===t.source&&r.flags===t.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===t.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===t.toString();if(s=Object.keys(r),a=s.length,a!==Object.keys(t).length)return!1;for(o=a;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,s[o]))return!1;for(o=a;o--!==0;){var i=s[o];if(!e(r[i],t[i]))return!1}return!0}return r!==r&&t!==t},"equal")});n();n();import Se,{createContext as Ve,useCallback as F,useMemo as Te,useRef as ve}from"react";var S=Ve({getCache:p(()=>{},"getCache"),setCache:p(()=>{},"setCache")});function j({mapData:e,children:r}){let t=ve(e?{mapData:e,options:{}}:void 0),a=F(()=>t.current,[]),o=F(i=>{t.current=i},[]),s=Te(()=>({getCache:a,setCache:o}),[a,o]);return Se.createElement(S.Provider,{value:s},r)}p(j,"MapDataProvider");n();var X=q(I());import{useCallback as Ne,useContext as Le,useEffect as Q,useRef as ke,useState as J}from"react";import{getMapData as be}from"@mappedin/mappedin-js";n();var Re="[MappedinJS]";function Ce(e="",{prefix:r=Re}={}){let t="".concat(r).concat(e?"-".concat(e):""),a=p((o,s)=>{if(typeof window<"u"&&window.rnDebug){let i=s.map(M=>M instanceof Error&&M.stack?"".concat(M.message,"\n").concat(M.stack):M);window.rnDebug("".concat(e," ").concat(o,": ").concat(i.join(" ")))}},"rnDebug");return{logState:u.env.NODE_ENV==="test"?3:0,log(...o){this.logState<=0&&(console.log(t,...o),a("log",o))},warn(...o){this.logState<=1&&(console.warn(t,...o),a("warn",o))},error(...o){this.logState<=2&&(console.error(t,...o),a("error",o))},assert(...o){console.assert(...o)},time(o){console.time(o)},timeEnd(o){console.timeEnd(o)},setLevel(o){0<=o&&o<=3&&(this.logState=o)}}}p(Ce,"createLogger");var Oe=Ce();var T=Oe;n();var Y=q(I());import{useRef as B}from"react";function l(e,r){let t=B(void 0),a=B(void 0);return(0,Y.default)(r,a.current)||(t.current=e(),a.current=r),t.current}p(l,"useMemoDeep");function Ae(e){let{getCache:r,setCache:t}=Le(S),[a,o]=J(void 0),[s,i]=J(!0),[M,m]=J(void 0),g=ke(0),d=l(()=>e&&C(y({},e),{analytics:y({context:"reactsdk"},e==null?void 0:e.analytics)}),[e]),V=Ne(w=>{let D=++g.current;i(!0),m(void 0),be(w).then(h=>{g.current===D&&o(h)}).catch(h=>{g.current===D&&(T.error("Failed to fetch MapData",h),m(h))}).finally(()=>{g.current===D&&i(!1)})},[]);return Q(()=>{let w=r==null?void 0:r();if(w!=null&&(d==null||w.mapData.mapId===d.mapId&&(0,X.default)(w.options,d))){o(w.mapData),i(!1),m(void 0);return}if(!d){m(new Error("useMapData requires options if not use within a MapDataProvider or MapView component."));return}V(d)},[V,r,d]),Q(()=>{let w=r==null?void 0:r();a!=null&&(w==null||w.mapData.mapId===a.mapId)&&(t==null||t({mapData:a,options:d||{}}))},[a,d,r,t]),{mapData:a,isLoading:s,error:M}}p(Ae,"useMapData");n();import{useCallback as je,useContext as Ie,useEffect as Je}from"react";function We(e,r){let{getCache:t}=Ie(S),a=je(o=>r(o),[r]);Je(()=>{var s;let o=(s=t==null?void 0:t())==null?void 0:s.mapData;if(o==null)throw new Error("useMapDataEvent must be used within a MapDataProvider or MapView component.");return o.on(e,a),()=>{o!=null&&o.off(e,a)}},[t,e,a])}p(We,"useMapDataEvent");n();import O,{useCallback as Z,useEffect as _e,useMemo as ee,useRef as te,useState as re,forwardRef as Ge,useImperativeHandle as $e,createContext as ze}from"react";import{show3dMap as He}from"@mappedin/mappedin-js";var f=ze({mapView:void 0,extensions:{}}),Ue={width:"100%",height:"100%",position:"relative"},qe=Ge((e,r)=>{let $=e,{mapData:t,options:a,style:o,fallback:s,children:i}=$,M=U($,["mapData","options","style","fallback","children"]),m=te({extensions:{}}).current,[g,d]=re(!0),[V,w]=re(!1),D=te(null),h=ee(()=>t,[t]),G=l(()=>a,[a]);$e(r,()=>m.mapView);let ce=ee(()=>({mapView:m.mapView,extensions:m.extensions}),[h,m.mapView,m.extensions]),de=Z(E=>{try{let x=Object.keys(E);for(let v of x){let R=E[v];R&&(R.onDeregister(R.instance),delete E[v])}}catch(x){T.error("Failed to clean up extensions",x)}return{}},[]),N=Z(E=>{var v;let x=E||m.mapView;try{(v=x==null?void 0:x.destroy)==null||v.call(x)}catch(R){T.error("Failed to destroy MapView",R)}E||(m.extensions=de(m.extensions),m.mapView=void 0,w(!1))},[]);return _e(()=>{if(!h||!D.current)return;N();let E=!1;return d(!0),He(D.current,h,G).then(x=>{E?N(x):(m.mapView=x,w(!0))}).catch(x=>{T.error("Failed to render MapView",x)}).finally(()=>{E||d(!1)}),()=>{E=!0,m.mapView&&N()}},[h,G,N]),O.createElement(j,{mapData:h},O.createElement(f.Provider,{value:ce},O.createElement("div",y({"data-testid":"mappedin-map",ref:D,style:y(y({},Ue),o)},M)),g?O.createElement(O.Fragment,null,s):V?i:null))});n();import{useCallback as Fe,useContext as Ke,useEffect as Be}from"react";n();var W=class W extends Error{constructor(r){super("".concat(r," must be used within a MapView component."))}};p(W,"MapViewNullError");var c=W;function Ye(e,r){let{mapView:t}=Ke(f),a=Fe(o=>r(o),[r]);Be(()=>{if(t==null)throw new c("useMapViewEvent");return t.on(e,a),()=>{t!=null&&t.off(e,a)}},[t,e,r])}p(Ye,"useMapViewEvent");n();import{useCallback as ae,useContext as Qe}from"react";function Xe(e,r){let{extensions:t}=Qe(f);if(!(r!=null&&r.onRegister)||!(r!=null&&r.onDeregister))throw new Error("onRegister and onDeregister are required");let a=ae(()=>{let s=t[e],i=s==null?void 0:s.instance;return i||(i=r.onRegister(),t[e]={instance:i,onDeregister:r.onDeregister}),i},[t,e,r.onRegister]),o=ae(()=>{let s=t[e];s&&(s.onDeregister(s.instance),delete t[e])},[t,e,r.onDeregister]);return{register:a,deregister:o}}p(Xe,"useMapViewExtension");n();import{useContext as tt,useEffect as rt,useRef as at,forwardRef as ot,useImperativeHandle as nt,useState as it}from"react";n();import{useEffect as Ze,useRef as et}from"react";function P(e,r){let t=et(!0);Ze(()=>{if(t.current){t.current=!1;return}return e()},r)}p(P,"useUpdateEffect");var st=ot((e,r)=>{let{mapView:t}=tt(f),a=at(void 0),o=l(()=>e.options,[e.options]),[s,i]=it(!1);return nt(r,()=>a.current,[s]),rt(()=>{if(t==null)throw new c("Path");let M=t.Paths.add(e.coordinate,o);return M.animation.then(()=>{var m;(m=e.onDrawComplete)==null||m.call(e)}),a.current=M,i(!0),()=>{a.current&&t.Paths.remove(a.current),i(!1)}},[t,e.coordinate]),P(()=>{a.current&&o&&(t==null||t.updateState(a.current,o))},[o]),null});n();import{useContext as pt,useEffect as mt}from"react";function ut(e){let{mapView:r}=pt(f),t=l(()=>e.options,[e.options]);return mt(()=>{if(r==null)throw new c("Navigation");return r.Navigation.draw(e.directions,t).then(()=>{var a;(a=e.onDrawComplete)==null||a.call(e)}),()=>{r.Navigation.clear()}},[r,e.directions,t]),null}p(ut,"Navigation");n();import{useContext as ft,useEffect as ct,useRef as dt,forwardRef as lt,useImperativeHandle as Mt,useState as xt}from"react";var yt=lt((e,r)=>{let{mapView:t}=ft(f),a=dt(void 0),o=l(()=>e.style,[e.style]),[s,i]=xt(!1);return Mt(r,()=>a.current,[s]),ct(()=>{if(t==null)throw new Error("MapView not initialized");return a.current=t.Shapes.add(e.geometry,e.style,e.floor),i(!0),()=>{t==null||a.current==null||(t.Shapes.remove(a.current),i(!1))}},[t,e.geometry,e.style,e.floor]),P(()=>{a.current&&o&&(t==null||t.updateState(a.current,o))},[o]),null});n();import{useContext as wt,useEffect as ht,useRef as Et,forwardRef as Pt,useImperativeHandle as gt,useState as Dt}from"react";var St=Pt((e,r)=>{let{mapView:t}=wt(f),a=Et(void 0),o=l(()=>e.options,[e.options]),[s,i]=Dt(!1);return gt(r,()=>a.current,[s]),ht(()=>{if(t==null)throw new c("Model");return a.current=t.Models.add(e.coordinate,e.url,o),i(!0),()=>{t==null||a.current==null||(t.Models.remove(a.current),i(!1))}},[t,e.url]),P(()=>{a.current&&(t==null||t.updateState(a.current,y({position:e.coordinate},o)))},[e.coordinate,o]),null});n();import{useContext as oe}from"react";function Vt(){var t;let{mapView:e}=oe(f),{getCache:r}=oe(S);if(!e)throw new c("useMap");return{mapData:((t=r==null?void 0:r())==null?void 0:t.mapData)||e.getMapData(),mapView:e}}p(Vt,"useMap");n();import Tt,{useCallback as vt,useContext as ie,useEffect as se,useMemo as Rt,useRef as b,forwardRef as pe,useImperativeHandle as me,useState as ue}from"react";import{createPortal as Ct}from"react-dom";n();var _=[0,4,6,8,10],ne=p(()=>{let e=new Array(16).fill(0),r=Math.random()*4294967296;for(let a=0;a<e.length;a++)a>0&&(a&3)===0&&(r=Math.random()*4294967296),e[a]=r>>>((a&3)<<3)&255;let t=e.map(a=>a.toString(16).padStart(2,"0"));return t[6]="4"+t[6][1],t[8]=["8","9","a","b"].includes(t[7][0])?t[7]:"a"+t[7][1],_.map((a,o)=>t.slice(a,o===_.length-1?void 0:_[o+1]).join("")).join("-")},"randomId");var fe=pe((e,r)=>{let{mapView:t}=ie(f),a=b(void 0),[o,s]=ue(!1),i=l(()=>e.options,[e.options]);return me(r,()=>a.current,[o]),se(()=>{if(t==null)throw new c("Marker");return a.current=t.Markers.add(e.target,"",i),s(!0),()=>{t==null||a.current==null||(t.Markers.remove(a.current),s(!1))}},[t,e.target]),P(()=>{a.current&&i&&(t==null||t.updateState(a.current,i))},[i]),t==null||a.current==null?null:Ct(e.children,a.current.contentEl,a.current.id)}),Ot=pe((e,r)=>{let{mapView:t}=ie(f),a=b(ne()),o=b(void 0),[s,i]=ue(!1),M=b(e.target);me(r,()=>o.current,[s]);let m=vt(d=>{o.current=d||void 0,i(!!d)},[]);se(()=>{if(t==null)throw new c("Marker");if(o.current&&o.current.target!==e.target){let{duration:d=300,easing:V="linear"}=e;t.Markers.animateTo(o.current,e.target,{duration:d,easing:V})}return()=>{i(!1)}},[t,e.target]);let g=Rt(()=>C(y({},e),{duration:void 0,easing:void 0}),[e.duration,e.easing]);return Tt.createElement(fe,C(y({},g),{key:a.current,target:M.current,ref:m}))});n();import{forwardRef as Nt,useContext as Lt,useEffect as kt,useImperativeHandle as bt,useRef as At,useState as jt}from"react";var It=Nt((e,r)=>{let{mapView:t}=Lt(f),a=At(void 0),[o,s]=jt(!1),i=l(()=>e.options,[e.options]);return bt(r,()=>a.current,[o]),kt(()=>{if(t==null)throw new c("Label");return a.current=t.Labels.add(e.target,e.text,i),s(!0),()=>{t==null||a.current==null||(t.Labels.remove(a.current),s(!1))}},[t,e.target]),P(()=>{a.current&&(t==null||t.updateState(a.current,y({text:e.text},i)))},[e.text,i]),null});export{Ot as AnimatedMarker,It as Label,j as MapDataProvider,qe as MapView,fe as Marker,St as Model,ut as Navigation,st as Path,yt as Shape,Vt as useMap,Ae as useMapData,We as useMapDataEvent,Ye as useMapViewEvent,Xe as useMapViewExtension};
1
+ var le=Object.create;var k=Object.defineProperty,Me=Object.defineProperties,xe=Object.getOwnPropertyDescriptor,ye=Object.getOwnPropertyDescriptors,we=Object.getOwnPropertyNames,L=Object.getOwnPropertySymbols,he=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var z=(e,r,t)=>r in e?k(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,y=(e,r)=>{for(var t in r||(r={}))A.call(r,t)&&z(e,t,r[t]);if(L)for(var t of L(r))H.call(r,t)&&z(e,t,r[t]);return e},C=(e,r)=>Me(e,ye(r)),p=(e,r)=>k(e,"name",{value:r,configurable:!0});var U=(e,r)=>{var t={};for(var a in e)A.call(e,a)&&r.indexOf(a)<0&&(t[a]=e[a]);if(e!=null&&L)for(var a of L(e))r.indexOf(a)<0&&H.call(e,a)&&(t[a]=e[a]);return t};var Ee=(e,r)=>()=>(e&&(r=e(e=0)),r);var Pe=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var ge=(e,r,t,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of we(r))!A.call(e,o)&&o!==t&&k(e,o,{get:()=>r[o],enumerable:!(a=xe(r,o))||a.enumerable});return e};var q=(e,r,t)=>(t=e!=null?le(he(e)):{},ge(r||!e||!e.__esModule?k(t,"default",{value:e,enumerable:!0}):t,e));var u,n=Ee(()=>{u={env:{NODE_ENV:"production",npm_package_version:"6.14.0"}}});var I=Pe((Ht,K)=>{"use strict";n();K.exports=p(function e(r,t){if(r===t)return!0;if(r&&t&&typeof r=="object"&&typeof t=="object"){if(r.constructor!==t.constructor)return!1;var a,o,s;if(Array.isArray(r)){if(a=r.length,a!=t.length)return!1;for(o=a;o--!==0;)if(!e(r[o],t[o]))return!1;return!0}if(r.constructor===RegExp)return r.source===t.source&&r.flags===t.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===t.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===t.toString();if(s=Object.keys(r),a=s.length,a!==Object.keys(t).length)return!1;for(o=a;o--!==0;)if(!Object.prototype.hasOwnProperty.call(t,s[o]))return!1;for(o=a;o--!==0;){var i=s[o];if(!e(r[i],t[i]))return!1}return!0}return r!==r&&t!==t},"equal")});n();n();import Se,{createContext as Ve,useCallback as F,useMemo as Te,useRef as ve}from"react";var S=Ve({getCache:p(()=>{},"getCache"),setCache:p(()=>{},"setCache")});function j({mapData:e,children:r}){let t=ve(e?{mapData:e,options:{}}:void 0),a=F(()=>t.current,[]),o=F(i=>{t.current=i},[]),s=Te(()=>({getCache:a,setCache:o}),[a,o]);return Se.createElement(S.Provider,{value:s},r)}p(j,"MapDataProvider");n();var X=q(I());import{useCallback as Ne,useContext as Le,useEffect as Q,useRef as ke,useState as J}from"react";import{getMapData as be}from"@mappedin/mappedin-js";n();var Re="[MappedinJS]";function Ce(e="",{prefix:r=Re}={}){let t="".concat(r).concat(e?"-".concat(e):""),a=p((o,s)=>{if(typeof window<"u"&&window.rnDebug){let i=s.map(M=>M instanceof Error&&M.stack?"".concat(M.message,"\n").concat(M.stack):M);window.rnDebug("".concat(e," ").concat(o,": ").concat(i.join(" ")))}},"rnDebug");return{logState:u.env.NODE_ENV==="test"?3:0,log(...o){this.logState<=0&&(console.log(t,...o),a("log",o))},warn(...o){this.logState<=1&&(console.warn(t,...o),a("warn",o))},error(...o){this.logState<=2&&(console.error(t,...o),a("error",o))},assert(...o){console.assert(...o)},time(o){console.time(o)},timeEnd(o){console.timeEnd(o)},setLevel(o){0<=o&&o<=3&&(this.logState=o)}}}p(Ce,"createLogger");var Oe=Ce();var T=Oe;n();var Y=q(I());import{useRef as B}from"react";function l(e,r){let t=B(void 0),a=B(void 0);return(0,Y.default)(r,a.current)||(t.current=e(),a.current=r),t.current}p(l,"useMemoDeep");function Ae(e){let{getCache:r,setCache:t}=Le(S),[a,o]=J(void 0),[s,i]=J(!0),[M,m]=J(void 0),g=ke(0),d=l(()=>e&&C(y({},e),{analytics:y({context:"reactsdk"},e==null?void 0:e.analytics)}),[e]),V=Ne(w=>{let D=++g.current;i(!0),m(void 0),be(w).then(h=>{g.current===D&&o(h)}).catch(h=>{g.current===D&&(T.error("Failed to fetch MapData",h),m(h))}).finally(()=>{g.current===D&&i(!1)})},[]);return Q(()=>{let w=r==null?void 0:r();if(w!=null&&(d==null||w.mapData.mapId===d.mapId&&(0,X.default)(w.options,d))){o(w.mapData),i(!1),m(void 0);return}if(!d){m(new Error("useMapData requires options if not use within a MapDataProvider or MapView component."));return}V(d)},[V,r,d]),Q(()=>{let w=r==null?void 0:r();a!=null&&(w==null||w.mapData.mapId===a.mapId)&&(t==null||t({mapData:a,options:d||{}}))},[a,d,r,t]),{mapData:a,isLoading:s,error:M}}p(Ae,"useMapData");n();import{useCallback as je,useContext as Ie,useEffect as Je}from"react";function We(e,r){let{getCache:t}=Ie(S),a=je(o=>r(o),[r]);Je(()=>{var s;let o=(s=t==null?void 0:t())==null?void 0:s.mapData;if(o==null)throw new Error("useMapDataEvent must be used within a MapDataProvider or MapView component.");return o.on(e,a),()=>{o!=null&&o.off(e,a)}},[t,e,a])}p(We,"useMapDataEvent");n();import O,{useCallback as Z,useEffect as _e,useMemo as ee,useRef as te,useState as re,forwardRef as Ge,useImperativeHandle as $e,createContext as ze}from"react";import{show3dMap as He}from"@mappedin/mappedin-js";var f=ze({mapView:void 0,extensions:{}}),Ue={width:"100%",height:"100%",position:"relative"},qe=Ge((e,r)=>{let $=e,{mapData:t,options:a,style:o,fallback:s,children:i}=$,M=U($,["mapData","options","style","fallback","children"]),m=te({extensions:{}}).current,[g,d]=re(!0),[V,w]=re(!1),D=te(null),h=ee(()=>t,[t]),G=l(()=>a,[a]);$e(r,()=>m.mapView);let ce=ee(()=>({mapView:m.mapView,extensions:m.extensions}),[h,m.mapView,m.extensions]),de=Z(E=>{try{let x=Object.keys(E);for(let v of x){let R=E[v];R&&(R.onDeregister(R.instance),delete E[v])}}catch(x){T.error("Failed to clean up extensions",x)}return{}},[]),N=Z(E=>{var v;let x=E||m.mapView;try{(v=x==null?void 0:x.destroy)==null||v.call(x)}catch(R){T.error("Failed to destroy MapView",R)}E||(m.extensions=de(m.extensions),m.mapView=void 0,w(!1))},[]);return _e(()=>{if(!h||!D.current)return;N();let E=!1;return d(!0),He(D.current,h,G).then(x=>{E?N(x):(m.mapView=x,w(!0))}).catch(x=>{T.error("Failed to render MapView",x)}).finally(()=>{E||d(!1)}),()=>{E=!0,m.mapView&&N()}},[h,G,N]),O.createElement(j,{mapData:h},O.createElement(f.Provider,{value:ce},O.createElement("div",y({"data-testid":"mappedin-map",ref:D,style:y(y({},Ue),o)},M)),g?O.createElement(O.Fragment,null,s):V?i:null))});n();import{useCallback as Fe,useContext as Ke,useEffect as Be}from"react";n();var W=class W extends Error{constructor(r){super("".concat(r," must be used within a MapView component."))}};p(W,"MapViewNullError");var c=W;function Ye(e,r){let{mapView:t}=Ke(f),a=Fe(o=>r(o),[r]);Be(()=>{if(t==null)throw new c("useMapViewEvent");return t.on(e,a),()=>{t!=null&&t.off(e,a)}},[t,e,r])}p(Ye,"useMapViewEvent");n();import{useCallback as ae,useContext as Qe}from"react";function Xe(e,r){let{extensions:t}=Qe(f);if(!(r!=null&&r.onRegister)||!(r!=null&&r.onDeregister))throw new Error("onRegister and onDeregister are required");let a=ae(()=>{let s=t[e],i=s==null?void 0:s.instance;return i||(i=r.onRegister(),t[e]={instance:i,onDeregister:r.onDeregister}),i},[t,e,r.onRegister]),o=ae(()=>{let s=t[e];s&&(s.onDeregister(s.instance),delete t[e])},[t,e,r.onDeregister]);return{register:a,deregister:o}}p(Xe,"useMapViewExtension");n();import{useContext as tt,useEffect as rt,useRef as at,forwardRef as ot,useImperativeHandle as nt,useState as it}from"react";n();import{useEffect as Ze,useRef as et}from"react";function P(e,r){let t=et(!0);Ze(()=>{if(t.current){t.current=!1;return}return e()},r)}p(P,"useUpdateEffect");var st=ot((e,r)=>{let{mapView:t}=tt(f),a=at(void 0),o=l(()=>e.options,[e.options]),[s,i]=it(!1);return nt(r,()=>a.current,[s]),rt(()=>{if(t==null)throw new c("Path");let M=t.Paths.add(e.coordinate,o);return M.animation.then(()=>{var m;(m=e.onDrawComplete)==null||m.call(e)}),a.current=M,i(!0),()=>{a.current&&t.Paths.remove(a.current),i(!1)}},[t,e.coordinate]),P(()=>{a.current&&o&&(t==null||t.updateState(a.current,o))},[o]),null});n();import{useContext as pt,useEffect as mt}from"react";function ut(e){let{mapView:r}=pt(f),t=l(()=>e.options,[e.options]);return mt(()=>{if(r==null)throw new c("Navigation");return r.Navigation.draw(e.directions,t).then(()=>{var a;(a=e.onDrawComplete)==null||a.call(e)}),()=>{r.Navigation.clear()}},[r,e.directions,t]),null}p(ut,"Navigation");n();import{useContext as ft,useEffect as ct,useRef as dt,forwardRef as lt,useImperativeHandle as Mt,useState as xt}from"react";var yt=lt((e,r)=>{let{mapView:t}=ft(f),a=dt(void 0),o=l(()=>e.style,[e.style]),[s,i]=xt(!1);return Mt(r,()=>a.current,[s]),ct(()=>{if(t==null)throw new Error("MapView not initialized");return a.current=t.Shapes.add(e.geometry,e.style,e.floor),i(!0),()=>{t==null||a.current==null||(t.Shapes.remove(a.current),i(!1))}},[t,e.geometry,e.style,e.floor]),P(()=>{a.current&&o&&(t==null||t.updateState(a.current,o))},[o]),null});n();import{useContext as wt,useEffect as ht,useRef as Et,forwardRef as Pt,useImperativeHandle as gt,useState as Dt}from"react";var St=Pt((e,r)=>{let{mapView:t}=wt(f),a=Et(void 0),o=l(()=>e.options,[e.options]),[s,i]=Dt(!1);return gt(r,()=>a.current,[s]),ht(()=>{if(t==null)throw new c("Model");return a.current=t.Models.add(e.coordinate,e.url,o),i(!0),()=>{t==null||a.current==null||(t.Models.remove(a.current),i(!1))}},[t,e.url]),P(()=>{a.current&&(t==null||t.updateState(a.current,y({position:e.coordinate},o)))},[e.coordinate,o]),null});n();import{useContext as oe}from"react";function Vt(){var t;let{mapView:e}=oe(f),{getCache:r}=oe(S);if(!e)throw new c("useMap");return{mapData:((t=r==null?void 0:r())==null?void 0:t.mapData)||e.getMapData(),mapView:e}}p(Vt,"useMap");n();import Tt,{useCallback as vt,useContext as ie,useEffect as se,useMemo as Rt,useRef as b,forwardRef as pe,useImperativeHandle as me,useState as ue}from"react";import{createPortal as Ct}from"react-dom";n();var _=[0,4,6,8,10],ne=p(()=>{let e=new Array(16).fill(0),r=Math.random()*4294967296;for(let a=0;a<e.length;a++)a>0&&(a&3)===0&&(r=Math.random()*4294967296),e[a]=r>>>((a&3)<<3)&255;let t=e.map(a=>a.toString(16).padStart(2,"0"));return t[6]="4"+t[6][1],t[8]=["8","9","a","b"].includes(t[7][0])?t[7]:"a"+t[7][1],_.map((a,o)=>t.slice(a,o===_.length-1?void 0:_[o+1]).join("")).join("-")},"randomId");var fe=pe((e,r)=>{let{mapView:t}=ie(f),a=b(void 0),[o,s]=ue(!1),i=l(()=>e.options,[e.options]);return me(r,()=>a.current,[o]),se(()=>{if(t==null)throw new c("Marker");return a.current=t.Markers.add(e.target,"",i),s(!0),()=>{t==null||a.current==null||(t.Markers.remove(a.current),s(!1))}},[t,e.target]),P(()=>{a.current&&i&&(t==null||t.updateState(a.current,i))},[i]),t==null||a.current==null?null:Ct(e.children,a.current.contentEl,a.current.id)}),Ot=pe((e,r)=>{let{mapView:t}=ie(f),a=b(ne()),o=b(void 0),[s,i]=ue(!1),M=b(e.target);me(r,()=>o.current,[s]);let m=vt(d=>{o.current=d||void 0,i(!!d)},[]);se(()=>{if(t==null)throw new c("Marker");if(o.current&&o.current.target!==e.target){let{duration:d=300,easing:V="linear"}=e;t.Markers.animateTo(o.current,e.target,{duration:d,easing:V})}return()=>{i(!1)}},[t,e.target]);let g=Rt(()=>C(y({},e),{duration:void 0,easing:void 0}),[e.duration,e.easing]);return Tt.createElement(fe,C(y({},g),{key:a.current,target:M.current,ref:m}))});n();import{forwardRef as Nt,useContext as Lt,useEffect as kt,useImperativeHandle as bt,useRef as At,useState as jt}from"react";var It=Nt((e,r)=>{let{mapView:t}=Lt(f),a=At(void 0),[o,s]=jt(!1),i=l(()=>e.options,[e.options]);return bt(r,()=>a.current,[o]),kt(()=>{if(t==null)throw new c("Label");return a.current=t.Labels.add(e.target,e.text,i),s(!0),()=>{t==null||a.current==null||(t.Labels.remove(a.current),s(!1))}},[t,e.target]),P(()=>{a.current&&(t==null||t.updateState(a.current,y({text:e.text},i)))},[e.text,i]),null});export{Ot as AnimatedMarker,It as Label,j as MapDataProvider,qe as MapView,fe as Marker,St as Model,ut as Navigation,st as Path,yt as Shape,Vt as useMap,Ae as useMapData,We as useMapDataEvent,Ye as useMapViewEvent,Xe as useMapViewExtension};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mappedin/react-sdk",
3
- "version": "6.13.0",
3
+ "version": "6.14.0",
4
4
  "homepage": "https://developer.mappedin.com/",
5
5
  "private": false,
6
6
  "main": "lib/esm/index.js",
@@ -17,7 +17,7 @@
17
17
  "peerDependencies": {
18
18
  "react": ">=16.8.0",
19
19
  "react-dom": ">=16.8.0",
20
- "@mappedin/mappedin-js": "^6.13.0"
20
+ "@mappedin/mappedin-js": "^6.14.0"
21
21
  },
22
22
  "dependencies": {},
23
23
  "devDependencies": {},