@panoramax/web-viewer 5.0.0-develop-d7206514 → 5.0.0-develop-d26305dd

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 (152) hide show
  1. package/build/bundle.cjs +3399 -0
  2. package/build/bundle.cjs.map +1 -0
  3. package/build/bundle_photoviewer.cjs +2510 -0
  4. package/build/bundle_photoviewer.cjs.map +1 -0
  5. package/build/cjs/index.js +1 -1
  6. package/build/cjs/index_photoviewer.js +1 -1
  7. package/build/components/core/Basic.css +56 -0
  8. package/build/components/core/Basic.js +378 -0
  9. package/build/components/core/CoverageMap.css +10 -0
  10. package/build/components/core/CoverageMap.js +169 -0
  11. package/build/components/core/Editor.css +33 -0
  12. package/build/components/core/Editor.js +398 -0
  13. package/build/components/core/PhotoViewer.css +70 -0
  14. package/build/components/core/PhotoViewer.js +650 -0
  15. package/build/components/core/Viewer.css +130 -0
  16. package/build/components/core/Viewer.js +711 -0
  17. package/build/components/core/index.js +10 -0
  18. package/build/components/index.js +11 -0
  19. package/build/components/index_photoviewer.js +6 -0
  20. package/build/components/layout/BottomDrawer.js +258 -0
  21. package/build/components/layout/CorneredGrid.js +143 -0
  22. package/build/components/layout/Mini.js +121 -0
  23. package/build/components/layout/Tabs.js +140 -0
  24. package/build/components/layout/index.js +9 -0
  25. package/build/components/menus/LocationPrecisionDoc.js +42 -0
  26. package/build/components/menus/MapBackground.js +110 -0
  27. package/build/components/menus/MapFilters.js +567 -0
  28. package/build/components/menus/MapLayers.js +238 -0
  29. package/build/components/menus/MapLegend.js +68 -0
  30. package/build/components/menus/MiniPictureLegend.js +73 -0
  31. package/build/components/menus/PictureLegend.js +379 -0
  32. package/build/components/menus/PictureMetadata.js +380 -0
  33. package/build/components/menus/PlayerOptions.js +93 -0
  34. package/build/components/menus/QualityScoreDoc.js +42 -0
  35. package/build/components/menus/ReportForm.js +132 -0
  36. package/build/components/menus/SemanticsDoc.js +38 -0
  37. package/build/components/menus/SemanticsDownload.js +33 -0
  38. package/build/components/menus/SemanticsFilters.js +153 -0
  39. package/build/components/menus/SemanticsList.js +413 -0
  40. package/build/components/menus/SemanticsMetadata.js +368 -0
  41. package/build/components/menus/Share.js +105 -0
  42. package/build/components/menus/index.js +22 -0
  43. package/build/components/menus/index_photoviewer.js +11 -0
  44. package/build/components/styles.js +557 -0
  45. package/build/components/ui/AnnotationsSwitch.js +159 -0
  46. package/build/components/ui/Button.js +77 -0
  47. package/build/components/ui/ButtonGroup.css +59 -0
  48. package/build/components/ui/ButtonGroup.js +69 -0
  49. package/build/components/ui/CopyButton.js +110 -0
  50. package/build/components/ui/Grade.js +54 -0
  51. package/build/components/ui/GradeFilter.js +122 -0
  52. package/build/components/ui/IconSwitch.js +193 -0
  53. package/build/components/ui/LinkButton.js +67 -0
  54. package/build/components/ui/ListGroup.js +66 -0
  55. package/build/components/ui/ListItem.js +90 -0
  56. package/build/components/ui/Loader.js +203 -0
  57. package/build/components/ui/Map.css +63 -0
  58. package/build/components/ui/Map.js +853 -0
  59. package/build/components/ui/MapMore.js +175 -0
  60. package/build/components/ui/Photo.css +50 -0
  61. package/build/components/ui/Photo.js +1502 -0
  62. package/build/components/ui/Popup.js +145 -0
  63. package/build/components/ui/ProgressBar.js +104 -0
  64. package/build/components/ui/QualityScore.js +147 -0
  65. package/build/components/ui/SearchBar.js +374 -0
  66. package/build/components/ui/SemanticsEditor.js +191 -0
  67. package/build/components/ui/SemanticsTable.js +88 -0
  68. package/build/components/ui/Switch.js +139 -0
  69. package/build/components/ui/TogglableGroup.js +157 -0
  70. package/build/components/ui/index.js +29 -0
  71. package/build/components/ui/index_photoviewer.js +21 -0
  72. package/build/components/ui/widgets/CopyCoordinates.js +75 -0
  73. package/build/components/ui/widgets/GeoSearch.css +21 -0
  74. package/build/components/ui/widgets/GeoSearch.js +150 -0
  75. package/build/components/ui/widgets/Legend.js +190 -0
  76. package/build/components/ui/widgets/LevelSelect.css +51 -0
  77. package/build/components/ui/widgets/LevelSelect.js +143 -0
  78. package/build/components/ui/widgets/MapFiltersButton.js +114 -0
  79. package/build/components/ui/widgets/MapLayersButton.js +79 -0
  80. package/build/components/ui/widgets/OSMEditors.js +155 -0
  81. package/build/components/ui/widgets/PictureLegendActions.js +99 -0
  82. package/build/components/ui/widgets/Player.css +7 -0
  83. package/build/components/ui/widgets/Player.js +154 -0
  84. package/build/components/ui/widgets/SemanticsFiltersButton.js +65 -0
  85. package/build/components/ui/widgets/Zoom.js +84 -0
  86. package/build/components/ui/widgets/index.js +16 -0
  87. package/build/components/ui/widgets/index_photoviewer.js +7 -0
  88. package/build/esm/components/core/Basic.js +1 -1
  89. package/build/img/arrow_360.svg +14 -0
  90. package/build/img/arrow_flat.svg +11 -0
  91. package/build/img/arrow_triangle.svg +9 -0
  92. package/build/img/arrow_turn.svg +8 -0
  93. package/build/img/bg_aerial.jpg +0 -0
  94. package/build/img/bg_streets.jpg +0 -0
  95. package/build/img/loader_base.jpg +0 -0
  96. package/build/img/logo_dead.svg +91 -0
  97. package/build/img/marker.svg +17 -0
  98. package/build/img/marker_blue.svg +20 -0
  99. package/build/img/osm.svg +49 -0
  100. package/build/img/panoramax.svg +13 -0
  101. package/build/img/switch_big.svg +54 -0
  102. package/build/img/switch_mini.svg +48 -0
  103. package/build/img/wd.svg +1 -0
  104. package/build/index_photoviewer.js +4 -0
  105. package/build/package.json +148 -0
  106. package/build/servers.js +14 -0
  107. package/build/translations/ar.json +1 -0
  108. package/build/translations/be.json +257 -0
  109. package/build/translations/br.json +81 -0
  110. package/build/translations/cy.json +117 -0
  111. package/build/translations/da.json +300 -0
  112. package/build/translations/de.json +309 -0
  113. package/build/translations/en.json +294 -0
  114. package/build/translations/eo.json +235 -0
  115. package/build/translations/es.json +292 -0
  116. package/build/translations/fi.json +1 -0
  117. package/build/translations/fr.json +294 -0
  118. package/build/translations/hr.json +294 -0
  119. package/build/translations/hu.json +294 -0
  120. package/build/translations/it.json +306 -0
  121. package/build/translations/ja.json +182 -0
  122. package/build/translations/ko.json +1 -0
  123. package/build/translations/nl.json +305 -0
  124. package/build/translations/nn.json +1 -0
  125. package/build/translations/pl.json +169 -0
  126. package/build/translations/pt.json +296 -0
  127. package/build/translations/pt_BR.json +304 -0
  128. package/build/translations/sv.json +182 -0
  129. package/build/translations/ti.json +9 -0
  130. package/build/translations/tr.json +297 -0
  131. package/build/translations/uk.json +268 -0
  132. package/build/translations/zh_Hant.json +309 -0
  133. package/build/utils/API.js +928 -0
  134. package/build/utils/InitParameters.js +521 -0
  135. package/build/utils/MapStyleComposer.js +889 -0
  136. package/build/utils/PanoraMapProtocol.js +49 -0
  137. package/build/utils/PhotoAdapter.js +49 -0
  138. package/build/utils/PresetsManager.js +148 -0
  139. package/build/utils/SemanticsMapProtocol.js +144 -0
  140. package/build/utils/URLHandler.js +426 -0
  141. package/build/utils/geocoder.js +203 -0
  142. package/build/utils/i18n.js +128 -0
  143. package/build/utils/index.js +17 -0
  144. package/build/utils/index_photoviewer.js +14 -0
  145. package/build/utils/indoor.js +200 -0
  146. package/build/utils/map.js +788 -0
  147. package/build/utils/picture.js +507 -0
  148. package/build/utils/semantics.js +321 -0
  149. package/build/utils/services.js +148 -0
  150. package/build/utils/utils.js +433 -0
  151. package/build/utils/widgets.js +110 -0
  152. package/package.json +1 -1
