@maplibre/maplibre-react-native 10.0.0-beta.3 → 10.0.0-beta.6
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/android/build.gradle +98 -51
- package/android/gradle.properties +7 -0
- package/android/src/main/AndroidManifest.xml +4 -2
- package/android/src/main/AndroidManifestNew.xml +5 -0
- package/android/src/main/java/org/maplibre/reactnative/MLRNPackage.java +0 -5
- package/android/src/main/java/org/maplibre/reactnative/components/styles/sources/MLRNShapeSource.java +0 -66
- package/android/src/main/java/org/maplibre/reactnative/components/styles/sources/MLRNShapeSourceManager.java +0 -28
- package/ios/MLRN/MLRNBackgroundLayer.h +0 -1
- package/ios/MLRN/MLRNFillExtrusionLayer.h +0 -1
- package/ios/MLRN/MLRNFillLayer.h +0 -1
- package/ios/MLRN/MLRNFillLayer.m +1 -0
- package/ios/MLRN/MLRNLineLayer.h +0 -1
- package/ios/MLRN/MLRNRasterLayer.h +0 -1
- package/ios/MLRN/MLRNShapeSource.h +0 -11
- package/ios/MLRN/MLRNShapeSource.m +0 -38
- package/ios/MLRN/MLRNShapeSourceManager.m +0 -68
- package/ios/MLRN/MLRNSymbolLayer.h +1 -7
- package/ios/MLRN/MLRNSymbolLayer.m +1 -89
- package/ios/MLRN/MLRNSymbolLayerManager.m +0 -1
- package/lib/commonjs/MapLibreRN.js +1 -5
- package/lib/commonjs/MapLibreRN.js.map +1 -1
- package/lib/commonjs/components/Images.js +1 -5
- package/lib/commonjs/components/Images.js.map +1 -1
- package/lib/commonjs/components/MapView.js +0 -7
- package/lib/commonjs/components/MapView.js.map +1 -1
- package/lib/commonjs/components/ShapeSource.js +6 -38
- package/lib/commonjs/components/ShapeSource.js.map +1 -1
- package/lib/commonjs/components/SymbolLayer.js +2 -17
- package/lib/commonjs/components/SymbolLayer.js.map +1 -1
- package/lib/commonjs/components/VectorSource.js +1 -11
- package/lib/commonjs/components/VectorSource.js.map +1 -1
- package/lib/module/MapLibreRN.js +0 -3
- package/lib/module/MapLibreRN.js.map +1 -1
- package/lib/module/components/Images.js +1 -5
- package/lib/module/components/Images.js.map +1 -1
- package/lib/module/components/MapView.js +0 -7
- package/lib/module/components/MapView.js.map +1 -1
- package/lib/module/components/ShapeSource.js +5 -37
- package/lib/module/components/ShapeSource.js.map +1 -1
- package/lib/module/components/SymbolLayer.js +3 -18
- package/lib/module/components/SymbolLayer.js.map +1 -1
- package/lib/module/components/VectorSource.js +1 -11
- package/lib/module/components/VectorSource.js.map +1 -1
- package/lib/typescript/commonjs/src/MapLibreRN.d.ts +0 -3
- package/lib/typescript/commonjs/src/MapLibreRN.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/Camera.d.ts +1 -1
- package/lib/typescript/commonjs/src/components/Images.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/MapView.d.ts +0 -1
- package/lib/typescript/commonjs/src/components/MapView.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/ShapeSource.d.ts +0 -1
- package/lib/typescript/commonjs/src/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/SymbolLayer.d.ts +0 -6
- package/lib/typescript/commonjs/src/components/SymbolLayer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/components/VectorSource.d.ts.map +1 -1
- package/lib/typescript/module/src/MapLibreRN.d.ts +0 -3
- package/lib/typescript/module/src/MapLibreRN.d.ts.map +1 -1
- package/lib/typescript/module/src/components/Camera.d.ts +1 -1
- package/lib/typescript/module/src/components/Images.d.ts.map +1 -1
- package/lib/typescript/module/src/components/MapView.d.ts +0 -1
- package/lib/typescript/module/src/components/MapView.d.ts.map +1 -1
- package/lib/typescript/module/src/components/ShapeSource.d.ts +0 -1
- package/lib/typescript/module/src/components/ShapeSource.d.ts.map +1 -1
- package/lib/typescript/module/src/components/SymbolLayer.d.ts +0 -6
- package/lib/typescript/module/src/components/SymbolLayer.d.ts.map +1 -1
- package/lib/typescript/module/src/components/VectorSource.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/MapLibreRN.ts +0 -5
- package/src/components/Camera.tsx +1 -1
- package/src/components/Images.tsx +1 -10
- package/src/components/MapView.tsx +0 -11
- package/src/components/ShapeSource.tsx +5 -73
- package/src/components/SymbolLayer.tsx +5 -33
- package/src/components/VectorSource.tsx +4 -20
- package/android/src/main/res/values/strings.xml +0 -3
- package/lib/commonjs/utils/deprecation.js +0 -31
- package/lib/commonjs/utils/deprecation.js.map +0 -1
- package/lib/module/utils/deprecation.js +0 -27
- package/lib/module/utils/deprecation.js.map +0 -1
- package/lib/typescript/commonjs/src/utils/deprecation.d.ts +0 -6
- package/lib/typescript/commonjs/src/utils/deprecation.d.ts.map +0 -1
- package/lib/typescript/module/src/utils/deprecation.d.ts +0 -6
- package/lib/typescript/module/src/utils/deprecation.d.ts.map +0 -1
- package/src/utils/deprecation.ts +0 -31
|
@@ -26,12 +26,10 @@ import {
|
|
|
26
26
|
type ExpressionField,
|
|
27
27
|
type FilterExpression,
|
|
28
28
|
} from "../utils/MapLibreRNStyles";
|
|
29
|
-
import { copyPropertiesAsDeprecated } from "../utils/deprecation";
|
|
30
29
|
import { getFilter } from "../utils/filterUtils";
|
|
31
30
|
|
|
32
31
|
const MapLibreRN = NativeModules.MLRNModule;
|
|
33
32
|
export const NATIVE_MODULE_NAME = "MLRNShapeSource";
|
|
34
|
-
export const SHAPE_SOURCE_NATIVE_ASSETS_KEY = "assets";
|
|
35
33
|
|
|
36
34
|
interface NativeProps {
|
|
37
35
|
shape?: string;
|
|
@@ -252,18 +250,6 @@ const ShapeSource = memo(
|
|
|
252
250
|
async function getClusterExpansionZoom(
|
|
253
251
|
feature: GeoJSON.Feature,
|
|
254
252
|
): Promise<number> {
|
|
255
|
-
if (typeof feature === "number") {
|
|
256
|
-
console.warn(
|
|
257
|
-
"Using cluster_id is deprecated and will be removed from the future releases. Please use cluster as an argument instead.",
|
|
258
|
-
);
|
|
259
|
-
const res: { data: number } = await _runNativeCommand(
|
|
260
|
-
"getClusterExpansionZoomById",
|
|
261
|
-
_nativeRef.current,
|
|
262
|
-
[feature],
|
|
263
|
-
);
|
|
264
|
-
return res.data;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
253
|
const res: { data: number } = await _runNativeCommand(
|
|
268
254
|
"getClusterExpansionZoom",
|
|
269
255
|
_nativeRef.current,
|
|
@@ -277,24 +263,6 @@ const ShapeSource = memo(
|
|
|
277
263
|
limit: number,
|
|
278
264
|
offset: number,
|
|
279
265
|
): Promise<GeoJSON.FeatureCollection> {
|
|
280
|
-
if (typeof feature === "number") {
|
|
281
|
-
console.warn(
|
|
282
|
-
"Using cluster_id is deprecated and will be removed from the future releases. Please use cluster as an argument instead.",
|
|
283
|
-
);
|
|
284
|
-
const res: { data: string | GeoJSON.FeatureCollection } =
|
|
285
|
-
await _runNativeCommand(
|
|
286
|
-
"getClusterLeavesById",
|
|
287
|
-
_nativeRef.current,
|
|
288
|
-
[feature, limit, offset],
|
|
289
|
-
);
|
|
290
|
-
|
|
291
|
-
if (isAndroid()) {
|
|
292
|
-
return JSON.parse(res.data as string);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
return res.data as GeoJSON.FeatureCollection;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
266
|
const res: { data: string | GeoJSON.FeatureCollection } =
|
|
299
267
|
await _runNativeCommand("getClusterLeaves", _nativeRef.current, [
|
|
300
268
|
JSON.stringify(feature),
|
|
@@ -312,24 +280,6 @@ const ShapeSource = memo(
|
|
|
312
280
|
async function getClusterChildren(
|
|
313
281
|
feature: GeoJSON.Feature,
|
|
314
282
|
): Promise<GeoJSON.FeatureCollection> {
|
|
315
|
-
if (typeof feature === "number") {
|
|
316
|
-
console.warn(
|
|
317
|
-
"Using cluster_id is deprecated and will be removed from the future releases. Please use cluster as an argument instead.",
|
|
318
|
-
);
|
|
319
|
-
const res: { data: string | GeoJSON.FeatureCollection } =
|
|
320
|
-
await _runNativeCommand(
|
|
321
|
-
"getClusterChildrenById",
|
|
322
|
-
_nativeRef.current,
|
|
323
|
-
[feature],
|
|
324
|
-
);
|
|
325
|
-
|
|
326
|
-
if (isAndroid()) {
|
|
327
|
-
return JSON.parse(res.data as string);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
return res.data as GeoJSON.FeatureCollection;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
283
|
const res: { data: string | GeoJSON.FeatureCollection } =
|
|
334
284
|
await _runNativeCommand("getClusterChildren", _nativeRef.current, [
|
|
335
285
|
JSON.stringify(feature),
|
|
@@ -372,31 +322,13 @@ const ShapeSource = memo(
|
|
|
372
322
|
payload: { features, coordinates, point },
|
|
373
323
|
},
|
|
374
324
|
} = event;
|
|
375
|
-
let newEvent = {
|
|
376
|
-
features,
|
|
377
|
-
coordinates,
|
|
378
|
-
point,
|
|
379
|
-
};
|
|
380
|
-
newEvent = copyPropertiesAsDeprecated(
|
|
381
|
-
event,
|
|
382
|
-
newEvent,
|
|
383
|
-
(key: string): void => {
|
|
384
|
-
console.warn(
|
|
385
|
-
`event.${key} is deprecated on ShapeSource#onPress, please use event.features`,
|
|
386
|
-
);
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
nativeEvent: (
|
|
390
|
-
origNativeEvent: NativeSyntheticEvent<{ payload: OnPressEvent }>,
|
|
391
|
-
) => ({
|
|
392
|
-
...origNativeEvent,
|
|
393
|
-
payload: features[0],
|
|
394
|
-
}),
|
|
395
|
-
},
|
|
396
|
-
);
|
|
397
325
|
|
|
398
326
|
if (props.onPress) {
|
|
399
|
-
props.onPress(
|
|
327
|
+
props.onPress({
|
|
328
|
+
features,
|
|
329
|
+
coordinates,
|
|
330
|
+
point,
|
|
331
|
+
});
|
|
400
332
|
}
|
|
401
333
|
}
|
|
402
334
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { View, NativeModules, requireNativeComponent } from "react-native";
|
|
1
|
+
import { NativeModules, requireNativeComponent } from "react-native";
|
|
3
2
|
|
|
4
3
|
import useAbstractLayer, {
|
|
5
4
|
type BaseLayerProps,
|
|
@@ -17,17 +16,11 @@ export interface SymbolLayerProps extends BaseProps, BaseLayerProps {
|
|
|
17
16
|
* Customizable style attributes
|
|
18
17
|
*/
|
|
19
18
|
style?: SymbolLayerStyleProps;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated passed children used to create an image with id of symbol in style and also set the iconImageName property accordingly.
|
|
23
|
-
* This is now deprecated, use Image component instead.
|
|
24
|
-
*/
|
|
25
|
-
children?: ReactElement | ReactElement[];
|
|
26
19
|
}
|
|
27
20
|
|
|
28
|
-
interface NativeProps
|
|
29
|
-
|
|
30
|
-
}
|
|
21
|
+
interface NativeProps
|
|
22
|
+
extends Omit<SymbolLayerProps, "style">,
|
|
23
|
+
NativeBaseProps {}
|
|
31
24
|
|
|
32
25
|
const MLRNSymbolLayer = requireNativeComponent<NativeProps>(NATIVE_MODULE_NAME);
|
|
33
26
|
|
|
@@ -46,32 +39,11 @@ const SymbolLayer: React.FC<SymbolLayerProps> = ({
|
|
|
46
39
|
sourceID,
|
|
47
40
|
});
|
|
48
41
|
|
|
49
|
-
const _shouldSnapshot = (): boolean => {
|
|
50
|
-
let isSnapshot = false;
|
|
51
|
-
|
|
52
|
-
if (Children.count(props.children) <= 0) {
|
|
53
|
-
return isSnapshot;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
Children.forEach(props.children, (child) => {
|
|
57
|
-
if (child?.type === View) {
|
|
58
|
-
isSnapshot = true;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
return isSnapshot;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
42
|
const updatedProps = {
|
|
66
43
|
...baseProps,
|
|
67
|
-
snapshot: _shouldSnapshot(),
|
|
68
44
|
};
|
|
69
45
|
|
|
70
|
-
return
|
|
71
|
-
<MLRNSymbolLayer ref={setNativeLayer} {...updatedProps}>
|
|
72
|
-
{props.children}
|
|
73
|
-
</MLRNSymbolLayer>
|
|
74
|
-
);
|
|
46
|
+
return <MLRNSymbolLayer ref={setNativeLayer} {...updatedProps} />;
|
|
75
47
|
};
|
|
76
48
|
|
|
77
49
|
export default SymbolLayer;
|
|
@@ -12,7 +12,6 @@ import { type BaseProps } from "../types/BaseProps";
|
|
|
12
12
|
import { type OnPressEvent } from "../types/OnPressEvent";
|
|
13
13
|
import { cloneReactChildrenWithProps, isFunction, isAndroid } from "../utils";
|
|
14
14
|
import { type FilterExpression } from "../utils/MapLibreRNStyles";
|
|
15
|
-
import { copyPropertiesAsDeprecated } from "../utils/deprecation";
|
|
16
15
|
import { getFilter } from "../utils/filterUtils";
|
|
17
16
|
|
|
18
17
|
const MapLibreRN = NativeModules.MLRNModule;
|
|
@@ -160,33 +159,18 @@ const VectorSource = memo(
|
|
|
160
159
|
if (!onPress) {
|
|
161
160
|
return;
|
|
162
161
|
}
|
|
162
|
+
|
|
163
163
|
const {
|
|
164
164
|
nativeEvent: {
|
|
165
165
|
payload: { features, coordinates, point },
|
|
166
166
|
},
|
|
167
167
|
} = event;
|
|
168
|
-
|
|
168
|
+
|
|
169
|
+
onPress({
|
|
169
170
|
features,
|
|
170
171
|
coordinates,
|
|
171
172
|
point,
|
|
172
|
-
};
|
|
173
|
-
newEvent = copyPropertiesAsDeprecated(
|
|
174
|
-
event,
|
|
175
|
-
newEvent,
|
|
176
|
-
(key: string) => {
|
|
177
|
-
console.warn(
|
|
178
|
-
`event.${key} is deprecated on VectorSource#onPress, please use event.features`,
|
|
179
|
-
);
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
nativeEvent: (origNativeEvent: OnPressEvent) => ({
|
|
183
|
-
...origNativeEvent,
|
|
184
|
-
payload: features[0],
|
|
185
|
-
}),
|
|
186
|
-
},
|
|
187
|
-
);
|
|
188
|
-
|
|
189
|
-
onPress(newEvent);
|
|
173
|
+
});
|
|
190
174
|
};
|
|
191
175
|
|
|
192
176
|
const allProps = {
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.copyPropertiesAsDeprecated = copyPropertiesAsDeprecated;
|
|
7
|
-
/**
|
|
8
|
-
* Copy properties from origObject to newObject, which not exists in newObject,
|
|
9
|
-
* calls onDeprecatedCalled callback in case a copied property is invoked.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
function copyPropertiesAsDeprecated(origObject, newObject, onDeprecatedCalled, accessors = {}) {
|
|
13
|
-
const result = {
|
|
14
|
-
...newObject
|
|
15
|
-
};
|
|
16
|
-
for (const [key, value] of Object.entries(origObject)) {
|
|
17
|
-
if (!(key in newObject)) {
|
|
18
|
-
Object.defineProperty(result, key, {
|
|
19
|
-
get() {
|
|
20
|
-
onDeprecatedCalled(key);
|
|
21
|
-
return accessors[key] ? accessors[key](value) : value;
|
|
22
|
-
},
|
|
23
|
-
enumerable: true,
|
|
24
|
-
// Ensure the property is enumerable
|
|
25
|
-
configurable: true // Ensure the property can be reconfigured
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return result;
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=deprecation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["copyPropertiesAsDeprecated","origObject","newObject","onDeprecatedCalled","accessors","result","key","value","Object","entries","defineProperty","get","enumerable","configurable"],"sourceRoot":"../../../src","sources":["utils/deprecation.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;;AAEO,SAASA,0BAA0BA,CAIxCC,UAA0B,EAC1BC,SAA6B,EAC7BC,kBAAyC,EACzCC,SAAkD,GAAG,CAAC,CAAC,EACnC;EACpB,MAAMC,MAAM,GAAG;IAAE,GAAGH;EAAU,CAAC;EAE/B,KAAK,MAAM,CAACI,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACR,UAAU,CAAC,EAAE;IACrD,IAAI,EAAEK,GAAG,IAAIJ,SAAS,CAAC,EAAE;MACvBM,MAAM,CAACE,cAAc,CAACL,MAAM,EAAEC,GAAG,EAAE;QACjCK,GAAGA,CAAA,EAAG;UACJR,kBAAkB,CAACG,GAAG,CAAC;UACvB,OAAOF,SAAS,CAACE,GAAG,CAAC,GAAGF,SAAS,CAACE,GAAG,CAAC,CAACC,KAAK,CAAC,GAAGA,KAAK;QACvD,CAAC;QACDK,UAAU,EAAE,IAAI;QAAE;QAClBC,YAAY,EAAE,IAAI,CAAE;MACtB,CAAC,CAAC;IACJ;EACF;EAEA,OAAOR,MAAM;AACf","ignoreList":[]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Copy properties from origObject to newObject, which not exists in newObject,
|
|
5
|
-
* calls onDeprecatedCalled callback in case a copied property is invoked.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export function copyPropertiesAsDeprecated(origObject, newObject, onDeprecatedCalled, accessors = {}) {
|
|
9
|
-
const result = {
|
|
10
|
-
...newObject
|
|
11
|
-
};
|
|
12
|
-
for (const [key, value] of Object.entries(origObject)) {
|
|
13
|
-
if (!(key in newObject)) {
|
|
14
|
-
Object.defineProperty(result, key, {
|
|
15
|
-
get() {
|
|
16
|
-
onDeprecatedCalled(key);
|
|
17
|
-
return accessors[key] ? accessors[key](value) : value;
|
|
18
|
-
},
|
|
19
|
-
enumerable: true,
|
|
20
|
-
// Ensure the property is enumerable
|
|
21
|
-
configurable: true // Ensure the property can be reconfigured
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return result;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=deprecation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["copyPropertiesAsDeprecated","origObject","newObject","onDeprecatedCalled","accessors","result","key","value","Object","entries","defineProperty","get","enumerable","configurable"],"sourceRoot":"../../../src","sources":["utils/deprecation.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;AAEA,OAAO,SAASA,0BAA0BA,CAIxCC,UAA0B,EAC1BC,SAA6B,EAC7BC,kBAAyC,EACzCC,SAAkD,GAAG,CAAC,CAAC,EACnC;EACpB,MAAMC,MAAM,GAAG;IAAE,GAAGH;EAAU,CAAC;EAE/B,KAAK,MAAM,CAACI,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACR,UAAU,CAAC,EAAE;IACrD,IAAI,EAAEK,GAAG,IAAIJ,SAAS,CAAC,EAAE;MACvBM,MAAM,CAACE,cAAc,CAACL,MAAM,EAAEC,GAAG,EAAE;QACjCK,GAAGA,CAAA,EAAG;UACJR,kBAAkB,CAACG,GAAG,CAAC;UACvB,OAAOF,SAAS,CAACE,GAAG,CAAC,GAAGF,SAAS,CAACE,GAAG,CAAC,CAACC,KAAK,CAAC,GAAGA,KAAK;QACvD,CAAC;QACDK,UAAU,EAAE,IAAI;QAAE;QAClBC,YAAY,EAAE,IAAI,CAAE;MACtB,CAAC,CAAC;IACJ;EACF;EAEA,OAAOR,MAAM;AACf","ignoreList":[]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copy properties from origObject to newObject, which not exists in newObject,
|
|
3
|
-
* calls onDeprecatedCalled callback in case a copied property is invoked.
|
|
4
|
-
*/
|
|
5
|
-
export declare function copyPropertiesAsDeprecated<DeprecatedType extends object, WithDeprecatedType extends Record<string, unknown>>(origObject: DeprecatedType, newObject: WithDeprecatedType, onDeprecatedCalled: (key: string) => void, accessors?: Record<string, (value: any) => unknown>): WithDeprecatedType;
|
|
6
|
-
//# sourceMappingURL=deprecation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deprecation.d.ts","sourceRoot":"","sources":["../../../../../src/utils/deprecation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wBAAgB,0BAA0B,CACxC,cAAc,SAAS,MAAM,EAC7B,kBAAkB,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAElD,UAAU,EAAE,cAAc,EAC1B,SAAS,EAAE,kBAAkB,EAC7B,kBAAkB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,EACzC,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAM,GACtD,kBAAkB,CAiBpB"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copy properties from origObject to newObject, which not exists in newObject,
|
|
3
|
-
* calls onDeprecatedCalled callback in case a copied property is invoked.
|
|
4
|
-
*/
|
|
5
|
-
export declare function copyPropertiesAsDeprecated<DeprecatedType extends object, WithDeprecatedType extends Record<string, unknown>>(origObject: DeprecatedType, newObject: WithDeprecatedType, onDeprecatedCalled: (key: string) => void, accessors?: Record<string, (value: any) => unknown>): WithDeprecatedType;
|
|
6
|
-
//# sourceMappingURL=deprecation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deprecation.d.ts","sourceRoot":"","sources":["../../../../../src/utils/deprecation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wBAAgB,0BAA0B,CACxC,cAAc,SAAS,MAAM,EAC7B,kBAAkB,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAElD,UAAU,EAAE,cAAc,EAC1B,SAAS,EAAE,kBAAkB,EAC7B,kBAAkB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,EACzC,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAM,GACtD,kBAAkB,CAiBpB"}
|
package/src/utils/deprecation.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copy properties from origObject to newObject, which not exists in newObject,
|
|
3
|
-
* calls onDeprecatedCalled callback in case a copied property is invoked.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export function copyPropertiesAsDeprecated<
|
|
7
|
-
DeprecatedType extends object,
|
|
8
|
-
WithDeprecatedType extends Record<string, unknown>,
|
|
9
|
-
>(
|
|
10
|
-
origObject: DeprecatedType,
|
|
11
|
-
newObject: WithDeprecatedType,
|
|
12
|
-
onDeprecatedCalled: (key: string) => void,
|
|
13
|
-
accessors: Record<string, (value: any) => unknown> = {},
|
|
14
|
-
): WithDeprecatedType {
|
|
15
|
-
const result = { ...newObject };
|
|
16
|
-
|
|
17
|
-
for (const [key, value] of Object.entries(origObject)) {
|
|
18
|
-
if (!(key in newObject)) {
|
|
19
|
-
Object.defineProperty(result, key, {
|
|
20
|
-
get() {
|
|
21
|
-
onDeprecatedCalled(key);
|
|
22
|
-
return accessors[key] ? accessors[key](value) : value;
|
|
23
|
-
},
|
|
24
|
-
enumerable: true, // Ensure the property is enumerable
|
|
25
|
-
configurable: true, // Ensure the property can be reconfigured
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return result;
|
|
31
|
-
}
|