@yanqirenshi/d3.ter 0.0.1 → 0.0.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/components/D3Ter.js +26 -0
- package/dist/index.js +24 -21
- package/dist/js/Atman.js +34 -0
- package/dist/js/Attribute.js +36 -39
- package/dist/js/AttributeInstance.js +14 -2
- package/dist/js/ColumnInstance.js +38 -35
- package/dist/js/Entity.js +6 -376
- package/dist/js/EntityTailor.js +250 -182
- package/dist/js/Identifier.js +35 -39
- package/dist/js/IdentifierInstance.js +18 -30
- package/dist/js/Painter.js +430 -0
- package/dist/js/Port.js +42 -33
- package/dist/js/Rectum.js +191 -0
- package/dist/js/Relationship.js +35 -81
- package/dist/js/utils/Name.js +62 -0
- package/dist/js/utils/Pool.js +48 -0
- package/dist/js/utils/Position.js +22 -0
- package/dist/js/utils/Size.js +21 -0
- package/package.json +1 -1
package/dist/js/Port.js
CHANGED
|
@@ -1,60 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports["default"] = void 0;
|
|
7
9
|
|
|
10
|
+
var _Atman2 = _interopRequireDefault(require("./Atman.js"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
8
14
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
15
|
|
|
10
16
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
11
17
|
|
|
12
18
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
19
|
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
21
|
+
|
|
22
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
23
|
+
|
|
24
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
25
|
+
|
|
26
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
27
|
+
|
|
28
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
29
|
+
|
|
30
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
31
|
+
|
|
32
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
33
|
+
|
|
34
|
+
var Port = /*#__PURE__*/function (_Atman) {
|
|
35
|
+
_inherits(Port, _Atman);
|
|
36
|
+
|
|
37
|
+
var _super = _createSuper(Port);
|
|
38
|
+
|
|
39
|
+
function Port(type, owner, data) {
|
|
40
|
+
var _this;
|
|
41
|
+
|
|
16
42
|
_classCallCheck(this, Port);
|
|
17
43
|
|
|
18
|
-
|
|
44
|
+
_this = _super.call(this, type === 'from' ? 'PORT-FROM' : 'PORT-TO', data);
|
|
45
|
+
_this._id = owner._id; // Idenrifier-Instance
|
|
46
|
+
|
|
47
|
+
_this._owner = owner;
|
|
48
|
+
_this.position = data.position || {
|
|
19
49
|
x: 0,
|
|
20
50
|
y: 0
|
|
21
51
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
52
|
+
|
|
53
|
+
owner._ports.push(_assertThisInitialized(_this));
|
|
54
|
+
|
|
55
|
+
_this._entity = null;
|
|
56
|
+
return _this;
|
|
26
57
|
}
|
|
27
58
|
|
|
28
59
|
_createClass(Port, [{
|
|
29
|
-
key: "
|
|
30
|
-
value: function
|
|
31
|
-
return
|
|
32
|
-
_id: null,
|
|
33
|
-
_class: null,
|
|
34
|
-
position: {
|
|
35
|
-
x: 0,
|
|
36
|
-
y: 0
|
|
37
|
-
},
|
|
38
|
-
_position: null,
|
|
39
|
-
_entity: null
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
}, {
|
|
43
|
-
key: "build",
|
|
44
|
-
value: function build(type, position, idenrifier_instance) {
|
|
45
|
-
var element = this.template();
|
|
46
|
-
element._id = idenrifier_instance._id;
|
|
47
|
-
element._class = type === 'from' ? 'PORT-FROM' : 'PORT-TO';
|
|
48
|
-
element._idenrifier_instance = idenrifier_instance;
|
|
49
|
-
if (position) element._position = position;
|
|
50
|
-
|
|
51
|
-
idenrifier_instance._ports.push(element);
|
|
52
|
-
|
|
53
|
-
return element;
|
|
60
|
+
key: "position_degree",
|
|
61
|
+
value: function position_degree() {
|
|
62
|
+
return this._owner._core.position % 360;
|
|
54
63
|
}
|
|
55
64
|
}]);
|
|
56
65
|
|
|
57
66
|
return Port;
|
|
58
|
-
}();
|
|
67
|
+
}(_Atman2["default"]);
|
|
59
68
|
|
|
60
69
|
exports["default"] = Port;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _assh0le = require("@yanqirenshi/assh0le");
|
|
11
|
+
|
|
12
|
+
var _Entity = _interopRequireDefault(require("./Entity.js"));
|
|
13
|
+
|
|
14
|
+
var _Identifier = _interopRequireDefault(require("./Identifier.js"));
|
|
15
|
+
|
|
16
|
+
var _Attribute = _interopRequireDefault(require("./Attribute.js"));
|
|
17
|
+
|
|
18
|
+
var _Relationship = _interopRequireDefault(require("./Relationship.js"));
|
|
19
|
+
|
|
20
|
+
var _Port = _interopRequireDefault(require("./Port.js"));
|
|
21
|
+
|
|
22
|
+
var _Painter = _interopRequireDefault(require("./Painter.js"));
|
|
23
|
+
|
|
24
|
+
var _Pool = _interopRequireDefault(require("./utils/Pool.js"));
|
|
25
|
+
|
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
27
|
+
|
|
28
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
29
|
+
|
|
30
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
31
|
+
|
|
32
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
33
|
+
|
|
34
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
35
|
+
|
|
36
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
37
|
+
|
|
38
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
39
|
+
|
|
40
|
+
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
41
|
+
|
|
42
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
43
|
+
|
|
44
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
45
|
+
|
|
46
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
47
|
+
|
|
48
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
49
|
+
|
|
50
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
51
|
+
|
|
52
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
53
|
+
|
|
54
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
55
|
+
|
|
56
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
57
|
+
|
|
58
|
+
var POOL = new _Pool["default"]();
|
|
59
|
+
|
|
60
|
+
var Rectum = /*#__PURE__*/function (_Colon) {
|
|
61
|
+
_inherits(Rectum, _Colon);
|
|
62
|
+
|
|
63
|
+
var _super = _createSuper(Rectum);
|
|
64
|
+
|
|
65
|
+
function Rectum(params) {
|
|
66
|
+
var _this;
|
|
67
|
+
|
|
68
|
+
_classCallCheck(this, Rectum);
|
|
69
|
+
|
|
70
|
+
_this = _super.call(this, params);
|
|
71
|
+
_this._entities = POOL.make();
|
|
72
|
+
_this._relationships = POOL.make();
|
|
73
|
+
_this._default = {
|
|
74
|
+
line: {
|
|
75
|
+
height: 14,
|
|
76
|
+
font: {
|
|
77
|
+
size: 14
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
return _possibleConstructorReturn(_this, _assertThisInitialized(_this));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
_createClass(Rectum, [{
|
|
85
|
+
key: "entities",
|
|
86
|
+
value: function entities() {
|
|
87
|
+
return this._entities;
|
|
88
|
+
}
|
|
89
|
+
}, {
|
|
90
|
+
key: "bounds",
|
|
91
|
+
value: function bounds(v) {
|
|
92
|
+
var d3svg = this.d3svg();
|
|
93
|
+
if (arguments.length === 0) return d3svg.bounds();
|
|
94
|
+
return d3svg.bounds(v);
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
key: "getIdentifier",
|
|
98
|
+
value: function getIdentifier(id, entities) {
|
|
99
|
+
var _iterator = _createForOfIteratorHelper(entities.list),
|
|
100
|
+
_step;
|
|
101
|
+
|
|
102
|
+
try {
|
|
103
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
104
|
+
var entity = _step.value;
|
|
105
|
+
if (entity.identifiers.contents.ht[id]) return entity.identifiers.contents.ht[id];
|
|
106
|
+
}
|
|
107
|
+
} catch (err) {
|
|
108
|
+
_iterator.e(err);
|
|
109
|
+
} finally {
|
|
110
|
+
_iterator.f();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
}, {
|
|
116
|
+
key: "buildRelationshipsWithPort",
|
|
117
|
+
value: function buildRelationshipsWithPort(relationships) {
|
|
118
|
+
var entities = this.entities();
|
|
119
|
+
var out = {
|
|
120
|
+
list: [],
|
|
121
|
+
ht: {}
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
var _iterator2 = _createForOfIteratorHelper(relationships),
|
|
125
|
+
_step2;
|
|
126
|
+
|
|
127
|
+
try {
|
|
128
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
129
|
+
var core = _step2.value;
|
|
130
|
+
var id_from = this.getIdentifier(core.from.id, entities);
|
|
131
|
+
var id_to = this.getIdentifier(core.to.id, entities);
|
|
132
|
+
var port_from = new _Port["default"]('from', id_from, core);
|
|
133
|
+
var port_to = new _Port["default"]('to', id_to, core);
|
|
134
|
+
var element = new _Relationship["default"](core, port_from, port_to);
|
|
135
|
+
var entity_from = id_from._entity;
|
|
136
|
+
var entity_to = id_to._entity;
|
|
137
|
+
port_from._entity = entity_from;
|
|
138
|
+
port_to._entity = entity_to;
|
|
139
|
+
entity_from.ports.items.ht[port_from._id] = port_from;
|
|
140
|
+
entity_from.ports.items.list.push(port_from);
|
|
141
|
+
entity_to.ports.items.ht[port_to._id] = port_to;
|
|
142
|
+
entity_to.ports.items.list.push(port_to);
|
|
143
|
+
out.list.push(element);
|
|
144
|
+
out.ht[element._id] = element;
|
|
145
|
+
}
|
|
146
|
+
} catch (err) {
|
|
147
|
+
_iterator2.e(err);
|
|
148
|
+
} finally {
|
|
149
|
+
_iterator2.f();
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return out;
|
|
153
|
+
}
|
|
154
|
+
}, {
|
|
155
|
+
key: "data",
|
|
156
|
+
value: function data(_data) {
|
|
157
|
+
this._identifiers = POOL.list2pool(_data.identifiers, function (d) {
|
|
158
|
+
return new _Identifier["default"](d);
|
|
159
|
+
});
|
|
160
|
+
this._attributes = POOL.list2pool(_data.attributes, function (d) {
|
|
161
|
+
return new _Attribute["default"](d);
|
|
162
|
+
});
|
|
163
|
+
var elements = {
|
|
164
|
+
identifiers: this._identifiers,
|
|
165
|
+
attributes: this._attributes
|
|
166
|
+
};
|
|
167
|
+
this._entities = POOL.list2pool(_data.entities, function (d) {
|
|
168
|
+
return new _Entity["default"](d).build(elements).sizing().positioning();
|
|
169
|
+
});
|
|
170
|
+
this._relationships = this.buildRelationshipsWithPort(_data.relationships);
|
|
171
|
+
|
|
172
|
+
_get(_getPrototypeOf(Rectum.prototype), "data", this).call(this, {
|
|
173
|
+
identifiers: this._identifiers,
|
|
174
|
+
attributes: this._attributes,
|
|
175
|
+
entities: this._entities,
|
|
176
|
+
relationships: this._relationships
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}, {
|
|
180
|
+
key: "draw",
|
|
181
|
+
value: function draw() {
|
|
182
|
+
var fore = this.layer('foreground');
|
|
183
|
+
var back = this.layer('background');
|
|
184
|
+
new _Painter["default"]().draw(fore, back, this.entities(), this._relationships);
|
|
185
|
+
}
|
|
186
|
+
}]);
|
|
187
|
+
|
|
188
|
+
return Rectum;
|
|
189
|
+
}(_assh0le.Colon);
|
|
190
|
+
|
|
191
|
+
exports["default"] = Rectum;
|
package/dist/js/Relationship.js
CHANGED
|
@@ -1,101 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports["default"] = void 0;
|
|
7
9
|
|
|
8
|
-
var
|
|
10
|
+
var _Atman2 = _interopRequireDefault(require("./Atman.js"));
|
|
9
11
|
|
|
10
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
13
|
|
|
12
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
13
|
-
|
|
14
14
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
15
15
|
|
|
16
16
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
19
|
+
|
|
20
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
21
|
+
|
|
22
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
23
|
+
|
|
24
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
25
|
+
|
|
26
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
27
|
+
|
|
28
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
29
|
+
|
|
30
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
31
|
+
|
|
32
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
33
|
+
|
|
34
|
+
var Relationship = /*#__PURE__*/function (_Atman) {
|
|
35
|
+
_inherits(Relationship, _Atman);
|
|
36
|
+
|
|
37
|
+
var _super = _createSuper(Relationship);
|
|
38
|
+
|
|
39
|
+
function Relationship(data, port_from, port_to) {
|
|
40
|
+
var _this;
|
|
41
|
+
|
|
20
42
|
_classCallCheck(this, Relationship);
|
|
21
43
|
|
|
22
|
-
|
|
44
|
+
_this = _super.call(this, 'RELATIONSHIP', data);
|
|
45
|
+
_this.from = port_from;
|
|
46
|
+
_this.to = port_to;
|
|
47
|
+
port_from._relationship = _assertThisInitialized(_this);
|
|
48
|
+
port_to._relationship = _assertThisInitialized(_this);
|
|
49
|
+
return _this;
|
|
23
50
|
}
|
|
24
51
|
|
|
25
|
-
_createClass(Relationship
|
|
26
|
-
|
|
27
|
-
value: function list2pool(list) {
|
|
28
|
-
var pool = new _Pool["default"]().list2pool(list, function (d) {
|
|
29
|
-
return d;
|
|
30
|
-
});
|
|
31
|
-
pool.indexes = {
|
|
32
|
-
from: {},
|
|
33
|
-
to: {}
|
|
34
|
-
};
|
|
35
|
-
return pool;
|
|
36
|
-
}
|
|
37
|
-
}, {
|
|
38
|
-
key: "template",
|
|
39
|
-
value: function template() {
|
|
40
|
-
return {
|
|
41
|
-
_id: null,
|
|
42
|
-
_class: 'RELATIONSHIP',
|
|
43
|
-
from: null,
|
|
44
|
-
to: null
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
}, {
|
|
48
|
-
key: "build",
|
|
49
|
-
value: function build(core, port_from, port_to) {
|
|
50
|
-
var element = this.template();
|
|
51
|
-
element._id = this.i++;
|
|
52
|
-
element.from = port_from;
|
|
53
|
-
element.to = port_to;
|
|
54
|
-
port_from._relationship = element;
|
|
55
|
-
port_to._relationship = element;
|
|
56
|
-
element._core = core;
|
|
57
|
-
core._element = element;
|
|
58
|
-
return element;
|
|
59
|
-
}
|
|
60
|
-
/* **************************************************************** *
|
|
61
|
-
* *
|
|
62
|
-
* **************************************************************** */
|
|
63
|
-
|
|
64
|
-
}, {
|
|
65
|
-
key: "drawCore",
|
|
66
|
-
value: function drawCore(edges) {
|
|
67
|
-
edges.attr('x1', function (d) {
|
|
68
|
-
var port = d.from;
|
|
69
|
-
var entity = d.from._entity;
|
|
70
|
-
return port.position.x + entity.position.x;
|
|
71
|
-
}).attr('y1', function (d) {
|
|
72
|
-
var port = d.from;
|
|
73
|
-
var entity = d.from._entity;
|
|
74
|
-
return port.position.y + entity.position.y;
|
|
75
|
-
}).attr('x2', function (d) {
|
|
76
|
-
var port = d.to;
|
|
77
|
-
var entity = d.to._entity;
|
|
78
|
-
return port.position.x + entity.position.x;
|
|
79
|
-
}).attr('y2', function (d) {
|
|
80
|
-
var port = d.to;
|
|
81
|
-
var entity = d.to._entity;
|
|
82
|
-
return port.position.y + entity.position.y;
|
|
83
|
-
}).attr('stroke', '#888888').attr('stroke-width', 1);
|
|
84
|
-
}
|
|
85
|
-
}, {
|
|
86
|
-
key: "draw",
|
|
87
|
-
value: function draw(place, relationships) {
|
|
88
|
-
var data = relationships.list.filter(function (edge) {
|
|
89
|
-
return edge.from._class === 'PORT-FROM' && edge.to._class === 'PORT-TO';
|
|
90
|
-
});
|
|
91
|
-
var edges = place.selectAll('line.connector').data(data, function (d) {
|
|
92
|
-
return d._id;
|
|
93
|
-
}).enter().append('line').attr('class', 'connector');
|
|
94
|
-
this.drawCore(edges);
|
|
95
|
-
}
|
|
96
|
-
}]);
|
|
97
|
-
|
|
98
|
-
return Relationship;
|
|
99
|
-
}();
|
|
52
|
+
return _createClass(Relationship);
|
|
53
|
+
}(_Atman2["default"]);
|
|
100
54
|
|
|
101
55
|
exports["default"] = Relationship;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _Position = _interopRequireDefault(require("./Position.js"));
|
|
9
|
+
|
|
10
|
+
var _Size = _interopRequireDefault(require("./Size.js"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
14
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
15
|
+
|
|
16
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
17
|
+
|
|
18
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
19
|
+
|
|
20
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
21
|
+
|
|
22
|
+
var Name = /*#__PURE__*/function () {
|
|
23
|
+
function Name(v) {
|
|
24
|
+
_classCallCheck(this, Name);
|
|
25
|
+
|
|
26
|
+
this.physical = null;
|
|
27
|
+
this.logical = null;
|
|
28
|
+
this.padding = 8;
|
|
29
|
+
this.position = new _Position["default"]();
|
|
30
|
+
this.size = new _Size["default"]();
|
|
31
|
+
this.set(v);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
_createClass(Name, [{
|
|
35
|
+
key: "set",
|
|
36
|
+
value: function set(v) {
|
|
37
|
+
if (arguments.lengh === 0 || !v) {
|
|
38
|
+
return this;
|
|
39
|
+
} else if ('string' === typeof v) {
|
|
40
|
+
var isLogical = function isLogical(str) {
|
|
41
|
+
return str.match(/^[^\x01-\x7E\xA1-\xDF]+$/);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
if (isLogical) this.physical = v;else this.logical = v;
|
|
45
|
+
} else if ("object" === _typeof(v)) {
|
|
46
|
+
this.physical = v.physical || null;
|
|
47
|
+
this.logical = v.logical || null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
53
|
+
key: "val",
|
|
54
|
+
value: function val() {
|
|
55
|
+
return this.logical || this.physical || '????????';
|
|
56
|
+
}
|
|
57
|
+
}]);
|
|
58
|
+
|
|
59
|
+
return Name;
|
|
60
|
+
}();
|
|
61
|
+
|
|
62
|
+
exports["default"] = Name;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
+
|
|
10
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
11
|
+
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
+
|
|
14
|
+
var Pool = /*#__PURE__*/function () {
|
|
15
|
+
function Pool() {
|
|
16
|
+
_classCallCheck(this, Pool);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
_createClass(Pool, [{
|
|
20
|
+
key: "make",
|
|
21
|
+
value: function make() {
|
|
22
|
+
return {
|
|
23
|
+
list: [],
|
|
24
|
+
ht: {}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}, {
|
|
28
|
+
key: "list2pool",
|
|
29
|
+
value: function list2pool(list, f) {
|
|
30
|
+
var pool = this.make();
|
|
31
|
+
if (!list) return pool;
|
|
32
|
+
if (f) return list.reduce(function (acc, val) {
|
|
33
|
+
var new_val = f(val);
|
|
34
|
+
acc.list.push(new_val);
|
|
35
|
+
acc.ht[new_val.id()] = new_val;
|
|
36
|
+
return acc;
|
|
37
|
+
}, pool);else return list.reduce(function (acc, val) {
|
|
38
|
+
acc.list.push(val);
|
|
39
|
+
acc.ht[val.id()] = val;
|
|
40
|
+
return acc;
|
|
41
|
+
}, pool);
|
|
42
|
+
}
|
|
43
|
+
}]);
|
|
44
|
+
|
|
45
|
+
return Pool;
|
|
46
|
+
}();
|
|
47
|
+
|
|
48
|
+
exports["default"] = Pool;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
9
|
+
|
|
10
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
11
|
+
|
|
12
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
13
|
+
|
|
14
|
+
var Position = /*#__PURE__*/_createClass(function Position(v) {
|
|
15
|
+
_classCallCheck(this, Position);
|
|
16
|
+
|
|
17
|
+
this.x = 0;
|
|
18
|
+
this.y = 0;
|
|
19
|
+
this.z = 0;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
exports["default"] = Position;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
9
|
+
|
|
10
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
11
|
+
|
|
12
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
13
|
+
|
|
14
|
+
var Size = /*#__PURE__*/_createClass(function Size(v) {
|
|
15
|
+
_classCallCheck(this, Size);
|
|
16
|
+
|
|
17
|
+
this.h = null;
|
|
18
|
+
this.w = null;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
exports["default"] = Size;
|