@@ -0,0 +1,379 @@
1
+ import { LitElement, css, nothing } from "lit";
2
+ import { html, unsafeStatic } from "lit/static-html.js";
3
+ import { classMap } from "lit/directives/class-map.js";
4
+ import { fa, onceParentAvailable } from "../../utils/widgets.js";
5
+ import {
6
+ faArrowLeft, faCalendarAlt, faChevronDown, faChevronUp, faShareNodes,
7
+ faTriangleExclamation, faUser, faUserLock,
8
+ } from "@fortawesome/free-solid-svg-icons";
9
+ import { hidden, panel, placeholder } from "../styles.js";
10
+ import { reverseGeocodingNominatim } from "../../utils/geocoder.js";
11
+ import { PanoramaxMetaCatalogURL } from "../../utils/services.js";
12
+
13
+ /**
14
+ * Picture legend shows info about picture author, capture date, address, and access to metadata popup.
15
+ * @class Panoramax.components.menus.PictureLegend
16
+ * @element pnx-picture-legend
17
+ * @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
18
+ * @slot `editors` External links to map editors, or any tool that may be helpful. Defaults to OSM tools (iD & JOSM).
19
+ * @example
20
+ * ```html
21
+ * <pnx-picture-legend ._parent=${viewer} />
22
+ * ```
23
+ */
24
+ export default class PictureLegend extends LitElement {
25
+ /** @private */
26
+ static styles = [placeholder, panel, hidden, css`
27
+ :host {
28
+ display: flex;
29
+ flex-direction: column;
30
+ margin: 0;
31
+ font-family: var(--font-family);
32
+ flex-wrap: nowrap;
33
+ }
34
+
35
+ @media screen and (min-width: 576px) {
36
+ :host {
37
+ max-height: 70vh;
38
+ }
39
+ }
40
+
41
+ /* Top bar */
42
+ .headline {
43
+ display: flex;
44
+ gap: 10px;
45
+ align-items: center;
46
+ margin: 10px 10px 5px 10px;
47
+ justify-content: space-between;
48
+ flex: 1;
49
+ }
50
+
51
+ .headline-buttons {
52
+ display: flex;
53
+ gap: 5px;
54
+ align-items: center;
55
+ }
56
+
57
+ /* Address line */
58
+ #pic-legend-addr {
59
+ line-height: 1.2em;
60
+ font-size: 1em;
61
+ margin-bottom: 2px;
62
+ flex-grow: 5;
63
+ font-weight: 800;
64
+ text-overflow: ellipsis;
65
+ overflow: hidden;
66
+ white-space: nowrap;
67
+ }
68
+
69
+ #pic-legend-addr span {
70
+ display: inline-block;
71
+ height: 100%;
72
+ width: 100%;
73
+ }
74
+
75
+ /* Visibility badge */
76
+ .visibility-badge {
77
+ cursor: help;
78
+ background: var(--blue);
79
+ color: var(--white);
80
+ border-radius: 10px;
81
+ height: 20px;
82
+ display: inline-flex;
83
+ font-size: 0.8em;
84
+ padding: 0 5px;
85
+ gap: 3px;
86
+ font-size: 0.7em;
87
+ align-items: center;
88
+ }
89
+
90
+ .visibility-badge svg {
91
+ height: 1em;
92
+ }
93
+
94
+ /* Minimal info block */
95
+ #pic-legend-info {
96
+ margin: 10px;
97
+ display: flex;
98
+ gap: 10px;
99
+ justify-content: space-around;
100
+ }
101
+ .info-block {
102
+ display: flex;
103
+ flex-shrink: 1;
104
+ gap: 5px;
105
+ font-weight: 600;
106
+ font-size: 0.85em;
107
+ align-items: center;
108
+ }
109
+ .info-block svg { height: 18px; }
110
+
111
+ /* Expand button */
112
+ #pic-legend-expand {
113
+ display: block;
114
+ margin-top: 5px;
115
+ max-width: 100%;
116
+ flex: 1;
117
+ }
118
+ #pic-legend-expand::part(btn) {
119
+ border-radius: 10px;
120
+ border-top-right-radius: 0;
121
+ border-top-left-radius: 0;
122
+ }
123
+
124
+ /* Details block */
125
+ pnx-picture-metadata {
126
+ margin: 5px 10px;
127
+ display: block;
128
+ box-sizing: border-box;
129
+ flex: 1;
130
+ overflow-y: auto;
131
+ }
132
+
133
+ /* Details actions */
134
+ #pic-legend-cta {
135
+ display: flex;
136
+ margin: 5px 10px;
137
+ border-bottom-left-radius: 10px;
138
+ border-bottom-right-radius: 10px;
139
+ gap: 5px;
140
+ flex-wrap: wrap;
141
+ flex: 1;
142
+ }
143
+
144
+ /* More options menu */
145
+ #pnx-legend-opts { min-width: unset; }
146
+
147
+ /* Editors */
148
+ #pic-legend-editors { margin: 0 10px; }
149
+
150
+ /* Light version */
151
+ .pnx-picture-legend-light {
152
+ width: max-content;
153
+ font-size: 10px;
154
+ }
155
+ `];
156
+
157
+ /**
158
+ * Component properties.
159
+ * @memberof Panoramax.components.menus.PictureLegend#
160
+ * @type {Object}
161
+ * @property {boolean} [light=false] Lighter version (for iframes)
162
+ */
163
+ static properties = {
164
+ light: {type: Boolean},
165
+ _caption: { state: true },
166
+ _addr: { state: true },
167
+ _expanded: { state: true },
168
+ _blockOnEditor: { state: true },
169
+ _visibility: { state: true },
170
+ collapsable: { type: Boolean },
171
+ };
172
+
173
+ /** @private */
174
+ constructor() {
175
+ super();
176
+ this._expanded = true;
177
+ this.collapsable = false;
178
+ this.light = false;
179
+ }
180
+
181
+ /** @private */
182
+ connectedCallback() {
183
+ super.connectedCallback();
184
+
185
+ this._expanded = !this.collapsable;
186
+ this._prevSearches = {};
187
+
188
+ onceParentAvailable(this)
189
+ .then(() => this._parent.onceReady())
190
+ .then(() => {
191
+ this._onPicChange(this._parent.psv.getPictureMetadata());
192
+ this._parent.psv.addEventListener("picture-loaded", () => {
193
+ this._onPicChange(this._parent.psv.getPictureMetadata());
194
+ });
195
+ this._parent.psv.addEventListener("sequence-stopped", () => {
196
+ this._onPicChange(this._parent.psv.getPictureMetadata());
197
+ });
198
+ this._parent.psv.addEventListener("annotation-focused", () => {
199
+ this._expanded = true;
200
+ });
201
+ if(!this._parent._initParams.getParentPostInit().skipTagsMenuOpening) {
202
+ this._parent.psv.addEventListener("annotations-toggled", e => {
203
+ if(e.detail.visible) { this._expanded = true; }
204
+ });
205
+ }
206
+ if(this._parent.psv.getSelectedAnnotations().length > 0) {
207
+ this._expanded = true;
208
+ }
209
+ });
210
+ }
211
+
212
+ /** @private */
213
+ _onPicChange(picMeta) {
214
+ clearTimeout(this._addrTimer1);
215
+ this._caption = picMeta?.caption;
216
+
217
+ if(picMeta) {
218
+ this._visibility = picMeta.properties?.["geovisio:visibility"] || null;
219
+ if(this._visibility === "anyone") { this._visibility = null; }
220
+
221
+ const coordsHash = `${picMeta.gps[0].toFixed(4)}/${picMeta.gps[1].toFixed(4)}`;
222
+ if(this._prevSearches[coordsHash]) {
223
+ this._addr = this._prevSearches[coordsHash];
224
+ }
225
+ else if(!this._parent.psv._sequencePlaying) {
226
+ this._addr = "";
227
+ this._addrTimer1 = setTimeout(() => {
228
+ reverseGeocodingNominatim(picMeta.gps[1], picMeta.gps[0])
229
+ .then(addr => {
230
+ clearTimeout(this._addrTimer2);
231
+ this._addr = addr;
232
+ this._prevSearches[coordsHash] = addr;
233
+ });
234
+ }, 500);
235
+ }
236
+ }
237
+ else {
238
+ this._visibility = null;
239
+ this._addr = "";
240
+ }
241
+ }
242
+
243
+ /** @private */
244
+ _onBackClick() {
245
+ if(this._parent.isWidthSmall() && this._parent.focus === "map") {
246
+ this._parent.select();
247
+ }
248
+ else {
249
+ this._parent._setFocus?.("map");
250
+ }
251
+ }
252
+
253
+ /**
254
+ * Force legend to not go anywhere beyond tags editor.
255
+ * @memberof Panoramax.components.menus.PictureLegend#
256
+ * @param {boolean} enabled Set to true to block legend, false to unblock
257
+ */
258
+ blockOnEditing(enabled) {
259
+ this._blockOnEditor = enabled;
260
+ }
261
+
262
+ /** @private */
263
+ render() {
264
+ if(!this._caption) { return nothing; }
265
+
266
+ const lang = this._parent?.lang || window.navigator.language;
267
+ const hiddenExpanded = classMap({"pnx-hidden": this._expanded});
268
+ const shownExpanded = classMap({"pnx-hidden": !this._expanded});
269
+
270
+ if(this.light) {
271
+ return html`<div class="pnx-picture-legend-light">
272
+ ${this._caption.producer?.length > 0 ? html`
273
+ <a
274
+ href=${PanoramaxMetaCatalogURL()+"/?pic="+this._parent.psv.getPictureMetadata().id}
275
+ target="_blank"
276
+ title=${this._parent?._t.pnx.share_page}
277
+ >${this._caption.producer[this._caption.producer.length-1]}</a>
278
+ </div>` : nothing}
279
+
280
+ ${this._caption.producer?.length > 0 && this._caption.date ? "-" : ""}
281
+
282
+ ${this._caption.date ? new Intl.DateTimeFormat(lang, {
283
+ timeZone: this._caption.tz,
284
+ dateStyle: "short"
285
+ }).format(this._caption.date) : nothing}
286
+
287
+ ${(this._caption.producer?.length > 0 || this._caption.date) && this._caption?.license ? "|" : ""}
288
+
289
+ ${this._caption?.license ? html`${unsafeStatic(this._caption.license)}` : nothing}
290
+ `;
291
+ }
292
+
293
+ return html`
294
+ <div class=${classMap({ "headline": true, "pnx-hidden": this._blockOnEditor })}>
295
+ ${this._parent._setFocus ? html`
296
+ <pnx-button
297
+ kind="superinline"
298
+ @click=${this._onBackClick}
299
+ >
300
+ ${fa(faArrowLeft)}
301
+ </pnx-button>
302
+ ` : nothing}
303
+
304
+ <div id="pic-legend-addr" title=${this._addr || ""}>
305
+ ${this._addr?.length > 0 ? this._addr : html`<span class="pnx-placeholder-loading">&nbsp;</span>`}
306
+ </div>
307
+
308
+ <div class="headline-buttons">
309
+ ${this._visibility ? html`
310
+ <div
311
+ class="visibility-badge"
312
+ title=${this._parent?._t.pnx["visibility_title_"+this._visibility]}
313
+ >
314
+ ${fa(faUserLock, {transform: {size: 16}})}
315
+ ${this._parent?._t.pnx["visibility_"+this._visibility]}
316
+ </div>
317
+ ` : nothing}
318
+
319
+ <pnx-button
320
+ size="sm"
321
+ class=${hiddenExpanded}
322
+ title=${this._parent?._t.pnx.share}
323
+ @click=${() => this._parent._showShareOptions()}
324
+ >
325
+ ${fa(faShareNodes)}
326
+ </pnx-button>
327
+
328
+ <pnx-picture-legend-actions
329
+ @click=${e => e.stopPropagation()}
330
+ ._parent=${this._parent}
331
+ ?full=${this._expanded}
332
+ ></pnx-picture-legend-actions>
333
+ </div>
334
+ </div>
335
+
336
+ <div id="pic-legend-info" class=${hiddenExpanded}>
337
+ ${this._caption.producer?.length > 0 ? html`<div class="info-block">
338
+ ${fa(faUser)}
339
+ ${this._caption.producer[this._caption.producer.length-1]}
340
+ </div>` : nothing}
341
+
342
+ ${this._caption.date ? html`<div class="info-block">
343
+ ${fa(faCalendarAlt)}
344
+ ${this._caption.date.toLocaleDateString(this._parent?.lang || window.navigator.language, { year: "numeric", month: "long", day: "numeric" })} </div>` : nothing}
345
+ </div>
346
+
347
+ <div id="pic-legend-cta" class=${classMap({ "pnx-hidden": !this._expanded || this._blockOnEditor })}>
348
+ <pnx-button size="sm" @click=${() => this._parent._showShareOptions()}>
349
+ ${fa(faShareNodes)} ${this._parent?._t.pnx.share}
350
+ </pnx-button>
351
+
352
+ ${this._parent.getAPI()._endpoints.report ? html`
353
+ <pnx-button kind="fullwarn" size="sm" @click=${() => this._parent._showReportForm()}>
354
+ ${fa(faTriangleExclamation)} ${this._parent?._t.pnx.report}
355
+ </pnx-button>
356
+ ` : nothing}
357
+
358
+ <slot name="editors">
359
+ <pnx-widget-osmeditors ._parent=${this._parent} />
360
+ </slot>
361
+ </div>
362
+
363
+ <pnx-picture-metadata
364
+ class=${shownExpanded}
365
+ .block-editor=${this._blockOnEditor}
366
+ ._parent=${this._parent}
367
+ ></pnx-picture-metadata>
368
+
369
+ ${this.collapsable && !this._blockOnEditor ? html`<pnx-button
370
+ kind="inline"
371
+ size="sm"
372
+ id="pic-legend-expand"
373
+ @click=${() => this._expanded = !this._expanded}
374
+ >${this._expanded ? fa(faChevronUp) : fa(faChevronDown)}</pnx-button>` : nothing}
375
+ `;
376
+ }
377
+ }
378
+
379
+ customElements.define("pnx-picture-legend", PictureLegend);