@abi-software/scaffoldvuer 0.4.0-vue3.6 → 0.4.0-vue3.7

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": "0.4.0-vue3.6",
3
+ "version": "0.4.0-vue3.7",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -10,13 +10,15 @@
10
10
  "serve": "vite --host --force",
11
11
  "build-bundle": "vite build",
12
12
  "build-static": "vite build -c vite.static-build.js",
13
- "styleguide": "vue-cli-service styleguidist",
14
- "styleguide:build": "vue-cli-service styleguidist:build",
13
+ "vuese-gen": "vuese gen",
15
14
  "changelog": "auto-changelog -p --output CHANGELOG.md --template keepachangelog",
16
15
  "version": "npm run build-bundle;npm run changelog; git add CHANGELOG.md",
17
16
  "release:beta": "npm version prerelease --preid=beta; npm publish --tag beta",
18
17
  "release:minor": "npm version minor; npm publish",
19
- "release:patch": "npm version patch; npm publish"
18
+ "release:patch": "npm version patch; npm publish",
19
+ "docs:dev": "vuese gen;vitepress dev docs",
20
+ "docs:build": "vuese gen;vitepress build docs",
21
+ "docs:preview": "vitepress preview docs"
20
22
  },
21
23
  "type": "module",
22
24
  "main": "./dist/scaffoldvuer.umd.cjs",
@@ -52,10 +54,11 @@
52
54
  "vue": "^3.4.15",
53
55
  "vue-router": "^4.2.5",
54
56
  "vue3-component-svg-sprite": "^0.0.1",
55
- "zincjs": "^1.3.2"
57
+ "zincjs": "^1.3.3"
56
58
  },
57
59
  "devDependencies": {
58
60
  "@vitejs/plugin-vue": "^4.6.2",
61
+ "@vuese/cli": "^2.14.3",
59
62
  "auto-changelog": "^2.4.0",
60
63
  "babel-eslint": "^10.1.0",
61
64
  "babel-plugin-component": "^1.1.1",
@@ -64,7 +67,8 @@
64
67
  "eslint-plugin-vue": "^9.19.2",
65
68
  "sass": "^1.69.5",
66
69
  "vite": "^5.0.10",
67
- "vue-styleguidist": "^4.72.4",
70
+ "vite-plugin-node-polyfills": "^0.21.0",
71
+ "vitepress": "^1.0.0-rc.42",
68
72
  "webpack-node-externals": "^2.5.2"
69
73
  },
70
74
  "eslintConfig": {
@@ -84,5 +88,12 @@
84
88
  "browserslist": [
85
89
  "> 1%",
86
90
  "last 2 versions"
87
- ]
91
+ ],
92
+ "vuese": {
93
+ "include": [
94
+ "src/components/ScaffoldVuer.vue"
95
+ ],
96
+ "genType": "markdown",
97
+ "outDir": "docs"
98
+ }
88
99
  }
package/src/App.vue CHANGED
@@ -111,6 +111,9 @@
111
111
  <el-button size="small" @click="featureTextureSlides(true)">
112
112
  Body slides
113
113
  </el-button>
114
+ <el-button size="small" @click="featureArmSlides(true)">
115
+ Arm slides
116
+ </el-button>
114
117
  <el-switch v-model="onClickMarkers" active-text="Markers On Selection" active-color="#8300bf" />
115
118
  </el-row>
116
119
  <el-row :gutter="20">
@@ -126,7 +129,9 @@
126
129
  </el-popover>
127
130
  <el-popover placement="bottom" trigger="click" width="800" popper-class="table-popover" :teleported="false">
128
131
  <template #default>
129
- <ModelsTable @viewModelClicked="viewModelClicked" />
132
+ <Suspense>
133
+ <ModelsTable @viewModelClicked="viewModelClicked" />
134
+ </Suspense>
130
135
  </template>
131
136
  <template #reference>
132
137
  <el-button class="models-button" :icon="ElIconFolderOpened">
@@ -152,7 +157,7 @@ import { shallowRef } from 'vue';
152
157
  import { ScaffoldVuer } from "./components/index.js";
