@yanqirenshi/d3.wireframe 0.0.7 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/DataBackground.js +37 -0
  2. package/dist/DataFont.js +39 -0
  3. package/dist/DataPosition.js +39 -0
  4. package/dist/DataRectangle.js +37 -0
  5. package/dist/DataStroke.js +37 -0
  6. package/dist/Digestion.js +320 -0
  7. package/dist/Drawer.js +317 -0
  8. package/dist/Element.js +98 -0
  9. package/dist/ElementButton.js +128 -0
  10. package/dist/ElementDialog.js +112 -0
  11. package/dist/ElementFounder.js +116 -0
  12. package/dist/ElementFrame.js +112 -0
  13. package/dist/ElementIcon.js +83 -0
  14. package/dist/ElementImage.js +112 -0
  15. package/dist/ElementLabel.js +82 -0
  16. package/dist/ElementModal.js +93 -0
  17. package/dist/Rectum.js +161 -0
  18. package/dist/components/D3Wireframe.js +16 -0
  19. package/dist/index.js +16 -0
  20. package/package.json +45 -35
  21. package/src/{D3Wireframe.js → Rectum.js} +115 -111
  22. package/src/components/D3Wireframe.js +9 -0
  23. package/src/index.js +9 -0
  24. package/babel.config.js +0 -14
  25. package/docs/asset-manifest.json +0 -23
  26. package/docs/favicon.ico +0 -0
  27. package/docs/index.html +0 -1
  28. package/docs/logo192.png +0 -0
  29. package/docs/logo512.png +0 -0
  30. package/docs/manifest.json +0 -25
  31. package/docs/precache-manifest.5f1fad934ed0507dbc92de6788eff788.js +0 -30
  32. package/docs/robots.txt +0 -3
  33. package/docs/service-worker.js +0 -39
  34. package/docs/static/css/main.5f361e03.chunk.css +0 -2
  35. package/docs/static/css/main.5f361e03.chunk.css.map +0 -1
  36. package/docs/static/js/2.e2326255.chunk.js +0 -3
  37. package/docs/static/js/2.e2326255.chunk.js.LICENSE.txt +0 -32
  38. package/docs/static/js/2.e2326255.chunk.js.map +0 -1
  39. package/docs/static/js/main.7f51684e.chunk.js +0 -2
  40. package/docs/static/js/main.7f51684e.chunk.js.map +0 -1
  41. package/docs/static/js/runtime-main.0c5b98f9.js +0 -2
  42. package/docs/static/js/runtime-main.0c5b98f9.js.map +0 -1
  43. package/docs/static/media/logo.5d5d9eef.svg +0 -7
  44. package/documents/README.md +0 -68
  45. package/documents/package-lock.json +0 -13792
  46. package/documents/package.json +0 -34
  47. package/documents/public/favicon.ico +0 -0
  48. package/documents/public/index.html +0 -43
  49. package/documents/public/logo192.png +0 -0
  50. package/documents/public/logo512.png +0 -0
  51. package/documents/public/manifest.json +0 -25
  52. package/documents/public/robots.txt +0 -3
  53. package/documents/src/App.css +0 -38
  54. package/documents/src/App.js +0 -26
  55. package/documents/src/App.test.js +0 -9
  56. package/documents/src/index.css +0 -13
  57. package/documents/src/index.js +0 -17
  58. package/documents/src/logo.svg +0 -7
  59. package/documents/src/serviceWorker.js +0 -141
  60. package/documents/src/setupTests.js +0 -5
  61. package/example/README.md +0 -68
  62. package/example/package-lock.json +0 -14729
  63. package/example/package.json +0 -36
  64. package/example/public/favicon.ico +0 -0
  65. package/example/public/index.html +0 -43
  66. package/example/public/logo192.png +0 -0
  67. package/example/public/logo512.png +0 -0
  68. package/example/public/manifest.json +0 -25
  69. package/example/public/robots.txt +0 -3
  70. package/example/src/App.css +0 -38
  71. package/example/src/App.js +0 -14
  72. package/example/src/App.test.js +0 -9
  73. package/example/src/data/WIREFRAME_DATA.js +0 -11
  74. package/example/src/data/WIREFRAME_DATA_DIALOG.js +0 -65
  75. package/example/src/data/WIREFRAME_DATA_FRAME.js +0 -70
  76. package/example/src/data/WIREFRAME_DATA_MODAL.js +0 -10
  77. package/example/src/index.css +0 -13
  78. package/example/src/index.js +0 -17
  79. package/example/src/js/D3Wireframe.js +0 -111
  80. package/example/src/js/DataBackground.js +0 -23
  81. package/example/src/js/DataFont.js +0 -25
  82. package/example/src/js/DataPosition.js +0 -21
  83. package/example/src/js/DataRectangle.js +0 -20
  84. package/example/src/js/DataStroke.js +0 -23
  85. package/example/src/js/Digestion.js +0 -273
  86. package/example/src/js/Drawer.js +0 -270
  87. package/example/src/js/Element.js +0 -67
  88. package/example/src/js/ElementButton.js +0 -94
  89. package/example/src/js/ElementDialog.js +0 -77
  90. package/example/src/js/ElementFounder.js +0 -85
  91. package/example/src/js/ElementFrame.js +0 -77
  92. package/example/src/js/ElementIcon.js +0 -56
  93. package/example/src/js/ElementImage.js +0 -77
  94. package/example/src/js/ElementLabel.js +0 -51
  95. package/example/src/js/ElementModal.js +0 -65
  96. package/example/src/pages/ExampleGraph.js +0 -39
  97. package/example/src/pages/Explanation.js +0 -43
  98. package/example/src/pages/PageExample.js +0 -41
  99. package/example/src/serviceWorker.js +0 -141
  100. package/example/src/setupTests.js +0 -5
  101. package/index.js +0 -3
  102. package/jest.config.js +0 -17
  103. package/riot.v3/index.html +0 -21
  104. package/riot.v3/index.js +0 -86
  105. package/riot.v3/scketch.js +0 -96
  106. package/riot.v3/wireframe.js +0 -11
  107. package/tests/D3Wireframe.test.js +0 -7
