react-bkoi-gl 1.0.7 → 2.0.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/README.md +163 -18
- package/dist/components/attribution-control.d.ts +4 -6
- package/dist/components/attribution-control.js +6 -5
- package/dist/components/attribution-control.js.map +1 -1
- package/dist/components/fullscreen-control.d.ts +4 -6
- package/dist/components/fullscreen-control.js +4 -4
- package/dist/components/fullscreen-control.js.map +1 -1
- package/dist/components/geolocate-control.d.ts +10 -26
- package/dist/components/geolocate-control.js +11 -11
- package/dist/components/geolocate-control.js.map +1 -1
- package/dist/components/layer.d.ts +7 -6
- package/dist/components/layer.js +8 -9
- package/dist/components/layer.js.map +1 -1
- package/dist/components/logo-control.d.ts +9 -0
- package/dist/components/logo-control.js +28 -0
- package/dist/components/logo-control.js.map +1 -0
- package/dist/components/map.d.ts +20 -16
- package/dist/components/map.js +38 -32
- package/dist/components/map.js.map +1 -1
- package/dist/components/marker.d.ts +10 -33
- package/dist/components/marker.js +22 -15
- package/dist/components/marker.js.map +1 -1
- package/dist/components/navigation-control.d.ts +4 -6
- package/dist/components/navigation-control.js +4 -4
- package/dist/components/navigation-control.js.map +1 -1
- package/dist/components/popup.d.ts +7 -25
- package/dist/components/popup.js +17 -28
- package/dist/components/popup.js.map +1 -1
- package/dist/components/scale-control.d.ts +4 -6
- package/dist/components/scale-control.js +4 -4
- package/dist/components/scale-control.js.map +1 -1
- package/dist/components/source.d.ts +3 -4
- package/dist/components/source.js +20 -22
- package/dist/components/source.js.map +1 -1
- package/dist/components/terrain-control.d.ts +10 -0
- package/dist/components/terrain-control.js +19 -0
- package/dist/components/terrain-control.js.map +1 -0
- package/dist/components/use-control.d.ts +6 -6
- package/dist/components/use-control.js +4 -5
- package/dist/components/use-control.js.map +1 -1
- package/dist/components/use-map.d.ts +8 -9
- package/dist/components/use-map.js +5 -5
- package/dist/components/use-map.js.map +1 -1
- package/dist/exports-maplibre-gl.d.ts +33 -0
- package/dist/exports-maplibre-gl.js +21 -0
- package/dist/exports-maplibre-gl.js.map +1 -0
- package/dist/index.cjs +590 -681
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/{mapbox → maplibre}/create-ref.d.ts +6 -6
- package/dist/maplibre/create-ref.js +30 -0
- package/dist/maplibre/create-ref.js.map +1 -0
- package/dist/maplibre/maplibre.d.ts +81 -0
- package/dist/maplibre/maplibre.js +387 -0
- package/dist/maplibre/maplibre.js.map +1 -0
- package/dist/styles/index.d.ts +4 -0
- package/dist/styles/react-bkoi-gl.css +1 -1
- package/dist/styles.d.js +2 -0
- package/dist/styles.d.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/types/common.d.ts +2 -60
- package/dist/types/common.js.map +1 -1
- package/dist/types/events.d.ts +64 -23
- package/dist/types/events.js.map +1 -1
- package/dist/types/internal.d.ts +14 -0
- package/dist/types/internal.js +2 -0
- package/dist/types/internal.js.map +1 -0
- package/dist/types/lib.d.ts +16 -200
- package/dist/types/lib.js.map +1 -1
- package/dist/types/style-spec.d.ts +1 -0
- package/dist/types/style-spec.js +2 -0
- package/dist/types/style-spec.js.map +1 -0
- package/dist/utils/apply-react-style.d.ts +1 -1
- package/dist/utils/apply-react-style.js.map +1 -1
- package/dist/utils/compare-class-names.d.ts +2 -0
- package/dist/utils/compare-class-names.js +23 -0
- package/dist/utils/compare-class-names.js.map +1 -0
- package/dist/utils/deep-equal.d.ts +1 -1
- package/dist/utils/deep-equal.js +1 -1
- package/dist/utils/deep-equal.js.map +1 -1
- package/dist/utils/set-globals.d.ts +6 -8
- package/dist/utils/set-globals.js +22 -10
- package/dist/utils/set-globals.js.map +1 -1
- package/dist/utils/style-utils.d.ts +3 -2
- package/dist/utils/style-utils.js +4 -4
- package/dist/utils/style-utils.js.map +1 -1
- package/dist/utils/transform.d.ts +11 -19
- package/dist/utils/transform.js +13 -36
- package/dist/utils/transform.js.map +1 -1
- package/dist/utils/use-isomorphic-layout-effect.d.ts +1 -1
- package/dist/utils/use-isomorphic-layout-effect.js +2 -2
- package/dist/utils/use-isomorphic-layout-effect.js.map +1 -1
- package/package.json +42 -26
- package/src/components/attribution-control.ts +40 -16
- package/src/components/fullscreen-control.ts +40 -0
- package/src/components/geolocate-control.ts +45 -39
- package/src/components/layer.ts +37 -29
- package/src/components/logo-control.ts +44 -0
- package/src/components/map.tsx +86 -75
- package/src/components/marker.ts +141 -123
- package/src/components/navigation-control.ts +11 -12
- package/src/components/popup.ts +94 -97
- package/src/components/scale-control.ts +12 -14
- package/src/components/source.ts +58 -57
- package/src/components/terrain-control.ts +29 -0
- package/src/components/use-control.ts +21 -17
- package/src/components/use-map.tsx +26 -24
- package/src/exports-maplibre-gl.ts +37 -0
- package/src/index.ts +3 -2
- package/src/maplibre/create-ref.ts +70 -0
- package/src/maplibre/maplibre.ts +624 -0
- package/src/styles.d.ts +4 -0
- package/src/types/common.ts +12 -72
- package/src/types/events.ts +102 -42
- package/src/types/internal.ts +26 -0
- package/src/types/lib.ts +65 -260
- package/src/types/style-spec.ts +34 -0
- package/src/utils/apply-react-style.ts +7 -3
- package/src/utils/compare-class-names.ts +29 -0
- package/src/utils/deep-equal.ts +2 -2
- package/src/utils/set-globals.ts +22 -28
- package/src/utils/style-utils.ts +18 -9
- package/src/utils/transform.ts +32 -60
- package/src/utils/use-isomorphic-layout-effect.ts +3 -2
- package/bkoi-gl/package.json +0 -6
- package/dist/exports-bkoi-gl.cjs +0 -1512
- package/dist/exports-bkoi-gl.d.ts +0 -89
- package/dist/exports-bkoi-gl.js +0 -36
- package/dist/exports-bkoi-gl.js.map +0 -1
- package/dist/exports-mapbox.d.ts +0 -139
- package/dist/exports-mapbox.js +0 -36
- package/dist/exports-mapbox.js.map +0 -1
- package/dist/mapbox/create-ref.js +0 -64
- package/dist/mapbox/create-ref.js.map +0 -1
- package/dist/mapbox/mapbox.d.ts +0 -81
- package/dist/mapbox/mapbox.js +0 -476
- package/dist/mapbox/mapbox.js.map +0 -1
- package/dist/types/events-bkoi-gl.d.ts +0 -49
- package/dist/types/events-bkoi-gl.js +0 -2
- package/dist/types/events-bkoi-gl.js.map +0 -1
- package/dist/types/events-mapbox.d.ts +0 -49
- package/dist/types/events-mapbox.js +0 -2
- package/dist/types/events-mapbox.js.map +0 -1
- package/dist/types/index.d.ts +0 -70
- package/dist/types/index.js +0 -5
- package/dist/types/index.js.map +0 -1
- package/dist/types/public.d.ts +0 -2
- package/dist/types/public.js +0 -2
- package/dist/types/public.js.map +0 -1
- package/dist/types/style-spec-bkoi-gl.d.ts +0 -9
- package/dist/types/style-spec-bkoi-gl.js +0 -2
- package/dist/types/style-spec-bkoi-gl.js.map +0 -1
- package/dist/types/style-spec-mapbox.d.ts +0 -7
- package/dist/types/style-spec-mapbox.js +0 -2
- package/dist/types/style-spec-mapbox.js.map +0 -1
- package/src/components/fullscreen-control.tsx +0 -37
- package/src/exports-bkoi-gl.ts +0 -156
- package/src/exports-mapbox.ts +0 -159
- package/src/mapbox/create-ref.ts +0 -118
- package/src/mapbox/mapbox.ts +0 -742
- package/src/types/events-bkoi-gl.ts +0 -78
- package/src/types/events-mapbox.ts +0 -76
- package/src/types/index.ts +0 -93
- package/src/types/public.ts +0 -9
- package/src/types/style-spec-bkoi-gl.ts +0 -81
- package/src/types/style-spec-mapbox.ts +0 -80
package/dist/components/popup.js
CHANGED
|
@@ -1,30 +1,27 @@
|
|
|
1
|
-
import { createPortal } from
|
|
2
|
-
import { useImperativeHandle, useEffect, useMemo, useRef, useContext, forwardRef, memo } from
|
|
1
|
+
import { createPortal } from "react-dom";
|
|
2
|
+
import { useImperativeHandle, useEffect, useMemo, useRef, useContext, forwardRef, memo } from "react";
|
|
3
3
|
import { applyReactStyle } from "../utils/apply-react-style.js";
|
|
4
4
|
import { MapContext } from "./map.js";
|
|
5
5
|
import { deepEqual } from "../utils/deep-equal.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
function Popup(props, ref) {
|
|
6
|
+
import { compareClassNames } from "../utils/compare-class-names.js";
|
|
7
|
+
export const Popup = memo(forwardRef((props, ref) => {
|
|
10
8
|
const {
|
|
11
9
|
map,
|
|
12
10
|
mapLib
|
|
13
11
|
} = useContext(MapContext);
|
|
14
12
|
const container = useMemo(() => {
|
|
15
|
-
return document.createElement(
|
|
13
|
+
return document.createElement("div");
|
|
16
14
|
}, []);
|
|
17
15
|
const thisRef = useRef({
|
|
18
16
|
props
|
|
19
17
|
});
|
|
20
|
-
thisRef.current.props = props;
|
|
21
18
|
const popup = useMemo(() => {
|
|
22
19
|
const options = {
|
|
23
20
|
...props
|
|
24
21
|
};
|
|
25
22
|
const pp = new mapLib.Popup(options);
|
|
26
23
|
pp.setLngLat([props.longitude, props.latitude]);
|
|
27
|
-
pp.once(
|
|
24
|
+
pp.once("open", e => {
|
|
28
25
|
thisRef.current.props.onOpen?.(e);
|
|
29
26
|
});
|
|
30
27
|
return pp;
|
|
@@ -33,10 +30,10 @@ function Popup(props, ref) {
|
|
|
33
30
|
const onClose = e => {
|
|
34
31
|
thisRef.current.props.onClose?.(e);
|
|
35
32
|
};
|
|
36
|
-
popup.on(
|
|
33
|
+
popup.on("close", onClose);
|
|
37
34
|
popup.setDOMContent(container).addTo(map.getMap());
|
|
38
35
|
return () => {
|
|
39
|
-
popup.off(
|
|
36
|
+
popup.off("close", onClose);
|
|
40
37
|
if (popup.isOpen()) {
|
|
41
38
|
popup.remove();
|
|
42
39
|
}
|
|
@@ -47,33 +44,25 @@ function Popup(props, ref) {
|
|
|
47
44
|
}, [props.style]);
|
|
48
45
|
useImperativeHandle(ref, () => popup, []);
|
|
49
46
|
if (popup.isOpen()) {
|
|
47
|
+
const oldProps = thisRef.current.props;
|
|
50
48
|
if (popup.getLngLat().lng !== props.longitude || popup.getLngLat().lat !== props.latitude) {
|
|
51
49
|
popup.setLngLat([props.longitude, props.latitude]);
|
|
52
50
|
}
|
|
53
|
-
if (props.offset && !deepEqual(
|
|
51
|
+
if (props.offset && !deepEqual(oldProps.offset, props.offset)) {
|
|
54
52
|
popup.setOffset(props.offset);
|
|
55
53
|
}
|
|
56
|
-
if (
|
|
54
|
+
if (oldProps.anchor !== props.anchor || oldProps.maxWidth !== props.maxWidth) {
|
|
57
55
|
popup.options.anchor = props.anchor;
|
|
58
56
|
popup.setMaxWidth(props.maxWidth);
|
|
59
57
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
if (!nextClassList.has(c)) {
|
|
65
|
-
popup.removeClassName(c);
|
|
66
|
-
}
|
|
58
|
+
const classNameDiff = compareClassNames(oldProps.className, props.className);
|
|
59
|
+
if (classNameDiff) {
|
|
60
|
+
for (const c of classNameDiff) {
|
|
61
|
+
popup.toggleClassName(c);
|
|
67
62
|
}
|
|
68
|
-
for (const c of nextClassList) {
|
|
69
|
-
if (!prevClassList.has(c)) {
|
|
70
|
-
popup.addClassName(c);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
popup.options.className = props.className;
|
|
74
63
|
}
|
|
64
|
+
thisRef.current.props = props;
|
|
75
65
|
}
|
|
76
66
|
return createPortal(props.children, container);
|
|
77
|
-
}
|
|
78
|
-
export default memo(forwardRef(Popup));
|
|
67
|
+
}));
|
|
79
68
|
//# sourceMappingURL=popup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popup.js","names":["createPortal","useImperativeHandle","useEffect","useMemo","useRef","useContext","forwardRef","memo","applyReactStyle","MapContext","deepEqual","
|
|
1
|
+
{"version":3,"file":"popup.js","names":["createPortal","useImperativeHandle","useEffect","useMemo","useRef","useContext","forwardRef","memo","applyReactStyle","MapContext","deepEqual","compareClassNames","Popup","props","ref","map","mapLib","container","document","createElement","thisRef","popup","options","pp","setLngLat","longitude","latitude","once","e","current","onOpen","onClose","on","setDOMContent","addTo","getMap","off","isOpen","remove","getElement","style","oldProps","getLngLat","lng","lat","offset","setOffset","anchor","maxWidth","setMaxWidth","classNameDiff","className","c","toggleClassName","children"],"sources":["../../src/components/popup.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-floating-promises */\n/* global document */\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport {\n useImperativeHandle,\n useEffect,\n useMemo,\n useRef,\n useContext,\n forwardRef,\n memo,\n} from \"react\";\nimport { applyReactStyle } from \"../utils/apply-react-style\";\n\nimport type { Popup as PopupInstance, PopupOptions } from \"../types/lib\";\nimport type { PopupEvent } from \"../types/events\";\n\nimport { MapContext } from \"./map\";\nimport { deepEqual } from \"../utils/deep-equal\";\nimport { compareClassNames } from \"../utils/compare-class-names\";\n\nexport type PopupProps = PopupOptions & {\n /** Longitude of the anchor location */\n longitude: number;\n /** Latitude of the anchor location */\n latitude: number;\n\n /** CSS style override, applied to the control's container */\n style?: React.CSSProperties;\n\n onOpen?: (e: PopupEvent) => void;\n onClose?: (e: PopupEvent) => void;\n children?: React.ReactNode;\n};\n\n/* eslint-disable complexity,max-statements */\nexport const Popup: React.FC<PopupProps> = memo(\n forwardRef((props: PopupProps, ref: React.Ref<PopupInstance>) => {\n const { map, mapLib } = useContext(MapContext);\n const container = useMemo(() => {\n return document.createElement(\"div\");\n }, []);\n const thisRef = useRef({ props });\n\n const popup: PopupInstance = 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 as PopupEvent);\n });\n return pp;\n }, []);\n\n useEffect(() => {\n const onClose = (e) => {\n thisRef.current.props.onClose?.(e as PopupEvent);\n };\n popup.on(\"close\", onClose);\n popup.setDOMContent(container).addTo(map.getMap());\n\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\n useEffect(() => {\n applyReactStyle(popup.getElement(), props.style);\n }, [props.style]);\n\n useImperativeHandle(ref, () => popup, []);\n\n if (popup.isOpen()) {\n const oldProps = thisRef.current.props;\n if (\n popup.getLngLat().lng !== props.longitude ||\n popup.getLngLat().lat !== props.latitude\n ) {\n popup.setLngLat([props.longitude, props.latitude]);\n }\n if (props.offset && !deepEqual(oldProps.offset, props.offset)) {\n popup.setOffset(props.offset);\n }\n if (\n oldProps.anchor !== props.anchor ||\n oldProps.maxWidth !== props.maxWidth\n ) {\n popup.options.anchor = props.anchor;\n popup.setMaxWidth(props.maxWidth);\n }\n const classNameDiff = compareClassNames(\n oldProps.className,\n props.className,\n );\n if (classNameDiff) {\n for (const c of classNameDiff) {\n popup.toggleClassName(c);\n }\n }\n thisRef.current.props = props;\n }\n\n return createPortal(props.children, container);\n }),\n);\n"],"mappings":"AAGA,SAASA,YAAY,QAAQ,WAAW;AACxC,SACEC,mBAAmB,EACnBC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,UAAU,EACVC,UAAU,EACVC,IAAI,QACC,OAAO;AAAC,SACNC,eAAe;AAAA,SAKfC,UAAU;AAAA,SACVC,SAAS;AAAA,SACTC,iBAAiB;AAiB1B,OAAO,MAAMC,KAA2B,GAAGL,IAAI,CAC7CD,UAAU,CAAC,CAACO,KAAiB,EAAEC,GAA6B,KAAK;EAC/D,MAAM;IAAEC,GAAG;IAAEC;EAAO,CAAC,GAAGX,UAAU,CAACI,UAAU,CAAC;EAC9C,MAAMQ,SAAS,GAAGd,OAAO,CAAC,MAAM;IAC9B,OAAOe,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EACtC,CAAC,EAAE,EAAE,CAAC;EACN,MAAMC,OAAO,GAAGhB,MAAM,CAAC;IAAES;EAAM,CAAC,CAAC;EAEjC,MAAMQ,KAAoB,GAAGlB,OAAO,CAAC,MAAM;IACzC,MAAMmB,OAAO,GAAG;MAAE,GAAGT;IAAM,CAAC;IAC5B,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AK,CAACqB,SAAS,CAAC,CAAC,CAACC,GAAG,KAAK9B,KAAK,CAACY,SAAS,IACzCJ,KAAK,CAACqB,SAAS,CAAC,CAAC,CAACE,GAAG,KAAK/B,KAAK,CAACa,QAAQ,EACxC;MACAL,KAAK,CAACG,SAAS,CAAC,CAACX,KAAK,CAACY,SAAS,EAAEZ,KAAK,CAACa,QAAQ,CAAC,CAAC;IACpD;IACA,IAAIb,KAAK,CAACgC,MAAM,IAAI,CAACnC,SAAS,CAAC+B,QAAQ,CAACI,MAAM,EAAEhC,KAAK,CAACgC,MAAM,CAAC,EAAE;MAC7DxB,KAAK,CAACyB,SAAS,CAACjC,KAAK,CAACgC,MAAM,CAAC;IAC/B;IACA,IACEJ,QAAQ,CAACM,MAAM,KAAKlC,KAAK,CAACkC,MAAM,IAChCN,QAAQ,CAACO,QAAQ,KAAKnC,KAAK,CAACmC,QAAQ,EACpC;MACA3B,KAAK,CAACC,OAAO,CAACyB,MAAM,GAAGlC,KAAK,CAACkC,MAAM;MACnC1B,KAAK,CAAC4B,WAAW,CAACpC,KAAK,CAACmC,QAAQ,CAAC;IACnC;IACA,MAAME,aAAa,GAAGvC,iBAAiB,CACrC8B,QAAQ,CAACU,SAAS,EAClBtC,KAAK,CAACsC,SACR,CAAC;IACD,IAAID,aAAa,EAAE;MACjB,KAAK,MAAME,CAAC,IAAIF,aAAa,EAAE;QAC7B7B,KAAK,CAACgC,eAAe,CAACD,CAAC,CAAC;MAC1B;IACF;IACAhC,OAAO,CAACS,OAAO,CAAChB,KAAK,GAAGA,KAAK;EAC/B;EAEA,OAAOb,YAAY,CAACa,KAAK,CAACyC,QAAQ,EAAErC,SAAS,CAAC;AAChD,CAAC,CACH,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import type { ControlPosition,
|
|
3
|
-
export type ScaleControlProps
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { ControlPosition, ScaleControlOptions } from "../types/lib";
|
|
3
|
+
export type ScaleControlProps = ScaleControlOptions & {
|
|
4
4
|
unit?: string;
|
|
5
5
|
maxWidth?: number;
|
|
6
6
|
/** Placement of the control relative to the map. */
|
|
@@ -8,6 +8,4 @@ export type ScaleControlProps<OptionsT> = OptionsT & {
|
|
|
8
8
|
/** CSS style override, applied to the control's container */
|
|
9
9
|
style?: React.CSSProperties;
|
|
10
10
|
};
|
|
11
|
-
declare
|
|
12
|
-
declare const _default: React.MemoExoticComponent<typeof ScaleControl>;
|
|
13
|
-
export default _default;
|
|
11
|
+
export declare const ScaleControl: React.FC<ScaleControlProps>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useEffect, useRef, memo } from
|
|
1
|
+
import { useEffect, useRef, memo } from "react";
|
|
2
2
|
import { applyReactStyle } from "../utils/apply-react-style.js";
|
|
3
|
-
import useControl from "./use-control.js";
|
|
4
|
-
function
|
|
3
|
+
import { useControl } from "./use-control.js";
|
|
4
|
+
function _ScaleControl(props) {
|
|
5
5
|
const ctrl = useControl(_ref => {
|
|
6
6
|
let {
|
|
7
7
|
mapLib
|
|
@@ -27,5 +27,5 @@ function ScaleControl(props) {
|
|
|
27
27
|
}, [style]);
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
30
|
-
export
|
|
30
|
+
export const ScaleControl = memo(_ScaleControl);
|
|
31
31
|
//# sourceMappingURL=scale-control.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scale-control.js","names":["useEffect","useRef","memo","applyReactStyle","useControl","
|
|
1
|
+
{"version":3,"file":"scale-control.js","names":["useEffect","useRef","memo","applyReactStyle","useControl","_ScaleControl","props","ctrl","_ref","mapLib","ScaleControl","position","propsRef","prevProps","current","style","maxWidth","undefined","options","unit","setUnit","_container"],"sources":["../../src/components/scale-control.ts"],"sourcesContent":["import * as React from \"react\";\nimport { useEffect, useRef, memo } from \"react\";\nimport { applyReactStyle } from \"../utils/apply-react-style\";\nimport { useControl } from \"./use-control\";\n\nimport type { ControlPosition, ScaleControlOptions } from \"../types/lib\";\n\nexport type ScaleControlProps = ScaleControlOptions & {\n // These props will be further constraint by OptionsT\n unit?: string;\n maxWidth?: number;\n\n /** Placement of the control relative to the map. */\n position?: ControlPosition;\n /** CSS style override, applied to the control's container */\n style?: React.CSSProperties;\n};\n\nfunction _ScaleControl(props: ScaleControlProps) {\n const ctrl = useControl(({ mapLib }) => new mapLib.ScaleControl(props), {\n position: props.position,\n });\n const propsRef = useRef<ScaleControlProps>(props);\n\n const prevProps = propsRef.current;\n propsRef.current = props;\n\n const { style } = props;\n\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\n useEffect(() => {\n applyReactStyle(ctrl._container, style);\n }, [style]);\n\n return null;\n}\n\nexport const ScaleControl: React.FC<ScaleControlProps> = memo(_ScaleControl);\n"],"mappings":"AACA,SAASA,SAAS,EAAEC,MAAM,EAAEC,IAAI,QAAQ,OAAO;AAAC,SACvCC,eAAe;AAAA,SACfC,UAAU;AAenB,SAASC,aAAaA,CAACC,KAAwB,EAAE;EAC/C,MAAMC,IAAI,GAAGH,UAAU,CAACI,IAAA;IAAA,IAAC;MAAEC;IAAO,CAAC,GAAAD,IAAA;IAAA,OAAK,IAAIC,MAAM,CAACC,YAAY,CAACJ,KAAK,CAAC;EAAA,GAAE;IACtEK,QAAQ,EAAEL,KAAK,CAACK;EAClB,CAAC,CAAC;EACF,MAAMC,QAAQ,GAAGX,MAAM,CAAoBK,KAAK,CAAC;EAEjD,MAAMO,SAAS,GAAGD,QAAQ,CAACE,OAAO;EAClCF,QAAQ,CAACE,OAAO,GAAGR,KAAK;EAExB,MAAM;IAAES;EAAM,CAAC,GAAGT,KAAK;EAEvB,IAAIA,KAAK,CAACU,QAAQ,KAAKC,SAAS,IAAIX,KAAK,CAACU,QAAQ,KAAKH,SAAS,CAACG,QAAQ,EAAE;IACzET,IAAI,CAACW,OAAO,CAACF,QAAQ,GAAGV,KAAK,CAACU,QAAQ;EACxC;EACA,IAAIV,KAAK,CAACa,IAAI,KAAKF,SAAS,IAAIX,KAAK,CAACa,IAAI,KAAKN,SAAS,CAACM,IAAI,EAAE;IAC7DZ,IAAI,CAACa,OAAO,CAACd,KAAK,CAACa,IAAI,CAAC;EAC1B;EAEAnB,SAAS,CAAC,MAAM;IACdG,eAAe,CAACI,IAAI,CAACc,UAAU,EAAEN,KAAK,CAAC;EACzC,CAAC,EAAE,CAACA,KAAK,CAAC,CAAC;EAEX,OAAO,IAAI;AACb;AAEA,OAAO,MAAML,YAAyC,GAAGR,IAAI,CAACG,aAAa,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type SourceProps
|
|
1
|
+
import type { SourceSpecification } from "../types/style-spec";
|
|
2
|
+
export type SourceProps = SourceSpecification & {
|
|
3
3
|
id?: string;
|
|
4
4
|
children?: any;
|
|
5
5
|
};
|
|
6
|
-
declare function Source
|
|
7
|
-
export default Source;
|
|
6
|
+
export declare function Source(props: SourceProps): any;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { useContext, useEffect, useMemo, useState, useRef } from
|
|
3
|
-
import { cloneElement } from 'react';
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useContext, useEffect, useMemo, useState, useRef, cloneElement } from "react";
|
|
4
3
|
import { MapContext } from "./map.js";
|
|
5
4
|
import assert from "../utils/assert.js";
|
|
6
5
|
import { deepEqual } from "../utils/deep-equal.js";
|
|
@@ -18,12 +17,12 @@ function createSource(map, id, props) {
|
|
|
18
17
|
return null;
|
|
19
18
|
}
|
|
20
19
|
function updateSource(source, props, prevProps) {
|
|
21
|
-
assert(props.id === prevProps.id,
|
|
22
|
-
assert(props.type === prevProps.type,
|
|
23
|
-
let changedKey =
|
|
20
|
+
assert(props.id === prevProps.id, "source id changed");
|
|
21
|
+
assert(props.type === prevProps.type, "source type changed");
|
|
22
|
+
let changedKey = "";
|
|
24
23
|
let changedKeyCount = 0;
|
|
25
24
|
for (const key in props) {
|
|
26
|
-
if (key !==
|
|
25
|
+
if (key !== "children" && key !== "id" && !deepEqual(prevProps[key], props[key])) {
|
|
27
26
|
changedKey = key;
|
|
28
27
|
changedKeyCount++;
|
|
29
28
|
}
|
|
@@ -32,30 +31,30 @@ function updateSource(source, props, prevProps) {
|
|
|
32
31
|
return;
|
|
33
32
|
}
|
|
34
33
|
const type = props.type;
|
|
35
|
-
if (type ===
|
|
34
|
+
if (type === "geojson") {
|
|
36
35
|
source.setData(props.data);
|
|
37
|
-
} else if (type ===
|
|
36
|
+
} else if (type === "image") {
|
|
38
37
|
source.updateImage({
|
|
39
38
|
url: props.url,
|
|
40
39
|
coordinates: props.coordinates
|
|
41
40
|
});
|
|
42
|
-
} else
|
|
43
|
-
source.setCoordinates(props.coordinates);
|
|
44
|
-
} else if ('setUrl' in source) {
|
|
41
|
+
} else {
|
|
45
42
|
switch (changedKey) {
|
|
46
|
-
case
|
|
47
|
-
source.
|
|
43
|
+
case "coordinates":
|
|
44
|
+
source.setCoordinates?.(props.coordinates);
|
|
45
|
+
break;
|
|
46
|
+
case "url":
|
|
47
|
+
source.setUrl?.(props.url);
|
|
48
48
|
break;
|
|
49
|
-
case
|
|
50
|
-
source.setTiles(props.tiles);
|
|
49
|
+
case "tiles":
|
|
50
|
+
source.setTiles?.(props.tiles);
|
|
51
51
|
break;
|
|
52
52
|
default:
|
|
53
|
+
console.warn(`Unable to update <Source> prop: ${changedKey}`);
|
|
53
54
|
}
|
|
54
|
-
} else {
|
|
55
|
-
console.warn(`Unable to update <Source> prop: ${changedKey}`);
|
|
56
55
|
}
|
|
57
56
|
}
|
|
58
|
-
function Source(props) {
|
|
57
|
+
export function Source(props) {
|
|
59
58
|
const map = useContext(MapContext).map.getMap();
|
|
60
59
|
const propsRef = useRef(props);
|
|
61
60
|
const [, setStyleLoaded] = useState(0);
|
|
@@ -63,10 +62,10 @@ function Source(props) {
|
|
|
63
62
|
useEffect(() => {
|
|
64
63
|
if (map) {
|
|
65
64
|
const forceUpdate = () => setTimeout(() => setStyleLoaded(version => version + 1), 0);
|
|
66
|
-
map.on(
|
|
65
|
+
map.on("styledata", forceUpdate);
|
|
67
66
|
forceUpdate();
|
|
68
67
|
return () => {
|
|
69
|
-
map.off(
|
|
68
|
+
map.off("styledata", forceUpdate);
|
|
70
69
|
if (map.style && map.style._loaded && map.getSource(id)) {
|
|
71
70
|
const allLayers = map.getStyle()?.layers;
|
|
72
71
|
if (allLayers) {
|
|
@@ -93,5 +92,4 @@ function Source(props) {
|
|
|
93
92
|
source: id
|
|
94
93
|
})) || null;
|
|
95
94
|
}
|
|
96
|
-
export default Source;
|
|
97
95
|
//# sourceMappingURL=source.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.js","names":["React","useContext","useEffect","useMemo","useState","useRef","cloneElement","MapContext","assert","deepEqual","sourceCounter","createSource","map","id","props","style","_loaded","options","children","addSource","getSource","updateSource","source","prevProps","type","changedKey","changedKeyCount","key","setData","data","updateImage","url","coordinates","setCoordinates","setUrl","setTiles","tiles","console","warn","Source","getMap","propsRef","setStyleLoaded","forceUpdate","setTimeout","version","on","off","allLayers","getStyle","layers","layer","removeLayer","removeSource","undefined","current","Children","child"],"sources":["../../src/components/source.ts"],"sourcesContent":["import * as React from
|
|
1
|
+
{"version":3,"file":"source.js","names":["React","useContext","useEffect","useMemo","useState","useRef","cloneElement","MapContext","assert","deepEqual","sourceCounter","createSource","map","id","props","style","_loaded","options","children","addSource","getSource","updateSource","source","prevProps","type","changedKey","changedKeyCount","key","setData","data","updateImage","url","coordinates","setCoordinates","setUrl","setTiles","tiles","console","warn","Source","getMap","propsRef","setStyleLoaded","forceUpdate","setTimeout","version","on","off","allLayers","getStyle","layers","layer","removeLayer","removeSource","undefined","current","Children","child"],"sources":["../../src/components/source.ts"],"sourcesContent":["import * as React from \"react\";\nimport {\n useContext,\n useEffect,\n useMemo,\n useState,\n useRef,\n cloneElement,\n} from \"react\";\nimport { MapContext } from \"./map\";\nimport assert from \"../utils/assert\";\nimport { deepEqual } from \"../utils/deep-equal\";\n\nimport type {\n GeoJSONSourceImplementation,\n ImageSourceImplementation,\n AnySourceImplementation,\n} from \"../types/internal\";\nimport type { SourceSpecification } from \"../types/style-spec\";\nimport type { Map as MapInstance } from \"../types/lib\";\n\nexport type SourceProps = SourceSpecification & {\n id?: string;\n children?: any;\n};\n\nlet sourceCounter = 0;\n\nfunction createSource(map: MapInstance, id: string, props: SourceProps) {\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\n/* eslint-disable complexity */\nfunction updateSource(\n source: AnySourceImplementation,\n props: SourceProps,\n prevProps: SourceProps,\n) {\n assert(props.id === prevProps.id, \"source id changed\");\n assert(props.type === prevProps.type, \"source type changed\");\n\n let changedKey = \"\";\n let changedKeyCount = 0;\n\n for (const key in props) {\n if (\n key !== \"children\" &&\n key !== \"id\" &&\n !deepEqual(prevProps[key], props[key])\n ) {\n changedKey = key;\n changedKeyCount++;\n }\n }\n\n if (!changedKeyCount) {\n return;\n }\n\n const type = props.type;\n\n if (type === \"geojson\") {\n (source as GeoJSONSourceImplementation).setData(props.data);\n } else if (type === \"image\") {\n (source as ImageSourceImplementation).updateImage({\n url: props.url,\n coordinates: props.coordinates,\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 */\n\nexport function Source(props: SourceProps) {\n const map = useContext(MapContext).map.getMap();\n const propsRef = useRef(props);\n const [, setStyleLoaded] = useState(0);\n\n const id = useMemo(() => props.id || `jsx-source-${sourceCounter++}`, []);\n\n useEffect(() => {\n if (map) {\n /* global setTimeout */\n const forceUpdate = () =>\n setTimeout(() => setStyleLoaded((version) => version + 1), 0);\n map.on(\"styledata\", forceUpdate);\n forceUpdate();\n\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\n // @ts-ignore\n let source = map && map.style && map.getSource(id);\n if (source) {\n updateSource(source, props, propsRef.current);\n } else {\n source = createSource(map, id, props);\n }\n propsRef.current = props;\n\n return (\n (source &&\n React.Children.map(\n props.children,\n (child) =>\n child &&\n cloneElement(child, {\n source: id,\n }),\n )) ||\n null\n );\n}\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SACEC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,QAAQ,EACRC,MAAM,EACNC,YAAY,QACP,OAAO;AAAC,SACNC,UAAU;AAAA,OACZC,MAAM;AAAA,SACJC,SAAS;AAelB,IAAIC,aAAa,GAAG,CAAC;AAErB,SAASC,YAAYA,CAACC,GAAgB,EAAEC,EAAU,EAAEC,KAAkB,EAAE;EAEtE,IAAIF,GAAG,CAACG,KAAK,IAAIH,GAAG,CAACG,KAAK,CAACC,OAAO,EAAE;IAClC,MAAMC,OAAO,GAAG;MAAE,GAAGH;IAAM,CAAC;IAC5B,OAAOG,OAAO,CAACJ,EAAE;IACjB,OAAOI,OAAO,C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D,GAAG,CAACwC,WAAW,CAACD,KAAK,CAACtC,EAAE,CAAC;cAC3B;YACF;UACF;UACAD,GAAG,CAACyC,YAAY,CAACxC,EAAE,CAAC;QACtB;MACF,CAAC;IACH;IACA,OAAOyC,SAAS;EAClB,CAAC,EAAE,CAAC1C,GAAG,CAAC,CAAC;EAGT,IAAIU,MAAM,GAAGV,GAAG,IAAIA,GAAG,CAACG,KAAK,IAAIH,GAAG,CAACQ,SAAS,CAACP,EAAE,CAAC;EAClD,IAAIS,MAAM,EAAE;IACVD,YAAY,CAACC,MAAM,EAAER,KAAK,EAAE2B,QAAQ,CAACc,OAAO,CAAC;EAC/C,CAAC,MAAM;IACLjC,MAAM,GAAGX,YAAY,CAACC,GAAG,EAAEC,EAAE,EAAEC,KAAK,CAAC;EACvC;EACA2B,QAAQ,CAACc,OAAO,GAAGzC,KAAK;EAExB,OACGQ,MAAM,IACLtB,KAAK,CAACwD,QAAQ,CAAC5C,GAAG,CAChBE,KAAK,CAACI,QAAQ,EACbuC,KAAK,IACJA,KAAK,IACLnD,YAAY,CAACmD,KAAK,EAAE;IAClBnC,MAAM,EAAET;EACV,CAAC,CACL,CAAC,IACH,IAAI;AAER","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { ControlPosition } from "../types/lib";
|
|
3
|
+
import type { TerrainSpecification } from "../types/style-spec";
|
|
4
|
+
export type TerrainControlProps = TerrainSpecification & {
|
|
5
|
+
/** Placement of the control relative to the map. */
|
|
6
|
+
position?: ControlPosition;
|
|
7
|
+
/** CSS style override, applied to the control's container */
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
};
|
|
10
|
+
export declare const TerrainControl: React.FC<TerrainControlProps>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useEffect, memo } from "react";
|
|
2
|
+
import { applyReactStyle } from "../utils/apply-react-style.js";
|
|
3
|
+
import { useControl } from "./use-control.js";
|
|
4
|
+
function _TerrainControl(props) {
|
|
5
|
+
const ctrl = useControl(_ref => {
|
|
6
|
+
let {
|
|
7
|
+
mapLib
|
|
8
|
+
} = _ref;
|
|
9
|
+
return new mapLib.TerrainControl(props);
|
|
10
|
+
}, {
|
|
11
|
+
position: props.position
|
|
12
|
+
});
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
applyReactStyle(ctrl._container, props.style);
|
|
15
|
+
}, [props.style]);
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
export const TerrainControl = memo(_TerrainControl);
|
|
19
|
+
//# sourceMappingURL=terrain-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terrain-control.js","names":["useEffect","memo","applyReactStyle","useControl","_TerrainControl","props","ctrl","_ref","mapLib","TerrainControl","position","_container","style"],"sources":["../../src/components/terrain-control.ts"],"sourcesContent":["import * as React from \"react\";\nimport { useEffect, memo } from \"react\";\nimport { applyReactStyle } from \"../utils/apply-react-style\";\nimport { useControl } from \"./use-control\";\n\nimport type { ControlPosition } from \"../types/lib\";\nimport type { TerrainSpecification } from \"../types/style-spec\";\n\nexport type TerrainControlProps = TerrainSpecification & {\n /** Placement of the control relative to the map. */\n position?: ControlPosition;\n /** CSS style override, applied to the control's container */\n style?: React.CSSProperties;\n};\n\nfunction _TerrainControl(props: TerrainControlProps) {\n const ctrl = useControl(({ mapLib }) => new mapLib.TerrainControl(props), {\n position: props.position,\n });\n\n useEffect(() => {\n applyReactStyle(ctrl._container, props.style);\n }, [props.style]);\n\n return null;\n}\n\nexport const TerrainControl: React.FC<TerrainControlProps> =\n memo(_TerrainControl);\n"],"mappings":"AACA,SAASA,SAAS,EAAEC,IAAI,QAAQ,OAAO;AAAC,SAC/BC,eAAe;AAAA,SACfC,UAAU;AAYnB,SAASC,eAAeA,CAACC,KAA0B,EAAE;EACnD,MAAMC,IAAI,GAAGH,UAAU,CAACI,IAAA;IAAA,IAAC;MAAEC;IAAO,CAAC,GAAAD,IAAA;IAAA,OAAK,IAAIC,MAAM,CAACC,cAAc,CAACJ,KAAK,CAAC;EAAA,GAAE;IACxEK,QAAQ,EAAEL,KAAK,CAACK;EAClB,CAAC,CAAC;EAEFV,SAAS,CAAC,MAAM;IACdE,eAAe,CAACI,IAAI,CAACK,UAAU,EAAEN,KAAK,CAACO,KAAK,CAAC;EAC/C,CAAC,EAAE,CAACP,KAAK,CAACO,KAAK,CAAC,CAAC;EAEjB,OAAO,IAAI;AACb;AAEA,OAAO,MAAMH,cAA6C,GACxDR,IAAI,CAACG,eAAe,CAAC","ignoreList":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { IControl, ControlPosition } from
|
|
2
|
-
import type { MapContextValue } from
|
|
1
|
+
import type { IControl, ControlPosition } from "../types/lib";
|
|
2
|
+
import type { MapContextValue } from "./map";
|
|
3
3
|
type ControlOptions = {
|
|
4
4
|
position?: ControlPosition;
|
|
5
5
|
};
|
|
6
|
-
declare function useControl<T extends IControl>(onCreate: (context: MapContextValue) => T, opts?: ControlOptions): T;
|
|
7
|
-
declare function useControl<T extends IControl>(onCreate: (context: MapContextValue) => T, onRemove: (context: MapContextValue) => void, opts?: ControlOptions): T;
|
|
8
|
-
declare function useControl<T extends IControl>(onCreate: (context: MapContextValue) => T, onAdd: (context: MapContextValue) => void, onRemove: (context: MapContextValue) => void, opts?: ControlOptions): T;
|
|
9
|
-
export
|
|
6
|
+
export declare function useControl<T extends IControl>(onCreate: (context: MapContextValue) => T, opts?: ControlOptions): T;
|
|
7
|
+
export declare function useControl<T extends IControl>(onCreate: (context: MapContextValue) => T, onRemove: (context: MapContextValue) => void, opts?: ControlOptions): T;
|
|
8
|
+
export declare function useControl<T extends IControl>(onCreate: (context: MapContextValue) => T, onAdd: (context: MapContextValue) => void, onRemove: (context: MapContextValue) => void, opts?: ControlOptions): T;
|
|
9
|
+
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { useContext, useMemo, useEffect } from
|
|
1
|
+
import { useContext, useMemo, useEffect } from "react";
|
|
2
2
|
import { MapContext } from "./map.js";
|
|
3
|
-
function useControl(onCreate, arg1, arg2, arg3) {
|
|
3
|
+
export function useControl(onCreate, arg1, arg2, arg3) {
|
|
4
4
|
const context = useContext(MapContext);
|
|
5
5
|
const ctrl = useMemo(() => onCreate(context), []);
|
|
6
6
|
useEffect(() => {
|
|
7
7
|
const opts = arg3 || arg2 || arg1;
|
|
8
|
-
const onAdd = typeof arg1 ===
|
|
9
|
-
const onRemove = typeof arg2 ===
|
|
8
|
+
const onAdd = typeof arg1 === "function" && typeof arg2 === "function" ? arg1 : null;
|
|
9
|
+
const onRemove = typeof arg2 === "function" ? arg2 : typeof arg1 === "function" ? arg1 : null;
|
|
10
10
|
const {
|
|
11
11
|
map
|
|
12
12
|
} = context;
|
|
@@ -27,5 +27,4 @@ function useControl(onCreate, arg1, arg2, arg3) {
|
|
|
27
27
|
}, []);
|
|
28
28
|
return ctrl;
|
|
29
29
|
}
|
|
30
|
-
export default useControl;
|
|
31
30
|
//# sourceMappingURL=use-control.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-control.js","names":["useContext","useMemo","useEffect","MapContext","useControl","onCreate","arg1","arg2","arg3","context","ctrl","opts","onAdd","onRemove","map","hasControl","addControl","position","removeControl"],"sources":["../../src/components/use-control.ts"],"sourcesContent":["import {useContext, useMemo, useEffect} from
|
|
1
|
+
{"version":3,"file":"use-control.js","names":["useContext","useMemo","useEffect","MapContext","useControl","onCreate","arg1","arg2","arg3","context","ctrl","opts","onAdd","onRemove","map","hasControl","addControl","position","removeControl"],"sources":["../../src/components/use-control.ts"],"sourcesContent":["import { useContext, useMemo, useEffect } from \"react\";\nimport type { IControl, ControlPosition } from \"../types/lib\";\nimport { MapContext } from \"./map\";\nimport type { MapContextValue } from \"./map\";\n\ntype ControlOptions = {\n position?: ControlPosition;\n};\n\nexport function useControl<T extends IControl>(\n onCreate: (context: MapContextValue) => T,\n opts?: ControlOptions,\n): T;\n\nexport function useControl<T extends IControl>(\n onCreate: (context: MapContextValue) => T,\n onRemove: (context: MapContextValue) => void,\n opts?: ControlOptions,\n): T;\n\nexport function useControl<T extends IControl>(\n onCreate: (context: MapContextValue) => T,\n onAdd: (context: MapContextValue) => void,\n onRemove: (context: MapContextValue) => void,\n opts?: ControlOptions,\n): T;\n\nexport function useControl<T extends IControl>(\n onCreate: (context: MapContextValue) => T,\n arg1?: ((context: MapContextValue) => void) | ControlOptions,\n arg2?: ((context: MapContextValue) => void) | ControlOptions,\n arg3?: ControlOptions,\n): T {\n const context = useContext(MapContext);\n const ctrl = useMemo(() => onCreate(context), []);\n\n useEffect(() => {\n const opts = (arg3 || arg2 || arg1) as ControlOptions;\n const onAdd =\n typeof arg1 === \"function\" && typeof arg2 === \"function\" ? arg1 : null;\n const onRemove =\n typeof arg2 === \"function\"\n ? arg2\n : typeof arg1 === \"function\"\n ? arg1\n : null;\n\n const { map } = context;\n if (!map.hasControl(ctrl)) {\n map.addControl(ctrl, opts?.position);\n if (onAdd) {\n onAdd(context);\n }\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\n return ctrl;\n}\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,OAAO,EAAEC,SAAS,QAAQ,OAAO;AAAC,SAE9CC,UAAU;AAyBnB,OAAO,SAASC,UAAUA,CACxBC,QAAyC,EACzCC,IAA4D,EAC5DC,IAA4D,EAC5DC,IAAqB,EAClB;EACH,MAAMC,OAAO,GAAGT,UAAU,CAACG,UAAU,CAAC;EACtC,MAAMO,IAAI,GAAGT,OAAO,CAAC,MAAMI,QAAQ,CAACI,OAAO,CAAC,EAAE,EAAE,CAAC;EAEjDP,SAAS,CAAC,MAAM;IACd,MAAMS,IAAI,GAAIH,IAAI,IAAID,IAAI,IAAID,IAAuB;IACrD,MAAMM,KAAK,GACT,OAAON,IAAI,KAAK,UAAU,IAAI,OAAOC,IAAI,KAAK,UAAU,GAAGD,IAAI,GAAG,IAAI;IACxE,MAAMO,QAAQ,GACZ,OAAON,IAAI,KAAK,UAAU,GACtBA,IAAI,GACJ,OAAOD,IAAI,KAAK,UAAU,GAC1BA,IAAI,GACJ,IAAI;IAEV,MAAM;MAAEQ;IAAI,CAAC,GAAGL,OAAO;IACvB,IAAI,CAACK,GAAG,CAACC,UAAU,CAACL,IAAI,CAAC,EAAE;MACzBI,GAAG,CAACE,UAAU,CAACN,IAAI,EAAEC,IAAI,EAAEM,QAAQ,CAAC;MACpC,IAAIL,KAAK,EAAE;QACTA,KAAK,CAACH,OAAO,CAAC;MAChB;IACF;IAEA,OAAO,MAAM;MACX,IAAII,QAAQ,EAAE;QACZA,QAAQ,CAACJ,OAAO,CAAC;MACnB;MAEA,IAAIK,GAAG,CAACC,UAAU,CAACL,IAAI,CAAC,EAAE;QACxBI,GAAG,CAACI,aAAa,CAACR,IAAI,CAAC;MACzB;IACF,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOA,IAAI;AACb","ignoreList":[]}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { MapRef } from
|
|
3
|
-
import { MapInstance } from '../types';
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { MapRef } from "../maplibre/create-ref";
|
|
4
3
|
type MountedMapsContextValue = {
|
|
5
4
|
maps: {
|
|
6
|
-
[id: string]: MapRef
|
|
5
|
+
[id: string]: MapRef;
|
|
7
6
|
};
|
|
8
|
-
onMapMount: (map: MapRef
|
|
7
|
+
onMapMount: (map: MapRef, id: string) => void;
|
|
9
8
|
onMapUnmount: (id: string) => void;
|
|
10
9
|
};
|
|
11
10
|
export declare const MountedMapsContext: React.Context<MountedMapsContextValue>;
|
|
12
11
|
export declare const MapProvider: React.FC<{
|
|
13
12
|
children?: React.ReactNode;
|
|
14
13
|
}>;
|
|
15
|
-
export type MapCollection
|
|
16
|
-
[id: string]: MapRef
|
|
17
|
-
current?: MapRef
|
|
14
|
+
export type MapCollection = {
|
|
15
|
+
[id: string]: MapRef | undefined;
|
|
16
|
+
current?: MapRef;
|
|
18
17
|
};
|
|
19
|
-
export declare function useMap
|
|
18
|
+
export declare function useMap(): MapCollection;
|
|
20
19
|
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import { useState, useCallback, useMemo, useContext } from
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useState, useCallback, useMemo, useContext } from "react";
|
|
3
3
|
import { MapContext } from "./map.js";
|
|
4
4
|
export const MountedMapsContext = React.createContext(null);
|
|
5
5
|
export const MapProvider = props => {
|
|
6
6
|
const [maps, setMaps] = useState({});
|
|
7
7
|
const onMapMount = useCallback(function (map) {
|
|
8
|
-
let id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
8
|
+
let id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "default";
|
|
9
9
|
setMaps(currMaps => {
|
|
10
|
-
if (id ===
|
|
10
|
+
if (id === "current") {
|
|
11
11
|
throw new Error("'current' cannot be used as map id");
|
|
12
12
|
}
|
|
13
13
|
if (currMaps[id]) {
|
|
@@ -20,7 +20,7 @@ export const MapProvider = props => {
|
|
|
20
20
|
});
|
|
21
21
|
}, []);
|
|
22
22
|
const onMapUnmount = useCallback(function () {
|
|
23
|
-
let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :
|
|
23
|
+
let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "default";
|
|
24
24
|
setMaps(currMaps => {
|
|
25
25
|
if (currMaps[id]) {
|
|
26
26
|
const nextMaps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-map.js","names":["React","useState","useCallback","useMemo","useContext","MapContext","MountedMapsContext","createContext","MapProvider","props","maps","setMaps","onMapMount","map","id","arguments","length","undefined","currMaps","Error","onMapUnmount","nextMaps","createElement","Provider","value","children","useMap","currentMap","mapsWithCurrent","current"],"sources":["../../src/components/use-map.tsx"],"sourcesContent":["import * as React from
|
|
1
|
+
{"version":3,"file":"use-map.js","names":["React","useState","useCallback","useMemo","useContext","MapContext","MountedMapsContext","createContext","MapProvider","props","maps","setMaps","onMapMount","map","id","arguments","length","undefined","currMaps","Error","onMapUnmount","nextMaps","createElement","Provider","value","children","useMap","currentMap","mapsWithCurrent","current"],"sources":["../../src/components/use-map.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { useState, useCallback, useMemo, useContext } from \"react\";\n\nimport { MapRef } from \"../maplibre/create-ref\";\nimport { MapContext } from \"./map\";\n\ntype MountedMapsContextValue = {\n maps: { [id: string]: MapRef };\n onMapMount: (map: MapRef, id: string) => void;\n onMapUnmount: (id: string) => void;\n};\n\nexport const MountedMapsContext =\n React.createContext<MountedMapsContextValue>(null);\n\nexport const MapProvider: React.FC<{ children?: React.ReactNode }> = (\n props,\n) => {\n const [maps, setMaps] = useState<{ [id: string]: MapRef }>({});\n\n const onMapMount = useCallback((map: MapRef, id: string = \"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\n const onMapUnmount = useCallback((id: string = \"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\n return (\n <MountedMapsContext.Provider\n value={{\n maps,\n onMapMount,\n onMapUnmount,\n }}\n >\n {props.children}\n </MountedMapsContext.Provider>\n );\n};\n\nexport type MapCollection = {\n [id: string]: MapRef | undefined;\n current?: MapRef;\n};\n\nexport function useMap(): MapCollection {\n const maps = useContext(MountedMapsContext)?.maps;\n const currentMap = useContext(MapContext);\n\n const mapsWithCurrent = useMemo(() => {\n return { ...maps, current: currentMap?.map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QAAQ;MACjB;MACA,OAAOH,QAAQ;IACjB,CAAC,CAAC;EACJ,CAAC,EAAE,EAAE,CAAC;EAEN,OACElB,KAAA,CAAAsB,aAAA,CAAChB,kBAAkB,CAACiB,QAAQ;IAC1BC,KAAK,EAAE;MACLd,IAAI;MACJE,UAAU;MACVQ;IACF;EAAE,GAEDX,KAAK,CAACgB,QACoB,CAAC;AAElC,CAAC;AAOD,OAAO,SAASC,MAAMA,CAAA,EAAkB;EACtC,MAAMhB,IAAI,GAAGN,UAAU,CAACE,kBAAkB,CAAC,EAAEI,IAAI;EACjD,MAAMiB,UAAU,GAAGvB,UAAU,CAACC,UAAU,CAAC;EAEzC,MAAMuB,eAAe,GAAGzB,OAAO,CAAC,MAAM;IACpC,OAAO;MAAE,GAAGO,IAAI;MAAEmB,OAAO,EAAEF,UAAU,EAAEd;IAAI,CAAC;EAC9C,CAAC,EAAE,CAACH,IAAI,EAAEiB,UAAU,CAAC,CAAC;EAEtB,OAAOC,eAAe;AACxB","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Map } from "./components/map";
|
|
2
|
+
export { Map };
|
|
3
|
+
export default Map;
|
|
4
|
+
export { Marker } from "./components/marker";
|
|
5
|
+
export { Popup } from "./components/popup";
|
|
6
|
+
export { AttributionControl } from "./components/attribution-control";
|
|
7
|
+
export { FullscreenControl } from "./components/fullscreen-control";
|
|
8
|
+
export { GeolocateControl } from "./components/geolocate-control";
|
|
9
|
+
export { NavigationControl } from "./components/navigation-control";
|
|
10
|
+
export { ScaleControl } from "./components/scale-control";
|
|
11
|
+
export { TerrainControl } from "./components/terrain-control";
|
|
12
|
+
export { LogoControl } from "./components/logo-control";
|
|
13
|
+
export { Source } from "./components/source";
|
|
14
|
+
export { Layer } from "./components/layer";
|
|
15
|
+
export { useControl } from "./components/use-control";
|
|
16
|
+
export { MapProvider, useMap } from "./components/use-map";
|
|
17
|
+
export type { MapProps } from "./components/map";
|
|
18
|
+
export type { MapRef } from "./maplibre/create-ref";
|
|
19
|
+
export type { MarkerProps } from "./components/marker";
|
|
20
|
+
export type { PopupProps } from "./components/popup";
|
|
21
|
+
export type { AttributionControlProps } from "./components/attribution-control";
|
|
22
|
+
export type { FullscreenControlProps } from "./components/fullscreen-control";
|
|
23
|
+
export type { GeolocateControlProps } from "./components/geolocate-control";
|
|
24
|
+
export type { NavigationControlProps } from "./components/navigation-control";
|
|
25
|
+
export type { ScaleControlProps } from "./components/scale-control";
|
|
26
|
+
export type { TerrainControlProps } from "./components/terrain-control";
|
|
27
|
+
export type { LogoControlProps } from "./components/logo-control";
|
|
28
|
+
export type { SourceProps } from "./components/source";
|
|
29
|
+
export type { LayerProps } from "./components/layer";
|
|
30
|
+
export * from "./types/common";
|
|
31
|
+
export * from "./types/events";
|
|
32
|
+
export * from "./types/lib";
|
|
33
|
+
export * from "./types/style-spec";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Map } from "./components/map.js";
|
|
2
|
+
export { Map };
|
|
3
|
+
export default Map;
|
|
4
|
+
export { Marker } from "./components/marker.js";
|
|
5
|
+
export { Popup } from "./components/popup.js";
|
|
6
|
+
export { AttributionControl } from "./components/attribution-control.js";
|
|
7
|
+
export { FullscreenControl } from "./components/fullscreen-control.js";
|
|
8
|
+
export { GeolocateControl } from "./components/geolocate-control.js";
|
|
9
|
+
export { NavigationControl } from "./components/navigation-control.js";
|
|
10
|
+
export { ScaleControl } from "./components/scale-control.js";
|
|
11
|
+
export { TerrainControl } from "./components/terrain-control.js";
|
|
12
|
+
export { LogoControl } from "./components/logo-control.js";
|
|
13
|
+
export { Source } from "./components/source.js";
|
|
14
|
+
export { Layer } from "./components/layer.js";
|
|
15
|
+
export { useControl } from "./components/use-control.js";
|
|
16
|
+
export { MapProvider, useMap } from "./components/use-map.js";
|
|
17
|
+
export * from "./types/common.js";
|
|
18
|
+
export * from "./types/events.js";
|
|
19
|
+
export * from "./types/lib.js";
|
|
20
|
+
export * from "./types/style-spec.js";
|
|
21
|
+
//# sourceMappingURL=exports-maplibre-gl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exports-maplibre-gl.js","names":["Map","Marker","Popup","AttributionControl","FullscreenControl","GeolocateControl","NavigationControl","ScaleControl","TerrainControl","LogoControl","Source","Layer","useControl","MapProvider","useMap"],"sources":["../src/exports-maplibre-gl.ts"],"sourcesContent":["import { Map } from \"./components/map\";\nexport { Map };\nexport default Map;\n\nexport { Marker } from \"./components/marker\";\nexport { Popup } from \"./components/popup\";\nexport { AttributionControl } from \"./components/attribution-control\";\nexport { FullscreenControl } from \"./components/fullscreen-control\";\nexport { GeolocateControl } from \"./components/geolocate-control\";\nexport { NavigationControl } from \"./components/navigation-control\";\nexport { ScaleControl } from \"./components/scale-control\";\nexport { TerrainControl } from \"./components/terrain-control\";\nexport { LogoControl } from \"./components/logo-control\";\nexport { Source } from \"./components/source\";\nexport { Layer } from \"./components/layer\";\nexport { useControl } from \"./components/use-control\";\nexport { MapProvider, useMap } from \"./components/use-map\";\n\nexport type { MapProps } from \"./components/map\";\nexport type { MapRef } from \"./maplibre/create-ref\";\nexport type { MarkerProps } from \"./components/marker\";\nexport type { PopupProps } from \"./components/popup\";\nexport type { AttributionControlProps } from \"./components/attribution-control\";\nexport type { FullscreenControlProps } from \"./components/fullscreen-control\";\nexport type { GeolocateControlProps } from \"./components/geolocate-control\";\nexport type { NavigationControlProps } from \"./components/navigation-control\";\nexport type { ScaleControlProps } from \"./components/scale-control\";\nexport type { TerrainControlProps } from \"./components/terrain-control\";\nexport type { LogoControlProps } from \"./components/logo-control\";\nexport type { SourceProps } from \"./components/source\";\nexport type { LayerProps } from \"./components/layer\";\n\n// Types\nexport * from \"./types/common\";\nexport * from \"./types/events\";\nexport * from \"./types/lib\";\nexport * from \"./types/style-spec\";\n"],"mappings":"SAASA,GAAG;AACZ,SAASA,GAAG;AACZ,eAAeA,GAAG;AAAC,SAEVC,MAAM;AAAA,SACNC,KAAK;AAAA,SACLC,kBAAkB;AAAA,SAClBC,iBAAiB;AAAA,SACjBC,gBAAgB;AAAA,SAChBC,iBAAiB;AAAA,SACjBC,YAAY;AAAA,SACZC,cAAc;AAAA,SACdC,WAAW;AAAA,SACXC,MAAM;AAAA,SACNC,KAAK;AAAA,SACLC,UAAU;AAAA,SACVC,WAAW,EAAEC,MAAM;AAAA;AAAA;AAAA;AAAA","ignoreList":[]}
|