@open-pioneer/scale-viewer 0.4.4 → 0.8.0-dev.20241120115147

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,5 +1,58 @@
1
1
  # @open-pioneer/scale-viewer
2
2
 
3
+ ## 0.8.0-dev.20241120115147
4
+
5
+ ### Minor Changes
6
+
7
+ - 2fa8020: Update trails core package dependencies.
8
+
9
+ - Also updates Chakra UI to the latest 2.x version and Chakra React Select to version 5.
10
+ - Removes any obsolete references to `@chakra-ui/system`.
11
+ This dependency seems to be no longer required and may lead to duplicate packages in your dependency tree.
12
+
13
+ ### Patch Changes
14
+
15
+ - d8337a6: Refactor implementation to use the new reactive properties of the map model.
16
+ - Updated dependencies [b717121]
17
+ - Updated dependencies [e7978a8]
18
+ - Updated dependencies [7ae9f90]
19
+ - Updated dependencies [d8337a6]
20
+ - Updated dependencies [b2127df]
21
+ - Updated dependencies [2fa8020]
22
+ - Updated dependencies [7ae9f90]
23
+ - Updated dependencies [d8337a6]
24
+ - @open-pioneer/map@0.8.0-dev.20241120115147
25
+
26
+ ## 0.7.0
27
+
28
+ ### Minor Changes
29
+
30
+ - 310800c: Switch from `peerDependencies` to normal `dependencies`. Peer dependencies have some usability problems when used at scale.
31
+
32
+ ### Patch Changes
33
+
34
+ - 310800c: Update core packages version.
35
+ - 583f1d6: The `mapId` or `map` properties are now optional on individual components.
36
+ You can use the `DefaultMapProvider` to configure an implicit default value.
37
+
38
+ Note that configuring _neither_ a default _nor_ an explicit `map` or `mapId` will trigger a runtime error.
39
+
40
+ - 583f1d6: All UI components in this project now accept the `mapId` (a `string`) _or_ the `map` (a `MapModel`) directly.
41
+ - a8b3449: Switch to a new versioning strategy.
42
+ From now on, packages released by this repository share a common version number.
43
+ - 900eb11: Update dependencies.
44
+ - Updated dependencies [310800c]
45
+ - Updated dependencies [2502050]
46
+ - Updated dependencies [583f1d6]
47
+ - Updated dependencies [583f1d6]
48
+ - Updated dependencies [397d617]
49
+ - Updated dependencies [a8b3449]
50
+ - Updated dependencies [310800c]
51
+ - Updated dependencies [900eb11]
52
+ - Updated dependencies [583f1d6]
53
+ - Updated dependencies [397d617]
54
+ - @open-pioneer/map@0.7.0
55
+
3
56
  ## 0.4.4
4
57
 
5
58
  ### Patch Changes
package/ScaleViewer.d.ts CHANGED
@@ -1,12 +1,9 @@
1
+ import { MapModelProps } from "@open-pioneer/map";
1
2
  import { CommonComponentProps } from "@open-pioneer/react-utils";
2
3
  import { FC } from "react";
3
4
  /**
4
5
  * These are the properties supported by the {@link ScaleViewer}.
5
6
  */
