@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,368 @@
1
+ import { LitElement, css, html, nothing } from "lit";
2
+ import { fa, onceParentAvailable } from "../../utils/widgets.js";
3
+ import {
4
+ faEraser, faFloppyDisk, faInfoCircle, faPlusSquare, faTimes
5
+ } from "@fortawesome/free-solid-svg-icons";
6
+ import { dataBlocks, hidden } from "../styles.js";
7
+ import { getUserAccount } from "../../utils/utils.js";
8
+
9
+ /**
10
+ * Semantics metadata displays detailed info about semantic attributes of a single picture.
11
+ * @class Panoramax.components.menus.SemanticsMetadata
12
+ * @element pnx-semantics-metadata
13
+ * @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
14
+ * @example
15
+ * ```html
16
+ * <pnx-semantics-metadata ._parent=${viewer}></pnx-semantics-metadata>
17
+ * ```
18
+ */
19
+ export default class SemanticsMetadata extends LitElement {
20
+ /** @private */
21
+ static styles = [ hidden, dataBlocks, css`
22
+ .top-btns, pnx-semantics-list {
23
+ font-size: 0.8em;
24
+ }
25
+ .top-btns {
26
+ display: flex;
27
+ margin: 5px 0;
28
+ gap: 5px;
29
+ }
30
+ .top-btns > * {
31
+ overflow: hidden;
32
+ }
33
+ .top-btns > *::part(btn) {
34
+ height: unset;
35
+ }
36
+ .data-block {
37
+ width: 100%;
38
+ }
39
+ .data-block h5 {
40
+ justify-content: space-between;
41
+ }
42
+ ` ];
43
+
44
+ /** @private */
45
+ static properties = {
46
+ _meta: {state: true},
47
+ _prevPSVPicNav: {state: true},
48
+ _authUrl: {state: true},
49
+ _showLinks: {state: true},
50
+
51
+ _addTag: {state: true},
52
+ _editTag: {state: true},
53
+ _addTagGeom: {state: true},
54
+ _editTagSem: {state: true},
55
+ };
56
+
57
+ constructor() {
58
+ super();
59
+ this._meta = {};
60
+ this._prevPSVPicNav = null;
61
+ this._authUrl = null;
62
+ this._showLinks = true;
63
+
64
+ this._addTag = false;
65
+ this._editTag = null;
66
+ this._addTagGeom = null;
67
+ this._editTagSem = null;
68
+ }
69
+
70
+ /** @private */
71
+ connectedCallback() {
72
+ super.connectedCallback();
73
+
74
+ onceParentAvailable(this).then(() => {
75
+ this._meta = this._parent?.psv?.getPictureMetadata();
76
+ this._parent?.oncePSVReady?.().then(() => {
77
+ this._parent.psv.addEventListener("picture-loaded", () => {
78
+ this._meta = this._parent.psv.getPictureMetadata();
79
+ });
80
+ this._parent.psv.addEventListener("annotation-focused", () => {
81
+ const tabs = this.shadowRoot.querySelector("pnx-tabs");
82
+ if(tabs) { tabs.setAttribute("activeTabIndex", 4); }
83
+ });
84
+ });
85
+
86
+ this._parent.getAPI().getAuthURL().then(res => this._authUrl = res);
87
+ });
88
+ }
89
+
90
+ /** @private */
91
+ _blockPicChange(block) {
92
+ this._parent?.legend?.renderRoot.querySelector("pnx-picture-legend")?.blockOnEditing(block);
93
+ if(this._parent?.mini) { this._parent.mini.style.display = block ? "none" : null; }
94
+ const answ = this._parent.renderRoot.querySelector("pnx-annotations-switch");
95
+ if(answ) { answ.style.display = block ? "none": null; }
96
+
97
+ if(block) {
98
+ this._prevPSVPicNav = this._parent.psv.getPicturesNavigation();
99
+ this._parent.psv.setPicturesNavigation("pic");
100
+ this._parent._disableKeyboard();
101
+ window.addEventListener("beforeunload", this._onBrowserQuit);
102
+ }
103
+ else {
104
+ this._parent.psv.setPicturesNavigation(this._prevPSVPicNav);
105
+ this._parent._enableKeyboard();
106
+ window.removeEventListener("beforeunload", this._onBrowserQuit);
107
+ }
108
+ }
109
+
110
+ /** @private */
111
+ _onBrowserQuit(e) {
112
+ e.preventDefault();
113
+ e.returnValue = true;
114
+ }
115
+
116
+ /** @private */
117
+ _checkCanEdit() {
118
+ const isFromLocalInstance = !this._meta.origInstance || this._parent?.api?._endpoint.startsWith(this._meta.origInstance.href);
119
+ if(isFromLocalInstance && getUserAccount() !== null) {
120
+ return true;
121
+ }
122
+ else {
123
+ if(!isFromLocalInstance && confirm((this._parent?._t.pnx.semantics_login_needed || "").replace("{n}", this._meta.origInstance.instance_name || this._meta.origInstance.href))) {
124
+ window.location.href = this._meta.origInstance.href + window.location.search.replace(/&?nav=pic/, "");
125
+ }
126
+ else if(isFromLocalInstance && confirm((this._parent?._t.pnx.semantics_login_needed || "").replace("{n}", this._parent.getAPI()._metadata.name))) {
127
+ window.location.href = this._authUrl.replace("<CBURL>", encodeURIComponent(window.location.href));
128
+ }
129
+ else {
130
+ return false;
131
+ }
132
+ }
133
+ }
134
+
135
+ /** @private */
136
+ _startAddTag() {
137
+ if(!this._checkCanEdit()) { return; }
138
+
139
+ this._blockPicChange(true);
140
+ this._addTag = true;
141
+ this._editTag = false;
142
+ this._addTagGeom = null;
143
+ this._editTagSem = null;
144
+
145
+ this._addTagGeomListener = e => {
146
+ this.renderRoot.querySelector("#pnx-sem-editor")?.forceInput();
147
+ this._addTagGeom = e.detail.shape;
148
+ };
149
+ this._parent.psv.addEventListener("annotation-drawn", this._addTagGeomListener);
150
+ this._parent.psv.startDrawAnnotation();
151
+ }
152
+
153
+ /** @private */
154
+ _onTagSemChange(e) {
155
+ this._editTagSem = e.detail;
156
+ }
157
+
158
+ /** @private */
159
+ _onSaveTag() {
160
+ const field = this.renderRoot.querySelector("#pnx-sem-editor");
161
+
162
+ // Check field validity
163
+ if(!field || !field.checkValidity() || !this._editTagSem || !this._editTagSem.delta || this._editTagSem.delta.length === 0) {
164
+ field.reportValidity();
165
+ return;
166
+ }
167
+
168
+ // Edit an annotation
169
+ if(this._editTag?.type === "annotation") {
170
+ this._parent?.api.editPictureAnnotation(this._editTag.annotation.id, this._editTagSem.delta).then(newAnnot => {
171
+ const annotPos = this._meta.properties.annotations.findIndex(a => a.id === newAnnot.id);
172
+ this._meta.properties.annotations[annotPos] = newAnnot;
173
+ this._onCancelEditTag(newAnnot);
174
+ }).catch(e => {
175
+ console.error("Can't send annotation", e);
176
+ this._onCancelEditTag(this._editTag.annotation);
177
+ alert(this._parent?._t.pnx.semantics_send_fail);
178
+ });
179
+ }
180
+ // Create annotation if a geom exists
181
+ else if(this._addTag && this._addTagGeom) {
182
+ this._parent.psv.fixDrawAnnotation();
183
+ this._parent?.api.createPictureAnnotation(this._meta, this._addTagGeom, this._editTagSem.delta).then(newAnnot => {
184
+ this._meta.properties.annotations.push(newAnnot);
185
+ this._onCancelEditTag(newAnnot, true);
186
+ }).catch(e => {
187
+ console.error("Can't send annotation", e);
188
+ alert(this._parent?._t.pnx.semantics_send_fail);
189
+ this._onCancelEditTag();
190
+ });
191
+ }
192
+ // Create picture tag or edit a tag group
193
+ else if(this._addTag || (this._editTag && this._editTag.type !== "annotation")) {
194
+ this._parent?.api.sendPictureSemantics(this._meta, this._editTagSem.delta).then(newPic => {
195
+ this._meta.properties.semantics = newPic.properties.semantics;
196
+ this._onCancelEditTag(this._editTagSem.delta);
197
+ }).catch(e => {
198
+ alert(this._parent?._t.pnx.semantics_send_fail);
199
+ console.error("Can't send semantics", e);
200
+ this._onCancelEditTag();
201
+ });
202
+ }
203
+ }
204
+
205
+ /** @private */
206
+ _onEraseDrawnAnnotation() {
207
+ this._parent.psv.stopDrawAnnotation();
208
+ this._addTagGeom = null;
209
+ this._parent.psv.startDrawAnnotation();
210
+ }
211
+
212
+ /** @private */
213
+ _onEditTag(e) {
214
+ if(!this._checkCanEdit()) { return; }
215
+
216
+ this._blockPicChange(true);
217
+ this._addTag = false;
218
+ this._addTagGeom = null;
219
+ this._editTagSem = e.detail.item?.type === "annotation" ? { semantics: e.detail.item.annotation.semantics } : e.detail.item.tagGroup;
220
+ this._editTag = e.detail.item;
221
+
222
+ if(e.detail.item?.type === "annotation") {
223
+ this._parent.psv.focusOnAnnotation(e.detail.item.annotation.id, true);
224
+ }
225
+ }
226
+
227
+ /** @private */
228
+ _onCancelEditTag(item = null, skipStopDraw = false) {
229
+ // Force hiding of report status on tag editor
230
+ this.renderRoot.querySelector("#pnx-sem-editor").reset();
231
+
232
+ this._addTag = false;
233
+ this._addTagGeom = null;
234
+ this._editTag = null;
235
+ if(!skipStopDraw) { this._parent.psv.stopDrawAnnotation(); }
236
+ this._blockPicChange(false);
237
+
238
+ // Select back item in list
239
+ this.getUpdateComplete().then(() => {
240
+ const list = this.renderRoot.querySelector("#pnx-sem-list");
241
+ if(item && list) {
242
+ if(item.id) { list.showAnnotation(item.id); }
243
+ else { list.showTagsGroup(item); }
244
+ }
245
+ });
246
+ }
247
+
248
+ /** @private */
249
+ _onDeleteTag(e) {
250
+ if(!this._checkCanEdit()) { return; }
251
+
252
+ if(confirm(this._parent?._t.pnx.semantics_delete_annotation_confirm)) {
253
+ const item = e.detail.item;
254
+ // Annotation deleting
255
+ if(item?.type === "annotation") {
256
+ this._parent?.api.deletePictureAnnotation(item.annotation.id).then(() => {
257
+ // Remove from current metadata
258
+ const newMeta = Object.assign({}, this._meta);
259
+ newMeta.properties.annotations = this._meta.properties.annotations.filter(a => a.id != item.annotation.id);
260
+ this._meta = newMeta;
261
+
262
+ // Remove from PSV
263
+ this._parent.psv.toggleAllAnnotations(true);
264
+
265
+ // Remove from annotations list
266
+ this.renderRoot.querySelector("pnx-semantics-list")?._onPicChange();
267
+ }).catch(e => {
268
+ console.error("Can't send annotation", e);
269
+ alert(this._parent?._t.pnx.semantics_send_fail);
270
+ });
271
+ }
272
+ // Tag group deletion
273
+ else {
274
+ const semDiff = item.tagGroup.semantics.map(t => Object.assign({action: "delete"}, t));
275
+ this._parent?.api.sendPictureSemantics(this._meta, semDiff).then(newPic => {
276
+ this._meta.properties.semantics = newPic.properties.semantics;
277
+ this.renderRoot.querySelector("pnx-semantics-list")?._onPicChange();
278
+ }).catch(e => {
279
+ alert(this._parent?._t.pnx.semantics_send_fail);
280
+ console.error("Can't send semantics", e);
281
+ });
282
+ }
283
+ }
284
+ }
285
+
286
+ /** @private */
287
+ render() {
288
+ if(!this._meta?.properties) { return; }
289
+
290
+ const canEdit = !this._meta.origInstance && (this._authUrl || getUserAccount() !== null);
291
+
292
+ return html`
293
+ ${(this._addTag || this._editTag) ? html`
294
+ <div class="data-block">
295
+ <h5>
296
+ ${this._addTag ? this._parent?._t.pnx.semantics_add_annotation : this._parent?._t.pnx.semantics_edit}
297
+
298
+ <pnx-button-group>
299
+ <pnx-button
300
+ kind="fullsuccess"
301
+ style="margin-right: 3px"
302
+ title=${this._parent?._t.pnx.semantics_save}
303
+ @click=${this._onSaveTag}
304
+ >
305
+ ${fa(faFloppyDisk)}
306
+ </pnx-button>
307
+ <pnx-button
308
+ kind="fullwarn"
309
+ title=${this._parent?._t.pnx.semantics_undo}
310
+ @click=${() => this._onCancelEditTag(this._editTag?.annotation || this._editTag)}
311
+ >
312
+ ${fa(faTimes)}
313
+ </pnx-button>
314
+ </pnx-button-group>
315
+ </h5>
316
+ <div>
317
+ ${this._addTag ? this._parent?._t.pnx.semantics_draw_annotation : nothing}
318
+ ${this._addTag && this._addTagGeom ? html`<pnx-button
319
+ kind="full"
320
+ style="margin-top: 5px; width: 100%"
321
+ @click=${this._onEraseDrawnAnnotation}
322
+ >
323
+ ${fa(faEraser)} ${this._parent?._t.pnx.semantics_erase_annotation}
324
+ </pnx-button>` : nothing}
325
+
326
+ <pnx-semantics-editor
327
+ id="pnx-sem-editor"
328
+ style="display: block; margin-top: 5px"
329
+ .semantics=${this._editTagSem?.semantics || []}
330
+ ._t=${this._parent._t}
331
+ @change=${this._onTagSemChange}
332
+ ></pnx-semantics-editor>
333
+ </div>
334
+ </div>
335
+ ` : html`
336
+ ${this._showLinks ? html `
337
+ <div class="top-btns">
338
+ <pnx-button
339
+ kind="full"
340
+ size="md"
341
+ style="flex: 2 1"
342
+ @click=${this._startAddTag}
343
+ >
344
+ ${fa(faPlusSquare)} ${this._parent?._t.pnx.semantics_add_annotation}
345
+ </pnx-button>
346
+ <pnx-button
347
+ kind="full"
348
+ size="md"
349
+ style="flex: 1 1"
350
+ @click=${() => this._parent?._showSemanticsDoc()}
351
+ >${fa(faInfoCircle)} ${this._parent?._t.pnx.semantics_doc}</pnx-button>
352
+ </div>
353
+ ` : nothing}
354
+
355
+ <pnx-semantics-list
356
+ id="pnx-sem-list"
357
+ .editable=${canEdit}
358
+ @select=${e => this._showLinks = e.detail.item == null}
359
+ @edit-click=${this._onEditTag}
360
+ @delete-click=${this._onDeleteTag}
361
+ ._parent=${this._parent}
362
+ />
363
+ `}
364
+ `;
365
+ }
366
+ }
367
+
368
+ customElements.define("pnx-semantics-metadata", SemanticsMetadata);
@@ -0,0 +1,105 @@
1
+ import { LitElement, css, html } from "lit";
2
+ import { fa, onceParentAvailable } from "../../utils/widgets.js";
3
+ import { faSvg, input, textarea, titles } from "../styles.js";
4
+ import {
5
+ faCircleInfo, faLink, faMap, faShareAlt
6
+ } from "@fortawesome/free-solid-svg-icons";
7
+
8
+ /**
9
+ * Share Menu displays links for quick picture sharing.
10
+ * @class Panoramax.components.menus.ShareMenu
11
+ * @element pnx-share-menu
12
+ * @extends [lit.LitElement](https://lit.dev/docs/api/LitElement/)
13
+ * @example
14
+ * ```html
15
+ * <pnx-share-menu ._parent=${viewer} />
16
+ * ```
17
+ */
18
+ export default class ShareMenu extends LitElement {
19
+ /** @private */
20
+ static styles = [ faSvg, input, textarea, titles, css`
21
+ div[slot="content"] {
22
+ margin-top: 10px;
23
+ }
24
+ .links {
25
+ display: flex;
26
+ gap: 5px;
27
+ }
28
+ .embed {
29
+ display: flex;
30
+ gap: 5px;
31
+ align-items: center;
32
+ flex-direction: column;
33
+ }
34
+ ` ];
35
+
36
+ /**
37
+ * Component properties.
38
+ * @memberof Panoramax.components.menus.ShareMenu#
39
+ * @type {Object}
40
+ * @property {string} [base-url] Override the default base URL (current page)
41
+ */
42
+ static properties = {
43
+ _url: {state: true},
44
+ "base-url": {type: String},
45
+ };
46
+
47
+ constructor() {
48
+ super();
49
+ this._onUrlChange();
50
+ }
51
+
52
+ /** @private */
53
+ connectedCallback() {
54
+ super.connectedCallback();
55
+ onceParentAvailable(this).then(() => this._parent.onceReady()).then(() => {
56
+ this._onUrlChange();
57
+ this._parent.urlHandler.addEventListener("url-changed", this._onUrlChange.bind(this));
58
+ });
59
+ }
60
+
61
+ /** @private */
62
+ _onUrlChange() {
63
+ const baseUrl = (this["base-url"] || window.location.href).replace(/\/$/, "");
64
+ this._url = this._parent?.urlHandler?.nextShortLink(baseUrl) || baseUrl;
65
+ }
66
+
67
+ /** @private */
68
+ render() {
69
+ const iframe = `<iframe src="${this._url}" style="border: none; width: 500px; height: 300px"></iframe>`;
70
+
71
+ return html`
72
+ <h4>${fa(faShareAlt)} ${this._parent?._t.pnx.share}</h4>
73
+ <pnx-tabs>
74
+ <h4 slot="title">${fa(faLink)} ${this._parent?._t.pnx.share_page}</h4>
75
+ <div slot="content">
76
+ <div class="links">
77
+ <input type="text" readonly value=${this._url} style="flex: 2" />
78
+ <pnx-copy-button ._t=${this._parent?._t} text=${this._url}></pnx-copy-button>
79
+ </div>
80
+ </div>
81
+
82
+ <h4 slot="title">${fa(faMap)} ${this._parent?._t.pnx.share_embed}</h4>
83
+ <div slot="content">
84
+ <div class="embed">
85
+ <pnx-link-button
86
+ href="https://docs.panoramax.fr/web-viewer/03_URL_settings/"
87
+ target="_blank"
88
+ kind="superinline"
89
+ size="sm"
90
+ >
91
+ ${fa(faCircleInfo)} ${this._parent?._t.pnx.share_embed_docs}
92
+ </pnx-link-button>
93
+ <textarea readonly .value=${iframe}></textarea>
94
+ <pnx-copy-button
95
+ ._t=${this._parent?._t}
96
+ text=${iframe}
97
+ style="width: 100%"
98
+ ></pnx-copy-button>
99
+ </div>
100
+ </div>
101
+ </pnx-tabs>`;
102
+ }
103
+ }
104
+
105
+ customElements.define("pnx-share-menu", ShareMenu);
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Complex menus components
3
+ * @module Panoramax:components:menus
4
+ */
5
+
6
+ export {default as LocationPrecisionDoc} from "./LocationPrecisionDoc.js";
7
+ export {default as MapBackground} from "./MapBackground.js";
8
+ export {default as MapFilters} from "./MapFilters.js";
9
+ export {default as MapLayers} from "./MapLayers.js";
10
+ export {default as MapLegend} from "./MapLegend.js";
11
+ export {default as MiniPictureLegend} from "./MiniPictureLegend.js";
12
+ export {default as PictureLegend} from "./PictureLegend.js";
13
+ export {default as PictureMetadata} from "./PictureMetadata.js";
14
+ export {default as PlayerOptions} from "./PlayerOptions.js";
15
+ export {default as QualityScoreDoc} from "./QualityScoreDoc.js";
16
+ export {default as ReportForm} from "./ReportForm.js";
17
+ export {default as SemanticsDoc} from "./SemanticsDoc.js";
18
+ export {default as SemanticsDownload} from "./SemanticsDownload.js";
19
+ export {default as SemanticsFilters} from "./SemanticsFilters.js";
20
+ export {default as SemanticsList} from "./SemanticsList.js";
21
+ export {default as SemanticsMetadata} from "./SemanticsMetadata.js";
22
+ export {default as Share} from "./Share.js";
@@ -0,0 +1,11 @@
1
+ // Lightweight export for PhotoViewer
2
+ export {default as PictureLegend} from "./PictureLegend.js";
3
+ export {default as PictureMetadata} from "./PictureMetadata.js";
4
+ export {default as PlayerOptions} from "./PlayerOptions.js";
5
+ export {default as QualityScoreDoc} from "./QualityScoreDoc.js";
6
+ export {default as ReportForm} from "./ReportForm.js";
7
+ export {default as SemanticsDoc} from "./SemanticsDoc.js";
8
+ export {default as SemanticsDownload} from "./SemanticsDownload.js";
9
+ export {default as SemanticsList} from "./SemanticsList.js";
10
+ export {default as SemanticsMetadata} from "./SemanticsMetadata.js";
11
+ export {default as Share} from "./Share.js";