@abi-software/scaffoldvuer 1.6.1 → 1.6.2-wc
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/dist/scaffoldvuer-wc.js +78810 -0
- package/dist/scaffoldvuer-wc.umd.cjs +4334 -0
- package/dist/style.css +1 -1
- package/package.json +5 -3
- package/src/App.vue +19 -0
- package/src/ScaffoldVuer-wc.js +13 -5
- package/src/app/DropZone.vue +10 -2
- package/src/components/ScaffoldVuer.vue +9 -1
- package/src/scripts/OrgansRenderer.js +28 -6
- package/vite.web-component.js +36 -0
- package/dist/scaffoldvuer.js +0 -43554
- package/dist/scaffoldvuer.umd.cjs +0 -3458
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/scaffoldvuer",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.2-wc",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"serve": "vite --host --force",
|
|
11
11
|
"build-bundle": "vite build",
|
|
12
|
+
"build-wc": "vite build -c vite.web-component.js",
|
|
12
13
|
"build-static": "vite build -c vite.static-build.js",
|
|
13
14
|
"vuese-gen": "node vuese-generator.js",
|
|
14
15
|
"vuese-watch": "node vuese-generator.js watch",
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
"vue": "^3.4.21",
|
|
55
56
|
"vue-router": "^4.2.5",
|
|
56
57
|
"vue3-component-svg-sprite": "^0.0.1",
|
|
57
|
-
"zincjs": "^1.11.
|
|
58
|
+
"zincjs": "^1.11.5"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
61
|
"@vitejs/plugin-vue": "^4.6.2",
|
|
@@ -70,7 +71,8 @@
|
|
|
70
71
|
"vite": "^5.0.10",
|
|
71
72
|
"vite-plugin-node-polyfills": "^0.21.0",
|
|
72
73
|
"vitepress": "^1.0.0-rc.42",
|
|
73
|
-
"vue-docgen-api": "^4.79.2"
|
|
74
|
+
"vue-docgen-api": "^4.79.2",
|
|
75
|
+
"vue-web-component-wrapper": "^1.6.9"
|
|
74
76
|
},
|
|
75
77
|
"eslintConfig": {
|
|
76
78
|
"root": true,
|
package/src/App.vue
CHANGED
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
:marker-labels="markerLabels"
|
|
30
30
|
:enableLocalAnnotations="false"
|
|
31
31
|
@open-map="openMap"
|
|
32
|
+
@on-error="onError"
|
|
32
33
|
@on-ready="onReady"
|
|
33
34
|
@scaffold-selected="onSelected"
|
|
34
35
|
@scaffold-navigated="onNavigated"
|
|
@@ -184,6 +185,9 @@
|
|
|
184
185
|
<el-col :span="auto">
|
|
185
186
|
<el-switch v-model="renderInfoOn" active-text="Renderer Info" active-color="#8300bf" />
|
|
186
187
|
</el-col>
|
|
188
|
+
<el-button size="small" @click="PrintViewport()">
|
|
189
|
+
Print Viewport
|
|
190
|
+
</el-button>
|
|
187
191
|
</el-row>
|
|
188
192
|
|
|
189
193
|
<template v-if="renderInfoOn && rendererInfo">
|
|
@@ -597,6 +601,10 @@ export default {
|
|
|
597
601
|
this.$refs.scaffold.getDynamicSelectedCoordinates();
|
|
598
602
|
this.rendererInfo = this.$refs.scaffold.getRendererInfo();
|
|
599
603
|
},
|
|
604
|
+
PrintViewport: function() {
|
|
605
|
+
const scene = this.$refs.scaffold.$module.scene;
|
|
606
|
+
console.log(scene.getZincCameraControls().getCurrentViewport());
|
|
607
|
+
},
|
|
600
608
|
fetchSuggestions: function (term, cb) {
|
|
601
609
|
if (term === "" || !this.$refs.scaffold) {
|
|
602
610
|
cb([]);
|
|
@@ -640,6 +648,17 @@ export default {
|
|
|
640
648
|
}
|
|
641
649
|
});
|
|
642
650
|
},
|
|
651
|
+
onError: function(payload) {
|
|
652
|
+
if (payload?.type === "download-error") {
|
|
653
|
+
const dropZone = this.$refs.dropzone;
|
|
654
|
+
if (dropZone) {
|
|
655
|
+
const realFilename = dropZone.findRealFilename(payload.xhr.responseURL);
|
|
656
|
+
if (realFilename) {
|
|
657
|
+
console.error(`External Resource ${realFilename}`);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
},
|
|
643
662
|
onReady: function () {
|
|
644
663
|
if (this.consoleOn) console.log(this.$refs.scaffold)
|
|
645
664
|
if (this.readyCallback) {
|
package/src/ScaffoldVuer-wc.js
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { defineCustomElementSFC } from 'vue-web-component-wrapper';
|
|
2
|
+
import { createPinia, setActivePinia } from "pinia";
|
|
3
|
+
import { useMainStore } from '@/store/index'
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
import ScaffoldVuerComponent from "./components/ScaffoldVuer.vue";
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
setActivePinia(createPinia());
|
|
8
|
+
const mainStore = useMainStore();
|
|
9
|
+
const token = document.cookie.split("; ").find((row) => row.startsWith("user-token"));
|
|
10
|
+
if (mainStore && token) {
|
|
11
|
+
mainStore.setUserToken(token.split("=")[1]);
|
|
12
|
+
}
|
|
7
13
|
|
|
8
|
-
|
|
14
|
+
const ScaffoldVuer = defineCustomElementSFC(ScaffoldVuerComponent, { shadowRoot: false });
|
|
15
|
+
|
|
16
|
+
customElements.define("scaffoldvuer-wc", ScaffoldVuer);
|
|
9
17
|
|
|
10
18
|
/*
|
|
11
19
|
const wrappedElement = wrap(Vue, ScaffoldVuer);
|
package/src/app/DropZone.vue
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
<script>
|
|
15
15
|
/* eslint-disable no-alert, no-console */
|
|
16
|
+
import { markRaw } from 'vue';
|
|
16
17
|
import { SimpleDropzone } from "simple-dropzone";
|
|
17
18
|
import path from "path";
|
|
18
19
|
|
|
@@ -26,7 +27,8 @@ export default {
|
|
|
26
27
|
name: "DropZone",
|
|
27
28
|
data: function () {
|
|
28
29
|
return {
|
|
29
|
-
objectURLs: [],
|
|
30
|
+
objectURLs: markRaw([]),
|
|
31
|
+
filesMapping: markRaw({}),
|
|
30
32
|
};
|
|
31
33
|
},
|
|
32
34
|
mounted: function () {
|
|
@@ -39,6 +41,9 @@ export default {
|
|
|
39
41
|
});
|
|
40
42
|
},
|
|
41
43
|
methods: {
|
|
44
|
+
findRealFilename: function(objectURL) {
|
|
45
|
+
return this.filesMapping[objectURL]
|
|
46
|
+
},
|
|
42
47
|
processTextureFile: function(textureData, flatarray) {
|
|
43
48
|
if (textureData && textureData.images && textureData.images.source) {
|
|
44
49
|
const images = textureData.images.source;
|
|
@@ -50,6 +55,7 @@ export default {
|
|
|
50
55
|
const objectURL = URL.createObjectURL(flatarray[index][1]);
|
|
51
56
|
this.objectURLs.push(objectURL);
|
|
52
57
|
textureData.images.source[i] = objectURL;
|
|
58
|
+
this.filesMapping[objectURL] = images[i];
|
|
53
59
|
}
|
|
54
60
|
}
|
|
55
61
|
const content = JSON.stringify(textureData);
|
|
@@ -65,6 +71,7 @@ export default {
|
|
|
65
71
|
const re = new RegExp(key, "g");
|
|
66
72
|
content = content.replace(re, objectURL);
|
|
67
73
|
this.objectURLs.push(objectURL);
|
|
74
|
+
this.filesMapping[objectURL] = key;
|
|
68
75
|
}
|
|
69
76
|
}
|
|
70
77
|
const data = JSON.parse(content);
|
|
@@ -93,7 +100,8 @@ export default {
|
|
|
93
100
|
},
|
|
94
101
|
revokeURLs: function () {
|
|
95
102
|
this.objectURLs.forEach(objectURL => URL.revokeObjectURL(objectURL));
|
|
96
|
-
this.objectURLs =
|
|
103
|
+
this.objectURLs.length = 0;
|
|
104
|
+
this.filesMapping = markRaw({});
|
|
97
105
|
},
|
|
98
106
|
localDrop: function (fileMap) {
|
|
99
107
|
this.revokeURLs();
|
|
@@ -1604,7 +1604,7 @@ export default {
|
|
|
1604
1604
|
if (event.identifiers.length > 0 && event.identifiers[0]) {
|
|
1605
1605
|
if (event.identifiers[0].coords) {
|
|
1606
1606
|
this.tData.active = false;
|
|
1607
|
-
if (
|
|
1607
|
+
if (this.viewingMode !== "Annotation" || !this.annotationSidebar) {
|
|
1608
1608
|
this.tData.visible = true;
|
|
1609
1609
|
}
|
|
1610
1610
|
this.tData.label = id;
|
|
@@ -2209,6 +2209,11 @@ export default {
|
|
|
2209
2209
|
}
|
|
2210
2210
|
}
|
|
2211
2211
|
},
|
|
2212
|
+
downloadErrorCallback: function() {
|
|
2213
|
+
return (error) => {
|
|
2214
|
+
this.$emit('on-error', error);
|
|
2215
|
+
}
|
|
2216
|
+
},
|
|
2212
2217
|
setURLFinishCallback: function (options) {
|
|
2213
2218
|
return () => {
|
|
2214
2219
|
this.localAnnotationsList.length = 0;
|
|
@@ -2368,6 +2373,9 @@ export default {
|
|
|
2368
2373
|
this.isReady = false;
|
|
2369
2374
|
this.$_searchIndex.removeAll();
|
|
2370
2375
|
this.hideRegionTooltip();
|
|
2376
|
+
this.$module.setDownloadErrorCallback(
|
|
2377
|
+
this.downloadErrorCallback()
|
|
2378
|
+
);
|
|
2371
2379
|
this.$module.setFinishDownloadCallback(
|
|
2372
2380
|
this.setURLFinishCallback({
|
|
2373
2381
|
background: state?.background,
|
|
@@ -40,6 +40,7 @@ const OrgansSceneData = function() {
|
|
|
40
40
|
const organPartAddedCallbacks = new Array();
|
|
41
41
|
const organPartRemovedCallbacks = new Array();
|
|
42
42
|
let finishDownloadCallback = undefined;
|
|
43
|
+
let downloadErrorCallback = undefined;
|
|
43
44
|
const modelsLoader = ModelsLoaderIn;
|
|
44
45
|
this.NDCCameraControl = undefined;
|
|
45
46
|
_this.typeName = "Organ Viewer";
|
|
@@ -187,6 +188,16 @@ const OrgansSceneData = function() {
|
|
|
187
188
|
finishDownloadCallback = undefined;
|
|
188
189
|
}
|
|
189
190
|
|
|
191
|
+
|
|
192
|
+
this.setDownloadErrorCallback = function(callback) {
|
|
193
|
+
if (typeof(callback === "function"))
|
|
194
|
+
downloadErrorCallback = callback;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
this.unsetDownloadErrorCallback = function() {
|
|
198
|
+
downloadErrorCallback = undefined;
|
|
199
|
+
}
|
|
200
|
+
|
|
190
201
|
this.getNamedObjectsToScreenCoordinates = function(name, camera) {
|
|
191
202
|
const vector = new THREE.Vector3();
|
|
192
203
|
vector.setFromMatrixPosition( obj.matrixWorld );
|
|
@@ -435,11 +446,22 @@ const OrgansSceneData = function() {
|
|
|
435
446
|
finishDownloadCallback();
|
|
436
447
|
}
|
|
437
448
|
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
449
|
+
|
|
450
|
+
//The payload can either be a zinc object when the loading is successful or
|
|
451
|
+
//an object containg the details of error message on failure.
|
|
452
|
+
//We only use it to handle an error
|
|
453
|
+
const singleItemFinishCallback = function() {
|
|
454
|
+
return function(payload) {
|
|
455
|
+
|
|
456
|
+
if (payload?.type === "Error") {
|
|
457
|
+
if (downloadErrorCallback) {
|
|
458
|
+
const error = {
|
|
459
|
+
xhr: payload.xhr,
|
|
460
|
+
type: "download-error",
|
|
461
|
+
};
|
|
462
|
+
downloadErrorCallback(error);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
443
465
|
}
|
|
444
466
|
}
|
|
445
467
|
|
|
@@ -549,7 +571,7 @@ const OrgansSceneData = function() {
|
|
|
549
571
|
_this.sceneData.metaURL = url;
|
|
550
572
|
organScene.addZincObjectAddedCallbacks(_addOrganPartCallback(systemName, partName, false));
|
|
551
573
|
organScene.addZincObjectRemovedCallbacks(_removeOrganPartCallback(undefined, partName, false));
|
|
552
|
-
organScene.loadMetadataURL(url,
|
|
574
|
+
organScene.loadMetadataURL(url, singleItemFinishCallback(), downloadCompletedCallback());
|
|
553
575
|
_this.scene = organScene;
|
|
554
576
|
_this.zincRenderer.setCurrentScene(organScene);
|
|
555
577
|
_this.graphicsHighlight.reset();
|
|
@@ -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
|
+
})
|