@open-pioneer/toc 0.9.0-dev.20250220091855 → 0.9.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,13 +1,16 @@
1
1
  # @open-pioneer/toc
2
2
 
3
- ## 0.9.0-dev.20250220091855
3
+ ## 0.9.0
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - bd82a78: Adds the optional functionality to collapse and expand groups in the TOC.
8
- This option can be activated with the `collapsibleGroups` property (default is `false`).
9
- If the property `initiallyCollapsed` is `true` all groups are collapsed by default when the TOC is rendered. This is helpful if the app has a large layer tree.
10
- Additionally, a menu item to collapse all groups can be added to the Tools section by setting `toolsConfig.showCollapseAllGroups` to `true` (default is `true`).
7
+ - cb94c75: update dependencies
8
+ - bd82a78: Adds the optional functionality to collapse and expand groups in the TOC.
9
+ This option can be activated with the `collapsibleGroups` property (default is `false`).
10
+ If the property `initiallyCollapsed` is `true` all groups are collapsed by default when the TOC is rendered.
11
+ This is helpful if the app has a large layer tree.
12
+
13
+ Additionally, a menu item to collapse all groups can be added to the tools section by setting `toolsConfig.showCollapseAllGroups` to `true` (default is `true`).
11
14
  This is only applicable if `collapsibleGroups` and `showTools` are both `true`.
12
15
 
