Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 35a347b

Browse files
committed
refactor(graph2d, network, timeline, utils): feature parity with br 0.x
Refactored monorepo to feature parity with branch 0.x. re #45, re #52
1 parent 666bcb5 commit 35a347b

File tree

18 files changed

+1435
-205
lines changed

18 files changed

+1435
-205
lines changed

‎lerna.json‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
{
22
"npmClient": "yarn",
33
"packages": ["packages/*"],
4-
"version": "independent"
4+
"version": "independent",
5+
"useWorkspaces": true,
6+
"command": {
7+
"publish": {
8+
"message": "chore(publish): 🤖update packages"
9+
}
10+
}
511
}

‎package.json‎

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,36 @@
33
"version": "0.1.0",
44
"private": true,
55
"description": "vue2vis monorepo",
6+
"workspaces": [
7+
"packages/*"
8+
],
69
"scripts": {
7-
"graph2d": "lerna run serve --scope @vue2vis/graph2d",
8-
"network": "lerna run serve --scope @vue2vis/network",
9-
"timeline": "lerna run serve --scope @vue2vis/timeline",
10+
"graph2d": "lerna run serve --stream --scope @vue2vis/graph2d",
11+
"network": "lerna run serve --stream --scope @vue2vis/network",
12+
"timeline": "lerna run serve --stream --scope @vue2vis/timeline",
13+
"clean": "lerna exec -- rm -rf ./node_modules",
14+
"commit": "yarn git-cz",
15+
"build": "lerna run build",
16+
"prepare": "lerna run prepare",
17+
"lerna:publish": "lerna lerna publish --conventional-commits",
18+
"lerna:changed": "lerna lerna changed",
1019
"test:unit": "vue-cli-service test:unit",
1120
"lint": "vue-cli-service lint"
1221
},
22+
"config": {
23+
"commitizen": {
24+
"path": "./node_modules/cz-conventional-changelog"
25+
}
26+
},
27+
"husky": {
28+
"hooks": {
29+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
30+
"pre-push": "yarn test:unit"
31+
}
32+
},
33+
"publishConfig": {
34+
"access": "public"
35+
},
1336
"repository": {
1437
"type": "git",
1538
"url": "git://github.com/alexcode/vue2vis.git"
@@ -28,20 +51,26 @@
2851
"vue": "^2.6.11"
2952
},
3053
"devDependencies": {
54+
"@commitlint/cli": "^8.3.5",
55+
"@commitlint/config-conventional": "^8.3.4",
3156
"@vue/cli-plugin-babel": "~4.2.0",
3257
"@vue/cli-plugin-eslint": "~4.2.0",
3358
"@vue/cli-plugin-unit-jest": "~4.2.0",
3459
"@vue/cli-service": "~4.2.0",
60+
"@vue/component-compiler": "^4.2.0",
3561
"@vue/eslint-config-prettier": "^6.0.0",
3662
"@vue/test-utils": "1.0.0-beta.31",
3763
"babel-eslint": "^10.0.3",
64+
"commitizen": "^4.0.3",
3865
"eslint": "^6.7.2",
3966
"eslint-plugin-prettier": "^3.1.1",
4067
"eslint-plugin-vue": "^6.1.2",
68+
"husky": "^4.2.3",
4169
"lerna": "^3.20.2",
4270
"prettier": "^1.19.1",
71+
"rollup": "^2.0.6",
72+
"rollup-plugin-vue": "^5.1.6",
4373
"vue": "^2.6.11",
44-
"vue-template-compiler": "^2.6.11",
45-
"vue2vis": "^0.0.16"
74+
"vue-template-compiler": "^2.6.11"
4675
}
4776
}

‎packages/graph2d/examples/App.vue‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@
3434
</template>
3535

