@open-pioneer/legend 1.5.0-dev.20260911123645 → 1.5.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 CHANGED
@@ -1,10 +1,11 @@
1
1
  # @open-pioneer/legend
2
2
 
3
- ## 1.5.0-dev.20260911123645
3
+ ## 1.5.0
4
4
 
5
5
  ### Minor Changes
6
6
 
7
7
  - f790fda: Update to Chakra 3.37.0
8
+ - a186f5d: Update core packages to 4.8.0.
8
9
 
9
10
  ### Patch Changes
10
11
 
@@ -57,26 +58,26 @@
57
58
 
58
59
  - 1723382: Introduce `listMode` for layer legend configurations:
59
60
 
60
- ```typescript
61
- //sublayer with legend configuration
62
- const internalLayer = new SimpleLayer({
63
- id: "layer1",
64
- title: "layer 1",
65
- olLayer: myOlLayer,
66
- visible: true,
67
- attributes: {
68
- legend: {
69
- listMode: "show",
70
- } satisfies LegendItemAttributes,
71
- },
72
- sublayers: [
73
- {
74
- name: "sublayer1",
75
- title: "Sub Layer 1",
76
- },
77
- ],
78
- });
79
- ```
61
+ ```typescript
62
+ //sublayer with legend configuration
63
+ const internalLayer = new SimpleLayer({
64
+ id: "layer1",
65
+ title: "layer 1",
66
+ olLayer: myOlLayer,
67
+ visible: true,
68
+ attributes: {
69
+ legend: {
70
+ listMode: "show"
71
+ } satisfies LegendItemAttributes
72
+ },
73
+ sublayers: [
74
+ {
75
+ name: "sublayer1",
76
+ title: "Sub Layer 1"
77
+ }
78
+ ]
79
+ });
80
+ ```
80
81
 
81
82
  - 2702df4: A layer's `internal` property is now respected by the Legend widget. If a layer is marked as internal (`internal` is `true`) no legend entry is displayed for this layer even if the legend is configured in the layer attributes.
82
83
  - 2732052: Icons have been changed to unify the appearance of the components. Preferably, Lucide react-icons are used.
@@ -104,17 +105,17 @@
104
105
  - 193068a: Deprecate the `mapId` property on React components.
105
106
  Use the `MapModel` directly instead to pass a reference to the map.
106
107
 
107
- Example:
108
+ Example:
108
109
 
109
- ```tsx
110
- // Default map for entire component tree
111
- <DefaultMapProvider map={mapModel}>
112
- <Toc />
113
- </DefaultMapProvider>
110
+ ```tsx
111
+ // Default map for entire component tree
112
+ <DefaultMapProvider map={mapModel}>
113
+ <Toc />
114
+ </DefaultMapProvider>
114
115
 
115
- // Map for specific component
116
- <Toc map={mapModel} />
117
- ```
116
+ // Map for specific component
117
+ <Toc map={mapModel} />
118
+ ```
118
119
 
119
120
  ### Patch Changes
120
121
 
@@ -134,9 +135,9 @@
134
135
  ### Minor Changes
135
136
 
136
137
  - 2fa8020: Update trails core package dependencies.
137
- - Also updates Chakra UI to the latest 2.x version and Chakra React Select to version 5.
138
- - Removes any obsolete references to `@chakra-ui/system`.
139
- This dependency seems to be no longer required and may lead to duplicate packages in your dependency tree.
138
+ - Also updates Chakra UI to the latest 2.x version and Chakra React Select to version 5.
139
+ - Removes any obsolete references to `@chakra-ui/system`.
140
+ This dependency seems to be no longer required and may lead to duplicate packages in your dependency tree.
140
141
 
141
142
  ### Patch Changes
142
143
 
@@ -155,7 +156,7 @@
155
156
  - 583f1d6: The `mapId` or `map` properties are now optional on individual components.
156
157
  You can use the `DefaultMapProvider` to configure an implicit default value.
157
158
 