package/dist/Rectum.js ADDED
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+
3
+ 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); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var _assh0le = require("@yanqirenshi/assh0le");
9
+ var _Element = _interopRequireDefault(require("./Element"));
10
+ var _Drawer = require("./Drawer.js");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
12
+ 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; } } }; }
13
+ 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; } }
14
+ 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; }
15
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
16
+ 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); } }
17
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
19
+ 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); }
20
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
21
+ 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); }
22
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
23
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
24
+ 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; }
25
+ function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }
26
+ function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }
27
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
28
+ 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); }
29
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
30
+ /**
31
+ * データクラス。ワイヤーフレーム要素の構築・マージ・保持を行い、
32
+ * 描画は Element(各 Element クラス)へ委譲する。
33
+ *
34
+ * 旧 D3Wireframe(assh0le 0.0.3 の Asshole クラス継承)を
35
+ * 現行アーキテクチャ(Colon 継承 + React ラッパ)へ移行したもの。
36
+ */
37
+ var Rectum = exports["default"] = /*#__PURE__*/function (_Colon) {
38
+ function Rectum(params) {
39
+ var _this;
40
+ _classCallCheck(this, Rectum);
41
+ _this = _callSuper(this, Rectum, [params]);
42
+ _this.element = new _Element["default"]();
43
+ _this._elements = {
44
+ ht: {},
45
+ list: []
46
+ };
47
+ return _this;
48
+ }
49
+ /* **************************************************************** *
50
+ * Make Elements
51
+ * **************************************************************** */
52
+ _inherits(Rectum, _Colon);
53
+ return _createClass(Rectum, [{
54
+ key: "firstObject",
55
+ value: function firstObject(list) {
56
+ if (list.length === 0) return null;
57
+ return list[0];
58
+ }
59
+ }, {
60
+ key: "merge",
61
+ value: function merge(source, target) {
62
+ var source_sorted = source.sort(function (a, b) {
63
+ return a.id < b.id ? -1 : 1;
64
+ });
65
+ var target_sorted = target.sort(function (a, b) {
66
+ return a._core.id < b._core.id ? -1 : 1;
67
+ });
68
+ var out = [];
69
+ while (source_sorted.length > 0 || target_sorted.length > 0) {
70
+ var src = this.firstObject(source_sorted);
71
+ var trg = this.firstObject(target_sorted);
72
+ if (trg === null) {
73
+ // source にしか無いケース
74
+ if (src.visible !== false) out.push(this.element.makeElement(src));
75
+ source_sorted.shift();
76
+ } else if (src === null) {
77
+ // target にしか無いやつは削除する。
78
+ target_sorted.shift();
79
+ } else if (src.id === trg._core.id) {
80
+ out.push(this.element.mergeCore(src, trg));
81
+ source_sorted.shift();
82
+ target_sorted.shift();
83
+ } else if (src.id < trg._core.id) {
84
+ // source にしか無いケース
85
+ out.push(this.element.makeElement(src));
86
+ source_sorted.shift();
87
+ } else {
88
+ // target にしか無いやつは削除する。
89
+ target_sorted.shift();
90
+ }
91
+ }
92
+ return out;
93
+ }
94
+ }, {
95
+ key: "makeElements",
96
+ value: function makeElements(list) {
97
+ var new_list = this.merge(list, this._elements.list);
98
+ var pool = {
99
+ ht: {},
100
+ list: []
101
+ };
102
+ var dh = new _Drawer.DrawerHierarchy();
103
+ var _iterator = _createForOfIteratorHelper(new_list),
104
+ _step;
105
+ try {
106
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
107
+ var d = _step.value;
108
+ dh.fitting(d);
109
+ pool.ht[d._id] = d;
110
+ pool.list.push(d);
111
+ }
112
+ } catch (err) {
113
+ _iterator.e(err);
114
+ } finally {
115
+ _iterator.f();
116
+ }
117
+ return pool;
118
+ }
119
+ /* **************************************************************** *
120
+ * Draw
121
+ * **************************************************************** */
122
+ }, {
123
+ key: "flatten",
124
+ value: function flatten(data) {
125
+ var out = [];
126
+ var _iterator2 = _createForOfIteratorHelper(data),
127
+ _step2;
128
+ try {
129
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
130
+ var d = _step2.value;
131
+ out.push(d);
132
+ if (d.children.length === 0) continue;
133
+ out = out.concat(this.flatten(d.children));
134
+ }
135
+ } catch (err) {
136
+ _iterator2.e(err);
137
+ } finally {
138
+ _iterator2.f();
139
+ }
140
+ return out;
141
+ }
142
+ }, {
143
+ key: "draw",
144
+ value: function draw() {
145
+ var data = this.flatten(this._elements.list);
146
+ var place = this.layer('foreground');
147
+ if (!place) return;
148
+ this.element.draw(place, data);
149
+ }
150
+ /* **************************************************************** *
151
+ * Data
152
+ * **************************************************************** */
153
+ }, {
154
+ key: "data",
155
+ value: function data(_data) {
156
+ if (arguments.length === 0) return _superPropGet(Rectum, "data", this, 3)([]);
157
+ this._elements = this.makeElements(_data);
158
+ return _superPropGet(Rectum, "data", this, 3)([this._elements]);
159
+ }
160
+ }]);
161
+ }(_assh0le.Colon);
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = D3Wireframe;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _assh0le = _interopRequireDefault(require("@yanqirenshi/assh0le"));
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
10
+ function D3Wireframe(props) {
11
+ var rectum = props.rectum;
12
+ return /*#__PURE__*/_react["default"].createElement(_assh0le["default"], {
13
+ id: "d3-wireframe-graph",
14
+ rectum: rectum
15
+ });
16
+ }
package/dist/index.js ADDED
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Rectum", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _Rectum["default"];
10
+ }
11
+ });
12
+ exports["default"] = void 0;
13
+ var _D3Wireframe = _interopRequireDefault(require("./components/D3Wireframe.js"));
14
+ var _Rectum = _interopRequireDefault(require("./Rectum.js"));
15
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
16
+ var _default = exports["default"] = _D3Wireframe["default"];
package/package.json CHANGED
@@ -1,35 +1,45 @@
1
- {
2
- "name": "@yanqirenshi/d3.wireframe",
3
- "version": "0.0.7",
4
- "description": "",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "jest",
8
- "test:w": "jest --watch",
9
- "test:coverage": "jest --coverage"
10
- },
11
- "repository": {
12
- "type": "git",
13
- "url": "git+https://github.com/yanqirenshi/D3.Wireframe.git"
14
- },
15
- "author": "yanqirenshi <yanqirenshi@gmail.com> (https://github.com/yanqirenshi)",
16
- "license": "ISC",
17
- "bugs": {
18
- "url": "https://github.com/yanqirenshi/D3.Wireframe/issues"
19
- },
20
- "homepage": "https://yanqirenshi.github.io/D3.Wireframe/#home",
21
- "dependencies": {
22
- "@yanqirenshi/assh0le": "0.0.3",
23
- "@yanqirenshi/d3.svg": "0.0.14",
24
- "d3": "^5.15.0"
25
- },
26
- "devDependencies": {
27
- "@babel/cli": "^7.8.4",
28
- "@babel/core": "^7.9.0",
29
- "@babel/preset-env": "^7.9.0",
30
- "deepmerge": "^4.2.2",
31
- "babel-jest": "^25.2.4",
32
- "babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
33
- "jest": "^25.2.4"
34
- }
35
- }
1
+ {
2
+ "name": "@yanqirenshi/d3.wireframe",
3
+ "version": "0.1.1",
4
+ "description": "Wireframe diagram renderer (frame / image / button / modal / dialog elements)",
5
+ "main": "dist/index.js",
6
+ "files": [
7
+ "dist",
8
+ "src"
9
+ ],
10
+ "scripts": {
11
+ "transpile": "babel src -d dist --copy-files",
12
+ "prepublishOnly": "npm run transpile",
13
+ "test": "jest",
14
+ "test:w": "jest --watch",
15
+ "test:coverage": "jest --coverage"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/yanqirenshi/D3.Wireframe.git"
20
+ },
21
+ "author": "yanqirenshi <yanqirenshi@gmail.com> (https://github.com/yanqirenshi)",
22
+ "license": "ISC",
23
+ "bugs": {
24
+ "url": "https://github.com/yanqirenshi/D3.Wireframe/issues"
25
+ },
26
+ "homepage": "https://yanqirenshi.github.io/D3.Wireframe/#home",
27
+ "peerDependencies": {
28
+ "react": "^18.0.0 || ^19.0.0",
29
+ "react-dom": "^18.0.0 || ^19.0.0"
30
+ },
31
+ "dependencies": {
32
+ "@yanqirenshi/assh0le": "^0.5.2"
33
+ },
34
+ "devDependencies": {
35
+ "@babel/cli": "^7.8.4",
36
+ "@babel/core": "^7.9.0",
37
+ "@babel/preset-env": "^7.9.0",
38
+ "@babel/preset-react": "^7.14.5",
39
+ "babel-jest": "^25.2.4",
40
+ "jest": "^25.2.4"
41
+ },
42
+ "publishConfig": {
43
+ "access": "public"
44
+ }
45
+ }
@@ -1,111 +1,115 @@
1
- import Asshole from '@yanqirenshi/assh0le';
2
-
3
- import Element from './Element';
4
-
5
- import { DrawerHierarchy } from './Drawer.js';
6
-
7
- export default class D3Wireframe extends Asshole {
8
- constructor () {
9
- super();
10
-
11
- this.element = new Element();
12
- this._elements = { ht: {}, list: [] };
13
- }
14
- /* **************************************************************** *
15
- * Initialize
16
- * **************************************************************** */
17
- init (params) {
18
- super.init(params);
19
-
20
- return this;
21
- }
22
- /* **************************************************************** *
23
- * Make Elements
24
- * **************************************************************** */
25
- firstObject (list) {
26
- if (list.length===0)
27
- return null;
28
- return list[0];
29
- }
30
- merge (source, target) {
31
- const source_sorted = source.sort((a, b) => { return a.id<b.id ? -1 : 1; });
32
- const target_sorted = target.sort((a, b) => {
33
- return a._core.id < b._core.id ? -1 : 1;
34
- });
35
-
36
- let out = [];
37
- while (source_sorted.length>0 || target_sorted.length>0) {
38
- let src = this.firstObject(source_sorted);
39
- let trg = this.firstObject(target_sorted);
40
- if (trg===null) {
41
- // source にしか無いケース
42
- if (src.visible!==false)
43
- out.push(this.element.makeElement(src));
44
- source_sorted.shift();
45
- } else if (src===null) {
46
- // target にしか無いやつは削除する。
47
- target_sorted.shift();
48
- } else if (src.id === trg._core.id) {
49
- out.push(this.element.mergeCore(src, trg));
50
- source_sorted.shift();
51
- target_sorted.shift();
52
- } else if (src.id < trg._core.id) {
53
- // source にしか無いケース
54
- out.push(this.element.makeElement(src));
55
- source_sorted.shift();
56
- } else {
57
- // target にしか無いやつは削除する。
58
- target_sorted.shift();
59
- }
60
- }
61
-
62
- return out;
63
- }
64
- makeElements (list) {
65
- let new_list = this.merge(list, this._elements.list);
66
-
67
- let pool = { ht: {}, list: [] };
68
-
69
- const dh = new DrawerHierarchy();
70
- for (let d of new_list) {
71
- dh.fitting(d);
72
-
73
- pool.ht[d._id] = d;
74
- pool.list.push(d);
75
- }
76
-
77
- return pool;
78
- }
79
- /* **************************************************************** *
80
- * Draw
81
- * **************************************************************** */
82
- flatten (data) {
83
- let out = [];
84
-
85
- const x = new D3Wireframe();
86
- for (let d of data) {
87
- out.push(d);
88
-
89
- if (d.children.length===0)
90
- continue;
91
-
92
- out = out.concat(x.flatten(d.children));
93
- }
94
-
95
- return out;
96
- }
97
- draw () {
98
- const data = this.flatten(this._elements.list);
99
- const forground = this.getLayerForeground();
100
-
101
- if (!forground)
102
- return;
103
-
104
- this.element.draw(forground, data);
105
- }
106
- data (data) {
107
- this._elements = this.makeElements(data);
108
-
109
- this.draw();
110
- }
111
- }
1
+ import { Colon } from '@yanqirenshi/assh0le';
2
+
3
+ import Element from './Element';
4
+
5
+ import { DrawerHierarchy } from './Drawer.js';
6
+
7
+ /**
8
+ * データクラス。ワイヤーフレーム要素の構築・マージ・保持を行い、
9
+ * 描画は Element(各 Element クラス)へ委譲する。
10
+ *
11
+ * 旧 D3Wireframe(assh0le 0.0.3 の Asshole クラス継承)を
12
+ * 現行アーキテクチャ(Colon 継承 + React ラッパ)へ移行したもの。
13
+ */
14
+ export default class Rectum extends Colon {
15
+ constructor (params) {
16
+ super(params);
17
+
18
+ this.element = new Element();
19
+ this._elements = { ht: {}, list: [] };
20
+ }
21
+ /* **************************************************************** *
22
+ * Make Elements
23
+ * **************************************************************** */
24
+ firstObject (list) {
25
+ if (list.length===0)
26
+ return null;
27
+ return list[0];
28
+ }
29
+ merge (source, target) {
30
+ const source_sorted = source.sort((a, b) => { return a.id<b.id ? -1 : 1; });
31
+ const target_sorted = target.sort((a, b) => {
32
+ return a._core.id < b._core.id ? -1 : 1;
33
+ });
34
+
35
+ let out = [];
36
+ while (source_sorted.length>0 || target_sorted.length>0) {
37
+ let src = this.firstObject(source_sorted);
38
+ let trg = this.firstObject(target_sorted);
39
+ if (trg===null) {
40
+ // source にしか無いケース
41
+ if (src.visible!==false)
42
+ out.push(this.element.makeElement(src));
43
+ source_sorted.shift();
44
+ } else if (src===null) {
45
+ // target にしか無いやつは削除する。
46
+ target_sorted.shift();
47
+ } else if (src.id === trg._core.id) {
48
+ out.push(this.element.mergeCore(src, trg));
49
+ source_sorted.shift();
50
+ target_sorted.shift();
51
+ } else if (src.id < trg._core.id) {
52
+ // source にしか無いケース
53
+ out.push(this.element.makeElement(src));
54
+ source_sorted.shift();
55
+ } else {
56
+ // target にしか無いやつは削除する。
57
+ target_sorted.shift();
58
+ }
59
+ }
60
+
61
+ return out;
62
+ }
63
+ makeElements (list) {
64
+ let new_list = this.merge(list, this._elements.list);
65
+
66
+ let pool = { ht: {}, list: [] };
67
+
68
+ const dh = new DrawerHierarchy();
69
+ for (let d of new_list) {
70
+ dh.fitting(d);
71
+
72
+ pool.ht[d._id] = d;
73
+ pool.list.push(d);
74
+ }
75
+
76
+ return pool;
77
+ }
78
+ /* **************************************************************** *
79
+ * Draw
80
+ * **************************************************************** */
81
+ flatten (data) {
82
+ let out = [];
83
+
84
+ for (let d of data) {
85
+ out.push(d);
86
+
87
+ if (d.children.length===0)
88
+ continue;
89
+
90
+ out = out.concat(this.flatten(d.children));
91
+ }
92
+
93
+ return out;
94
+ }
95
+ draw () {
96
+ const data = this.flatten(this._elements.list);
97
+ const place = this.layer('foreground');
98
+
99
+ if (!place)
100
+ return;
101
+
102
+ this.element.draw(place, data);
103
+ }
104
+ /* **************************************************************** *
105
+ * Data
106
+ * **************************************************************** */
107
+ data (data) {
108
+ if (arguments.length===0)
109
+ return super.data();
110
+
111
+ this._elements = this.makeElements(data);
112
+
113
+ return super.data(this._elements);
114
+ }
115
+ }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+
3
+ import Asshole from '@yanqirenshi/assh0le';
4
+
5
+ export default function D3Wireframe (props) {
6
+ const rectum = props.rectum;
7
+
8
+ return <Asshole id="d3-wireframe-graph" rectum={rectum}/>;
9
+ }
package/src/index.js ADDED
@@ -0,0 +1,9 @@
1
+ import D3Wireframe from './components/D3Wireframe.js';
2
+
3
+ import Rectum from './Rectum.js';
4
+
5
+ export default D3Wireframe;
6
+
7
+ export {
8
+ Rectum,
9
+ }
package/babel.config.js DELETED
@@ -1,14 +0,0 @@
1
- module.exports = {
2
- presets: [
3
- [
4
- "@babel/preset-env"
5
- ]
6
- ],
7
- env: {
8
- test: {
9
- plugins: [
10
- "babel-plugin-transform-es2015-modules-commonjs",
11
- ],
12
- },
13
- },
14
- };
@@ -1,23 +0,0 @@
1
- {
2
- "files": {
3
- "main.css": "/static/css/main.5f361e03.chunk.css",
4
- "main.js": "/static/js/main.7f51684e.chunk.js",
5
- "main.js.map": "/static/js/main.7f51684e.chunk.js.map",
6
- "runtime-main.js": "/static/js/runtime-main.0c5b98f9.js",
7
- "runtime-main.js.map": "/static/js/runtime-main.0c5b98f9.js.map",
8
- "static/js/2.e2326255.chunk.js": "/static/js/2.e2326255.chunk.js",
9
- "static/js/2.e2326255.chunk.js.map": "/static/js/2.e2326255.chunk.js.map",
10
- "index.html": "/index.html",
11
- "precache-manifest.5f1fad934ed0507dbc92de6788eff788.js": "/precache-manifest.5f1fad934ed0507dbc92de6788eff788.js",
12
- "service-worker.js": "/service-worker.js",
13
- "static/css/main.5f361e03.chunk.css.map": "/static/css/main.5f361e03.chunk.css.map",
14
- "static/js/2.e2326255.chunk.js.LICENSE.txt": "/static/js/2.e2326255.chunk.js.LICENSE.txt",
15
- "static/media/logo.svg": "/static/media/logo.5d5d9eef.svg"
16
- },
17
- "entrypoints": [
18
- "static/js/runtime-main.0c5b98f9.js",
19
- "static/js/2.e2326255.chunk.js",
20
- "static/css/main.5f361e03.chunk.css",
21
- "static/js/main.7f51684e.chunk.js"
22
- ]
23
- }
package/docs/favicon.ico DELETED
Binary file
package/docs/index.html DELETED
@@ -1 +0,0 @@
1
- <!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><link href="/static/css/main.5f361e03.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,f,i=r[0],l=r[1],a=r[2],p=0,s=[];p<i.length;p++)f=i[p],Object.prototype.hasOwnProperty.call(o,f)&&o[f]&&s.push(o[f][0]),o[f]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(c&&c(r);s.length;)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var l=t[i];0!==o[l]&&(n=!1)}n&&(u.splice(r--,1),e=f(f.s=t[0]))}return e}var n={},o={1:0},u=[];function f(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,f),t.l=!0,t.exports}f.m=e,f.c=n,f.d=function(e,r,t){f.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},f.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.t=function(e,r){if(1&r&&(e=f(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(f.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)f.d(t,n,function(r){return e[r]}.bind(null,n));return t},f.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(r,"a",r),r},f.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},f.p="/";var i=this["webpackJsonpd3.wireframe.docs"]=this["webpackJsonpd3.wireframe.docs"]||[],l=i.push.bind(i);i.push=r,i=i.slice();for(var a=0;a<i.length;a++)r(i[a]);var c=l;t()}([])</script><script src="/static/js/2.e2326255.chunk.js"></script><script src="/static/js/main.7f51684e.chunk.js"></script></body></html>
package/docs/logo192.png DELETED
Binary file
package/docs/logo512.png DELETED
Binary file
@@ -1,25 +0,0 @@
1
- {
2
- "short_name": "React App",
3
- "name": "Create React App Sample",
4
- "icons": [
5
- {
6
- "src": "favicon.ico",
7
- "sizes": "64x64 32x32 24x24 16x16",
8
- "type": "image/x-icon"
9
- },
10
- {
11
- "src": "logo192.png",
12
- "type": "image/png",
13
- "sizes": "192x192"
14
- },
15
- {
16
- "src": "logo512.png",
17
- "type": "image/png",
18
- "sizes": "512x512"
19
- }
20
- ],
21
- "start_url": ".",
22
- "display": "standalone",
23
- "theme_color": "#000000",
24
- "background_color": "#ffffff"
25
- }
@@ -1,30 +0,0 @@
1
- self.__precacheManifest = (self.__precacheManifest || []).concat([
2
- {
3
- "revision": "74f4986114a315bc4def7bc7e06741bc",
4
- "url": "/index.html"
5
- },
6
- {
7
- "revision": "43559e4e70704f2b1162",
8
- "url": "/static/css/main.5f361e03.chunk.css"
9
- },
10
- {
11
- "revision": "d2baff32e3e1664d9a91",
12
- "url": "/static/js/2.e2326255.chunk.js"
13
- },
14
- {
15
- "revision": "e88a3e95b5364d46e95b35ae8c0dc27d",
16
- "url": "/static/js/2.e2326255.chunk.js.LICENSE.txt"
17
- },
18
- {
19
- "revision": "43559e4e70704f2b1162",
20
- "url": "/static/js/main.7f51684e.chunk.js"
21
- },
22
- {
23
- "revision": "52cf867a072fb12b9e66",
24
- "url": "/static/js/runtime-main.0c5b98f9.js"
25
- },
26
- {
27
- "revision": "5d5d9eefa31e5e13a6610d9fa7a283bb",
28
- "url": "/static/media/logo.5d5d9eef.svg"
29
- }
30
- ]);
package/docs/robots.txt DELETED
@@ -1,3 +0,0 @@
1
- # https://www.robotstxt.org/robotstxt.html
2
- User-agent: *
3
- Disallow: