@abi-software/mapintegratedvuer 1.23.0 → 1.24.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.
Files changed (34) hide show
  1. package/dist/{ConnectivityGraph-Cao0C1-G.js → ConnectivityGraph-CCxk8vcE.js} +6 -6
  2. package/dist/{ContentMixin-4t04VWoF.js → ContentMixin-Db8nqZax.js} +295 -240
  3. package/dist/{DynamicMarkerMixin-tATj70ym.js → DynamicMarkerMixin-LB2RYdSY.js} +1 -1
  4. package/dist/{Flatmap-DF4FAwLY.js → Flatmap-CqUzOkdl.js} +5 -5
  5. package/dist/{Iframe-DbQ22y53.js → Iframe-I-xdZ2FP.js} +2 -2
  6. package/dist/{MultiFlatmap-Dwy9gbWC.js → MultiFlatmap-11L97ycJ.js} +6 -6
  7. package/dist/{Plot-COXE_H78.js → Plot-Bd9RqyVD.js} +2 -2
  8. package/dist/{Scaffold-9ubjNzcD.js → Scaffold-CySWXQxI.js} +46 -36
  9. package/dist/{Simulation-CR-yKjxu.js → Simulation-ChUbGudZ.js} +2 -2
  10. package/dist/{connectivities-DhBMlBSj.js → connectivities-LtlFwLOp.js} +6399 -5790
  11. package/dist/es-D-YkSGXX.js +436 -0
  12. package/dist/mapintegratedvuer.js +12994 -11652
  13. package/dist/mapintegratedvuer.umd.cjs +191 -190
  14. package/dist/style.css +1 -1
  15. package/package.json +4 -4
  16. package/src/assets/header-icon.scss +9 -3
  17. package/src/components/ContentBar.vue +172 -92
  18. package/src/components/ContentVuer.vue +41 -1
  19. package/src/components/DialogToolbarContent.vue +45 -4
  20. package/src/components/EventBus.js +8 -0
  21. package/src/components/MapContent.vue +77 -31
  22. package/src/components/ResizeSensor.vue +7 -9
  23. package/src/components/ScreenshotPopover.vue +526 -0
  24. package/src/components/SplitDialog.vue +94 -93
  25. package/src/components/SplitFlow.vue +158 -96
  26. package/src/components/scripts/utilities.js +56 -1
  27. package/src/components/viewers/Flatmap.vue +1 -0
  28. package/src/components/viewers/MultiFlatmap.vue +3 -0
  29. package/src/components/viewers/Scaffold.vue +25 -13
  30. package/src/components.d.ts +2 -0
  31. package/src/mixins/ContentMixin.js +23 -10
  32. package/src/services/screenshot.js +1186 -0
  33. package/src/stores/connectivities.js +38 -5
  34. package/src/stores/settings.js +18 -0
@@ -22,7 +22,7 @@
22
22
  import { computed } from 'vue';
23
23
  import Tagging from '../services/tagging.js';
24
24
  import SplitFlow from './SplitFlow.vue';
25
- import EventBus from './EventBus';
25
+ import { onEvents } from './EventBus';
26
26
  import { mapStores } from 'pinia';
27
27
  import { useSettingsStore } from '../stores/settings';
28
28
  import { useSplitFlowStore } from '../stores/splitFlow';
@@ -33,6 +33,24 @@ import RetrieveContextCardMixin from '../mixins/RetrieveContextCardMixin.js';
33
33
 
34
34
  /**
35
35
  * Content of the app. More work flows will be added here.
36
+ *
37
+ * ## Screenshots
38
+ *
39
+ * Each viewer pane has a camera button in its header that downloads a screenshot of that pane.
40
+ * The camera button in the top toolbar downloads all visible panes together, including the sidebar if it is open.
41
+ * Screenshots are saved as PNG. Pick the resolution (1x to 4x the device pixel ratio) before downloading; higher resolutions suit printing.
42
+ * On-screen controls such as zoom buttons and settings panels are left out of the image.
43
+ * Very large outputs are reduced automatically to stay within browser canvas limits.
44
+ *
45
+ * Default screenshot settings can be set with `options.screenshot`,
46
+ * and screenshots can be triggered programmatically with the `captureScreenshot` method:
47
+ *
48
+ * ```js
49
+ * // All visible panes
50
+ * this.$refs.map.captureScreenshot({ scale: 3 });
51
+ * // A single pane, by entry id
52
+ * this.$refs.map.captureScreenshot({ paneId: 1, scale: 2 });
53
+ * ```
36
54
  */
