@panoramax/web-viewer 4.0.2 → 4.0.3-develop-d59993ce

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.
Files changed (57) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/build/index.css +2 -2
  3. package/build/index.css.map +1 -1
  4. package/build/index.js +287 -72
  5. package/build/index.js.map +1 -1
  6. package/config/jest/mocks.js +5 -0
  7. package/docs/09_Develop.md +6 -0
  8. package/docs/reference/components/core/PhotoViewer.md +1 -0
  9. package/docs/reference/components/core/Viewer.md +2 -1
  10. package/docs/reference/components/menus/AnnotationsList.md +16 -0
  11. package/docs/reference/components/ui/HashTags.md +15 -0
  12. package/docs/reference/components/ui/ListItem.md +38 -0
  13. package/docs/reference/components/ui/Photo.md +78 -1
  14. package/docs/reference/components/ui/SemanticsTable.md +32 -0
  15. package/docs/reference/components/ui/widgets/GeoSearch.md +5 -1
  16. package/docs/reference/utils/PresetsManager.md +35 -0
  17. package/docs/reference.md +4 -0
  18. package/mkdocs.yml +4 -0
  19. package/package.json +2 -1
  20. package/src/components/core/Basic.css +2 -0
  21. package/src/components/core/PhotoViewer.js +11 -0
  22. package/src/components/core/Viewer.js +8 -1
  23. package/src/components/layout/Tabs.js +1 -1
  24. package/src/components/menus/AnnotationsList.js +151 -0
  25. package/src/components/menus/PictureLegend.js +6 -5
  26. package/src/components/menus/PictureMetadata.js +80 -8
  27. package/src/components/menus/index.js +1 -0
  28. package/src/components/styles.js +34 -0
  29. package/src/components/ui/HashTags.js +98 -0
  30. package/src/components/ui/ListItem.js +83 -0
  31. package/src/components/ui/Photo.js +188 -0
  32. package/src/components/ui/SemanticsTable.js +87 -0
  33. package/src/components/ui/index.js +3 -0
  34. package/src/components/ui/widgets/GeoSearch.js +13 -5
  35. package/src/img/osm.svg +49 -0
  36. package/src/img/wd.svg +1 -0
  37. package/src/translations/en.json +23 -0
  38. package/src/translations/fr.json +21 -0
  39. package/src/translations/it.json +28 -1
  40. package/src/translations/nl.json +14 -4
  41. package/src/translations/zh_Hant.json +6 -1
  42. package/src/utils/PresetsManager.js +137 -0
  43. package/src/utils/URLHandler.js +1 -1
  44. package/src/utils/geocoder.js +135 -83
  45. package/src/utils/index.js +3 -1
  46. package/src/utils/picture.js +28 -0
  47. package/src/utils/semantics.js +162 -0
  48. package/src/utils/services.js +39 -1
  49. package/src/utils/widgets.js +18 -1
  50. package/tests/components/core/__snapshots__/PhotoViewer.test.js.snap +10 -0
  51. package/tests/components/core/__snapshots__/Viewer.test.js.snap +10 -0
  52. package/tests/data/Map_geocoder_nominatim.json +25 -40
  53. package/tests/utils/PresetsManager.test.js +123 -0
  54. package/tests/utils/URLHandler.test.js +42 -0
  55. package/tests/utils/__snapshots__/geocoder.test.js.snap +5 -16
  56. package/tests/utils/geocoder.test.js +1 -1
  57. package/tests/utils/semantics.test.js +125 -0
@@ -197,6 +197,11 @@ jest.mock("@photo-sphere-viewer/virtual-tour-plugin", () => ({
197
197
  }));
198
198
 
199
199
 
200
+ jest.mock("@photo-sphere-viewer/markers-plugin", () => ({
201
+ MarkersPlugin: jest.fn(),
202
+ }));
203
+
204
+
200
205
  jest.mock("query-selector-shadow-dom", () => ({
201
206
  querySelectorDeep: jest.fn(),
202
207
  }));
@@ -58,6 +58,12 @@ This means that, when developing, if you want to check if your attributes are we
58
58
 
59
59
  All third-party services URL (like geocoding API, OSM iD editor) are grouped into a dedicated `src/utils/services.js` file. You can easily change them to deploy a custom version of the viewer.
60
60
 