13
16
  ```jsx
@@ -24,23 +27,28 @@
24
27
 
25
28
  ### Patch Changes
26
29
 
27
- - Updated dependencies [f327eec]
28
- - Updated dependencies [f327eec]
29
- - Updated dependencies [209eb8e]
30
- - @open-pioneer/map@0.9.0-dev.20250220091855
31
- - @open-pioneer/basemap-switcher@0.9.0-dev.20250220091855
30
+ - Updated dependencies [e7fdc5d]
31
+ - Updated dependencies [cb94c75]
32
+ - Updated dependencies [37cd707]
33
+ - Updated dependencies [32ed2cd]
34
+ - Updated dependencies [f327eec]
35
+ - Updated dependencies [f327eec]
36
+ - Updated dependencies [209eb8e]
37
+ - Updated dependencies [d72e42c]
38
+ - @open-pioneer/map@0.9.0
39
+ - @open-pioneer/basemap-switcher@0.9.0
32
40
 
33
41
  ## 0.8.0
34
42
 
35
43
  ### Minor Changes
36
44
 
37
- - 2fa8020: Update trails core package dependencies.
45
+ - 2fa8020: Update trails core package dependencies.
38
46
 
39
- - Also updates Chakra UI to the latest 2.x version and Chakra React Select to version 5.
40
- - Removes any obsolete references to `@chakra-ui/system`.
41
- This dependency seems to be no longer required and may lead to duplicate packages in your dependency tree.
47
+ - Also updates Chakra UI to the latest 2.x version and Chakra React Select to version 5.
48
+ - Removes any obsolete references to `@chakra-ui/system`.
49
+ This dependency seems to be no longer required and may lead to duplicate packages in your dependency tree.
42
50
 
43
- - 7ae9f90: When showing a layer via the toc, all parent layers of that layer will also be made visible.
51
+ - 7ae9f90: When showing a layer via the toc, all parent layers of that layer will also be made visible.
44
52
 
45
53
  This can be disabled by configuring `autoShowParents={false}` on the `TOC` component.
46
54
 
@@ -51,191 +59,191 @@
51
59
 
52
60
  ### Patch Changes
53
61
 
54
- - e7978a8: Use reactive map model APIs to access the current set of layers and their attributes.
55
- - 49f0207: Update trails core packages to version 2.4.0
56
- - 7ae9f90: Implement support for `GroupLayer`.
57
- The hierarchy of (possibly nested) groups is visualized by rendering them as a tree.
58
- - Updated dependencies [b717121]
59
- - Updated dependencies [e7978a8]
60
- - Updated dependencies [7a5f1e1]
61
- - Updated dependencies [7ae9f90]
62
- - Updated dependencies [e7978a8]
63
- - Updated dependencies [d8337a6]
64
- - Updated dependencies [49f0207]
65
- - Updated dependencies [b2127df]
66
- - Updated dependencies [2fa8020]
67
- - Updated dependencies [7ae9f90]
68
- - Updated dependencies [d8337a6]
69
- - @open-pioneer/map@0.8.0
70
- - @open-pioneer/basemap-switcher@0.8.0
62
+ - e7978a8: Use reactive map model APIs to access the current set of layers and their attributes.
63
+ - 49f0207: Update trails core packages to version 2.4.0
64
+ - 7ae9f90: Implement support for `GroupLayer`.
65
+ The hierarchy of (possibly nested) groups is visualized by rendering them as a tree.
66
+ - Updated dependencies [b717121]
67
+ - Updated dependencies [e7978a8]
68
+ - Updated dependencies [7a5f1e1]
69
+ - Updated dependencies [7ae9f90]
70
+ - Updated dependencies [e7978a8]
71
+ - Updated dependencies [d8337a6]
72
+ - Updated dependencies [49f0207]
73
+ - Updated dependencies [b2127df]
74
+ - Updated dependencies [2fa8020]
75
+ - Updated dependencies [7ae9f90]
76
+ - Updated dependencies [d8337a6]
77
+ - @open-pioneer/map@0.8.0
78
+ - @open-pioneer/basemap-switcher@0.8.0
71
79
 
72
80
  ## 0.7.0
73
81
 
74
82
  ### Minor Changes
75
83
 
76
- - 310800c: Switch from `peerDependencies` to normal `dependencies`. Peer dependencies have some usability problems when used at scale.
84
+ - 310800c: Switch from `peerDependencies` to normal `dependencies`. Peer dependencies have some usability problems when used at scale.
77
85
 
78
86
  ### Patch Changes
79
87
 
80
- - 310800c: Update core packages version.
81
- - 583f1d6: The `mapId` or `map` properties are now optional on individual components.
82
- You can use the `DefaultMapProvider` to configure an implicit default value.
88
+ - 310800c: Update core packages version.
89
+ - 583f1d6: The `mapId` or `map` properties are now optional on individual components.
90
+ You can use the `DefaultMapProvider` to configure an implicit default value.
83
91
 
84
92
  Note that configuring _neither_ a default _nor_ an explicit `map` or `mapId` will trigger a runtime error.
85
93
 
86
- - 583f1d6: All UI components in this project now accept the `mapId` (a `string`) _or_ the `map` (a `MapModel`) directly.
87
- - a8b3449: Switch to a new versioning strategy.
88
- From now on, packages released by this repository share a common version number.
89
- - 2502050: Use new union types for layers.
90
- - 900eb11: Update dependencies.
91
- - Updated dependencies [310800c]
92
- - Updated dependencies [2502050]
93
- - Updated dependencies [583f1d6]
94
- - Updated dependencies [583f1d6]
95
- - Updated dependencies [397d617]
96
- - Updated dependencies [a8b3449]
97
- - Updated dependencies [310800c]
98
- - Updated dependencies [900eb11]
99
- - Updated dependencies [583f1d6]
100
- - Updated dependencies [397d617]
101
- - @open-pioneer/basemap-switcher@0.7.0
102
- - @open-pioneer/map@0.7.0
94
+ - 583f1d6: All UI components in this project now accept the `mapId` (a `string`) _or_ the `map` (a `MapModel`) directly.
95
+ - a8b3449: Switch to a new versioning strategy.
96
+ From now on, packages released by this repository share a common version number.
97
+ - 2502050: Use new union types for layers.
98
+ - 900eb11: Update dependencies.
99
+ - Updated dependencies [310800c]
100
+ - Updated dependencies [2502050]
101
+ - Updated dependencies [583f1d6]
102
+ - Updated dependencies [583f1d6]
103
+ - Updated dependencies [397d617]
104
+ - Updated dependencies [a8b3449]
105
+ - Updated dependencies [310800c]
106
+ - Updated dependencies [900eb11]
107
+ - Updated dependencies [583f1d6]
108
+ - Updated dependencies [397d617]
109
+ - @open-pioneer/basemap-switcher@0.7.0
110
+ - @open-pioneer/map@0.7.0
103
111
 
104
112
  ## 0.4.4
105
113
 
106
114
  ### Patch Changes
107
115
 
108
- - b152428: Update trails dependencies
109
- - Updated dependencies [291ccb6]
110
- - Updated dependencies [b152428]
111
- - Updated dependencies [291ccb6]
112
- - @open-pioneer/basemap-switcher@0.4.4
113
- - @open-pioneer/map@0.6.1
116
+ - b152428: Update trails dependencies
117
+ - Updated dependencies [291ccb6]
118
+ - Updated dependencies [b152428]
119
+ - Updated dependencies [291ccb6]
120
+ - @open-pioneer/basemap-switcher@0.4.4
121
+ - @open-pioneer/map@0.6.1
114
122
 
115
123
  ## 0.4.3
116
124
 
117
125
  ### Patch Changes
118
126
 
119
- - 0b48e97: improve aria labels and roles for hierachical layer groups in toc (fixes issue [#321](https://github.com/open-pioneer/trails-openlayers-base-packages/issues/321))
120
- - 28e092a: Update dependencies
121
- - Updated dependencies [28e092a]
122
- - Updated dependencies [0d51d2f]
123
- - Updated dependencies [65a14f4]
124
- - Updated dependencies [76f8863]
125
- - @open-pioneer/basemap-switcher@0.4.3
126
- - @open-pioneer/map@0.6.0
127
+ - 0b48e97: improve aria labels and roles for hierachical layer groups in toc (fixes issue [#321](https://github.com/open-pioneer/trails-openlayers-base-packages/issues/321))
128
+ - 28e092a: Update dependencies
129
+ - Updated dependencies [28e092a]
130
+ - Updated dependencies [0d51d2f]
131
+ - Updated dependencies [65a14f4]
132
+ - Updated dependencies [76f8863]
133
+ - @open-pioneer/basemap-switcher@0.4.3
134
+ - @open-pioneer/map@0.6.0
127
135
 
128
136
  ## 0.4.2
129
137
 
130
138
  ### Patch Changes
131
139
 
132
- - 4140646: Update trails dependencies
133
- - 4140646: Update to react 18.3.1
134
- - 81bc7da: Update trails dependencies
135
- - 2c092dc: Update dependencies
136
- - Updated dependencies [4140646]
137
- - Updated dependencies [4140646]
138
- - Updated dependencies [b5bb7a1]
139
- - Updated dependencies [81bc7da]
140
- - Updated dependencies [2c092dc]
141
- - Updated dependencies [4140646]
142
- - @open-pioneer/basemap-switcher@0.4.2
143
- - @open-pioneer/react-utils@0.2.3
144
- - @open-pioneer/map@0.5.1
140
+ - 4140646: Update trails dependencies
141
+ - 4140646: Update to react 18.3.1
142
+ - 81bc7da: Update trails dependencies
143
+ - 2c092dc: Update dependencies
144
+ - Updated dependencies [4140646]
145
+ - Updated dependencies [4140646]
146
+ - Updated dependencies [b5bb7a1]
147
+ - Updated dependencies [81bc7da]
148
+ - Updated dependencies [2c092dc]
149
+ - Updated dependencies [4140646]
150
+ - @open-pioneer/basemap-switcher@0.4.2
151
+ - @open-pioneer/react-utils@0.2.3
152
+ - @open-pioneer/map@0.5.1
145
153
 
146
154
  ## 0.4.1
147
155
 
148
156
  ### Patch Changes
149
157
 
150
- - Updated dependencies [520a97b]
151
- - @open-pioneer/map@0.5.0
152
- - @open-pioneer/basemap-switcher@0.4.1
158
+ - Updated dependencies [520a97b]
159
+ - @open-pioneer/map@0.5.0
160
+ - @open-pioneer/basemap-switcher@0.4.1
153
161
 
154
162
  ## 0.4.0
155
163
 
156
164
  ### Minor Changes
157
165
 
158
- - 9334e81: Update to OpenLayers 9
166
+ - 9334e81: Update to OpenLayers 9
159
167
 
160
168
  ### Patch Changes
161
169
 
162
- - ca6c2fd: Don't remove uppercase characters in slugs
163
- - 1a8ad89: Update package.json metadata
164
- - 6162979: Update versions of core packages
165
- - Updated dependencies [1a8ad89]
166
- - Updated dependencies [a11bf72]
167
- - Updated dependencies [fc6bf82]
168
- - Updated dependencies [a0d8882]
169
- - Updated dependencies [6162979]
170
- - Updated dependencies [9334e81]
171
- - Updated dependencies [ac7fdd1]
172
- - Updated dependencies [13ea342]
173
- - @open-pioneer/basemap-switcher@0.4.0
174
- - @open-pioneer/react-utils@0.2.2
175
- - @open-pioneer/map@0.4.0
170
+ - ca6c2fd: Don't remove uppercase characters in slugs
171
+ - 1a8ad89: Update package.json metadata
172
+ - 6162979: Update versions of core packages
173
+ - Updated dependencies [1a8ad89]
174
+ - Updated dependencies [a11bf72]
175
+ - Updated dependencies [fc6bf82]
176
+ - Updated dependencies [a0d8882]
177
+ - Updated dependencies [6162979]
178
+ - Updated dependencies [9334e81]
179
+ - Updated dependencies [ac7fdd1]
180
+ - Updated dependencies [13ea342]
181
+ - @open-pioneer/basemap-switcher@0.4.0
182
+ - @open-pioneer/react-utils@0.2.2
183
+ - @open-pioneer/map@0.4.0
176
184
 
177
185
  ## 0.3.1
178
186
 
179
187
  ### Patch Changes
180
188
 
181
- - Updated dependencies [611ddb9]
182
- - @open-pioneer/map@0.3.1
183
- - @open-pioneer/basemap-switcher@0.3.1
189
+ - Updated dependencies [611ddb9]
190
+ - @open-pioneer/map@0.3.1
191
+ - @open-pioneer/basemap-switcher@0.3.1
184
192
 
185
193
  ## 0.3.0
186
194
 
187
195
  ### Minor Changes
188
196
 
189
- - ee7c2d4: Update runtime version.
197
+ - ee7c2d4: Update runtime version.
190
198
 
191
199
  ### Patch Changes
192
200
 
193
- - 0883bbd: Add property `menuPosition` to React Select.
194
- - Updated dependencies [6984d20]
195
- - Updated dependencies [0883bbd]
196
- - Updated dependencies [ee7c2d4]
197
- - Updated dependencies [a582e5e]
198
- - Updated dependencies [0456500]
199
- - Updated dependencies [762e7b9]
200
- - @open-pioneer/basemap-switcher@0.3.0
201
- - @open-pioneer/map@0.3.0
202
- - @open-pioneer/react-utils@0.2.1
201
+ - 0883bbd: Add property `menuPosition` to React Select.
202
+ - Updated dependencies [6984d20]
203
+ - Updated dependencies [0883bbd]
204
+ - Updated dependencies [ee7c2d4]
205
+ - Updated dependencies [a582e5e]
206
+ - Updated dependencies [0456500]
207
+ - Updated dependencies [762e7b9]
208
+ - @open-pioneer/basemap-switcher@0.3.0
209
+ - @open-pioneer/map@0.3.0
210
+ - @open-pioneer/react-utils@0.2.1
203
211
 
204
212
  ## 0.2.0
205
213
 
206
214
  ### Minor Changes
207
215
 
208
- - 70349a8: Update to new core packages major versions
216
+ - 70349a8: Update to new core packages major versions
209
217
 
210
218
  ### Patch Changes
211
219
 
212
- - Updated dependencies [70349a8]
213
- - @open-pioneer/basemap-switcher@0.2.0
214
- - @open-pioneer/map@0.2.0
215
- - @open-pioneer/react-utils@0.2.0
220
+ - Updated dependencies [70349a8]
221
+ - @open-pioneer/basemap-switcher@0.2.0
222
+ - @open-pioneer/map@0.2.0
223
+ - @open-pioneer/react-utils@0.2.0
216
224
 
217
225
  ## 0.1.1
218
226
 
219
227
  ### Patch Changes
220
228
 
221
- - Updated dependencies [08bffbc]
222
- - Updated dependencies [a58546b]
223
- - Updated dependencies [a58546b]
224
- - Updated dependencies [0c4ce04]
225
- - @open-pioneer/map@0.1.1
226
- - @open-pioneer/basemap-switcher@0.1.1
229
+ - Updated dependencies [08bffbc]
230
+ - Updated dependencies [a58546b]
231
+ - Updated dependencies [a58546b]
232
+ - Updated dependencies [0c4ce04]
233
+ - @open-pioneer/map@0.1.1
234
+ - @open-pioneer/basemap-switcher@0.1.1
227
235
 
228
236
  ## 0.1.0
229
237
 
230
238
  ### Minor Changes
231
239
 
232
- - cafb66b: Initial release.
240
+ - cafb66b: Initial release.
233
241
 
234
242
  ### Patch Changes
235
243
 
236
- - Updated dependencies [bb2f27a]
237
- - Updated dependencies [1e7545c]
238
- - Updated dependencies [182da1c]
239
- - @open-pioneer/map@0.1.0
240
- - @open-pioneer/basemap-switcher@0.1.0
241
- - @open-pioneer/react-utils@0.1.0
244
+ - Updated dependencies [bb2f27a]
245
+ - Updated dependencies [1e7545c]
246
+ - Updated dependencies [182da1c]
247
+ - @open-pioneer/map@0.1.0
248
+ - @open-pioneer/basemap-switcher@0.1.0
249
+ - @open-pioneer/react-utils@0.1.0
package/README.md CHANGED
@@ -23,8 +23,8 @@ To show the toolset menu, set the `showTools` property to `true`.
23
23
 
24
24
  The default tools provided by the TOC are:
25
25
 
26
- - A button to hide all layers (sets `visibility` to false, enabled by default)
27
- - A button to collapse all groups (enabled by default if groups are collapsible)
26
+ - A button to hide all layers (sets `visibility` to false, enabled by default)
27
+ - A button to collapse all groups (enabled by default if groups are collapsible)
28
28
 
29
29
  These tools can be configured by using the `toolsConfig` property.
30
30
 
@@ -1 +1 @@
1
- {"version":3,"file":"TocModel.js","sources":["TocModel.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { createContext, Provider, useContext } from \"react\";\n\nconst TocModelContext = createContext<TocModel | undefined>(undefined);\n\n/**\n * Provider for the toc's shared model.\n * Used at the root of the component.\n */\nexport const TocModelProvider: Provider<TocModel> = TocModelContext.Provider as Provider<TocModel>;\n\n/**\n * Returns the shared model for the current toc component.\n */\nexport function useTocModel(): TocModel {\n const model = useContext(TocModelContext);\n if (!model) {\n throw new Error(\"Internal error: TocModel not found in context.\");\n }\n return model;\n}\n\n/**\n * Shared model used by the toc and all its sub-components.\n *\n * @internal\n */\nexport interface TocModel {\n /**\n * Return the global widget options.\n *\n * NOTE: The object itself is reactive, but individual properties are not (change -> replace).\n */\n readonly options: TocWidgetOptions;\n\n /**\n * Returns the item that corresponds with the `layerId`.\n */\n getItem(layerId: string): TocItem | undefined;\n\n /**\n * Returns the list of all items.\n */\n getItems(): TocItem[];\n\n // Used by toc item components to register themselves\n registerItem(item: TocItem): void;\n unregisterItem(item: TocItem): void;\n}\n\n/**\n * Global toc widget options.\n *\n * @internal\n */\nexport interface TocWidgetOptions {\n /**\n * True: When showing a child, show all parents as well (`setVisible(true)`).\n */\n autoShowParents: boolean;\n\n /**\n * True: Layer items with children can be collapsed.\n */\n collapsibleGroups: boolean;\n\n /**\n * True: All groups are initially collapsed.\n */\n initiallyCollapsed: boolean;\n}\n\n/**\n * Represents an item in the toc.\n *\n * Currently items register themselves in the model when they are mounted\n * and remove themselves when they are unmounted.\n *\n * @internal\n */\nexport interface TocItem {\n /**\n * Identifier of the layer that corresponds with the list item.\n */\n readonly layerId: string;\n\n /**\n * true if list item is expanded.\n */\n readonly isExpanded: boolean;\n\n /**\n * Expands or collapses the list item.\n *\n * Note: not all list items support this operation.\n */\n setExpanded(expanded: boolean): void;\n}\n"],"names":[],"mappings":";;AAIA,MAAM,eAAA,GAAkB,cAAoC,KAAS,CAAA,CAAA,CAAA;AAM9D,MAAM,mBAAuC,eAAgB,CAAA,SAAA;AAK7D,SAAS,WAAwB,GAAA;AACpC,EAAM,MAAA,KAAA,GAAQ,WAAW,eAAe,CAAA,CAAA;AACxC,EAAA,IAAI,CAAC,KAAO,EAAA;AACR,IAAM,MAAA,IAAI,MAAM,gDAAgD,CAAA,CAAA;AAAA,GACpE;AACA,EAAO,OAAA,KAAA,CAAA;AACX;;;;"}
1
+ {"version":3,"file":"TocModel.js","sources":["TocModel.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { createContext, Provider, useContext } from \"react\";\n\nconst TocModelContext = createContext<TocModel | undefined>(undefined);\n\n/**\n * Provider for the toc's shared model.\n * Used at the root of the component.\n */\nexport const TocModelProvider: Provider<TocModel> = TocModelContext.Provider as Provider<TocModel>;\n\n/**\n * Returns the shared model for the current toc component.\n */\nexport function useTocModel(): TocModel {\n const model = useContext(TocModelContext);\n if (!model) {\n throw new Error(\"Internal error: TocModel not found in context.\");\n }\n return model;\n}\n\n/**\n * Shared model used by the toc and all its sub-components.\n *\n * @internal\n */\nexport interface TocModel {\n /**\n * Return the global widget options.\n *\n * NOTE: The object itself is reactive, but individual properties are not (change -> replace).\n */\n readonly options: TocWidgetOptions;\n\n /**\n * Returns the item that corresponds with the `layerId`.\n */\n getItem(layerId: string): TocItem | undefined;\n\n /**\n * Returns the list of all items.\n */\n getItems(): TocItem[];\n\n // Used by toc item components to register themselves\n registerItem(item: TocItem): void;\n unregisterItem(item: TocItem): void;\n}\n\n/**\n * Global toc widget options.\n *\n * @internal\n */\nexport interface TocWidgetOptions {\n /**\n * True: When showing a child, show all parents as well (`setVisible(true)`).\n */\n autoShowParents: boolean;\n\n /**\n * True: Layer items with children can be collapsed.\n */\n collapsibleGroups: boolean;\n\n /**\n * True: All groups are initially collapsed.\n */\n initiallyCollapsed: boolean;\n}\n\n/**\n * Represents an item in the toc.\n *\n * Currently items register themselves in the model when they are mounted\n * and remove themselves when they are unmounted.\n *\n * @internal\n */\nexport interface TocItem {\n /**\n * Identifier of the layer that corresponds with the list item.\n */\n readonly layerId: string;\n\n /**\n * true if list item is expanded.\n */\n readonly isExpanded: boolean;\n\n /**\n * Expands or collapses the list item.\n *\n * Note: not all list items support this operation.\n */\n setExpanded(expanded: boolean): void;\n}\n"],"names":[],"mappings":";;AAIA,MAAM,eAAA,GAAkB,cAAoC,MAAS,CAAA;AAM9D,MAAM,mBAAuC,eAAgB,CAAA;AAK7D,SAAS,WAAwB,GAAA;AACpC,EAAM,MAAA,KAAA,GAAQ,WAAW,eAAe,CAAA;AACxC,EAAA,IAAI,CAAC,KAAO,EAAA;AACR,IAAM,MAAA,IAAI,MAAM,gDAAgD,CAAA;AAAA;AAEpE,EAAO,OAAA,KAAA;AACX;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@open-pioneer/toc",
4
- "version": "0.9.0-dev.20250220091855",
4
+ "version": "0.9.0",
5
5
  "description": "This package provides a UI component that displays the map content to the user and allows them to control it.",
6
6
  "keywords": [
7
7
  "open-pioneer-trails"
@@ -14,18 +14,18 @@
14
14
  "directory": "src/packages/toc"
15
15
  },
16
16
  "dependencies": {
17
- "@open-pioneer/chakra-integration": "^2.4.0",
18
- "@open-pioneer/react-utils": "^2.4.0",
19
- "@open-pioneer/runtime": "^2.4.0",
17
+ "@open-pioneer/chakra-integration": "^3.0.0",
18
+ "@open-pioneer/react-utils": "^3.0.0",
19
+ "@open-pioneer/runtime": "^3.0.0",
20
20
  "classnames": "^2.3.2",
21
- "ol": "^10.3.0",
22
- "react": "^18.3.1",
21
+ "ol": "^10.4.0",
22
+ "react": "^19.0.0",
23
23
  "react-icons": "^5.3.0",
24
24
  "@chakra-ui/icons": "^2.2.4",
25
- "@open-pioneer/reactivity": "^2.4.0",
25
+ "@open-pioneer/reactivity": "^3.0.0",
26
26
  "@conterra/reactivity-core": "^0.4.3",
27
- "@open-pioneer/basemap-switcher": "^0.9.0-dev.20250220091855",
28
- "@open-pioneer/map": "^0.9.0-dev.20250220091855"
27
+ "@open-pioneer/basemap-switcher": "^0.9.0",
28
+ "@open-pioneer/map": "^0.9.0"
29
29
  },
30
30
  "exports": {
31
31
  "./package.json": "./package.json",
@@ -1 +1 @@
1
- {"version":3,"file":"LayerItem.js","sources":["LayerItem.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { ChevronDownIcon, ChevronRightIcon } from \"@chakra-ui/icons\";\nimport { reactive } from \"@conterra/reactivity-core\";\nimport {\n Box,\n Checkbox,\n Collapse,\n Flex,\n IconButton,\n Spacer,\n Tooltip\n} from \"@open-pioneer/chakra-integration\";\nimport { AnyLayer } from \"@open-pioneer/map\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport classNames from \"classnames\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { memo, useEffect, useId, useMemo } from \"react\";\nimport { FiAlertTriangle } from \"react-icons/fi\";\nimport { TocItem, useTocModel } from \"../../model/TocModel\";\nimport { slug } from \"../../utils/slug\";\nimport { useChildLayers, useLoadState } from \"./hooks\";\nimport { LayerItemMenu } from \"./LayerItemMenu\";\nimport { LayerList } from \"./LayerList\";\n\n/**\n * Renders a single layer as a list item.\n *\n * The item may have further nested list items if there are sublayers present.\n */\nexport const LayerItem = memo(function LayerItem(props: { layer: AnyLayer }): JSX.Element {\n const { layer } = props;\n const intl = useIntl();\n const [tocItem, _tocModel, tocOptions] = useTocItem(layer);\n const expanded = useReactiveSnapshot(() => tocItem.isExpanded, [tocItem]);\n const isCollapsible = tocOptions ? tocOptions.collapsibleGroups : false;\n\n const layerGroupId = useId();\n const childLayers = useChildLayers(layer);\n const isAvailable = useLoadState(layer) !== \"error\";\n const notAvailableLabel = intl.formatMessage({ id: \"layerNotAvailable\" });\n const { title, description, isVisible } = useReactiveSnapshot(() => {\n return {\n title: layer.title,\n description: layer.description,\n isVisible: layer.visible\n };\n }, [layer]);\n\n let nestedChildren;\n if (childLayers?.length) {\n nestedChildren = (\n <LayerList\n layers={childLayers}\n ml={4}\n aria-label={intl.formatMessage({ id: \"childgroupLabel\" }, { title: title })}\n />\n );\n }\n return (\n <Box as=\"li\" className={classNames(\"toc-layer-item\", `layer-${slug(layer.id)}`)}>\n <Flex\n className=\"toc-layer-item-content\"\n width=\"100%\"\n flexDirection=\"row\"\n align=\"center\"\n justifyContent=\"space-between\"\n /** Gap to prevent bleeding of the buttons hover style into the layer title */\n gap={2}\n /** Aligned to the size of the (potential) menu button in LayerItemDescriptor */\n minHeight={10}\n >\n {isCollapsible && (\n <CollapseButton\n layerTitle={title}\n layerGroupId={layerGroupId}\n expanded={expanded}\n onClick={() => tocItem.setExpanded(!expanded)}\n hasNestedChildren={!!nestedChildren}\n />\n )}\n <Checkbox\n // Keyboard navigation jumps only to Checkboxes and uses the texts inside this DOM node.\n // The aria-labels of Tooltip and Icon is ignored by screenreader because they are no child element of the checkbox.\n // To consider the notAvailableLabel, an aria-label at the checkbox is necessary.\n aria-label={title + (!isAvailable ? \" \" + notAvailableLabel : \"\")}\n isChecked={isVisible}\n isDisabled={!isAvailable}\n onChange={(event) =>\n updateLayerVisibility(\n layer,\n event.target.checked,\n tocOptions.autoShowParents\n )\n }\n >\n {title}\n </Checkbox>\n {!isAvailable && (\n <Tooltip\n className=\"toc-layer-item-content-tooltip\"\n label={notAvailableLabel}\n placement=\"right\"\n openDelay={500}\n >\n <span>\n <FiAlertTriangle\n className=\"toc-layer-item-content-icon\"\n color={\"red\"}\n aria-label={notAvailableLabel}\n />\n </span>\n </Tooltip>\n )}\n <Spacer />\n <LayerItemMenu layer={layer} title={title} description={description} intl={intl} />\n </Flex>\n {nestedChildren && (\n <Collapse in={expanded} id={layerGroupId} className=\"toc-collapsible-item\">\n {nestedChildren}\n </Collapse>\n )}\n </Box>\n );\n});\n\nfunction CollapseButton(props: {\n layerTitle: string;\n layerGroupId: string;\n expanded: boolean;\n onClick: () => void;\n hasNestedChildren: boolean;\n}) {\n const { layerTitle, layerGroupId, expanded, onClick, hasNestedChildren } = props;\n const intl = useIntl();\n return (\n <IconButton\n variant=\"ghost\"\n borderRadius=\"full\"\n padding={0}\n className=\"toc-layer-item-collapse-button\"\n onClick={onClick}\n icon={expanded ? <ChevronDownIcon /> : <ChevronRightIcon />}\n aria-label={\n expanded\n ? intl.formatMessage({ id: \"group.collapse\" }, { title: layerTitle })\n : intl.formatMessage({ id: \"group.expand\" }, { title: layerTitle })\n }\n aria-expanded={expanded}\n aria-controls={layerGroupId}\n visibility={hasNestedChildren ? \"visible\" : \"hidden\"} //use visible:hidden for layers without children for correct indent\n />\n );\n}\n\n// Creates a toc item and registers it with the shared toc model.\nfunction useTocItem(layer: AnyLayer) {\n const tocModel = useTocModel();\n const options = useReactiveSnapshot(() => tocModel.options, [tocModel]);\n const tocItem = useMemo((): TocItem => {\n const expanded = reactive(!options.initiallyCollapsed);\n return {\n layerId: layer.id,\n get isExpanded(): boolean {\n return expanded.value;\n },\n setExpanded(expand: boolean) {\n expanded.value = expand;\n }\n };\n // TODO: isCollapsed -> recreate model is ok?\n }, [layer, options.initiallyCollapsed]);\n\n // Register the item on the shared toc model\n useEffect(() => {\n tocModel.registerItem(tocItem);\n return () => tocModel.unregisterItem(tocItem);\n }, [tocModel, tocItem]);\n\n return [tocItem, tocModel, options] as const;\n}\n\nfunction updateLayerVisibility(layer: AnyLayer, visible: boolean, autoShowParents: boolean) {\n layer.setVisible(visible);\n if (visible && autoShowParents && layer.parent) {\n updateLayerVisibility(layer.parent, true, true);\n }\n}\n"],"names":["LayerItem"],"mappings":";;;;;;;;;;;;;;;AAgCO,MAAM,SAAY,GAAA,IAAA,CAAK,SAASA,UAAAA,CAAU,KAAyC,EAAA;AACtF,EAAM,MAAA,EAAE,OAAU,GAAA,KAAA,CAAA;AAClB,EAAA,MAAM,OAAO,OAAQ,EAAA,CAAA;AACrB,EAAA,MAAM,CAAC,OAAS,EAAA,SAAA,EAAW,UAAU,CAAA,GAAI,WAAW,KAAK,CAAA,CAAA;AACzD,EAAA,MAAM,WAAW,mBAAoB,CAAA,MAAM,QAAQ,UAAY,EAAA,CAAC,OAAO,CAAC,CAAA,CAAA;AACxE,EAAM,MAAA,aAAA,GAAgB,UAAa,GAAA,UAAA,CAAW,iBAAoB,GAAA,KAAA,CAAA;AAElE,EAAA,MAAM,eAAe,KAAM,EAAA,CAAA;AAC3B,EAAM,MAAA,WAAA,GAAc,eAAe,KAAK,CAAA,CAAA;AACxC,EAAM,MAAA,WAAA,GAAc,YAAa,CAAA,KAAK,CAAM,KAAA,OAAA,CAAA;AAC5C,EAAA,MAAM,oBAAoB,IAAK,CAAA,aAAA,CAAc,EAAE,EAAA,EAAI,qBAAqB,CAAA,CAAA;AACxE,EAAA,MAAM,EAAE,KAAO,EAAA,WAAA,EAAa,SAAU,EAAA,GAAI,oBAAoB,MAAM;AA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YAAY,MAAiB,EAAA;AACzB,QAAA,QAAA,CAAS,KAAQ,GAAA,MAAA,CAAA;AAAA,OACrB;AAAA,KACJ,CAAA;AAAA,GAED,EAAA,CAAC,KAAO,EAAA,OAAA,CAAQ,kBAAkB,CAAC,CAAA,CAAA;AAGtC,EAAA,SAAA,CAAU,MAAM;AACZ,IAAA,QAAA,CAAS,aAAa,OAAO,CAAA,CAAA;AAC7B,IAAO,OAAA,MAAM,QAAS,CAAA,cAAA,CAAe,OAAO,CAAA,CAAA;AAAA,GAC7C,EAAA,CAAC,QAAU,EAAA,OAAO,CAAC,CAAA,CAAA;AAEtB,EAAO,OAAA,CAAC,OAAS,EAAA,QAAA,EAAU,OAAO,CAAA,CAAA;AACtC,CAAA;AAEA,SAAS,qBAAA,CAAsB,KAAiB,EAAA,OAAA,EAAkB,eAA0B,EAAA;AACxF,EAAA,KAAA,CAAM,WAAW,OAAO,CAAA,CAAA;AACxB,EAAI,IAAA,OAAA,IAAW,eAAmB,IAAA,KAAA,CAAM,MAAQ,EAAA;AAC5C,IAAsB,qBAAA,CAAA,KAAA,CAAM,MAAQ,EAAA,IAAA,EAAM,IAAI,CAAA,CAAA;AAAA,GAClD;AACJ;;;;"}
1
+ {"version":3,"file":"LayerItem.js","sources":["LayerItem.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { ChevronDownIcon, ChevronRightIcon } from \"@chakra-ui/icons\";\nimport { reactive } from \"@conterra/reactivity-core\";\nimport {\n Box,\n Checkbox,\n Collapse,\n Flex,\n IconButton,\n Spacer,\n Tooltip\n} from \"@open-pioneer/chakra-integration\";\nimport { AnyLayer } from \"@open-pioneer/map\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\nimport classNames from \"classnames\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { memo, ReactNode, useEffect, useId, useMemo } from \"react\";\nimport { FiAlertTriangle } from \"react-icons/fi\";\nimport { TocItem, useTocModel } from \"../../model/TocModel\";\nimport { slug } from \"../../utils/slug\";\nimport { useChildLayers, useLoadState } from \"./hooks\";\nimport { LayerItemMenu } from \"./LayerItemMenu\";\nimport { LayerList } from \"./LayerList\";\n\n/**\n * Renders a single layer as a list item.\n *\n * The item may have further nested list items if there are sublayers present.\n */\nexport const LayerItem = memo(function LayerItem(props: { layer: AnyLayer }): ReactNode {\n const { layer } = props;\n const intl = useIntl();\n const [tocItem, _tocModel, tocOptions] = useTocItem(layer);\n const expanded = useReactiveSnapshot(() => tocItem.isExpanded, [tocItem]);\n const isCollapsible = tocOptions ? tocOptions.collapsibleGroups : false;\n\n const layerGroupId = useId();\n const childLayers = useChildLayers(layer);\n const isAvailable = useLoadState(layer) !== \"error\";\n const notAvailableLabel = intl.formatMessage({ id: \"layerNotAvailable\" });\n const { title, description, isVisible } = useReactiveSnapshot(() => {\n return {\n title: layer.title,\n description: layer.description,\n isVisible: layer.visible\n };\n }, [layer]);\n\n let nestedChildren;\n if (childLayers?.length) {\n nestedChildren = (\n <LayerList\n layers={childLayers}\n ml={4}\n aria-label={intl.formatMessage({ id: \"childgroupLabel\" }, { title: title })}\n />\n );\n }\n return (\n <Box as=\"li\" className={classNames(\"toc-layer-item\", `layer-${slug(layer.id)}`)}>\n <Flex\n className=\"toc-layer-item-content\"\n width=\"100%\"\n flexDirection=\"row\"\n align=\"center\"\n justifyContent=\"space-between\"\n /** Gap to prevent bleeding of the buttons hover style into the layer title */\n gap={2}\n /** Aligned to the size of the (potential) menu button in LayerItemDescriptor */\n minHeight={10}\n >\n {isCollapsible && (\n <CollapseButton\n layerTitle={title}\n layerGroupId={layerGroupId}\n expanded={expanded}\n onClick={() => tocItem.setExpanded(!expanded)}\n hasNestedChildren={!!nestedChildren}\n />\n )}\n <Checkbox\n // Keyboard navigation jumps only to Checkboxes and uses the texts inside this DOM node.\n // The aria-labels of Tooltip and Icon is ignored by screenreader because they are no child element of the checkbox.\n // To consider the notAvailableLabel, an aria-label at the checkbox is necessary.\n aria-label={title + (!isAvailable ? \" \" + notAvailableLabel : \"\")}\n isChecked={isVisible}\n isDisabled={!isAvailable}\n onChange={(event) =>\n updateLayerVisibility(\n layer,\n event.target.checked,\n tocOptions.autoShowParents\n )\n }\n >\n {title}\n </Checkbox>\n {!isAvailable && (\n <Tooltip\n className=\"toc-layer-item-content-tooltip\"\n label={notAvailableLabel}\n placement=\"right\"\n openDelay={500}\n >\n <span>\n <FiAlertTriangle\n className=\"toc-layer-item-content-icon\"\n color={\"red\"}\n aria-label={notAvailableLabel}\n />\n </span>\n </Tooltip>\n )}\n <Spacer />\n <LayerItemMenu layer={layer} title={title} description={description} intl={intl} />\n </Flex>\n {nestedChildren && (\n <Collapse in={expanded} id={layerGroupId} className=\"toc-collapsible-item\">\n {nestedChildren}\n </Collapse>\n )}\n </Box>\n );\n});\n\nfunction CollapseButton(props: {\n layerTitle: string;\n layerGroupId: string;\n expanded: boolean;\n onClick: () => void;\n hasNestedChildren: boolean;\n}) {\n const { layerTitle, layerGroupId, expanded, onClick, hasNestedChildren } = props;\n const intl = useIntl();\n return (\n <IconButton\n variant=\"ghost\"\n borderRadius=\"full\"\n padding={0}\n className=\"toc-layer-item-collapse-button\"\n onClick={onClick}\n icon={expanded ? <ChevronDownIcon /> : <ChevronRightIcon />}\n aria-label={\n expanded\n ? intl.formatMessage({ id: \"group.collapse\" }, { title: layerTitle })\n : intl.formatMessage({ id: \"group.expand\" }, { title: layerTitle })\n }\n aria-expanded={expanded}\n aria-controls={layerGroupId}\n visibility={hasNestedChildren ? \"visible\" : \"hidden\"} //use visible:hidden for layers without children for correct indent\n />\n );\n}\n\n// Creates a toc item and registers it with the shared toc model.\nfunction useTocItem(layer: AnyLayer) {\n const tocModel = useTocModel();\n const options = useReactiveSnapshot(() => tocModel.options, [tocModel]);\n const tocItem = useMemo((): TocItem => {\n const expanded = reactive(!options.initiallyCollapsed);\n return {\n layerId: layer.id,\n get isExpanded(): boolean {\n return expanded.value;\n },\n setExpanded(expand: boolean) {\n expanded.value = expand;\n }\n };\n }, [layer, options.initiallyCollapsed]);\n\n // Register the item on the shared toc model\n useEffect(() => {\n tocModel.registerItem(tocItem);\n return () => tocModel.unregisterItem(tocItem);\n }, [tocModel, tocItem]);\n\n return [tocItem, tocModel, options] as const;\n}\n\nfunction updateLayerVisibility(layer: AnyLayer, visible: boolean, autoShowParents: boolean) {\n layer.setVisible(visible);\n if (visible && autoShowParents && layer.parent) {\n updateLayerVisibility(layer.parent, true, true);\n }\n}\n"],"names":["LayerItem"],"mappings":";;;;;;;;;;;;;;;AAgCO,MAAM,SAAY,GAAA,IAAA,CAAK,SAASA,UAAAA,CAAU,KAAuC,EAAA;AACpF,EAAM,MAAA,EAAE,OAAU,GAAA,KAAA;AAClB,EAAA,MAAM,OAAO,OAAQ,EAAA;AACrB,EAAA,MAAM,CAAC,OAAS,EAAA,SAAA,EAAW,UAAU,CAAA,GAAI,WAAW,KAAK,CAAA;AACzD,EAAA,MAAM,WAAW,mBAAoB,CAAA,MAAM,QAAQ,UAAY,EAAA,CAAC,OAAO,CAAC,CAAA;AACxE,EAAM,MAAA,aAAA,GAAgB,UAAa,GAAA,UAAA,CAAW,iBAAoB,GAAA,KAAA;AAElE,EAAA,MAAM,eAAe,KAAM,EAAA;AAC3B,EAAM,MAAA,WAAA,GAAc,eAAe,KAAK,CAAA;AACxC,EAAM,MAAA,WAAA,GAAc,YAAa,CAAA,KAAK,CAAM,KAAA,OAAA;AAC5C,EAAA,MAAM,oBAAoB,IAAK,CAAA,aAAA,CAAc,EAAE,EAAA,EAAI,qBAAqB,CAAA;AACxE,EAAA,MAAM,EAAE,KAAO,EAAA,WAAA,EAAa,SAAU,EAAA,GAAI,oBAAoB,MAAM;AAChE,IAAO,OAAA;AAAA,MACH,OAAO,KAAM,CAAA,KAAA;AAAA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CAAA,cAAA,CAAe,OAAO,CAAA;AAAA,GAC7C,EAAA,CAAC,QAAU,EAAA,OAAO,CAAC,CAAA;AAEtB,EAAO,OAAA,CAAC,OAAS,EAAA,QAAA,EAAU,OAAO,CAAA;AACtC;AAEA,SAAS,qBAAA,CAAsB,KAAiB,EAAA,OAAA,EAAkB,eAA0B,EAAA;AACxF,EAAA,KAAA,CAAM,WAAW,OAAO,CAAA;AACxB,EAAI,IAAA,OAAA,IAAW,eAAmB,IAAA,KAAA,CAAM,MAAQ,EAAA;AAC5C,IAAsB,qBAAA,CAAA,KAAA,CAAM,MAAQ,EAAA,IAAA,EAAM,IAAI,CAAA;AAAA;AAEtD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"LayerItemMenu.js","sources":["LayerItemMenu.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport {\n Button,\n Popover,\n PopoverArrow,\n PopoverBody,\n PopoverCloseButton,\n PopoverContent,\n PopoverHeader,\n PopoverTrigger,\n Portal\n} from \"@open-pioneer/chakra-integration\";\nimport { AnyLayer } from \"@open-pioneer/map\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport { FiMoreVertical } from \"react-icons/fi\";\nimport { useLoadState } from \"./hooks\";\n\nexport function LayerItemMenu(props: {\n layer: AnyLayer;\n title: string;\n description: string;\n intl: PackageIntl;\n}) {\n const { layer, title, description, intl } = props;\n const isPresent = !!description;\n const buttonLabel = intl.formatMessage({ id: \"descriptionLabel\" });\n const isAvailable = useLoadState(layer) !== \"error\";\n\n return (\n isPresent && (\n <Popover placement=\"bottom-start\">\n <PopoverTrigger>\n <Button\n isDisabled={!isAvailable}\n className=\"toc-layer-item-details-button\"\n aria-label={buttonLabel}\n borderRadius=\"full\"\n iconSpacing={0}\n padding={0}\n variant=\"ghost\"\n leftIcon={<FiMoreVertical />}\n />\n </PopoverTrigger>\n <Portal>\n <PopoverContent\n className=\"toc-layer-item-details\"\n overflowY=\"auto\"\n maxHeight=\"400\"\n >\n <PopoverArrow />\n <PopoverCloseButton mt={1} />\n <PopoverHeader>{title}</PopoverHeader>\n <PopoverBody>{description}</PopoverBody>\n </PopoverContent>\n </Portal>\n </Popover>\n )\n );\n}\n"],"names":[],"mappings":";;;;;AAkBO,SAAS,cAAc,KAK3B,EAAA;AACC,EAAA,MAAM,EAAE,KAAA,EAAO,KAAO,EAAA,WAAA,EAAa,MAAS,GAAA,KAAA,CAAA;AAC5C,EAAM,MAAA,SAAA,GAAY,CAAC,CAAC,WAAA,CAAA;AACpB,EAAA,MAAM,cAAc,IAAK,CAAA,aAAA,CAAc,EAAE,EAAA,EAAI,oBAAoB,CAAA,CAAA;AACjE,EAAM,MAAA,WAAA,GAAc,YAAa,CAAA,KAAK,CAAM,KAAA,OAAA,CAAA;AAE5C,EAAA,OACI,SACI,oBAAA,IAAA,CAAC,OAAQ,EAAA,EAAA,SAAA,EAAU,cACf,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,cACG,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACG,YAAY,CAAC,WAAA;AAAA,QACb,SAAU,EAAA,+BAAA;AAAA,QACV,YAAY,EAAA,WAAA;AAAA,QACZ,YAAa,EAAA,MAAA;AAAA,QACb,WAAa,EAAA,CAAA;AAAA,QACb,OAAS,EAAA,CAAA;AAAA,QACT,OAAQ,EAAA,OAAA;AAAA,QACR,QAAA,sBAAW,cAAe,EAAA,EAAA,CAAA;AAAA,OAAA;AAAA,KAElC,EAAA,CAAA;AAAA,wBACC,MACG,EAAA,EAAA,QAAA,kBAAA,IAAA;AAAA,MAAC,cAAA;AAAA,MAAA;AAAA,QACG,SAAU,EAAA,wBAAA;AAAA,QACV,SAAU,EAAA,MAAA;AAAA,QACV,SAAU,EAAA,KAAA;AAAA,QAEV,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,YAAa,EAAA,EAAA,CAAA;AAAA,0BACd,GAAA,CAAC,kBAAmB,EAAA,EAAA,EAAA,EAAI,CAAG,EAAA,CAAA;AAAA,0BAC3B,GAAA,CAAC,iBAAe,QAAM,EAAA,KAAA,EAAA,CAAA;AAAA,0BACtB,GAAA,CAAC,eAAa,QAAY,EAAA,WAAA,EAAA,CAAA;AAAA,SAAA;AAAA,OAAA;AAAA,KAElC,EAAA,CAAA;AAAA,GACJ,EAAA,CAAA,CAAA;AAGZ;;;;"}
1
+ {"version":3,"file":"LayerItemMenu.js","sources":["LayerItemMenu.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport {\n Button,\n Popover,\n PopoverArrow,\n PopoverBody,\n PopoverCloseButton,\n PopoverContent,\n PopoverHeader,\n PopoverTrigger,\n Portal\n} from \"@open-pioneer/chakra-integration\";\nimport { AnyLayer } from \"@open-pioneer/map\";\nimport { PackageIntl } from \"@open-pioneer/runtime\";\nimport { FiMoreVertical } from \"react-icons/fi\";\nimport { useLoadState } from \"./hooks\";\n\nexport function LayerItemMenu(props: {\n layer: AnyLayer;\n title: string;\n description: string;\n intl: PackageIntl;\n}) {\n const { layer, title, description, intl } = props;\n const isPresent = !!description;\n const buttonLabel = intl.formatMessage({ id: \"descriptionLabel\" });\n const isAvailable = useLoadState(layer) !== \"error\";\n\n return (\n isPresent && (\n <Popover placement=\"bottom-start\">\n <PopoverTrigger>\n <Button\n isDisabled={!isAvailable}\n className=\"toc-layer-item-details-button\"\n aria-label={buttonLabel}\n borderRadius=\"full\"\n iconSpacing={0}\n padding={0}\n variant=\"ghost\"\n leftIcon={<FiMoreVertical />}\n />\n </PopoverTrigger>\n <Portal>\n <PopoverContent\n className=\"toc-layer-item-details\"\n overflowY=\"auto\"\n maxHeight=\"400\"\n >\n <PopoverArrow />\n <PopoverCloseButton mt={1} />\n <PopoverHeader>{title}</PopoverHeader>\n <Popover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A,0BACtB,GAAA,CAAC,eAAa,QAAY,EAAA,WAAA,EAAA;AAAA;AAAA;AAAA,KAElC,EAAA;AAAA,GACJ,EAAA,CAAA;AAGZ;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { Text, Box, List } from '@open-pioneer/chakra-integration';
2
+ import { Box, List, Text } from '@open-pioneer/chakra-integration';
3
3
  import { useIntl } from '../../_virtual/_virtual-pioneer-module_react-hooks.js';
4
4
  import { memo, useMemo } from 'react';
5
5
  import { LayerItem } from './LayerItem.js';
@@ -1 +1 @@
1
- {"version":3,"file":"LayerList.js","sources":["LayerList.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Box, List, ListProps, Text } from \"@open-pioneer/chakra-integration\";\nimport { AnyLayer, MapModel } from \"@open-pioneer/map\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { memo, useMemo } from \"react\";\nimport { LayerItem } from \"./LayerItem\";\nimport { useLayers } from \"./hooks\";\n\ninterface TopLevelLayerListProps {\n map: MapModel;\n\n /** The label of the list group (<ul>) */\n \"aria-label\"?: string;\n}\n\n/**\n * Lists the operational layers in the map.\n */\nexport const TopLevelLayerList = memo(function TopLevelLayerList(props: TopLevelLayerListProps) {\n const { map, \"aria-label\": ariaLabel } = props;\n const intl = useIntl();\n const layers = useLayers(map);\n\n if (!layers.length) {\n return (\n <Text className=\"toc-missing-layers\" aria-label={ariaLabel}>\n {intl.formatMessage({ id: \"missingLayers\" })}\n </Text>\n );\n }\n\n return <LayerList layers={layers} aria-label={ariaLabel} />;\n});\n\n/**\n * Renders the given layers as a list (<ul>).\n */\nexport const LayerList = memo(function LayerList(props: { layers: AnyLayer[] } & ListProps) {\n const { layers, ...listProps } = props;\n const items = useMemo(\n () => layers.map((layer) => <LayerItem key={layer.id} layer={layer} />),\n [layers]\n );\n\n return (\n <Box>\n <List\n // Note: not using UnorderedList because it adds default margins\n as=\"ul\"\n className=\"toc-layer-list\"\n listStyleType=\"none\"\n role=\"group\"\n {...listProps}\n >\n {items}\n </List>\n </Box>\n );\n});\n"],"names":["TopLevelLayerList","LayerList"],"mappings":";;;;;;;AAmBO,MAAM,iBAAoB,GAAA,IAAA,CAAK,SAASA,kBAAAA,CAAkB,KAA+B,EAAA;AAC5F,EAAA,MAAM,EAAE,GAAA,EAAK,YAAc,EAAA,SAAA,EAAc,GAAA,KAAA,CAAA;AACzC,EAAA,MAAM,OAAO,OAAQ,EAAA,CAAA;AACrB,EAAM,MAAA,MAAA,GAAS,UAAU,GAAG,CAAA,CAAA;AAE5B,EAAI,IAAA,CAAC,OAAO,MAAQ,EAAA;AAChB,IAAA,uBACK,GAAA,CAAA,IAAA,EAAA,EAAK,SAAU,EAAA,oBAAA,EAAqB,YAAY,EAAA,SAAA,EAC5C,QAAK,EAAA,IAAA,CAAA,aAAA,CAAc,EAAE,EAAA,EAAI,eAAgB,EAAC,CAC/C,EAAA,CAAA,CAAA;AAAA,GAER;AAEA,EAAA,uBAAQ,GAAA,CAAA,SAAA,EAAA,EAAU,MAAgB,EAAA,YAAA,EAAY,SAAW,EAAA,CAAA,CAAA;AAC7D,CAAC,EAAA;AAKM,MAAM,SAAY,GAAA,IAAA,CAAK,SAASC,UAAAA,CAAU,KAA2C,EAAA;AACxF,EAAA,MAAM,EAAE,MAAA,EAAQ,GAAG,SAAA,EAAc,GAAA,KAAA,CAAA;AACjC,EAAA,MAAM,KAAQ,GAAA,OAAA;AAAA,IACV,MAAM,MAAO,CAAA,GAAA,CAAI,CAAC,KAAA,yBAAW,SAAyB,EAAA,EAAA,KAAA,EAAA,EAAV,KAAM,CAAA,EAAkB,CAAE,CAAA;AAAA,IACtE,CAAC,MAAM,CAAA;AAAA,GACX,CAAA;AAEA,EAAA,2BACK,GACG,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MAEG,EAAG,EAAA,IAAA;AAAA,MACH,SAAU,EAAA,gBAAA;AAAA,MACV,aAAc,EAAA,MAAA;AAAA,MACd,IAAK,EAAA,OAAA;AAAA,MACJ,GAAG,SAAA;AAAA,MAEH,QAAA,EAAA,KAAA;AAAA,KAAA;AAAA,GAET,EAAA,CAAA,CAAA;AAER,CAAC;;;;"}
1
+ {"version":3,"file":"LayerList.js","sources":["LayerList.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Box, List, ListProps, Text } from \"@open-pioneer/chakra-integration\";\nimport { AnyLayer, MapModel } from \"@open-pioneer/map\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { memo, useMemo } from \"react\";\nimport { LayerItem } from \"./LayerItem\";\nimport { useLayers } from \"./hooks\";\n\ninterface TopLevelLayerListProps {\n map: MapModel;\n\n /** The label of the list group (<ul>) */\n \"aria-label\"?: string;\n}\n\n/**\n * Lists the operational layers in the map.\n */\nexport const TopLevelLayerList = memo(function TopLevelLayerList(props: TopLevelLayerListProps) {\n const { map, \"aria-label\": ariaLabel } = props;\n const intl = useIntl();\n const layers = useLayers(map);\n\n if (!layers.length) {\n return (\n <Text className=\"toc-missing-layers\" aria-label={ariaLabel}>\n {intl.formatMessage({ id: \"missingLayers\" })}\n </Text>\n );\n }\n\n return <LayerList layers={layers} aria-label={ariaLabel} />;\n});\n\n/**\n * Renders the given layers as a list (<ul>).\n */\nexport const LayerList = memo(function LayerList(props: { layers: AnyLayer[] } & ListProps) {\n const { layers, ...listProps } = props;\n const items = useMemo(\n () => layers.map((layer) => <LayerItem key={layer.id} layer={layer} />),\n [layers]\n );\n\n return (\n <Box>\n <List\n // Note: not using UnorderedList because it adds default margins\n as=\"ul\"\n className=\"toc-layer-list\"\n listStyleType=\"none\"\n role=\"group\"\n {...listProps}\n >\n {items}\n </List>\n </Box>\n );\n});\n"],"names":["TopLevelLayerList","LayerList"],"m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1 @@
1
- {"version":3,"file":"hooks.js","sources":["hooks.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { AnyLayer, isSublayer, Layer, MapModel } from \"@open-pioneer/map\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\n\n/** Returns the top level operational layers in render order (topmost layer first). */\nexport function useLayers(map: MapModel): Layer[] {\n return useReactiveSnapshot(() => {\n const layers = map.layers.getOperationalLayers({ sortByDisplayOrder: true }) ?? [];\n layers.reverse(); // render topmost layer first\n return layers;\n }, [map]);\n}\n\n/**\n * Returns the child layers (sublayers or layers contained in a group layer) of a layer.\n * Layers are returned in render order (topmost sublayer first).\n */\nexport function useChildLayers(layer: AnyLayer): AnyLayer[] | undefined {\n return useReactiveSnapshot(() => {\n const children = layer.children?.getItems({ sortByDisplayOrder: true });\n children?.reverse(); // render topmost layer first\n return children;\n }, [layer]);\n}\n\n/** Returns the layers current state. */\nexport function useLoadState(layer: AnyLayer): string {\n return useReactiveSnapshot(() => {\n // for sublayers, use the state of the parent\n const target = isSublayer(layer) ? layer.parentLayer : layer;\n return target.loadState;\n }, [layer]);\n}\n"],"names":[],"mappings":";;;AAMO,SAAS,UAAU,GAAwB,EAAA;AAC9C,EAAA,OAAO,oBAAoB,MAAM;AAC7B,IAAM,MAAA,MAAA,GAAS,IAAI,MAAO,CAAA,oBAAA,CAAqB,EAAE,kBAAoB,EAAA,IAAA,EAAM,CAAA,IAAK,EAAC,CAAA;AACjF,IAAA,MAAA,CAAO,OAAQ,EAAA,CAAA;AACf,IAAO,OAAA,MAAA,CAAA;AAAA,GACX,EAAG,CAAC,GAAG,CAAC,CAAA,CAAA;AACZ,CAAA;AAMO,SAAS,eAAe,KAAyC,EAAA;AACpE,EAAA,OAAO,oBAAoB,MAAM;AAC7B,IAAA,MAAM,WAAW,KAAM,CAAA,QAAA,EAAU,SAAS,EAAE,kBAAA,EAAoB,MAAM,CAAA,CAAA;AACtE,IAAA,QAAA,EAAU,OAAQ,EAAA,CAAA;AAClB,IAAO,OAAA,QAAA,CAAA;AAAA,GACX,EAAG,CAAC,KAAK,CAAC,CAAA,CAAA;AACd,CAAA;AAGO,SAAS,aAAa,KAAyB,EAAA;AAClD,EAAA,OAAO,oBAAoB,MAAM;AAE7B,IAAA,MAAM,MAAS,GAAA,UAAA,CAAW,KAAK,CAAA,GAAI,MAAM,WAAc,GAAA,KAAA,CAAA;AACvD,IAAA,OAAO,MAAO,CAAA,SAAA,CAAA;AAAA,GAClB,EAAG,CAAC,KAAK,CAAC,CAAA,CAAA;AACd;;;;"}
1
+ {"version":3,"file":"hooks.js","sources":["hooks.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { AnyLayer, isSublayer, Layer, MapModel } from \"@open-pioneer/map\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\n\n/** Returns the top level operational layers in render order (topmost layer first). */\nexport function useLayers(map: MapModel): Layer[] {\n return useReactiveSnapshot(() => {\n const layers = map.layers.getOperationalLayers({ sortByDisplayOrder: true }) ?? [];\n layers.reverse(); // render topmost layer first\n return layers;\n }, [map]);\n}\n\n/**\n * Returns the child layers (sublayers or layers contained in a group layer) of a layer.\n * Layers are returned in render order (topmost sublayer first).\n */\nexport function useChildLayers(layer: AnyLayer): AnyLayer[] | undefined {\n return useReactiveSnapshot(() => {\n const children = layer.children?.getItems({ sortByDisplayOrder: true });\n children?.reverse(); // render topmost layer first\n return children;\n }, [layer]);\n}\n\n/** Returns the layers current state. */\nexport function useLoadState(layer: AnyLayer): string {\n return useReactiveSnapshot(() => {\n // for sublayers, use the state of the parent\n const target = isSublayer(layer) ? layer.parentLayer : layer;\n return target.loadState;\n }, [layer]);\n}\n"],"names":[],"mappings":";;;AAMO,SAAS,UAAU,GAAwB,EAAA;AAC9C,EAAA,OAAO,oBAAoB,MAAM;AAC7B,IAAM,MAAA,MAAA,GAAS,IAAI,MAAO,CAAA,oBAAA,CAAqB,EAAE,kBAAoB,EAAA,IAAA,EAAM,CAAA,IAAK,EAAC;AACjF,IAAA,MAAA,CAAO,OAAQ,EAAA;AACf,IAAO,OAAA,MAAA;AAAA,GACX,EAAG,CAAC,GAAG,CAAC,CAAA;AACZ;AAMO,SAAS,eAAe,KAAyC,EAAA;AACpE,EAAA,OAAO,oBAAoB,MAAM;AAC7B,IAAA,MAAM,WAAW,KAAM,CAAA,QAAA,EAAU,SAAS,EAAE,kBAAA,EAAoB,MAAM,CAAA;AACtE,IAAA,QAAA,EAAU,OAAQ,EAAA;AAClB,IAAO,OAAA,QAAA;AAAA,GACX,EAAG,CAAC,KAAK,CAAC,CAAA;AACd;AAGO,SAAS,aAAa,KAAyB,EAAA;AAClD,EAAA,OAAO,oBAAoB,MAAM;AAE7B,IAAA,MAAM,MAAS,GAAA,UAAA,CAAW,KAAK,CAAA,GAAI,MAAM,WAAc,GAAA,KAAA;AACvD,IAAA,OAAO,MAAO,CAAA,SAAA;AAAA,GAClB,EAAG,CAAC,KAAK,CAAC,CAAA;AACd;;;;"}
package/ui/Toc.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Toc.js","sources":["Toc.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { reactive, reactiveMap } from \"@conterra/reactivity-core\";\nimport { BasemapSwitcher, BasemapSwitcherProps } from \"@open-pioneer/basemap-switcher\";\nimport { Box, Flex, Spacer, Text } from \"@open-pioneer/chakra-integration\";\nimport { MapModel, MapModelProps, useMapModel } from \"@open-pioneer/map\";\nimport {\n CommonComponentProps,\n SectionHeading,\n TitledSection,\n useCommonComponentProps\n} from \"@open-pioneer/react-utils\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, useEffect, useId, useMemo, useRef } from \"react\";\nimport { TocItem, TocModel, TocModelProvider, TocWidgetOptions } from \"../model/TocModel\";\nimport { TopLevelLayerList } from \"./LayerList/LayerList\";\nimport { Tools } from \"./Tools\";\n\n/**\n * Props supported by the {@link Toc} component.\n */\nexport interface TocProps extends CommonComponentProps, MapModelProps {\n /**\n * Defines whether the tool component is shown in the toc.\n *\n * Defaults to `false`.\n */\n showTools?: boolean;\n\n /**\n * Properties for the embedded tool component.\n */\n toolsConfig?: ToolsConfig;\n\n /**\n * Defines whether the basemap switcher is shown in the toc.\n *\n * Defaults to `true`.\n */\n showBasemapSwitcher?: boolean;\n\n /**\n * Properties for the embedded basemap switcher.\n *\n * Property `mapId` is not applied (the basemap switcher uses the same map as the).\n */\n basemapSwitcherProps?: Omit<BasemapSwitcherProps, \"mapId\">;\n\n /**\n * If `true`, groups in the toc can be collapsed and expanded.\n * This property should only be `true` if the map actually contains layer groups.\n *\n * Defaults to `false`.\n */\n collapsibleGroups?: boolean;\n\n /**\n * If `true` groups in the toc are collapsed initially.\n *\n * Defaults to `false`. If {@link collapsibleGroups} is `false` this property should also be `false`. Otherwise only the top level layers will appear in the toc.\n */\n initiallyCollapsed?: boolean;\n\n /**\n * Show the parent layers when a child layer is made visible.\n *\n * Defaults to `true`.\n */\n autoShowParents?: boolean;\n}\n\n/**\n * Props supported by the {@link Tools} component.\n */\nexport interface ToolsConfig {\n /**\n * Optional property to show the `hide all layers` entry.\n *\n * Defaults to `true`.\n */\n showHideAllLayers?: boolean;\n\n /**\n * Optional property to show the `collapse all groups` entry.\n *\n * Defaults to `true`. Only applicable if {@link TocProps.collapsibleGroups} is `true`.\n */\n showCollapseAllGroups?: boolean;\n}\n\nconst PADDING = 2;\n\n/**\n * Displays the layers of the configured map.\n */\nexport const Toc: FC<TocProps> = (props: TocProps) => {\n const intl = useIntl();\n const { containerProps } = useCommonComponentProps(\"toc\", props);\n const state = useMapModel(props);\n\n let content: JSX.Element | null;\n switch (state.kind) {\n case \"loading\":\n content = null;\n break;\n case \"rejected\":\n content = <Text className=\"toc-error\">{intl.formatMessage({ id: \"error\" })}</Text>;\n break;\n case \"resolved\": {\n const map = state.map;\n content = <TocContent {...props} map={map} />;\n break;\n }\n }\n\n return (\n <Flex {...containerProps} direction=\"column\" gap={PADDING}>\n {content}\n </Flex>\n );\n};\n\n/** This component is rendered once we have a reference to the loaded map model. */\nfunction TocContent(props: TocProps & { map: MapModel }) {\n const {\n map,\n showTools = false,\n toolsConfig,\n showBasemapSwitcher = true,\n basemapSwitcherProps\n } = props;\n const intl = useIntl();\n const model = useTocModel(props);\n const basemapsHeadingId = useId();\n const basemapSwitcher = showBasemapSwitcher && (\n <Box className=\"toc-basemap-switcher\">\n <TitledSection\n title={\n <SectionHeading id={basemapsHeadingId} size={\"sm\"} mb={PADDING}>\n {intl.formatMessage({ id: \"basemapsLabel\" })}\n </SectionHeading>\n }\n >\n <BasemapSwitcher\n map={map}\n aria-labelledby={basemapsHeadingId}\n {...basemapSwitcherProps}\n />\n </TitledSection>\n </Box>\n );\n\n const layerList = (\n <Box className=\"toc-operational-layers\">\n <TitledSection\n title={\n <SectionHeading size={\"sm\"} mb={2}>\n <Flex>\n <Text my={3}>\n {intl.formatMessage({\n id: \"operationalLayerLabel\"\n })}\n </Text>\n <Spacer />\n {showTools && <Tools map={map} {...toolsConfig} />}\n </Flex>\n </SectionHeading>\n }\n >\n <TopLevelLayerList\n map={map}\n aria-label={intl.formatMessage({ id: \"operationalLayerLabel\" })}\n />\n </TitledSection>\n </Box>\n );\n\n return (\n <TocModelProvider value={model}>\n {basemapSwitcher}\n {layerList}\n </TocModelProvider>\n );\n}\n\nfunction useTocModel(props: TocProps): TocModel {\n const initialProps = useRef(props);\n const { model, options } = useMemo(() => {\n const options = reactive<TocWidgetOptions>(\n createOptions(\n initialProps.current.autoShowParents,\n initialProps.current.collapsibleGroups,\n initialProps.current.initiallyCollapsed\n )\n );\n\n // Indexed by layerId\n const items = reactiveMap<string, TocItem>();\n const model: TocModel = {\n get options() {\n return options.value;\n },\n getItem(layerId: string): TocItem | undefined {\n return items.get(layerId);\n },\n getItems(): TocItem[] {\n return Array.from(items.values());\n },\n registerItem(item: TocItem): void {\n if (items.has(item.layerId)) {\n throw new Error(`Item with layerId '${item.layerId}' already registered.`);\n }\n items.set(item.layerId, item);\n },\n unregisterItem(item: TocItem): void {\n if (items.get(item.layerId) !== item) {\n throw new Error(`Item with layerId '${item.layerId}' not registered.`);\n }\n items.delete(item.layerId);\n }\n };\n return { model, options };\n }, []);\n\n // Sync props to model\n useEffect(() => {\n options.value = createOptions(\n props.autoShowParents,\n props.collapsibleGroups,\n props.initiallyCollapsed\n );\n }, [options, props.autoShowParents, props.collapsibleGroups, props.initiallyCollapsed]);\n\n return model;\n}\n\nfunction createOptions(\n autoShowParents?: boolean | undefined,\n collapsibleGroups?: boolean | undefined,\n isCollapsed?: boolean | undefined\n): TocWidgetOptions {\n return {\n autoShowParents: autoShowParents ?? true,\n collapsibleGroups: collapsibleGroups ?? false,\n initiallyCollapsed: isCollapsed ?? false\n };\n}\n"],"names":["options","model"],"mappings":";;;;;;;;;;;;AA0FA,MAAM,OAAU,GAAA,CAAA,CAAA;AAKH,MAAA,GAAA,GAAoB,CAAC,KAAoB,KAAA;AAClD,EAAA,MAAM,OAAO,OAAQ,EAAA,CAAA;AACrB,EAAA,MAAM,EAAE,cAAA,EAAmB,GAAA,uBAAA,CAAwB,OAAO,KAAK,CAAA,CAAA;AAC/D,EAAM,MAAA,KAAA,GAAQ,YAAY,KAAK,CAAA,CAAA;AAE/B,EAAI,IAAA,OAAA,CAAA;AACJ,EAAA,QAAQ,MAAM,IAAM;AAAA,IAChB,KAAK,SAAA;AACD,MAAU,OAAA,GAAA,IAAA,CAAA;AACV,MAAA,MAAA;AAAA,IACJ,KAAK,UAAA;AACD,MAAU,OAAA,mBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,SAAA,EAAU,WAAa,EAAA,QAAA,EAAA,IAAA,CAAK,cAAc,EAAE,EAAA,EAAI,OAAQ,EAAC,CAA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CAAA,CAAA;AAGL,EAAA,SAAA,CAAU,MAAM;AACZ,IAAA,OAAA,CAAQ,KAAQ,GAAA,aAAA;AAAA,MACZ,KAAM,CAAA,eAAA;AAAA,MACN,KAAM,CAAA,iBAAA;AAAA,MACN,KAAM,CAAA,kBAAA;AAAA,KACV,CAAA;AAAA,GACJ,EAAG,CAAC,OAAS,EAAA,KAAA,CAAM,iBAAiB,KAAM,CAAA,iBAAA,EAAmB,KAAM,CAAA,kBAAkB,CAAC,CAAA,CAAA;AAEtF,EAAO,OAAA,KAAA,CAAA;AACX,CAAA;AAEA,SAAS,aAAA,CACL,eACA,EAAA,iBAAA,EACA,WACgB,EAAA;AAChB,EAAO,OAAA;AAAA,IACH,iBAAiB,eAAmB,IAAA,IAAA;AAAA,IACpC,mBAAmB,iBAAqB,IAAA,KAAA;AAAA,IACxC,oBAAoB,WAAe,IAAA,KAAA;AAAA,GACvC,CAAA;AACJ;;;;"}
1
+ {"version":3,"file":"Toc.js","sources":["Toc.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { reactive, reactiveMap } from \"@conterra/reactivity-core\";\nimport { BasemapSwitcher, BasemapSwitcherProps } from \"@open-pioneer/basemap-switcher\";\nimport { Box, Flex, Spacer, Text } from \"@open-pioneer/chakra-integration\";\nimport { MapModel, MapModelProps, useMapModel } from \"@open-pioneer/map\";\nimport {\n CommonComponentProps,\n SectionHeading,\n TitledSection,\n useCommonComponentProps\n} from \"@open-pioneer/react-utils\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, ReactNode, useEffect, useId, useMemo, useRef } from \"react\";\nimport { TocItem, TocModel, TocModelProvider, TocWidgetOptions } from \"../model/TocModel\";\nimport { TopLevelLayerList } from \"./LayerList/LayerList\";\nimport { Tools } from \"./Tools\";\n\n/**\n * Props supported by the {@link Toc} component.\n */\nexport interface TocProps extends CommonComponentProps, MapModelProps {\n /**\n * Defines whether the tool component is shown in the toc.\n *\n * Defaults to `false`.\n */\n showTools?: boolean;\n\n /**\n * Properties for the embedded tool component.\n */\n toolsConfig?: ToolsConfig;\n\n /**\n * Defines whether the basemap switcher is shown in the toc.\n *\n * Defaults to `true`.\n */\n showBasemapSwitcher?: boolean;\n\n /**\n * Properties for the embedded basemap switcher.\n *\n * Property `mapId` is not applied (the basemap switcher uses the same map as the).\n */\n basemapSwitcherProps?: Omit<BasemapSwitcherProps, \"mapId\">;\n\n /**\n * If `true`, groups in the toc can be collapsed and expanded.\n * This property should only be `true` if the map actually contains layer groups.\n *\n * Defaults to `false`.\n */\n collapsibleGroups?: boolean;\n\n /**\n * If `true` groups in the toc are collapsed initially.\n *\n * Defaults to `false`. If {@link collapsibleGroups} is `false` this property should also be `false`. Otherwise only the top level layers will appear in the toc.\n */\n initiallyCollapsed?: boolean;\n\n /**\n * Show the parent layers when a child layer is made visible.\n *\n * Defaults to `true`.\n */\n autoShowParents?: boolean;\n}\n\n/**\n * Props supported by the {@link Tools} component.\n */\nexport interface ToolsConfig {\n /**\n * Optional property to show the `hide all layers` entry.\n *\n * Defaults to `true`.\n */\n showHideAllLayers?: boolean;\n\n /**\n * Optional property to show the `collapse all groups` entry.\n *\n * Defaults to `true`. Only applicable if {@link TocProps.collapsibleGroups} is `true`.\n */\n showCollapseAllGroups?: boolean;\n}\n\nconst PADDING = 2;\n\n/**\n * Displays the layers of the configured map.\n */\nexport const Toc: FC<TocProps> = (props: TocProps) => {\n const intl = useIntl();\n const { containerProps } = useCommonComponentProps(\"toc\", props);\n const state = useMapModel(props);\n\n let content: ReactNode | null;\n switch (state.kind) {\n case \"loading\":\n content = null;\n break;\n case \"rejected\":\n content = <Text className=\"toc-error\">{intl.formatMessage({ id: \"error\" })}</Text>;\n break;\n case \"resolved\": {\n const map = state.map;\n content = <TocContent {...props} map={map} />;\n break;\n }\n }\n\n return (\n <Flex {...containerProps} direction=\"column\" gap={PADDING}>\n {content}\n </Flex>\n );\n};\n\n/** This component is rendered once we have a reference to the loaded map model. */\nfunction TocContent(props: TocProps & { map: MapModel }) {\n const {\n map,\n showTools = false,\n toolsConfig,\n showBasemapSwitcher = true,\n basemapSwitcherProps\n } = props;\n const intl = useIntl();\n const model = useTocModel(props);\n const basemapsHeadingId = useId();\n const basemapSwitcher = showBasemapSwitcher && (\n <Box className=\"toc-basemap-switcher\">\n <TitledSection\n title={\n <SectionHeading id={basemapsHeadingId} size={\"sm\"} mb={PADDING}>\n {intl.formatMessage({ id: \"basemapsLabel\" })}\n </SectionHeading>\n }\n >\n <BasemapSwitcher\n map={map}\n aria-labelledby={basemapsHeadingId}\n {...basemapSwitcherProps}\n />\n </TitledSection>\n </Box>\n );\n\n const layerList = (\n <Box className=\"toc-operational-layers\">\n <TitledSection\n title={\n <SectionHeading size={\"sm\"} mb={2}>\n <Flex>\n <Text my={3}>\n {intl.formatMessage({\n id: \"operationalLayerLabel\"\n })}\n </Text>\n <Spacer />\n {showTools && <Tools map={map} {...toolsConfig} />}\n </Flex>\n </SectionHeading>\n }\n >\n <TopLevelLayerList\n map={map}\n aria-label={intl.formatMessage({ id: \"operationalLayerLabel\" })}\n />\n </TitledSection>\n </Box>\n );\n\n return (\n <TocModelProvider value={model}>\n {basemapSwitcher}\n {layerList}\n </TocModelProvider>\n );\n}\n\nfunction useTocModel(props: TocProps): TocModel {\n const initialProps = useRef(props);\n const { model, options } = useMemo(() => {\n const options = reactive<TocWidgetOptions>(\n createOptions(\n initialProps.current.autoShowParents,\n initialProps.current.collapsibleGroups,\n initialProps.current.initiallyCollapsed\n )\n );\n\n // Indexed by layerId\n const items = reactiveMap<string, TocItem>();\n const model: TocModel = {\n get options() {\n return options.value;\n },\n getItem(layerId: string): TocItem | undefined {\n return items.get(layerId);\n },\n getItems(): TocItem[] {\n return Array.from(items.values());\n },\n registerItem(item: TocItem): void {\n if (items.has(item.layerId)) {\n throw new Error(`Item with layerId '${item.layerId}' already registered.`);\n }\n items.set(item.layerId, item);\n },\n unregisterItem(item: TocItem): void {\n if (items.get(item.layerId) !== item) {\n throw new Error(`Item with layerId '${item.layerId}' not registered.`);\n }\n items.delete(item.layerId);\n }\n };\n return { model, options };\n }, []);\n\n // Sync props to model\n useEffect(() => {\n options.value = createOptions(\n props.autoShowParents,\n props.collapsibleGroups,\n props.initiallyCollapsed\n );\n }, [options, props.autoShowParents, props.collapsibleGroups, props.initiallyCollapsed]);\n\n return model;\n}\n\nfunction createOptions(\n autoShowParents?: boolean | undefined,\n collapsibleGroups?: boolean | undefined,\n isCollapsed?: boolean | undefined\n): TocWidgetOptions {\n return {\n autoShowParents: autoShowParents ?? true,\n collapsibleGroups: collapsibleGroups ?? false,\n initiallyCollapsed: isCollapsed ?? false\n };\n}\n"],"names":["options","model"],"mappings":";;;;;;;;;;;;AA0FA,MAAM,OAAU,GAAA,CAAA;AAKH,MAAA,GAAA,GAAoB,CAAC,KAAoB,KAAA;AAClD,EAAA,MAAM,OAAO,OAAQ,EAAA;AACrB,EAAA,MAAM,EAAE,cAAA,EAAmB,GAAA,uBAAA,CAAwB,OAAO,KAAK,CAAA;AAC/D,EAAM,MAAA,KAAA,GAAQ,YAAY,KAAK,CAAA;AAE/B,EAAI,IAAA,OAAA;AACJ,EAAA,QAAQ,MAAM,IAAM;AAAA,IAChB,KAAK,SAAA;AACD,MAAU,OAAA,GAAA,IAAA;AACV,MAAA;AAAA,IACJ,KAAK,UAAA;AACD,MAAU,OAAA,mBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,SAAA,EAAU,WAAa,EAAA,QAAA,EAAA,IAAA,CAAK,cAAc,EAAE,EAAA,EAAI,OAAQ,EAAC,CAAE,EAAA,CAAA;AAC3E,MAAA;AAAA,IACJ,KAAK,UAAY,EAAA;AACb,MAAA,MAAM,MAAM,KAAM,CAAA,GAAA;AAClB,MAAA,OAAA,mBAAW,GAAA,CAAA,UAAA,EAAA,EAAY,GAAG,KAAA,EAAO,GAAU,EAAA,CAAA;AAC3C,MAAA;AAAA;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,oBAAoB,WAAe,IAAA;AAAA,GACvC;AACJ;;;;"}
package/ui/Tools.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Tools.js","sources":["Tools.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport {\n Box,\n Button,\n Menu,\n MenuButton,\n MenuItem,\n MenuList,\n Portal\n} from \"@open-pioneer/chakra-integration\";\nimport { AnyLayer, MapModel } from \"@open-pioneer/map\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, memo } from \"react\";\nimport { FiMoreVertical } from \"react-icons/fi\";\nimport { TocModel, useTocModel } from \"../model/TocModel\";\nimport { ToolsConfig } from \"./Toc\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\n\nexport interface ToolsProps extends ToolsConfig {\n map: MapModel;\n}\n\nexport const Tools: FC<ToolsProps> = memo(function Tools(props: ToolsProps) {\n const intl = useIntl();\n const tocModel = useTocModel();\n const collapsibleGroups = useReactiveSnapshot(\n () => tocModel.options.collapsibleGroups,\n [tocModel]\n );\n const {\n map,\n showHideAllLayers = true,\n showCollapseAllGroups: showCollapseAllGroupsProp = collapsibleGroups\n } = props;\n\n // Only respected if groups are collapsible\n const showCollapseAllGroups = collapsibleGroups && showCollapseAllGroupsProp;\n const hasContent = showHideAllLayers || showCollapseAllGroups;\n return (\n hasContent && (\n <Box className=\"toc-tools\">\n <Menu placement=\"bottom-start\">\n <MenuButton\n as={Button}\n className=\"toc-tools-button\"\n aria-label={intl.formatMessage({ id: \"toolsLabel\" })}\n borderRadius=\"full\"\n iconSpacing={0}\n padding={3}\n variant=\"ghost\"\n leftIcon={<FiMoreVertical />}\n />\n <Portal>\n <MenuList className=\"tools-menu\">\n {showHideAllLayers && (\n <MenuItem\n aria-label={intl.formatMessage({ id: \"tools.hideAllLayers\" })}\n onClick={() => {\n hideAllLayers(map);\n }}\n >\n {intl.formatMessage({ id: \"tools.hideAllLayers\" })}\n </MenuItem>\n )}\n {showCollapseAllGroups && (\n <MenuItem\n aria-label={intl.formatMessage({\n id: \"tools.collapseAllGroups\"\n })}\n onClick={() => {\n collapseAllGroups(tocModel);\n }}\n >\n {intl.formatMessage({ id: \"tools.collapseAllGroups\" })}\n </MenuItem>\n )}\n </MenuList>\n </Portal>\n </Menu>\n </Box>\n )\n );\n});\n\nfunction hideAllLayers(map: MapModel | undefined) {\n const hide = (layer: AnyLayer) => {\n layer.setVisible(false);\n\n const children = layer.children?.getItems();\n if (children) {\n for (const child of children) {\n hide(child);\n }\n }\n };\n\n map?.layers.getOperationalLayers().forEach((layer) => {\n hide(layer);\n });\n}\n\nfunction collapseAllGroups(tocModel: TocModel) {\n tocModel.getItems().forEach((item) => item.setExpanded(false));\n}\n"],"names":["Tools"],"mappings":";;;;;;;;AAuBO,MAAM,KAAwB,GAAA,IAAA,CAAK,SAASA,MAAAA,CAAM,KAAmB,EAAA;AACxE,EAAA,MAAM,OAAO,OAAQ,EAAA,CAAA;AACrB,EAAA,MAAM,WAAW,WAAY,EAAA,CAAA;AAC7B,EAAA,MAAM,iBAAoB,GAAA,mBAAA;AAAA,IACtB,MAAM,SAAS,OAAQ,CAAA,iBAAA;AAAA,IACvB,CAAC,QAAQ,CAAA;AAAA,GACb,CAAA;AACA,EAAM,MAAA;AAAA,IACF,GAAA;AAAA,IACA,iBAAoB,GAAA,IAAA;AAAA,IACpB,uBAAuB,yBAA4B,GAAA,iBAAA;AAAA,GACnD,GAAA,KAAA,CAAA;AAGJ,EAAA,MAAM,wBAAwB,iBAAqB,IAAA,yBAAA,CAAA;AACnD,EAAA,MAAM,aAAa,iBAAqB,IAAA,qBAAA,CAAA;AACxC,EACI,OAAA,UAAA,wBACK,GAAI,EAAA,EAAA,SAAA,EAAU,aACX,QAAC,kBAAA,IAAA,CAAA,IAAA,EAAA,EAAK,WAAU,cACZ,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,UA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AAC9C,EAAM,MAAA,IAAA,GAAO,CAAC,KAAoB,KAAA;AAC9B,IAAA,KAAA,CAAM,WAAW,KAAK,CAAA,CAAA;AAEtB,IAAM,MAAA,QAAA,GAAW,KAAM,CAAA,QAAA,EAAU,QAAS,EAAA,CAAA;AAC1C,IAAA,IAAI,QAAU,EAAA;AACV,MAAA,KAAA,MAAW,SAAS,QAAU,EAAA;AAC1B,QAAA,IAAA,CAAK,KAAK,CAAA,CAAA;AAAA,OACd;AAAA,KACJ;AAAA,GACJ,CAAA;AAEA,EAAA,GAAA,EAAK,MAAO,CAAA,oBAAA,EAAuB,CAAA,OAAA,CAAQ,CAAC,KAAU,KAAA;AAClD,IAAA,IAAA,CAAK,KAAK,CAAA,CAAA;AAAA,GACb,CAAA,CAAA;AACL,CAAA;AAEA,SAAS,kBAAkB,QAAoB,EAAA;AAC3C,EAAS,QAAA,CAAA,QAAA,GAAW,OAAQ,CAAA,CAAC,SAAS,IAAK,CAAA,WAAA,CAAY,KAAK,CAAC,CAAA,CAAA;AACjE;;;;"}
1
+ {"version":3,"file":"Tools.js","sources":["Tools.tsx"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport {\n Box,\n Button,\n Menu,\n MenuButton,\n MenuItem,\n MenuList,\n Portal\n} from \"@open-pioneer/chakra-integration\";\nimport { AnyLayer, MapModel } from \"@open-pioneer/map\";\nimport { useIntl } from \"open-pioneer:react-hooks\";\nimport { FC, memo } from \"react\";\nimport { FiMoreVertical } from \"react-icons/fi\";\nimport { TocModel, useTocModel } from \"../model/TocModel\";\nimport { ToolsConfig } from \"./Toc\";\nimport { useReactiveSnapshot } from \"@open-pioneer/reactivity\";\n\nexport interface ToolsProps extends ToolsConfig {\n map: MapModel;\n}\n\nexport const Tools: FC<ToolsProps> = memo(function Tools(props: ToolsProps) {\n const intl = useIntl();\n const tocModel = useTocModel();\n const collapsibleGroups = useReactiveSnapshot(\n () => tocModel.options.collapsibleGroups,\n [tocModel]\n );\n const {\n map,\n showHideAllLayers = true,\n showCollapseAllGroups: showCollapseAllGroupsProp = collapsibleGroups\n } = props;\n\n // Only respected if groups are collapsible\n const showCollapseAllGroups = collapsibleGroups && showCollapseAllGroupsProp;\n const hasContent = showHideAllLayers || showCollapseAllGroups;\n return (\n hasContent && (\n <Box className=\"toc-tools\">\n <Menu placement=\"bottom-start\">\n <MenuButton\n as={Button}\n className=\"toc-tools-button\"\n aria-label={intl.formatMessage({ id: \"toolsLabel\" })}\n borderRadius=\"full\"\n iconSpacing={0}\n padding={3}\n variant=\"ghost\"\n leftIcon={<FiMoreVertical />}\n />\n <Portal>\n <MenuList className=\"tools-menu\">\n {showHideAllLayers && (\n <MenuItem\n aria-label={intl.formatMessage({ id: \"tools.hideAllLayers\" })}\n onClick={() => {\n hideAllLayers(map);\n }}\n >\n {intl.formatMessage({ id: \"tools.hideAllLayers\" })}\n </MenuItem>\n )}\n {showCollapseAllGroups && (\n <MenuItem\n aria-label={intl.formatMessage({\n id: \"tools.collapseAllGroups\"\n })}\n onClick={() => {\n collapseAllGroups(tocModel);\n }}\n >\n {intl.formatMessage({ id: \"tools.collapseAllGroups\" })}\n </MenuItem>\n )}\n </MenuList>\n </Portal>\n </Menu>\n </Box>\n )\n );\n});\n\nfunction hideAllLayers(map: MapModel | undefined) {\n const hide = (layer: AnyLayer) => {\n layer.setVisible(false);\n\n const children = layer.children?.getItems();\n if (children) {\n for (const child of children) {\n hide(child);\n }\n }\n };\n\n map?.layers.getOperationalLayers().forEach((layer) => {\n hide(layer);\n });\n}\n\nfunction collapseAllGroups(tocModel: TocModel) {\n tocModel.getItems().forEach((item) => item.setExpanded(false));\n}\n"],"names":["Tools"],"mappings":";;;;;;;;AAuBO,MAAM,KAAwB,GAAA,IAAA,CAAK,SAASA,MAAAA,CAAM,KAAmB,EAAA;AACxE,EAAA,MAAM,OAAO,OAAQ,EAAA;AACrB,EAAA,MAAM,WAAW,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AI,uBAAuB;AAAA;AAAA,OACrD;AAAA,MAEH,qBACG,oBAAA,GAAA;AAAA,QAAC,QAAA;AAAA,QAAA;AAAA,UACG,YAAA,EAAY,KAAK,aAAc,CAAA;AAAA,YAC3B,EAAI,EAAA;AAAA,WACP,CAAA;AAAA,UACD,SAAS,MAAM;AACX,YAAA,iBAAA,CAAkB,QAAQ,CAAA;AAAA,WAC9B;AAAA,UAEC,QAAK,EAAA,IAAA,CAAA,aAAA,CAAc,EAAE,EAAA,EAAI,2BAA2B;AAAA;AAAA;AACzD,KAAA,EAER,CACJ,EAAA;AAAA,GAAA,EACJ,CACJ,EAAA,CAAA;AAGZ,CAAC;AAED,SAAS,cAAc,GAA2B,EAAA;AAC9C,EAAM,MAAA,IAAA,GAAO,CAAC,KAAoB,KAAA;AAC9B,IAAA,KAAA,CAAM,WAAW,KAAK,CAAA;AAEtB,IAAM,MAAA,QAAA,GAAW,KAAM,CAAA,QAAA,EAAU,QAAS,EAAA;AAC1C,IAAA,IAAI,QAAU,EAAA;AACV,MAAA,KAAA,MAAW,SAAS,QAAU,EAAA;AAC1B,QAAA,IAAA,CAAK,KAAK,CAAA;AAAA;AACd;AACJ,GACJ;AAEA,EAAA,GAAA,EAAK,MAAO,CAAA,oBAAA,EAAuB,CAAA,OAAA,CAAQ,CAAC,KAAU,KAAA;AAClD,IAAA,IAAA,CAAK,KAAK,CAAA;AAAA,GACb,CAAA;AACL;AAEA,SAAS,kBAAkB,QAAoB,EAAA;AAC3C,EAAS,QAAA,CAAA,QAAA,GAAW,OAAQ,CAAA,CAAC,SAAS,IAAK,CAAA,WAAA,CAAY,KAAK,CAAC,CAAA;AACjE;;;;"}
package/utils/slug.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"slug.js","sources":["slug.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Strips special characters from the given string, making it suitable\n * for use in CSS classes.\n */\nexport function slug(id: string): string {\n return id\n .toLowerCase()\n .replace(/[^a-z0-9 -]/g, \"\")\n .replace(/\\s+/g, \"-\")\n .replace(/-+/g, \"-\");\n}\n"],"names":[],"mappings":"AAOO,SAAS,KAAK,EAAoB,EAAA;AACrC,EAAA,OAAO,EACF,CAAA,WAAA,EACA,CAAA,OAAA,CAAQ,cAAgB,EAAA,EAAE,CAC1B,CAAA,OAAA,CAAQ,MAAQ,EAAA,GAAG,CACnB,CAAA,OAAA,CAAQ,OAAO,GAAG,CAAA,CAAA;AAC3B;;;;"}
1
+ {"version":3,"file":"slug.js","sources":["slug.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023-2025 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Strips special characters from the given string, making it suitable\n * for use in CSS classes.\n */\nexport function slug(id: string): string {\n return id\n .toLowerCase()\n .replace(/[^a-z0-9 -]/g, \"\")\n .replace(/\\s+/g, \"-\")\n .replace(/-+/g, \"-\");\n}\n"],"names":[],"mappings":"AAOO,SAAS,KAAK,EAAoB,EAAA;AACrC,EAAA,OAAO,EACF,CAAA,WAAA,EACA,CAAA,OAAA,CAAQ,cAAgB,EAAA,EAAE,CAC1B,CAAA,OAAA,CAAQ,MAAQ,EAAA,GAAG,CACnB,CAAA,OAAA,CAAQ,OAAO,GAAG,CAAA;AAC3B;;;;"}