@react-fabric/graph 1.0.0-beta.62 → 1.0.0-beta.63
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/css/styles.css +1 -1
- package/dist/cjs/_virtual/elk-worker.js +1 -1
- package/dist/cjs/components/ContextMenu.js +7 -7
- package/dist/cjs/components/{Context.js → Provider.js} +2 -6
- package/dist/cjs/components/Tools.js +38 -38
- package/dist/cjs/components/Viewer.js +6 -5
- package/dist/cjs/components/context.js +34 -0
- package/dist/cjs/graph/index.js +15 -15
- package/dist/cjs/programs/node-badge/factory.js +3 -2
- package/dist/cjs/programs/node-badge/texture.js +30 -30
- package/dist/cjs/programs/node-image/factory.js +3 -2
- package/dist/cjs/programs/node-image/texture.js +36 -36
- package/dist/esm/_virtual/elk-worker.js +1 -1
- package/dist/esm/components/ContextMenu.js +3 -3
- package/dist/esm/components/{Context.js → Provider.js} +3 -6
- package/dist/esm/components/Tools.js +37 -37
- package/dist/esm/components/Viewer.js +4 -3
- package/dist/esm/components/context.js +33 -0
- package/dist/esm/graph/index.js +15 -15
- package/dist/esm/programs/node-badge/factory.js +3 -2
- package/dist/esm/programs/node-badge/texture.js +30 -30
- package/dist/esm/programs/node-image/factory.js +3 -2
- package/dist/esm/programs/node-image/texture.js +36 -36
- package/dist/types/components/Provider.d.ts +3 -0
- package/dist/types/components/{Context.d.ts → context.d.ts} +3 -4
- package/dist/types/programs/edge-curve/drawLabel.d.ts +1 -1
- package/package.json +12 -12
- package/src/components/ContextMenu.tsx +11 -47
- package/src/components/{Context.tsx → Provider.tsx} +3 -30
- package/src/components/Tools.tsx +13 -51
- package/src/components/Viewer.tsx +6 -7
- package/src/components/context.ts +43 -0
- package/src/programs/arrow-head/index.ts +0 -1
- package/src/programs/edge-curve/drawLabel.ts +1 -1
- package/src/programs/edge-curve/index.ts +0 -2
- package/src/programs/edge-line/index.ts +0 -2
- package/src/programs/node-badge/factory.ts +0 -2
- package/src/programs/node-circle/base/index.ts +0 -2
- package/src/programs/node-image/factory.ts +0 -2
- package/src/programs/node-rect/base/index.ts +0 -2
|
@@ -6,7 +6,7 @@ import { useFloatingNodeId, useFloating, autoUpdate, offset, flip, useClick, use
|
|
|
6
6
|
import { Menu, MenuItem, Divider } from '@react-fabric/core';
|
|
7
7
|
import { useState, useRef, useEffect, cloneElement } from 'react';
|
|
8
8
|
import { ICONS } from '../constants/index.js';
|
|
9
|
-
import { useGraph } from './
|
|
9
|
+
import { useGraph } from './context.js';
|
|
10
10
|
import { jsx } from 'react/jsx-runtime';
|
|
11
11
|
|
|
12
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -115,7 +115,7 @@ var GraphContextMenu = function GraphContextMenu() {
|
|
|
115
115
|
}, [sigma]);
|
|
116
116
|
return isOpen && /*#__PURE__*/jsx(FloatingPortal, {
|
|
117
117
|
root: (_refs$domReference$cu = (_refs$domReference$cu2 = refs.domReference.current) === null || _refs$domReference$cu2 === void 0 ? void 0 : _refs$domReference$cu2.closest(".theme-base")) !== null && _refs$domReference$cu !== void 0 ? _refs$domReference$cu : undefined,
|
|
118
|
-
children: /*#__PURE__*/cloneElement(
|
|
118
|
+
children: /*#__PURE__*/cloneElement(/*#__PURE__*/jsx(Menu, {
|
|
119
119
|
children: menu
|
|
120
120
|
}), _objectSpread(_objectSpread({}, getFloatingProps()), {}, {
|
|
121
121
|
style: _objectSpread(_objectSpread({}, floatingStyles), {}, {
|
|
@@ -123,7 +123,7 @@ var GraphContextMenu = function GraphContextMenu() {
|
|
|
123
123
|
zIndex: "var(--z-popover)",
|
|
124
124
|
fontSize: "0.75rem"
|
|
125
125
|
}),
|
|
126
|
-
className: "bg-
|
|
126
|
+
className: "bg-default outline rounded-capped shadow-lg",
|
|
127
127
|
ref: refs.setFloating,
|
|
128
128
|
onMouseUp: tryClosing.current
|
|
129
129
|
}))
|
|
@@ -3,16 +3,13 @@
|
|
|
3
3
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
4
|
import { Icon } from '@react-fabric/core';
|
|
5
5
|
import { fitViewportToNodes } from '@sigma/utils';
|
|
6
|
-
import { useState, useEffect, useImperativeHandle
|
|
6
|
+
import { useState, useEffect, useImperativeHandle } from 'react';
|
|
7
7
|
import { useDragSelection } from '../hooks/sigmaDragSelect.js';
|
|
8
8
|
import { useGraphology } from '../hooks/useGraphology.js';
|
|
9
9
|
import { useSigma } from '../hooks/useSigma.js';
|
|
10
|
+
import { GraphContext } from './context.js';
|
|
10
11
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
11
12
|
|
|
12
|
-
var GraphContext = /*#__PURE__*/createContext({});
|
|
13
|
-
var useGraph = function useGraph() {
|
|
14
|
-
return useContext(GraphContext);
|
|
15
|
-
};
|
|
16
13
|
var GraphProvider = function GraphProvider(_ref) {
|
|
17
14
|
var ref = _ref.ref,
|
|
18
15
|
data = _ref.data,
|
|
@@ -103,4 +100,4 @@ var GraphProvider = function GraphProvider(_ref) {
|
|
|
103
100
|
});
|
|
104
101
|
};
|
|
105
102
|
|
|
106
|
-
export { GraphProvider
|
|
103
|
+
export { GraphProvider };
|
|
@@ -4,7 +4,7 @@ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
|
4
4
|
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
5
5
|
import { ButtonGroup, Button, Dropdown, Menu, MenuItem } from '@react-fabric/core';
|
|
6
6
|
import { ICONS } from '../constants/index.js';
|
|
7
|
-
import { useGraph } from './
|
|
7
|
+
import { useGraph } from './context.js';
|
|
8
8
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
9
9
|
|
|
10
10
|
var Tools = function Tools() {
|
|
@@ -16,7 +16,7 @@ var Tools = function Tools() {
|
|
|
16
16
|
zoomIn = _useGraph.zoomIn,
|
|
17
17
|
zoomOut = _useGraph.zoomOut;
|
|
18
18
|
return /*#__PURE__*/jsxs("div", {
|
|
19
|
-
className: "flex flex-nowrap outline absolute top-0 start-0 p-0 z-1 bg-
|
|
19
|
+
className: "flex flex-nowrap outline absolute top-0 start-0 p-0 z-1 bg-default",
|
|
20
20
|
children: [/*#__PURE__*/jsxs(ButtonGroup, {
|
|
21
21
|
variant: "link",
|
|
22
22
|
children: [/*#__PURE__*/jsx(Button, {
|
|
@@ -67,15 +67,15 @@ var Tools = function Tools() {
|
|
|
67
67
|
className: "text-sm",
|
|
68
68
|
children: [/*#__PURE__*/jsx(MenuItem, {
|
|
69
69
|
label: "box",
|
|
70
|
-
onClick: /*#__PURE__*/_asyncToGenerator(
|
|
71
|
-
return _regeneratorRuntime.wrap(function
|
|
70
|
+
onClick: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
71
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
72
72
|
while (1) switch (_context.prev = _context.next) {
|
|
73
73
|
case 0:
|
|
74
|
-
_context.next =
|
|
74
|
+
_context.next = 1;
|
|
75
75
|
return graph.elkLayout("box");
|
|
76
|
-
case
|
|
76
|
+
case 1:
|
|
77
77
|
return _context.abrupt("return", _context.sent);
|
|
78
|
-
case
|
|
78
|
+
case 2:
|
|
79
79
|
case "end":
|
|
80
80
|
return _context.stop();
|
|
81
81
|
}
|
|
@@ -83,15 +83,15 @@ var Tools = function Tools() {
|
|
|
83
83
|
}))
|
|
84
84
|
}), /*#__PURE__*/jsx(MenuItem, {
|
|
85
85
|
label: "force",
|
|
86
|
-
onClick: /*#__PURE__*/_asyncToGenerator(
|
|
87
|
-
return _regeneratorRuntime.wrap(function
|
|
86
|
+
onClick: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
87
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
88
88
|
while (1) switch (_context2.prev = _context2.next) {
|
|
89
89
|
case 0:
|
|
90
|
-
_context2.next =
|
|
90
|
+
_context2.next = 1;
|
|
91
91
|
return graph.elkLayout("force");
|
|
92
|
-
case
|
|
92
|
+
case 1:
|
|
93
93
|
return _context2.abrupt("return", _context2.sent);
|
|
94
|
-
case
|
|
94
|
+
case 2:
|
|
95
95
|
case "end":
|
|
96
96
|
return _context2.stop();
|
|
97
97
|
}
|
|
@@ -99,15 +99,15 @@ var Tools = function Tools() {
|
|
|
99
99
|
}))
|
|
100
100
|
}), /*#__PURE__*/jsx(MenuItem, {
|
|
101
101
|
label: "layered",
|
|
102
|
-
onClick: /*#__PURE__*/_asyncToGenerator(
|
|
103
|
-
return _regeneratorRuntime.wrap(function
|
|
102
|
+
onClick: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
103
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
104
104
|
while (1) switch (_context3.prev = _context3.next) {
|
|
105
105
|
case 0:
|
|
106
|
-
_context3.next =
|
|
106
|
+
_context3.next = 1;
|
|
107
107
|
return graph.elkLayout("layered");
|
|
108
|
-
case
|
|
108
|
+
case 1:
|
|
109
109
|
return _context3.abrupt("return", _context3.sent);
|
|
110
|
-
case
|
|
110
|
+
case 2:
|
|
111
111
|
case "end":
|
|
112
112
|
return _context3.stop();
|
|
113
113
|
}
|
|
@@ -115,15 +115,15 @@ var Tools = function Tools() {
|
|
|
115
115
|
}))
|
|
116
116
|
}), /*#__PURE__*/jsx(MenuItem, {
|
|
117
117
|
label: "stress",
|
|
118
|
-
onClick: /*#__PURE__*/_asyncToGenerator(
|
|
119
|
-
return _regeneratorRuntime.wrap(function
|
|
118
|
+
onClick: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
119
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
120
120
|
while (1) switch (_context4.prev = _context4.next) {
|
|
121
121
|
case 0:
|
|
122
|
-
_context4.next =
|
|
122
|
+
_context4.next = 1;
|
|
123
123
|
return graph.elkLayout("stress");
|
|
124
|
-
case
|
|
124
|
+
case 1:
|
|
125
125
|
return _context4.abrupt("return", _context4.sent);
|
|
126
|
-
case
|
|
126
|
+
case 2:
|
|
127
127
|
case "end":
|
|
128
128
|
return _context4.stop();
|
|
129
129
|
}
|
|
@@ -131,15 +131,15 @@ var Tools = function Tools() {
|
|
|
131
131
|
}))
|
|
132
132
|
}), /*#__PURE__*/jsx(MenuItem, {
|
|
133
133
|
label: "radial",
|
|
134
|
-
onClick: /*#__PURE__*/_asyncToGenerator(
|
|
135
|
-
return _regeneratorRuntime.wrap(function
|
|
134
|
+
onClick: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
135
|
+
return _regeneratorRuntime.wrap(function (_context5) {
|
|
136
136
|
while (1) switch (_context5.prev = _context5.next) {
|
|
137
137
|
case 0:
|
|
138
|
-
_context5.next =
|
|
138
|
+
_context5.next = 1;
|
|
139
139
|
return graph.elkLayout("radial");
|
|
140
|
-
case
|
|
140
|
+
case 1:
|
|
141
141
|
return _context5.abrupt("return", _context5.sent);
|
|
142
|
-
case
|
|
142
|
+
case 2:
|
|
143
143
|
case "end":
|
|
144
144
|
return _context5.stop();
|
|
145
145
|
}
|
|
@@ -147,15 +147,15 @@ var Tools = function Tools() {
|
|
|
147
147
|
}))
|
|
148
148
|
}), /*#__PURE__*/jsx(MenuItem, {
|
|
149
149
|
label: "sporeOverlap",
|
|
150
|
-
onClick: /*#__PURE__*/_asyncToGenerator(
|
|
151
|
-
return _regeneratorRuntime.wrap(function
|
|
150
|
+
onClick: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
151
|
+
return _regeneratorRuntime.wrap(function (_context6) {
|
|
152
152
|
while (1) switch (_context6.prev = _context6.next) {
|
|
153
153
|
case 0:
|
|
154
|
-
_context6.next =
|
|
154
|
+
_context6.next = 1;
|
|
155
155
|
return graph.elkLayout("sporeOverlap");
|
|
156
|
-
case
|
|
156
|
+
case 1:
|
|
157
157
|
return _context6.abrupt("return", _context6.sent);
|
|
158
|
-
case
|
|
158
|
+
case 2:
|
|
159
159
|
case "end":
|
|
160
160
|
return _context6.stop();
|
|
161
161
|
}
|
|
@@ -163,15 +163,15 @@ var Tools = function Tools() {
|
|
|
163
163
|
}))
|
|
164
164
|
}), /*#__PURE__*/jsx(MenuItem, {
|
|
165
165
|
label: "sporeCompaction",
|
|
166
|
-
onClick: /*#__PURE__*/_asyncToGenerator(
|
|
167
|
-
return _regeneratorRuntime.wrap(function
|
|
166
|
+
onClick: /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
167
|
+
return _regeneratorRuntime.wrap(function (_context7) {
|
|
168
168
|
while (1) switch (_context7.prev = _context7.next) {
|
|
169
169
|
case 0:
|
|
170
|
-
_context7.next =
|
|
170
|
+
_context7.next = 1;
|
|
171
171
|
return graph.elkLayout("sporeCompaction");
|
|
172
|
-
case
|
|
172
|
+
case 1:
|
|
173
173
|
return _context7.abrupt("return", _context7.sent);
|
|
174
|
-
case
|
|
174
|
+
case 2:
|
|
175
175
|
case "end":
|
|
176
176
|
return _context7.stop();
|
|
177
177
|
}
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import { Section } from '@react-fabric/core';
|
|
5
|
-
import { GraphProvider, useGraph } from './Context.js';
|
|
6
|
-
import { Tools } from './Tools.js';
|
|
7
5
|
import { useRef, useEffect } from 'react';
|
|
8
6
|
import { GraphContextMenu } from './ContextMenu.js';
|
|
7
|
+
import { GraphProvider } from './Provider.js';
|
|
8
|
+
import { Tools } from './Tools.js';
|
|
9
|
+
import { useGraph } from './context.js';
|
|
9
10
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
10
11
|
|
|
11
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -29,7 +30,7 @@ var Graph = function Graph() {
|
|
|
29
30
|
};
|
|
30
31
|
}, [graph]);
|
|
31
32
|
return /*#__PURE__*/jsxs("div", {
|
|
32
|
-
className: "area-content relative bg-
|
|
33
|
+
className: "area-content relative bg-default graph-viewer",
|
|
33
34
|
children: [/*#__PURE__*/jsx("div", {
|
|
34
35
|
dir: "ltr",
|
|
35
36
|
ref: sigma.containerRef,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* React Fabric
|
|
7
|
+
* @version: 1.0.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* The MIT License (MIT)
|
|
11
|
+
* Copyright (c) 2026 Adarsh Pastakia
|
|
12
|
+
*
|
|
13
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
14
|
+
* and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
15
|
+
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
16
|
+
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
17
|
+
* subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial
|
|
20
|
+
* portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
23
|
+
* TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
24
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
25
|
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
var GraphContext = /*#__PURE__*/createContext({});
|
|
29
|
+
var useGraph = function useGraph() {
|
|
30
|
+
return useContext(GraphContext);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { GraphContext, useGraph };
|
package/dist/esm/graph/index.js
CHANGED
|
@@ -7,8 +7,8 @@ import _typeof from '@babel/runtime/helpers/typeof';
|
|
|
7
7
|
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
8
8
|
import _createClass from '@babel/runtime/helpers/createClass';
|
|
9
9
|
import _possibleConstructorReturn from '@babel/runtime/helpers/possibleConstructorReturn';
|
|
10
|
-
import _get from '@babel/runtime/helpers/get';
|
|
11
10
|
import _getPrototypeOf from '@babel/runtime/helpers/getPrototypeOf';
|
|
11
|
+
import _get from '@babel/runtime/helpers/get';
|
|
12
12
|
import _inherits from '@babel/runtime/helpers/inherits';
|
|
13
13
|
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
14
14
|
import { debounce } from '@react-fabric/utilities';
|
|
@@ -25,6 +25,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
25
25
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
26
26
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
27
27
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
28
|
+
function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
28
29
|
var Graph = /*#__PURE__*/function (_Graphology) {
|
|
29
30
|
function Graph(options) {
|
|
30
31
|
var _this;
|
|
@@ -54,21 +55,20 @@ var Graph = /*#__PURE__*/function (_Graphology) {
|
|
|
54
55
|
return _createClass(Graph, [{
|
|
55
56
|
key: "on",
|
|
56
57
|
value: function on(type, listener) {
|
|
57
|
-
return
|
|
58
|
+
return _superPropGet(Graph, "on", this, 3)([type, listener]);
|
|
58
59
|
}
|
|
59
60
|
}, {
|
|
60
61
|
key: "off",
|
|
61
62
|
value: function off(type, listener) {
|
|
62
|
-
return
|
|
63
|
+
return _superPropGet(Graph, "off", this, 3)([type, listener]);
|
|
63
64
|
}
|
|
64
65
|
}, {
|
|
65
66
|
key: "emit",
|
|
66
67
|
value: function emit(type) {
|
|
67
|
-
var _get2;
|
|
68
68
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
69
69
|
args[_key - 1] = arguments[_key];
|
|
70
70
|
}
|
|
71
|
-
return (
|
|
71
|
+
return _superPropGet(Graph, "emit", this, 3)([type].concat(args));
|
|
72
72
|
}
|
|
73
73
|
}, {
|
|
74
74
|
key: "mergeNodes",
|
|
@@ -240,7 +240,7 @@ var Graph = /*#__PURE__*/function (_Graphology) {
|
|
|
240
240
|
return n.key;
|
|
241
241
|
})));
|
|
242
242
|
}
|
|
243
|
-
|
|
243
|
+
_superPropGet(Graph, "import", this, 3)([data, merge]);
|
|
244
244
|
// fire events for nodes added
|
|
245
245
|
this.emit("nodesLoaded", newNodes);
|
|
246
246
|
// apply random positions for nodes
|
|
@@ -306,9 +306,9 @@ var Graph = /*#__PURE__*/function (_Graphology) {
|
|
|
306
306
|
}, {
|
|
307
307
|
key: "elkLayout",
|
|
308
308
|
value: function () {
|
|
309
|
-
var _elkLayout = _asyncToGenerator(
|
|
309
|
+
var _elkLayout = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(type) {
|
|
310
310
|
var _this8 = this;
|
|
311
|
-
return _regeneratorRuntime.wrap(function
|
|
311
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
312
312
|
while (1) switch (_context.prev = _context.next) {
|
|
313
313
|
case 0:
|
|
314
314
|
if (!this.elk) this.elk = new ElkConstructor({
|
|
@@ -361,7 +361,7 @@ var Graph = /*#__PURE__*/function (_Graphology) {
|
|
|
361
361
|
})["catch"](console.error)["finally"](function () {
|
|
362
362
|
_this8.emit("layoutRunning", false);
|
|
363
363
|
});
|
|
364
|
-
case
|
|
364
|
+
case 1:
|
|
365
365
|
case "end":
|
|
366
366
|
return _context.stop();
|
|
367
367
|
}
|
|
@@ -398,7 +398,7 @@ var Graph = /*#__PURE__*/function (_Graphology) {
|
|
|
398
398
|
}, {
|
|
399
399
|
key: "checkParallelEdges",
|
|
400
400
|
value: function checkParallelEdges() {
|
|
401
|
-
var
|
|
401
|
+
var _this0 = this;
|
|
402
402
|
// Use dedicated helper to identify parallel edges:
|
|
403
403
|
// @ts-expect-error ignore
|
|
404
404
|
indexParallelEdgesIndex(this, {
|
|
@@ -412,17 +412,17 @@ var Graph = /*#__PURE__*/function (_Graphology) {
|
|
|
412
412
|
parallelMinIndex = _ref2.parallelMinIndex,
|
|
413
413
|
parallelMaxIndex = _ref2.parallelMaxIndex;
|
|
414
414
|
if (typeof parallelMinIndex === "number") {
|
|
415
|
-
|
|
415
|
+
_this0.mergeEdgeAttributes(edge, {
|
|
416
416
|
type: parallelIndex ? "curved" : "line",
|
|
417
|
-
curvature:
|
|
417
|
+
curvature: _this0.getCurvature(parallelIndex !== null && parallelIndex !== void 0 ? parallelIndex : 1, parallelMaxIndex !== null && parallelMaxIndex !== void 0 ? parallelMaxIndex : 1)
|
|
418
418
|
});
|
|
419
419
|
} else if (typeof parallelIndex === "number") {
|
|
420
|
-
|
|
420
|
+
_this0.mergeEdgeAttributes(edge, {
|
|
421
421
|
type: "curved",
|
|
422
|
-
curvature:
|
|
422
|
+
curvature: _this0.getCurvature(parallelIndex !== null && parallelIndex !== void 0 ? parallelIndex : 1, parallelMaxIndex !== null && parallelMaxIndex !== void 0 ? parallelMaxIndex : 1)
|
|
423
423
|
});
|
|
424
424
|
} else {
|
|
425
|
-
|
|
425
|
+
_this0.setEdgeAttribute(edge, "type", "line");
|
|
426
426
|
}
|
|
427
427
|
});
|
|
428
428
|
}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
4
4
|
import _createClass from '@babel/runtime/helpers/createClass';
|
|
5
5
|
import _possibleConstructorReturn from '@babel/runtime/helpers/possibleConstructorReturn';
|
|
6
|
-
import _get from '@babel/runtime/helpers/get';
|
|
7
6
|
import _getPrototypeOf from '@babel/runtime/helpers/getPrototypeOf';
|
|
7
|
+
import _get from '@babel/runtime/helpers/get';
|
|
8
8
|
import _inherits from '@babel/runtime/helpers/inherits';
|
|
9
9
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
10
10
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
@@ -17,6 +17,7 @@ import VERTEX_SHADER_SOURCE from './vert.glsl.js';
|
|
|
17
17
|
var _excluded = ["drawHover", "drawLabel", "drawingMode", "keepWithinCircle", "padding", "colorAttribute", "badgePosition"];
|
|
18
18
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
19
19
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
20
|
+
function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
20
21
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
22
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22
23
|
var ICON_MAP = {
|
|
@@ -180,7 +181,7 @@ function getNodeImageProgram(options) {
|
|
|
180
181
|
var gl = programInfo.gl;
|
|
181
182
|
gl.bindTexture(gl.TEXTURE_2D, this.texture);
|
|
182
183
|
}
|
|
183
|
-
|
|
184
|
+
_superPropGet(NodeImageProgram, "renderProgram", this, 3)([params, programInfo]);
|
|
184
185
|
}
|
|
185
186
|
}, {
|
|
186
187
|
key: "processVisibleItem",
|
|
@@ -47,11 +47,11 @@ function loadRasterImage(_x) {
|
|
|
47
47
|
return _loadRasterImage.apply(this, arguments);
|
|
48
48
|
}
|
|
49
49
|
function _loadRasterImage() {
|
|
50
|
-
_loadRasterImage = _asyncToGenerator(
|
|
51
|
-
return _regeneratorRuntime.wrap(function
|
|
50
|
+
_loadRasterImage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(imageSource) {
|
|
51
|
+
return _regeneratorRuntime.wrap(function (_context2) {
|
|
52
52
|
while (1) switch (_context2.prev = _context2.next) {
|
|
53
53
|
case 0:
|
|
54
|
-
_context2.next =
|
|
54
|
+
_context2.next = 1;
|
|
55
55
|
return new Promise(function (resolve, reject) {
|
|
56
56
|
var image = new Image();
|
|
57
57
|
image.addEventListener("load", function () {
|
|
@@ -69,9 +69,9 @@ function _loadRasterImage() {
|
|
|
69
69
|
image.setAttribute("crossOrigin", "");
|
|
70
70
|
image.src = imageSource;
|
|
71
71
|
});
|
|
72
|
-
case
|
|
72
|
+
case 1:
|
|
73
73
|
return _context2.abrupt("return", _context2.sent);
|
|
74
|
-
case
|
|
74
|
+
case 2:
|
|
75
75
|
case "end":
|
|
76
76
|
return _context2.stop();
|
|
77
77
|
}
|
|
@@ -97,7 +97,7 @@ function loadSVGImage(_x2) {
|
|
|
97
97
|
* This helper loads an image using the proper function.
|
|
98
98
|
*/
|
|
99
99
|
function _loadSVGImage() {
|
|
100
|
-
_loadSVGImage = _asyncToGenerator(
|
|
100
|
+
_loadSVGImage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(imageSource) {
|
|
101
101
|
var _ref,
|
|
102
102
|
size,
|
|
103
103
|
svg,
|
|
@@ -109,7 +109,7 @@ function _loadSVGImage() {
|
|
|
109
109
|
url,
|
|
110
110
|
res,
|
|
111
111
|
_args3 = arguments;
|
|
112
|
-
return _regeneratorRuntime.wrap(function
|
|
112
|
+
return _regeneratorRuntime.wrap(function (_context3) {
|
|
113
113
|
while (1) switch (_context3.prev = _context3.next) {
|
|
114
114
|
case 0:
|
|
115
115
|
_ref = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {}, size = _ref.size;
|
|
@@ -118,11 +118,11 @@ function _loadSVGImage() {
|
|
|
118
118
|
originalWidth = root.getAttribute("width");
|
|
119
119
|
originalHeight = root.getAttribute("height");
|
|
120
120
|
if (!(!originalWidth || !originalHeight)) {
|
|
121
|
-
_context3.next =
|
|
121
|
+
_context3.next = 1;
|
|
122
122
|
break;
|
|
123
123
|
}
|
|
124
124
|
throw new Error("loadSVGImage: cannot use `size` if target SVG has no definite dimensions.");
|
|
125
|
-
case
|
|
125
|
+
case 1:
|
|
126
126
|
if (typeof size === "number") {
|
|
127
127
|
root.setAttribute("width", "" + size);
|
|
128
128
|
root.setAttribute("height", "" + size);
|
|
@@ -140,11 +140,11 @@ function _loadSVGImage() {
|
|
|
140
140
|
void res["finally"](function () {
|
|
141
141
|
return URL.revokeObjectURL(url);
|
|
142
142
|
});
|
|
143
|
-
_context3.next =
|
|
143
|
+
_context3.next = 2;
|
|
144
144
|
return res;
|
|
145
|
-
case
|
|
145
|
+
case 2:
|
|
146
146
|
return _context3.abrupt("return", _context3.sent);
|
|
147
|
-
case
|
|
147
|
+
case 3:
|
|
148
148
|
case "end":
|
|
149
149
|
return _context3.stop();
|
|
150
150
|
}
|
|
@@ -160,20 +160,20 @@ function loadImage(_x3) {
|
|
|
160
160
|
* This helper computes exact coordinates to draw an image onto a texture.
|
|
161
161
|
*/
|
|
162
162
|
function _loadImage() {
|
|
163
|
-
_loadImage = _asyncToGenerator(
|
|
163
|
+
_loadImage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(imageSource) {
|
|
164
164
|
var _ref2,
|
|
165
165
|
_args4 = arguments;
|
|
166
|
-
return _regeneratorRuntime.wrap(function
|
|
166
|
+
return _regeneratorRuntime.wrap(function (_context4) {
|
|
167
167
|
while (1) switch (_context4.prev = _context4.next) {
|
|
168
168
|
case 0:
|
|
169
169
|
_ref2 = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {}, _ref2.size;
|
|
170
|
-
_context4.next =
|
|
170
|
+
_context4.next = 1;
|
|
171
171
|
return loadSVGImage(imageSource, {
|
|
172
172
|
size: 128
|
|
173
173
|
});
|
|
174
|
-
case
|
|
174
|
+
case 1:
|
|
175
175
|
return _context4.abrupt("return", _context4.sent);
|
|
176
|
-
case
|
|
176
|
+
case 2:
|
|
177
177
|
case "end":
|
|
178
178
|
return _context4.stop();
|
|
179
179
|
}
|
|
@@ -382,46 +382,46 @@ var TextureManager = /*#__PURE__*/function (_EventEmitter) {
|
|
|
382
382
|
}, {
|
|
383
383
|
key: "registerImage",
|
|
384
384
|
value: function () {
|
|
385
|
-
var _registerImage = _asyncToGenerator(
|
|
385
|
+
var _registerImage = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(source) {
|
|
386
386
|
var size, image;
|
|
387
|
-
return _regeneratorRuntime.wrap(function
|
|
387
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
388
388
|
while (1) switch (_context.prev = _context.next) {
|
|
389
389
|
case 0:
|
|
390
390
|
if (!this.imageStates[source]) {
|
|
391
|
-
_context.next =
|
|
391
|
+
_context.next = 1;
|
|
392
392
|
break;
|
|
393
393
|
}
|
|
394
394
|
return _context.abrupt("return");
|
|
395
|
-
case
|
|
395
|
+
case 1:
|
|
396
396
|
this.imageStates[source] = {
|
|
397
397
|
status: "loading"
|
|
398
398
|
};
|
|
399
|
-
_context.prev =
|
|
399
|
+
_context.prev = 2;
|
|
400
400
|
size = this.options.size;
|
|
401
|
-
_context.next =
|
|
401
|
+
_context.next = 3;
|
|
402
402
|
return loadImage(source, {
|
|
403
403
|
size: size.mode === "force" ? size.value : undefined
|
|
404
404
|
});
|
|
405
|
-
case
|
|
405
|
+
case 3:
|
|
406
406
|
image = _context.sent;
|
|
407
407
|
this.imageStates[source] = _objectSpread({
|
|
408
408
|
status: "ready",
|
|
409
409
|
image: image
|
|
410
410
|
}, refineImage(image, this.corrector, this.options));
|
|
411
411
|
this.scheduleGenerateTexture();
|
|
412
|
-
_context.next =
|
|
412
|
+
_context.next = 5;
|
|
413
413
|
break;
|
|
414
|
-
case
|
|
415
|
-
_context.prev =
|
|
416
|
-
_context
|
|
414
|
+
case 4:
|
|
415
|
+
_context.prev = 4;
|
|
416
|
+
_context["catch"](2);
|
|
417
417
|
this.imageStates[source] = {
|
|
418
418
|
status: "error"
|
|
419
419
|
};
|
|
420
|
-
case
|
|
420
|
+
case 5:
|
|
421
421
|
case "end":
|
|
422
422
|
return _context.stop();
|
|
423
423
|
}
|
|
424
|
-
}, _callee, this, [[
|
|
424
|
+
}, _callee, this, [[2, 4]]);
|
|
425
425
|
}));
|
|
426
426
|
function registerImage(_x4) {
|
|
427
427
|
return _registerImage.apply(this, arguments);
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
4
4
|
import _createClass from '@babel/runtime/helpers/createClass';
|
|
5
5
|
import _possibleConstructorReturn from '@babel/runtime/helpers/possibleConstructorReturn';
|
|
6
|
-
import _get from '@babel/runtime/helpers/get';
|
|
7
6
|
import _getPrototypeOf from '@babel/runtime/helpers/getPrototypeOf';
|
|
7
|
+
import _get from '@babel/runtime/helpers/get';
|
|
8
8
|
import _inherits from '@babel/runtime/helpers/inherits';
|
|
9
9
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
10
10
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
@@ -18,6 +18,7 @@ import VERTEX_SHADER_SOURCE from './vert.glsl.js';
|
|
|
18
18
|
var _excluded = ["drawHover", "drawLabel", "drawingMode", "keepWithinCircle", "padding", "colorAttribute"];
|
|
19
19
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
20
20
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
21
|
+
function _superPropGet(t, o, e, r) { var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e); return 2 & r && "function" == typeof p ? function (t) { return p.apply(e, t); } : p; }
|
|
21
22
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
23
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
24
|
|
|
@@ -158,7 +159,7 @@ function getNodeImageProgram(options) {
|
|
|
158
159
|
var gl = programInfo.gl;
|
|
159
160
|
gl.bindTexture(gl.TEXTURE_2D, this.texture);
|
|
160
161
|
}
|
|
161
|
-
|
|
162
|
+
_superPropGet(NodeImageProgram, "renderProgram", this, 3)([params, programInfo]);
|
|
162
163
|
}
|
|
163
164
|
}, {
|
|
164
165
|
key: "processVisibleItem",
|