@abi-software/scaffoldvuer 1.8.1-beta.0 → 1.8.1-isan.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/scaffoldvuer",
3
- "version": "1.8.1-beta.0",
3
+ "version": "1.8.1-isan.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -130,7 +130,7 @@ export default {
130
130
  data: function () {
131
131
  return {
132
132
  display: false,
133
- annotationEntry: { },
133
+ annotationEntry: [],
134
134
  ElIconDelete: shallowRef(ElIconDelete),
135
135
  };
136
136
  },
@@ -151,16 +151,16 @@ export default {
151
151
  this.display = true;
152
152
  if (this.annotationDisplay) {
153
153
  const region = this.region ? this.region +"/" : "";
154
- this.annotationEntry = {
154
+ this.annotationEntry.push({
155
155
  "featureId": region + this.label,
156
156
  "resourceId": this.scaffoldUrl,
157
157
  "resource": this.scaffoldUrl,
158
- };
158
+ });
159
159
  }
160
160
  }
161
161
  else {
162
162
  this.display = false;
163
- this.annotationEntry = { };
163
+ this.annotationEntry = [];
164
164
  }
165
165
  },
166
166
  hideTriggered: function() {
@@ -29,7 +29,7 @@
29
29
  />
30
30
  <div v-show="displayUI && !isTransitioning">
31
31
  <DrawToolbar
32
- v-if="viewingMode === 'Annotation' && (authorisedUser || offlineAnnotate)"
32
+ v-if="viewingMode === 'Annotation' && (authorisedUser || offlineAnnotationEnabled)"
33
33
  :toolbarOptions="toolbarOptions"
34
34
  :activeDrawTool="activeDrawTool"
35
35
  :activeDrawMode="activeDrawMode"
@@ -310,7 +310,7 @@
310
310
  <el-row class="viewing-mode-description">
311
311
  {{ modeDescription }}
312
312
  </el-row>
313
- <el-row v-if="viewingMode === 'Annotation' && offlineAnnotate" class="viewing-mode-description">
313
+ <el-row v-if="viewingMode === 'Annotation' && offlineAnnotationEnabled" class="viewing-mode-description">
314
314
  (Offline annotate)
315
315
  </el-row>
316
316
  </el-row>
@@ -805,8 +805,8 @@ export default {
805
805
  },
806
806
  openMapRef: undefined,
807
807
  backgroundIconRef: undefined,
808
- offlineAnnotate: false,
809
- offlineAnnotation: markRaw([]),
808
+ offlineAnnotationEnabled: false,
809
+ offlineAnnotations: markRaw([]),
810
810
  authorisedUser: undefined,
811
811
  toolbarOptions: [
812
812
  "Delete",
@@ -1004,11 +1004,11 @@ export default {
1004
1004
  * local annotation list.
1005
1005
  */
1006
1006
  removeFromOfflineAnnotation: function(regionPath, groupName) {
1007
- for (let i = 0; i < this.offlineAnnotation.length; i++) {
1008
- const annotation = this.offlineAnnotation[i];
1007
+ for (let i = 0; i < this.offlineAnnotations.length; i++) {
1008
+ const annotation = this.offlineAnnotations[i];
1009
1009
  if (annotation.region === regionPath &&
1010
1010
  annotation.group === groupName) {
1011
- this.offlineAnnotation.splice(i, 1);
1011
+ this.offlineAnnotations.splice(i, 1);
1012
1012
  return;
1013
1013
  }
1014
1014
  }
@@ -1026,7 +1026,7 @@ export default {
1026
1026
  //Remove relevant objects from the rest of the app.
1027
1027
  if (objects.length === 0) {
1028
1028
  this.$_searchIndex.removeZincObject(zincObject, zincObject.uuid);
1029
- if (this.offlineAnnotate) {
1029
+ if (this.offlineAnnotationEnabled) {
1030
1030
  this.removeFromOfflineAnnotation(regionPath, groupName);
1031
1031
  }
1032
1032
  }
@@ -1111,18 +1111,18 @@ export default {
1111
1111
  region, group, this.url, comment);
1112
1112
  this.existDrawnFeatures = markRaw(this.existDrawnFeatures.filter(feature => feature.id !== annotation.item.id));
1113
1113
  this.existDrawnFeatures.push(annotation.feature);
1114
- if (this.offlineAnnotate) {
1114
+ if (this.offlineAnnotationEnabled) {
1115
1115
  annotation.group = group;
1116
1116
  let regionPath = region;
1117
1117
  if (regionPath.slice(-1) === "/") {
1118
1118
  regionPath = regionPath.slice(0, -1);
1119
1119
  }
1120
1120
  annotation.region = regionPath;
1121
- this.offlineAnnotation = JSON.parse(sessionStorage.getItem('offline-annotation')) || [];
1121
+ this.offlineAnnotations = JSON.parse(sessionStorage.getItem('offline-annotation')) || [];
1122
1122
  //Remove previous entry if there is matching region and group
1123
1123
  this.removeFromOfflineAnnotation(regionPath, group);
1124
- this.offlineAnnotation.push(annotation);
1125
- sessionStorage.setItem('offline-annotation', JSON.stringify(this.offlineAnnotation));
1124
+ this.offlineAnnotations.push(annotation);
1125
+ sessionStorage.setItem('offline-annotation', JSON.stringify(this.offlineAnnotations));
1126
1126
  }
1127
1127
  this.$emit('userPrimitivesUpdated', {region, group, zincObject});
1128
1128
  },
@@ -1220,8 +1220,8 @@ export default {
1220
1220
  this.existDrawnFeatures = markRaw(this.existDrawnFeatures.filter(feature => feature.id !== annotation.item.id));
1221
1221
  const childRegion = this.$module.scene.getRootRegion().findChildFromPath(regionPath);
1222
1222
  childRegion.removeZincObject(this._editingZincObject);
1223
- if (this.offlineAnnotate) {
1224
- sessionStorage.setItem('offline-annotation', JSON.stringify(this.offlineAnnotation));
1223
+ if (this.offlineAnnotationEnabled) {
1224
+ sessionStorage.setItem('offline-annotation', JSON.stringify(this.offlineAnnotations));
1225
1225
  }
1226
1226
  }
1227
1227
  }
@@ -1481,7 +1481,7 @@ export default {
1481
1481
  }
1482
1482
  },
1483
1483
  activateAnnotationMode: function(names, event) {
1484
- if (this.authorisedUser || this.offlineAnnotate) {
1484
+ if (this.authorisedUser || this.offlineAnnotationEnabled) {
1485
1485
  this.createData.toBeDeleted = false;
1486
1486
  if ((this.createData.shape !== "") || (this.createData.editingIndex > -1)) {
1487
1487
  // Create new shape bsaed on current settings
@@ -1951,11 +1951,11 @@ export default {
1951
1951
  );
1952
1952
  } else {
1953
1953
  const region = this.tData.region ? this.tData.region +"/" : "";
1954
- const annotationEntry = {
1954
+ const annotationEntry = [{
1955
1955
  "featureId": region + this.tData.label,
1956
1956
  "resourceId": this.url,
1957
1957
  "resource": this.url,
1958
- };
1958
+ }];
1959
1959
  this.$emit('annotation-open', {
1960
1960
  annotationEntry: annotationEntry,
1961
1961
  createData: this.createData,
@@ -1984,13 +1984,13 @@ export default {
1984
1984
  this.$refs.scaffoldTreeControls.removeRegion('__annotation');
1985
1985
  // Offline annotations are removed when switch viewing mode
1986
1986
  // Restore data in case need to save settings, doesn't affect anything
1987
- this.offlineAnnotation = annotations;
1987
+ this.offlineAnnotations = annotations;
1988
1988
  },
1989
1989
  addAnnotationFeature: async function () {
1990
1990
  let drawnFeatures;
1991
- if (this.offlineAnnotate) {
1992
- this.offlineAnnotation = JSON.parse(sessionStorage.getItem('offline-annotation')) || [];
1993
- drawnFeatures = this.offlineAnnotation.filter((offline) => offline.resource === this.url).map(offline => offline.feature);
1991
+ if (this.offlineAnnotationEnabled) {
1992
+ this.offlineAnnotations = JSON.parse(sessionStorage.getItem('offline-annotation')) || [];
1993
+ drawnFeatures = this.offlineAnnotations.filter((offline) => offline.resource === this.url).map(offline => offline.feature);
1994
1994
  } else {
1995
1995
  drawnFeatures = [];
1996
1996
  const drawn = await getDrawnAnnotations(this.annotator, this.userToken, this.url);
@@ -2020,10 +2020,10 @@ export default {
2020
2020
  this.annotator.authenticate(this.userToken).then((userData) => {
2021
2021
  if (userData.name && userData.email && userData.canUpdate) {
2022
2022
  this.authorisedUser = userData;
2023
- this.offlineAnnotate = false;
2023
+ this.offlineAnnotationEnabled = false;
2024
2024
  } else {
2025
2025
  this.authorisedUser = undefined;
2026
- this.offlineAnnotate = true;
2026
+ this.offlineAnnotationEnabled = true;
2027
2027
  }
2028
2028
  this.addAnnotationFeature();
2029
2029
  this.loading = false;
@@ -2221,10 +2221,8 @@ export default {
2221
2221
  if (options.background) {
2222
2222
  this.backgroundChangeCallback(options.background);
2223
2223
  }
2224
- if (options.offlineAnnotation) {
2225
- if (options.offlineAnnotation.expiry > new Date().getTime()) {
2226
- sessionStorage.setItem('offline-annotation', options.offlineAnnotation.value);
2227
- }
2224
+ if (options.offlineAnnotations) {
2225
+ sessionStorage.setItem('offline-annotation', options.offlineAnnotations);
2228
2226
  }
2229
2227
  if (options.viewingMode) {
2230
2228
  this.changeViewingMode(options.viewingMode);
@@ -2246,7 +2244,7 @@ export default {
2246
2244
  },
2247
2245
  setURLFinishCallback: function (options) {
2248
2246
  return () => {
2249
- this.offlineAnnotation.length = 0;
2247
+ this.offlineAnnotations.length = 0;
2250
2248
  this.updateSettingsfromScene();
2251
2249
  this.$module.updateTime(0.01);
2252
2250
  this.$module.updateTime(0);
@@ -2295,15 +2293,8 @@ export default {
2295
2293
  if (this.lastSelected && this.lastSelected.group) {
2296
2294
  state.search = {...this.lastSelected};
2297
2295
  }
2298
- if (this.offlineAnnotate) {
2299
- if (!sessionStorage.getItem('offline-annotation-expiry')) {
2300
- const expiry = new Date().getTime() + 24 * 60 * 60 * 1000;
2301
- sessionStorage.setItem('offline-annotation-expiry', expiry);
2302
- }
2303
- state.offlineAnnotation = {
2304
- expiry: sessionStorage.getItem('offline-annotation-expiry'),
2305
- value: sessionStorage.getItem('offline-annotation'),
2306
- };
2296
+ if (this.offlineAnnotationEnabled) {
2297
+ state.offlineAnnotations = sessionStorage.getItem('offline-annotation');
2307
2298
  }
2308
2299
  return state;
2309
2300
  },
@@ -2324,7 +2315,7 @@ export default {
2324
2315
  background: state.background,
2325
2316
  viewingMode: this.viewingMode,
2326
2317
  search: state.search,
2327
- offlineAnnotation: state.offlineAnnotation,
2318
+ offlineAnnotations: state.offlineAnnotations,
2328
2319
  });
2329
2320
  } else {
2330
2321
  if (state.background || state.search || state.viewport || state.viewingMode || state.visibility) {
@@ -2338,7 +2329,7 @@ export default {
2338
2329
  viewport: state.viewport,
2339
2330
  visibility: state.visibility,
2340
2331
  search: state.search,
2341
- offlineAnnotation: state.offlineAnnotation,
2332
+ offlineAnnotations: state.offlineAnnotations,
2342
2333
  })
2343
2334
  );
2344
2335
  }
@@ -2358,23 +2349,23 @@ export default {
2358
2349
  /**
2359
2350
  * Return a copy of the local annotations list.
2360
2351
  * This list is used for storing user created annotation
2361
- * when offlineAnnotate is set to true.
2352
+ * when offlineAnnotationEnabled is set to true.
2362
2353
  *
2363
2354
  * @public
2364
2355
  */
2365
2356
  getOfflineAnnotations: function () {
2366
- return [...this.offlineAnnotation];
2357
+ return [...this.offlineAnnotations];
2367
2358
  },
2368
2359
  /**
2369
2360
  * Import local annotations. The annotations will only
2370
- * be imported when offlineAnnotate is set to
2361
+ * be imported when offlineAnnotationEnabled is set to
2371
2362
  * true;
2372
2363
  *
2373
2364
  * @public
2374
2365
  * @arg {Array} `annotationsList`
2375
2366
  */
2376
2367
  importOfflineAnnotations: function (annotationsList) {
2377
- if (this.offlineAnnotate) {
2368
+ if (this.offlineAnnotationEnabled) {
2378
2369
  //Make sure the annotations are encoded correctly
2379
2370
  annotationsList.forEach(annotation => {
2380
2371
  const group = annotation.group;
@@ -2391,9 +2382,9 @@ export default {
2391
2382
  annotationFeaturesToPrimitives(this.$module.scene, featuresList);
2392
2383
  //Make a local non-reactive copy.
2393
2384
  annotationsList.forEach((annotation) => {
2394
- this.offlineAnnotation.push({...annotation});
2385
+ this.offlineAnnotations.push({...annotation});
2395
2386
  });
2396
- sessionStorage.setItem('offline-annotation', JSON.stringify(this.offlineAnnotation));
2387
+ sessionStorage.setItem('offline-annotation', JSON.stringify(this.offlineAnnotations));
2397
2388
  }
2398
2389
  },
2399
2390
 
@@ -2428,7 +2419,7 @@ export default {
2428
2419
  viewURL: this.viewURL,
2429
2420
  viewport: state?.viewport,
2430
2421
  visibility: state?.visibility,
2431
- offlineAnnotation: state?.offlineAnnotation,
2422
+ offlineAnnotations: state?.offlineAnnotations,
2432
2423
  })
2433
2424
  );
2434
2425
  if (this.fileFormat === "gltf") {
@@ -0,0 +1,36 @@
1
+ import { defineConfig } from 'vite'
2
+ import rootConfig from './vite.config.js'
3
+ import { nodePolyfills } from 'vite-plugin-node-polyfills'
4
+ import vue from '@vitejs/plugin-vue'
5
+
6
+ // defineWorkspace provides a nice type hinting DX
7
+ export default defineConfig((configEnv) => {
8
+ const config = rootConfig(configEnv);
9
+ config.css.extract = false
10
+ config.plugins.push(
11
+ nodePolyfills({
12
+ // To add only specific polyfills, add them here. If no option is passed, adds all polyfills
13
+ include: ['path']
14
+ })
15
+ );
16
+ // config.plugins.push(
17
+ // cssInjectedByJsPlugin()
18
+ // );
19
+ config.plugins[0] = vue({
20
+ template: {
21
+ compilerOptions: {
22
+ isCustomElement: (tag) => tag.includes('scaffoldvuer-wc')
23
+ }
24
+ }
25
+ }),
26
+ config.build = {
27
+ lib: {
28
+ entry: './src/ScaffoldVuer-wc.js',
29
+ name: 'scaffoldvuer-wc',
30
+ // the proper extensions will be added
31
+ fileName: 'scaffoldvuer-wc'
32
+ },
33
+ }
34
+
35
+ return config;
36
+ })