@abi-software/mapintegratedvuer 1.22.0 → 1.23.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/mapintegratedvuer",
3
- "version": "1.22.0",
3
+ "version": "1.23.0",
4
4
  "license": "Apache-2.0",
5
5
  "engines": {
6
6
  "node": "^24.20.0"
@@ -58,12 +58,12 @@
58
58
  "*.js"
59
59
  ],
60
60
  "dependencies": {
61
- "@abi-software/flatmapvuer": "1.19.0",
62
- "@abi-software/map-side-bar": "2.19.0",
63
- "@abi-software/map-utilities": "1.12.0",
61
+ "@abi-software/flatmapvuer": "1.20.0",
62
+ "@abi-software/map-side-bar": "2.20.0",
63
+ "@abi-software/map-utilities": "1.13.0",
64
64
  "@abi-software/plotvuer": "1.3.0",
65
- "@abi-software/scaffoldvuer": "2.0.0",
66
- "@abi-software/simulationvuer": "4.3.0",
65
+ "@abi-software/scaffoldvuer": "2.1.0",
66
+ "@abi-software/simulationvuer": "4.4.0",
67
67
  "@abi-software/sparc-annotation": "0.3.2",
68
68
  "@abi-software/svg-sprite": "1.4.0",
69
69
  "@element-plus/icons-vue": "^2.3.2",
@@ -7,7 +7,7 @@
7
7
  class="context-card"
8
8
  >
9
9
  <div class="card-left">
10
- <img :src="banner" class="context-image" />
10
+ <img :crossorigin="crossorigin" :src="banner" class="context-image" />
11
11
  </div>
12
12
  <div class="card-right scrollbar">
13
13
  <div>
@@ -54,7 +54,11 @@
54
54
  </div>
55
55
  <template v-for="(view, i) in contextData.views" :key="i + '_1'">
56
56
  <div @click="openViewFile(view)" class="context-card-view">
57
- <img class="view-image" :src="getFileFromPath(view.thumbnail)" />
57
+ <img
58
+ :crossorigin="crossorigin"
59
+ class="view-image"
60
+ :src="getFileFromPath(view.thumbnail)"
61
+ />
58
62
  <div class="view-description">{{ view.description }}</div>
59
63
  </div>
60
64
  <div class="padding" />
@@ -72,6 +76,7 @@
72
76
  :style="'background-color:' + sample.color"
73
77
  ></div>
74
78
  <img
79
+ :crossorigin="crossorigin"
75
80
  class="key-image"
76
81
  v-else-if="sample.thumbnail"
77
82
  :src="getFileFromPath(sample.thumbnail)"
@@ -99,7 +104,11 @@
99
104
  </div>
100
105
  <template v-for="(view, i) in contextData.views" :key="i + '_1'">
101
106
  <span @click="viewClicked(view, i)" class="context-card-view">
102
- <img class="view-image" :src="getFileFromPath(view.thumbnail)" />
107
+ <img
108
+ :crossorigin="crossorigin"
109
+ class="view-image"
110
+ :src="getFileFromPath(view.thumbnail)"
111
+ />
103
112
  <div class="view-description">
104
113
  {{ view.description }}
105
114
  <i class="el-icon-warning-outline info"></i>
@@ -171,6 +180,9 @@ export default {
171
180
  CopyToClipboard,
172
181
  },
173
182
  mixins: [S3Bucket],
183
+ inject: {
184
+ crossorigin: { default: 'anonymous' },
185
+ },
174
186
  props: {
175
187
  /**
176
188
  * Object containing information for
@@ -18,7 +18,7 @@
18
18
  class="dataset-card"
19
19
  ref="card"
20
20
  >
21
- <img :src="entry.datasetImage" class="image" />
21
+ <img :crossorigin="crossorigin" :src="entry.datasetImage" class="image" />
22
22
  <div style="padding: 14px">
23
23
  <span class="dataset-description">{{ entry.datasetDescription }}</span>
24
24
  <div>
@@ -33,6 +33,9 @@
33
33
  <script>
34
34
  export default {
35
35
  name: 'DatasetHeader',
36
+ inject: {
37
+ crossorigin: { default: 'anonymous' },
38
+ },
36
39
  props: {
37
40
  /**
38
41
  * Object containing information for
@@ -142,9 +142,17 @@ export default {
142
142
  type: Boolean,
143
143
  default: true,
144
144
  },
145
+ /**
146
+ * The `crossorigin` attribute value used for images.
147
+ */
148
+ crossorigin: {
149
+ type: String,
150
+ default: 'anonymous',
151
+ },
145
152
  },
146
153
  provide: function () {
147
154
  return {
155
+ crossorigin: computed(() => this.crossorigin),
148
156
  showGlobalSettings: this.showGlobalSettings,
149
157
  showOpenMapButton: this.showOpenMapButton,
150
158
  truncateLongLabel: computed(() => this.truncateLongLabel),
@@ -1,5 +1,14 @@
1
1
  <template>
2
- <SimulationVuer :apiLocation="apiLocation" :id="id" ref="simulation" />
2
+ <SimulationVuer
3
+ v-if="isCrossOriginIsolated"
4
+ :apiLocation="apiLocation"
5
+ :id="id"
6
+ ref="simulation"
7
+ />
8
+ <div v-else class="simulation-unsupported">
9
+ Simulations require a cross-origin isolated page (for SharedArrayBuffer support). This browser
10
+ or host is not configured for it.
11
+ </div>
3
12
  </template>
4
13
 
5
14
  <script>
@@ -13,6 +22,13 @@ export default {
13
22
  components: {
14
23
  SimulationVuer,
15
24
  },
25
+ data: function () {
26
+ return {
27
+ // libOpenCOR (wasm) uses threads, which need SharedArrayBuffer and therefore COOP/COEP headers.
28
+ // Without them it aborts on Safari.
29
+ isCrossOriginIsolated: window.crossOriginIsolated === true,
30
+ };
31
+ },
16
32
  computed: {
17
33
  id: function () {
18
34
  //resource field is only available for simulation omex file and it will run locally.
@@ -22,3 +38,9 @@ export default {
22
38
  },
23
39
  };
24
40
  </script>
41
+
42
+ <style scoped lang="scss">
43
+ .simulation-unsupported {
44
+ padding: 1rem;
45
+ }
46
+ </style>
package/vite.config.js CHANGED
@@ -9,6 +9,32 @@ import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
9
9
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
10
10
  const pathSrc = path.resolve(__dirname, './src');
11
11
 
12
+ // SimulationVuer (libOpenCOR wasm) needs SharedArrayBuffer, which requires cross-origin isolation.
13
+ // Safari/WebKit does not support COEP `credentialless`,
14
+ // so serve `require-corp` to WebKit browsers and `credentialless` to the rest.
15
+ const isWebKitOnly = (ua = '') => ua.includes('AppleWebKit') && !/(Chrome|Chromium|Edg)\//.test(ua);
16
+
17
+ const crossOriginIsolation = () => {
18
+ const middleware = (req, res, next) => {
19
+ res.setHeader('Cross-Origin-Opener-Policy', 'same-origin');
20
+ res.setHeader(
21
+ 'Cross-Origin-Embedder-Policy',
22
+ isWebKitOnly(req.headers['user-agent']) ? 'require-corp' : 'credentialless',
23
+ );
24
+ res.setHeader('Vary', 'User-Agent');
25
+ next();
26
+ };
27
+ return {
28
+ name: 'cross-origin-isolation',
29
+ configureServer: (server) => {
30
+ server.middlewares.use(middleware);
31
+ },
32
+ configurePreviewServer: (server) => {
33
+ server.middlewares.use(middleware);
34
+ },
35
+ };
36
+ };
37
+
12
38
  // https://vitejs.dev/config/
13
39
  export default defineConfig(({ command }) => {
14
40
  const config = {
@@ -53,11 +79,8 @@ export default defineConfig(({ command }) => {
53
79
  if (command === 'serve') {
54
80
  config.server = {
55
81
  port: 8081,
56
- headers: {
57
- 'Cross-Origin-Opener-Policy': 'same-origin',
58
- 'Cross-Origin-Embedder-Policy': 'credentialless',
59
- },
60
82
  };
83
+ config.plugins.push(crossOriginIsolation());
61
84
  config.define = {
62
85
  'process.env.HTTP_PROXY': 8081,
63
86
  global: 'globalThis',
@@ -1,25 +0,0 @@
1
- import { _ as e } from "./connectivities-Br3MpoAv.js";
2
- import { t } from "./ContentMixin-B-O_IwPg.js";
3
- import { createBlock as n, openBlock as r, resolveComponent as i } from "vue";
4
- import { SimulationVuer as a } from "@abi-software/simulationvuer";
5
- import "@abi-software/simulationvuer/dist/style.css";
6
- //#region src/components/viewers/Simulation.vue
7
- var o = {
8
- name: "Simulation",
9
- mixins: [t],
10
- components: { SimulationVuer: a },
11
- computed: { id: function() {
12
- return this.entry.resource ? this.entry.resource : this.entry.discoverId;
13
- } }
14
- };
15
- function s(e, t, a, o, s, c) {
16
- let l = i("SimulationVuer");
17
- return r(), n(l, {
18
- apiLocation: e.apiLocation,
19
- id: c.id,
20
- ref: "simulation"
21
- }, null, 8, ["apiLocation", "id"]);
22
- }
23
- var c = /*#__PURE__*/ e(o, [["render", s]]);
24
- //#endregion
25
- export { c as default };