@open-pioneer/scale-setter 1.4.0-dev.20260727093741 → 1.4.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/CHANGELOG.md +6 -1
- package/ScaleSetter.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
# @open-pioneer/scale-setter
|
|
2
2
|
|
|
3
|
-
## 1.4.0
|
|
3
|
+
## 1.4.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
7
|
- c30396d: Update Chakra to 3.36.1
|
|
8
|
+
- d862003: Update to trails core-packages 4.7.0
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- c16a401: Migrated from eslint to oxlint and from prettier to oxfmt.
|
|
8
13
|
|
|
9
14
|
## 1.3.0
|
|
10
15
|
|
package/ScaleSetter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScaleSetter.js","sources":["ScaleSetter.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Box, Button, Icon, Menu, Portal } 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 { PackageIntl } from \"@open-pioneer/runtime\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, useMemo } from \"react\";\nimport { LuChevronDown } from \"react-icons/lu\";\n\nconst DEFAULT_SCALES = [\n 17471320, 8735660, 4367830, 2183915, 1091957, 545978, 272989, 136494, 68247, 34123, 17061, 8530,\n 4265, 2132\n];\n\n/**\n * These are the properties supported by the {@link ScaleSetter}.\n */\nexport interface ScaleSetterProps extends CommonComponentProps, MapModelProps {\n /**\n * The set of scales that can be selected by the user.\n */\n scales?: number[];\n}\n\n/**\n * Displays the current scale and allows the user to change it.\n */\nexport const ScaleSetter: FC<ScaleSetterProps> = (props) => {\n const { scales = DEFAULT_SCALES } = props;\n const { containerProps } = useCommonComponentProps(\"scale-setter\", props);\n const map = useMapModelValue(props);\n const intl = useIntl();\n\n const scaleSelectOptions = useMemo(\n () =>\n scales.map((scaleValue) => {\n return (\n <Menu.Item\n className=\"scale-setter-option\"\n aria-label={intl.formatMessage(\n {\n id: \"option.ariaLabel\"\n },\n { scale: scaleValue }\n )}\n value={String(scaleValue)}\n key={scaleValue}\n onClick={() => map.setScale(scaleValue)}\n onFocus={(e) => {\n // Not available in unit tests\n e.target?.scrollIntoView?.({\n block: \"nearest\"\n });\n }}\n >\n {renderScaleText(intl, scaleValue)}\n </Menu.Item>\n );\n }),\n [intl, map, scales]\n );\n\n const activeScale = useReactiveSnapshot(() => map.scale ?? 1, [map]);\n return (\n <Box {...containerProps}>\n <Menu.Root>\n <Menu.Trigger asChild>\n <Button\n className=\"scale-setter-menubutton\"\n aria-label={intl.formatMessage(\n {\n id: \"button.ariaLabel\"\n },\n {\n scale: activeScale\n }\n )}\n aria-description={intl.formatMessage({\n id: \"button.ariaDescription\"\n })}\n >\n {renderScaleText(intl, activeScale)}\n <Icon>\n <LuChevronDown />\n </Icon>\n </Button>\n </Menu.Trigger>\n <Portal>\n <Menu.Positioner>\n <Menu.Content\n className=\"scale-setter-menuoptions\"\n maxHeight=\"20em\"\n overflowY=\"auto\"\n >\n {scaleSelectOptions}\n </Menu.Content>\n </Menu.Positioner>\n </Portal>\n </Menu.Root>\n </Box>\n );\n};\n\nfunction renderScaleText(intl: PackageIntl, rawScale: number): string {\n return \"1 : \" + intl.formatNumber(rawScale);\n}\n"],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"ScaleSetter.js","sources":["ScaleSetter.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Box, Button, Icon, Menu, Portal } 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 { PackageIntl } from \"@open-pioneer/runtime\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, useMemo } from \"react\";\nimport { LuChevronDown } from \"react-icons/lu\";\n\nconst DEFAULT_SCALES = [\n 17471320, 8735660, 4367830, 2183915, 1091957, 545978, 272989, 136494, 68247, 34123, 17061, 8530,\n 4265, 2132\n];\n\n/**\n * These are the properties supported by the {@link ScaleSetter}.\n */\nexport interface ScaleSetterProps extends CommonComponentProps, MapModelProps {\n /**\n * The set of scales that can be selected by the user.\n */\n scales?: number[];\n}\n\n/**\n * Displays the current scale and allows the user to change it.\n */\nexport const ScaleSetter: FC<ScaleSetterProps> = (props) => {\n const { scales = DEFAULT_SCALES } = props;\n const { containerProps } = useCommonComponentProps(\"scale-setter\", props);\n const map = useMapModelValue(props);\n const intl = useIntl();\n\n const scaleSelectOptions = useMemo(\n () =>\n scales.map((scaleValue) => {\n return (\n <Menu.Item\n className=\"scale-setter-option\"\n aria-label={intl.formatMessage(\n {\n id: \"option.ariaLabel\"\n },\n { scale: scaleValue }\n )}\n value={String(scaleValue)}\n key={scaleValue}\n onClick={() => map.setScale(scaleValue)}\n onFocus={(e) => {\n // Not available in unit tests\n e.target?.scrollIntoView?.({\n block: \"nearest\"\n });\n }}\n >\n {renderScaleText(intl, scaleValue)}\n </Menu.Item>\n );\n }),\n [intl, map, scales]\n );\n\n const activeScale = useReactiveSnapshot(() => map.scale ?? 1, [map]);\n return (\n <Box {...containerProps}>\n <Menu.Root>\n <Menu.Trigger asChild>\n <Button\n className=\"scale-setter-menubutton\"\n aria-label={intl.formatMessage(\n {\n id: \"button.ariaLabel\"\n },\n {\n scale: activeScale\n }\n )}\n aria-description={intl.formatMessage({\n id: \"button.ariaDescription\"\n })}\n >\n {renderScaleText(intl, activeScale)}\n <Icon>\n <LuChevronDown />\n </Icon>\n </Button>\n </Menu.Trigger>\n <Portal>\n <Menu.Positioner>\n <Menu.Content\n className=\"scale-setter-menuoptions\"\n maxHeight=\"20em\"\n overflowY=\"auto\"\n >\n {scaleSelectOptions}\n </Menu.Content>\n </Menu.Positioner>\n </Portal>\n </Menu.Root>\n </Box>\n );\n};\n\nfunction renderScaleText(intl: PackageIntl, rawScale: number): string {\n return \"1 : \" + intl.formatNumber(rawScale);\n}\n"],"names":[],"mappings":";;;;;;;;;AAYA,MAAM,cAAA,GAAiB;AAAA,EACnB,QAAA;AAAA,EAAU,OAAA;AAAA,EAAS,OAAA;AAAA,EAAS,OAAA;AAAA,EAAS,OAAA;AAAA,EAAS,MAAA;AAAA,EAAQ,MAAA;AAAA,EAAQ,MAAA;AAAA,EAAQ,KAAA;AAAA,EAAO,KAAA;AAAA,EAAO,KAAA;AAAA,EAAO,IAAA;AAAA,EAC3F,IAAA;AAAA,EAAM;AACV,CAAA;AAeO,MAAM,WAAA,GAAoC,CAAC,KAAA,KAAU;AACxD,EAAA,MAAM,EAAE,MAAA,GAAS,cAAA,EAAe,GAAI,KAAA;AACpC,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,kBAAA,GAAqB,OAAA;AAAA,IACvB,MACI,MAAA,CAAO,GAAA,CAAI,CAAC,UAAA,KAAe;AACvB,MAAA,uBACI,GAAA;AAAA,QAAC,IAAA,CAAK,IAAA;AAAA,QAAL;AAAA,UACG,SAAA,EAAU,qBAAA;AAAA,UACV,cAAY,IAAA,CAAK,aAAA;AAAA,YACb;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A,EACnB;AAAA;AAAA;AAAA,KACJ,EACJ,CAAA;AAAA,oBACA,GAAA,CAAC,MAAA,EAAA,EACG,QAAA,kBAAA,GAAA,CAAC,IAAA,CAAK,YAAL,EACG,QAAA,kBAAA,GAAA;AAAA,MAAC,IAAA,CAAK,OAAA;AAAA,MAAL;AAAA,QACG,SAAA,EAAU,0BAAA;AAAA,QACV,SAAA,EAAU,MAAA;AAAA,QACV,SAAA,EAAU,MAAA;AAAA,QAET,QAAA,EAAA;AAAA;AAAA,OAET,CAAA,EACJ;AAAA,GAAA,EACJ,CAAA,EACJ,CAAA;AAER;AAEA,SAAS,eAAA,CAAgB,MAAmB,QAAA,EAA0B;AAClE,EAAA,OAAO,MAAA,GAAS,IAAA,CAAK,YAAA,CAAa,QAAQ,CAAA;AAC9C;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@open-pioneer/scale-setter",
|
|
4
|
-
"version": "1.4.0
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"description": "This package provides a UI component to change the scale of the map.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"open-pioneer-trails"
|
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
"directory": "src/packages/scale-setter"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@conterra/reactivity-core": "^0.8.6",
|
|
18
17
|
"@chakra-ui/react": "^3.36.1",
|
|
19
|
-
"@
|
|
20
|
-
"@open-pioneer/
|
|
21
|
-
"@open-pioneer/reactivity": "4.7.0
|
|
18
|
+
"@conterra/reactivity-core": "^0.8.6",
|
|
19
|
+
"@open-pioneer/react-utils": "^4.7.0",
|
|
20
|
+
"@open-pioneer/reactivity": "^4.7.0",
|
|
21
|
+
"@open-pioneer/runtime": "^4.7.0",
|
|
22
22
|
"ol": "^10.9.0",
|
|
23
23
|
"react": "^19.2.8",
|
|
24
24
|
"react-icons": "^5.7.0",
|
|
25
|
-
"@open-pioneer/map": "1.4.0
|
|
25
|
+
"@open-pioneer/map": "1.4.0"
|
|
26
26
|
},
|
|
27
27
|
"exports": {
|
|
28
28
|
"./package.json": "./package.json",
|