158
- Note that configuring _neither_ a default _nor_ an explicit `map` or `mapId` will trigger a runtime error.
159
+ Note that configuring _neither_ a default _nor_ an explicit `map` or `mapId` will trigger a runtime error.
159
160
 
160
161
  - 583f1d6: All UI components in this project now accept the `mapId` (a `string`) _or_ the `map` (a `MapModel`) directly.
161
162
  - a8b3449: Switch to a new versioning strategy.
package/Legend.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Legend.js","sources":["Legend.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Box, Icon, Image, List, Text } from \"@chakra-ui/react\";\nimport {\n AnyLayer,\n Layer,\n MapModel,\n MapModelProps,\n isLayer,\n useMapModelValue\n} from \"@open-pioneer/map\";\nimport {\n CommonComponentProps,\n useCommonComponentProps,\n classNames\n} from \"@open-pioneer/react-utils\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { ComponentType, FC, ReactNode, useEffect, useMemo, useState } from \"react\";\nimport { LuTriangleAlert } from \"react-icons/lu\";\n\n/**\n * Properties of a legend item React component.\n */\nexport interface LegendItemComponentProps {\n /**\n * Related layer of the legend.\n */\n layer: AnyLayer;\n}\n\n/**\n * Attributes of the legend attribute that can be specified on a layer.\n *\n * To show a legend for the layer, provide an imageUrl to an image to show\n * or provide a React component that will be rendered as a legend.\n *\n * LegendItemAttributes should be registered with a layer as the `\"legend\"` attribute.\n */\nexport interface LegendItemAttributes {\n /**\n * (Optional) URL to an image that will be shown as a legend for the layer.\n */\n imageUrl?: string;\n\n /**\n * (Optional) React component that will be shown as customized legend for the layer.\n */\n Component?: ComponentType<LegendItemComponentProps>;\n\n /**\n * (Optional) Additional property to control the display of the layer in the legend.\n */\n listMode?: ListMode;\n}\n\n/**\n * These are special properties for the Legend.\n */\nexport interface LegendProps extends CommonComponentProps, MapModelProps {\n /**\n * Specifies whether legend for active base layer is shown in the legend UI.\n * Defaults to `false`.\n */\n showBaseLayers?: boolean;\n}\n\n/**\n * ListMode determines if a layer item is displayed in the Legend for the layer.\n * The option `\"hide-children\"` provides a shortcut to hide all child layers (e.g. sublayers of group) of the layer in the Legend.\n * It has the same effect as manually setting the `listMode` to `\"hide\"` on all child layers.\n *\n * ListMode has precedence over the layer's `internal` attribute but specifically configures the layer's display in the legend.\n *\n * By default, the list mode becomes `\"hide-children\"` if a layer has an associated legend.\n */\nexport type ListMode = \"show\" | \"hide\" | \"hide-children\";\n\n/**\n * The `Legend` component can be used to display the legend of layers that are visible in the map.\n */\nexport const Legend: FC<LegendProps> = (props) => {\n const { showBaseLayers = false } = props;\n const { containerProps } = useCommonComponentProps(\"legend\", props);\n const map = useMapModelValue(props);\n\n return (\n <Box {...containerProps}>\n <LegendList map={map} showBaseLayers={showBaseLayers} />\n </Box>\n );\n};\n\nfunction LegendList(props: { map: MapModel; showBaseLayers: boolean }): ReactNode {\n const { map, showBaseLayers } = props;\n\n const layers = useLayers(map);\n const legendListItems: ReactNode[] = layers.map((layer) => {\n return <LegendItem key={layer.id} layer={layer} showBaseLayers={showBaseLayers} />;\n });\n\n return (\n <List.Root\n // Note: not using UnorderedList because it adds default margins\n as=\"ul\"\n className=\"legend-layer-list\"\n listStyleType=\"none\"\n gap={2}\n >\n {legendListItems}\n </List.Root>\n );\n}\n\nfunction LegendItem(props: { layer: AnyLayer; showBaseLayers: boolean }): ReactNode {\n const { layer, showBaseLayers } = props;\n const { isVisible, isInternal } = useReactiveSnapshot(() => {\n return {\n isVisible: layer.visible,\n isInternal: layer.internal\n };\n }, [layer]);\n const childLayers = useChildLayers(layer);\n const listModeProp = useListMode(layer);\n const legendContent = useLegendContent(layer);\n const listMode = getListMode(listModeProp, isInternal, !!legendContent);\n\n if (!isVisible || listMode === \"hide\" || (!showBaseLayers && isBaseLayer(layer))) {\n return;\n }\n\n // legend items for all child layers (sublayers or layers in a group)\n let childItems: ReactNode[] = [];\n if (listMode === \"show\") {\n childItems = childLayers.map((child) => (\n <LegendItem key={child.id} layer={child} showBaseLayers={showBaseLayers} />\n ));\n }\n // listMode: hide/hide-children -> childItems stays empty\n\n return (\n <>\n <LegendContent layer={layer} content={legendContent} />\n {childItems}\n </>\n );\n}\n\nfunction LegendContent(props: { layer: AnyLayer; content: ReactNode }) {\n const intl = useIntl();\n\n const { layer, content } = props;\n const baseLayer = isBaseLayer(layer);\n return content ? (\n <Box as=\"li\" className={classNames(\"legend-item\", `layer-${slug(layer.id)}`)}>\n {baseLayer ? (\n /* Render additional text, if layer is a configured basemap */\n <Text as=\"b\">{intl.formatMessage({ id: \"basemapLabel\" })}</Text>\n ) : null}\n {content}\n </Box>\n ) : undefined;\n}\n\nfunction LegendImage(props: { imageUrl: string; layer: AnyLayer }) {\n const intl = useIntl();\n const { layer, imageUrl } = props;\n const title = useReactiveSnapshot(() => layer.title, [layer]);\n const [isError, setIsError] = useState(false);\n useEffect(() => {\n setIsError(false);\n }, [imageUrl]);\n\n const content = useMemo(() => {\n if (isError) {\n return (\n <Box>\n <Text>\n <Icon me={2}>\n <LuTriangleAlert />\n </Icon>\n {intl.formatMessage({ id: \"fallbackLabel\" })}\n </Text>\n </Box>\n );\n }\n\n return (\n <Image\n maxW=\"none\"\n maxH=\"none\"\n src={imageUrl}\n alt={intl.formatMessage({ id: \"altLabel\" }, { layerName: title })}\n className={\"legend-item__image\"}\n onError={() => setIsError(true)}\n />\n );\n }, [intl, title, imageUrl, isError]);\n\n return (\n <Box>\n <Text>{title}</Text>\n {content}\n </Box>\n );\n}\n\n/**\n * Resolves the content that would be rendered for the given layer.\n */\nfunction useLegendContent(layer: AnyLayer): ReactNode | undefined {\n const legendAttributes = useLegendAttributes(layer);\n const legendUrl = useReactiveSnapshot(() => layer.legend, [layer]);\n return useMemo(() => {\n let renderedComponent: ReactNode | undefined;\n if (legendAttributes?.Component) {\n renderedComponent = <legendAttributes.Component layer={layer} />;\n } else if (legendAttributes?.imageUrl) {\n renderedComponent = <LegendImage layer={layer} imageUrl={legendAttributes.imageUrl} />;\n } else {\n if (legendUrl) {\n renderedComponent = <LegendImage layer={layer} imageUrl={legendUrl} />;\n }\n }\n return renderedComponent;\n }, [legendUrl, legendAttributes, layer]);\n}\n\n/** Returns the top level operational layers in render order (topmost layer first). */\nfunction useLayers(map: MapModel): Layer[] {\n return useReactiveSnapshot(() => {\n const layers =\n map.layers.getLayers({\n sortByDisplayOrder: true,\n includeInternalLayers: true //internal status is handled by LegendItems\n }) ?? [];\n layers.reverse(); // render topmost layer first\n return layers;\n }, [map]);\n}\n\n/**\n * Returns the child layers (sublayers or layers belonging to a GroupLayer) of the given layer.\n * Layers are returned in render order (topmost layer first).\n */\nfunction useChildLayers(layer: AnyLayer): AnyLayer[] {\n return (\n useReactiveSnapshot(() => {\n const childLayers = layer.children?.getItems({\n includeInternalLayers: true //internal status is handled by LegendItems\n });\n if (!childLayers) {\n return undefined;\n }\n\n childLayers.reverse(); // render topmost layer first\n return childLayers;\n }, [layer]) ?? []\n );\n}\n\nfunction useLegendAttributes(layer: AnyLayer): LegendItemAttributes | undefined {\n return useReactiveSnapshot(\n () => layer.attributes.legend as LegendItemAttributes | undefined,\n [layer]\n );\n}\n\nfunction getListMode(\n listModeProp: ListMode | undefined,\n isInternal: boolean,\n hasLegendContent: boolean\n): ListMode {\n if (listModeProp) {\n return listModeProp; // Explicit value wins\n }\n if (isInternal) {\n return \"hide\";\n }\n if (hasLegendContent) {\n return \"hide-children\";\n }\n return \"show\";\n}\n\nfunction isBaseLayer(layer: AnyLayer) {\n return isLayer(layer) && layer.isBaseLayer;\n}\n\nfunction slug(id: string) {\n return id\n .toLowerCase()\n .replace(/[^a-z0-9 -]/g, \"\")\n .replace(/\\s+/g, \"-\")\n .replace(/-+/g, \"-\");\n}\n\nfunction useListMode(layer: AnyLayer): ListMode | undefined {\n return useReactiveSnapshot(\n () => (layer.attributes.legend as LegendItemAttributes | undefined)?.listMode,\n [layer]\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AAkFO,MAAM,MAAA,GAA0B,CAAC,KAAA,KAAU;AAC9C,EAAA,MAAM,EAAE,cAAA,GAAiB,KAAA,EAAM,GAAI,KAAA;AACnC,EAAA,MAAM,EAAE,cAAA,EAAe,GAAI,uBAAA,CAAwB,UAAU,KAAK,CAAA;AAClE,EAAA,MAAM,GAAA,GAAM,iBAAiB,KAAK,CAAA;AAElC,EAAA,uBACI,GAAA,CAAC,OAAK,GAAG,cAAA,EACL,8BAAC,UAAA,EAAA,EAAW,GAAA,EAAU,gBAAgC,CAAA,EAC1D,CAAA;AAER;AAEA,SAAS,WAAW,KAAA,EAA8D;AAC9E,EAAA,MAAM,EAAE,GAAA,EAAK,cAAA,EAAe,GAAI,KAAA;AAEhC,EAAA,M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,OAAO,MAAA;AAAA,IACX;AAEA,IAAA,WAAA,CAAY,OAAA,EAAQ;AACpB,IAAA,OAAO,WAAA;AAAA,EACX,CAAA,EAAG,CAAC,KAAK,CAAC,KAAK,EAAC;AAExB;AAEA,SAAS,oBAAoB,KAAA,EAAmD;AAC5E,EAAA,OAAO,mBAAA;AAAA,IACH,MAAM,MAAM,UAAA,CAAW,MAAA;AAAA,IACvB,CAAC,KAAK;AAAA,GACV;AACJ;AAEA,SAAS,WAAA,CACL,YAAA,EACA,UAAA,EACA,gBAAA,EACQ;AACR,EAAA,IAAI,YAAA,EAAc;AACd,IAAA,OAAO,YAAA;AAAA,EACX;AACA,EAAA,IAAI,UAAA,EAAY;AACZ,IAAA,OAAO,MAAA;AAAA,EACX;AACA,EAAA,IAAI,gBAAA,EAAkB;AAClB,IAAA,OAAO,eAAA;AAAA,EACX;AACA,EAAA,OAAO,MAAA;AACX;AAEA,SAAS,YAAY,KAAA,EAAiB;AAClC,EAAA,OAAO,OAAA,CAAQ,KAAK,CAAA,IAAK,KAAA,CAAM,WAAA;AACnC;AAEA,SAAS,KAAK,EAAA,EAAY;AACtB,EAAA,OAAO,EAAA,CACF,WAAA,EAAY,CACZ,OAAA,CAAQ,cAAA,EAAgB,EAAE,CAAA,CAC1B,OAAA,CAAQ,MAAA,EAAQ,GAAG,CAAA,CACnB,OAAA,CAAQ,OAAO,GAAG,CAAA;AAC3B;AAEA,SAAS,YAAY,KAAA,EAAuC;AACxD,EAAA,OAAO,mBAAA;AAAA,IACH,MAAO,KAAA,CAAM,UAAA,CAAW,MAAA,EAA6C,QAAA;AAAA,IACrE,CAAC,KAAK;AAAA,GACV;AACJ;;;;"}
1
+ {"version":3,"file":"Legend.js","sources":["Legend.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Box, Icon, Image, List, Text } from \"@chakra-ui/react\";\nimport {\n AnyLayer,\n Layer,\n MapModel,\n MapModelProps,\n isLayer,\n useMapModelValue\n} from \"@open-pioneer/map\";\nimport {\n CommonComponentProps,\n useCommonComponentProps,\n classNames\n} from \"@open-pioneer/react-utils\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { ComponentType, FC, ReactNode, useEffect, useMemo, useState } from \"react\";\nimport { LuTriangleAlert } from \"react-icons/lu\";\n\n/**\n * Properties of a legend item React component.\n */\nexport interface LegendItemComponentProps {\n /**\n * Related layer of the legend.\n */\n layer: AnyLayer;\n}\n\n/**\n * Attributes of the legend attribute that can be specified on a layer.\n *\n * To show a legend for the layer, provide an imageUrl to an image to show\n * or provide a React component that will be rendered as a legend.\n *\n * LegendItemAttributes should be registered with a layer as the `\"legend\"` attribute.\n */\nexport interface LegendItemAttributes {\n /**\n * (Optional) URL to an image that will be shown as a legend for the layer.\n */\n imageUrl?: string;\n\n /**\n * (Optional) React component that will be shown as customized legend for the layer.\n */\n Component?: ComponentType<LegendItemComponentProps>;\n\n /**\n * (Optional) Additional property to control the display of the layer in the legend.\n */\n listMode?: ListMode;\n}\n\n/**\n * These are special properties for the Legend.\n */\nexport interface LegendProps extends CommonComponentProps, MapModelProps {\n /**\n * Specifies whether legend for active base layer is shown in the legend UI.\n * Defaults to `false`.\n */\n showBaseLayers?: boolean;\n}\n\n/**\n * ListMode determines if a layer item is displayed in the Legend for the layer.\n * The option `\"hide-children\"` provides a shortcut to hide all child layers (e.g. sublayers of group) of the layer in the Legend.\n * It has the same effect as manually setting the `listMode` to `\"hide\"` on all child layers.\n *\n * ListMode has precedence over the layer's `internal` attribute but specifically configures the layer's display in the legend.\n *\n * By default, the list mode becomes `\"hide-children\"` if a layer has an associated legend.\n */\nexport type ListMode = \"show\" | \"hide\" | \"hide-children\";\n\n/**\n * The `Legend` component can be used to display the legend of layers that are visible in the map.\n */\nexport const Legend: FC<LegendProps> = (props) => {\n const { showBaseLayers = false } = props;\n const { containerProps } = useCommonComponentProps(\"legend\", props);\n const map = useMapModelValue(props);\n\n return (\n <Box {...containerProps}>\n <LegendList map={map} showBaseLayers={showBaseLayers} />\n </Box>\n );\n};\n\nfunction LegendList(props: { map: MapModel; showBaseLayers: boolean }): ReactNode {\n const { map, showBaseLayers } = props;\n\n const layers = useLayers(map);\n const legendListItems: ReactNode[] = layers.map((layer) => {\n return <LegendItem key={layer.id} layer={layer} showBaseLayers={showBaseLayers} />;\n });\n\n return (\n <List.Root\n // Note: not using UnorderedList because it adds default margins\n as=\"ul\"\n className=\"legend-layer-list\"\n listStyleType=\"none\"\n gap={2}\n >\n {legendListItems}\n </List.Root>\n );\n}\n\nfunction LegendItem(props: { layer: AnyLayer; showBaseLayers: boolean }): ReactNode {\n const { layer, showBaseLayers } = props;\n const { isVisible, isInternal } = useReactiveSnapshot(() => {\n return {\n isVisible: layer.visible,\n isInternal: layer.internal\n };\n }, [layer]);\n const childLayers = useChildLayers(layer);\n const listModeProp = useListMode(layer);\n const legendContent = useLegendContent(layer);\n const listMode = getListMode(listModeProp, isInternal, !!legendContent);\n\n if (!isVisible || listMode === \"hide\" || (!showBaseLayers && isBaseLayer(layer))) {\n return;\n }\n\n // legend items for all child layers (sublayers or layers in a group)\n let childItems: ReactNode[] = [];\n if (listMode === \"show\") {\n childItems = childLayers.map((child) => (\n <LegendItem key={child.id} layer={child} showBaseLayers={showBaseLayers} />\n ));\n }\n // listMode: hide/hide-children -> childItems stays empty\n\n return (\n <>\n <LegendContent layer={layer} content={legendContent} />\n {childItems}\n </>\n );\n}\n\nfunction LegendContent(props: { layer: AnyLayer; content: ReactNode }) {\n const intl = useIntl();\n\n const { layer, content } = props;\n const baseLayer = isBaseLayer(layer);\n return content ? (\n <Box as=\"li\" className={classNames(\"legend-item\", `layer-${slug(layer.id)}`)}>\n {baseLayer ? (\n /* Render additional text, if layer is a configured basemap */\n <Text as=\"b\">{intl.formatMessage({ id: \"basemapLabel\" })}</Text>\n ) : null}\n {content}\n </Box>\n ) : undefined;\n}\n\nfunction LegendImage(props: { imageUrl: string; layer: AnyLayer }) {\n const intl = useIntl();\n const { layer, imageUrl } = props;\n const title = useReactiveSnapshot(() => layer.title, [layer]);\n const [isError, setIsError] = useState(false);\n useEffect(() => {\n setIsError(false);\n }, [imageUrl]);\n\n const content = useMemo(() => {\n if (isError) {\n return (\n <Box>\n <Text>\n <Icon me={2}>\n <LuTriangleAlert />\n </Icon>\n {intl.formatMessage({ id: \"fallbackLabel\" })}\n </Text>\n </Box>\n );\n }\n\n return (\n <Image\n maxW=\"none\"\n maxH=\"none\"\n src={imageUrl}\n alt={intl.formatMessage({ id: \"altLabel\" }, { layerName: title })}\n className={\"legend-item__image\"}\n onError={() => setIsError(true)}\n />\n );\n }, [intl, title, imageUrl, isError]);\n\n return (\n <Box>\n <Text>{title}</Text>\n {content}\n </Box>\n );\n}\n\n/**\n * Resolves the content that would be rendered for the given layer.\n */\nfunction useLegendContent(layer: AnyLayer): ReactNode | undefined {\n const legendAttributes = useLegendAttributes(layer);\n const legendUrl = useReactiveSnapshot(() => layer.legend, [layer]);\n return useMemo(() => {\n let renderedComponent: ReactNode | undefined;\n if (legendAttributes?.Component) {\n renderedComponent = <legendAttributes.Component layer={layer} />;\n } else if (legendAttributes?.imageUrl) {\n renderedComponent = <LegendImage layer={layer} imageUrl={legendAttributes.imageUrl} />;\n } else {\n if (legendUrl) {\n renderedComponent = <LegendImage layer={layer} imageUrl={legendUrl} />;\n }\n }\n return renderedComponent;\n }, [legendUrl, legendAttributes, layer]);\n}\n\n/** Returns the top level operational layers in render order (topmost layer first). */\nfunction useLayers(map: MapModel): Layer[] {\n return useReactiveSnapshot(() => {\n const layers =\n map.layers.getLayers({\n sortByDisplayOrder: true,\n includeInternalLayers: true //internal status is handled by LegendItems\n }) ?? [];\n layers.reverse(); // render topmost layer first\n return layers;\n }, [map]);\n}\n\n/**\n * Returns the child layers (sublayers or layers belonging to a GroupLayer) of the given layer.\n * Layers are returned in render order (topmost layer first).\n */\nfunction useChildLayers(layer: AnyLayer): AnyLayer[] {\n return (\n useReactiveSnapshot(() => {\n const childLayers = layer.children?.getItems({\n includeInternalLayers: true //internal status is handled by LegendItems\n });\n if (!childLayers) {\n return undefined;\n }\n\n childLayers.reverse(); // render topmost layer first\n return childLayers;\n }, [layer]) ?? []\n );\n}\n\nfunction useLegendAttributes(layer: AnyLayer): LegendItemAttributes | undefined {\n return useReactiveSnapshot(\n () => layer.attributes.legend as LegendItemAttributes | undefined,\n [layer]\n );\n}\n\nfunction getListMode(\n listModeProp: ListMode | undefined,\n isInternal: boolean,\n hasLegendContent: boolean\n): ListMode {\n if (listModeProp) {\n return listModeProp; // Explicit value wins\n }\n if (isInternal) {\n return \"hide\";\n }\n if (hasLegendContent) {\n return \"hide-children\";\n }\n return \"show\";\n}\n\nfunction isBaseLayer(layer: AnyLayer) {\n return isLayer(layer) && layer.isBaseLayer;\n}\n\nfunction slug(id: string) {\n return id\n .toLowerCase()\n .replace(/[^a-z0-9 -]/g, \"\")\n .replace(/\\s+/g, \"-\")\n .replace(/-+/g, \"-\");\n}\n\nfunction useListMode(layer: AnyLayer): ListMode | undefined {\n return useReactiveSnapshot(\n () => (layer.attributes.legend as LegendItemAttributes | undefined)?.listMode,\n [layer]\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AAkFO,MAAM,MAAA,GAA0B,CAAC,KAAA,KAAU;AAC9C,EAAA,MAAM,EAAE,cAAA,GAAiB,KAAA,EAAM,GAAI,KAAA;AACnC,EAAA,MAAM,EAAE,cAAA,EAAe,GAAI,uBAAA,CAAwB,UAAU,KAAK,CAAA;AAClE,EAAA,MAAM,GAAA,GAAM,iBAAiB,KAAK,CAAA;AAElC,EAAA,uBACI,GAAA,CAAC,OAAK,GAAG,cAAA,EACL,8BAAC,UAAA,EAAA,EAAW,GAAA,EAAU,gBAAgC,CAAA,EAC1D,CAAA;AAER;AAEA,SAAS,WAAW,KAAA,EAA8D;AAC9E,EAAA,MAAM,EAAE,GAAA,E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ACD,IAAA,IAAI,CAAC,WAAA,EAAa;AACd,MAAA,OAAO,MAAA;AAAA,IACX;AAEA,IAAA,WAAA,CAAY,OAAA,EAAQ;AACpB,IAAA,OAAO,WAAA;AAAA,EACX,CAAA,EAAG,CAAC,KAAK,CAAC,KAAK,EAAC;AAExB;AAEA,SAAS,oBAAoB,KAAA,EAAmD;AAC5E,EAAA,OAAO,mBAAA;AAAA,IACH,MAAM,MAAM,UAAA,CAAW,MAAA;AAAA,IACvB,CAAC,KAAK;AAAA,GACV;AACJ;AAEA,SAAS,WAAA,CACL,YAAA,EACA,UAAA,EACA,gBAAA,EACQ;AACR,EAAA,IAAI,YAAA,EAAc;AACd,IAAA,OAAO,YAAA;AAAA,EACX;AACA,EAAA,IAAI,UAAA,EAAY;AACZ,IAAA,OAAO,MAAA;AAAA,EACX;AACA,EAAA,IAAI,gBAAA,EAAkB;AAClB,IAAA,OAAO,eAAA;AAAA,EACX;AACA,EAAA,OAAO,MAAA;AACX;AAEA,SAAS,YAAY,KAAA,EAAiB;AAClC,EAAA,OAAO,OAAA,CAAQ,KAAK,CAAA,IAAK,KAAA,CAAM,WAAA;AACnC;AAEA,SAAS,KAAK,EAAA,EAAY;AACtB,EAAA,OAAO,EAAA,CACF,WAAA,EAAY,CACZ,OAAA,CAAQ,cAAA,EAAgB,EAAE,CAAA,CAC1B,OAAA,CAAQ,MAAA,EAAQ,GAAG,CAAA,CACnB,OAAA,CAAQ,OAAO,GAAG,CAAA;AAC3B;AAEA,SAAS,YAAY,KAAA,EAAuC;AACxD,EAAA,OAAO,mBAAA;AAAA,IACH,MAAO,KAAA,CAAM,UAAA,CAAW,MAAA,EAA6C,QAAA;AAAA,IACrE,CAAC,KAAK;AAAA,GACV;AACJ;;"}
package/README.md CHANGED
@@ -34,12 +34,11 @@ import { CustomLegend } from "./CustomLegend"; // import react component to show
34
34
  async getMapConfig({ layerFactory }): Promise<MapConfig> {
35
35
  return {
36
36
  // ...
37
- layers: [
37
+ baseLayers: [
38
38
  layerFactory.create({
39
39
  type: SimpleLayer,
40
40
  id: "topplus_open",
41
41
  title: "TopPlus Open",
42
- isBaseLayer: true,
43
42
  visible: true,
44
43
  olLayer: createTopPlusOpenLayer("web"),
45
44
  attributes: {
@@ -49,6 +48,8 @@ async getMapConfig({ layerFactory }): Promise<MapConfig> {
49
48
  }
50
49
  }
51
50
  }),
51
+ ]
52
+ layers: [
52
53
  layerFactory.create({
53
54
  type: SimpleLayer,
54
55
  title: "Kindertagesstätten",
@@ -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/legend",
4
- "version": "1.5.0-dev.20260911123645",
4
+ "version": "1.5.0",
5
5
  "description": "This package provides a legend UI component that allows a user to see legend information for layers in the map.",
6
6
  "keywords": [
7
7
  "open-pioneer-trails"
@@ -15,12 +15,12 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@chakra-ui/react": "^3.37.0",
18
- "@open-pioneer/map": "1.5.0-dev.20260911123645",
19
- "@open-pioneer/react-utils": "4.8.0-dev.20260910101405",
20
- "@open-pioneer/reactivity": "4.8.0-dev.20260910101405",
21
- "@open-pioneer/runtime": "4.8.0-dev.20260910101405",
18
+ "@open-pioneer/map": "1.5.0",
19
+ "@open-pioneer/react-utils": "^4.8.0",
20
+ "@open-pioneer/reactivity": "^4.8.0",
21
+ "@open-pioneer/runtime": "^4.8.0",
22
22
  "ol": "^10.10.0",
23
- "react": "^19.2.8",
23
+ "react": "^19.3.0",
24
24
  "react-icons": "^5.7.0"
25
25
  },
26
26
  "publishConfig": {