@open-pioneer/scale-viewer 0.11.0 → 0.12.0-dev.20250905090001
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 +18 -1
- package/ScaleViewer.js +3 -3
- package/ScaleViewer.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @open-pioneer/scale-viewer
|
|
2
2
|
|
|
3
|
+
## 0.12.0-dev.20250905090001
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 10d2fe7: Update dependencies
|
|
8
|
+
- da6a410: Update dependencies
|
|
9
|
+
- Updated dependencies [29a10df]
|
|
10
|
+
- Updated dependencies [10d2fe7]
|
|
11
|
+
- Updated dependencies [2702df4]
|
|
12
|
+
- Updated dependencies [12561fe]
|
|
13
|
+
- Updated dependencies [5df900f]
|
|
14
|
+
- Updated dependencies [8986b3b]
|
|
15
|
+
- Updated dependencies [aeb9000]
|
|
16
|
+
- Updated dependencies [5df900f]
|
|
17
|
+
- Updated dependencies [f1f69f2]
|
|
18
|
+
- Updated dependencies [da6a410]
|
|
19
|
+
- @open-pioneer/map@0.12.0-dev.20250905090001
|
|
20
|
+
|
|
3
21
|
## 0.11.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -72,7 +90,6 @@
|
|
|
72
90
|
### Minor Changes
|
|
73
91
|
|
|
74
92
|
- 2fa8020: Update trails core package dependencies.
|
|
75
|
-
|
|
76
93
|
- Also updates Chakra UI to the latest 2.x version and Chakra React Select to version 5.
|
|
77
94
|
- Removes any obsolete references to `@chakra-ui/system`.
|
|
78
95
|
This dependency seems to be no longer required and may lead to duplicate packages in your dependency tree.
|
package/ScaleViewer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Box, VisuallyHidden, Text } from '@chakra-ui/react';
|
|
3
|
-
import {
|
|
3
|
+
import { useMapModelValue } from '@open-pioneer/map';
|
|
4
4
|
import { useCommonComponentProps } from '@open-pioneer/react-utils';
|
|
5
5
|
import { useReactiveSnapshot } from '@open-pioneer/reactivity';
|
|
6
6
|
import { useIntl } from './_virtual/_virtual-pioneer-module_react-hooks.js';
|
|
@@ -8,9 +8,9 @@ import { useState, useEffect } from 'react';
|
|
|
8
8
|
|
|
9
9
|
const ScaleViewer = (props) => {
|
|
10
10
|
const { containerProps } = useCommonComponentProps("scale-viewer", props);
|
|
11
|
-
const
|
|
11
|
+
const map = useMapModelValue(props);
|
|
12
12
|
const intl = useIntl();
|
|
13
|
-
const scale = useReactiveSnapshot(() => map
|
|
13
|
+
const scale = useReactiveSnapshot(() => map.scale ?? 1, [map]);
|
|
14
14
|
const displayScale = intl.formatNumber(scale);
|
|
15
15
|
const debouncedScale = useDebouncedValue(scale, 3e3);
|
|
16
16
|
const ariaLabel = intl.formatMessage({ id: "scaleLabel" }, { scale: debouncedScale });
|
package/ScaleViewer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScaleViewer.js","sources":["ScaleViewer.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Box, Text, VisuallyHidden } from \"@chakra-ui/react\";\nimport { MapModelProps,
|
|
1
|
+
{"version":3,"file":"ScaleViewer.js","sources":["ScaleViewer.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Box, Text, VisuallyHidden } from \"@chakra-ui/react\";\nimport { MapModelProps, useMapModelValue } from \"@open-pioneer/map\";\nimport { CommonComponentProps, useCommonComponentProps } from \"@open-pioneer/react-utils\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, useEffect, useState } from \"react\";\n\n/**\n * These are the properties supported by the {@link ScaleViewer}.\n */\nexport interface ScaleViewerProps extends CommonComponentProps, MapModelProps {}\n\nexport const ScaleViewer: FC<ScaleViewerProps> = (props) => {\n const { containerProps } = useCommonComponentProps(\"scale-viewer\", props);\n const map = useMapModelValue(props);\n const intl = useIntl();\n\n const scale = useReactiveSnapshot(() => map.scale ?? 1, [map]);\n const displayScale = intl.formatNumber(scale);\n\n // Make the scale shown to the screen reader lag behind a bit via debounce.\n // Otherwise, the user is notified of too many updates (individual scale changes).\n // See https://github.com/open-pioneer/trails-openlayers-base-packages/issues/431\n const debouncedScale = useDebouncedValue(scale, 3000);\n const ariaLabel = intl.formatMessage({ id: \"scaleLabel\" }, { scale: debouncedScale });\n\n return (\n <Box\n {...containerProps}\n role=\"region\"\n aria-label={intl.formatMessage({ id: \"regionLabel\" })}\n >\n <VisuallyHidden aria-live=\"polite\" aria-atomic=\"true\">\n {ariaLabel}\n </VisuallyHidden>\n <Text as=\"p\" aria-hidden=\"true\">\n 1:{displayScale}\n </Text>\n </Box>\n );\n};\n\n// TODO: Might be useful in a shared package\nfunction useDebouncedValue<T>(currentValue: T, timeout = 1000): T {\n const [value, setValue] = useState<T>(currentValue);\n\n useEffect(() => {\n const id = setTimeout(() => setValue(currentValue), timeout);\n return () => clearTimeout(id);\n }, [currentValue, timeout]);\n\n return value;\n}\n"],"names":[],"mappings":";;;;;;;;AAcO,MAAM,WAAA,GAAoC,CAAC,KAAA,KAAU;AACxD,EAAA,MAAM,EAAE,cAAA,EAAe,GAAI,uBAAA,CAAwB,gBAAgB,KAAK,CAAA;AACxE,EAAA,MAAM,GAAA,GAAM,iBAAiB,KAAK,CAAA;AAClC,EAAA,MAAM,OAAO,OAAA,EAAQ;AAErB,EAAA,MAAM,KAAA,GAAQ,oBAAoB,MAAM,GAAA,CAAI,SAAS,CAAA,EAAG,CAAC,GAAG,CAAC,CAAA;AAC7D,EAAA,MAAM,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|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.12.0-dev.20250905090001",
|
|
5
5
|
"description": "This package provides a UI component to show the actual map scale to the user.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"open-pioneer-trails"
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"directory": "src/packages/scale-viewer"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@chakra-ui/react": "^3.
|
|
17
|
+
"@chakra-ui/react": "^3.24.2",
|
|
18
18
|
"@open-pioneer/react-utils": "^4.0.0",
|
|
19
19
|
"@open-pioneer/runtime": "^4.0.0",
|
|
20
20
|
"@open-pioneer/reactivity": "^4.0.0",
|
|
21
|
-
"react": "^19.1.
|
|
22
|
-
"@open-pioneer/map": "
|
|
21
|
+
"react": "^19.1.1",
|
|
22
|
+
"@open-pioneer/map": "0.12.0-dev.20250905090001"
|
|
23
23
|
},
|
|
24
24
|
"exports": {
|
|
25
25
|
"./package.json": "./package.json",
|