@papaemmelab/isabl-web 0.3.0 → 0.3.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.
@@ -0,0 +1,229 @@
1
+ 'use strict';
2
+
3
+ // Load modules
4
+
5
+ const Hoek = require('hoek');
6
+
7
+
8
+ // Declare internals
9
+
10
+ const internals = {};
11
+
12
+
13
+ exports = module.exports = internals.Topo = function () {
14
+
15
+ this._items = [];
16
+ this.nodes = [];
17
+ };
18
+
19
+
20
+ internals.Topo.prototype.add = function (nodes, options) {
21
+
22
+ options = options || {};
23
+
24
+ // Validate rules
25
+
26
+ const before = [].concat(options.before || []);
27
+ const after = [].concat(options.after || []);
28
+ const group = options.group || '?';
29
+ const sort = options.sort || 0; // Used for merging only
30
+
31
+ Hoek.assert(before.indexOf(group) === -1, 'Item cannot come before itself:', group);
32
+ Hoek.assert(before.indexOf('?') === -1, 'Item cannot come before unassociated items');
33
+ Hoek.assert(after.indexOf(group) === -1, 'Item cannot come after itself:', group);
34
+ Hoek.assert(after.indexOf('?') === -1, 'Item cannot come after unassociated items');
35
+
36
+ ([].concat(nodes)).forEach((node, i) => {
37
+
38
+ const item = {
39
+ seq: this._items.length,
40
+ sort: sort,
41
+ before: before,
42
+ after: after,
43
+ group: group,
44
+ node: node
45
+ };
46
+
47
+ this._items.push(item);
48
+ });
49
+
50
+ // Insert event
51
+
52
+ const error = this._sort();
53
+ Hoek.assert(!error, 'item', (group !== '?' ? 'added into group ' + group : ''), 'created a dependencies error');
54
+
55
+ return this.nodes;
56
+ };
57
+
58
+
59
+ internals.Topo.prototype.merge = function (others) {
60
+
61
+ others = [].concat(others);
62
+ for (let i = 0; i < others.length; ++i) {
63
+ const other = others[i];
64
+ if (other) {
65
+ for (let j = 0; j < other._items.length; ++j) {
66
+ const item = Hoek.shallow(other._items[j]);
67
+ this._items.push(item);
68
+ }
69
+ }
70
+ }
71
+
72
+ // Sort items
73
+
74
+ this._items.sort(internals.mergeSort);
75
+ for (let i = 0; i < this._items.length; ++i) {
76
+ this._items[i].seq = i;
77
+ }
78
+
79
+ const error = this._sort();
80
+ Hoek.assert(!error, 'merge created a dependencies error');
81
+
82
+ return this.nodes;
83
+ };
84
+
85
+
86
+ internals.mergeSort = function (a, b) {
87
+
88
+ return a.sort === b.sort ? 0 : (a.sort < b.sort ? -1 : 1);
89
+ };
90
+
91
+
92
+ internals.Topo.prototype._sort = function () {
93
+
94
+ // Construct graph
95
+
96
+ const graph = {};
97
+ const graphAfters = Object.create(null); // A prototype can bungle lookups w/ false positives
98
+ const groups = Object.create(null);
99
+
100
+ for (let i = 0; i < this._items.length; ++i) {
101
+ const item = this._items[i];
102
+ const seq = item.seq; // Unique across all items
103
+ const group = item.group;
104
+
105
+ // Determine Groups
106
+
107
+ groups[group] = groups[group] || [];
108
+ groups[group].push(seq);
109
+
110
+ // Build intermediary graph using 'before'
111
+
112
+ graph[seq] = item.before;
113
+
114
+ // Build second intermediary graph with 'after'
115
+
116
+ const after = item.after;
117
+ for (let j = 0; j < after.length; ++j) {
118
+ graphAfters[after[j]] = (graphAfters[after[j]] || []).concat(seq);
119
+ }
120
+ }
121
+
122
+ // Expand intermediary graph
123
+
124
+ let graphNodes = Object.keys(graph);
125
+ for (let i = 0; i < graphNodes.length; ++i) {
126
+ const node = graphNodes[i];
127
+ const expandedGroups = [];
128
+
129
+ const graphNodeItems = Object.keys(graph[node]);
130
+ for (let j = 0; j < graphNodeItems.length; ++j) {
131
+ const group = graph[node][graphNodeItems[j]];
132
+ groups[group] = groups[group] || [];
133
+
134
+ for (let k = 0; k < groups[group].length; ++k) {
135
+ expandedGroups.push(groups[group][k]);
136
+ }
137
+ }
138
+ graph[node] = expandedGroups;
139
+ }
140
+
141
+ // Merge intermediary graph using graphAfters into final graph
142
+
143
+ const afterNodes = Object.keys(graphAfters);
144
+ for (let i = 0; i < afterNodes.length; ++i) {
145
+ const group = afterNodes[i];
146
+
147
+ if (groups[group]) {
148
+ for (let j = 0; j < groups[group].length; ++j) {
149
+ const node = groups[group][j];
150
+ graph[node] = graph[node].concat(graphAfters[group]);
151
+ }
152
+ }
153
+ }
154
+
155
+ // Compile ancestors
156
+
157
+ let children;
158
+ const ancestors = {};
159
+ graphNodes = Object.keys(graph);
160
+ for (let i = 0; i < graphNodes.length; ++i) {
161
+ const node = graphNodes[i];
162
+ children = graph[node];
163
+
164
+ for (let j = 0; j < children.length; ++j) {
165
+ ancestors[children[j]] = (ancestors[children[j]] || []).concat(node);
166
+ }
167
+ }
168
+
169
+ // Topo sort
170
+
171
+ const visited = {};
172
+ const sorted = [];
173
+
174
+ for (let i = 0; i < this._items.length; ++i) {
175
+ let next = i;
176
+
177
+ if (ancestors[i]) {
178
+ next = null;
179
+ for (let j = 0; j < this._items.length; ++j) {
180
+ if (visited[j] === true) {
181
+ continue;
182
+ }
183
+
184
+ if (!ancestors[j]) {
185
+ ancestors[j] = [];
186
+ }
187
+
188
+ const shouldSeeCount = ancestors[j].length;
189
+ let seenCount = 0;
190
+ for (let k = 0; k < shouldSeeCount; ++k) {
191
+ if (sorted.indexOf(ancestors[j][k]) >= 0) {
192
+ ++seenCount;
193
+ }
194
+ }
195
+
196
+ if (seenCount === shouldSeeCount) {
197
+ next = j;
198
+ break;
199
+ }
200
+ }
201
+ }
202
+
203
+ if (next !== null) {
204
+ next = next.toString(); // Normalize to string TODO: replace with seq
205
+ visited[next] = true;
206
+ sorted.push(next);
207
+ }
208
+ }
209
+
210
+ if (sorted.length !== this._items.length) {
211
+ return new Error('Invalid dependencies');
212
+ }
213
+
214
+ const seqIndex = {};
215
+ for (let i = 0; i < this._items.length; ++i) {
216
+ const item = this._items[i];
217
+ seqIndex[item.seq] = item;
218
+ }
219
+
220
+ const sortedNodes = [];
221
+ this._items = sorted.map((value) => {
222
+
223
+ const sortedItem = seqIndex[value];
224
+ sortedNodes.push(sortedItem.node);
225
+ return sortedItem;
226
+ });
227
+
228
+ this.nodes = sortedNodes;
229
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@papaemmelab/isabl-web",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "lint": "vue-cli-service lint",
@@ -9,20 +9,16 @@
9
9
  "build-wc-async": "vue-cli-service build --target wc-async --name isabl-web ./src/components/*.vue",
10
10
  "publish-app": "yarn build-lib && yarn version --patch && yarn build-lib && yarn publish --access public",
11
11
  "dev": "yarn build-lib --watch",
12
- "postuninstall": "electron-builder install-app-deps",
13
12
  "test:unit": "vue-cli-service test:unit",
14
13
  "test:e2e": "vue-cli-service test:e2e",
15
14
  "test:travis": "yarn test:e2e --headless",
16
15
  "test:submissions": "node tests/utils/create_test_submission.js",
17
16
  "test:report-coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov -t $CODECOV_TOKEN",
18
- "electron:build": "vue-cli-service electron:build",
19
- "electron:serve": "vue-cli-service electron:serve",
20
- "electron:generate-icons": "electron-icon-builder --input=./public/icon.png --output=build --flatten",
21
- "postinstall": "electron-builder install-app-deps",
22
17
  "demo": "nodemon demo/demo-app.js"
23
18
  },