6
- export interface ScaleViewerProps extends CommonComponentProps {
7
- /**
8
- * The map id.
9
- */
10
- mapId: string;
7
+ export interface ScaleViewerProps extends CommonComponentProps, MapModelProps {
11
8
  }
12
9
  export declare const ScaleViewer: FC<ScaleViewerProps>;
package/ScaleViewer.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { Box, Text } from '@open-pioneer/chakra-integration';
3
- import { useMapModel, useScale } from '@open-pioneer/map';
3
+ import { useMapModel } from '@open-pioneer/map';
4
4
  import { useCommonComponentProps } from '@open-pioneer/react-utils';
5
+ import { useReactiveSnapshot } from '@open-pioneer/reactivity';
5
6
  import { useIntl } from './_virtual/_virtual-pioneer-module_react-hooks.js';
6
7
 
7
8
  const ScaleViewer = (props) => {
8
- const { mapId } = props;
9
9
  const { containerProps } = useCommonComponentProps("scale-viewer", props);
10
- const { map } = useMapModel(mapId);
10
+ const { map } = useMapModel(props);
11
11
  const intl = useIntl();
12
- const scale = useScale(map?.olMap);
12
+ const scale = useReactiveSnapshot(() => map?.scale ?? 1, [map]);
13
13
  const displayScale = scale ? intl.formatNumber(scale) : void 0;
14
14
  return /* @__PURE__ */ jsx(Box, { ...containerProps, children: displayScale && /* @__PURE__ */ jsxs(Text, { children: [
15
15
  "1:",
@@ -1 +1 @@
1
- {"version":3,"file":"ScaleViewer.js","sources":["ScaleViewer.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Box, Text } from \"@open-pioneer/chakra-integration\";\nimport { useMapModel, useScale } from \"@open-pioneer/map\";\nimport { CommonComponentProps, useCommonComponentProps } from \"@open-pioneer/react-utils\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC } from \"react\";\n\n/**\n * These are the properties supported by the {@link ScaleViewer}.\n */\nexport interface ScaleViewerProps extends CommonComponentProps {\n /**\n * The map id.\n */\n mapId: string;\n}\n\nexport const ScaleViewer: FC<ScaleViewerProps> = (props) => {\n const { mapId } = props;\n const { containerProps } = useCommonComponentProps(\"scale-viewer\", props);\n\n const { map } = useMapModel(mapId);\n const intl = useIntl();\n const scale = useScale(map?.olMap);\n const displayScale = scale ? intl.formatNumber(scale) : undefined;\n\n return <Box {...containerProps}>{displayScale && <Text>1:{displayScale}</Text>}</Box>;\n};\n"],"names":[],"mappings":";;;;;;AAkBa,MAAA,WAAA,GAAoC,CAAC,KAAU,KAAA;AACxD,EAAM,MAAA,EAAE,OAAU,GAAA,KAAA,CAAA;AAClB,EAAA,MAAM,EAAE,cAAA,EAAmB,GAAA,uBAAA,CAAwB,gBAAgB,KAAK,CAAA,CAAA;AAExE,EAAA,MAAM,EAAE,GAAA,EAAQ,GAAA,WAAA,CAAY,KAAK,CAAA,CAAA;AACjC,EAAA,MAAM,OAAO,OAAQ,EAAA,CAAA;AACrB,EAAM,MAAA,KAAA,GAAQ,QAAS,CAAA,GAAA,EAAK,KAAK,CAAA,CAAA;AACjC,EAAA,MAAM,YAAe,GAAA,KAAA,GAAQ,IAAK,CAAA,YAAA,CAAa,KAAK,CAAI,GAAA,KAAA,CAAA,CAAA;AAExD,EAAA,2BAAQ,GAAK,EAAA,EAAA,GAAG,cAAiB,EAAA,QAAA,EAAA,YAAA,yBAAiB,IAAK,EAAA,EAAA,QAAA,EAAA;AAAA,IAAA,IAAA;AAAA,IAAG,YAAA;AAAA,GAAA,EAAa,CAAQ,EAAA,CAAA,CAAA;AACnF;;;;"}
1
+ {"version":3,"file":"ScaleViewer.js","sources":["ScaleViewer.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Box, Text } from \"@open-pioneer/chakra-integration\";\nimport { MapModelProps, useMapModel } 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 } 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 } = useMapModel(props);\n const intl = useIntl();\n const scale = useReactiveSnapshot(() => map?.scale ?? 1, [map]);\n const displayScale = scale ? intl.formatNumber(scale) : undefined;\n\n return <Box {...containerProps}>{displayScale && <Text>1:{displayScale}</Text>}</Box>;\n};\n"],"names":[],"mappings":";;;;;;;AAca,MAAA,WAAA,GAAoC,CAAC,KAAU,KAAA;AACxD,EAAA,MAAM,EAAE,cAAA,EAAmB,GAAA,uBAAA,CAAwB,gBAAgB,KAAK,CAAA,CAAA;AACxE,EAAA,MAAM,EAAE,GAAA,EAAQ,GAAA,WAAA,CAAY,KAAK,CAAA,CAAA;AACjC,EAAA,MAAM,OAAO,OAAQ,EAAA,CAAA;AACrB,EAAM,MAAA,KAAA,GAAQ,oBAAoB,MAAM,GAAA,EAAK,SAAS,CAAG,EAAA,CAAC,GAAG,CAAC,CAAA,CAAA;AAC9D,EAAA,MAAM,YAAe,GAAA,KAAA,GAAQ,IAAK,CAAA,YAAA,CAAa,KAAK,CAAI,GAAA,KAAA,CAAA,CAAA;AAExD,EAAA,2BAAQ,GAAK,EAAA,EAAA,GAAG,cAAiB,EAAA,QAAA,EAAA,YAAA,yBAAiB,IAAK,EAAA,EAAA,QAAA,EAAA;AAAA,IAAA,IAAA;AAAA,IAAG,YAAA;AAAA,GAAA,EAAa,CAAQ,EAAA,CAAA,CAAA;AACnF;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@open-pioneer/scale-viewer",
4
- "version": "0.4.4",
4
+ "version": "0.8.0-dev.20241120115147",
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"
@@ -13,12 +13,13 @@
13
13
  "url": "https://github.com/open-pioneer/trails-openlayers-base-packages",
14
14
  "directory": "src/packages/scale-viewer"
15
15
  },
16
- "peerDependencies": {
17
- "@open-pioneer/chakra-integration": "^1.1.4",
18
- "@open-pioneer/react-utils": "^1.0.1",
19
- "@open-pioneer/runtime": "^2.1.7",
16
+ "dependencies": {
17
+ "@open-pioneer/chakra-integration": "^2.4.0-dev.20241120092632",
18
+ "@open-pioneer/react-utils": "^2.4.0-dev.20241120092632",
19
+ "@open-pioneer/runtime": "^2.4.0-dev.20241120092632",
20
+ "@open-pioneer/reactivity": "^2.4.0-dev.20241120092632",
20
21
  "react": "^18.3.1",
21
- "@open-pioneer/map": "^0.6.1"
22
+ "@open-pioneer/map": "^0.8.0-dev.20241120115147"
22
23
  },
23
24
  "exports": {
24
25
  "./package.json": "./package.json",