@mappedin/react-sdk 6.9.0 → 6.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_LICENSES.txt +31 -0
- package/lib/esm/index.d.ts +198 -117
- package/lib/esm/index.js +1 -1
- package/package.json +2 -2
package/THIRD_PARTY_LICENSES.txt
CHANGED
|
@@ -8345,6 +8345,7 @@ The following npm packages may be included in this product:
|
|
|
8345
8345
|
- @babel/preset-react@7.27.1
|
|
8346
8346
|
- @babel/preset-typescript@7.27.1
|
|
8347
8347
|
- @babel/runtime@7.27.4
|
|
8348
|
+
- @babel/runtime@7.28.4
|
|
8348
8349
|
- @babel/template@7.27.2
|
|
8349
8350
|
- @babel/traverse@7.27.4
|
|
8350
8351
|
- @babel/traverse@7.28.5
|
|
@@ -13176,6 +13177,36 @@ SOFTWARE.
|
|
|
13176
13177
|
|
|
13177
13178
|
-----------
|
|
13178
13179
|
|
|
13180
|
+
The following npm package may be included in this product:
|
|
13181
|
+
|
|
13182
|
+
- i18next@25.6.2
|
|
13183
|
+
|
|
13184
|
+
This package contains the following license:
|
|
13185
|
+
|
|
13186
|
+
The MIT License (MIT)
|
|
13187
|
+
|
|
13188
|
+
Copyright (c) 2025 i18next
|
|
13189
|
+
|
|
13190
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13191
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13192
|
+
in the Software without restriction, including without limitation the rights
|
|
13193
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13194
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
13195
|
+
furnished to do so, subject to the following conditions:
|
|
13196
|
+
|
|
13197
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13198
|
+
copies or substantial portions of the Software.
|
|
13199
|
+
|
|
13200
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
13201
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
13202
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
13203
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
13204
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
13205
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
13206
|
+
SOFTWARE.
|
|
13207
|
+
|
|
13208
|
+
-----------
|
|
13209
|
+
|
|
13179
13210
|
The following npm package may be included in this product:
|
|
13180
13211
|
|
|
13181
13212
|
- safe-buffer@5.2.1
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -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@
|
|
59
|
+
//#region ../../node_modules/.pnpm/type-fest@5.2.0/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,27 +64,81 @@ 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@
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
67
|
+
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-any.d.ts
|
|
68
|
+
/**
|
|
69
|
+
Returns a boolean for whether the given type is `any`.
|
|
70
|
+
|
|
71
|
+
@link https://stackoverflow.com/a/49928360/1490091
|
|
72
|
+
|
|
73
|
+
Useful in type utilities, such as disallowing `any`s to be passed to a function.
|
|
74
|
+
|
|
75
|
+
@example
|
|
76
|
+
```
|
|
77
|
+
import type {IsAny} from 'type-fest';
|
|
78
|
+
|
|
79
|
+
const typedObject = {a: 1, b: 2} as const;
|
|
80
|
+
const anyObject: any = {a: 1, b: 2};
|
|
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];
|
|
73
84
|
}
|
|
74
85
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
@category
|
|
86
|
+
const typedA = get(typedObject, 'a');
|
|
87
|
+
//=> 1
|
|
88
|
+
|
|
89
|
+
const anyA = get(anyObject, 'a');
|
|
90
|
+
//=> any
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
@category Type Guard
|
|
94
|
+
@category Utilities
|
|
84
95
|
*/
|
|
96
|
+
type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-optional-key-of.d.ts
|
|
99
|
+
/**
|
|
100
|
+
Returns a boolean for whether the given key is an optional key of type.
|
|
101
|
+
|
|
102
|
+
This is useful when writing utility types or schema validators that need to differentiate `optional` keys.
|
|
85
103
|
|
|
104
|
+
@example
|
|
105
|
+
```
|
|
106
|
+
import type {IsOptionalKeyOf} from 'type-fest';
|
|
107
|
+
|
|
108
|
+
interface User {
|
|
109
|
+
name: string;
|
|
110
|
+
surname: string;
|
|
111
|
+
|
|
112
|
+
luckyNumber?: number;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
interface Admin {
|
|
116
|
+
name: string;
|
|
117
|
+
surname?: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
type T1 = IsOptionalKeyOf<User, 'luckyNumber'>;
|
|
121
|
+
//=> true
|
|
122
|
+
|
|
123
|
+
type T2 = IsOptionalKeyOf<User, 'name'>;
|
|
124
|
+
//=> false
|
|
125
|
+
|
|
126
|
+
type T3 = IsOptionalKeyOf<User, 'name' | 'luckyNumber'>;
|
|
127
|
+
//=> boolean
|
|
128
|
+
|
|
129
|
+
type T4 = IsOptionalKeyOf<User | Admin, 'name'>;
|
|
130
|
+
//=> false
|
|
131
|
+
|
|
132
|
+
type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
|
|
133
|
+
//=> boolean
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
@category Type Guard
|
|
137
|
+
@category Utilities
|
|
138
|
+
*/
|
|
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;
|
|
86
140
|
//#endregion
|
|
87
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
141
|
+
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/optional-keys-of.d.ts
|
|
88
142
|
/**
|
|
89
143
|
Extract all optional keys from the given type.
|
|
90
144
|
|
|
@@ -118,11 +172,11 @@ const update2: UpdateOperation<User> = {
|
|
|
118
172
|
|
|
119
173
|
@category Utilities
|
|
120
174
|
*/
|
|
121
|
-
type OptionalKeysOf<
|
|
122
|
-
? (keyof { [Key in keyof
|
|
175
|
+
type OptionalKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
|
|
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`
|
|
123
177
|
: never;
|
|
124
178
|
//#endregion
|
|
125
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
179
|
+
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/required-keys-of.d.ts
|
|
126
180
|
/**
|
|
127
181
|
Extract all required keys from the given type.
|
|
128
182
|
|
|
@@ -147,10 +201,10 @@ const validator2 = createValidation<User>('surname', value => value.length < 25)
|
|
|
147
201
|
|
|
148
202
|
@category Utilities
|
|
149
203
|
*/
|
|
150
|
-
type RequiredKeysOf<
|
|
151
|
-
? Exclude<keyof
|
|
204
|
+
type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
|
|
205
|
+
? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
|
|
152
206
|
//#endregion
|
|
153
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
207
|
+
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/is-never.d.ts
|
|
154
208
|
/**
|
|
155
209
|
Returns a boolean for whether the given type is `never`.
|
|
156
210
|
|
|
@@ -194,64 +248,120 @@ endIfEqual('abc', '123');
|
|
|
194
248
|
*/
|
|
195
249
|
type IsNever<T> = [T] extends [never] ? true : false;
|
|
196
250
|
//#endregion
|
|
197
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
251
|
+
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/if.d.ts
|
|
198
252
|
/**
|
|
199
|
-
An if-else-like type that resolves depending on whether the given type is `
|
|
253
|
+
An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
|
|
200
254
|
|
|
201
|
-
|
|
255
|
+
Use-cases:
|
|
256
|
+
- You can use this in combination with `Is*` types to create an if-else-like experience. For example, `If<IsAny<any>, 'is any', 'not any'>`.
|
|
257
|
+
|
|
258
|
+
Note:
|
|
259
|
+
- Returns a union of if branch and else branch if the given type is `boolean` or `any`. For example, `If<boolean, 'Y', 'N'>` will return `'Y' | 'N'`.
|
|
260
|
+
- Returns the else branch if the given type is `never`. For example, `If<never, 'Y', 'N'>` will return `'N'`.
|
|
202
261
|
|
|
203
262
|
@example
|
|
204
263
|
```
|
|
205
|
-
import
|
|
264
|
+
import {If} from 'type-fest';
|
|
206
265
|
|
|
207
|
-
type
|
|
208
|
-
//=>
|
|
266
|
+
type A = If<true, 'yes', 'no'>;
|
|
267
|
+
//=> 'yes'
|
|
209
268
|
|
|
210
|
-
type
|
|
211
|
-
//=> '
|
|
212
|
-
```
|
|
269
|
+
type B = If<false, 'yes', 'no'>;
|
|
270
|
+
//=> 'no'
|
|
213
271
|
|
|
214
|
-
|
|
215
|
-
|
|
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;
|
|
272
|
+
type C = If<boolean, 'yes', 'no'>;
|
|
273
|
+
//=> 'yes' | 'no'
|
|
223
274
|
|
|
224
|
-
|
|
225
|
-
|
|
275
|
+
type D = If<any, 'yes', 'no'>;
|
|
276
|
+
//=> 'yes' | 'no'
|
|
226
277
|
|
|
227
|
-
|
|
278
|
+
type E = If<never, 'yes', 'no'>;
|
|
279
|
+
//=> 'no'
|
|
280
|
+
```
|
|
228
281
|
|
|
229
|
-
|
|
282
|
+
@example
|
|
283
|
+
```
|
|
284
|
+
import {If, IsAny, IsNever} from 'type-fest';
|
|
285
|
+
|
|
286
|
+
type A = If<IsAny<unknown>, 'is any', 'not any'>;
|
|
287
|
+
//=> 'not any'
|
|
288
|
+
|
|
289
|
+
type B = If<IsNever<never>, 'is never', 'not never'>;
|
|
290
|
+
//=> 'is never'
|
|
291
|
+
```
|
|
230
292
|
|
|
231
293
|
@example
|
|
232
294
|
```
|
|
233
|
-
import
|
|
295
|
+
import {If, IsEqual} from 'type-fest';
|
|
234
296
|
|
|
235
|
-
|
|
236
|
-
const anyObject: any = {a: 1, b: 2};
|
|
297
|
+
type IfEqual<T, U, IfBranch, ElseBranch> = If<IsEqual<T, U>, IfBranch, ElseBranch>;
|
|
237
298
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}
|
|
299
|
+
type A = IfEqual<string, string, 'equal', 'not equal'>;
|
|
300
|
+
//=> 'equal'
|
|
241
301
|
|
|
242
|
-
|
|
243
|
-
//=>
|
|
302
|
+
type B = IfEqual<string, number, 'equal', 'not equal'>;
|
|
303
|
+
//=> 'not equal'
|
|
304
|
+
```
|
|
244
305
|
|
|
245
|
-
|
|
246
|
-
|
|
306
|
+
Note: Sometimes using the `If` type can make an implementation non–tail-recursive, which can impact performance. In such cases, it’s better to use a conditional directly. Refer to the following example:
|
|
307
|
+
|
|
308
|
+
@example
|
|
309
|
+
```
|
|
310
|
+
import type {If, IsEqual, StringRepeat} from 'type-fest';
|
|
311
|
+
|
|
312
|
+
type HundredZeroes = StringRepeat<'0', 100>;
|
|
313
|
+
|
|
314
|
+
// The following implementation is not tail recursive
|
|
315
|
+
type Includes<S extends string, Char extends string> =
|
|
316
|
+
S extends `${infer First}${infer Rest}`
|
|
317
|
+
? If<IsEqual<First, Char>,
|
|
318
|
+
'found',
|
|
319
|
+
Includes<Rest, Char>>
|
|
320
|
+
: 'not found';
|
|
321
|
+
|
|
322
|
+
// Hence, instantiations with long strings will fail
|
|
323
|
+
// @ts-expect-error
|
|
324
|
+
type Fails = Includes<HundredZeroes, '1'>;
|
|
325
|
+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
326
|
+
// Error: Type instantiation is excessively deep and possibly infinite.
|
|
327
|
+
|
|
328
|
+
// However, if we use a simple conditional instead of `If`, the implementation becomes tail-recursive
|
|
329
|
+
type IncludesWithoutIf<S extends string, Char extends string> =
|
|
330
|
+
S extends `${infer First}${infer Rest}`
|
|
331
|
+
? IsEqual<First, Char> extends true
|
|
332
|
+
? 'found'
|
|
333
|
+
: IncludesWithoutIf<Rest, Char>
|
|
334
|
+
: 'not found';
|
|
335
|
+
|
|
336
|
+
// Now, instantiations with long strings will work
|
|
337
|
+
type Works = IncludesWithoutIf<HundredZeroes, '1'>;
|
|
338
|
+
//=> 'not found'
|
|
247
339
|
```
|
|
248
340
|
|
|
249
341
|
@category Type Guard
|
|
250
342
|
@category Utilities
|
|
251
343
|
*/
|
|
252
|
-
type
|
|
344
|
+
type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
|
|
345
|
+
//#endregion
|
|
346
|
+
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/internal/type.d.ts
|
|
347
|
+
/**
|
|
348
|
+
Matches any primitive, `void`, `Date`, or `RegExp` value.
|
|
349
|
+
*/
|
|
350
|
+
type BuiltIns = Primitive | void | Date | RegExp;
|
|
351
|
+
/**
|
|
352
|
+
Test if the given function has multiple call signatures.
|
|
353
|
+
|
|
354
|
+
Needed to handle the case of a single call signature with properties.
|
|
355
|
+
|
|
356
|
+
Multiple call signatures cannot currently be supported due to a TypeScript limitation.
|
|
357
|
+
@see https://github.com/microsoft/TypeScript/issues/29732
|
|
358
|
+
*/
|
|
359
|
+
type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> = T extends {
|
|
360
|
+
(...arguments_: infer A): unknown;
|
|
361
|
+
(...arguments_: infer B): unknown;
|
|
362
|
+
} ? B extends A ? A extends B ? false : true : true : false;
|
|
253
363
|
//#endregion
|
|
254
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
364
|
+
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/simplify.d.ts
|
|
255
365
|
/**
|
|
256
366
|
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
367
|
|
|
@@ -306,12 +416,12 @@ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface`
|
|
|
306
416
|
```
|
|
307
417
|
|
|
308
418
|
@link https://github.com/microsoft/TypeScript/issues/15300
|
|
309
|
-
@see SimplifyDeep
|
|
419
|
+
@see {@link SimplifyDeep}
|
|
310
420
|
@category Object
|
|
311
421
|
*/
|
|
312
422
|
type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
|
|
313
423
|
//#endregion
|
|
314
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
424
|
+
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/omit-index-signature.d.ts
|
|
315
425
|
/**
|
|
316
426
|
Omit any index signatures from the given object type, leaving only explicitly defined properties.
|
|
317
427
|
|
|
@@ -399,12 +509,12 @@ type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
|
|
|
399
509
|
// => { foo: 'bar'; qux?: 'baz' | undefined; }
|
|
400
510
|
```
|
|
401
511
|
|
|
402
|
-
@see PickIndexSignature
|
|
512
|
+
@see {@link PickIndexSignature}
|
|
403
513
|
@category Object
|
|
404
514
|
*/
|
|
405
515
|
type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
|
|
406
516
|
//#endregion
|
|
407
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
517
|
+
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/pick-index-signature.d.ts
|
|
408
518
|
/**
|
|
409
519
|
Pick only index signatures from the given object type, leaving out all explicitly defined properties.
|
|
410
520
|
|
|
@@ -447,12 +557,12 @@ type ExampleIndexSignature = PickIndexSignature<Example>;
|
|
|
447
557
|
// }
|
|
448
558
|
```
|
|
449
559
|
|
|
450
|
-
@see OmitIndexSignature
|
|
560
|
+
@see {@link OmitIndexSignature}
|
|
451
561
|
@category Object
|
|
452
562
|
*/
|
|
453
563
|
type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
|
|
454
564
|
//#endregion
|
|
455
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
565
|
+
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/merge.d.ts
|
|
456
566
|
// Merges two objects without worrying about index signatures.
|
|
457
567
|
type SimpleMerge<Destination, Source> = { [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source;
|
|
458
568
|
|
|
@@ -492,36 +602,7 @@ export type FooBar = Merge<Foo, Bar>;
|
|
|
492
602
|
*/
|
|
493
603
|
type Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
|
|
494
604
|
//#endregion
|
|
495
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
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
|
-
|
|
605
|
+
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/internal/object.d.ts
|
|
525
606
|
/**
|
|
526
607
|
Merges user specified options with default options.
|
|
527
608
|
|
|
@@ -574,10 +655,9 @@ type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOp
|
|
|
574
655
|
// Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
|
|
575
656
|
```
|
|
576
657
|
*/
|
|
577
|
-
type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> =
|
|
578
|
-
>>;
|
|
658
|
+
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>>>>;
|
|
579
659
|
//#endregion
|
|
580
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
660
|
+
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/partial-deep.d.ts
|
|
581
661
|
/**
|
|
582
662
|
@see {@link PartialDeep}
|
|
583
663
|
*/
|
|
@@ -592,24 +672,23 @@ type PartialDeepOptions = {
|
|
|
592
672
|
Allows `undefined` values in non-tuple arrays.
|
|
593
673
|
- When set to `true`, elements of non-tuple arrays can be `undefined`.
|
|
594
674
|
- When set to `false`, only explicitly defined elements are allowed in non-tuple arrays, ensuring stricter type checking.
|
|
595
|
-
@default
|
|
675
|
+
@default false
|
|
596
676
|
@example
|
|
597
|
-
You can
|
|
677
|
+
You can allow `undefined` values in non-tuple arrays by passing `{recurseIntoArrays: true; allowUndefinedInNonTupleArrays: true}` as the second type argument:
|
|
598
678
|
```
|
|
599
679
|
import type {PartialDeep} from 'type-fest';
|
|
600
680
|
type Settings = {
|
|
601
681
|
languages: string[];
|
|
602
682
|
};
|
|
603
|
-
declare const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true; allowUndefinedInNonTupleArrays:
|
|
604
|
-
partialSettings.languages = [undefined]; //
|
|
605
|
-
partialSettings.languages = []; // Ok
|
|
683
|
+
declare const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true; allowUndefinedInNonTupleArrays: true}>;
|
|
684
|
+
partialSettings.languages = [undefined]; // OK
|
|
606
685
|
```
|
|
607
686
|
*/
|
|
608
687
|
readonly allowUndefinedInNonTupleArrays?: boolean;
|
|
609
688
|
};
|
|
610
689
|
type DefaultPartialDeepOptions = {
|
|
611
690
|
recurseIntoArrays: false;
|
|
612
|
-
allowUndefinedInNonTupleArrays:
|
|
691
|
+
allowUndefinedInNonTupleArrays: false;
|
|
613
692
|
};
|
|
614
693
|
|
|
615
694
|
/**
|
|
@@ -623,19 +702,19 @@ Use-cases:
|
|
|
623
702
|
```
|
|
624
703
|
import type {PartialDeep} from 'type-fest';
|
|
625
704
|
|
|
626
|
-
|
|
705
|
+
let settings = {
|
|
627
706
|
textEditor: {
|
|
628
707
|
fontSize: 14,
|
|
629
708
|
fontColor: '#000000',
|
|
630
|
-
fontWeight: 400
|
|
709
|
+
fontWeight: 400,
|
|
631
710
|
},
|
|
632
711
|
autocomplete: false,
|
|
633
|
-
autosave: true
|
|
712
|
+
autosave: true,
|
|
634
713
|
};
|
|
635
714
|
|
|
636
|
-
const applySavedSettings = (savedSettings: PartialDeep<
|
|
637
|
-
|
|
638
|
-
|
|
715
|
+
const applySavedSettings = (savedSettings: PartialDeep<typeof settings>) => (
|
|
716
|
+
{...settings, ...savedSettings, textEditor: {...settings.textEditor, ...savedSettings.textEditor}}
|
|
717
|
+
);
|
|
639
718
|
|
|
640
719
|
settings = applySavedSettings({textEditor: {fontWeight: 500}});
|
|
641
720
|
```
|
|
@@ -645,13 +724,15 @@ By default, this does not affect elements in array and tuple types. You can chan
|
|
|
645
724
|
```
|
|
646
725
|
import type {PartialDeep} from 'type-fest';
|
|
647
726
|
|
|
648
|
-
type
|
|
649
|
-
|
|
650
|
-
}
|
|
727
|
+
type Shape = {
|
|
728
|
+
dimensions: [number, number];
|
|
729
|
+
};
|
|
651
730
|
|
|
652
|
-
const
|
|
653
|
-
|
|
731
|
+
const partialShape: PartialDeep<Shape, {recurseIntoArrays: true}> = {
|
|
732
|
+
dimensions: [], // OK
|
|
654
733
|
};
|
|
734
|
+
|
|
735
|
+
partialShape.dimensions = [15]; // OK
|
|
655
736
|
```
|
|
656
737
|
|
|
657
738
|
@see {@link PartialDeepOptions}
|
|
@@ -662,8 +743,8 @@ const partialSettings: PartialDeep<Settings, {recurseIntoArrays: true}> = {
|
|
|
662
743
|
@category Map
|
|
663
744
|
*/
|
|
664
745
|
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
|
-
|
|
746
|
+
type _PartialDeep<T, Options extends Required<PartialDeepOptions>> = T extends BuiltIns | ((new (...arguments_: any[]) => unknown)) ? 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 ((...arguments_: any[]) => unknown) ? IsNever<keyof T> extends true ? T // For functions with no properties
|
|
747
|
+
: HasMultipleCallSignatures<T> extends true ? T : ((...arguments_: Parameters<T>) => ReturnType<T>) & PartialObjectDeep<T, Options> : T extends object ? T extends ReadonlyArray<infer ItemType> // Test for arrays/tuples, per https://github.com/microsoft/TypeScript/issues/35156
|
|
667
748
|
? Options['recurseIntoArrays'] extends true ? ItemType[] extends T // Test for arrays (non-tuples) specifically
|
|
668
749
|
? readonly ItemType[] extends T // Differentiate readonly and mutable arrays
|
|
669
750
|
? 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
|
|
@@ -693,9 +774,9 @@ type PartialReadonlySetDeep<T, Options extends Required<PartialDeepOptions>> = {
|
|
|
693
774
|
/**
|
|
694
775
|
Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
|
|
695
776
|
*/
|
|
696
|
-
type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> =
|
|
777
|
+
type PartialObjectDeep<ObjectType extends object, Options extends Required<PartialDeepOptions>> = { [KeyType in keyof ObjectType]?: _PartialDeep<ObjectType[KeyType], Options> };
|
|
697
778
|
//#endregion
|
|
698
|
-
//#region ../../node_modules/.pnpm/type-fest@
|
|
779
|
+
//#region ../../node_modules/.pnpm/type-fest@5.2.0/node_modules/type-fest/source/literal-union.d.ts
|
|
699
780
|
/**
|
|
700
781
|
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
782
|
|
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.9.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.10.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.
|
|
3
|
+
"version": "6.10.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.
|
|
20
|
+
"@mappedin/mappedin-js": "^6.10.0"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {},
|
|
23
23
|
"devDependencies": {},
|