153
158
  import DropZone from "./app/DropZone.vue";
154
159
  import ModelsTable from "./app/ModelsTable.vue";
155
- import { testSlides, testVolume } from "./app/TextureDemos.js";
160
+ import { testArmSlides, testSlides, testVolume } from "./app/TextureDemos.js";
156
161
  import {
157
162
  FolderOpened as ElIconFolderOpened,
158
163
  Setting as ElIconSetting,
@@ -326,6 +331,23 @@ export default {
326
331
  this.$refs.scaffold.clearScene();
327
332
  testSlides(this.$refs.scaffold, texture_prefix);
328
333
  },
334
+ featureArmSlides: async function (overlap) {
335
+ //Test texture
336
+ if (overlap) {
337
+ const url =
338
+ "https://mapcore-bucket1.s3.us-west-2.amazonaws.com/texture/arm1/arm_texture_metadata.json";
339
+ if (this.route.query.url !== encodeURI(url)) {
340
+ this.router.replace({ path: "/", query: { url } });
341
+ this.readyCallback = testArmSlides;
342
+ return;
343
+ } else {
344
+ testArmSlides(this.$refs.scaffold);
345
+ return;
346
+ }
347
+ }
348
+ this.$refs.scaffold.clearScene();
349
+ testSlides(this.$refs.scaffold, texture_prefix);
350
+ },
329
351
  saveSettings: function () {
330
352
  this.sceneSettings.push(this.$refs.scaffold.getState());
331
353
  },
@@ -391,6 +413,12 @@ export default {
391
413
  if (this.readyCallback) {
392
414
  this.readyCallback(this.$refs.scaffold, texture_prefix);
393
415
  this.readyCallback = undefined;
416
+ } else {
417
+ const url =
418
+ "https://mapcore-bucket1.s3.us-west-2.amazonaws.com/texture/arm1/arm_texture_metadata.json";
419
+ if (this.route.query.url === encodeURI(url)) {
420
+ testArmSlides(this.$refs.scaffold);
421
+ }
394
422
  }
395
423
  },
396
424
  onSelected: function (data) {
@@ -1,53 +1,63 @@
1
- //import { google } from 'googleapis';
2
- //const sheets = google.sheets('v4');
3
-
4
- /* eslint-disable no-alert, no-console */
5
- export default {
6
- data: function() {
7
- return {
8
- tableData: [],
9
- };
10
- },
11
- methods: {
12
- createTable: async function(sheetRows, keywords) {
13
- for (let i = 0; i < sheetRows.length; i++) {
14
- let mappedData = {};
15
- for (let j = 0; j < keywords.length; j++) {
16
- let keyword = keywords[j];
17
- mappedData[keyword] = sheetRows[i][keyword];
18
- }
19
- this.tableData.push(mappedData);
20
- }
21
- },
22
- getModelsInformation: async function() {
1
+ //import { GoogleSpreadsheet } from 'google-spreadsheet';
23
2
 
24
3
  /*
25
- const serviceAccountAuth = new JWT({
26
- // env var values here are copied from service account credentials generated by google
27
- // see "Authentication" section in docs for more info
28
- email: import.meta.env.VITE_APP_GOOGLE_SERVICE_SCAFFOLDVUER_EMAIL,
29
- key: import.meta.env.VITE_APP_GOOGLE_PRIVATE_SCAFFOLDVUER_KEY,
30
- scopes: ['https://www.googleapis.com/auth/spreadsheets'],
31
- });
32
-
33
- const doc = new GoogleSpreadsheet(import.meta.env.VITE_GOOGLE_SPREADSHEET_ID, serviceAccountAuth);
34
-
35
-
36
-
37
- const doc = new GoogleSpreadsheet(import.meta.env.VITE_GOOGLE_SPREADSHEET_ID);
38
- await doc.useServiceAccountAuth({
39
- client_email: import.meta.env.VITE_APP_GOOGLE_SERVICE_SCAFFOLDVUER_EMAIL,
40
- private_key: import.meta.env.VITE_APP_GOOGLE_PRIVATE_SCAFFOLDVUER_KEY,
41
- });
42
-
43
- await doc.loadInfo(); // loads document properties and worksheets
44
- const sheet = doc.sheetsByIndex[0];
45
- const sheetRows = await sheet.getRows();
46
- const keys = ["Organ", "Species", "Note", "Location",
47
- "Last modified","Blackfynn dataset", "Published", "Discover"];
48
- this.createTable(sheetRows, keys);
49
- */
50
-
4
+ export default async function(keywords, spreadsheet_id, service_email, service_key) {
5
+ const tableData = [];
6
+
7
+ // const serviceAccountAuth = new JWT({
8
+ // email: service_email,
9
+ // key: service_key,
10
+ // scopes: ['https://www.googleapis.com/auth/spreadsheets'],
11
+ // });
12
+
13
+ const doc = new GoogleSpreadsheet(spreadsheet_id);
14
+ await doc.loadInfo(); // loads document properties and worksheets
15
+ const sheet = doc.sheetsByIndex[0];
16
+ const sheetRows = await sheet.getRows();
17
+ for (let i = 0; i < sheetRows.length; i++) {
18
+ let mappedData = {};
19
+ for (let j = 0; j < keywords.length; j++) {
20
+ let keyword = keywords[j];
21
+ mappedData[keyword] = sheetRows[i][keyword];
51
22
  }
23
+ tableData.push(mappedData);
52
24
  }
25
+ return tableData;
26
+ }
27
+ */
28
+
29
+ export default async function(keywords, spreadsheet_id) {
30
+ const gid = '0';
31
+ const response = await fetch(`https://docs.google.com/spreadsheets/d/${spreadsheet_id}/gviz/tq?tqx=out:json&tq&gid=${gid}`);
32
+ const txt = await response.text();
33
+
34
+ const jsonString = txt.match(/(?<="table":).*(?=}\);)/g)[0];
35
+ const json = JSON.parse(jsonString);
36
+ const tableData = [];
37
+ const labelRow = [];
38
+ json.cols.forEach(colonne => labelRow.push(colonne.label));
39
+ const keywordsIndex = [];
40
+ keywords.forEach(key => keywordsIndex.push(labelRow.indexOf(key)));
41
+ const rawTable = [];
42
+ json.rows.forEach(r => {
43
+ const row = []
44
+ r.c.forEach(cel => {
45
+ let value = '';
46
+ try{value = cel.f ? cel.f : cel.v}
47
+ catch(e){value = ''}
48
+ row.push(value)
49
+ })
50
+ rawTable.push(row)
51
+ })
52
+ rawTable.forEach(row => {
53
+ const mappedData = {};
54
+ keywordsIndex.forEach(index => {
55
+ mappedData[labelRow[index]] = row[index];
56
+
57
+ });
58
+ tableData.push(mappedData);
59
+ });
60
+
61
+
62
+ return tableData
53
63
  }
@@ -68,7 +68,8 @@
68
68
 
69
69
  <script>
70
70
  /* eslint-disable no-alert, no-console */
71
- import models from './ModelsInformation.js'
71
+ import getTableData from "./ModelsInformation.js";
72
+
72
73
  import {
73
74
  ElButton as Button,
74
75
  ElInput as Input,
@@ -84,15 +85,20 @@ export default {
84
85
  Table,
85
86
  TableColumn
86
87
  ],
87
- mixins: [models],
88
+ async setup() {
89
+ const keywords = ["Organ", "Species", "Note", "Location",
90
+ "Last modified","Blackfynn dataset", "Published", "Discover"];
91
+ const spreadsheet_id = import.meta.env.VITE_GOOGLE_SPREADSHEET_ID;
92
+ const service_email = import.meta.env.VITE_GOOGLE_SERVICE_SCAFFOLDVUER_EMAIL;
93
+ const service_key = import.meta.env.VITE_GOOGLE_PRIVATE_SCAFFOLDVUER_KEY;
94
+ const tableData = await getTableData(keywords, spreadsheet_id, service_email, service_key);
95
+ return { tableData };
96
+ },
88
97
  data() {
89
98
  return {
90
99
  search: '',
91
100
  }
92
101
  },
93
- created: function() {
94
- this.getModelsInformation();
95
- },
96
102
  methods: {
97
103
  handleView: function(row) {
98
104
  this.$emit("viewModelClicked", row.Location);
@@ -106,9 +112,3 @@ export default {
106
112
  }
107
113
  };
108
114
  </script>
109
-
110
- <style scoped lang="scss">
111
- @use "element-plus/theme-chalk/src/input";
112
- @use "element-plus/theme-chalk/src/table";
113
- @use "element-plus/theme-chalk/src/table-column";
114
- </style>
@@ -66,6 +66,17 @@ export const testVolume = async (scaffoldVuer, texture_prefix) => {
66
66
  window.texture = zincObject;
67
67
  };
68
68
 
69
+ const addCylinder = (scaffoldVuer) => {
70
+ const THREE = scaffoldVuer.$module.Zinc.THREE;
71
+ const cylinderGeometry = new THREE.CylinderGeometry(50, 50, 200,80);
72
+ const material = new THREE.MeshPhongMaterial( {color: 0xffff00, side : THREE.DoubleSide} );
73
+ const cylinderMesh = new THREE.Mesh( cylinderGeometry, material );
74
+ const zincGeometry = new scaffoldVuer.$module.Zinc.Geometry();
75
+ zincGeometry.setMesh(cylinderMesh, false, false);
76
+ zincGeometry.setName("Cylinder");
77
+ scaffoldVuer.addZincObject(zincGeometry);
78
+ }
79
+
69
80
  export const testSlides = async (scaffoldVuer, texture_prefix) => {
70
81
  const scaffoldModule = scaffoldVuer.$module;
71
82
  const texture = await getTexture(scaffoldModule, texture_prefix);
@@ -108,7 +119,117 @@ export const testSlides = async (scaffoldVuer, texture_prefix) => {
108
119
  n.set(-100, 0, 0, -10, 0, -200, 0, 0, 0, 0, -100, 0, 0, 0, 10, 1);
109
120
  textureSlides.morph.applyMatrix4(n);
110
121
  scaffoldVuer.addZincObject(textureSlides);
111
- //scaffoldVuer.fitWindow();
112
- window.texture = textureSlides;
122
+ scaffoldVuer.fitWindow();
123
+ //window.texture = textureSlides;
124
+ //addCylinder(scaffoldVuer);
113
125
  };
114
126
 
127
+ const padNumber = (number) => {
128
+ let string = number.toString();
129
+ while(string.length < 4) {
130
+ string = "0" + string;
131
+ }
132
+ return string;
133
+ }
134
+
135
+ const getArmTexture = async (scaffoldModule) => {
136
+ const imgArray = [];
137
+ const prefix = "https://mapcore-bucket1.s3.us-west-2.amazonaws.com/texture/arm1/jpg";
138
+ const texture = new scaffoldModule.Zinc.TextureArray();
139
+ for (let i = 984; i <= 2184;) {
140
+ imgArray.push(`${prefix}/${padNumber(i)}.jpg`);
141
+ i = i + 10 ;
142
+ }
143
+ await texture.loadFromImages(imgArray);
144
+ return texture;
145
+ };
146
+
147
+
148
+ /*
149
+ {
150
+ "id": "mesh-location-orientation",
151
+ "locations": [
152
+ {
153
+ "identifier": 1,
154
+ "label": "dave",
155
+ "orientation": "[10.0, 0.0, 0.0, 0.0, 10.0, 0.0, 0.0, 0.0, 10.0]",
156
+ "position": "[62.97939922758831, 48.5944672602095, 1.2382504590408302e-14]",
157
+ "scale": "[1, 2, 3]"
158
+ "reference_point": "corner"
159
+ }
160
+ ],
161
+ "version": "0.1.0"
162
+ }
163
+ */
164
+
165
+ //https://threejs.org/docs/#manual/en/introduction/Matrix-transformations
166
+ const applyTransformation = (scaffoldVuer, mesh, rotation, position, scale, reference) => {
167
+ //if (reference === "centre") {
168
+ // mesh.geometry.translate(-0.5, -0.5, -0.5);
169
+ //}
170
+ const THREE = scaffoldVuer.$module.Zinc.THREE;
171
+ const matrix = new THREE.Matrix4();
172
+ matrix.set(
173
+ rotation[0],
174
+ rotation[1],
175
+ rotation[2],
176
+ 0,
177
+ rotation[3],
178
+ rotation[4],
179
+ rotation[5],
180
+ 0,
181
+ rotation[6],
182
+ rotation[7],
183
+ rotation[8],
184
+ 0,
185
+ 0,
186
+ 0,
187
+ 0,
188
+ 0
189
+ );
190
+ console.log(matrix)
191
+ const quaternion = new THREE.Quaternion().setFromRotationMatrix(matrix);
192
+ console.log(quaternion);
193
+ mesh.position.set(...position);
194
+ mesh.quaternion.copy( quaternion );
195
+ mesh.scale.set(...scale);
196
+ mesh.updateMatrix();
197
+ console.log(rotation)
198
+ }
199
+
200
+
201
+
202
+ export const testArmSlides = async (scaffoldVuer) => {
203
+ const scaffoldModule = scaffoldVuer.$module;
204
+ const texture = await getArmTexture(scaffoldModule);
205
+ const textureSlides = new scaffoldModule.Zinc.TextureSlides(texture);
206
+ textureSlides.setName("Arm texture");
207
+ textureSlides.createSlides([
208
+ {
209
+ direction: "x",
210
+ value: 0.5,
211
+ },
212
+ {
213
+ direction: "y",
214
+ value: 0.5,
215
+ },
216
+ {
217
+ direction: "z",
218
+ value: 0.5,
219
+ },
220
+ ]);
221
+
222
+ const rotation = [
223
+ Math.cos(Math.PI / 2.0), 0, Math.sin(Math.PI / 2.0),
224
+ 0, 1, 0,
225
+ -Math.sin(Math.PI / 2.0), 0, Math.cos(Math.PI / 2.0)
226
+ ];
227
+ const position = [0, -1.0, 0.95];
228
+ const scale = [1.6, 1.6, 1.2];
229
+ const reference = "centre";
230
+ applyTransformation(scaffoldVuer, textureSlides.morph, rotation, position, scale, reference);
231
+ scaffoldVuer.addZincObject(textureSlides);
232
+ scaffoldVuer.fitWindow();
233
+ };
234
+
235
+
@@ -96,14 +96,14 @@ export default {
96
96
 
97
97
  .my-slider {
98
98
  position: absolute;
99
- width: 109px;
99
+ width: 135px;
100
100
  top: -12px;
101
101
  left: 50px;
102
102
  pointer-events: auto;
103
103
  }
104
104
 
105
105
  .opacity-container {
106
- width: 224px;
106
+ width: 250px;
107
107
  height: 93px;
108
108
  border-radius: 4px;
109
109
  border: solid 1px #d8dce6;
@@ -11,7 +11,7 @@
11
11
  ref="opacityControls" />
12
12
  <texture-slides-controls
13
13
  v-show="isTextureSlides"
14
- class="controls"
14
+ class="texture-controls"
15
15
  ref="tSlidesControls" />
16
16
  </div>
17
17
  <div
@@ -88,7 +88,7 @@ export default {
88
88
  }
89
89
  }
90
90
  &.close {
91
- right: -220px;
91
+ right: -250px;
92
92
  .my-drawer {
93
93
  pointer-events: none;
94
94
  opacity: 0;
@@ -102,7 +102,7 @@ export default {
102
102
  text-align: left;
103
103
  border: 1px solid rgb(220, 223, 230);
104
104
  background: #ffffff;
105
- width:220px;
105
+ width:250px;
106
106
  }
107
107
 
108
108
  .drawer-button {