61
+ ### Presets for semantics
62
+
63
+ The semantics system for sequences, pictures and annotations make use of __tagging presets__. These are JSON files hosted at [presets.panoramax.fr](https://presets.panoramax.fr/), they have their [dedicated Gitlab repository](https://gitlab.com/panoramax/server/tagging-presets).
64
+
65
+ In the viewer, they show up through icons and translated labels associated to pictures & annotations. If you want to change them, you have to edit them in Gitlab repository. Viewer automatically loads hosted files at start.
66
+
61
67
  ## Testing
62
68
 
63
69
  We're trying to make Panoramax as reliable and secure as possible. To ensure this, we rely heavily on code testing. A variety of testing tools is made available:
@@ -22,6 +22,7 @@
22
22
  | grid | [<code>CorneredGrid</code>](../layout/CorneredGrid.md/#Panoramax.components.layout.CorneredGrid) | The grid layout manager |
23
23
  | popup | [<code>Popup</code>](../ui/Popup.md/#Panoramax.components.ui.Popup) | The popup container |
24
24
  | urlHandler | [<code>URLHandler</code>](../../utils/URLHandler.md/#Panoramax.utils.URLHandler) | The URL query parameters manager |
25
+ | presetsManager | [<code>PresetsManager</code>](../../utils/PresetsManager.md/#Panoramax.utils.PresetsManager) | The semantics presets manager |
25
26
 
26
27
 
27
28
  * [.PhotoViewer](#Panoramax.components.core.PhotoViewer) ⇐ [<code>Basic</code>](Basic.md/#Panoramax.components.core.Basic)
@@ -24,6 +24,7 @@
24
24
  | mini | [<code>Mini</code>](../layout/Mini.md/#Panoramax.components.layout.Mini) | The reduced/collapsed map/photo component |
25
25
  | popup | [<code>Popup</code>](../ui/Popup.md/#Panoramax.components.ui.Popup) | The popup container |
26
26
  | urlHandler | [<code>URLHandler</code>](../../utils/URLHandler.md/#Panoramax.utils.URLHandler) | The URL query parameters manager |
27
+ | presetsManager | [<code>PresetsManager</code>](../../utils/PresetsManager.md/#Panoramax.utils.PresetsManager) | The semantics presets manager |
27
28
 
28
29
 
29
30
  * [.Viewer](#Panoramax.components.core.Viewer) ⇐ [<code>PhotoViewer</code>](PhotoViewer.md/#Panoramax.components.core.PhotoViewer)
@@ -114,7 +115,7 @@ Component properties. All of [Basic properties](Basic.md/#Panoramax.components.c
114
115
  | [psv] | <code>object</code> | | [Any option to pass to Photo component](../ui/Photo.md/#Panoramax.components.ui.Photo) as an object.<br />Example: `psv="{'transitionDuration': 500, 'picturesNavigation': 'pic'}"` |
115
116
  | [url-parameters] | <code>string</code> | <code>true</code> | Should the component add and update URL query parameters to save viewer state ? |
116
117
  | [focus] | <code>string</code> | <code>&quot;pic&quot;</code> | The component showing up as main component (pic, map) |
117
- | [geocoder] | <code>string</code> | <code>&quot;nominatim&quot;</code> | The geocoder engine to use (nominatim, ban) |
118
+ | [geocoder] | <code>string</code> | <code>&quot;nominatim&quot;</code> | The geocoder engine to use (nominatim, ban, or URL to a standard [GeocodeJSON-compliant](https://github.com/geocoders/geocodejson-spec/blob/master/draft/README.md) API) |
118
119
  | [widgets] | <code>string</code> | <code>true</code> | Use default set of widgets ? Set to false to avoid any widget to show up, and use slots to populate as you like. |
119
120
  | [picture] | <code>string</code> | | The picture ID to display |
120
121
  | [sequence] | <code>string</code> | | The sequence ID of the picture displayed |
@@ -0,0 +1,16 @@
1
+ <a name="Panoramax.components.menus.AnnotationsList"></a>
2
+
3
+ ## Panoramax.components.menus.AnnotationsList ⇐ <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
4
+ **Kind**: static class of <code>Panoramax.components.menus</code>
5
+ **Extends**: <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
6
+ **Element**: pnx-annotations-list
7
+ <a name="new_Panoramax.components.menus.AnnotationsList_new"></a>
8
+
9
+ ### new AnnotationsList()
10
+ Annotations list shows listing of tagged picture areas.
11
+ It uses the parent component currently selected picture.
12
+
13
+ **Example**
14
+ ```html
15
+ <pnx-annotations-list _parent=${viewer} />
16
+ ```
@@ -0,0 +1,15 @@
1
+ <a name="Panoramax.components.ui.HashTags"></a>
2
+
3
+ ## Panoramax.components.ui.HashTags ⇐ <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
4
+ **Kind**: static class of <code>Panoramax.components.ui</code>
5
+ **Extends**: <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
6
+ **Element**: pnx-hashtags
7
+ <a name="new_Panoramax.components.ui.HashTags_new"></a>
8
+
9
+ ### new HashTags()
10
+ HashTags component shows the list of hashtags associated to a picture.
11
+
12
+ **Example**
13
+ ```html
14
+ <pnx-hashtags ._parent=${viewer} />
15
+ ```
@@ -0,0 +1,38 @@
1
+ <a name="Panoramax.components.ui.ListItem"></a>
2
+
3
+ ## Panoramax.components.ui.ListItem ⇐ <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
4
+ **Kind**: static class of <code>Panoramax.components.ui</code>
5
+ **Extends**: <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
6
+ **Element**: pnx-list-item
7
+ **Slot**: `icon` The left icon (symbol for this item)
8
+ **Slot**: `action` The right icon (symbol for an interactive action)
9
+
10
+ * [.ListItem](#Panoramax.components.ui.ListItem) ⇐ <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
11
+ * [new ListItem()](#new_Panoramax.components.ui.ListItem_new)
12
+ * [.properties](#Panoramax.components.ui.ListItem+properties) : <code>Object</code>
13
+
14
+ <a name="new_Panoramax.components.ui.ListItem_new"></a>
15
+
16
+ ### new ListItem()
17
+ ListItem is a list entry, in a Material Design fashion.
18
+
19
+ **Example**
20
+ ```html
21
+ <pnx-list-item title="My feature" subtitle="It is very cool">
22
+ <img src="..." slot="icon" />
23
+ <img src="..." slot="action" />
24
+ </pnx-list-item>
25
+ ```
26
+ <a name="Panoramax.components.ui.ListItem+properties"></a>
27
+
28
+ ### listItem.properties : <code>Object</code>
29
+ Component properties.
30
+
31
+ **Kind**: instance property of [<code>ListItem</code>](#Panoramax.components.ui.ListItem)
32
+ **Properties**
33
+
34
+ | Name | Type | Description |
35
+ | --- | --- | --- |
36
+ | title | <code>string</code> | The item title |
37
+ | [subtitle] | <code>string</code> | The item subtitle |
38
+
@@ -3,7 +3,7 @@
3
3
  ## Panoramax.components.ui.Photo ⇐ <code>[photo-sphere-viewer.core.Viewer](https://photo-sphere-viewer.js.org/api/classes/Core.Viewer.html)</code>
4
4
  **Kind**: static class of <code>Panoramax.components.ui</code>
5
5
  **Extends**: <code>[photo-sphere-viewer.core.Viewer](https://photo-sphere-viewer.js.org/api/classes/Core.Viewer.html)</code>
6
- **Emits**: [<code>picture-loading</code>](#Panoramax.components.ui.Photo+event_picture-loading), [<code>picture-preview-started</code>](#Panoramax.components.ui.Photo+event_picture-preview-started), [<code>picture-preview-stopped</code>](#Panoramax.components.ui.Photo+event_picture-preview-stopped), [<code>view-rotated</code>](#Panoramax.components.ui.Photo+event_view-rotated), [<code>picture-loaded</code>](#Panoramax.components.ui.Photo+event_picture-loaded), [<code>picture-tiles-loaded</code>](#Panoramax.components.ui.Photo+event_picture-tiles-loaded), [<code>transition-duration-changed</code>](#Panoramax.components.ui.Photo+event_transition-duration-changed), [<code>sequence-playing</code>](#Panoramax.components.ui.Photo+event_sequence-playing), [<code>sequence-stopped</code>](#Panoramax.components.ui.Photo+event_sequence-stopped), [<code>pictures-navigation-changed</code>](#Panoramax.components.ui.Photo+event_pictures-navigation-changed), [<code>ready</code>](#Panoramax.components.ui.Photo+event_ready)
6
+ **Emits**: [<code>picture-loading</code>](#Panoramax.components.ui.Photo+event_picture-loading), [<code>picture-preview-started</code>](#Panoramax.components.ui.Photo+event_picture-preview-started), [<code>picture-preview-stopped</code>](#Panoramax.components.ui.Photo+event_picture-preview-stopped), [<code>view-rotated</code>](#Panoramax.components.ui.Photo+event_view-rotated), [<code>picture-loaded</code>](#Panoramax.components.ui.Photo+event_picture-loaded), [<code>picture-tiles-loaded</code>](#Panoramax.components.ui.Photo+event_picture-tiles-loaded), [<code>transition-duration-changed</code>](#Panoramax.components.ui.Photo+event_transition-duration-changed), [<code>sequence-playing</code>](#Panoramax.components.ui.Photo+event_sequence-playing), [<code>sequence-stopped</code>](#Panoramax.components.ui.Photo+event_sequence-stopped), [<code>pictures-navigation-changed</code>](#Panoramax.components.ui.Photo+event_pictures-navigation-changed), [<code>ready</code>](#Panoramax.components.ui.Photo+event_ready), [<code>annotations-toggled</code>](#Panoramax.components.ui.Photo+event_annotations-toggled), [<code>annotation-click</code>](#Panoramax.components.ui.Photo+event_annotation-click), [<code>annotations-unfocused</code>](#Panoramax.components.ui.Photo+event_annotations-unfocused)
7
7
 
8
8
  * [.Photo](#Panoramax.components.ui.Photo) ⇐ <code>[photo-sphere-viewer.core.Viewer](https://photo-sphere-viewer.js.org/api/classes/Core.Viewer.html)</code>
9
9
  * [new Photo(parent, container, [options])](#new_Panoramax.components.ui.Photo_new)
@@ -28,6 +28,10 @@
28
28
  * [.toggleSequencePlaying()](#Panoramax.components.ui.Photo+toggleSequencePlaying)
29
29
  * [.getPicturesNavigation()](#Panoramax.components.ui.Photo+getPicturesNavigation) ⇒ <code>string</code>
30
30
  * [.setPicturesNavigation(pn)](#Panoramax.components.ui.Photo+setPicturesNavigation)
31
+ * [.areAnnotationsVisible()](#Panoramax.components.ui.Photo+areAnnotationsVisible) ⇒ <code>boolean</code>
32
+ * [.toggleAllAnnotations(visible)](#Panoramax.components.ui.Photo+toggleAllAnnotations)
33
+ * [.focusOnAnnotation(id)](#Panoramax.components.ui.Photo+focusOnAnnotation)
34
+ * [.unfocusAnnotation([skipEvent])](#Panoramax.components.ui.Photo+unfocusAnnotation)
31
35
  * [.forceRefresh()](#Panoramax.components.ui.Photo+forceRefresh)
32
36
  * ["ready"](#Panoramax.components.ui.Photo+event_ready)
33
37
  * ["picture-loading"](#Panoramax.components.ui.Photo+event_picture-loading)
@@ -35,11 +39,14 @@
35
39
  * ["picture-preview-stopped"](#Panoramax.components.ui.Photo+event_picture-preview-stopped)
36
40
  * ["view-rotated"](#Panoramax.components.ui.Photo+event_view-rotated)
37
41
  * ["picture-loaded"](#Panoramax.components.ui.Photo+event_picture-loaded)
42
+ * ["annotation-click"](#Panoramax.components.ui.Photo+event_annotation-click)
38
43
  * ["picture-tiles-loaded"](#Panoramax.components.ui.Photo+event_picture-tiles-loaded)
39
44
  * ["transition-duration-changed"](#Panoramax.components.ui.Photo+event_transition-duration-changed)
40
45
  * ["sequence-playing"](#Panoramax.components.ui.Photo+event_sequence-playing)
41
46
  * ["sequence-stopped"](#Panoramax.components.ui.Photo+event_sequence-stopped)
42
47
  * ["pictures-navigation-changed"](#Panoramax.components.ui.Photo+event_pictures-navigation-changed)
48
+ * ["annotations-toggled"](#Panoramax.components.ui.Photo+event_annotations-toggled)
49
+ * ["annotations-unfocused"](#Panoramax.components.ui.Photo+event_annotations-unfocused)
43
50
 
44
51
  <a name="new_Panoramax.components.ui.Photo_new"></a>
45
52
 
@@ -246,6 +253,46 @@ Switch the allowed navigation between pictures.
246
253
  | --- | --- | --- |
247
254
  | pn | <code>string</code> | The picture navigation mode ("any": no restriction, "seq": only pictures in same sequence, "pic": only selected picture) |
248
255
 
256
+ <a name="Panoramax.components.ui.Photo+areAnnotationsVisible"></a>
257
+
258
+ ### photo.areAnnotationsVisible() ⇒ <code>boolean</code>
259
+ Are there any picture annotations shown ?
260
+
261
+ **Kind**: instance method of [<code>Photo</code>](#Panoramax.components.ui.Photo)
262
+ **Returns**: <code>boolean</code> - True if annotations are visible
263
+ <a name="Panoramax.components.ui.Photo+toggleAllAnnotations"></a>
264
+
265
+ ### photo.toggleAllAnnotations(visible)
266
+ Toggle visibility of picture annotations
267
+
268
+ **Kind**: instance method of [<code>Photo</code>](#Panoramax.components.ui.Photo)
269
+
270
+ | Param | Type | Description |
271
+ | --- | --- | --- |
272
+ | visible | <code>boolean</code> | True to make visible, false to hide |
273
+
274
+ <a name="Panoramax.components.ui.Photo+focusOnAnnotation"></a>
275
+
276
+ ### photo.focusOnAnnotation(id)
277
+ Make view centered and zoomed on given annotation.
278
+
279
+ **Kind**: instance method of [<code>Photo</code>](#Panoramax.components.ui.Photo)
280
+
281
+ | Param | Type | Description |
282
+ | --- | --- | --- |
283
+ | id | <code>string</code> | The annotation UUID |
284
+
285
+ <a name="Panoramax.components.ui.Photo+unfocusAnnotation"></a>
286
+
287
+ ### photo.unfocusAnnotation([skipEvent])
288
+ Remove focus styling on annotations.
289
+
290
+ **Kind**: instance method of [<code>Photo</code>](#Panoramax.components.ui.Photo)
291
+
292
+ | Param | Type | Default | Description |
293
+ | --- | --- | --- | --- |
294
+ | [skipEvent] | <code>boolean</code> | <code>false</code> | Set to true to avoid launching annotations-unfocused event |
295
+
249
296
  <a name="Panoramax.components.ui.Photo+forceRefresh"></a>
250
297
 
251
298
  ### photo.forceRefresh()
@@ -335,6 +382,18 @@ Event for picture load (low-resolution image is loaded)
335
382
  | detail.z | <code>number</code> | New z position (0-100) |
336
383
  | detail.first | <code>boolean</code> | True if first picture loaded |
337
384
 
385
+ <a name="Panoramax.components.ui.Photo+event_annotation-click"></a>
386
+
387
+ ### "annotation-click"
388
+ Event launched on annotation click over picture
389
+
390
+ **Kind**: event emitted by [<code>Photo</code>](#Panoramax.components.ui.Photo)
391
+ **Properties**
392
+
393
+ | Name | Type | Description |
394
+ | --- | --- | --- |
395
+ | detail.annotationId | <code>string</code> | The annotation UUID |
396
+
338
397
  <a name="Panoramax.components.ui.Photo+event_picture-tiles-loaded"></a>
339
398
 
340
399
  ### "picture-tiles-loaded"
@@ -383,3 +442,21 @@ Event for pictures navigation mode change
383
442
  | --- | --- | --- |
384
443
  | detail.value | <code>string</code> | New mode (any, pic, seq) |
385
444
 
445
+ <a name="Panoramax.components.ui.Photo+event_annotations-toggled"></a>
446
+
447
+ ### "annotations-toggled"
448
+ Event for pictures annotation visibility change
449
+
450
+ **Kind**: event emitted by [<code>Photo</code>](#Panoramax.components.ui.Photo)
451
+ **Properties**
452
+
453
+ | Name | Type | Description |
454
+ | --- | --- | --- |
455
+ | detail.visible | <code>boolean</code> | True if they are visible |
456
+
457
+ <a name="Panoramax.components.ui.Photo+event_annotations-unfocused"></a>
458
+
459
+ ### "annotations-unfocused"
460
+ Event for pictures annotation unfocus
461
+
462
+ **Kind**: event emitted by [<code>Photo</code>](#Panoramax.components.ui.Photo)
@@ -0,0 +1,32 @@
1
+ <a name="Panoramax.components.ui.SemanticsTable"></a>
2
+
3
+ ## Panoramax.components.ui.SemanticsTable ⇐ <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
4
+ **Kind**: static class of <code>Panoramax.components.ui</code>
5
+ **Extends**: <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
6
+ **Element**: pnx-semantics-table
7
+
8
+ * [.SemanticsTable](#Panoramax.components.ui.SemanticsTable) ⇐ <code>[lit.LitElement](https://lit.dev/docs/api/LitElement/)</code>
9
+ * [new SemanticsTable()](#new_Panoramax.components.ui.SemanticsTable_new)
10
+ * [.properties](#Panoramax.components.ui.SemanticsTable+properties) : <code>Object</code>
11
+
12
+ <a name="new_Panoramax.components.ui.SemanticsTable_new"></a>
13
+
14
+ ### new SemanticsTable()
15
+ Semantics Tables display all semantics tags from either a picture or an annotation.
16
+
17
+ **Example**
18
+ ```html
19
+ <pnx-semantics-table source=${picture.properties} ._t=${viewer._t} />
20
+ ```
21
+ <a name="Panoramax.components.ui.SemanticsTable+properties"></a>
22
+
23
+ ### semanticsTable.properties : <code>Object</code>
24
+ Component properties.
25
+
26
+ **Kind**: instance property of [<code>SemanticsTable</code>](#Panoramax.components.ui.SemanticsTable)
27
+ **Properties**
28
+
29
+ | Name | Type | Description |
30
+ | --- | --- | --- |
31
+ | [source] | <code>object</code> | The picture or annotation feature (having a `semantics` property) |
32
+
@@ -16,7 +16,11 @@ Ready-to-use geocoder search bar.
16
16
 
17
17
  **Example**
18
18
  ```html
19
+ <!-- Default geocoder -->
19
20
  <pnx-widget-geosearch _parent=${viewer} />
21
+
22
+ <!-- Custom-URL geocoder -->
23
+ <pnx-widget-geosearch geocoder="https://photon.komoot.io/api" _parent=${viewer} />
20
24
  ```
21
25
  <a name="Panoramax.components.ui.widgets.GeoSearch+properties"></a>
22
26
 
@@ -28,5 +32,5 @@ Component properties.
28
32
 
29
33
  | Name | Type | Default | Description |
30
34
  | --- | --- | --- | --- |
31
- | [geocoder] | <code>string</code> | <code>&quot;nominatim&quot;</code> | The geocoder engine to use (nominatim, ban) |
35
+ | [geocoder] | <code>string</code> | <code>&quot;nominatim&quot;</code> | The geocoder engine to use (nominatim, ban, or URL to a standard [GeocodeJSON-compliant](https://github.com/geocoders/geocodejson-spec/blob/master/draft/README.md) API) |
32
36
 
@@ -0,0 +1,35 @@
1
+ <a name="Panoramax.utils.PresetsManager"></a>
2
+
3
+ ## Panoramax.utils.PresetsManager
4
+ **Kind**: static class of <code>Panoramax.utils</code>
5
+
6
+ * [.PresetsManager](#Panoramax.utils.PresetsManager)
7
+ * [new PresetsManager([lang], [skipLoad])](#new_Panoramax.utils.PresetsManager_new)
8
+ * [.onceReady()](#Panoramax.utils.PresetsManager+onceReady) ⇒ <code>Promise</code>
9
+ * [.getPreset()](#Panoramax.utils.PresetsManager+getPreset) ⇒ <code>Promise</code>
10
+
11
+ <a name="new_Panoramax.utils.PresetsManager_new"></a>
12
+
13
+ ### new PresetsManager([lang], [skipLoad])
14
+ Presets Manager handle retrieval of presets against dedicated endpoint.
15
+ It allows an easily search between all presets, and handles translations.
16
+
17
+
18
+ | Param | Type | Default | Description |
19
+ | --- | --- | --- | --- |
20
+ | [lang] | <code>string</code> | | The user prefered language. Defaults to web browser preferences. |
21
+ | [skipLoad] | <code>boolean</code> | <code>false</code> | Set to true to disable automatic load of API data |
22
+
23
+ <a name="Panoramax.utils.PresetsManager+onceReady"></a>
24
+
25
+ ### presetsManager.onceReady() ⇒ <code>Promise</code>
26
+ Resolves when the all necessary data was downloaded.
27
+
28
+ **Kind**: instance method of [<code>PresetsManager</code>](#Panoramax.utils.PresetsManager)
29
+ <a name="Panoramax.utils.PresetsManager+getPreset"></a>
30
+
31
+ ### presetsManager.getPreset() ⇒ <code>Promise</code>
32
+ Find the best matching preset for a given STAC feature.
33
+
34
+ **Kind**: instance method of [<code>PresetsManager</code>](#Panoramax.utils.PresetsManager)
35
+ **Fulfil**: <code>object\|null</code> The preset JSON that best matches, or null if no matches
package/docs/reference.md CHANGED
@@ -25,6 +25,7 @@ Layout helpers:
25
25
 
26
26
  All-in-one, ready-to-use menus for complex operations. Note that they don't embed a container (like popup or panel) to be reusable in any situation.
27
27
 
28
+ - [AnnotationsList](./reference/components/menus/AnnotationsList.md) : selected picture list of annotations (areas with tags).
28
29
  - [MapBackground](./reference/components/menus/MapBackground.md) : change map background.
29
30
  - [MapFilters](./reference/components/menus/MapFilters.md) : set map filters.
30
31
  - [MapLayers](./reference/components/menus/MapLayers.md) : change map theme and background.
@@ -44,8 +45,10 @@ Basic UI components:
44
45
  - [ButtonGroup](./reference/components/ui/ButtonGroup.md) : button bar.
45
46
  - [CopyButton](./reference/components/ui/CopyButton.md) : a copy-to-clipboard button.
46
47
  - [Grade](./reference/components/ui/Grade.md) : a 5-star rating display.
48
+ - [HashTags](./reference/components/ui/HashTags.md) : a list of hashtags associated to a picture.
47
49
  - [LinkButton](./reference/components/ui/LinkButton.md) : a link button.
48
50
  - [ListGroup](./reference/components/ui/ListGroup.md) : a menu-like list of buttons and links.
51
+ - [ListItem](./reference/components/ui/ListItem.md) : a Material Design-like list entry.
49
52
  - [Loader](./reference/components/ui/Loader.md) : the fullscreen initial loader.
50
53
  - [Map](./reference/components/ui/Map.md) : the browseable map (MapLibre GL).
51
54
  - [MapMore](./reference/components/ui/MapMore.md) : advanced version of the browseable map.
@@ -54,6 +57,7 @@ Basic UI components:
54
57
  - [ProgressBar](./reference/components/ui/ProgressBar.md) : a progress bar.
55
58
  - [QualityScore](./reference/components/ui/QualityScore.md) : a A/B/C/D/E grade display and input.
56
59
  - [SearchBar](./reference/components/ui/SearchBar.md) : a search bar.
60
+ - [SemanticsTable](./reference/components/ui/SemanticsTable.md) : table for showing complete semantic tags of a picture/annotation.
57
61
  - [TogglableGroup](./reference/components/ui/TogglableGroup.md) : an helper for showing a menu on button click.
58
62
 
59
63
 
package/mkdocs.yml CHANGED
@@ -65,6 +65,7 @@ nav:
65
65
  - Mini: 'reference/components/layout/Mini.md'
66
66
  - Tabs: 'reference/components/layout/Tabs.md'
67
67
  - menus:
68
+ - AnnotationsList: 'reference/components/menus/AnnotationsList.md'
68
69
  - MapBackground: 'reference/components/menus/MapBackground.md'
69
70
  - MapFilters: 'reference/components/menus/MapFilters.md'
70
71
  - MapLayers: 'reference/components/menus/MapLayers.md'
@@ -90,8 +91,10 @@ nav:
90
91
  - ButtonGroup: 'reference/components/ui/ButtonGroup.md'
91
92
  - CopyButton: 'reference/components/ui/CopyButton.md'
92
93
  - Grade: 'reference/components/ui/Grade.md'
94
+ - HashTags: 'reference/components/ui/HashTags.md'
93
95
  - LinkButton: 'reference/components/ui/LinkButton.md'
94
96
  - ListGroup: 'reference/components/ui/ListGroup.md'
97
+ - ListItem: 'reference/components/ui/ListItem.md'
95
98
  - Loader: 'reference/components/ui/Loader.md'
96
99
  - Map: 'reference/components/ui/Map.md'
97
100
  - MapMore: 'reference/components/ui/MapMore.md'
@@ -100,6 +103,7 @@ nav:
100
103
  - ProgressBar: 'reference/components/ui/ProgressBar.md'
101
104
  - QualityScore: 'reference/components/ui/QualityScore.md'
102
105
  - SearchBar: 'reference/components/ui/SearchBar.md'
106
+ - SemanticsTable: 'reference/components/ui/SemanticsTable.md'
103
107
  - TogglableGroup: 'reference/components/ui/TogglableGroup.md'
104
108
  - utils:
105
109
  - API: 'reference/utils/API.md'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panoramax/web-viewer",
3
- "version": "4.0.2",
3
+ "version": "4.0.3-develop-d59993ce",
4
4
  "description": "Panoramax web viewer for geolocated pictures",
5
5
  "main": "build/index.js",
6
6
  "author": "Panoramax team",
@@ -98,6 +98,7 @@
98
98
  "@photo-sphere-viewer/gallery-plugin": "5.12.1",
99
99
  "@photo-sphere-viewer/markers-plugin": "5.12.1",
100
100
  "@photo-sphere-viewer/virtual-tour-plugin": "5.12.1",
101
+ "iconify-icon": "^3.0.0",
101
102
  "json5": "^2.2.3",
102
103
  "lit": "^3.2.1",
103
104
  "maplibre-gl": "^5.3.0",
@@ -4,6 +4,7 @@
4
4
  --black: #181818;
5
5
  --black-pale: #1b1a17;
6
6
  --red: #f70000;
7
+ --red-transparent: rgba(247, 0, 0, 0.3);
7
8
  --red-pale: #ff726f;
8
9
  --grey: #f5f5f5;
9
10
  --grey-pale: #cfd2cf;
@@ -17,6 +18,7 @@
17
18
  --beige: #f5f3ec;
18
19
  --yellow: #fec868;
19
20
  --orange: #ff6f00;
21
+ --orange-transparent: rgba(255,111,0,0.3);
20
22
  --orange-pale: #fffafa;
21
23
  --green: #7ec636;
22
24
  --green-pale: #f0ffee;
@@ -9,6 +9,7 @@ import Photo, { PSV_DEFAULT_ZOOM, PSV_ANIM_DURATION } from "../ui/Photo";
9
9
  import { createWebComp } from "../../utils/widgets";
10
10
  import { isNullId } from "../../utils/utils";
11
11
  import { default as InitParameters, alterPSVState, alterMapState, alterPhotoViewerState } from "../../utils/InitParameters";
12
+ import PresetManager from "../../utils/PresetsManager";
12
13
 
13
14
 
14
15
  export const PSV_ZOOM_DELTA = 20;
@@ -32,6 +33,7 @@ const PSV_MOVE_DELTA = Math.PI / 6;
32
33
  * @property {Panoramax.components.layout.CorneredGrid} grid The grid layout manager
33
34
  * @property {Panoramax.components.ui.Popup} popup The popup container
34
35
  * @property {Panoramax.utils.URLHandler} urlHandler The URL query parameters manager
36
+ * @property {Panoramax.utils.PresetsManager} presetsManager The semantics presets manager
35
37
  * @fires Panoramax.components.core.Basic#select
36
38
  * @fires Panoramax.components.core.Basic#ready
37
39
  * @fires Panoramax.components.core.Basic#broken
@@ -133,12 +135,19 @@ export default class PhotoViewer extends Basic {
133
135
  focus: this._initParams.getParentPostInit().focus,
134
136
  picture: this._initParams.getParentPostInit().picture,
135
137
  });
138
+
136
139
  this.grid.appendChild(createWebComp("pnx-widget-zoom", {
137
140
  slot: "bottom-right",
138
141
  class: "pnx-print-hidden",
139
142
  _parent: this
140
143
  }));
141
144
  this.grid.appendChild(this.legend);
145
+
146
+ this.grid.appendChild(createWebComp("pnx-hashtags", {
147
+ slot: "top-right",
148
+ _parent: this,
149
+ class: "pnx-only-psv pnx-print-hidden",
150
+ }));
142
151
  }
143
152
  else {
144
153
  this.legend = createWebComp("pnx-picture-legend", { _parent: this });
@@ -161,6 +170,8 @@ export default class PhotoViewer extends Basic {
161
170
  connectedCallback() {
162
171
  super.connectedCallback();
163
172
 
173
+ this.presetsManager = new PresetManager(this.lang);
174
+
164
175
  if(this["url-parameters"] && this["url-parameters"] !== "false") {
165
176
  this.urlHandler = new URLHandler(this);
166
177
  this.onceReady().then(() => {
@@ -39,6 +39,7 @@ const MAP_MOVE_DELTA = 100;
39
39
  * @property {Panoramax.components.layout.Mini} mini The reduced/collapsed map/photo component
40
40
  * @property {Panoramax.components.ui.Popup} popup The popup container
41
41
  * @property {Panoramax.utils.URLHandler} urlHandler The URL query parameters manager
42
+ * @property {Panoramax.utils.PresetsManager} presetsManager The semantics presets manager
42
43
  * @fires Panoramax.components.core.Basic#select
43
44
  * @fires Panoramax.components.core.Basic#ready
44
45
  * @fires Panoramax.components.core.Basic#broken
@@ -95,7 +96,7 @@ export default class Viewer extends PhotoViewer {
95
96
  * @property {object} [psv] [Any option to pass to Photo component](#Panoramax.components.ui.Photo) as an object.<br />Example: `psv="{'transitionDuration': 500, 'picturesNavigation': 'pic'}"`
96
97
  * @property {string} [url-parameters=true] Should the component add and update URL query parameters to save viewer state ?
97
98
  * @property {string} [focus=pic] The component showing up as main component (pic, map)
98
- * @property {string} [geocoder=nominatim] The geocoder engine to use (nominatim, ban)
99
+ * @property {string} [geocoder=nominatim] The geocoder engine to use (nominatim, ban, or URL to a standard [GeocodeJSON-compliant](https://github.com/geocoders/geocodejson-spec/blob/master/draft/README.md) API)
99
100
  * @property {string} [widgets=true] Use default set of widgets ? Set to false to avoid any widget to show up, and use slots to populate as you like.
100
101
  * @property {string} [picture] The picture ID to display
101
102
  * @property {string} [sequence] The sequence ID of the picture displayed
@@ -156,6 +157,12 @@ export default class Viewer extends PhotoViewer {
156
157
  picture: this._initParams.getParentPostInit().picture,
157
158
  });
158
159
  this.grid.appendChild(this.legend);
160
+
161
+ this.grid.appendChild(createWebComp("pnx-hashtags", {
162
+ slot: "top-right",
163
+ _parent: this,
164
+ class: "pnx-only-psv pnx-print-hidden",
165
+ }));
159
166
  }
160
167
  else {
161
168
  this.legend = createWebComp("pnx-picture-legend", { _parent: this });
@@ -121,7 +121,7 @@ export default class Tabs extends LitElement {
121
121
  render() {
122
122
  return html`
123
123
  <nav @click="${this._handleTabClick}">
124
- <slot name="title"></slot>
124
+ <slot name="title" @slotchange=${() => this.activeTabIndex = 0}></slot>
125
125
  </nav>
126
126
  <div class="contents">
127
127
  <slot name="content"></slot>