@receptron/graphai_vue_cytoscape 0.2.0 → 0.3.0

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.
Files changed (2) hide show
  1. package/lib/cytoscape.js +156 -234
  2. package/package.json +9 -8
package/lib/cytoscape.js CHANGED
@@ -1,79 +1,25 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
24
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
- var __importDefault = (this && this.__importDefault) || function (mod) {
50
- return (mod && mod.__esModule) ? mod : { "default": mod };
51
- };
52
- var _a;
53
- Object.defineProperty(exports, "__esModule", { value: true });
54
- exports.useCytoscape = exports.dataSourceNodeIds = exports.inputs2dataSources = void 0;
55
- var vue_1 = require("vue");
56
- var graphai_1 = require("graphai");
57
- var cytoscape_1 = __importDefault(require("cytoscape"));
58
- var cytoscape_klay_1 = __importDefault(require("cytoscape-klay"));
59
- cytoscape_1.default.use(cytoscape_klay_1.default);
60
- var layout = "klay";
61
- var colorPriority = "#f80";
62
- var colorStatic = "#88f";
63
- var calcNodeWidth = function (label) {
1
+ import { ref, onMounted, watch } from "vue";
2
+ import { NodeState, sleep, isObject } from "graphai";
3
+ import cytoscape from "cytoscape";
4
+ import klay from "cytoscape-klay";
5
+ cytoscape.use(klay);
6
+ const layout = "klay";
7
+ const colorPriority = "#f80";
8
+ const colorStatic = "#88f";
9
+ const calcNodeWidth = (label) => {
64
10
  if (label === null || label === undefined) {
65
11
  return "50px";
66
12
  }
67
13
  return Math.max(50, label.length * 8) + "px";
68
14
  };
69
- var cyStyle = [
15
+ const cyStyle = [
70
16
  {
71
17
  selector: "node",
72
18
  style: {
73
19
  "background-color": "data(color)",
74
20
  label: "data(id)",
75
- shape: function (ele) { return (ele.data("isStatic") ? "rectangle" : "roundrectangle"); },
76
- width: function (ele) { return calcNodeWidth(ele.data("id")); },
21
+ shape: (ele) => (ele.data("isStatic") ? "rectangle" : "roundrectangle"),
22
+ width: (ele) => calcNodeWidth(ele.data("id")),
77
23
  color: "#fff",
78
24
  height: "30px",
79
25
  "text-valign": "center",
@@ -122,69 +68,67 @@ var cyStyle = [
122
68
  },
123
69
  },
124
70
  ];
125
- var colorMap = (_a = {},
126
- _a[graphai_1.NodeState.Waiting] = "#888",
127
- _a[graphai_1.NodeState.Completed] = "#000",
128
- _a[graphai_1.NodeState.Executing] = "#0f0",
129
- _a["executing-server"] = "#FFC0CB",
130
- _a[graphai_1.NodeState.Queued] = "#ff0",
131
- _a[graphai_1.NodeState.Injected] = "#00f",
132
- _a[graphai_1.NodeState.TimedOut] = "#f0f",
133
- _a[graphai_1.NodeState.Failed] = "#f00",
134
- _a[graphai_1.NodeState.Skipped] = "#0ff",
135
- _a);
136
- var parseInput = function (input) {
71
+ const colorMap = {
72
+ [NodeState.Waiting]: "#888",
73
+ [NodeState.Completed]: "#000",
74
+ [NodeState.Executing]: "#0f0",
75
+ ["executing-server"]: "#FFC0CB",
76
+ [NodeState.Queued]: "#ff0",
77
+ [NodeState.Injected]: "#00f",
78
+ [NodeState.TimedOut]: "#f0f",
79
+ [NodeState.Failed]: "#f00",
80
+ [NodeState.Skipped]: "#0ff",
81
+ };
82
+ const parseInput = (input) => {
137
83
  // WARNING: Assuming the first character is always ":"
138
- var ids = input.slice(1).split(".");
139
- var source = ids.shift() || "";
140
- var label = ids.length ? ids.join(".") : undefined;
141
- return { source: source, label: label };
84
+ const ids = input.slice(1).split(".");
85
+ const source = ids.shift() || "";
86
+ const label = ids.length ? ids.join(".") : undefined;
87
+ return { source, label };
142
88
  };
143
- var inputs2dataSources = function (inputs) {
89
+ export const inputs2dataSources = (inputs) => {
144
90
  if (Array.isArray(inputs)) {
145
- return inputs.map(function (inp) { return (0, exports.inputs2dataSources)(inp); }).flat();
91
+ return inputs.map((inp) => inputs2dataSources(inp)).flat();
146
92
  }
147
- if ((0, graphai_1.isObject)(inputs)) {
93
+ if (isObject(inputs)) {
148
94
  return Object.values(inputs)
149
- .map(function (input) { return (0, exports.inputs2dataSources)(input); })
95
+ .map((input) => inputs2dataSources(input))
150
96
  .flat();
151
97
  }
152
98
  if (typeof inputs === "string") {
153
- var templateMatch = Array.from(inputs.matchAll(/\${(:[^}]+)}/g)).map(function (m) { return m[1]; });
99
+ const templateMatch = Array.from(inputs.matchAll(/\${(:[^}]+)}/g)).map((m) => m[1]);
154
100
  if (templateMatch.length > 0) {
155
- return (0, exports.inputs2dataSources)(templateMatch);
101
+ return inputs2dataSources(templateMatch);
156
102
  }
157
103
  }
158
104
  return inputs;
159
105
  };
160
- exports.inputs2dataSources = inputs2dataSources;
161
- var dataSourceNodeIds = function (sources) {
162
- return sources.filter(function (source) { return source.nodeId; }).map(function (source) { return source.nodeId; });
106
+ export const dataSourceNodeIds = (sources) => {
107
+ return sources.filter((source) => source.nodeId).map((source) => source.nodeId);
163
108
  };
164
- exports.dataSourceNodeIds = dataSourceNodeIds;
165
- var node2cyNode = function (node, nodeId) {
166
- var isStatic = "value" in node;
167
- var cyNode = {
109
+ const node2cyNode = (node, nodeId) => {
110
+ const isStatic = "value" in node;
111
+ const cyNode = {
168
112
  data: {
169
113
  id: nodeId,
170
- color: isStatic ? colorStatic : colorMap[graphai_1.NodeState.Waiting],
171
- isStatic: isStatic,
114
+ color: isStatic ? colorStatic : colorMap[NodeState.Waiting],
115
+ isStatic,
172
116
  },
173
117
  };
174
118
  return cyNode;
175
119
  };
176
- var node2cyEdge = function (node, nodeId) {
177
- var edges = [];
120
+ const node2cyEdge = (node, nodeId) => {
121
+ const edges = [];
178
122
  if ("inputs" in node) {
179
123
  // computed node
180
- (0, exports.inputs2dataSources)(node.inputs).forEach(function (input) {
124
+ inputs2dataSources(node.inputs).forEach((input) => {
181
125
  if (input[0] === ":") {
182
- var _a = parseInput(input), source = _a.source, label = _a.label;
126
+ const { source, label } = parseInput(input);
183
127
  edges.push({
184
128
  data: {
185
- source: source,
129
+ source,
186
130
  target: nodeId,
187
- label: label,
131
+ label,
188
132
  },
189
133
  });
190
134
  }
@@ -192,15 +136,15 @@ var node2cyEdge = function (node, nodeId) {
192
136
  }
193
137
  if ("update" in node && node.update) {
194
138
  // static node
195
- (0, exports.inputs2dataSources)([node.update]).forEach(function (input) {
139
+ inputs2dataSources([node.update]).forEach((input) => {
196
140
  if (input[0] === ":") {
197
- var _a = parseInput(input), source = _a.source, label = _a.label;
141
+ const { source, label } = parseInput(input);
198
142
  edges.push({
199
143
  data: {
200
- source: source,
144
+ source,
201
145
  target: nodeId,
202
146
  isUpdate: true,
203
- label: label,
147
+ label,
204
148
  },
205
149
  });
206
150
  }
@@ -208,28 +152,28 @@ var node2cyEdge = function (node, nodeId) {
208
152
  }
209
153
  return edges;
210
154
  };
211
- var cytoscapeFromGraph = function (_graph_data) {
212
- var elements = { nodes: [], edges: [], map: {} };
213
- var pushEdge = function (data) {
214
- elements.edges.push({ data: data });
155
+ const cytoscapeFromGraph = (_graph_data) => {
156
+ const elements = { nodes: [], edges: [], map: {} };
157
+ const pushEdge = (data) => {
158
+ elements.edges.push({ data });
215
159
  };
216
- var toGraph = function (graph_data) {
217
- Object.keys(graph_data.nodes || {}).forEach(function (nodeId) {
218
- var node = graph_data.nodes[nodeId];
219
- var cyNode = node2cyNode(node, nodeId);
160
+ const toGraph = (graph_data) => {
161
+ Object.keys(graph_data.nodes || {}).forEach((nodeId) => {
162
+ const node = graph_data.nodes[nodeId];
163
+ const cyNode = node2cyNode(node, nodeId);
220
164
  elements.nodes.push(cyNode);
221
165
  elements.map[nodeId] = cyNode;
222
- node2cyEdge(node, nodeId).forEach(function (edge) {
166
+ node2cyEdge(node, nodeId).forEach((edge) => {
223
167
  elements.edges.push(edge);
224
168
  });
225
169
  // nested
226
170
  if ("agent" in node && node.agent === "nestedAgent") {
227
- var graph_1 = typeof node.graph === "string" ? JSON.parse(node.graph) : __assign({}, node.graph);
228
- var staticInputs_1 = Object.keys(graph_1.nodes)
229
- .filter(function (key) { return "value" in graph_1.nodes[key]; })
230
- .reduce(function (tmp, key) {
231
- if (graph_1.nodes[key].value[0] === ":") {
232
- var source = parseInput(graph_1.nodes[key].value).source;
171
+ const graph = typeof node.graph === "string" ? JSON.parse(node.graph) : { ...node.graph };
172
+ const staticInputs = Object.keys(graph.nodes)
173
+ .filter((key) => "value" in graph.nodes[key])
174
+ .reduce((tmp, key) => {
175
+ if (graph.nodes[key].value[0] === ":") {
176
+ const { source } = parseInput(graph.nodes[key].value);
233
177
  if (!tmp[source]) {
234
178
  tmp[source] = [];
235
179
  }
@@ -237,23 +181,23 @@ var cytoscapeFromGraph = function (_graph_data) {
237
181
  }
238
182
  return tmp;
239
183
  }, {});
240
- Object.keys(node.inputs).forEach(function (parentInputNodeId) {
241
- if (!graph_1.nodes[parentInputNodeId]) {
242
- graph_1.nodes[parentInputNodeId] = { value: "dummy" };
184
+ Object.keys(node.inputs).forEach((parentInputNodeId) => {
185
+ if (!graph.nodes[parentInputNodeId]) {
186
+ graph.nodes[parentInputNodeId] = { value: "dummy" };
243
187
  }
244
- (0, exports.inputs2dataSources)([node.inputs[parentInputNodeId]]).forEach(function (input) {
245
- var source = parseInput(input).source;
188
+ inputs2dataSources([node.inputs[parentInputNodeId]]).forEach((input) => {
189
+ const { source } = parseInput(input);
246
190
  pushEdge({ source: nodeId, target: parentInputNodeId, label: source });
247
- if (staticInputs_1[parentInputNodeId]) {
248
- staticInputs_1[parentInputNodeId].forEach(function (id) {
191
+ if (staticInputs[parentInputNodeId]) {
192
+ staticInputs[parentInputNodeId].forEach((id) => {
249
193
  pushEdge({ source: nodeId, target: id, label: parentInputNodeId });
250
194
  });
251
195
  }
252
196
  });
253
197
  });
254
- toGraph(graph_1);
255
- Object.keys(graph_1.nodes).forEach(function (key) {
256
- var childNode = graph_1.nodes[key];
198
+ toGraph(graph);
199
+ Object.keys(graph.nodes).forEach((key) => {
200
+ const childNode = graph.nodes[key];
257
201
  if ("agent" in childNode && childNode.isResult) {
258
202
  pushEdge({ source: key, target: nodeId, label: "result", isResult: true });
259
203
  }
@@ -262,55 +206,42 @@ var cytoscapeFromGraph = function (_graph_data) {
262
206
  });
263
207
  };
264
208
  toGraph(_graph_data);
265
- return { elements: elements };
209
+ return { elements };
266
210
  };
267
- var useCytoscape = function (selectedGraph) {
268
- var _a;
269
- var cy = null;
270
- var cytoscapeData = (0, vue_1.ref)(cytoscapeFromGraph((_a = selectedGraph.value) !== null && _a !== void 0 ? _a : { nodes: {} }));
271
- var cytoscapeRef = (0, vue_1.ref)();
272
- var zoomingEnabled = (0, vue_1.ref)(true);
273
- var updateCytoscape = function (log) { return __awaiter(void 0, void 0, void 0, function () {
274
- var nodeId, state, elements, graph, nodeData;
275
- var _a, _b, _c;
276
- return __generator(this, function (_d) {
277
- switch (_d.label) {
278
- case 0:
279
- nodeId = log.nodeId, state = log.state;
280
- if (![graphai_1.NodeState.Completed, graphai_1.NodeState.Waiting].includes(state)) return [3 /*break*/, 2];
281
- return [4 /*yield*/, (0, graphai_1.sleep)(100)];
282
- case 1:
283
- _d.sent();
284
- _d.label = 2;
285
- case 2:
286
- elements = cytoscapeData.value.elements;
287
- if (!elements.map[nodeId]) return [3 /*break*/, 4];
288
- elements.map[nodeId].data.color = colorMap[state];
289
- graph = selectedGraph.value;
290
- nodeData = (_b = ((_a = graph === null || graph === void 0 ? void 0 : graph.nodes) !== null && _a !== void 0 ? _a : {})[nodeId]) !== null && _b !== void 0 ? _b : {};
291
- if ("agent" in nodeData && state === graphai_1.NodeState.Queued && ((_c = nodeData.priority) !== null && _c !== void 0 ? _c : 0) > 0) {
292
- // computed node
293
- elements.map[nodeId].data.color = colorPriority;
294
- }
295
- else if ("value" in nodeData && state === graphai_1.NodeState.Waiting) {
296
- // static node
297
- elements.map[nodeId].data.color = colorStatic;
298
- }
299
- cytoscapeData.value = { elements: elements };
300
- if (!(state === graphai_1.NodeState.Injected)) return [3 /*break*/, 4];
301
- return [4 /*yield*/, (0, graphai_1.sleep)(100)];
302
- case 3:
303
- _d.sent();
304
- elements.map[nodeId].data.color = colorStatic;
305
- cytoscapeData.value = { elements: elements };
306
- _d.label = 4;
307
- case 4: return [2 /*return*/];
211
+ export const useCytoscape = (selectedGraph) => {
212
+ let cy = null;
213
+ const cytoscapeData = ref(cytoscapeFromGraph(selectedGraph.value ?? { nodes: {} }));
214
+ const cytoscapeRef = ref();
215
+ const zoomingEnabled = ref(true);
216
+ const updateCytoscape = async (log) => {
217
+ const { nodeId, state } = log;
218
+ if ([NodeState.Completed, NodeState.Waiting].includes(state)) {
219
+ await sleep(100);
220
+ }
221
+ const elements = cytoscapeData.value.elements;
222
+ if (elements.map[nodeId]) {
223
+ elements.map[nodeId].data.color = colorMap[state];
224
+ const graph = selectedGraph.value;
225
+ const nodeData = (graph?.nodes ?? {})[nodeId] ?? {};
226
+ if ("agent" in nodeData && state === NodeState.Queued && (nodeData.priority ?? 0) > 0) {
227
+ // computed node
228
+ elements.map[nodeId].data.color = colorPriority;
308
229
  }
309
- });
310
- }); };
311
- var createCytoscape = function () {
230
+ else if ("value" in nodeData && state === NodeState.Waiting) {
231
+ // static node
232
+ elements.map[nodeId].data.color = colorStatic;
233
+ }
234
+ cytoscapeData.value = { elements };
235
+ if (state === NodeState.Injected) {
236
+ await sleep(100);
237
+ elements.map[nodeId].data.color = colorStatic;
238
+ cytoscapeData.value = { elements };
239
+ }
240
+ }
241
+ };
242
+ const createCytoscape = () => {
312
243
  try {
313
- cy = (0, cytoscape_1.default)({
244
+ cy = cytoscape({
314
245
  container: cytoscapeRef.value,
315
246
  style: cyStyle,
316
247
  layout: {
@@ -332,67 +263,59 @@ var useCytoscape = function (selectedGraph) {
332
263
  // error_msg.value = `${error}`;
333
264
  }
334
265
  };
335
- var updateGraphData = function () { return __awaiter(void 0, void 0, void 0, function () {
336
- var name_1;
337
- return __generator(this, function (_a) {
338
- switch (_a.label) {
339
- case 0:
340
- if (!cy) return [3 /*break*/, 2];
341
- cy.elements().remove();
342
- cy.add(cytoscapeData.value.elements);
343
- name_1 = cytoscapeData.value.elements.nodes.reduce(function (prevName, node) {
344
- if (node.position) {
345
- return "preset";
346
- }
347
- return prevName;
348
- }, layout);
349
- // console.log("layout", name);
350
- cy.layout({ name: name_1 }).run();
351
- cy.fit();
352
- if (!(name_1 === layout)) return [3 /*break*/, 2];
353
- return [4 /*yield*/, (0, graphai_1.sleep)(400)];
354
- case 1:
355
- _a.sent();
356
- storePositions();
357
- _a.label = 2;
358
- case 2: return [2 /*return*/];
266
+ const updateGraphData = async () => {
267
+ if (cy) {
268
+ cy.elements().remove();
269
+ cy.add(cytoscapeData.value.elements);
270
+ const name = cytoscapeData.value.elements.nodes.reduce((prevName, node) => {
271
+ if (node.position) {
272
+ return "preset";
273
+ }
274
+ return prevName;
275
+ }, layout);
276
+ // console.log("layout", name);
277
+ cy.layout({ name }).run();
278
+ cy.fit();
279
+ if (name === layout) {
280
+ await sleep(400);
281
+ storePositions();
359
282
  }
360
- });
361
- }); };
362
- var storePositions = function () {
283
+ }
284
+ };
285
+ const storePositions = () => {
363
286
  // console.log("storePositions");
364
287
  if (cy) {
365
- cy.nodes().forEach(function (cynode) {
366
- var id = cynode.id();
367
- var pos = cynode.position();
368
- var node = cytoscapeData.value.elements.map[id];
288
+ cy.nodes().forEach((cynode) => {
289
+ const id = cynode.id();
290
+ const pos = cynode.position();
291
+ const node = cytoscapeData.value.elements.map[id];
369
292
  node.position = pos;
370
293
  });
371
294
  }
372
295
  };
373
- var resetCytoscape = function () {
374
- var elements = cytoscapeData.value.elements;
375
- Object.keys(elements.map).forEach(function (nodeId) {
376
- var graph = selectedGraph.value;
377
- var nodeData = graph.nodes[nodeId];
378
- elements.map[nodeId].data.color = "value" in nodeData ? colorStatic : colorMap[graphai_1.NodeState.Waiting];
296
+ const resetCytoscape = () => {
297
+ const elements = cytoscapeData.value.elements;
298
+ Object.keys(elements.map).forEach((nodeId) => {
299
+ const graph = selectedGraph.value;
300
+ const nodeData = graph.nodes[nodeId];
301
+ elements.map[nodeId].data.color = "value" in nodeData ? colorStatic : colorMap[NodeState.Waiting];
379
302
  });
380
- cytoscapeData.value = { elements: elements };
303
+ cytoscapeData.value = { elements };
381
304
  };
382
- (0, vue_1.watch)(cytoscapeData, function () {
305
+ watch(cytoscapeData, () => {
383
306
  console.log("updated");
384
307
  updateGraphData();
385
308
  });
386
- (0, vue_1.watch)(selectedGraph, function () {
309
+ watch(selectedGraph, () => {
387
310
  cytoscapeData.value = cytoscapeFromGraph(selectedGraph.value);
388
311
  });
389
- (0, vue_1.onMounted)(function () {
312
+ onMounted(() => {
390
313
  createCytoscape();
391
314
  updateGraphData();
392
315
  });
393
- var layoutCytoscape = function (key) {
316
+ const layoutCytoscape = (key) => {
394
317
  if (cy) {
395
- var positions = cy.nodes().map(function (node) {
318
+ const positions = cy.nodes().map((node) => {
396
319
  return {
397
320
  id: node.id(),
398
321
  position: node.position(),
@@ -402,13 +325,13 @@ var useCytoscape = function (selectedGraph) {
402
325
  localStorage.setItem("layoutData-" + key, JSON.stringify(positions));
403
326
  }
404
327
  };
405
- var loadLayout = function (key) {
406
- var savedLayoutData = localStorage.getItem("layoutData-" + key);
328
+ const loadLayout = (key) => {
329
+ const savedLayoutData = localStorage.getItem("layoutData-" + key);
407
330
  if (savedLayoutData) {
408
- var positions = JSON.parse(savedLayoutData);
409
- positions.forEach(function (data) {
331
+ const positions = JSON.parse(savedLayoutData);
332
+ positions.forEach((data) => {
410
333
  if (cy) {
411
- var node = cy.getElementById(data.id);
334
+ const node = cy.getElementById(data.id);
412
335
  if (node) {
413
336
  node.position(data.position);
414
337
  }
@@ -416,18 +339,17 @@ var useCytoscape = function (selectedGraph) {
416
339
  });
417
340
  }
418
341
  };
419
- (0, vue_1.watch)(zoomingEnabled, function (value) {
342
+ watch(zoomingEnabled, (value) => {
420
343
  if (cy) {
421
344
  cy.zoomingEnabled(value);
422
345
  }
423
346
  });
424
347
  return {
425
- cytoscapeRef: cytoscapeRef,
426
- updateCytoscape: updateCytoscape,
427
- resetCytoscape: resetCytoscape,
428
- layoutCytoscape: layoutCytoscape,
429
- loadLayout: loadLayout,
430
- zoomingEnabled: zoomingEnabled,
348
+ cytoscapeRef,
349
+ updateCytoscape,
350
+ resetCytoscape,
351
+ layoutCytoscape,
352
+ loadLayout,
353
+ zoomingEnabled,
431
354
  };
432
355
  };
433
- exports.useCytoscape = useCytoscape;
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@receptron/graphai_vue_cytoscape",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "main": "lib/cytoscape.js",
5
+ "type": "module",
5
6
  "files": [
6
7
  "./lib"
7
8
  ],
8
9
  "scripts": {
9
10
  "dev": "vite",
10
- "build": "tsc --esModuleInterop --declaration --outDir lib/ src/composables/cytoscape.ts",
11
+ "build": "tsc -p tsconfig.build.json",
11
12
  "preview": "vite preview",
12
13
  "build-only": "vite build",
13
14
  "type-check": "vue-tsc --build --force",
@@ -26,15 +27,15 @@
26
27
  },
27
28
  "homepage": "https://github.com/receptron/graphai_utils/tree/main/packages/vue-cytoscape#readme",
28
29
  "dependencies": {
29
- "cytoscape": "^3.30.4",
30
+ "cytoscape": "^3.34.3",
30
31
  "cytoscape-klay": "^3.1.4"
31
32
  },
32
33
  "devDependencies": {
33
- "@types/cytoscape-klay": "^3.1.4",
34
- "@vitejs/plugin-vue": "^5.2.1",
35
- "@vue/tsconfig": "^0.7.0",
36
- "vue": "^3.5.13",
37
- "vue-tsc": "^2.2.0"
34
+ "@types/cytoscape-klay": "^3.1.5",
35
+ "@vitejs/plugin-vue": "^6.0.9",
36
+ "@vue/tsconfig": "^0.9.1",
37
+ "vue": "^3.5.43",
38
+ "vue-tsc": "^3.3.11"
38
39
  },
39
40
  "types": "./lib/cytoscape.d.ts",
40
41
  "directories": {