3636
<script>
37-
import { Graph2d } from "../lib/main.js";
38-
// import { Timeline } from "@vue2vis/timeline";
37+
import { Graph2d } from "@vue2vis/graph2d";
3938
4039
export default {
4140
components: {
@@ -123,8 +122,6 @@ export default {
123122
</script>
124123

125124
<style lang="css">
126-
/* @import "../node_modules/vue2vis/dist/vue2vis.css"; */
127-
@import "../node_modules/vis-timeline/styles/vis-timeline-graph2d.css";
128125
* {
129126
font-family: sans-serif;
130127
}

‎packages/graph2d/lib/Graph2d.vue‎

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
<script>
66
import { DataSet, DataView } from "vis-data/esnext";
77
import { Graph2d } from "vis-timeline/esnext";
8-
import { subscribeEvents, translateEvent } from "@vue2vis/utils";
8+
import { mountVisData, translateEvent } from "@vue2vis/utils";
9+
import "vis-timeline/styles/vis-timeline-graph2d.css";
910
1011
export default {
1112
name: "graph2d",
1213
props: {
1314
groups: {
14-
type: [Array, DataSet, DataView],
15-
default: () => []
15+
type: [Array, DataSet, DataView]
1616
},
1717
items: {
1818
type: [Array, DataSet, DataView],
@@ -98,11 +98,9 @@ export default {
9898
},
9999
setGroups(groups) {
100100
this.graph2d.setGroups(groups);
101-
subscribeEvents(this, "groups", this.graph2d.groupsData);
102101
},
103102
setItems(items) {
104103
this.graph2d.setItems(items);
105-
subscribeEvents(this, "items", this.graph2d.itemsData);
106104
},
107105
setOptions(options) {
108106
this.graph2d.setOptions(options);
@@ -112,13 +110,14 @@ export default {
112110
}
113111
},
114112
mounted() {
115-
this.graph2d = new Graph2d(this.$refs.visualization);
116-
this.setOptions(this.options);
117-
if (this.groups) {
118-
this.setGroups(this.groups);
119-
}
120-
this.setItems(this.items);
121-
113+
this.visData.items = mountVisData(this, "items");
114+
this.visData.groups = mountVisData(this, "groups");
115+
this.graph2d = new Graph2d(
116+
this.$refs.visualization,
117+
this.visData.items,
118+
this.visData.groups,
119+
this.options
120+
);
122121
this.events.forEach(eventName =>
123122
this.graph2d.on(eventName, props =>
124123
this.$emit(translateEvent(eventName), props)

‎packages/graph2d/package.json‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@
55
"author": "Alex Couturon <infocontact.alex@gmail.com>",
66
"homepage": "https://github.com/alexcode/vue2vis#readme",
77
"license": "MIT",
8-
"main": "lib/main.js",
8+
"main": "dist/graph2d.cjs.js",
9+
"module": "dist/graph2d.esm.js",
910
"directories": {
1011
"lib": "lib",
1112
"test": "__tests__"
1213
},
1314
"files": [
1415
"lib"
1516
],
16-
"publishConfig": {
17-
"registry": "https://registry.yarnpkg.com"
18-
},
1917
"repository": {
2018
"type": "git",
2119
"url": "git+https://github.com/alexcode/vue2vis.git"
2220
},
2321
"scripts": {
2422
"test": "echo \"Error: run tests from root\" && exit 1",
2523
"serve": "vue-cli-service serve ./examples/main.js",
26-
"prepublishOnly": "vue-cli-service build --target lib ./lib/main.js"
24+
"build": "rollup -c rollup.config.js",
25+
"prepare": "rollup -c rollup.config.js",
26+
"prepublishOnly": "rollup -c rollup.config.js"
2727
},
2828
"bugs": {
2929
"url": "https://github.com/alexcode/vue2vis/issues"
@@ -33,15 +33,17 @@
3333
"vis-timeline": "^7.2.1"
3434
},
3535
"peerDependencies": {
36-
"@egjs/hammerjs": "^2.0.0",
3736
"moment": "^2.24.0",
38-
"vis-data": "^6.5.0",
39-
"vis-util": "^4.0.0"
37+
"vis-data": "^6.3.0"
4038
},
4139
"devDependencies": {
4240
"@egjs/hammerjs": "^2.0.0",
41+
"component-emitter": "^1.3.0",
42+
"keycharm": "^0.3.0",
4343
"moment": "^2.24.0",
44-
"vis-data": "^6.5.0",
44+
"propagating-hammerjs": "^1.4.0",
45+
"uuid": "^3.4.0",
46+
"vis-data": "^6.3.0",
4547
"vis-util": "^4.0.0"
4648
}
4749
}

‎packages/graph2d/rollup.config.js‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import vue from "rollup-plugin-vue";
2+
3+
export default [
4+
{
5+
input: "./lib/main.js",
6+
output: {
7+
format: "esm",
8+
file: "dist/graph2d.esm.js"
9+
},
10+
plugins: [vue()]
11+
},
12+
{
13+
input: "./lib/main.js",
14+
output: {
15+
format: "cjs",
16+
file: "dist/graph2d.cjs.js"
17+
},
18+
plugins: [vue()]
19+
}
20+
];

‎packages/network/examples/App.vue‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@
6464
</template>
6565

6666
<script>
67-
import { Network } from "../lib/main.js";
68-
// import { Network } from "@vue2vis/network";
67+
import { Network } from "@vue2vis/network";
6968
7069
export default {
7170
components: {

‎packages/network/lib/Network.vue‎

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
<script>
66
import { DataSet, DataView } from "vis-data/esnext";
77
import { Network } from "vis-network/esnext";
8-
import { subscribeEvents, translateEvent } from "@vue2vis/utils";
8+
import { mountVisData, translateEvent } from "@vue2vis/utils";
9+
import "vis-network/styles/vis-network.css";
910
1011
export default {
1112
name: "network",
@@ -60,8 +61,8 @@ export default {
6061
},
6162
data: () => ({
6263
visData: {
63-
nodes: null,
64-
edges: null
64+
nodes: [],
65+
edges: []
6566
}
6667
}),
6768
watch: {
@@ -76,8 +77,6 @@ export default {
7677
setData(n, e) {
7778
this.visData.nodes = Array.isArray(n) ? new DataSet(n) : n;
7879
this.visData.edges = Array.isArray(e) ? new DataSet(e) : e;
79-
subscribeEvents(this, "nodes", this.visData.nodes);
80-
subscribeEvents(this, "edges", this.visData.edges);
8180
this.network.setData(this.visData);
8281
},
8382
destroy() {
@@ -258,18 +257,13 @@ export default {
258257
this.network = null;
259258
},
260259
mounted() {
261-
const container = this.$refs.visualization;
262-
this.visData.nodes = Array.isArray(this.nodes)
263-
? new DataSet(this.nodes)
264-
: this.nodes;
265-
this.visData.edges = Array.isArray(this.edges)
266-
? new DataSet(this.edges)
267-
: this.edges;
268-
269-
subscribeEvents(this, "nodes", this.visData.nodes);
270-
subscribeEvents(this, "edges", this.visData.edges);
271-
272-
this.network = new Network(container, this.visData, this.options);
260+
this.visData.nodes = mountVisData(this, "nodes");
261+
this.visData.edges = mountVisData(this, "edges");
262+
this.network = new Network(
263+
this.$refs.visualization,
264+
this.visData,
265+
this.options
266+
);
273267
274268
this.events.forEach(eventName =>
275269
this.network.on(eventName, props =>

‎packages/network/package.json‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@
55
"author": "Alex Couturon <infocontact.alex@gmail.com>",
66
"homepage": "https://github.com/alexcode/vue2vis#readme",
77
"license": "MIT",
8-
"main": "lib/main.js",
8+
"main": "dist/network.cjs.js",
9+
"module": "dist/network.esm.js",
910
"directories": {
1011
"lib": "lib",
1112
"test": "__tests__"
1213
},
1314
"files": [
1415
"lib"
1516
],
16-
"publishConfig": {
17-
"registry": "https://registry.yarnpkg.com"
18-
},
1917
"repository": {
2018
"type": "git",
2119
"url": "git+https://github.com/alexcode/vue2vis.git"
2220
},
2321
"scripts": {
2422
"test": "echo \"Error: run tests from root\" && exit 1",
2523
"serve": "vue-cli-service serve ./examples/main.js",
26-
"prepublishOnly": "vue-cli-service build --target lib ./lib/main.js"
24+
"build": "rollup -c rollup.config.js",
25+
"prepare": "rollup -c rollup.config.js",
26+
"prepublishOnly": "rollup -c rollup.config.js"
2727
},
2828
"bugs": {
2929
"url": "https://github.com/alexcode/vue2vis/issues"
@@ -33,15 +33,17 @@
3333
"vis-network": "^7.4.0"
3434
},
3535
"peerDependencies": {
36-
"@egjs/hammerjs": "^2.0.0",
3736
"moment": "^2.24.0",
38-
"vis-data": "^6.5.0",
39-
"vis-util": "^4.0.0"
37+
"vis-data": "^6.5.0"
4038
},
4139
"devDependencies": {
4240
"@egjs/hammerjs": "^2.0.0",
41+
"component-emitter": "^1.3.0",
42+
"keycharm": "^0.3.0",
4343
"moment": "^2.24.0",
44-
"vis-data": "^6.5.0",
44+
"timsort": "^0.3.0",
45+
"uuid": "^7.0.0",
46+
"vis-data": "^6.2.1",
4547
"vis-util": "^4.0.0"
4648
}
4749
}

‎packages/network/rollup.config.js‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import vue from "rollup-plugin-vue";
2+
3+
export default [
4+
{
5+
input: "./lib/main.js",
6+
output: {
7+
format: "esm",
8+
file: "dist/network.esm.js"
9+
},
10+
plugins: [vue()]
11+
},
12+
{
13+
input: "./lib/main.js",
14+
output: {
15+
format: "cjs",
16+
file: "dist/network.cjs.js"
17+
},
18+
plugins: [vue()]
19+
}
20+
];

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /