@yanqirenshi/d3.wireframe 0.0.7 → 0.1.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.
- package/babel.config.js +10 -14
- package/dist/DataBackground.js +37 -0
- package/dist/DataFont.js +39 -0
- package/dist/DataPosition.js +39 -0
- package/dist/DataRectangle.js +37 -0
- package/dist/DataStroke.js +37 -0
- package/dist/Digestion.js +320 -0
- package/dist/Drawer.js +317 -0
- package/dist/Element.js +98 -0
- package/dist/ElementButton.js +128 -0
- package/dist/ElementDialog.js +112 -0
- package/dist/ElementFounder.js +116 -0
- package/dist/ElementFrame.js +112 -0
- package/dist/ElementIcon.js +83 -0
- package/dist/ElementImage.js +112 -0
- package/dist/ElementLabel.js +82 -0
- package/dist/ElementModal.js +93 -0
- package/dist/Rectum.js +161 -0
- package/dist/components/D3Wireframe.js +16 -0
- package/dist/index.js +16 -0
- package/jest.config.js +23 -17
- package/package.json +41 -35
- package/src/{D3Wireframe.js → Rectum.js} +115 -111
- package/src/components/D3Wireframe.js +9 -0
- package/src/index.js +9 -0
- package/tests/D3Wireframe.test.js +54 -7
- package/tests/d3-stub.js +4 -0
- package/docs/asset-manifest.json +0 -23
- package/docs/favicon.ico +0 -0
- package/docs/index.html +0 -1
- package/docs/logo192.png +0 -0
- package/docs/logo512.png +0 -0
- package/docs/manifest.json +0 -25
- package/docs/precache-manifest.5f1fad934ed0507dbc92de6788eff788.js +0 -30
- package/docs/robots.txt +0 -3
- package/docs/service-worker.js +0 -39
- package/docs/static/css/main.5f361e03.chunk.css +0 -2
- package/docs/static/css/main.5f361e03.chunk.css.map +0 -1
- package/docs/static/js/2.e2326255.chunk.js +0 -3
- package/docs/static/js/2.e2326255.chunk.js.LICENSE.txt +0 -32
- package/docs/static/js/2.e2326255.chunk.js.map +0 -1
- package/docs/static/js/main.7f51684e.chunk.js +0 -2
- package/docs/static/js/main.7f51684e.chunk.js.map +0 -1
- package/docs/static/js/runtime-main.0c5b98f9.js +0 -2
- package/docs/static/js/runtime-main.0c5b98f9.js.map +0 -1
- package/docs/static/media/logo.5d5d9eef.svg +0 -7
- package/documents/README.md +0 -68
- package/documents/package-lock.json +0 -13792
- package/documents/package.json +0 -34
- package/documents/public/favicon.ico +0 -0
- package/documents/public/index.html +0 -43
- package/documents/public/logo192.png +0 -0
- package/documents/public/logo512.png +0 -0
- package/documents/public/manifest.json +0 -25
- package/documents/public/robots.txt +0 -3
- package/documents/src/App.css +0 -38
- package/documents/src/App.js +0 -26
- package/documents/src/App.test.js +0 -9
- package/documents/src/index.css +0 -13
- package/documents/src/index.js +0 -17
- package/documents/src/logo.svg +0 -7
- package/documents/src/serviceWorker.js +0 -141
- package/documents/src/setupTests.js +0 -5
- package/example/README.md +0 -68
- package/example/package-lock.json +0 -14729
- package/example/package.json +0 -36
- package/example/public/favicon.ico +0 -0
- package/example/public/index.html +0 -43
- package/example/public/logo192.png +0 -0
- package/example/public/logo512.png +0 -0
- package/example/public/manifest.json +0 -25
- package/example/public/robots.txt +0 -3
- package/example/src/App.css +0 -38
- package/example/src/App.js +0 -14
- package/example/src/App.test.js +0 -9
- package/example/src/data/WIREFRAME_DATA.js +0 -11
- package/example/src/data/WIREFRAME_DATA_DIALOG.js +0 -65
- package/example/src/data/WIREFRAME_DATA_FRAME.js +0 -70
- package/example/src/data/WIREFRAME_DATA_MODAL.js +0 -10
- package/example/src/index.css +0 -13
- package/example/src/index.js +0 -17
- package/example/src/js/D3Wireframe.js +0 -111
- package/example/src/js/DataBackground.js +0 -23
- package/example/src/js/DataFont.js +0 -25
- package/example/src/js/DataPosition.js +0 -21
- package/example/src/js/DataRectangle.js +0 -20
- package/example/src/js/DataStroke.js +0 -23
- package/example/src/js/Digestion.js +0 -273
- package/example/src/js/Drawer.js +0 -270
- package/example/src/js/Element.js +0 -67
- package/example/src/js/ElementButton.js +0 -94
- package/example/src/js/ElementDialog.js +0 -77
- package/example/src/js/ElementFounder.js +0 -85
- package/example/src/js/ElementFrame.js +0 -77
- package/example/src/js/ElementIcon.js +0 -56
- package/example/src/js/ElementImage.js +0 -77
- package/example/src/js/ElementLabel.js +0 -51
- package/example/src/js/ElementModal.js +0 -65
- package/example/src/pages/ExampleGraph.js +0 -39
- package/example/src/pages/Explanation.js +0 -43
- package/example/src/pages/PageExample.js +0 -41
- package/example/src/serviceWorker.js +0 -141
- package/example/src/setupTests.js +0 -5
- package/index.js +0 -3
- package/riot.v3/index.html +0 -21
- package/riot.v3/index.js +0 -86
- package/riot.v3/scketch.js +0 -96
- package/riot.v3/wireframe.js +0 -11
package/babel.config.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
presets: [
|
|
3
|
-
[
|
|
4
|
-
"@babel/preset-env"
|
|
5
|
-
]
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
],
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
};
|
|
1
|
+
module.exports = {
|
|
2
|
+
presets: [
|
|
3
|
+
[
|
|
4
|
+
"@babel/preset-env"
|
|
5
|
+
],
|
|
6
|
+
[
|
|
7
|
+
"@babel/preset-react"
|
|
8
|
+
]
|
|
9
|
+
],
|
|
10
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
8
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
9
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
10
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
12
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
|
+
var DataBackground = /*#__PURE__*/function () {
|
|
14
|
+
function DataBackground() {
|
|
15
|
+
_classCallCheck(this, DataBackground);
|
|
16
|
+
}
|
|
17
|
+
return _createClass(DataBackground, [{
|
|
18
|
+
key: "template",
|
|
19
|
+
value: function template() {
|
|
20
|
+
return {
|
|
21
|
+
color: '#fff',
|
|
22
|
+
opacity: 1.0
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}, {
|
|
26
|
+
key: "build",
|
|
27
|
+
value: function build(data) {
|
|
28
|
+
var out = this.template();
|
|
29
|
+
if (!data) return out;
|
|
30
|
+
if (data.color) out.color = data.color;
|
|
31
|
+
if (data.opacity) out.opacity = data.opacity;
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
34
|
+
}]);
|
|
35
|
+
}();
|
|
36
|
+
var BACKGROUND = new DataBackground();
|
|
37
|
+
var _default = exports["default"] = BACKGROUND;
|
package/dist/DataFont.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
8
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
9
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
10
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
12
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
|
+
var DataFont = /*#__PURE__*/function () {
|
|
14
|
+
function DataFont() {
|
|
15
|
+
_classCallCheck(this, DataFont);
|
|
16
|
+
}
|
|
17
|
+
return _createClass(DataFont, [{
|
|
18
|
+
key: "template",
|
|
19
|
+
value: function template() {
|
|
20
|
+
return {
|
|
21
|
+
size: 16,
|
|
22
|
+
color: '#fff',
|
|
23
|
+
weight: 'normal'
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}, {
|
|
27
|
+
key: "build",
|
|
28
|
+
value: function build(data) {
|
|
29
|
+
var out = this.template();
|
|
30
|
+
if (!data) return out;
|
|
31
|
+
if (data.size) out.size = data.size;
|
|
32
|
+
if (data.color) out.color = data.color;
|
|
33
|
+
if (data.weight) out.weight = data.weight;
|
|
34
|
+
return out;
|
|
35
|
+
}
|
|
36
|
+
}]);
|
|
37
|
+
}();
|
|
38
|
+
var FONT = new DataFont();
|
|
39
|
+
var _default = exports["default"] = FONT;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
8
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
9
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
10
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
12
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
|
+
var DataPosition = /*#__PURE__*/function () {
|
|
14
|
+
function DataPosition() {
|
|
15
|
+
_classCallCheck(this, DataPosition);
|
|
16
|
+
}
|
|
17
|
+
return _createClass(DataPosition, [{
|
|
18
|
+
key: "template",
|
|
19
|
+
value: function template() {
|
|
20
|
+
return {
|
|
21
|
+
x: 0,
|
|
22
|
+
y: 0,
|
|
23
|
+
z: 0
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}, {
|
|
27
|
+
key: "build",
|
|
28
|
+
value: function build(data) {
|
|
29
|
+
var out = this.template();
|
|
30
|
+
if (!data) return out;
|
|
31
|
+
if (data.x) out.x = data.x;
|
|
32
|
+
if (data.y) out.y = data.y;
|
|
33
|
+
if (data.z) out.z = data.z;
|
|
34
|
+
return out;
|
|
35
|
+
}
|
|
36
|
+
}]);
|
|
37
|
+
}();
|
|
38
|
+
var POSITION = new DataPosition();
|
|
39
|
+
var _default = exports["default"] = POSITION;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
8
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
9
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
10
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
12
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
|
+
var DataRectangle = /*#__PURE__*/function () {
|
|
14
|
+
function DataRectangle() {
|
|
15
|
+
_classCallCheck(this, DataRectangle);
|
|
16
|
+
}
|
|
17
|
+
return _createClass(DataRectangle, [{
|
|
18
|
+
key: "template",
|
|
19
|
+
value: function template() {
|
|
20
|
+
return {
|
|
21
|
+
w: 0,
|
|
22
|
+
h: 0
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}, {
|
|
26
|
+
key: "build",
|
|
27
|
+
value: function build(data) {
|
|
28
|
+
var out = this.template();
|
|
29
|
+
if (!data) return out;
|
|
30
|
+
if (data.w) out.w = data.w;
|
|
31
|
+
if (data.h) out.h = data.h;
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
34
|
+
}]);
|
|
35
|
+
}();
|
|
36
|
+
var RECTANGLE = new DataRectangle();
|
|
37
|
+
var _default = exports["default"] = RECTANGLE;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
8
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
9
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
10
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
12
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
|
+
var DataStroke = /*#__PURE__*/function () {
|
|
14
|
+
function DataStroke() {
|
|
15
|
+
_classCallCheck(this, DataStroke);
|
|
16
|
+
}
|
|
17
|
+
return _createClass(DataStroke, [{
|
|
18
|
+
key: "template",
|
|
19
|
+
value: function template() {
|
|
20
|
+
return {
|
|
21
|
+
color: '#afafb0',
|
|
22
|
+
width: 1
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}, {
|
|
26
|
+
key: "build",
|
|
27
|
+
value: function build(data) {
|
|
28
|
+
var out = this.template();
|
|
29
|
+
if (!data) return null;
|
|
30
|
+
if (data.color) out.color = data.color;
|
|
31
|
+
if (data.width) out.width = data.width;
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
34
|
+
}]);
|
|
35
|
+
}();
|
|
36
|
+
var STROKE = new DataStroke();
|
|
37
|
+
var _default = exports["default"] = STROKE;
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.DigestionHierarchy = exports.DigestionGeometry = exports.DigestionCore = void 0;
|
|
7
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
8
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
9
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
10
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
11
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
12
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
13
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
14
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
15
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
16
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
17
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
18
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
19
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
20
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
22
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
23
|
+
// https://yanqirenshi.github.io/D3.Sketch/dist/edge/Drawer.js
|
|
24
|
+
/**
|
|
25
|
+
* 幾何学計算するための Drawer です。
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* let drawer = new DrawerHierarchy();
|
|
29
|
+
*/
|
|
30
|
+
var DigestionGeometry = exports.DigestionGeometry = /*#__PURE__*/function () {
|
|
31
|
+
function DigestionGeometry() {
|
|
32
|
+
_classCallCheck(this, DigestionGeometry);
|
|
33
|
+
}
|
|
34
|
+
return _createClass(DigestionGeometry, [{
|
|
35
|
+
key: "deg2rad",
|
|
36
|
+
value:
|
|
37
|
+
///// ////////////////////////////////////////////////////////////////
|
|
38
|
+
///// Utilities
|
|
39
|
+
///// ////////////////////////////////////////////////////////////////
|
|
40
|
+
function deg2rad(degree) {
|
|
41
|
+
return degree * (Math.PI / 180);
|
|
42
|
+
}
|
|
43
|
+
///// ////////////////////////////////////////////////////////////////
|
|
44
|
+
///// Cross Point of two lines
|
|
45
|
+
///// ////////////////////////////////////////////////////////////////
|
|
46
|
+
}, {
|
|
47
|
+
key: "isCorss",
|
|
48
|
+
value: function isCorss(A, B, C, D) {
|
|
49
|
+
// 二つの線分の交差チェック
|
|
50
|
+
// https://www.hiramine.com/programming/graphics/2d_segmentintersection.html
|
|
51
|
+
var ACx = C.x - A.x;
|
|
52
|
+
var ACy = C.y - A.y;
|
|
53
|
+
var BUNBO = (B.x - A.x) * (D.y - C.y) - (B.y - A.y) * (D.x - C.x);
|
|
54
|
+
if (BUNBO === 0) return false;
|
|
55
|
+
var r = ((D.y - C.y) * ACx - (D.x - C.x) * ACy) / BUNBO;
|
|
56
|
+
var s = ((B.y - A.y) * ACx - (B.x - A.x) * ACy) / BUNBO;
|
|
57
|
+
return 0 <= r && r <= 1 && 0 <= s && s <= 1;
|
|
58
|
+
}
|
|
59
|
+
// 2直線の交点を求める。(具)
|
|
60
|
+
}, {
|
|
61
|
+
key: "getCrossPointCore",
|
|
62
|
+
value: function getCrossPointCore(line, line_port) {
|
|
63
|
+
var out = {
|
|
64
|
+
x: 0,
|
|
65
|
+
y: 0
|
|
66
|
+
};
|
|
67
|
+
var A = line.from;
|
|
68
|
+
var B = line.to;
|
|
69
|
+
var C = line_port.from;
|
|
70
|
+
var D = line_port.to;
|
|
71
|
+
var bunbo = (B.y - A.y) * (D.x - C.x) - (B.x - A.x) * (D.y - C.y);
|
|
72
|
+
if (!this.isCorss(A, B, C, D)) return null;
|
|
73
|
+
|
|
74
|
+
// 二つの線分の交点を算出する。
|
|
75
|
+
// http://mf-atelier.sakura.ne.jp/mf-atelier/modules/tips/program/algorithm/a1.html
|
|
76
|
+
var d1, d2;
|
|
77
|
+
d1 = C.y * D.x - C.x * D.y;
|
|
78
|
+
d2 = A.y * B.x - A.x * B.y;
|
|
79
|
+
out.x = (d1 * (B.x - A.x) - d2 * (D.x - C.x)) / bunbo;
|
|
80
|
+
out.y = (d1 * (B.y - A.y) - d2 * (D.y - C.y)) / bunbo;
|
|
81
|
+
return out;
|
|
82
|
+
}
|
|
83
|
+
// 2直線の交点を求める。
|
|
84
|
+
}, {
|
|
85
|
+
key: "getCrossPoint",
|
|
86
|
+
value: function getCrossPoint(lines, line_port) {
|
|
87
|
+
var _iterator = _createForOfIteratorHelper(lines),
|
|
88
|
+
_step;
|
|
89
|
+
try {
|
|
90
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
91
|
+
var line = _step.value;
|
|
92
|
+
var point = this.getCrossPointCore(line, line_port);
|
|
93
|
+
if (point) return point;
|
|
94
|
+
}
|
|
95
|
+
} catch (err) {
|
|
96
|
+
_iterator.e(err);
|
|
97
|
+
} finally {
|
|
98
|
+
_iterator.f();
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
}]);
|
|
103
|
+
}();
|
|
104
|
+
/**
|
|
105
|
+
* Drawer の共通要素とての Core です。
|
|
106
|
+
* 各 Drawer の要素を整えるメッソッドをまとめているクラスです。
|
|
107
|
+
* いろいろと共通なものがあると思うので。
|
|
108
|
+
* また見通しも良くなるかと。
|
|
109
|
+
* 作る必要があるのかはアレですが。。。
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* let drawer = new DrawerHierarchy();
|
|
113
|
+
*/
|
|
114
|
+
var DigestionCore = exports.DigestionCore = /*#__PURE__*/function () {
|
|
115
|
+
function DigestionCore() {
|
|
116
|
+
_classCallCheck(this, DigestionCore);
|
|
117
|
+
}
|
|
118
|
+
return _createClass(DigestionCore, [{
|
|
119
|
+
key: "normalizeFont",
|
|
120
|
+
value:
|
|
121
|
+
///// ////////////////////////////////////////////////////////////////
|
|
122
|
+
///// normalize
|
|
123
|
+
///// ////////////////////////////////////////////////////////////////
|
|
124
|
+
function normalizeFont(font_core) {
|
|
125
|
+
var template = {
|
|
126
|
+
size: 16,
|
|
127
|
+
color: '#333333'
|
|
128
|
+
};
|
|
129
|
+
if (!font_core) return template;
|
|
130
|
+
return font_core;
|
|
131
|
+
}
|
|
132
|
+
}, {
|
|
133
|
+
key: "normalizeLabel",
|
|
134
|
+
value: function normalizeLabel(label_core) {
|
|
135
|
+
var label = {
|
|
136
|
+
contents: '',
|
|
137
|
+
position: {
|
|
138
|
+
x: 20,
|
|
139
|
+
y: 20
|
|
140
|
+
},
|
|
141
|
+
font: {
|
|
142
|
+
size: 16,
|
|
143
|
+
color: '#333333'
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
if (!label_core) return label;
|
|
147
|
+
if (label_core.contents) label.contents = label_core.contents;
|
|
148
|
+
var label_tmp = label_core.position ? label_core.position : label.position;
|
|
149
|
+
label.position = this.normalizePosition(label_tmp);
|
|
150
|
+
label.font = this.normalizeFont(label_core.font);
|
|
151
|
+
return label;
|
|
152
|
+
}
|
|
153
|
+
}, {
|
|
154
|
+
key: "normalizeSize",
|
|
155
|
+
value: function normalizeSize(size_core) {
|
|
156
|
+
var size = {
|
|
157
|
+
w: 0,
|
|
158
|
+
h: 0
|
|
159
|
+
};
|
|
160
|
+
if (!size_core) return size;
|
|
161
|
+
if (size_core.w || size_core.w === 0) size.w = size_core.w;
|
|
162
|
+
if (size_core.h || size_core.h === 0) size.h = size_core.h;
|
|
163
|
+
return size;
|
|
164
|
+
}
|
|
165
|
+
}, {
|
|
166
|
+
key: "normalizePosition",
|
|
167
|
+
value: function normalizePosition(position_core) {
|
|
168
|
+
var position = {
|
|
169
|
+
x: 0,
|
|
170
|
+
y: 0
|
|
171
|
+
};
|
|
172
|
+
if (!position_core) return position;
|
|
173
|
+
if (position_core.x || position_core.x === 0) position.x = position_core.x;
|
|
174
|
+
if (position_core.y || position_core.y === 0) position.y = position_core.y;
|
|
175
|
+
return position;
|
|
176
|
+
}
|
|
177
|
+
}, {
|
|
178
|
+
key: "normalizeBackground",
|
|
179
|
+
value: function normalizeBackground(background_core) {
|
|
180
|
+
var background = {
|
|
181
|
+
color: '#ffffff'
|
|
182
|
+
};
|
|
183
|
+
if (!background_core) return background;
|
|
184
|
+
if (background_core.color) background.color = background_core.color;
|
|
185
|
+
return background;
|
|
186
|
+
}
|
|
187
|
+
}, {
|
|
188
|
+
key: "normalizeBorder",
|
|
189
|
+
value: function normalizeBorder(border_core) {
|
|
190
|
+
var border = {
|
|
191
|
+
width: 1,
|
|
192
|
+
type: 'solid',
|
|
193
|
+
color: '#666666'
|
|
194
|
+
};
|
|
195
|
+
if (!border_core) return border;
|
|
196
|
+
if (border_core.width || border_core.width === 0) border.width = border_core.width;
|
|
197
|
+
if (border_core.color) border.color = border_core.color;
|
|
198
|
+
if (border_core.type) border.type = border_core.type;
|
|
199
|
+
return border;
|
|
200
|
+
}
|
|
201
|
+
}, {
|
|
202
|
+
key: "normalizePadding",
|
|
203
|
+
value: function normalizePadding(padding_core) {
|
|
204
|
+
var template = {
|
|
205
|
+
top: 0,
|
|
206
|
+
left: 0,
|
|
207
|
+
bottom: 0,
|
|
208
|
+
right: 0
|
|
209
|
+
};
|
|
210
|
+
if (!padding_core) return template;
|
|
211
|
+
return padding_core;
|
|
212
|
+
}
|
|
213
|
+
}]);
|
|
214
|
+
}();
|
|
215
|
+
/**
|
|
216
|
+
* 階層構造のデータの Drawer です。
|
|
217
|
+
* Data の 位置、サイズ を整えます。
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* let drawer = new DrawerHierarchy();
|
|
221
|
+
*/
|
|
222
|
+
var DigestionHierarchy = exports.DigestionHierarchy = /*#__PURE__*/function (_DigestionCore) {
|
|
223
|
+
function DigestionHierarchy() {
|
|
224
|
+
_classCallCheck(this, DigestionHierarchy);
|
|
225
|
+
return _callSuper(this, DigestionHierarchy, arguments);
|
|
226
|
+
}
|
|
227
|
+
_inherits(DigestionHierarchy, _DigestionCore);
|
|
228
|
+
return _createClass(DigestionHierarchy, [{
|
|
229
|
+
key: "data2rect",
|
|
230
|
+
value:
|
|
231
|
+
///// ////////////////////////////////////////////////////////////////
|
|
232
|
+
///// Utilities
|
|
233
|
+
///// ////////////////////////////////////////////////////////////////
|
|
234
|
+
function data2rect(data) {
|
|
235
|
+
return {
|
|
236
|
+
from: {
|
|
237
|
+
x: data.position.x,
|
|
238
|
+
y: data.position.y
|
|
239
|
+
},
|
|
240
|
+
to: {
|
|
241
|
+
x: data.position.x + data.size.w,
|
|
242
|
+
y: data.position.y + data.size.h
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
///// ////////////////////////////////////////////////////////////////
|
|
247
|
+
///// Fitting
|
|
248
|
+
///// ////////////////////////////////////////////////////////////////
|
|
249
|
+
}, {
|
|
250
|
+
key: "fittingCalSizeCore",
|
|
251
|
+
value: function fittingCalSizeCore(rect_a, rect_b) {
|
|
252
|
+
if (!rect_a.from) {
|
|
253
|
+
rect_a.from = {
|
|
254
|
+
x: rect_b.from.x,
|
|
255
|
+
y: rect_b.from.y
|
|
256
|
+
};
|
|
257
|
+
} else {
|
|
258
|
+
if (rect_a.from.x > rect_b.from.x) rect_a.from.x = rect_b.from.x;
|
|
259
|
+
if (rect_a.from.y > rect_b.from.y) rect_a.from.y = rect_b.from.y;
|
|
260
|
+
}
|
|
261
|
+
if (!rect_a.to) {
|
|
262
|
+
rect_a.to = {
|
|
263
|
+
x: rect_b.to.x,
|
|
264
|
+
y: rect_b.to.y
|
|
265
|
+
};
|
|
266
|
+
} else {
|
|
267
|
+
if (rect_a.to.x < rect_b.to.x) rect_a.to.x = rect_b.to.x;
|
|
268
|
+
if (rect_a.to.y < rect_b.to.y) rect_a.to.y = rect_b.to.y;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}, {
|
|
272
|
+
key: "fittingCalSize",
|
|
273
|
+
value: function fittingCalSize(rect, child) {
|
|
274
|
+
var rect_a = rect;
|
|
275
|
+
var rect_b = this.data2rect(child);
|
|
276
|
+
this.fittingCalSizeCore(rect_a, rect_b);
|
|
277
|
+
}
|
|
278
|
+
}, {
|
|
279
|
+
key: "fitting",
|
|
280
|
+
value: function fitting(data, parent) {
|
|
281
|
+
// parent からの相対位置で補正
|
|
282
|
+
if (parent) {
|
|
283
|
+
data.position.x = parent.position.x + data.position.x;
|
|
284
|
+
data.position.y = parent.position.y + data.position.y;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// children も同様に。
|
|
288
|
+
var rect = {
|
|
289
|
+
from: null,
|
|
290
|
+
to: null
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
// children の fitting 合せて data のサイズも計測。
|
|
294
|
+
var children = data.children;
|
|
295
|
+
if (children && children.length > 0) {
|
|
296
|
+
var _iterator2 = _createForOfIteratorHelper(data.children),
|
|
297
|
+
_step2;
|
|
298
|
+
try {
|
|
299
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
300
|
+
var child = _step2.value;
|
|
301
|
+
this.fitting(child, data);
|
|
302
|
+
this.fittingCalSize(rect, child); // rect は破壊的
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// children 内容で data のサイズを補正
|
|
306
|
+
} catch (err) {
|
|
307
|
+
_iterator2.e(err);
|
|
308
|
+
} finally {
|
|
309
|
+
_iterator2.f();
|
|
310
|
+
}
|
|
311
|
+
this.fittingCalSizeCore(rect, this.data2rect(data));
|
|
312
|
+
data.size.w = rect.to.x - rect.from.x;
|
|
313
|
+
data.size.h = rect.to.y - rect.from.y;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}]);
|
|
317
|
+
}(DigestionCore);
|
|
318
|
+
var Digestion = exports["default"] = /*#__PURE__*/_createClass(function Digestion() {
|
|
319
|
+
_classCallCheck(this, Digestion);
|
|
320
|
+
});
|