@open-pioneer/basemap-switcher 1.1.0 → 1.2.0-dev.20260121105545
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/BasemapSwitcher.js +2 -2
- package/BasemapSwitcher.js.map +1 -1
- package/CHANGELOG.md +12 -0
- package/_virtual/{_virtual-pioneer-module_react-hooks.js → hooks.js} +1 -1
- package/_virtual/hooks.js.map +1 -0
- package/package.json +8 -8
- package/_virtual/_virtual-pioneer-module_react-hooks.js.map +0 -1
package/BasemapSwitcher.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Tooltip } from '@open-pioneer/chakra-snippets/tooltip';
|
|
|
4
4
|
import { useMapModelValue } from '@open-pioneer/map';
|
|
5
5
|
import { useCommonComponentProps } from '@open-pioneer/react-utils';
|
|
6
6
|
import { useReactiveSnapshot } from '@open-pioneer/reactivity';
|
|
7
|
-
import { useIntl } from './_virtual/
|
|
7
|
+
import { useIntl } from './_virtual/hooks.js';
|
|
8
8
|
import { useMemo } from 'react';
|
|
9
9
|
import { LuTriangleAlert, LuInfo } from 'react-icons/lu';
|
|
10
10
|
|
|
@@ -130,5 +130,5 @@ function ProblemIndicator(props) {
|
|
|
130
130
|
return /* @__PURE__ */ jsx(Box, { ml: 2, className: "basemap-switcher-option-problem-indicator", children: /* @__PURE__ */ jsx(Tooltip, { content: message, "aria-label": message, positioning: { placement: "right" }, children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Icon, { "aria-label": message, color }) }) }) });
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
export { BasemapSwitcher
|
|
133
|
+
export { BasemapSwitcher };
|
|
134
134
|
//# sourceMappingURL=BasemapSwitcher.js.map
|
package/BasemapSwitcher.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasemapSwitcher.js","sources":["BasemapSwitcher.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Box, createListCollection, Portal, Select, Text } from \"@chakra-ui/react\";\nimport { Tooltip } from \"@open-pioneer/chakra-snippets/tooltip\";\nimport { Layer, 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, useMemo } from \"react\";\nimport { type IconType } from \"react-icons/lib\";\nimport { LuInfo, LuTriangleAlert } from \"react-icons/lu\";\n\n/*\n Exported for tests. Feels a bit hacky but should be fine for now.\n Originally was using the empty string, but that doesn't work well with happy-dom.\n*/\nexport const NO_BASEMAP_ID = \"___NO_BASEMAP___\";\n\n/**\n * Properties for single select options.\n */\ninterface SelectOption {\n /**\n * The id of the basemap for the select option.\n */\n value: string;\n\n /**\n * The label of the select option.\n */\n label: string;\n\n /**\n * The layer object for the select option.\n * Undefined is used for \"no basemap\".\n */\n layer: Layer | undefined;\n}\n\n/**\n * These are special properties for the BasemapSwitcher.\n */\nexport interface BasemapSwitcherProps extends CommonComponentProps, MapModelProps {\n /**\n * Additional css class name(s) that will be added to the BasemapSwitcher component.\n */\n className?: string;\n\n /**\n * Specifies whether an option to deactivate all basemap layers is available in the BasemapSwitcher.\n * Defaults to `false`.\n */\n allowSelectingEmptyBasemap?: boolean | undefined;\n\n /**\n * Optional aria-labelledby property.\n * Do not use together with aria-label.\n */\n \"aria-labelledby\"?: string;\n\n /**\n * Optional aria-label property.\n * Do not use together with aria-label.\n */\n \"aria-label\"?: string;\n}\n\n/**\n * The `BasemapSwitcher` component can be used in an app to switch between the different basemaps.\n */\nexport const BasemapSwitcher: FC<BasemapSwitcherProps> = (props) => {\n const map = useMapModelValue(props);\n const intl = useIntl();\n const {\n allowSelectingEmptyBasemap = false,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy\n } = props;\n const { containerProps } = useCommonComponentProps(\"basemap-switcher\", props);\n const emptyBasemapLabel = intl.formatMessage({ id: \"emptyBasemapLabel\" });\n\n const activateLayer = (layerId: string[]) => {\n map.layers.activateBaseLayer(layerId[0] === NO_BASEMAP_ID ? undefined : layerId[0]);\n };\n\n const { optionsListCollection, selectedOption } = useReactiveSnapshot(() => {\n const baseLayers = map.layers.getBaseLayers() ?? [];\n const options: SelectOption[] = baseLayers.map<SelectOption>((layer) => {\n return {\n value: layer.id,\n layer: layer,\n label: layer.title,\n disabled: layer.loadState == \"error\"\n };\n });\n\n const activeBaseLayer = map.layers.getActiveBaseLayer();\n if (allowSelectingEmptyBasemap || activeBaseLayer == null) {\n const emptyOption: SelectOption = {\n value: NO_BASEMAP_ID,\n layer: undefined,\n label: emptyBasemapLabel\n };\n options.push(emptyOption);\n }\n const optionsListCollection = createListCollection({ items: options });\n const selectedOption = optionsListCollection.find(activeBaseLayer?.id ?? NO_BASEMAP_ID);\n if (!selectedOption) {\n throw new Error(\"Internal error: selected option not found in list.\");\n }\n\n return { optionsListCollection, selectedOption };\n }, [allowSelectingEmptyBasemap, emptyBasemapLabel, map]);\n\n return (\n <Box {...containerProps}>\n <Select.Root\n collection={optionsListCollection}\n value={[selectedOption.value]}\n onValueChange={(option) => option && activateLayer(option.value)}\n className=\"basemap-switcher-select\"\n lazyMount={true}\n unmountOnExit={true}\n >\n <Select.Control>\n <Select.Trigger\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n className=\"basemap-switcher-select-trigger\"\n >\n <Select.ValueText display=\"flex\" alignItems=\"center\">\n <BasemapItemContent option={selectedOption} />\n </Select.ValueText>\n </Select.Trigger>\n <Select.IndicatorGroup>\n <Select.Indicator />\n </Select.IndicatorGroup>\n </Select.Control>\n\n <Portal>\n <Select.Positioner>\n <Select.Content className=\"basemap-switcher-select-content\">\n {optionsListCollection.items.map((item) => (\n <BasemapItem item={item} key={item.value} />\n ))}\n </Select.Content>\n </Select.Positioner>\n </Portal>\n </Select.Root>\n </Box>\n );\n};\n\nfunction BasemapItem(props: { item: SelectOption }) {\n const item = props.item;\n\n return (\n <Select.Item\n item={item}\n key={item.value}\n justifyContent=\"flex-start\"\n // Override pointer-events: none rule for disabled items; we want to show the tooltip on hover\n pointerEvents=\"auto\"\n className=\"basemap-switcher-option\"\n >\n <BasemapItemContent option={item} />\n </Select.Item>\n );\n}\n\nfunction BasemapItemContent(props: { option: SelectOption }) {\n const { option } = props;\n const intl = useIntl();\n const loadState = useReactiveSnapshot(() => option.layer?.loadState, [option.layer]);\n const visibleInScale = useReactiveSnapshot(() => option.layer?.visibleInScale, [option.layer]);\n\n const { problem, opacity } = useMemo(() => {\n let problem = undefined;\n let opacity = undefined;\n if (option.layer) {\n if (loadState === \"error\") {\n problem = (\n <ProblemIndicator\n Icon={LuTriangleAlert}\n color=\"red\"\n message={intl.formatMessage({ id: \"layerNotAvailable\" })}\n />\n );\n } else if (!visibleInScale) {\n problem = (\n <ProblemIndicator\n Icon={LuInfo}\n message={intl.formatMessage({ id: \"layerNotVisible\" })}\n />\n );\n opacity = 0.5;\n }\n }\n return { problem, opacity };\n }, [option.layer, loadState, visibleInScale, intl]);\n\n return (\n <>\n <Text as=\"span\" opacity={opacity}>\n {option.label}\n </Text>\n {problem}\n </>\n );\n}\n\nfunction ProblemIndicator(props: { Icon: IconType; message: string; color?: string }) {\n const { Icon, message, color } = props;\n return (\n <Box ml={2} className=\"basemap-switcher-option-problem-indicator\">\n <Tooltip content={message} aria-label={message} positioning={{ placement: \"right\" }}>\n <span>\n <Icon aria-label={message} color={color} />\n </span>\n </Tooltip>\n </Box>\n );\n}\n"],"names":["optionsListCollection","selectedOption","problem","opacity"],"mappings":";;;;;;;;;;AAgBO,MAAM,aAAA,GAAgB;AAsDtB,MAAM,eAAA,GAA4C,CAAC,KAAA,KAAU;AAChE,EAAA,MAAM,GAAA,GAAM,iBAAiB,KAAK,CAAA;AAClC,EAAA,MAAM,OAAO,OAAA,EAAQ;AACrB,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AU,2CAAA,EAClB,QAAA,kBAAA,GAAA,CAAC,OAAA,EAAA,EAAQ,OAAA,EAAS,OAAA,EAAS,YAAA,EAAY,OAAA,EAAS,WAAA,EAAa,EAAE,SAAA,EAAW,OAAA,EAAQ,EAC9E,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EACG,QAAA,kBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,YAAA,EAAY,OAAA,EAAS,KAAA,EAAc,CAAA,EAC7C,CAAA,EACJ,CAAA,EACJ,CAAA;AAER;;;;"}
|
|
1
|
+
{"version":3,"file":"BasemapSwitcher.js","sources":["BasemapSwitcher.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Box, createListCollection, Portal, Select, Text } from \"@chakra-ui/react\";\nimport { Tooltip } from \"@open-pioneer/chakra-snippets/tooltip\";\nimport { Layer, 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, useMemo } from \"react\";\nimport { type IconType } from \"react-icons/lib\";\nimport { LuInfo, LuTriangleAlert } from \"react-icons/lu\";\n\n/*\n Exported for tests. Feels a bit hacky but should be fine for now.\n Originally was using the empty string, but that doesn't work well with happy-dom.\n*/\nexport const NO_BASEMAP_ID = \"___NO_BASEMAP___\";\n\n/**\n * Properties for single select options.\n */\ninterface SelectOption {\n /**\n * The id of the basemap for the select option.\n */\n value: string;\n\n /**\n * The label of the select option.\n */\n label: string;\n\n /**\n * The layer object for the select option.\n * Undefined is used for \"no basemap\".\n */\n layer: Layer | undefined;\n}\n\n/**\n * These are special properties for the BasemapSwitcher.\n */\nexport interface BasemapSwitcherProps extends CommonComponentProps, MapModelProps {\n /**\n * Additional css class name(s) that will be added to the BasemapSwitcher component.\n */\n className?: string;\n\n /**\n * Specifies whether an option to deactivate all basemap layers is available in the BasemapSwitcher.\n * Defaults to `false`.\n */\n allowSelectingEmptyBasemap?: boolean | undefined;\n\n /**\n * Optional aria-labelledby property.\n * Do not use together with aria-label.\n */\n \"aria-labelledby\"?: string;\n\n /**\n * Optional aria-label property.\n * Do not use together with aria-label.\n */\n \"aria-label\"?: string;\n}\n\n/**\n * The `BasemapSwitcher` component can be used in an app to switch between the different basemaps.\n */\nexport const BasemapSwitcher: FC<BasemapSwitcherProps> = (props) => {\n const map = useMapModelValue(props);\n const intl = useIntl();\n const {\n allowSelectingEmptyBasemap = false,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy\n } = props;\n const { containerProps } = useCommonComponentProps(\"basemap-switcher\", props);\n const emptyBasemapLabel = intl.formatMessage({ id: \"emptyBasemapLabel\" });\n\n const activateLayer = (layerId: string[]) => {\n map.layers.activateBaseLayer(layerId[0] === NO_BASEMAP_ID ? undefined : layerId[0]);\n };\n\n const { optionsListCollection, selectedOption } = useReactiveSnapshot(() => {\n const baseLayers = map.layers.getBaseLayers() ?? [];\n const options: SelectOption[] = baseLayers.map<SelectOption>((layer) => {\n return {\n value: layer.id,\n layer: layer,\n label: layer.title,\n disabled: layer.loadState == \"error\"\n };\n });\n\n const activeBaseLayer = map.layers.getActiveBaseLayer();\n if (allowSelectingEmptyBasemap || activeBaseLayer == null) {\n const emptyOption: SelectOption = {\n value: NO_BASEMAP_ID,\n layer: undefined,\n label: emptyBasemapLabel\n };\n options.push(emptyOption);\n }\n const optionsListCollection = createListCollection({ items: options });\n const selectedOption = optionsListCollection.find(activeBaseLayer?.id ?? NO_BASEMAP_ID);\n if (!selectedOption) {\n throw new Error(\"Internal error: selected option not found in list.\");\n }\n\n return { optionsListCollection, selectedOption };\n }, [allowSelectingEmptyBasemap, emptyBasemapLabel, map]);\n\n return (\n <Box {...containerProps}>\n <Select.Root\n collection={optionsListCollection}\n value={[selectedOption.value]}\n onValueChange={(option) => option && activateLayer(option.value)}\n className=\"basemap-switcher-select\"\n lazyMount={true}\n unmountOnExit={true}\n >\n <Select.Control>\n <Select.Trigger\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n className=\"basemap-switcher-select-trigger\"\n >\n <Select.ValueText display=\"flex\" alignItems=\"center\">\n <BasemapItemContent option={selectedOption} />\n </Select.ValueText>\n </Select.Trigger>\n <Select.IndicatorGroup>\n <Select.Indicator />\n </Select.IndicatorGroup>\n </Select.Control>\n\n <Portal>\n <Select.Positioner>\n <Select.Content className=\"basemap-switcher-select-content\">\n {optionsListCollection.items.map((item) => (\n <BasemapItem item={item} key={item.value} />\n ))}\n </Select.Content>\n </Select.Positioner>\n </Portal>\n </Select.Root>\n </Box>\n );\n};\n\nfunction BasemapItem(props: { item: SelectOption }) {\n const item = props.item;\n\n return (\n <Select.Item\n item={item}\n key={item.value}\n justifyContent=\"flex-start\"\n // Override pointer-events: none rule for disabled items; we want to show the tooltip on hover\n pointerEvents=\"auto\"\n className=\"basemap-switcher-option\"\n >\n <BasemapItemContent option={item} />\n </Select.Item>\n );\n}\n\nfunction BasemapItemContent(props: { option: SelectOption }) {\n const { option } = props;\n const intl = useIntl();\n const loadState = useReactiveSnapshot(() => option.layer?.loadState, [option.layer]);\n const visibleInScale = useReactiveSnapshot(() => option.layer?.visibleInScale, [option.layer]);\n\n const { problem, opacity } = useMemo(() => {\n let problem = undefined;\n let opacity = undefined;\n if (option.layer) {\n if (loadState === \"error\") {\n problem = (\n <ProblemIndicator\n Icon={LuTriangleAlert}\n color=\"red\"\n message={intl.formatMessage({ id: \"layerNotAvailable\" })}\n />\n );\n } else if (!visibleInScale) {\n problem = (\n <ProblemIndicator\n Icon={LuInfo}\n message={intl.formatMessage({ id: \"layerNotVisible\" })}\n />\n );\n opacity = 0.5;\n }\n }\n return { problem, opacity };\n }, [option.layer, loadState, visibleInScale, intl]);\n\n return (\n <>\n <Text as=\"span\" opacity={opacity}>\n {option.label}\n </Text>\n {problem}\n </>\n );\n}\n\nfunction ProblemIndicator(props: { Icon: IconType; message: string; color?: string }) {\n const { Icon, message, color } = props;\n return (\n <Box ml={2} className=\"basemap-switcher-option-problem-indicator\">\n <Tooltip content={message} aria-label={message} positioning={{ placement: \"right\" }}>\n <span>\n <Icon aria-label={message} color={color} />\n </span>\n </Tooltip>\n </Box>\n );\n}\n"],"names":["optionsListCollection","selectedOption","problem","opacity"],"mappings":";;;;;;;;;;AAgBO,MAAM,aAAA,GAAgB,kBAAA;AAsDtB,MAAM,eAAA,GAA4C,CAAC,KAAA,KAAU;AAChE,EAAA,MAAM,GAAA,GAAM,iBAAiB,KAAK,CAAA;AAClC,EAAA,MAAM,OAAO,OAAA,EAAQ;AACrB,EAAA,MAAM;AAAA,IACF,0BAAA,GAA6B,KAAA;AAAA,IAC7B,YAAA,EAAc,SAAA;AAAA,IACd,iBAAA,EAAmB;AAAA,GACvB,GAAI,KAAA;AACJ,EAAA,MAAM,EAAE,cAAA,EAAe,GAAI,uBAAA,CAAwB,oBAAoB,KAAK,CAAA;AAC5E,EAAA,MAAM,oBAAoB,IAAA,CAAK,aAAA,CAAc,EAAE,EAAA,EAAI,qBAAqB,CAAA;AAExE,EAAA,MAAM,aAAA,GAAgB,CAAC,OAAA,KAAsB;AACzC,IAAA,GAAA,CAAI,MAAA,CAAO,kBAAkB,OAAA,CAAQ,CAAC,MAAM,aAAA,GAAgB,MAAA,GAAY,OAAA,CAAQ,CAAC,CAAC,CAAA;AAAA,EACtF,CAAA;AAEA,EAAA,MAAM,EAAE,qBAAA,EAAuB,cAAA,EAAe,GAAI,oBAAoB,MAAM;AACxE,IAAA,MAAM,UAAA,GAAa,GAAA,CAAI,MAAA,CAAO,aAAA,MAAmB,EAAC;AAClD,IAAA,MAAM,OAAA,GAA0B,UAAA,CAAW,GAAA,CAAkB,CAAC,KAAA,KAAU;AACpE,MAAA,OAAO;AAAA,QACH,OAAO,KAAA,CAAM,EAAA;AAAA,QACb,KAAA;AAAA,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G,CAAC,MAAA,CAAO,OAAO,SAAA,EAAW,cAAA,EAAgB,IAAI,CAAC,CAAA;AAElD,EAAA,uBACI,IAAA,CAAA,QAAA,EAAA,EACI,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,EAAA,EAAG,MAAA,EAAO,OAAA,EACX,iBAAO,KAAA,EACZ,CAAA;AAAA,IACC;AAAA,GAAA,EACL,CAAA;AAER;AAEA,SAAS,iBAAiB,KAAA,EAA4D;AAClF,EAAA,MAAM,EAAE,IAAA,EAAM,OAAA,EAAS,KAAA,EAAM,GAAI,KAAA;AACjC,EAAA,uBACI,GAAA,CAAC,GAAA,EAAA,EAAI,EAAA,EAAI,CAAA,EAAG,SAAA,EAAU,2CAAA,EAClB,QAAA,kBAAA,GAAA,CAAC,OAAA,EAAA,EAAQ,OAAA,EAAS,OAAA,EAAS,YAAA,EAAY,OAAA,EAAS,WAAA,EAAa,EAAE,SAAA,EAAW,OAAA,EAAQ,EAC9E,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EACG,QAAA,kBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,YAAA,EAAY,OAAA,EAAS,KAAA,EAAc,CAAA,EAC7C,CAAA,EACJ,CAAA,EACJ,CAAA;AAER;;;;"}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @open-pioneer/basemap-switcher
|
|
2
2
|
|
|
3
|
+
## 1.2.0-dev.20260121105545
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 279ca67: Use `workspace:*` instead of `workspace:^` for local package references as default. This ensures that trails packages from this repository are always referenced with their exact version to avoid potential issues with version mismatches. If a project specifically wants to use other versions for some trails packages, a pnpm override can be used to force other versions.
|
|
8
|
+
- 9580bb4: Update various dependencies.
|
|
9
|
+
- 9580bb4: Update to Chakra 3.31.0
|
|
10
|
+
- Updated dependencies [279ca67]
|
|
11
|
+
- Updated dependencies [9580bb4]
|
|
12
|
+
- Updated dependencies [9580bb4]
|
|
13
|
+
- @open-pioneer/map@1.2.0-dev.20260121105545
|
|
14
|
+
|
|
3
15
|
## 1.1.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -0,0 +1 @@
|
|
|
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/basemap-switcher",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.0-dev.20260121105545",
|
|
5
5
|
"description": "This package provides a UI component that allows a user to switch between different base maps.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"open-pioneer-trails"
|
|
@@ -14,16 +14,16 @@
|
|
|
14
14
|
"directory": "src/packages/basemap-switcher"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@open-pioneer/react-utils": "
|
|
18
|
-
"@open-pioneer/runtime": "
|
|
19
|
-
"@chakra-ui/react": "^3.
|
|
17
|
+
"@open-pioneer/react-utils": "4.4.0-dev.20260121102820",
|
|
18
|
+
"@open-pioneer/runtime": "4.4.0-dev.20260121102820",
|
|
19
|
+
"@chakra-ui/react": "^3.31.0",
|
|
20
20
|
"ol": "^10.7.0",
|
|
21
|
-
"react": "^19.2.
|
|
21
|
+
"react": "^19.2.3",
|
|
22
22
|
"react-icons": "^5.5.0",
|
|
23
|
-
"@open-pioneer/reactivity": "
|
|
23
|
+
"@open-pioneer/reactivity": "4.4.0-dev.20260121102820",
|
|
24
24
|
"@conterra/reactivity-core": "^0.8.1",
|
|
25
|
-
"@open-pioneer/chakra-snippets": "
|
|
26
|
-
"@open-pioneer/map": "
|
|
25
|
+
"@open-pioneer/chakra-snippets": "4.4.0-dev.20260121102820",
|
|
26
|
+
"@open-pioneer/map": "1.2.0-dev.20260121105545"
|
|
27
27
|
},
|
|
28
28
|
"exports": {
|
|
29
29
|
"./package.json": "./package.json",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_virtual-pioneer-module_react-hooks.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|