react-three-map 0.8.1 → 1.0.0-next.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/CHANGELOG.md +19 -0
- package/README.md +41 -24
- package/dist/cjs/main.js +1283 -44
- package/dist/es/main.mjs +2 -1
- package/dist/es/main10.mjs +71 -10
- package/dist/es/main10.mjs.map +1 -1
- package/dist/es/main11.mjs +12 -35
- package/dist/es/main11.mjs.map +1 -1
- package/dist/es/main12.mjs +12 -13
- package/dist/es/main12.mjs.map +1 -1
- package/dist/es/main13.mjs +42 -24
- package/dist/es/main13.mjs.map +1 -1
- package/dist/es/main14.mjs +13 -4
- package/dist/es/main14.mjs.map +1 -1
- package/dist/es/main15.mjs +22 -31
- package/dist/es/main15.mjs.map +1 -1
- package/dist/es/main16.mjs +87 -22
- package/dist/es/main16.mjs.map +1 -1
- package/dist/es/main17.mjs +14 -94
- package/dist/es/main17.mjs.map +1 -1
- package/dist/es/main18.mjs +22 -62
- package/dist/es/main18.mjs.map +1 -1
- package/dist/es/main19.mjs +27 -20
- package/dist/es/main19.mjs.map +1 -1
- package/dist/es/main20.mjs +8 -23
- package/dist/es/main20.mjs.map +1 -1
- package/dist/es/main21.mjs +34 -16
- package/dist/es/main21.mjs.map +1 -1
- package/dist/es/main22.mjs +12 -80
- package/dist/es/main22.mjs.map +1 -1
- package/dist/es/main23.mjs +26 -0
- package/dist/es/main23.mjs.map +1 -0
- package/dist/es/main24.mjs +5 -0
- package/dist/es/main24.mjs.map +1 -0
- package/dist/es/main25.mjs +33 -0
- package/dist/es/main25.mjs.map +1 -0
- package/dist/es/main26.mjs +27 -0
- package/dist/es/main26.mjs.map +1 -0
- package/dist/es/main27.mjs +98 -0
- package/dist/es/main27.mjs.map +1 -0
- package/dist/es/main28.mjs +66 -0
- package/dist/es/main28.mjs.map +1 -0
- package/dist/es/main29.mjs +23 -0
- package/dist/es/main29.mjs.map +1 -0
- package/dist/es/main3.mjs +13 -4
- package/dist/es/main3.mjs.map +1 -1
- package/dist/es/main30.mjs +27 -0
- package/dist/es/main30.mjs.map +1 -0
- package/dist/es/main31.mjs +19 -0
- package/dist/es/main31.mjs.map +1 -0
- package/dist/es/main32.mjs +83 -0
- package/dist/es/main32.mjs.map +1 -0
- package/dist/es/main33.mjs +501 -0
- package/dist/es/main33.mjs.map +1 -0
- package/dist/es/main34.mjs +90 -0
- package/dist/es/main34.mjs.map +1 -0
- package/dist/es/main35.mjs +6 -0
- package/dist/es/main35.mjs.map +1 -0
- package/dist/es/main36.mjs +26 -0
- package/dist/es/main36.mjs.map +1 -0
- package/dist/es/main37.mjs +19 -0
- package/dist/es/main37.mjs.map +1 -0
- package/dist/es/main38.mjs +50 -0
- package/dist/es/main38.mjs.map +1 -0
- package/dist/es/main39.mjs +31 -0
- package/dist/es/main39.mjs.map +1 -0
- package/dist/es/main4.mjs +3 -3
- package/dist/es/main40.mjs +9 -0
- package/dist/es/main40.mjs.map +1 -0
- package/dist/es/main41.mjs +62 -0
- package/dist/es/main41.mjs.map +1 -0
- package/dist/es/main42.mjs +42 -0
- package/dist/es/main42.mjs.map +1 -0
- package/dist/es/main5.mjs +22 -2
- package/dist/es/main5.mjs.map +1 -1
- package/dist/es/main6.mjs +1 -1
- package/dist/es/main7.mjs +1 -1
- package/dist/es/main8.mjs +87 -20
- package/dist/es/main8.mjs.map +1 -1
- package/dist/es/main9.mjs +80 -24
- package/dist/es/main9.mjs.map +1 -1
- package/dist/maplibre/cjs/main.js +30 -9
- package/dist/maplibre/es/main.mjs +2 -1
- package/dist/maplibre/es/main.mjs.map +1 -1
- package/dist/maplibre/es/main14.mjs +1 -1
- package/dist/maplibre/es/main14.mjs.map +1 -1
- package/dist/maplibre/es/main16.mjs +2 -1
- package/dist/maplibre/es/main16.mjs.map +1 -1
- package/dist/maplibre/es/main3.mjs +2 -2
- package/dist/maplibre/es/main3.mjs.map +1 -1
- package/dist/maplibre/es/main5.mjs +21 -1
- package/dist/maplibre/es/main5.mjs.map +1 -1
- package/dist/maplibre/types/api/coords-to-vector-3.d.ts +1 -0
- package/dist/maplibre/types/core/canvas-in-layer/use-canvas-in-layer.d.ts +5 -1
- package/dist/maplibre/types/core/canvas-in-layer/use-render.d.ts +5 -1
- package/dist/maplibre/types/core/earth-radius.d.ts +1 -1
- package/dist/maplibre/types/core/generic-map.d.ts +2 -2
- package/dist/maplibre/types/{mapbox → maplibre}/canvas.d.ts +1 -1
- package/dist/maplibre/types/maplibre.index.d.ts +1 -1
- package/dist/types/api/coords-to-vector-3.d.ts +1 -0
- package/dist/types/core/canvas-in-layer/use-canvas-in-layer.d.ts +5 -1
- package/dist/types/core/canvas-in-layer/use-render.d.ts +5 -1
- package/dist/types/core/earth-radius.d.ts +1 -1
- package/dist/types/core/generic-map.d.ts +2 -2
- package/dist/types/mapbox/canvas.d.ts +1 -1
- package/made-with/studio-carto-urban-project.webp +0 -0
- package/package.json +7 -7
- package/stories/package.json +4 -4
- package/stories/yarn.lock +175 -98
package/dist/es/main.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMap as useMap$1 } from "./main2.mjs";
|
|
2
2
|
import { Canvas } from "./main3.mjs";
|
|
3
3
|
import { Coordinates } from "./main4.mjs";
|
|
4
|
-
import { coordsToVector3 } from "./main5.mjs";
|
|
4
|
+
import { averageMercatorScale, coordsToVector3 } from "./main5.mjs";
|
|
5
5
|
import { NearCoordinates } from "./main6.mjs";
|
|
6
6
|
import { vector3ToCoords } from "./main7.mjs";
|
|
7
7
|
const useMap = useMap$1;
|
|
@@ -9,6 +9,7 @@ export {
|
|
|
9
9
|
Canvas,
|
|
10
10
|
Coordinates,
|
|
11
11
|
NearCoordinates,
|
|
12
|
+
averageMercatorScale,
|
|
12
13
|
coordsToVector3,
|
|
13
14
|
useMap,
|
|
14
15
|
vector3ToCoords
|
package/dist/es/main10.mjs
CHANGED
|
@@ -1,12 +1,73 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { createPortal } from "react-dom";
|
|
2
|
+
import { memo, forwardRef, useContext, useMemo, useRef, useEffect, useImperativeHandle } from "react";
|
|
3
|
+
import { applyReactStyle } from "./main37.mjs";
|
|
4
|
+
import { MapContext } from "./main8.mjs";
|
|
5
|
+
import { deepEqual } from "./main38.mjs";
|
|
6
|
+
function getClassList(className) {
|
|
7
|
+
return new Set(className ? className.trim().split(/\s+/) : []);
|
|
8
|
+
}
|
|
9
|
+
memo(forwardRef((props, ref) => {
|
|
10
|
+
const { map, mapLib } = useContext(MapContext);
|
|
11
|
+
const container = useMemo(() => {
|
|
12
|
+
return document.createElement("div");
|
|
7
13
|
}, []);
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
14
|
+
const thisRef = useRef({ props });
|
|
15
|
+
thisRef.current.props = props;
|
|
16
|
+
const popup = useMemo(() => {
|
|
17
|
+
const options = { ...props };
|
|
18
|
+
const pp = new mapLib.Popup(options);
|
|
19
|
+
pp.setLngLat([props.longitude, props.latitude]);
|
|
20
|
+
pp.once("open", (e) => {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
(_b = (_a = thisRef.current.props).onOpen) == null ? void 0 : _b.call(_a, e);
|
|
23
|
+
});
|
|
24
|
+
return pp;
|
|
25
|
+
}, []);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
const onClose = (e) => {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
(_b = (_a = thisRef.current.props).onClose) == null ? void 0 : _b.call(_a, e);
|
|
30
|
+
};
|
|
31
|
+
popup.on("close", onClose);
|
|
32
|
+
popup.setDOMContent(container).addTo(map.getMap());
|
|
33
|
+
return () => {
|
|
34
|
+
popup.off("close", onClose);
|
|
35
|
+
if (popup.isOpen()) {
|
|
36
|
+
popup.remove();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
applyReactStyle(popup.getElement(), props.style);
|
|
42
|
+
}, [props.style]);
|
|
43
|
+
useImperativeHandle(ref, () => popup, []);
|
|
44
|
+
if (popup.isOpen()) {
|
|
45
|
+
if (popup.getLngLat().lng !== props.longitude || popup.getLngLat().lat !== props.latitude) {
|
|
46
|
+
popup.setLngLat([props.longitude, props.latitude]);
|
|
47
|
+
}
|
|
48
|
+
if (props.offset && !deepEqual(popup.options.offset, props.offset)) {
|
|
49
|
+
popup.setOffset(props.offset);
|
|
50
|
+
}
|
|
51
|
+
if (popup.options.anchor !== props.anchor || popup.options.maxWidth !== props.maxWidth) {
|
|
52
|
+
popup.options.anchor = props.anchor;
|
|
53
|
+
popup.setMaxWidth(props.maxWidth);
|
|
54
|
+
}
|
|
55
|
+
if (popup.options.className !== props.className) {
|
|
56
|
+
const prevClassList = getClassList(popup.options.className);
|
|
57
|
+
const nextClassList = getClassList(props.className);
|
|
58
|
+
for (const c of prevClassList) {
|
|
59
|
+
if (!nextClassList.has(c)) {
|
|
60
|
+
popup.removeClassName(c);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
for (const c of nextClassList) {
|
|
64
|
+
if (!prevClassList.has(c)) {
|
|
65
|
+
popup.addClassName(c);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
popup.options.className = props.className;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return createPortal(props.children, container);
|
|
72
|
+
}));
|
|
12
73
|
//# sourceMappingURL=main10.mjs.map
|
package/dist/es/main10.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main10.mjs","sources":["../../
|
|
1
|
+
{"version":3,"file":"main10.mjs","sources":["../../node_modules/@vis.gl/react-mapbox/dist/components/popup.js"],"sourcesContent":["import { createPortal } from 'react-dom';\nimport { useImperativeHandle, useEffect, useMemo, useRef, useContext, forwardRef, memo } from 'react';\nimport { applyReactStyle } from \"../utils/apply-react-style.js\";\nimport { MapContext } from \"./map.js\";\nimport { deepEqual } from \"../utils/deep-equal.js\";\n// Adapted from https://github.com/mapbox/mapbox-gl-js/blob/v1.13.0/src/ui/popup.js\nfunction getClassList(className) {\n return new Set(className ? className.trim().split(/\\s+/) : []);\n}\n/* eslint-disable complexity,max-statements */\nexport const Popup = memo(forwardRef((props, ref) => {\n const { map, mapLib } = useContext(MapContext);\n const container = useMemo(() => {\n return document.createElement('div');\n }, []);\n const thisRef = useRef({ props });\n thisRef.current.props = props;\n const popup = useMemo(() => {\n const options = { ...props };\n const pp = new mapLib.Popup(options);\n pp.setLngLat([props.longitude, props.latitude]);\n pp.once('open', e => {\n thisRef.current.props.onOpen?.(e);\n });\n return pp;\n }, []);\n useEffect(() => {\n const onClose = e => {\n thisRef.current.props.onClose?.(e);\n };\n popup.on('close', onClose);\n popup.setDOMContent(container).addTo(map.getMap());\n return () => {\n // https://github.com/visgl/react-map-gl/issues/1825\n // onClose should not be fired if the popup is removed by unmounting\n // When using React strict mode, the component is mounted twice.\n // Firing the onClose callback here would be a false signal to remove the component.\n popup.off('close', onClose);\n if (popup.isOpen()) {\n popup.remove();\n }\n };\n }, []);\n useEffect(() => {\n applyReactStyle(popup.getElement(), props.style);\n }, [props.style]);\n useImperativeHandle(ref, () => popup, []);\n if (popup.isOpen()) {\n if (popup.getLngLat().lng !== props.longitude || popup.getLngLat().lat !== props.latitude) {\n popup.setLngLat([props.longitude, props.latitude]);\n }\n if (props.offset && !deepEqual(popup.options.offset, props.offset)) {\n popup.setOffset(props.offset);\n }\n if (popup.options.anchor !== props.anchor || popup.options.maxWidth !== props.maxWidth) {\n popup.options.anchor = props.anchor;\n popup.setMaxWidth(props.maxWidth);\n }\n if (popup.options.className !== props.className) {\n const prevClassList = getClassList(popup.options.className);\n const nextClassList = getClassList(props.className);\n for (const c of prevClassList) {\n if (!nextClassList.has(c)) {\n popup.removeClassName(c);\n }\n }\n for (const c of nextClassList) {\n if (!prevClassList.has(c)) {\n popup.addClassName(c);\n }\n }\n popup.options.className = props.className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QAAI,MAAM,YAAY,QAAQ,MAAM,aAAa,MAAM,UAAW,EAAC,QAAQ,MAAM,UAAU;AACvF,YAAM,UAAU,CAAC,MAAM,WAAW,MAAM,QAAQ,CAAC;AAAA,IACpD;AACD,QAAI,MAAM,UAAU,CAAC,UAAU,MAAM,QAAQ,QAAQ,MAAM,MAAM,GAAG;AAChE,YAAM,UAAU,MAAM,MAAM;AAAA,IAC/B;AACD,QAAI,MAAM,QAAQ,WAAW,MAAM,UAAU,MAAM,QAAQ,aAAa,MAAM,UAAU;AACpF,YAAM,QAAQ,SAAS,MAAM;AAC7B,YAAM,YAAY,MAAM,QAAQ;AAAA,IACnC;AACD,QAAI,MAAM,QAAQ,cAAc,MAAM,WAAW;AAC7C,YAAM,gBAAgB,aAAa,MAAM,QAAQ,SAAS;AAC1D,YAAM,gBAAgB,aAAa,MAAM,SAAS;AAClD,iBAAW,KAAK,eAAe;AAC3B,YAAI,CAAC,cAAc,IAAI,CAAC,GAAG;AACvB,gBAAM,gBAAgB,CAAC;AAAA,QAC1B;AAAA,MACJ;AACD,iBAAW,KAAK,eAAe;AAC3B,YAAI,CAAC,cAAc,IAAI,CAAC,GAAG;AACvB,gBAAM,aAAa,CAAC;AAAA,QACvB;AAAA,MACJ;AACD,YAAM,QAAQ,YAAY,MAAM;AAAA,IACnC;AAAA,EACJ;AACD,SAAO,aAAa,MAAM,UAAU,SAAS;AACjD,CAAC,CAAC;","x_google_ignoreList":[0]}
|
package/dist/es/main11.mjs
CHANGED
|
@@ -1,37 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
camera.projectionMatrix.copy(camera.matrix).premultiply(projByView);
|
|
13
|
-
camera.projectionMatrixInverse.copy(camera.projectionMatrix).invert();
|
|
14
|
-
camera.far = calculateFar(
|
|
15
|
-
camera.matrix.elements[10],
|
|
16
|
-
camera.matrix.elements[14],
|
|
17
|
-
camera.near
|
|
18
|
-
);
|
|
19
|
-
camera.userData.projByView = projByView.toArray();
|
|
20
|
-
camera.userData.projByViewInv = projByViewInv.toArray();
|
|
1
|
+
import { memo, useEffect } from "react";
|
|
2
|
+
import { applyReactStyle } from "./main37.mjs";
|
|
3
|
+
import { useControl } from "./main39.mjs";
|
|
4
|
+
function _AttributionControl(props) {
|
|
5
|
+
const ctrl = useControl(({ mapLib }) => new mapLib.AttributionControl(props), {
|
|
6
|
+
position: props.position
|
|
7
|
+
});
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
applyReactStyle(ctrl._container, props.style);
|
|
10
|
+
}, [props.style]);
|
|
11
|
+
return null;
|
|
21
12
|
}
|
|
22
|
-
|
|
23
|
-
target.position.setScalar(0).applyMatrix4(projByViewInv2);
|
|
24
|
-
target.up.set(0, -1, 0).applyMatrix4(projByViewInv2).negate().add(target.position).normalize();
|
|
25
|
-
fwd.set(0, 0, 1).applyMatrix4(projByViewInv2);
|
|
26
|
-
target.lookAt(fwd);
|
|
27
|
-
};
|
|
28
|
-
function calculateFar(c, d, near) {
|
|
29
|
-
const numerator = d * (c - 1);
|
|
30
|
-
const denominator = c * near + near;
|
|
31
|
-
const far = numerator / denominator;
|
|
32
|
-
return far;
|
|
33
|
-
}
|
|
34
|
-
export {
|
|
35
|
-
syncCamera
|
|
36
|
-
};
|
|
13
|
+
memo(_AttributionControl);
|
|
37
14
|
//# sourceMappingURL=main11.mjs.map
|
package/dist/es/main11.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main11.mjs","sources":["../../
|
|
1
|
+
{"version":3,"file":"main11.mjs","sources":["../../node_modules/@vis.gl/react-mapbox/dist/components/attribution-control.js"],"sourcesContent":["import { useEffect, memo } from 'react';\nimport { applyReactStyle } from \"../utils/apply-react-style.js\";\nimport { useControl } from \"./use-control.js\";\nfunction _AttributionControl(props) {\n const ctrl = useControl(({ mapLib }) => new mapLib.AttributionControl(props), {\n position: props.position\n });\n useEffect(() => {\n applyReactStyle(ctrl._container, props.style);\n }, [props.style]);\n return null;\n}\nexport const AttributionControl = memo(_AttributionControl);\n//# sourceMappingURL=attribution-control.js.map"],"names":[],"mappings":";;;AAGA,SAAS,oBAAoB,OAAO;AAChC,QAAM,OAAO,WAAW,CAAC,EAAE,OAAQ,MAAK,IAAI,OAAO,mBAAmB,KAAK,GAAG;AAAA,IAC1E,UAAU,MAAM;AAAA,EACxB,CAAK;AACD,YAAU,MAAM;AACZ,oBAAgB,KAAK,YAAY,MAAM,KAAK;AAAA,EACpD,GAAO,CAAC,MAAM,KAAK,CAAC;AAChB,SAAO;AACX;AACkC,KAAK,mBAAmB;","x_google_ignoreList":[0]}
|
package/dist/es/main12.mjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { memo, useEffect } from "react";
|
|
2
|
+
import { applyReactStyle } from "./main37.mjs";
|
|
3
|
+
import { useControl } from "./main39.mjs";
|
|
4
|
+
function _FullscreenControl(props) {
|
|
5
|
+
const ctrl = useControl(({ mapLib }) => new mapLib.FullscreenControl({
|
|
6
|
+
container: props.containerId && document.getElementById(props.containerId)
|
|
7
|
+
}), { position: props.position });
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
applyReactStyle(ctrl._controlContainer, props.style);
|
|
10
|
+
}, [props.style]);
|
|
11
|
+
return null;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
-
useCoordsToMatrix
|
|
14
|
-
};
|
|
13
|
+
memo(_FullscreenControl);
|
|
15
14
|
//# sourceMappingURL=main12.mjs.map
|
package/dist/es/main12.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main12.mjs","sources":["../../
|
|
1
|
+
{"version":3,"file":"main12.mjs","sources":["../../node_modules/@vis.gl/react-mapbox/dist/components/fullscreen-control.js"],"sourcesContent":["import { useEffect, memo } from 'react';\nimport { applyReactStyle } from \"../utils/apply-react-style.js\";\nimport { useControl } from \"./use-control.js\";\nfunction _FullscreenControl(props) {\n const ctrl = useControl(({ mapLib }) => new mapLib.FullscreenControl({\n container: props.containerId && document.getElementById(props.containerId)\n }), { position: props.position });\n useEffect(() => {\n applyReactStyle(ctrl._controlContainer, props.style);\n }, [props.style]);\n return null;\n}\nexport const FullscreenControl = memo(_FullscreenControl);\n//# sourceMappingURL=fullscreen-control.js.map"],"names":[],"mappings":";;;AAGA,SAAS,mBAAmB,OAAO;AAC/B,QAAM,OAAO,WAAW,CAAC,EAAE,OAAM,MAAO,IAAI,OAAO,kBAAkB;AAAA,IACjE,WAAW,MAAM,eAAe,SAAS,eAAe,MAAM,WAAW;AAAA,EAC5E,CAAA,GAAG,EAAE,UAAU,MAAM,SAAU,CAAA;AAChC,YAAU,MAAM;AACZ,oBAAgB,KAAK,mBAAmB,MAAM,KAAK;AAAA,EAC3D,GAAO,CAAC,MAAM,KAAK,CAAC;AAChB,SAAO;AACX;AACiC,KAAK,kBAAkB;","x_google_ignoreList":[0]}
|
package/dist/es/main13.mjs
CHANGED
|
@@ -1,26 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
function
|
|
5
|
-
const
|
|
6
|
-
|
|
1
|
+
import { memo, forwardRef, useRef, useImperativeHandle, useEffect } from "react";
|
|
2
|
+
import { applyReactStyle } from "./main37.mjs";
|
|
3
|
+
import { useControl } from "./main39.mjs";
|
|
4
|
+
function _GeolocateControl(props, ref) {
|
|
5
|
+
const thisRef = useRef({ props });
|
|
6
|
+
const ctrl = useControl(({ mapLib }) => {
|
|
7
|
+
const gc = new mapLib.GeolocateControl(props);
|
|
8
|
+
const setupUI = gc._setupUI.bind(gc);
|
|
9
|
+
gc._setupUI = (args) => {
|
|
10
|
+
if (!gc._container.hasChildNodes()) {
|
|
11
|
+
setupUI(args);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
gc.on("geolocate", (e) => {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
(_b = (_a = thisRef.current.props).onGeolocate) == null ? void 0 : _b.call(_a, e);
|
|
17
|
+
});
|
|
18
|
+
gc.on("error", (e) => {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
(_b = (_a = thisRef.current.props).onError) == null ? void 0 : _b.call(_a, e);
|
|
21
|
+
});
|
|
22
|
+
gc.on("outofmaxbounds", (e) => {
|
|
23
|
+
var _a, _b;
|
|
24
|
+
(_b = (_a = thisRef.current.props).onOutOfMaxBounds) == null ? void 0 : _b.call(_a, e);
|
|
25
|
+
});
|
|
26
|
+
gc.on("trackuserlocationstart", (e) => {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
(_b = (_a = thisRef.current.props).onTrackUserLocationStart) == null ? void 0 : _b.call(_a, e);
|
|
29
|
+
});
|
|
30
|
+
gc.on("trackuserlocationend", (e) => {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
(_b = (_a = thisRef.current.props).onTrackUserLocationEnd) == null ? void 0 : _b.call(_a, e);
|
|
33
|
+
});
|
|
34
|
+
return gc;
|
|
35
|
+
}, { position: props.position });
|
|
36
|
+
thisRef.current.props = props;
|
|
37
|
+
useImperativeHandle(ref, () => ctrl, []);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
applyReactStyle(ctrl._container, props.style);
|
|
40
|
+
}, [props.style]);
|
|
41
|
+
return null;
|
|
7
42
|
}
|
|
8
|
-
|
|
9
|
-
const canvas = useThree((s) => s.gl.domElement);
|
|
10
|
-
useState(() => {
|
|
11
|
-
const store = _roots.get(canvas).store;
|
|
12
|
-
initR3M({ ...props, store });
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
function initR3M({ store, ...props }) {
|
|
16
|
-
const viewProjMx = new Matrix4().identity().toArray();
|
|
17
|
-
const r3m = { ...props, viewProjMx };
|
|
18
|
-
store.setState({ r3m });
|
|
19
|
-
return r3m;
|
|
20
|
-
}
|
|
21
|
-
export {
|
|
22
|
-
initR3M,
|
|
23
|
-
useInitR3M,
|
|
24
|
-
useR3M
|
|
25
|
-
};
|
|
43
|
+
memo(forwardRef(_GeolocateControl));
|
|
26
44
|
//# sourceMappingURL=main13.mjs.map
|
package/dist/es/main13.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main13.mjs","sources":["../../
|
|
1
|
+
{"version":3,"file":"main13.mjs","sources":["../../node_modules/@vis.gl/react-mapbox/dist/components/geolocate-control.js"],"sourcesContent":["import { useImperativeHandle, useRef, useEffect, forwardRef, memo } from 'react';\nimport { applyReactStyle } from \"../utils/apply-react-style.js\";\nimport { useControl } from \"./use-control.js\";\nfunction _GeolocateControl(props, ref) {\n const thisRef = useRef({ props });\n const ctrl = useControl(({ mapLib }) => {\n const gc = new mapLib.GeolocateControl(props);\n // Hack: fix GeolocateControl reuse\n // When using React strict mode, the component is mounted twice.\n // GeolocateControl's UI creation is asynchronous. Removing and adding it back causes the UI to be initialized twice.\n const setupUI = gc._setupUI.bind(gc);\n gc._setupUI = args => {\n if (!gc._container.hasChildNodes()) {\n setupUI(args);\n }\n };\n gc.on('geolocate', e => {\n thisRef.current.props.onGeolocate?.(e);\n });\n gc.on('error', e => {\n thisRef.current.props.onError?.(e);\n });\n gc.on('outofmaxbounds', e => {\n thisRef.current.props.onOutOfMaxBounds?.(e);\n });\n gc.on('trackuserlocationstart', e => {\n thisRef.current.props.onTrackUserLocationStart?.(e);\n });\n gc.on('trackuserlocationend', e => {\n thisRef.current.props.onTrackUserLocationEnd?.(e);\n });\n return gc;\n }, { position: props.position });\n thisRef.current.props = props;\n useImperativeHandle(ref, () => ctrl, []);\n useEffect(() => {\n applyReactStyle(ctrl._container, props.style);\n }, [props.style]);\n return null;\n}\nexport const GeolocateControl = memo(forwardRef(_Ge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|
4
|
-
|
|
1
|
+
import { memo, useEffect } from "react";
|
|
2
|
+
import { applyReactStyle } from "./main37.mjs";
|
|
3
|
+
import { useControl } from "./main39.mjs";
|
|
4
|
+
function _NavigationControl(props) {
|
|
5
|
+
const ctrl = useControl(({ mapLib }) => new mapLib.NavigationControl(props), {
|
|
6
|
+
position: props.position
|
|
7
|
+
});
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
applyReactStyle(ctrl._container, props.style);
|
|
10
|
+
}, [props.style]);
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
memo(_NavigationControl);
|
|
5
14
|
//# sourceMappingURL=main14.mjs.map
|
package/dist/es/main14.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main14.mjs","sources":["../../
|
|
1
|
+
{"version":3,"file":"main14.mjs","sources":["../../node_modules/@vis.gl/react-mapbox/dist/components/navigation-control.js"],"sourcesContent":["import { useEffect, memo } from 'react';\nimport { applyReactStyle } from \"../utils/apply-react-style.js\";\nimport { useControl } from \"./use-control.js\";\nfunction _NavigationControl(props) {\n const ctrl = useControl(({ mapLib }) => new mapLib.NavigationControl(props), {\n position: props.position\n });\n useEffect(() => {\n applyReactStyle(ctrl._container, props.style);\n }, [props.style]);\n return null;\n}\nexport const NavigationControl = memo(_NavigationControl);\n//# sourceMappingURL=navigation-control.js.map"],"names":[],"mappings":";;;AAGA,SAAS,mBAAmB,OAAO;AAC/B,QAAM,OAAO,WAAW,CAAC,EAAE,OAAQ,MAAK,IAAI,OAAO,kBAAkB,KAAK,GAAG;AAAA,IACzE,UAAU,MAAM;AAAA,EACxB,CAAK;AACD,YAAU,MAAM;AACZ,oBAAgB,KAAK,YAAY,MAAM,KAAK;AAAA,EACpD,GAAO,CAAC,MAAM,KAAK,CAAC;AAChB,SAAO;AACX;AACiC,KAAK,kBAAkB;","x_google_ignoreList":[0]}
|
package/dist/es/main15.mjs
CHANGED
|
@@ -1,33 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { memo, useRef, useEffect } from "react";
|
|
2
|
+
import { applyReactStyle } from "./main37.mjs";
|
|
3
|
+
import { useControl } from "./main39.mjs";
|
|
4
|
+
function _ScaleControl(props) {
|
|
5
|
+
const ctrl = useControl(({ mapLib }) => new mapLib.ScaleControl(props), {
|
|
6
|
+
position: props.position
|
|
7
|
+
});
|
|
8
|
+
const propsRef = useRef(props);
|
|
9
|
+
const prevProps = propsRef.current;
|
|
10
|
+
propsRef.current = props;
|
|
11
|
+
const { style } = props;
|
|
12
|
+
if (props.maxWidth !== void 0 && props.maxWidth !== prevProps.maxWidth) {
|
|
13
|
+
ctrl.options.maxWidth = props.maxWidth;
|
|
14
|
+
}
|
|
15
|
+
if (props.unit !== void 0 && props.unit !== prevProps.unit) {
|
|
16
|
+
ctrl.setUnit(props.unit);
|
|
17
|
+
}
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
applyReactStyle(ctrl._container, style);
|
|
20
|
+
}, [style]);
|
|
21
|
+
return null;
|
|
6
22
|
}
|
|
7
|
-
|
|
8
|
-
const canvas = useThree((s) => s.gl.domElement);
|
|
9
|
-
useMemo(() => {
|
|
10
|
-
const store = _roots.get(canvas).store;
|
|
11
|
-
const coords = { longitude, latitude, altitude };
|
|
12
|
-
setCoords(store, coords);
|
|
13
|
-
}, [longitude, latitude, altitude]);
|
|
14
|
-
}
|
|
15
|
-
function useSetRootCoords(store, {
|
|
16
|
-
longitude,
|
|
17
|
-
latitude,
|
|
18
|
-
altitude
|
|
19
|
-
}) {
|
|
20
|
-
useMemo(() => {
|
|
21
|
-
setCoords(store, { longitude, latitude, altitude });
|
|
22
|
-
}, [longitude, latitude, altitude]);
|
|
23
|
-
}
|
|
24
|
-
function setCoords(store, coords) {
|
|
25
|
-
store.setState({ coords });
|
|
26
|
-
}
|
|
27
|
-
export {
|
|
28
|
-
setCoords,
|
|
29
|
-
useCoords,
|
|
30
|
-
useSetCoords,
|
|
31
|
-
useSetRootCoords
|
|
32
|
-
};
|
|
23
|
+
memo(_ScaleControl);
|
|
33
24
|
//# sourceMappingURL=main15.mjs.map
|
package/dist/es/main15.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main15.mjs","sources":["../../
|
|
1
|
+
{"version":3,"file":"main15.mjs","sources":["../../node_modules/@vis.gl/react-mapbox/dist/components/scale-control.js"],"sourcesContent":["import { useEffect, useRef, memo } from 'react';\nimport { applyReactStyle } from \"../utils/apply-react-style.js\";\nimport { useControl } from \"./use-control.js\";\nfunction _ScaleControl(props) {\n const ctrl = useControl(({ mapLib }) => new mapLib.ScaleControl(props), {\n position: props.position\n });\n const propsRef = useRef(props);\n const prevProps = propsRef.current;\n propsRef.current = props;\n const { style } = props;\n if (props.maxWidth !== undefined && props.maxWidth !== prevProps.maxWidth) {\n ctrl.options.maxWidth = props.maxWidth;\n }\n if (props.unit !== undefined && props.unit !== prevProps.unit) {\n ctrl.setUnit(props.unit);\n }\n useEffect(() => {\n applyReactStyle(ctrl._container, style);\n }, [style]);\n return null;\n}\nexport const ScaleControl = memo(_ScaleControl);\n//# sourceMappingURL=scale-control.js.map"],"names":[],"mappings":";;;AAGA,SAAS,cAAc,OAAO;AAC1B,QAAM,OAAO,WAAW,CAAC,EAAE,OAAQ,MAAK,IAAI,OAAO,aAAa,KAAK,GAAG;AAAA,IACpE,UAAU,MAAM;AAAA,EACxB,CAAK;AACD,QAAM,WAAW,OAAO,KAAK;AAC7B,QAAM,YAAY,SAAS;AAC3B,WAAS,UAAU;AACnB,QAAM,EAAE,MAAO,IAAG;AAClB,MAAI,MAAM,aAAa,UAAa,MAAM,aAAa,UAAU,UAAU;AACvE,SAAK,QAAQ,WAAW,MAAM;AAAA,EACjC;AACD,MAAI,MAAM,SAAS,UAAa,MAAM,SAAS,UAAU,MAAM;AAC3D,SAAK,QAAQ,MAAM,IAAI;AAAA,EAC1B;AACD,YAAU,MAAM;AACZ,oBAAgB,KAAK,YAAY,KAAK;AAAA,EAC9C,GAAO,CAAC,KAAK,CAAC;AACV,SAAO;AACX;AAC4B,KAAK,aAAa;","x_google_ignoreList":[0]}
|
package/dist/es/main16.mjs
CHANGED
|
@@ -1,26 +1,91 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import { useContext, useRef, useState, useMemo, useEffect } from "react";
|
|
2
|
+
import { MapContext } from "./main8.mjs";
|
|
3
|
+
import assert from "./main40.mjs";
|
|
4
|
+
import { deepEqual } from "./main38.mjs";
|
|
5
|
+
function updateLayer(map, id, props, prevProps) {
|
|
6
|
+
assert(props.id === prevProps.id, "layer id changed");
|
|
7
|
+
assert(props.type === prevProps.type, "layer type changed");
|
|
8
|
+
if (props.type === "custom" || prevProps.type === "custom") {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const { layout = {}, paint = {}, filter, minzoom, maxzoom, beforeId } = props;
|
|
12
|
+
if (beforeId !== prevProps.beforeId) {
|
|
13
|
+
map.moveLayer(id, beforeId);
|
|
14
|
+
}
|
|
15
|
+
if (layout !== prevProps.layout) {
|
|
16
|
+
const prevLayout = prevProps.layout || {};
|
|
17
|
+
for (const key in layout) {
|
|
18
|
+
if (!deepEqual(layout[key], prevLayout[key])) {
|
|
19
|
+
map.setLayoutProperty(id, key, layout[key]);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
for (const key in prevLayout) {
|
|
23
|
+
if (!layout.hasOwnProperty(key)) {
|
|
24
|
+
map.setLayoutProperty(id, key, void 0);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (paint !== prevProps.paint) {
|
|
29
|
+
const prevPaint = prevProps.paint || {};
|
|
30
|
+
for (const key in paint) {
|
|
31
|
+
if (!deepEqual(paint[key], prevPaint[key])) {
|
|
32
|
+
map.setPaintProperty(id, key, paint[key]);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
for (const key in prevPaint) {
|
|
36
|
+
if (!paint.hasOwnProperty(key)) {
|
|
37
|
+
map.setPaintProperty(id, key, void 0);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (!deepEqual(filter, prevProps.filter)) {
|
|
42
|
+
map.setFilter(id, filter);
|
|
43
|
+
}
|
|
44
|
+
if (minzoom !== prevProps.minzoom || maxzoom !== prevProps.maxzoom) {
|
|
45
|
+
map.setLayerZoomRange(id, minzoom, maxzoom);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function createLayer(map, id, props) {
|
|
49
|
+
if (map.style && map.style._loaded && (!("source" in props) || map.getSource(props.source))) {
|
|
50
|
+
const options = { ...props, id };
|
|
51
|
+
delete options.beforeId;
|
|
52
|
+
map.addLayer(options, props.beforeId);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
let layerCounter = 0;
|
|
56
|
+
function Layer(props) {
|
|
57
|
+
const map = useContext(MapContext).map.getMap();
|
|
58
|
+
const propsRef = useRef(props);
|
|
59
|
+
const [, setStyleLoaded] = useState(0);
|
|
60
|
+
const id = useMemo(() => props.id || `jsx-layer-${layerCounter++}`, []);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (map) {
|
|
63
|
+
const forceUpdate = () => setStyleLoaded((version) => version + 1);
|
|
64
|
+
map.on("styledata", forceUpdate);
|
|
65
|
+
forceUpdate();
|
|
66
|
+
return () => {
|
|
67
|
+
map.off("styledata", forceUpdate);
|
|
68
|
+
if (map.style && map.style._loaded && map.getLayer(id)) {
|
|
69
|
+
map.removeLayer(id);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return void 0;
|
|
74
|
+
}, [map]);
|
|
75
|
+
const layer = map && map.style && map.getLayer(id);
|
|
76
|
+
if (layer) {
|
|
77
|
+
try {
|
|
78
|
+
updateLayer(map, id, props, propsRef.current);
|
|
79
|
+
} catch (error) {
|
|
80
|
+
console.warn(error);
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
createLayer(map, id, props);
|
|
84
|
+
}
|
|
85
|
+
propsRef.current = props;
|
|
86
|
+
return null;
|
|
22
87
|
}
|
|
23
88
|
export {
|
|
24
|
-
|
|
89
|
+
Layer
|
|
25
90
|
};
|
|
26
91
|
//# sourceMappingURL=main16.mjs.map
|
package/dist/es/main16.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main16.mjs","sources":["../../
|
|
1
|
+
{"version":3,"file":"main16.mjs","sources":["../../node_modules/@vis.gl/react-mapbox/dist/components/layer.js"],"sourcesContent":["import { useContext, useEffect, useMemo, useState, useRef } from 'react';\nimport { MapContext } from \"./map.js\";\nimport assert from \"../utils/assert.js\";\nimport { deepEqual } from \"../utils/deep-equal.js\";\n/* eslint-disable complexity, max-statements */\nfunction updateLayer(map, id, props, prevProps) {\n assert(props.id === prevProps.id, 'layer id changed');\n assert(props.type === prevProps.type, 'layer type changed');\n if (props.type === 'custom' || prevProps.type === 'custom') {\n return;\n }\n // @ts-ignore filter does not exist in some Layer types\n const { layout = {}, paint = {}, filter, minzoom, maxzoom, beforeId } = props;\n if (beforeId !== prevProps.beforeId) {\n map.moveLayer(id, beforeId);\n }\n if (layout !== prevProps.layout) {\n const prevLayout = prevProps.layout || {};\n for (const key in layout) {\n if (!deepEqual(layout[key], prevLayout[key])) {\n map.setLayoutProperty(id, key, layout[key]);\n }\n }\n for (const key in prevLayout) {\n if (!layout.hasOwnProperty(key)) {\n map.setLayoutProperty(id, key, undefined);\n }\n }\n }\n if (paint !== prevProps.paint) {\n const prevPaint = prevProps.paint || {};\n for (const key in paint) {\n if (!deepEqual(paint[key], prevPaint[key])) {\n map.setPaintProperty(id, key, paint[key]);\n }\n }\n for (const key in prevPaint) {\n if (!paint.hasOwnProperty(key)) {\n map.setPaintProperty(id, key, undefined);\n }\n }\n }\n // @ts-ignore filter does not exist in some Layer types\n if (!deepEqual(filter, prevProps.filter)) {\n map.setFilter(id, filter);\n }\n if (minzoom !== prevProps.minzoom || maxzoom !== prevProps.maxzoom) {\n map.setLayerZoomRange(id, minzoom, maxzoom);\n }\n}\nfunction createLayer(map, id, props) {\n // @ts-ignore\n if (map.style && map.style._loaded && (!('source' in props) || map.getSource(props.source))) {\n const options = { ...props, id };\n delete options.beforeId;\n // @ts-ignore\n map.addLayer(options, props.beforeId);\n }\n}\n/* eslint-enable complexity, max-statements */\nlet layerCounter = 0;\nexport function Layer(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-layer-${layerCounter++}`, []);\n useEffect(() => {\n if (map) {\n const forceUpdate = () => setStyleLoaded(version => version + 1);\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.getLayer(id)) {\n map.removeLayer(id);\n }\n };\n }\n return undefined;\n }, [map]);\n // @ts-ignore\n const layer = map && map.style && map.getLayer(id);\n if (layer) {\n try {\n updateLayer(map, id, props, propsRef.current);\n }\n catch (error) {\n console.warn(error); // eslint-disable-line\n }\n }\n else {\n createLayer(map, id, props);\n }\n // Store last rendered props\n propsRef.current = props;\n return null;\n}\n//# sourceMappingURL=layer.js.map"],"names":[],"mappings":";;;;AAKA,SAAS,YAAY,KAAK,IAAI,OAAO,WAAW;AAC5C,SAAO,MAAM,OAAO,UAAU,IAAI,kBAAkB;AACpD,SAAO,MAAM,SAAS,UAAU,MAAM,oBAAoB;AAC1D,MAAI,MAAM,SAAS,YAAY,UAAU,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