@open-pioneer/map-navigation 0.10.0 → 0.11.0-dev.20250515143825
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 +14 -0
- package/History.d.ts +1 -1
- package/History.js +10 -11
- package/History.js.map +1 -1
- package/InitialExtent.d.ts +1 -1
- package/InitialExtent.js +3 -4
- package/InitialExtent.js.map +1 -1
- package/Zoom.d.ts +1 -1
- package/Zoom.js +10 -10
- package/Zoom.js.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @open-pioneer/map-navigation
|
|
2
2
|
|
|
3
|
+
## 0.11.0-dev.20250515143825
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 738390e: Update to Chakra v3
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [738390e]
|
|
12
|
+
- Updated dependencies [738390e]
|
|
13
|
+
- Updated dependencies [738390e]
|
|
14
|
+
- @open-pioneer/map@0.11.0-dev.20250515143825
|
|
15
|
+
- @open-pioneer/map-ui-components@0.11.0-dev.20250515143825
|
|
16
|
+
|
|
3
17
|
## 0.10.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/History.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { ButtonProps } from "@chakra-ui/react";
|
|
1
2
|
import { MapModelProps } from "@open-pioneer/map";
|
|
2
3
|
import { CommonComponentProps } from "@open-pioneer/react-utils";
|
|
3
4
|
import { FC, RefAttributes } from "react";
|
|
4
|
-
import { ButtonProps } from "@open-pioneer/chakra-integration";
|
|
5
5
|
export type HistoryForwardProps = Omit<HistoryProps, "viewDirection">;
|
|
6
6
|
/**
|
|
7
7
|
* Provides a button by which the user can navigate to the next map view.
|
package/History.js
CHANGED
|
@@ -5,19 +5,18 @@ import { useCommonComponentProps } from '@open-pioneer/react-utils';
|
|
|
5
5
|
import { useReactiveSnapshot } from '@open-pioneer/reactivity';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import { useIntl } from './_virtual/_virtual-pioneer-module_react-hooks.js';
|
|
8
|
-
import { forwardRef } from 'react';
|
|
9
8
|
import { FiCornerUpLeft, FiCornerUpRight } from 'react-icons/fi';
|
|
10
9
|
import { useHistoryViewModel } from './ViewHistoryModel.js';
|
|
11
10
|
|
|
12
|
-
const HistoryForward =
|
|
13
|
-
return /* @__PURE__ */ jsx(History, { viewDirection: "forward",
|
|
14
|
-
}
|
|
15
|
-
const HistoryBackward =
|
|
16
|
-
return /* @__PURE__ */ jsx(History, { viewDirection: "backward",
|
|
17
|
-
}
|
|
18
|
-
const History =
|
|
11
|
+
const HistoryForward = function HistoryForward2(props) {
|
|
12
|
+
return /* @__PURE__ */ jsx(History, { viewDirection: "forward", ...props });
|
|
13
|
+
};
|
|
14
|
+
const HistoryBackward = function HistoryBackward2(props) {
|
|
15
|
+
return /* @__PURE__ */ jsx(History, { viewDirection: "backward", ...props });
|
|
16
|
+
};
|
|
17
|
+
const History = function History2(props) {
|
|
19
18
|
const intl = useIntl();
|
|
20
|
-
const { buttonProps, viewDirection } = props;
|
|
19
|
+
const { buttonProps, viewDirection, ref } = props;
|
|
21
20
|
const { map } = useMapModel(props);
|
|
22
21
|
const viewModel = useHistoryViewModel(map);
|
|
23
22
|
const { defaultClassName, buttonLabel, buttonIcon } = getDirectionProps(intl, viewDirection);
|
|
@@ -51,10 +50,10 @@ const History = forwardRef(function History2(props, ref) {
|
|
|
51
50
|
label: buttonLabel,
|
|
52
51
|
icon: buttonIcon,
|
|
53
52
|
onClick: navigate,
|
|
54
|
-
|
|
53
|
+
disabled: !canNavigate
|
|
55
54
|
}
|
|
56
55
|
);
|
|
57
|
-
}
|
|
56
|
+
};
|
|
58
57
|
function getDirectionProps(intl, viewDirection) {
|
|
59
58
|
switch (viewDirection) {
|
|
60
59
|
case "forward":
|
package/History.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"History.js","sources":["History.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { MapModelProps, useMapModel } from \"@open-pioneer/map\";\nimport { ToolButton } from \"@open-pioneer/map-ui-components\";\nimport { CommonComponentProps, useCommonComponentProps } from \"@open-pioneer/react-utils\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport classNames from \"classnames\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC,
|
|
1
|
+
{"version":3,"file":"History.js","sources":["History.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonProps } from \"@chakra-ui/react\";\nimport { MapModelProps, useMapModel } from \"@open-pioneer/map\";\nimport { ToolButton } from \"@open-pioneer/map-ui-components\";\nimport { CommonComponentProps, useCommonComponentProps } from \"@open-pioneer/react-utils\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport classNames from \"classnames\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, RefAttributes } from \"react\";\nimport { FiCornerUpLeft, FiCornerUpRight } from \"react-icons/fi\";\nimport { useHistoryViewModel } from \"./ViewHistoryModel\";\n\nexport type HistoryForwardProps = Omit<HistoryProps, \"viewDirection\">;\n\n/**\n * Provides a button by which the user can navigate to the next map view.\n *\n * This component composes {@link History}.\n */\nexport const HistoryForward: FC<HistoryForwardProps> = function HistoryForward(\n props: HistoryForwardProps\n) {\n return <History viewDirection=\"forward\" {...props} />;\n};\n\nexport type HistoryBackwardProps = HistoryForwardProps;\n\n/**\n * Provides a button by which the user can navigate to the previous map view.\n *\n * This component composes {@link History}.\n */\nexport const HistoryBackward: FC<HistoryBackwardProps> = function HistoryBackward(\n props: HistoryBackwardProps\n) {\n return <History viewDirection=\"backward\" {...props} />;\n};\n\nexport interface HistoryProps\n extends CommonComponentProps,\n RefAttributes<HTMLButtonElement>,\n MapModelProps {\n /**\n * Additional properties for the `Button` element.\n *\n * Note that the ToolButton also defines some of these props.\n */\n buttonProps?: Partial<ButtonProps>;\n\n /**\n * The view direction.\n *\n * The button will either view forward or view backward depending on this value.\n */\n viewDirection: \"forward\" | \"backward\";\n}\n\n/**\n * Provides a button by which the user can navigate forward or backward in the view history of the map.\n */\nexport const History: FC<HistoryProps> = function History(props: HistoryProps) {\n const intl = useIntl();\n const { buttonProps, viewDirection, ref } = props;\n const { map } = useMapModel(props);\n const viewModel = useHistoryViewModel(map);\n const { defaultClassName, buttonLabel, buttonIcon } = getDirectionProps(intl, viewDirection);\n const { containerProps } = useCommonComponentProps(classNames(\"view\", defaultClassName), props);\n\n const canNavigate = useReactiveSnapshot(() => {\n if (!viewModel) {\n return false;\n }\n\n if (viewDirection === \"forward\") {\n return viewModel.canForward;\n } else {\n return viewModel.canBackward;\n }\n }, [viewModel, viewDirection]);\n const navigate = () => {\n if (!viewModel) {\n return;\n }\n\n if (viewDirection === \"forward\") {\n viewModel.forward();\n } else {\n viewModel.backward();\n }\n };\n\n return (\n viewModel && (\n <ToolButton\n ref={ref}\n {...containerProps}\n buttonProps={buttonProps}\n label={buttonLabel}\n icon={buttonIcon}\n onClick={navigate}\n disabled={!canNavigate}\n />\n )\n );\n};\n\nfunction getDirectionProps(intl: PackageIntl, viewDirection: \"forward\" | \"backward\") {\n switch (viewDirection) {\n case \"forward\":\n return {\n defaultClassName: \"view-forward\",\n buttonLabel: intl.formatMessage({ id: \"view-forward.title\" }),\n buttonIcon: <FiCornerUpRight />\n };\n case \"backward\":\n return {\n defaultClassName: \"view-backward\",\n buttonLabel: intl.formatMessage({ id: \"view-backward.title\" }),\n buttonIcon: <FiCornerUpLeft />\n };\n }\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,MAAA;AAAA;AAGJ,IAAA,IAAI,kBAAkB,SAAW,EAAA;AAC7B,MAAA,SAAA,CAAU,OAAQ,EAAA;AAAA,KACf,MAAA;AACH,MAAA,SAAA,CAAU,QAAS,EAAA;AAAA;AACvB,GACJ;AAEA,EAAA,OACI,SACI,oBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACG,GAAA;AAAA,MACC,GAAG,cAAA;AAAA,MACJ,WAAA;AAAA,MACA,KAAO,EAAA,WAAA;AAAA,MACP,IAAM,EAAA,UAAA;AAAA,MACN,OAAS,EAAA,QAAA;AAAA,MACT,UAAU,CAAC;AAAA;AAAA,GACf;AAGZ;AAEA,SAAS,iBAAA,CAAkB,MAAmB,aAAuC,EAAA;AACjF,EAAA,QAAQ,aAAe;AAAA,IACnB,KAAK,SAAA;AACD,MAAO,OAAA;AAAA,QACH,gBAAkB,EAAA,cAAA;AAAA,QAClB,aAAa,IAAK,CAAA,aAAA,CAAc,EAAE,EAAA,EAAI,sBAAsB,CAAA;AAAA,QAC5D,UAAA,sBAAa,eAAgB,EAAA,EAAA;AAAA,OACjC;AAAA,IACJ,KAAK,UAAA;AACD,MAAO,OAAA;AAAA,QACH,gBAAkB,EAAA,eAAA;AAAA,QAClB,aAAa,IAAK,CAAA,aAAA,CAAc,EAAE,EAAA,EAAI,uBAAuB,CAAA;AAAA,QAC7D,UAAA,sBAAa,cAAe,EAAA,EAAA;AAAA,OAChC;AAAA;AAEZ;;;;"}
|
package/InitialExtent.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ButtonProps } from "@
|
|
1
|
+
import { ButtonProps } from "@chakra-ui/react";
|
|
2
2
|
import { MapModelProps } from "@open-pioneer/map";
|
|
3
3
|
import { CommonComponentProps } from "@open-pioneer/react-utils";
|
|
4
4
|
import { FC, RefAttributes } from "react";
|
package/InitialExtent.js
CHANGED
|
@@ -3,14 +3,13 @@ import { useMapModel } from '@open-pioneer/map';
|
|
|
3
3
|
import { ToolButton } from '@open-pioneer/map-ui-components';
|
|
4
4
|
import { useCommonComponentProps } from '@open-pioneer/react-utils';
|
|
5
5
|
import { useIntl } from './_virtual/_virtual-pioneer-module_react-hooks.js';
|
|
6
|
-
import { forwardRef } from 'react';
|
|
7
6
|
import { FiHome } from 'react-icons/fi';
|
|
8
7
|
|
|
9
|
-
const InitialExtent =
|
|
8
|
+
const InitialExtent = function InitialExtent2(props) {
|
|
10
9
|
const { containerProps } = useCommonComponentProps("initial-extent", props);
|
|
11
10
|
const { map } = useMapModel(props);
|
|
12
11
|
const intl = useIntl();
|
|
13
|
-
const { buttonProps } = props;
|
|
12
|
+
const { buttonProps, ref } = props;
|
|
14
13
|
function setInitExtent() {
|
|
15
14
|
const initialExtent = map?.initialExtent;
|
|
16
15
|
if (initialExtent) {
|
|
@@ -34,7 +33,7 @@ const InitialExtent = forwardRef(function InitialExtent2(props, ref) {
|
|
|
34
33
|
...containerProps
|
|
35
34
|
}
|
|
36
35
|
);
|
|
37
|
-
}
|
|
36
|
+
};
|
|
38
37
|
|
|
39
38
|
export { InitialExtent };
|
|
40
39
|
//# sourceMappingURL=InitialExtent.js.map
|
package/InitialExtent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitialExtent.js","sources":["InitialExtent.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonProps } from \"@
|
|
1
|
+
{"version":3,"file":"InitialExtent.js","sources":["InitialExtent.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonProps } from \"@chakra-ui/react\";\nimport { MapModelProps, useMapModel } from \"@open-pioneer/map\";\nimport { ToolButton } from \"@open-pioneer/map-ui-components\";\nimport { CommonComponentProps, useCommonComponentProps } from \"@open-pioneer/react-utils\";\nimport { Extent } from \"ol/extent\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, RefAttributes } from \"react\";\nimport { FiHome } from \"react-icons/fi\";\n\nexport interface InitialExtentProps\n extends CommonComponentProps,\n RefAttributes<HTMLButtonElement>,\n MapModelProps {\n /**\n * Additional properties for the `Button` element.\n *\n * Note that the ToolButton also defines some of these props.\n */\n buttonProps?: Partial<ButtonProps>;\n}\n\n/**\n * Provides a simple button that switches the view to its initial viewpoint.\n */\nexport const InitialExtent: FC<InitialExtentProps> = function InitialExtent(\n props: InitialExtentProps\n) {\n const { containerProps } = useCommonComponentProps(\"initial-extent\", props);\n const { map } = useMapModel(props);\n const intl = useIntl();\n const { buttonProps, ref } = props;\n\n function setInitExtent() {\n const initialExtent = map?.initialExtent;\n if (initialExtent) {\n const newExtent: Extent = [\n initialExtent.xMin,\n initialExtent.yMin,\n initialExtent.xMax,\n initialExtent.yMax\n ];\n\n map.olView.fit(newExtent, { duration: 200 });\n }\n }\n\n return (\n <ToolButton\n ref={ref}\n buttonProps={buttonProps}\n label={intl.formatMessage({ id: \"initial-extent.title\" })}\n icon={<FiHome />}\n onClick={setInitExtent}\n {...containerProps}\n />\n );\n};\n"],"names":["InitialExtent"],"mappings":";;;;;;;AA0Ba,MAAA,aAAA,GAAwC,SAASA,cAAAA,CAC1D,KACF,EAAA;AACE,EAAA,MAAM,EAAE,cAAA,EAAmB,GAAA,uBAAA,CAAwB,kBAAkB,KAAK,CAAA;AAC1E,EAAA,MAAM,EAAE,GAAA,EAAQ,GAAA,WAAA,CAAY,KAAK,CAAA;AACjC,EAAA,MAAM,OAAO,OAAQ,EAAA;AACrB,EAAM,MAAA,EAAE,WAAa,EAAA,GAAA,EAAQ,GAAA,KAAA;AAE7B,EAAA,SAAS,aAAgB,GAAA;AACrB,IAAA,MAAM,gBAAgB,GAAK,EAAA,aAAA;AAC3B,IAAA,IAAI,aAAe,EAAA;AACf,MAAA,MAAM,SAAoB,GAAA;AAAA,QACtB,aAAc,CAAA,IAAA;AAAA,QACd,aAAc,CAAA,IAAA;AAAA,QACd,aAAc,CAAA,IAAA;AAAA,QACd,aAAc,CAAA;AAAA,OAClB;AAEA,MAAA,GAAA,CAAI,OAAO,GAAI,CAAA,SAAA,EAAW,EAAE,QAAA,EAAU,KAAK,CAAA;AAAA;AAC/C;AAGJ,EACI,uBAAA,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACG,GAAA;AAAA,MACA,WAAA;AAAA,MACA,OAAO,IAAK,CAAA,aAAA,CAAc,EAAE,EAAA,EAAI,wBAAwB,CAAA;AAAA,MACxD,IAAA,sBAAO,MAAO,EAAA,EAAA,CAAA;AAAA,MACd,OAAS,EAAA,aAAA;AAAA,MACR,GAAG;AAAA;AAAA,GACR;AAER;;;;"}
|
package/Zoom.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ButtonProps } from "@
|
|
1
|
+
import { ButtonProps } from "@chakra-ui/react";
|
|
2
2
|
import { MapModelProps } from "@open-pioneer/map";
|
|
3
3
|
import { CommonComponentProps } from "@open-pioneer/react-utils";
|
|
4
4
|
import { FC, RefAttributes } from "react";
|
package/Zoom.js
CHANGED
|
@@ -4,17 +4,17 @@ import { ToolButton } from '@open-pioneer/map-ui-components';
|
|
|
4
4
|
import { useCommonComponentProps } from '@open-pioneer/react-utils';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import { useIntl } from './_virtual/_virtual-pioneer-module_react-hooks.js';
|
|
7
|
-
import {
|
|
7
|
+
import { useState } from 'react';
|
|
8
8
|
import { FiMinus, FiPlus } from 'react-icons/fi';
|
|
9
9
|
|
|
10
|
-
const ZoomIn =
|
|
11
|
-
return /* @__PURE__ */ jsx(Zoom, { zoomDirection: "in",
|
|
12
|
-
}
|
|
13
|
-
const ZoomOut =
|
|
14
|
-
return /* @__PURE__ */ jsx(Zoom, { zoomDirection: "out",
|
|
15
|
-
}
|
|
16
|
-
const Zoom =
|
|
17
|
-
const { buttonProps, zoomDirection } = props;
|
|
10
|
+
const ZoomIn = function ZoomIn2(props) {
|
|
11
|
+
return /* @__PURE__ */ jsx(Zoom, { zoomDirection: "in", ...props });
|
|
12
|
+
};
|
|
13
|
+
const ZoomOut = function ZoomOut2(props) {
|
|
14
|
+
return /* @__PURE__ */ jsx(Zoom, { zoomDirection: "out", ...props });
|
|
15
|
+
};
|
|
16
|
+
const Zoom = function Zoom2(props) {
|
|
17
|
+
const { buttonProps, zoomDirection, ref } = props;
|
|
18
18
|
const { map } = useMapModel(props);
|
|
19
19
|
const intl = useIntl();
|
|
20
20
|
const [disabled, setDisabled] = useState(false);
|
|
@@ -49,7 +49,7 @@ const Zoom = forwardRef(function Zoom2(props, ref) {
|
|
|
49
49
|
...containerProps
|
|
50
50
|
}
|
|
51
51
|
);
|
|
52
|
-
}
|
|
52
|
+
};
|
|
53
53
|
function getDirectionProps(intl, zoomDirection) {
|
|
54
54
|
switch (zoomDirection) {
|
|
55
55
|
case "in":
|
package/Zoom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Zoom.js","sources":["Zoom.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonProps } from \"@
|
|
1
|
+
{"version":3,"file":"Zoom.js","sources":["Zoom.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { ButtonProps } from \"@chakra-ui/react\";\nimport { MapModelProps, useMapModel } from \"@open-pioneer/map\";\nimport { ToolButton } from \"@open-pioneer/map-ui-components\";\nimport { CommonComponentProps, useCommonComponentProps } from \"@open-pioneer/react-utils\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport classNames from \"classnames\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, RefAttributes, useState } from \"react\";\nimport { FiMinus, FiPlus } from \"react-icons/fi\";\n\nexport type ZoomInProps = Omit<ZoomProps, \"zoomDirection\">;\n\n/**\n * Provides a button by which the user can zoom into the map.\n *\n * This component composes {@link Zoom}.\n */\nexport const ZoomIn: FC<ZoomInProps> = function ZoomIn(props) {\n return <Zoom zoomDirection=\"in\" {...props} />;\n};\n\nexport type ZoomOutProps = ZoomInProps;\n\n/**\n * Provides a button by which the user can zoom out of the map.\n *\n * This component composes {@link Zoom}.\n */\nexport const ZoomOut: FC<ZoomOutProps> = function ZoomOut(props) {\n return <Zoom zoomDirection=\"out\" {...props} />;\n};\n\nexport interface ZoomProps\n extends CommonComponentProps,\n RefAttributes<HTMLButtonElement>,\n MapModelProps {\n /**\n * Additional properties for the `Button` element.\n *\n * Note that the ToolButton also defines some of these props.\n */\n buttonProps?: Partial<ButtonProps>;\n\n /**\n * The zoom direction.\n *\n * The button will either zoom in or zoom out depending on this value.\n */\n zoomDirection: \"in\" | \"out\";\n}\n\n/**\n * Provides a button by which the user can zoom in or zoom out of the map.\n */\nexport const Zoom: FC<ZoomProps> = function Zoom(props: ZoomProps) {\n const { buttonProps, zoomDirection, ref } = props;\n const { map } = useMapModel(props);\n const intl = useIntl();\n const [disabled, setDisabled] = useState<boolean>(false);\n const { defaultClassName, buttonLabel, buttonIcon } = getDirectionProps(intl, zoomDirection);\n\n const { containerProps } = useCommonComponentProps(classNames(\"zoom\", defaultClassName), props);\n\n function zoom() {\n if (disabled) {\n return;\n }\n setDisabled(true);\n const view = map?.olView;\n let currZoom = map?.zoomLevel;\n\n const maxZoom = view?.getMaxZoom() || Number.MAX_SAFE_INTEGER;\n const minZoom = view?.getMinZoom() || 0;\n if (view && currZoom !== undefined) {\n if (zoomDirection === \"in\" && currZoom < maxZoom) {\n ++currZoom;\n } else if (zoomDirection === \"out\" && currZoom > minZoom) {\n --currZoom;\n }\n\n view.animate({ zoom: currZoom, duration: 200 }, () => setDisabled(false));\n }\n }\n\n return (\n <ToolButton\n ref={ref}\n buttonProps={buttonProps}\n label={buttonLabel}\n icon={buttonIcon}\n onClick={zoom}\n {...containerProps}\n />\n );\n};\n\nfunction getDirectionProps(intl: PackageIntl, zoomDirection: \"in\" | \"out\") {\n switch (zoomDirection) {\n case \"in\":\n return {\n defaultClassName: \"zoom-in\",\n buttonLabel: intl.formatMessage({ id: \"zoom-in.title\" }),\n buttonIcon: <FiPlus />\n };\n case \"out\":\n return {\n defaultClassName: \"zoom-out\",\n buttonLabel: intl.formatMessage({ id: \"zoom-out.title\" }),\n buttonIcon: <FiMinus />\n };\n }\n}\n"],"names":["ZoomIn","ZoomOut","Zoom"],"mappings":";;;;;;;;;AAmBa,MAAA,MAAA,GAA0B,SAASA,OAAAA,CAAO,KAAO,EAAA;AAC1D,EAAA,uBAAQ,GAAA,CAAA,IAAA,EAAA,EAAK,aAAc,EAAA,IAAA,EAAM,GAAG,KAAO,EAAA,CAAA;AAC/C;AASa,MAAA,OAAA,GAA4B,SAASC,QAAAA,CAAQ,KAAO,EAAA;AAC7D,EAAA,uBAAQ,GAAA,CAAA,IAAA,EAAA,EAAK,aAAc,EAAA,KAAA,EAAO,GAAG,KAAO,EAAA,CAAA;AAChD;AAwBa,MAAA,IAAA,GAAsB,SAASC,KAAAA,CAAK,KAAkB,EAAA;AAC/D,EAAA,MAAM,EAAE,WAAA,EAAa,aAAe,EAAA,GAAA,EAAQ,GAAA,KAAA;AAC5C,EAAA,MAAM,EAAE,GAAA,EAAQ,GAAA,WAAA,CAAY,KAAK,CAAA;AACjC,EAAA,MAAM,OAAO,OAAQ,EAAA;AACrB,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAAkB,KAAK,CAAA;AACvD,EAAA,MAAM,EAAE,gBAAkB,EAAA,WAAA,EAAa,YAAe,GAAA,iBAAA,CAAkB,MAAM,aAAa,CAAA;AAE3F,EAAM,MAAA,EAAE,gBAAmB,GAAA,uBAAA,CAAwB,WAAW,MAAQ,EAAA,gBAAgB,GAAG,KAAK,CAAA;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J,KAAK,KAAA;AACD,MAAO,OAAA;AAAA,QACH,gBAAkB,EAAA,UAAA;AAAA,QAClB,aAAa,IAAK,CAAA,aAAA,CAAc,EAAE,EAAA,EAAI,kBAAkB,CAAA;AAAA,QACxD,UAAA,sBAAa,OAAQ,EAAA,EAAA;AAAA,OACzB;AAAA;AAEZ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@open-pioneer/map-navigation",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.11.0-dev.20250515143825",
|
|
5
5
|
"description": "This package provides a collection of map navigation controls.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"open-pioneer-trails"
|
|
@@ -14,17 +14,17 @@
|
|
|
14
14
|
"directory": "src/packages/map-navigation"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@conterra/reactivity-core": "^0.
|
|
18
|
-
"@
|
|
19
|
-
"@open-pioneer/react-utils": "
|
|
20
|
-
"@open-pioneer/reactivity": "
|
|
21
|
-
"@open-pioneer/runtime": "
|
|
17
|
+
"@conterra/reactivity-core": "^0.6.0",
|
|
18
|
+
"@chakra-ui/react": "^3.17.0",
|
|
19
|
+
"@open-pioneer/react-utils": "4.0.0-dev.20250512105016",
|
|
20
|
+
"@open-pioneer/reactivity": "4.0.0-dev.20250512105016",
|
|
21
|
+
"@open-pioneer/runtime": "4.0.0-dev.20250512105016",
|
|
22
22
|
"classnames": "^2.3.2",
|
|
23
23
|
"ol": "^10.5.0",
|
|
24
24
|
"react": "^19.1.0",
|
|
25
25
|
"react-icons": "^5.3.0",
|
|
26
|
-
"@open-pioneer/map": "
|
|
27
|
-
"@open-pioneer/map-ui-components": "
|
|
26
|
+
"@open-pioneer/map": "0.11.0-dev.20250515143825",
|
|
27
|
+
"@open-pioneer/map-ui-components": "0.11.0-dev.20250515143825"
|
|
28
28
|
},
|
|
29
29
|
"exports": {
|
|
30
30
|
"./package.json": "./package.json",
|