@tmlmobilidade/ui 20250403.1805.0 → 20250403.1846.33
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/dist/index.css.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/attribution-control.js +15 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/attribution-control.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/fullscreen-control.js +17 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/fullscreen-control.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/geolocate-control.js +45 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/geolocate-control.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/layer.js +102 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/layer.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/logo-control.js +13 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/logo-control.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/map.js +91 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/map.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/marker.js +93 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/marker.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/navigation-control.js +17 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/navigation-control.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/popup.js +67 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/popup.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/scale-control.js +27 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/scale-control.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/source.js +117 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/source.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/terrain-control.js +15 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/terrain-control.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/use-control.js +32 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/use-control.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/use-map.js +45 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/components/use-map.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/maplibre/create-ref.js +58 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/maplibre/create-ref.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/maplibre/maplibre.js +456 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/maplibre/maplibre.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/utils/apply-react-style.js +21 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/utils/apply-react-style.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/utils/assert.js +8 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/utils/assert.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/utils/compare-class-names.js +26 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/utils/compare-class-names.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/utils/deep-equal.js +62 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/utils/deep-equal.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/utils/set-globals.js +26 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/utils/set-globals.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/utils/style-utils.js +51 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/utils/style-utils.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/utils/transform.js +53 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/utils/transform.js.map +1 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/utils/use-isomorphic-layout-effect.js +8 -0
- package/dist/node_modules/@vis.gl/react-maplibre/dist/utils/use-isomorphic-layout-effect.js.map +1 -0
- package/dist/src/components/AppProvider/index.js +12 -1
- package/dist/src/components/AppProvider/index.js.map +1 -1
- package/dist/src/components/layout/Collapsible/index.js +3 -2
- package/dist/src/components/layout/Collapsible/index.js.map +1 -1
- package/dist/src/components/map/MapView/index.js +11 -1
- package/dist/src/components/map/MapView/index.js.map +1 -1
- package/dist/src/components/map/MapViewStyleActiveStops/index.js +14 -1
- package/dist/src/components/map/MapViewStyleActiveStops/index.js.map +1 -1
- package/dist/src/components/map/MapViewStylePath/index.js +14 -1
- package/dist/src/components/map/MapViewStylePath/index.js.map +1 -1
- package/dist/src/components/map/MapViewStyleStops/index.js +14 -1
- package/dist/src/components/map/MapViewStyleStops/index.js.map +1 -1
- package/dist/src/components/map/MapViewStyleVehicles/index.js +14 -1
- package/dist/src/components/map/MapViewStyleVehicles/index.js.map +1 -1
- package/dist/styles-no-reset.css +1 -0
- package/dist/styles.css +1 -0
- package/package.json +5 -9
@@ -0,0 +1,117 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { useContext, useRef, useState, useMemo, useEffect, cloneElement } from 'react';
|
3
|
+
import { MapContext } from './map.js';
|
4
|
+
import assert from '../utils/assert.js';
|
5
|
+
import { deepEqual } from '../utils/deep-equal.js';
|
6
|
+
|
7
|
+
let sourceCounter = 0;
|
8
|
+
function createSource(map, id, props) {
|
9
|
+
// @ts-ignore
|
10
|
+
if (map.style && map.style._loaded) {
|
11
|
+
const options = { ...props };
|
12
|
+
delete options.id;
|
13
|
+
delete options.children;
|
14
|
+
// @ts-ignore
|
15
|
+
map.addSource(id, options);
|
16
|
+
return map.getSource(id);
|
17
|
+
}
|
18
|
+
return null;
|
19
|
+
}
|
20
|
+
/* eslint-disable complexity */
|
21
|
+
function updateSource(source, props, prevProps) {
|
22
|
+
assert(props.id === prevProps.id, 'source id changed');
|
23
|
+
assert(props.type === prevProps.type, 'source type changed');
|
24
|
+
let changedKey = '';
|
25
|
+
let changedKeyCount = 0;
|
26
|
+
for (const key in props) {
|
27
|
+
if (key !== 'children' && key !== 'id' && !deepEqual(prevProps[key], props[key])) {
|
28
|
+
changedKey = key;
|
29
|
+
changedKeyCount++;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
if (!changedKeyCount) {
|
33
|
+
return;
|
34
|
+
}
|
35
|
+
const type = props.type;
|
36
|
+
if (type === 'geojson') {
|
37
|
+
source.setData(props.data);
|
38
|
+
}
|
39
|
+
else if (type === 'image') {
|
40
|
+
source.updateImage({
|
41
|
+
url: props.url,
|
42
|
+
coordinates: props.coordinates
|
43
|
+
});
|
44
|
+
}
|
45
|
+
else {
|
46
|
+
switch (changedKey) {
|
47
|
+
case 'coordinates':
|
48
|
+
// @ts-ignore
|
49
|
+
source.setCoordinates?.(props.coordinates);
|
50
|
+
break;
|
51
|
+
case 'url':
|
52
|
+
// @ts-ignore
|
53
|
+
source.setUrl?.(props.url);
|
54
|
+
break;
|
55
|
+
case 'tiles':
|
56
|
+
// @ts-ignore
|
57
|
+
source.setTiles?.(props.tiles);
|
58
|
+
break;
|
59
|
+
default:
|
60
|
+
// eslint-disable-next-line
|
61
|
+
console.warn(`Unable to update <Source> prop: ${changedKey}`);
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
/* eslint-enable complexity */
|
66
|
+
function Source(props) {
|
67
|
+
const map = useContext(MapContext).map.getMap();
|
68
|
+
const propsRef = useRef(props);
|
69
|
+
const [, setStyleLoaded] = useState(0);
|
70
|
+
const id = useMemo(() => props.id || `jsx-source-${sourceCounter++}`, []);
|
71
|
+
useEffect(() => {
|
72
|
+
if (map) {
|
73
|
+
/* global setTimeout */
|
74
|
+
const forceUpdate = () => setTimeout(() => setStyleLoaded(version => version + 1), 0);
|
75
|
+
map.on('styledata', forceUpdate);
|
76
|
+
forceUpdate();
|
77
|
+
return () => {
|
78
|
+
map.off('styledata', forceUpdate);
|
79
|
+
// @ts-ignore
|
80
|
+
if (map.style && map.style._loaded && map.getSource(id)) {
|
81
|
+
// Parent effects are destroyed before child ones, see
|
82
|
+
// https://github.com/facebook/react/issues/16728
|
83
|
+
// Source can only be removed after all child layers are removed
|
84
|
+
const allLayers = map.getStyle()?.layers;
|
85
|
+
if (allLayers) {
|
86
|
+
for (const layer of allLayers) {
|
87
|
+
// @ts-ignore (2339) source does not exist on all layer types
|
88
|
+
if (layer.source === id) {
|
89
|
+
map.removeLayer(layer.id);
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
map.removeSource(id);
|
94
|
+
}
|
95
|
+
};
|
96
|
+
}
|
97
|
+
return undefined;
|
98
|
+
}, [map]);
|
99
|
+
// @ts-ignore
|
100
|
+
let source = map && map.style && map.getSource(id);
|
101
|
+
if (source) {
|
102
|
+
updateSource(source, props, propsRef.current);
|
103
|
+
}
|
104
|
+
else {
|
105
|
+
source = createSource(map, id, props);
|
106
|
+
}
|
107
|
+
propsRef.current = props;
|
108
|
+
return ((source &&
|
109
|
+
React.Children.map(props.children, child => child &&
|
110
|
+
cloneElement(child, {
|
111
|
+
source: id
|
112
|
+
}))) ||
|
113
|
+
null);
|
114
|
+
}
|
115
|
+
|
116
|
+
export { Source };
|
117
|
+
//# sourceMappingURL=source.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"source.js","sources":["../../../../../../../../node_modules/@vis.gl/react-maplibre/dist/components/source.js"],"sourcesContent":["import * as React from 'react';\nimport { useContext, useEffect, useMemo, useState, useRef, cloneElement } from 'react';\nimport { MapContext } from \"./map.js\";\nimport assert from \"../utils/assert.js\";\nimport { deepEqual } from \"../utils/deep-equal.js\";\nlet sourceCounter = 0;\nfunction createSource(map, id, props) {\n // @ts-ignore\n if (map.style && map.style._loaded) {\n const options = { ...props };\n delete options.id;\n delete options.children;\n // @ts-ignore\n map.addSource(id, options);\n return map.getSource(id);\n }\n return null;\n}\n/* eslint-disable complexity */\nfunction updateSource(source, props, prevProps) {\n assert(props.id === prevProps.id, 'source id changed');\n assert(props.type === prevProps.type, 'source type changed');\n let changedKey = '';\n let changedKeyCount = 0;\n for (const key in props) {\n if (key !== 'children' && key !== 'id' && !deepEqual(prevProps[key], props[key])) {\n changedKey = key;\n changedKeyCount++;\n }\n }\n if (!changedKeyCount) {\n return;\n }\n const type = props.type;\n if (type === 'geojson') {\n source.setData(props.data);\n }\n else if (type === 'image') {\n source.updateImage({\n url: props.url,\n coordinates: props.coordinates\n });\n }\n else {\n switch (changedKey) {\n case 'coordinates':\n // @ts-ignore\n source.setCoordinates?.(props.coordinates);\n break;\n case 'url':\n // @ts-ignore\n source.setUrl?.(props.url);\n break;\n case 'tiles':\n // @ts-ignore\n source.setTiles?.(props.tiles);\n break;\n default:\n // eslint-disable-next-line\n console.warn(`Unable to update <Source> prop: ${changedKey}`);\n }\n }\n}\n/* eslint-enable complexity */\nexport function Source(props) {\n const map = useContext(MapContext).map.getMap();\n const propsRef = useRef(props);\n const [, setStyleLoaded] = useState(0);\n const id = useMemo(() => props.id || `jsx-source-${sourceCounter++}`, []);\n useEffect(() => {\n if (map) {\n /* global setTimeout */\n const forceUpdate = () => setTimeout(() => setStyleLoaded(version => version + 1), 0);\n map.on('styledata', forceUpdate);\n forceUpdate();\n return () => {\n map.off('styledata', forceUpdate);\n // @ts-ignore\n if (map.style && map.style._loaded && map.getSource(id)) {\n // Parent effects are destroyed before child ones, see\n // https://github.com/facebook/react/issues/16728\n // Source can only be removed after all child layers are removed\n const allLayers = map.getStyle()?.layers;\n if (allLayers) {\n for (const layer of allLayers) {\n // @ts-ignore (2339) source does not exist on all layer types\n if (layer.source === id) {\n map.removeLayer(layer.id);\n }\n }\n }\n map.removeSource(id);\n }\n };\n }\n return undefined;\n }, [map]);\n // @ts-ignore\n let source = map && map.style && map.getSource(id);\n if (source) {\n updateSource(source, props, propsRef.current);\n }\n else {\n source = createSource(map, id, props);\n }\n propsRef.current = props;\n return ((source &&\n React.Children.map(props.children, child => child &&\n cloneElement(child, {\n source: id\n }))) ||\n null);\n}\n//# sourceMappingURL=source.js.map"],"names":[],"mappings":";;;;;;AAKA,IAAI,aAAa,GAAG,CAAC;AACrB,SAAS,YAAY,CAAC,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE;AACtC;AACA,IAAI,IAAI,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE;AACxC,QAAQ,MAAM,OAAO,GAAG,EAAE,GAAG,KAAK,EAAE;AACpC,QAAQ,OAAO,OAAO,CAAC,EAAE;AACzB,QAAQ,OAAO,OAAO,CAAC,QAAQ;AAC/B;AACA,QAAQ,GAAG,CAAC,SAAS,CAAC,EAAE,EAAE,OAAO,CAAC;AAClC,QAAQ,OAAO,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;AAChC;AACA,IAAI,OAAO,IAAI;AACf;AACA;AACA,SAAS,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE;AAChD,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,SAAS,CAAC,EAAE,EAAE,mBAAmB,CAAC;AAC1D,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,EAAE,qBAAqB,CAAC;AAChE,IAAI,IAAI,UAAU,GAAG,EAAE;AACvB,IAAI,IAAI,eAAe,GAAG,CAAC;AAC3B,IAAI,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE;AAC7B,QAAQ,IAAI,GAAG,KAAK,UAAU,IAAI,GAAG,KAAK,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE;AAC1F,YAAY,UAAU,GAAG,GAAG;AAC5B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,GAAG,YAAY,CAAC,GAAG,EAAE,EAAE,EAAE,KAAK,CAAC;AAC7C;AACA,IAAI,QAAQ,CAAC,OAAO,GAAG,KAAK;AAC5B,IAAI,QAAQ,CAAC,MAAM;AACnB,QAAQ,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,IAAI,KAAK;AACzD,YAAY,YAAY,CAAC,KAAK,EAAE;AAChC,gBAAgB,MAAM,EAAE;AACxB,aAAa,CAAC,CAAC;AACf,QAAQ,IAAI;AACZ;;;;","x_google_ignoreList":[0]}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { memo, useEffect } from 'react';
|
2
|
+
import { applyReactStyle } from '../utils/apply-react-style.js';
|
3
|
+
import { useControl } from './use-control.js';
|
4
|
+
|
5
|
+
function _TerrainControl(props) {
|
6
|
+
const ctrl = useControl(({ mapLib }) => new mapLib.TerrainControl(props), {
|
7
|
+
position: props.position
|
8
|
+
});
|
9
|
+
useEffect(() => {
|
10
|
+
applyReactStyle(ctrl._container, props.style);
|
11
|
+
}, [props.style]);
|
12
|
+
return null;
|
13
|
+
}
|
14
|
+
memo(_TerrainControl);
|
15
|
+
//# sourceMappingURL=terrain-control.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"terrain-control.js","sources":["../../../../../../../../node_modules/@vis.gl/react-maplibre/dist/components/terrain-control.js"],"sourcesContent":["import { useEffect, memo } from 'react';\nimport { applyReactStyle } from \"../utils/apply-react-style.js\";\nimport { useControl } from \"./use-control.js\";\nfunction _TerrainControl(props) {\n const ctrl = useControl(({ mapLib }) => new mapLib.TerrainControl(props), {\n position: props.position\n });\n useEffect(() => {\n applyReactStyle(ctrl._container, props.style);\n }, [props.style]);\n return null;\n}\nexport const TerrainControl = memo(_TerrainControl);\n//# sourceMappingURL=terrain-control.js.map"],"names":[],"mappings":";;;;AAGA,SAAS,eAAe,CAAC,KAAK,EAAE;AAChC,IAAI,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,IAAI,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE;AAC9E,QAAQ,QAAQ,EAAE,KAAK,CAAC;AACxB,KAAK,CAAC;AACN,IAAI,SAAS,CAAC,MAAM;AACpB,QAAQ,eAAe,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,KAAK,CAAC;AACrD,KAAK,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACrB,IAAI,OAAO,IAAI;AACf;AAC8B,IAAI,CAAC,eAAe","x_google_ignoreList":[0]}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { useContext, useMemo, useEffect } from 'react';
|
2
|
+
import { MapContext } from './map.js';
|
3
|
+
|
4
|
+
function useControl(onCreate, arg1, arg2, arg3) {
|
5
|
+
const context = useContext(MapContext);
|
6
|
+
const ctrl = useMemo(() => onCreate(context), []);
|
7
|
+
useEffect(() => {
|
8
|
+
const opts = (arg1);
|
9
|
+
const onAdd = typeof arg1 === 'function' && "undefined" === 'function' ? arg1 : null;
|
10
|
+
const onRemove = typeof arg1 === 'function' ? arg1 : null;
|
11
|
+
const { map } = context;
|
12
|
+
if (!map.hasControl(ctrl)) {
|
13
|
+
map.addControl(ctrl, opts?.position);
|
14
|
+
if (onAdd) {
|
15
|
+
onAdd(context);
|
16
|
+
}
|
17
|
+
}
|
18
|
+
return () => {
|
19
|
+
if (onRemove) {
|
20
|
+
onRemove(context);
|
21
|
+
}
|
22
|
+
// Map might have been removed (parent effects are destroyed before child ones)
|
23
|
+
if (map.hasControl(ctrl)) {
|
24
|
+
map.removeControl(ctrl);
|
25
|
+
}
|
26
|
+
};
|
27
|
+
}, []);
|
28
|
+
return ctrl;
|
29
|
+
}
|
30
|
+
|
31
|
+
export { useControl };
|
32
|
+
//# sourceMappingURL=use-control.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"use-control.js","sources":["../../../../../../../../node_modules/@vis.gl/react-maplibre/dist/components/use-control.js"],"sourcesContent":["import { useContext, useMemo, useEffect } from 'react';\nimport { MapContext } from \"./map.js\";\nexport function useControl(onCreate, arg1, arg2, arg3) {\n const context = useContext(MapContext);\n const ctrl = useMemo(() => onCreate(context), []);\n useEffect(() => {\n const opts = (arg3 || arg2 || arg1);\n const onAdd = typeof arg1 === 'function' && typeof arg2 === 'function' ? arg1 : null;\n const onRemove = typeof arg2 === 'function' ? arg2 : typeof arg1 === 'function' ? arg1 : null;\n const { map } = context;\n if (!map.hasControl(ctrl)) {\n map.addControl(ctrl, opts?.position);\n if (onAdd) {\n onAdd(context);\n }\n }\n return () => {\n if (onRemove) {\n onRemove(context);\n }\n // Map might have been removed (parent effects are destroyed before child ones)\n if (map.hasControl(ctrl)) {\n map.removeControl(ctrl);\n }\n };\n }, []);\n return ctrl;\n}\n//# sourceMappingURL=use-control.js.map"],"names":[],"mappings":";;;AAEO,SAAS,UAAU,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE;AACvD,IAAI,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,CAAC;AAC1C,IAAI,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,QAAQ,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;AACrD,IAAI,SAAS,CAAC,MAAM;AACpB,QAAQ,MAAM,IAAI,IAAoB,IAAI,CAAC;AAC3C,QAAQ,MAAM,KAAK,GAAG,OAAO,IAAI,KAAK,UAAU,IAAI,WAAW,KAAK,UAAU,GAAG,IAAI,GAAG,IAAI;AAC5F,QAAQ,MAAM,QAAQ,GAAuC,OAAO,IAAI,KAAK,UAAU,GAAG,IAAI,GAAG,IAAI;AACrG,QAAQ,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO;AAC/B,QAAQ,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;AACnC,YAAY,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC;AAChD,YAAY,IAAI,KAAK,EAAE;AACvB,gBAAgB,KAAK,CAAC,OAAO,CAAC;AAC9B;AACA;AACA,QAAQ,OAAO,MAAM;AACrB,YAAY,IAAI,QAAQ,EAAE;AAC1B,gBAAgB,QAAQ,CAAC,OAAO,CAAC;AACjC;AACA;AACA,YAAY,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;AACtC,gBAAgB,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC;AACvC;AACA,SAAS;AACT,KAAK,EAAE,EAAE,CAAC;AACV,IAAI,OAAO,IAAI;AACf;;;;","x_google_ignoreList":[0]}
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { useState, useCallback, useContext, useMemo } from 'react';
|
3
|
+
import { MapContext } from './map.js';
|
4
|
+
|
5
|
+
const MountedMapsContext = React.createContext(null);
|
6
|
+
const MapProvider = props => {
|
7
|
+
const [maps, setMaps] = useState({});
|
8
|
+
const onMapMount = useCallback((map, id = 'default') => {
|
9
|
+
setMaps(currMaps => {
|
10
|
+
if (id === 'current') {
|
11
|
+
throw new Error("'current' cannot be used as map id");
|
12
|
+
}
|
13
|
+
if (currMaps[id]) {
|
14
|
+
throw new Error(`Multiple maps with the same id: ${id}`);
|
15
|
+
}
|
16
|
+
return { ...currMaps, [id]: map };
|
17
|
+
});
|
18
|
+
}, []);
|
19
|
+
const onMapUnmount = useCallback((id = 'default') => {
|
20
|
+
setMaps(currMaps => {
|
21
|
+
if (currMaps[id]) {
|
22
|
+
const nextMaps = { ...currMaps };
|
23
|
+
delete nextMaps[id];
|
24
|
+
return nextMaps;
|
25
|
+
}
|
26
|
+
return currMaps;
|
27
|
+
});
|
28
|
+
}, []);
|
29
|
+
return (React.createElement(MountedMapsContext.Provider, { value: {
|
30
|
+
maps,
|
31
|
+
onMapMount,
|
32
|
+
onMapUnmount
|
33
|
+
} }, props.children));
|
34
|
+
};
|
35
|
+
function useMap() {
|
36
|
+
const maps = useContext(MountedMapsContext)?.maps;
|
37
|
+
const currentMap = useContext(MapContext);
|
38
|
+
const mapsWithCurrent = useMemo(() => {
|
39
|
+
return { ...maps, current: currentMap?.map };
|
40
|
+
}, [maps, currentMap]);
|
41
|
+
return mapsWithCurrent;
|
42
|
+
}
|
43
|
+
|
44
|
+
export { MapProvider, MountedMapsContext, useMap };
|
45
|
+
//# sourceMappingURL=use-map.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"use-map.js","sources":["../../../../../../../../node_modules/@vis.gl/react-maplibre/dist/components/use-map.js"],"sourcesContent":["import * as React from 'react';\nimport { useState, useCallback, useMemo, useContext } from 'react';\nimport { MapContext } from \"./map.js\";\nexport const MountedMapsContext = React.createContext(null);\nexport const MapProvider = props => {\n const [maps, setMaps] = useState({});\n const onMapMount = useCallback((map, id = 'default') => {\n setMaps(currMaps => {\n if (id === 'current') {\n throw new Error(\"'current' cannot be used as map id\");\n }\n if (currMaps[id]) {\n throw new Error(`Multiple maps with the same id: ${id}`);\n }\n return { ...currMaps, [id]: map };\n });\n }, []);\n const onMapUnmount = useCallback((id = 'default') => {\n setMaps(currMaps => {\n if (currMaps[id]) {\n const nextMaps = { ...currMaps };\n delete nextMaps[id];\n return nextMaps;\n }\n return currMaps;\n });\n }, []);\n return (React.createElement(MountedMapsContext.Provider, { value: {\n maps,\n onMapMount,\n onMapUnmount\n } }, props.children));\n};\nexport function useMap() {\n const maps = useContext(MountedMapsContext)?.maps;\n const currentMap = useContext(MapContext);\n const mapsWithCurrent = useMemo(() => {\n return { ...maps, current: currentMap?.map };\n }, [maps, currentMap]);\n return mapsWithCurrent;\n}\n//# sourceMappingURL=use-map.js.map"],"names":[],"mappings":";;;;AAGY,MAAC,kBAAkB,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI;AAC9C,MAAC,WAAW,GAAG,KAAK,IAAI;AACpC,IAAI,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,EAA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AG,OAAO,CAAC,MAAM;AAC1C,QAAQ,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE;AACpD,KAAK,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;AAC1B,IAAI,OAAO,eAAe;AAC1B;;;;","x_google_ignoreList":[0]}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
/** These methods may break the react binding if called directly */
|
2
|
+
const skipMethods = [
|
3
|
+
'setMaxBounds',
|
4
|
+
'setMinZoom',
|
5
|
+
'setMaxZoom',
|
6
|
+
'setMinPitch',
|
7
|
+
'setMaxPitch',
|
8
|
+
'setRenderWorldCopies',
|
9
|
+
'setProjection',
|
10
|
+
'setStyle',
|
11
|
+
'addSource',
|
12
|
+
'removeSource',
|
13
|
+
'addLayer',
|
14
|
+
'removeLayer',
|
15
|
+
'setLayerZoomRange',
|
16
|
+
'setFilter',
|
17
|
+
'setPaintProperty',
|
18
|
+
'setLayoutProperty',
|
19
|
+
'setLight',
|
20
|
+
'setTerrain',
|
21
|
+
'setFog',
|
22
|
+
'remove'
|
23
|
+
];
|
24
|
+
function createRef(mapInstance) {
|
25
|
+
if (!mapInstance) {
|
26
|
+
return null;
|
27
|
+
}
|
28
|
+
const map = mapInstance.map;
|
29
|
+
const result = {
|
30
|
+
getMap: () => map
|
31
|
+
};
|
32
|
+
for (const key of getMethodNames(map)) {
|
33
|
+
// @ts-expect-error
|
34
|
+
if (!(key in result) && !skipMethods.includes(key)) {
|
35
|
+
result[key] = map[key].bind(map);
|
36
|
+
}
|
37
|
+
}
|
38
|
+
return result;
|
39
|
+
}
|
40
|
+
function getMethodNames(obj) {
|
41
|
+
const result = new Set();
|
42
|
+
let proto = obj;
|
43
|
+
while (proto) {
|
44
|
+
for (const key of Object.getOwnPropertyNames(proto)) {
|
45
|
+
if (key[0] !== '_' &&
|
46
|
+
typeof obj[key] === 'function' &&
|
47
|
+
key !== 'fire' &&
|
48
|
+
key !== 'setEventedParent') {
|
49
|
+
result.add(key);
|
50
|
+
}
|
51
|
+
}
|
52
|
+
proto = Object.getPrototypeOf(proto);
|
53
|
+
}
|
54
|
+
return Array.from(result);
|
55
|
+
}
|
56
|
+
|
57
|
+
export { createRef as default };
|
58
|
+
//# sourceMappingURL=create-ref.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"create-ref.js","sources":["../../../../../../../../node_modules/@vis.gl/react-maplibre/dist/maplibre/create-ref.js"],"sourcesContent":["/** These methods may break the react binding if called directly */\nconst skipMethods = [\n 'setMaxBounds',\n 'setMinZoom',\n 'setMaxZoom',\n 'setMinPitch',\n 'setMaxPitch',\n 'setRenderWorldCopies',\n 'setProjection',\n 'setStyle',\n 'addSource',\n 'removeSource',\n 'addLayer',\n 'removeLayer',\n 'setLayerZoomRange',\n 'setFilter',\n 'setPaintProperty',\n 'setLayoutProperty',\n 'setLight',\n 'setTerrain',\n 'setFog',\n 'remove'\n];\nexport default function createRef(mapInstance) {\n if (!mapInstance) {\n return null;\n }\n const map = mapInstance.map;\n const result = {\n getMap: () => map\n };\n for (const key of getMethodNames(map)) {\n // @ts-expect-error\n if (!(key in result) && !skipMethods.includes(key)) {\n result[key] = map[key].bind(map);\n }\n }\n return result;\n}\nfunction getMethodNames(obj) {\n const result = new Set();\n let proto = obj;\n while (proto) {\n for (const key of Object.getOwnPropertyNames(proto)) {\n if (key[0] !== '_' &&\n typeof obj[key] === 'function' &&\n key !== 'fire' &&\n key !== 'setEventedParent') {\n result.add(key);\n }\n }\n proto = Object.getPrototypeOf(proto);\n }\n return Array.from(result);\n}\n//# sourceMappingURL=create-ref.js.map"],"names":[],"mappings":"AAAA;AACA,MAAM,WAAW,GAAG;AACpB,IAAI,cAAc;AAClB,IAAI,YAAY;AAChB,IAAI,YAAY;AAChB,IAAI,aAAa;AACjB,IAAI,aAAa;AACjB,IAAI,sBAAsB;AAC1B,IAAI,eAAe;AACnB,IAAI,UAAU;AACd,IAAI,WAAW;AACf,IAAI,c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