@abi-software/scaffoldvuer 1.4.1 → 1.4.2
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.js +11023 -10899
- package/dist/scaffoldvuer.umd.cjs +176 -176
- package/dist/style.css +1 -1
- package/package.json +6 -9
- package/src/components/ScaffoldVuer.vue +91 -64
- package/vuese-generator.js +75 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/scaffoldvuer",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -41,18 +41,17 @@
|
|
|
41
41
|
"*.js"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@abi-software/map-utilities": "^1.1.
|
|
44
|
+
"@abi-software/map-utilities": "^1.1.2",
|
|
45
45
|
"@abi-software/sparc-annotation": "^0.3.1",
|
|
46
|
-
"@abi-software/svg-sprite": "^1.0.
|
|
46
|
+
"@abi-software/svg-sprite": "^1.0.1",
|
|
47
47
|
"@element-plus/icons-vue": "^2.3.1",
|
|
48
|
-
"@vue/compat": "^3.4.15",
|
|
49
48
|
"core-js": "^3.22.5",
|
|
50
|
-
"element-plus": "
|
|
49
|
+
"element-plus": "2.8.4",
|
|
51
50
|
"minisearch": "^6.0.1",
|
|
52
51
|
"pinia": "^2.1.7",
|
|
53
52
|
"simple-dropzone": "^0.8.3",
|
|
54
53
|
"unplugin-vue-components": "^0.26.0",
|
|
55
|
-
"vue": "^3.4.
|
|
54
|
+
"vue": "^3.4.21",
|
|
56
55
|
"vue-router": "^4.2.5",
|
|
57
56
|
"vue3-component-svg-sprite": "^0.0.1",
|
|
58
57
|
"zincjs": "^1.11.4"
|
|
@@ -60,11 +59,9 @@
|
|
|
60
59
|
"devDependencies": {
|
|
61
60
|
"@vitejs/plugin-vue": "^4.6.2",
|
|
62
61
|
"@vuese/markdown-render": "^2.11.3",
|
|
63
|
-
"@vuese/parser": "^2.10.3",
|
|
64
62
|
"auto-changelog": "^2.4.0",
|
|
65
63
|
"babel-eslint": "^10.1.0",
|
|
66
64
|
"babel-plugin-component": "^1.1.1",
|
|
67
|
-
"base64-inline-loader": "^2.0.1",
|
|
68
65
|
"chokidar": "^3.6.0",
|
|
69
66
|
"concurrently": "^8.2.2",
|
|
70
67
|
"eslint": "^8.56.0",
|
|
@@ -73,7 +70,7 @@
|
|
|
73
70
|
"vite": "^5.0.10",
|
|
74
71
|
"vite-plugin-node-polyfills": "^0.21.0",
|
|
75
72
|
"vitepress": "^1.0.0-rc.42",
|
|
76
|
-
"
|
|
73
|
+
"vue-docgen-api": "^4.79.2"
|
|
77
74
|
},
|
|
78
75
|
"eslintConfig": {
|
|
79
76
|
"root": true,
|
|
@@ -570,12 +570,12 @@ export default {
|
|
|
570
570
|
* GroupName to value pair.
|
|
571
571
|
* The value can be a single number or and object in the following
|
|
572
572
|
* form:
|
|
573
|
-
*
|
|
573
|
+
*
|
|
574
574
|
* {
|
|
575
575
|
* number: Number,
|
|
576
576
|
* imgURL: String
|
|
577
577
|
* }
|
|
578
|
-
*
|
|
578
|
+
*
|
|
579
579
|
* When imgURL is specified, scaffoldvuer will attempt to render
|
|
580
580
|
* the image in imgURL as marker instead.
|
|
581
581
|
*
|
|
@@ -870,8 +870,10 @@ export default {
|
|
|
870
870
|
},
|
|
871
871
|
currentTime: {
|
|
872
872
|
handler: function () {
|
|
873
|
-
|
|
874
|
-
|
|
873
|
+
/**
|
|
874
|
+
* Emit when time in the current scene has changed
|
|
875
|
+
* @arg {String} "Current time in scene"
|
|
876
|
+
*/
|
|
875
877
|
this.$emit("timeChanged", this.currentTime);
|
|
876
878
|
},
|
|
877
879
|
},
|
|
@@ -945,10 +947,10 @@ export default {
|
|
|
945
947
|
},
|
|
946
948
|
methods: {
|
|
947
949
|
/**
|
|
948
|
-
* @
|
|
950
|
+
* @public
|
|
949
951
|
* Call this to manually add a zinc object into the current scene.
|
|
950
952
|
* This will subsequently trigger a zincObjectAdded
|
|
951
|
-
* @arg ZincObject object to be added
|
|
953
|
+
* @arg {Object} "ZincObject object to be added"
|
|
952
954
|
*/
|
|
953
955
|
addZincObject: function (zincObject) {
|
|
954
956
|
if (this.$module.scene) {
|
|
@@ -966,8 +968,10 @@ export default {
|
|
|
966
968
|
if (this.timeVarying === false && zincObject.isTimeVarying()) {
|
|
967
969
|
this.timeVarying = true;
|
|
968
970
|
}
|
|
969
|
-
|
|
970
|
-
|
|
971
|
+
/**
|
|
972
|
+
* Emit when a new object is added to the scene
|
|
973
|
+
* @arg {Object} "The object added to the sceene"
|
|
974
|
+
*/
|
|
971
975
|
this.$emit("zinc-object-added", zincObject);
|
|
972
976
|
},
|
|
973
977
|
/**
|
|
@@ -1048,10 +1052,10 @@ export default {
|
|
|
1048
1052
|
hrefElement.remove();
|
|
1049
1053
|
},
|
|
1050
1054
|
/**
|
|
1051
|
-
* @
|
|
1055
|
+
* @public
|
|
1052
1056
|
* Function for capturing a screenshot of the current rendering.
|
|
1053
1057
|
*
|
|
1054
|
-
* @arg filename given to the screenshot.
|
|
1058
|
+
* @arg {String} "filename given to the screenshot."
|
|
1055
1059
|
*/
|
|
1056
1060
|
captureScreenshot: function (filename) {
|
|
1057
1061
|
this.captureFilename = filename;
|
|
@@ -1060,7 +1064,7 @@ export default {
|
|
|
1060
1064
|
);
|
|
1061
1065
|
},
|
|
1062
1066
|
/**
|
|
1063
|
-
* @
|
|
1067
|
+
* @public
|
|
1064
1068
|
* Function to clear current scene, the tree controls and the search index.
|
|
1065
1069
|
*/
|
|
1066
1070
|
clearScene: function () {
|
|
@@ -1069,15 +1073,19 @@ export default {
|
|
|
1069
1073
|
if (this.$module.scene) this.$module.scene.clearAll();
|
|
1070
1074
|
},
|
|
1071
1075
|
/**
|
|
1072
|
-
* @
|
|
1076
|
+
* @public
|
|
1073
1077
|
* Add and edit local annotations
|
|
1078
|
+
* @arg `region`,
|
|
1079
|
+
* @arg `group`,
|
|
1080
|
+
* @arg `zincObject`,
|
|
1081
|
+
* @arg `comment`
|
|
1074
1082
|
*/
|
|
1075
1083
|
addAndEditAnnotations: function (region, group, zincObject, comment) {
|
|
1076
1084
|
const annotation = addUserAnnotationWithFeature(this.annotator, this.userToken, zincObject,
|
|
1077
1085
|
region, group, this.url, comment);
|
|
1078
1086
|
if (this.enableLocalAnnotations) {
|
|
1079
1087
|
annotation.group = group;
|
|
1080
|
-
let regionPath = region;
|
|
1088
|
+
let regionPath = region;
|
|
1081
1089
|
if (regionPath.slice(-1) === "/") {
|
|
1082
1090
|
regionPath = regionPath.slice(0, -1);
|
|
1083
1091
|
}
|
|
@@ -1089,9 +1097,10 @@ export default {
|
|
|
1089
1097
|
this.$emit('userPrimitivesUpdated', {region, group, zincObject});
|
|
1090
1098
|
},
|
|
1091
1099
|
/**
|
|
1092
|
-
* @
|
|
1100
|
+
* @public
|
|
1093
1101
|
* Callback for when primitives have been update using primitive controls.
|
|
1094
1102
|
* This is only called from callback.
|
|
1103
|
+
* @arg `object`
|
|
1095
1104
|
*/
|
|
1096
1105
|
primitivesUpdated: function(object) {
|
|
1097
1106
|
if (object.isZincObject && object.isEditable) {
|
|
@@ -1101,8 +1110,9 @@ export default {
|
|
|
1101
1110
|
}
|
|
1102
1111
|
},
|
|
1103
1112
|
/**
|
|
1104
|
-
* @
|
|
1113
|
+
* @public
|
|
1105
1114
|
* Confirm creation of new primitive. This is only called from callback.
|
|
1115
|
+
* @arg `payload`
|
|
1106
1116
|
*/
|
|
1107
1117
|
confirmCreate: function(payload) {
|
|
1108
1118
|
if (payload) {
|
|
@@ -1180,7 +1190,7 @@ export default {
|
|
|
1180
1190
|
}
|
|
1181
1191
|
}
|
|
1182
1192
|
this.cancelCreate();
|
|
1183
|
-
},
|
|
1193
|
+
},
|
|
1184
1194
|
formatTooltip(val) {
|
|
1185
1195
|
if (this.timeMax >= 1000) {
|
|
1186
1196
|
if (val) {
|
|
@@ -1192,7 +1202,7 @@ export default {
|
|
|
1192
1202
|
return val ? val.toFixed(2) + " ms" : "0 ms";
|
|
1193
1203
|
},
|
|
1194
1204
|
/**
|
|
1195
|
-
* @
|
|
1205
|
+
* @public
|
|
1196
1206
|
* Function to reset the view to default.
|
|
1197
1207
|
* Also called when the associated button is pressed.
|
|
1198
1208
|
*/
|
|
@@ -1214,7 +1224,7 @@ export default {
|
|
|
1214
1224
|
}
|
|
1215
1225
|
},
|
|
1216
1226
|
/**
|
|
1217
|
-
* @
|
|
1227
|
+
* @public
|
|
1218
1228
|
* Function to zoom in.
|
|
1219
1229
|
* Also called when the associated button is pressed.
|
|
1220
1230
|
*/
|
|
@@ -1227,7 +1237,7 @@ export default {
|
|
|
1227
1237
|
* Function to zoom out.
|
|
1228
1238
|
* Also called when the associated button is pressed.
|
|
1229
1239
|
*
|
|
1230
|
-
* @
|
|
1240
|
+
* @public
|
|
1231
1241
|
*/
|
|
1232
1242
|
zoomOut: function () {
|
|
1233
1243
|
if (this.$module.scene) {
|
|
@@ -1237,7 +1247,8 @@ export default {
|
|
|
1237
1247
|
/**
|
|
1238
1248
|
* Function to change the current play speed.
|
|
1239
1249
|
*
|
|
1240
|
-
* @
|
|
1250
|
+
* @public
|
|
1251
|
+
* @arg `speed`
|
|
1241
1252
|
*/
|
|
1242
1253
|
speedChanged: function (speed) {
|
|
1243
1254
|
this.currentSpeed = speed;
|
|
@@ -1246,7 +1257,7 @@ export default {
|
|
|
1246
1257
|
/**
|
|
1247
1258
|
* Function used to stop the free spin
|
|
1248
1259
|
*
|
|
1249
|
-
* @
|
|
1260
|
+
* @public
|
|
1250
1261
|
*/
|
|
1251
1262
|
stopFreeSpin: function () {
|
|
1252
1263
|
let cameracontrol = this.$module.scene.getZincCameraControls();
|
|
@@ -1255,9 +1266,9 @@ export default {
|
|
|
1255
1266
|
},
|
|
1256
1267
|
/**
|
|
1257
1268
|
* Return a list of obejcts with the provided name.
|
|
1258
|
-
* @arg Group name to search.
|
|
1269
|
+
* @arg "Group name to search."
|
|
1259
1270
|
*
|
|
1260
|
-
* @
|
|
1271
|
+
* @public
|
|
1261
1272
|
*/
|
|
1262
1273
|
findObjectsWithGroupName: function (name) {
|
|
1263
1274
|
let objects = [];
|
|
@@ -1267,10 +1278,10 @@ export default {
|
|
|
1267
1278
|
return objects;
|
|
1268
1279
|
},
|
|
1269
1280
|
/**
|
|
1270
|
-
*
|
|
1271
|
-
*
|
|
1272
|
-
*
|
|
1273
|
-
* @
|
|
1281
|
+
* @public
|
|
1282
|
+
* Switch active drawing type
|
|
1283
|
+
* @arg {String} `type`
|
|
1284
|
+
* @arg {String} `icon`
|
|
1274
1285
|
*/
|
|
1275
1286
|
toggleDrawing: function (type, icon) {
|
|
1276
1287
|
this.createData.toBeDeleted = false;
|
|
@@ -1287,16 +1298,16 @@ export default {
|
|
|
1287
1298
|
/**
|
|
1288
1299
|
* Toggle the drawing box which aid the drawing
|
|
1289
1300
|
*
|
|
1290
|
-
* @
|
|
1301
|
+
* @public
|
|
1291
1302
|
*/
|
|
1292
1303
|
toggleDrawingBox: function () {
|
|
1293
1304
|
this.createData.drawingBox = !this.createData.drawingBox;
|
|
1294
1305
|
},
|
|
1295
1306
|
/**
|
|
1296
1307
|
* Find and and zoom into objects with the provided list of names.
|
|
1297
|
-
* @arg List of names
|
|
1308
|
+
* @arg "List of names"
|
|
1298
1309
|
*
|
|
1299
|
-
* @
|
|
1310
|
+
* @public
|
|
1300
1311
|
*/
|
|
1301
1312
|
viewRegion: function (names) {
|
|
1302
1313
|
const rootRegion = this.$module.scene.getRootRegion();
|
|
@@ -1392,11 +1403,11 @@ export default {
|
|
|
1392
1403
|
this.createData.points.push(coords);
|
|
1393
1404
|
}
|
|
1394
1405
|
}
|
|
1395
|
-
},
|
|
1406
|
+
},
|
|
1396
1407
|
/**
|
|
1397
1408
|
* Return renderer information
|
|
1398
1409
|
*
|
|
1399
|
-
* @
|
|
1410
|
+
* @public
|
|
1400
1411
|
*/
|
|
1401
1412
|
getRendererInfo: function () {
|
|
1402
1413
|
if (this.$module.zincRenderer) {
|
|
@@ -1408,7 +1419,7 @@ export default {
|
|
|
1408
1419
|
* Function used to rotate the scene.
|
|
1409
1420
|
* Also called when the associated button is pressed.
|
|
1410
1421
|
*
|
|
1411
|
-
* @
|
|
1422
|
+
* @public
|
|
1412
1423
|
*/
|
|
1413
1424
|
freeSpin: function () {
|
|
1414
1425
|
if (this.$module.scene) {
|
|
@@ -1503,8 +1514,10 @@ export default {
|
|
|
1503
1514
|
this.$refs.scaffoldTreeControls.removeActive(false);
|
|
1504
1515
|
}
|
|
1505
1516
|
}
|
|
1506
|
-
|
|
1507
|
-
|
|
1517
|
+
/**
|
|
1518
|
+
* Emit when an object is selected
|
|
1519
|
+
* @arg {Object} "Identifier of selected objects"
|
|
1520
|
+
*/
|
|
1508
1521
|
this.$emit("scaffold-selected", event.identifiers);
|
|
1509
1522
|
}
|
|
1510
1523
|
} else if (event.eventType == 2) {
|
|
@@ -1538,8 +1551,10 @@ export default {
|
|
|
1538
1551
|
this.createEditTemporaryLines(event.identifiers[0].extraData.worldCoords);
|
|
1539
1552
|
}
|
|
1540
1553
|
}
|
|
1541
|
-
|
|
1542
|
-
|
|
1554
|
+
/**
|
|
1555
|
+
* Emit when an object is highlighted
|
|
1556
|
+
* @arg {Object} "Identifier of selected objects"
|
|
1557
|
+
*/
|
|
1543
1558
|
this.$emit("scaffold-highlighted", event.identifiers);
|
|
1544
1559
|
}
|
|
1545
1560
|
} else if (event.eventType == 3) {
|
|
@@ -1560,7 +1575,7 @@ export default {
|
|
|
1560
1575
|
/**
|
|
1561
1576
|
* Get the coordinates of the current selected region.
|
|
1562
1577
|
*
|
|
1563
|
-
* @
|
|
1578
|
+
* @public
|
|
1564
1579
|
*/
|
|
1565
1580
|
getCoordinatesOfSelected: function () {
|
|
1566
1581
|
if (this.selectedObjects && this.selectedObjects.length > 0) {
|
|
@@ -1573,7 +1588,7 @@ export default {
|
|
|
1573
1588
|
* current selected region which will be updated after each render
|
|
1574
1589
|
* loop.
|
|
1575
1590
|
*
|
|
1576
|
-
* @
|
|
1591
|
+
* @public
|
|
1577
1592
|
*/
|
|
1578
1593
|
getDynamicSelectedCoordinates: function () {
|
|
1579
1594
|
return this.$module.selectedScreenCoordinates;
|
|
@@ -1653,10 +1668,10 @@ export default {
|
|
|
1653
1668
|
}
|
|
1654
1669
|
},
|
|
1655
1670
|
/**
|
|
1656
|
-
* @
|
|
1671
|
+
* @public
|
|
1657
1672
|
* Start the animation.
|
|
1658
1673
|
*
|
|
1659
|
-
* @arg flag to turn the animation on/off
|
|
1674
|
+
* @arg "flag to turn the animation on/off"
|
|
1660
1675
|
*/
|
|
1661
1676
|
play: function (flag) {
|
|
1662
1677
|
this.$module.playAnimation(flag);
|
|
@@ -1665,7 +1680,7 @@ export default {
|
|
|
1665
1680
|
//this.hideRegionTooltip();
|
|
1666
1681
|
},
|
|
1667
1682
|
/**
|
|
1668
|
-
* @
|
|
1683
|
+
* @public
|
|
1669
1684
|
* Function to toggle on/off overlay help.
|
|
1670
1685
|
*/
|
|
1671
1686
|
setHelpMode: function (helpMode) {
|
|
@@ -1893,7 +1908,7 @@ export default {
|
|
|
1893
1908
|
}
|
|
1894
1909
|
this.userInformation = undefined;
|
|
1895
1910
|
this.annotator.authenticate(this.userToken).then((userData) => {
|
|
1896
|
-
if (userData.name && userData.email) {
|
|
1911
|
+
if (userData.name && userData.email && userData.canUpdate) {
|
|
1897
1912
|
this.userInformation = userData;
|
|
1898
1913
|
//Only draw annotations stored in the server on initial authentication
|
|
1899
1914
|
if (!authenticated) {
|
|
@@ -1921,7 +1936,7 @@ export default {
|
|
|
1921
1936
|
}
|
|
1922
1937
|
},
|
|
1923
1938
|
/**
|
|
1924
|
-
* @
|
|
1939
|
+
* @public
|
|
1925
1940
|
* Hide the tooltip
|
|
1926
1941
|
*/
|
|
1927
1942
|
hideRegionTooltip: function () {
|
|
@@ -1939,7 +1954,7 @@ export default {
|
|
|
1939
1954
|
/**
|
|
1940
1955
|
* Set the marker modes for objects with the provided name, mode can
|
|
1941
1956
|
* be "on", "off" or "inherited".
|
|
1942
|
-
* Value can either be number or an object containing number and
|
|
1957
|
+
* Value can either be number or an object containing number and
|
|
1943
1958
|
* imgURL.
|
|
1944
1959
|
*/
|
|
1945
1960
|
setMarkerModeForObjectsWithName: function (name, value, mode) {
|
|
@@ -1955,8 +1970,10 @@ export default {
|
|
|
1955
1970
|
}
|
|
1956
1971
|
},
|
|
1957
1972
|
/**
|
|
1958
|
-
* @
|
|
1973
|
+
* @public
|
|
1959
1974
|
* Set the marker modes for objects specified by the list of annotations
|
|
1975
|
+
* @arg `annotations`
|
|
1976
|
+
* @arg `mode`
|
|
1960
1977
|
*/
|
|
1961
1978
|
setMarkerModeWithAnnotations: function (annotations, mode) {
|
|
1962
1979
|
if (this.$module.scene) {
|
|
@@ -1994,11 +2011,11 @@ export default {
|
|
|
1994
2011
|
}
|
|
1995
2012
|
},
|
|
1996
2013
|
/**
|
|
1997
|
-
* @
|
|
2014
|
+
* @public
|
|
1998
2015
|
*
|
|
1999
2016
|
* Search a object and display the tooltip
|
|
2000
|
-
* @arg text to search across
|
|
2001
|
-
* @arg toggle the tooltip if this is set
|
|
2017
|
+
* @arg "text to search across"
|
|
2018
|
+
* @arg "toggle the tooltip if this is set"
|
|
2002
2019
|
*/
|
|
2003
2020
|
search: function (text, displayLabel) {
|
|
2004
2021
|
if (this.$_searchIndex) {
|
|
@@ -2034,10 +2051,11 @@ export default {
|
|
|
2034
2051
|
return false;
|
|
2035
2052
|
},
|
|
2036
2053
|
/**
|
|
2037
|
-
* @
|
|
2054
|
+
* @public
|
|
2038
2055
|
*
|
|
2039
2056
|
* Get the list of suggested terms based on the provided term.
|
|
2040
2057
|
* This can be used for autocomplete.
|
|
2058
|
+
* @arg `term`
|
|
2041
2059
|
*/
|
|
2042
2060
|
fetchSuggestions: function (term) {
|
|
2043
2061
|
if (this.$_searchIndex === undefined) return [];
|
|
@@ -2092,7 +2110,9 @@ export default {
|
|
|
2092
2110
|
this.$module.updateTime(0);
|
|
2093
2111
|
this.$module.unsetFinishDownloadCallback();
|
|
2094
2112
|
this.addRegionsToSearchIndex();
|
|
2095
|
-
|
|
2113
|
+
/**
|
|
2114
|
+
* Emit when all objects have been loaded
|
|
2115
|
+
*/
|
|
2096
2116
|
this.$emit("on-ready");
|
|
2097
2117
|
this.setMarkers();
|
|
2098
2118
|
//Create a bounding box.
|
|
@@ -2112,7 +2132,7 @@ export default {
|
|
|
2112
2132
|
* Function used for getting the current states of the scene. This exported states
|
|
2113
2133
|
* can be imported using the importStates method.
|
|
2114
2134
|
*
|
|
2115
|
-
* @
|
|
2135
|
+
* @public
|
|
2116
2136
|
*/
|
|
2117
2137
|
getState: function () {
|
|
2118
2138
|
let state = {
|
|
@@ -2133,7 +2153,8 @@ export default {
|
|
|
2133
2153
|
* Function used for importing the states of the scene. This exported states
|
|
2134
2154
|
* can be imported using the read states method.
|
|
2135
2155
|
*
|
|
2136
|
-
* @
|
|
2156
|
+
* @public
|
|
2157
|
+
* @arg `state`
|
|
2137
2158
|
*/
|
|
2138
2159
|
setState: function (state) {
|
|
2139
2160
|
if (state) {
|
|
@@ -2166,9 +2187,9 @@ export default {
|
|
|
2166
2187
|
},
|
|
2167
2188
|
/**
|
|
2168
2189
|
* export current scene in GLTF.
|
|
2169
|
-
* @arg Return in binary form when set to true
|
|
2190
|
+
* @arg "Return in binary form when set to true"
|
|
2170
2191
|
*
|
|
2171
|
-
* @
|
|
2192
|
+
* @public
|
|
2172
2193
|
*/
|
|
2173
2194
|
exportGLTF: function (binary) {
|
|
2174
2195
|
return this.$module.scene.exportGLTF(binary);
|
|
@@ -2178,7 +2199,7 @@ export default {
|
|
|
2178
2199
|
* This list is used for storing user created annotation
|
|
2179
2200
|
* when enableLocalAnnotations is set to true.
|
|
2180
2201
|
*
|
|
2181
|
-
* @
|
|
2202
|
+
* @public
|
|
2182
2203
|
*/
|
|
2183
2204
|
getLocalAnnotations: function () {
|
|
2184
2205
|
return [...this.localAnnotationsList];
|
|
@@ -2188,7 +2209,8 @@ export default {
|
|
|
2188
2209
|
* be imported when enableLocalAnnotations is set to
|
|
2189
2210
|
* true;
|
|
2190
2211
|
*
|
|
2191
|
-
* @
|
|
2212
|
+
* @public
|
|
2213
|
+
* @arg {Array} `annotationsList`
|
|
2192
2214
|
*/
|
|
2193
2215
|
importLocalAnnotations: function (annotationsList) {
|
|
2194
2216
|
if (this.enableLocalAnnotations) {
|
|
@@ -2198,7 +2220,7 @@ export default {
|
|
|
2198
2220
|
const region = annotation.region;
|
|
2199
2221
|
let fullName = region.slice(-1) === "/" ? region : region + "/";
|
|
2200
2222
|
const noSlash = fullName.slice(0, -1);
|
|
2201
|
-
annotation.region = noSlash;
|
|
2223
|
+
annotation.region = noSlash;
|
|
2202
2224
|
fullName = fullName + group;
|
|
2203
2225
|
const featureID = encodeURIComponent(fullName);
|
|
2204
2226
|
annotation.item.id = featureID;
|
|
@@ -2217,7 +2239,9 @@ export default {
|
|
|
2217
2239
|
* viewport. This function will ignore the state prop and
|
|
2218
2240
|
* read in the new url.
|
|
2219
2241
|
*
|
|
2220
|
-
* @
|
|
2242
|
+
* @public
|
|
2243
|
+
* @arg `newValue`
|
|
2244
|
+
* @arg `state`
|
|
2221
2245
|
*/
|
|
2222
2246
|
setURLAndState: function (newValue, state) {
|
|
2223
2247
|
if (newValue != this._currentURL) {
|
|
@@ -2264,7 +2288,8 @@ export default {
|
|
|
2264
2288
|
* Function used for reading in new scaffold metadata. This function will ignore
|
|
2265
2289
|
* the state prop and read in the new url.
|
|
2266
2290
|
*
|
|
2267
|
-
* @
|
|
2291
|
+
* @public
|
|
2292
|
+
* @arg `newValue`
|
|
2268
2293
|
*/
|
|
2269
2294
|
setURL: function (newValue) {
|
|
2270
2295
|
this.setURLAndState(newValue, undefined);
|
|
@@ -2300,7 +2325,7 @@ export default {
|
|
|
2300
2325
|
}
|
|
2301
2326
|
},
|
|
2302
2327
|
/**
|
|
2303
|
-
* @
|
|
2328
|
+
* @public
|
|
2304
2329
|
*
|
|
2305
2330
|
* Force the renderer to resize
|
|
2306
2331
|
*/
|
|
@@ -2314,9 +2339,11 @@ export default {
|
|
|
2314
2339
|
if (this.tData.visible) {
|
|
2315
2340
|
this.showRegionTooltip(this.tData.label, true, true);
|
|
2316
2341
|
}
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2342
|
+
/**
|
|
2343
|
+
* Emit when the scene has been transformed due to navigation,
|
|
2344
|
+
* only triggered during syncControl mode
|
|
2345
|
+
* @arg {Object} "Information on the navigation"
|
|
2346
|
+
*/
|
|
2320
2347
|
this.$emit("scaffold-navigated", payload);
|
|
2321
2348
|
},
|
|
2322
2349
|
/**
|
package/vuese-generator.js
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
import fs from 'fs'
|
|
9
9
|
import path from 'path'
|
|
10
10
|
import chokidar from 'chokidar'
|
|
11
|
-
import { parser } from '@vuese/parser'
|
|
11
|
+
// import { parser } from '@vuese/parser'
|
|
12
|
+
import { parseSource } from 'vue-docgen-api'
|
|
12
13
|
import { Render } from '@vuese/markdown-render'
|
|
13
14
|
|
|
14
15
|
const watchMode = process.argv.find((argv) => argv === 'watch')
|
|
@@ -22,29 +23,87 @@ function generateMarkdown(file) {
|
|
|
22
23
|
const fileContent = fs.readFileSync(fileWithPath, 'utf-8')
|
|
23
24
|
|
|
24
25
|
try {
|
|
25
|
-
const parserResult = parser(fileContent)
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
// const parserResult = parser(fileContent)
|
|
27
|
+
const parserResult = parseSource(fileContent, fileWithPath)
|
|
28
|
+
parserResult.then((result) => {
|
|
29
|
+
const {
|
|
30
|
+
displayName: name,
|
|
31
|
+
description: desc,
|
|
32
|
+
props,
|
|
33
|
+
events,
|
|
34
|
+
methods
|
|
35
|
+
} = result
|
|
36
|
+
|
|
37
|
+
// transform props to vuese styles
|
|
38
|
+
const parseResult = {
|
|
39
|
+
name: name,
|
|
40
|
+
componentDesc: {
|
|
41
|
+
default: [desc]
|
|
42
|
+
},
|
|
43
|
+
props: transformData(props),
|
|
44
|
+
events: transformData(events),
|
|
45
|
+
methods: transformData(methods),
|
|
46
|
+
}
|
|
47
|
+
const r = new Render(parseResult)
|
|
48
|
+
const renderResult = r.render()
|
|
49
|
+
const markdownResult = r.renderMarkdown()
|
|
50
|
+
const markdownContent = markdownResult.content
|
|
51
|
+
const componentName = path.basename(fileWithPath, '.vue')
|
|
35
52
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
console.error(`Error writing markdown file for ${componentName}`, err)
|
|
39
|
-
} else {
|
|
40
|
-
console.log(`Markdown file for ${componentName} is generated!`)
|
|
53
|
+
if (!fs.existsSync(outputDir)) {
|
|
54
|
+
fs.mkdirSync(outputDir)
|
|
41
55
|
}
|
|
56
|
+
|
|
57
|
+
fs.writeFile(`${outputDir}/${componentName}.md`, markdownContent, (err) => {
|
|
58
|
+
if (err) {
|
|
59
|
+
console.error(`Error writing markdown file for ${componentName}`, err)
|
|
60
|
+
} else {
|
|
61
|
+
console.log(`Markdown file for ${componentName} is generated!`)
|
|
62
|
+
}
|
|
63
|
+
})
|
|
42
64
|
})
|
|
43
65
|
} catch(e) {
|
|
44
66
|
console.error(e)
|
|
45
67
|
}
|
|
46
68
|
}
|
|
47
69
|
|
|
70
|
+
function transformData(data = []) {
|
|
71
|
+
data.forEach((prop) => {
|
|
72
|
+
prop.name = prop.name
|
|
73
|
+
|
|
74
|
+
if (prop.description) {
|
|
75
|
+
prop.describe = [prop.description.replaceAll('\n', ' ')]
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (prop.type) {
|
|
79
|
+
prop.type = prop.type.name
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (prop.defaultValue) {
|
|
83
|
+
prop.default = prop.defaultValue.value.replaceAll('\n', ' ')
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// events
|
|
87
|
+
if (prop.properties) {
|
|
88
|
+
prop.argumentsDesc = []
|
|
89
|
+
prop.properties.forEach((param) => {
|
|
90
|
+
const argName = param.name || param.description
|
|
91
|
+
prop.argumentsDesc.push(argName)
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// methods
|
|
96
|
+
if (prop.params) {
|
|
97
|
+
prop.argumentsDesc = []
|
|
98
|
+
prop.params.forEach((param) => {
|
|
99
|
+
const argName = param.description || param.name
|
|
100
|
+
prop.argumentsDesc.push(argName)
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
return data
|
|
105
|
+
}
|
|
106
|
+
|
|
48
107
|
// To generate markdown files - one time
|
|
49
108
|
components.forEach((component) => {
|
|
50
109
|
console.log(`Write markdown file for ${component} on first load.`)
|