@open-pioneer/scale-viewer 1.5.0-dev.20260910103330 → 1.5.0-dev.20260917081843

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @open-pioneer/scale-viewer
2
2
 
3
- ## 1.5.0-dev.20260910103330
3
+ ## 1.5.0-dev.20260917081843
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -8,6 +8,7 @@
8
8
 
9
9
  ### Patch Changes
10
10
 
11
+ - 0d9a9d0: Adapt to timing changes during map initialization.
11
12
  - 09ec7c7: Updated dependencies
12
13
 
13
14
  ## 1.4.0
@@ -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\n\nimport { Box, BoxProps, Text, VisuallyHidden } from \"@chakra-ui/react\";\nimport { MapModelProps, useMapModelValue } from \"@open-pioneer/map\";\nimport {\n CommonComponentProps,\n mergeChakraProps,\n useCommonComponentProps\n} from \"@open-pioneer/react-utils\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, useEffect, useMemo, 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 const mergedBoxProps = useMemo(\n () =>\n mergeChakraProps<BoxProps>(\n {\n role: \"region\",\n \"aria-label\": intl.formatMessage({ id: \"regionLabel\" })\n },\n containerProps\n ),\n [intl, containerProps]\n );\n\n return (\n <Box {...mergedBoxProps}>\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":";;;;;;;;AAmBO,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,YAAA,GAAe,IAAA,CAAK,YAAA,CAAa,KAAK,CAAA;AAK5C,EAAA,MAAM,cAAA,GAAiB,iBAAA,CAAkB,KAAA,EAAO,GAAI,CAAA;AACpD,EAAA,MAAM,SAAA,GAAY,IAAA,CAAK,aAAA,CAAc,EAAE,EAAA,EAAI,cAAa,EAAG,EAAE,KAAA,EAAO,cAAA,EAAgB,CAAA;AAEpF,EAAA,MAAM,cAAA,GAAiB,OAAA;AAAA,IACnB,MACI,gBAAA;AAAA,MACI;AAAA,QACI,IAAA,EAAM,QAAA;AAAA,QACN,cAAc,IAAA,CAAK,aAAA,CAAc,EAAE,EAAA,EAAI,eAAe;AAAA,OAC1D;AAAA,MACA;AAAA,KACJ;AAAA,IACJ,CAAC,MAAM,cAAc;AAAA,GACzB;AAEA,EAAA,uBACI,IAAA,CAAC,GAAA,EAAA,EAAK,GAAG,cAAA,EACL,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,cAAA,EAAA,EAAe,WAAA,EAAU,QAAA,EAAS,aAAA,EAAY,QAC1C,QAAA,EAAA,SAAA,EACL,CAAA;AAAA,oBACA,IAAA,CAAC,IAAA,EAAA,EAAK,EAAA,EAAG,GAAA,EAAI,eAAY,MAAA,EAAO,QAAA,EAAA;AAAA,MAAA,IAAA;AAAA,MACzB;AAAA,KAAA,EACP;AAAA,GAAA,EACJ,CAAA;AAER;AAGA,SAAS,iBAAA,CAAqB,YAAA,EAAiB,OAAA,GAAU,GAAA,EAAS;AAC9D,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAY,YAAY,CAAA;AAElD,EAAA,SAAA,CAAU,MAAM;AACZ,IAAA,MAAM,KAAK,UAAA,CAAW,MAAM,QAAA,CAAS,YAAY,GAAG,OAAO,CAAA;AAC3D,IAAA,OAAO,MAAM,aAAa,EAAE,CAAA;AAAA,EAChC,CAAA,EAAG,CAAC,YAAA,EAAc,OAAO,CAAC,CAAA;AAE1B,EAAA,OAAO,KAAA;AACX;;;;"}
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\n\nimport { Box, BoxProps, Text, VisuallyHidden } from \"@chakra-ui/react\";\nimport { MapModelProps, useMapModelValue } from \"@open-pioneer/map\";\nimport {\n CommonComponentProps,\n mergeChakraProps,\n useCommonComponentProps\n} from \"@open-pioneer/react-utils\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, useEffect, useMemo, 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 const mergedBoxProps = useMemo(\n () =>\n mergeChakraProps<BoxProps>(\n {\n role: \"region\",\n \"aria-label\": intl.formatMessage({ id: \"regionLabel\" })\n },\n containerProps\n ),\n [intl, containerProps]\n );\n\n return (\n <Box {...mergedBoxProps}>\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":";;;;;;;;AAmBO,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,OA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;AAC3D,IAAA,OAAO,MAAM,aAAa,EAAE,CAAA;AAAA,EAChC,CAAA,EAAG,CAAC,YAAA,EAAc,OAAO,CAAC,CAAA;AAE1B,EAAA,OAAO,KAAA;AACX;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
1
+ {"version":3,"file":"hooks.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@open-pioneer/scale-viewer",
4
- "version": "1.5.0-dev.20260910103330",
4
+ "version": "1.5.0-dev.20260917081843",
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"
@@ -15,11 +15,11 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@chakra-ui/react": "^3.37.0",
18
- "@open-pioneer/map": "1.5.0-dev.20260910103330",
18
+ "@open-pioneer/map": "1.5.0-dev.20260917081843",
19
19
  "@open-pioneer/react-utils": "4.8.0-dev.20260910101405",
20
20
  "@open-pioneer/reactivity": "4.8.0-dev.20260910101405",
21
21
  "@open-pioneer/runtime": "4.8.0-dev.20260910101405",
22
- "react": "^19.2.8"
22
+ "react": "^19.3.0"
23
23
  },
24
24
  "publishConfig": {
25
25
  "directory": "dist",