37
55
  export default {
38
56
  name: 'MapContent',
@@ -70,6 +88,8 @@ export default {
70
88
  },
71
89
  /**
72
90
  * The options include APIs and Keys.
91
+ * `options.screenshot` sets the screenshot defaults,
92
+ * e.g. `{ scale: 2, legend: 'include', toolbar: true }`.
73
93
  */
74
94
  options: {
75
95
  type: Object,
@@ -276,6 +296,20 @@ export default {
276
296
  getState: function (anonymousAnnotations = false) {
277
297
  return this.$refs.flow.getState(anonymousAnnotations);
278
298
  },
299
+ /**
300
+ * @public
301
+ * Capture a screenshot and download it as PNG.
302
+ * Captures the pane with `paneId` (entry id) if provided,
303
+ * otherwise all visible panes including the sidebar.
304
+ * `legend` is `exclude` (default), `include` or `only`,
305
+ * the latter downloads only the legend panel of each pane.
306
+ * `toolbar` includes the header bar of each pane (default `false`).
307
+ * The default `scale`, `legend` and `toolbar` come from `options.screenshot`.
308
+ * @arg `options` { paneId, scale: Number, legend: String, toolbar: Boolean }
309
+ */
310
+ captureScreenshot: function (options = {}) {
311
+ return this.$refs.flow.captureScreenshot(options);
312
+ },
279
313
  /**
280
314
  * @public
281
315
  * Provide a way to set the current view, this is currently limited
@@ -454,51 +488,63 @@ export default {
454
488
  : null;
455
489
  this.options.flatmapAPI ? this.settingsStore.updateFlatmapAPI(this.options.flatmapAPI) : null;
456
490
  this.options.rootUrl ? this.settingsStore.updateRootUrl(this.options.rootUrl) : null;
491
+ this.options.screenshot
492
+ ? this.settingsStore.updateScreenshotOptions(this.options.screenshot)
493
+ : null;
457
494
  }
458
495
  this.settingsStore.updateAllClosable(this.allClosable);
459
496
  this.splitFlowStore?.reset();
460
497
  this.splitFlowStore?.getAvailableTerms(this.settingsStore.sparcApi);
461
498
  },
462
499
  mounted: async function () {
463
- EventBus.on('updateShareLinkRequested', (data) => {
464
- /**
465
- * This event emits when the share link is requested.
466
- */
467
- this.$emit('updateShareLinkRequested', data);
468
- });
469
- EventBus.on('trackEvent', (taggingData) => {
470
- /**
471
- * This event triggers data tracking for Google Tag Manager (GTM) related to map interactions.
472
- */
473
- this.$emit('trackEvent', taggingData);
500
+ this._offBus = onEvents({
501
+ updateShareLinkRequested: (data) => {
502
+ /**
503
+ * This event emits when the share link is requested.
504
+ */
505
+ this.$emit('updateShareLinkRequested', data);
506
+ },
507
+ trackEvent: (taggingData) => {
508
+ /**
509
+ * This event triggers data tracking for Google Tag Manager (GTM) related to map interactions.
510
+ */
511
+ this.$emit('trackEvent', taggingData);
512
+ },
513
+ mapLoaded: (map) => {
514
+ // Check if there is a search term to display
515
+ if (this.displaySearchFromQuery) {
516
+ setTimeout(() => {
517
+ this.$refs.flow?.onDisplaySearch({ term: this.displaySearchFromQuery });
518
+ this.displaySearchFromQuery = ''; // Clear after using it from first load
519
+ });
520
+ }
521
+ /**
522
+ * This event emit when the map is loaded.
523
+ */
524
+ this.$emit('mapLoaded', map);
525
+ },
526
+ // Allow other components to request opening a map via setCurrentEntry
527
+ SetCurrentEntry: (entry) => {
528
+ // Ignore requests until the flow is ready, as before
529
+ if (entry && this.isReady) {
530
+ this.setCurrentEntry(entry);
531
+ }
532
+ },
474
533
  });
475
534
  if (!this.state) {
476
535
  this.initialState = await initialState(this.startingMap, this.options.sparcApi);
536
+ // The component may have been unmounted while awaiting
537
+ if (this._unmounted) return;
477
538
  }
478
- EventBus.on('mapLoaded', (map) => {
479
- // Check if there is a search term to display
480
- if (this.displaySearchFromQuery) {
481
- setTimeout(() => {
482
- this.$refs.flow.onDisplaySearch({ term: this.displaySearchFromQuery });
483
- this.displaySearchFromQuery = ''; // Clear after using it from first load
484
- });
485
- }
486
- /**
487
- * This event emit when the map is loaded.
488
- */
489
- this.$emit('mapLoaded', map);
490
- });
491
- // Allow other components to request opening a map via setCurrentEntry
492
- EventBus.on('SetCurrentEntry', (entry) => {
493
- if (entry) {
494
- this.setCurrentEntry(entry);
495
- }
496
- });
497
539
  this.isReady = true;
498
540
  this.settingsStore.updateUseHelpModeDialog(this.useHelpModeDialog);
499
541
  this.settingsStore.updateConnectivityInfoSidebar(this.connectivityInfoSidebar);
500
542
  this.settingsStore.updateAnnotationSidebar(this.annotationSidebar);
501
543
  },
544
+ beforeUnmount: function () {
545
+ this._unmounted = true;
546
+ this._offBus?.();
547
+ },
502
548
  };
503
549
  </script>
504
550
 
@@ -3,22 +3,20 @@
3
3
  </template>
4
4
 
5
5
  <script>
6
- import ResizeSensor from 'css-element-queries/src/ResizeSensor';
7
-
8
6
  export default {
9
7
  name: 'ResizeSensor',
10
8
  methods: {
11
9
  activate: function () {
12
- if (!this._sensor) {
13
- this._sensor = new ResizeSensor(this.$refs.display, this.displayResize);
10
+ if (!this._observer && this.$refs.display) {
11
+ this._observer = new ResizeObserver(() => this.displayResize());
12
+ this._observer.observe(this.$refs.display);
14
13
  this.displayResize();
15
14
  }
16
15
  },
17
16
  deactivate: function () {
18
- if (this._sensor) {
19
- this._sensor.detach(this.$refs.display, this.displayResize);
20
- delete this._sensor;
21
- this._sensor = undefined;
17
+ if (this._observer) {
18
+ this._observer.disconnect();
19
+ this._observer = undefined;
22
20
  this.displayResize();
23
21
  }
24
22
  },
@@ -26,7 +24,7 @@ export default {
26
24
  this.$emit('resize');
27
25
  },
28
26
  },
29
- unmounted() {
27
+ beforeUnmount() {
30
28
  this.deactivate();
31
29
  },
32
30
  activated() {