24
19
  "dependencies": {
25
- "ansi_up": "4.0.4",
20
+ "@mdi/font": "^7.0.96",
21
+ "ansi_up": "^5",
26
22
  "axios": "^0.21.1",
27
23
  "crossfilter": "^1.3.12",
28
24
  "crossfilter2": "^1.4.7",
@@ -40,7 +36,7 @@
40
36
  "vue-observe-visibility": "^0.4.6",
41
37
  "vue-router": "^3.0.1",
42
38
  "vue-upload-component": "^2.8.11",
43
- "vuetify": "1.1.9",
39
+ "vuetify": "2.6.10",
44
40
  "vuex": "^3.0.1",
45
41
  "vuex-router-sync": "^5.0.0"
46
42
  },
@@ -59,16 +55,14 @@
59
55
  "babel-jest": "^23.0.1",
60
56
  "babel-plugin-istanbul": "^5.2.0",
61
57
  "codecov": "^3.6.1",
62
- "electron": "^4.0.0",
63
- "electron-icon-builder": "^1.0.0",
58
+ "eslint-plugin-vuetify": "^1.1.0",
64
59
  "express": "^4.16.3",
65
60
  "html-webpack-plugin": "^3.2.0",
66
61
  "istanbul-lib-coverage": "^2.0.5",
67
62
  "mini-css-extract-plugin": "^0.4.2",
68
- "node-sass": "^4.9.0",
69
63
  "nyc": "^14.1.1",
64
+ "sass": "^1.55.0",
70
65
  "sass-loader": "^7.0.1",
71
- "vue-cli-plugin-electron-builder": "^1.2.0",
72
66
  "vue-template-compiler": "^2.5.16",
73
67
  "xlsx-populate": "^1.19.1"
74
68
  },