@yanqirenshi/d3.wireframe 0.0.6 → 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.
Files changed (110) hide show
  1. package/babel.config.js +10 -14
  2. package/dist/DataBackground.js +37 -0
  3. package/dist/DataFont.js +39 -0
  4. package/dist/DataPosition.js +39 -0
  5. package/dist/DataRectangle.js +37 -0
  6. package/dist/DataStroke.js +37 -0
  7. package/dist/Digestion.js +320 -0
  8. package/dist/Drawer.js +317 -0
  9. package/dist/Element.js +98 -0
  10. package/dist/ElementButton.js +128 -0
  11. package/dist/ElementDialog.js +112 -0
  12. package/dist/ElementFounder.js +116 -0
  13. package/dist/ElementFrame.js +112 -0
  14. package/dist/ElementIcon.js +83 -0
  15. package/dist/ElementImage.js +112 -0
  16. package/dist/ElementLabel.js +82 -0
  17. package/dist/ElementModal.js +93 -0
  18. package/dist/Rectum.js +161 -0
  19. package/dist/components/D3Wireframe.js +16 -0
  20. package/dist/index.js +16 -0
  21. package/jest.config.js +23 -17
  22. package/package.json +41 -35
  23. package/src/Element.js +1 -1
  24. package/src/ElementFounder.js +1 -0
  25. package/src/{D3Wireframe.js → Rectum.js} +115 -111
  26. package/src/components/D3Wireframe.js +9 -0
  27. package/src/index.js +9 -0
  28. package/tests/D3Wireframe.test.js +54 -7
  29. package/tests/d3-stub.js +4 -0
  30. package/docs/asset-manifest.json +0 -23
  31. package/docs/favicon.ico +0 -0
  32. package/docs/index.html +0 -1
  33. package/docs/logo192.png +0 -0
  34. package/docs/logo512.png +0 -0
  35. package/docs/manifest.json +0 -25
  36. package/docs/precache-manifest.5f1fad934ed0507dbc92de6788eff788.js +0 -30
  37. package/docs/robots.txt +0 -3
  38. package/docs/service-worker.js +0 -39
  39. package/docs/static/css/main.5f361e03.chunk.css +0 -2
  40. package/docs/static/css/main.5f361e03.chunk.css.map +0 -1
  41. package/docs/static/js/2.e2326255.chunk.js +0 -3
  42. package/docs/static/js/2.e2326255.chunk.js.LICENSE.txt +0 -32
  43. package/docs/static/js/2.e2326255.chunk.js.map +0 -1
  44. package/docs/static/js/main.7f51684e.chunk.js +0 -2
  45. package/docs/static/js/main.7f51684e.chunk.js.map +0 -1
  46. package/docs/static/js/runtime-main.0c5b98f9.js +0 -2
  47. package/docs/static/js/runtime-main.0c5b98f9.js.map +0 -1
  48. package/docs/static/media/logo.5d5d9eef.svg +0 -7
  49. package/documents/README.md +0 -68
  50. package/documents/package-lock.json +0 -13792
  51. package/documents/package.json +0 -34
  52. package/documents/public/favicon.ico +0 -0
  53. package/documents/public/index.html +0 -43
  54. package/documents/public/logo192.png +0 -0
  55. package/documents/public/logo512.png +0 -0
  56. package/documents/public/manifest.json +0 -25
  57. package/documents/public/robots.txt +0 -3
  58. package/documents/src/App.css +0 -38
  59. package/documents/src/App.js +0 -26
  60. package/documents/src/App.test.js +0 -9
  61. package/documents/src/index.css +0 -13
  62. package/documents/src/index.js +0 -17
  63. package/documents/src/logo.svg +0 -7
  64. package/documents/src/serviceWorker.js +0 -141
  65. package/documents/src/setupTests.js +0 -5
  66. package/example/README.md +0 -68
  67. package/example/package-lock.json +0 -14729
  68. package/example/package.json +0 -36
  69. package/example/public/favicon.ico +0 -0
  70. package/example/public/index.html +0 -43
  71. package/example/public/logo192.png +0 -0
  72. package/example/public/logo512.png +0 -0
  73. package/example/public/manifest.json +0 -25
  74. package/example/public/robots.txt +0 -3
  75. package/example/src/App.css +0 -38
  76. package/example/src/App.js +0 -14
  77. package/example/src/App.test.js +0 -9
  78. package/example/src/data/WIREFRAME_DATA.js +0 -11
  79. package/example/src/data/WIREFRAME_DATA_DIALOG.js +0 -65
  80. package/example/src/data/WIREFRAME_DATA_FRAME.js +0 -70
  81. package/example/src/data/WIREFRAME_DATA_MODAL.js +0 -10
  82. package/example/src/index.css +0 -13
  83. package/example/src/index.js +0 -17
  84. package/example/src/js/D3Wireframe.js +0 -111
  85. package/example/src/js/DataBackground.js +0 -23
  86. package/example/src/js/DataFont.js +0 -25
  87. package/example/src/js/DataPosition.js +0 -21
  88. package/example/src/js/DataRectangle.js +0 -20
  89. package/example/src/js/DataStroke.js +0 -23
  90. package/example/src/js/Digestion.js +0 -273
  91. package/example/src/js/Drawer.js +0 -270
  92. package/example/src/js/Element.js +0 -67
  93. package/example/src/js/ElementButton.js +0 -94
  94. package/example/src/js/ElementDialog.js +0 -77
  95. package/example/src/js/ElementFounder.js +0 -84
  96. package/example/src/js/ElementFrame.js +0 -77
  97. package/example/src/js/ElementIcon.js +0 -56
  98. package/example/src/js/ElementImage.js +0 -77
  99. package/example/src/js/ElementLabel.js +0 -51
  100. package/example/src/js/ElementModal.js +0 -65
  101. package/example/src/pages/ExampleGraph.js +0 -39
  102. package/example/src/pages/Explanation.js +0 -43
  103. package/example/src/pages/PageExample.js +0 -41
  104. package/example/src/serviceWorker.js +0 -141
  105. package/example/src/setupTests.js +0 -5
  106. package/index.js +0 -3
  107. package/riot.v3/index.html +0 -21
  108. package/riot.v3/index.js +0 -86
  109. package/riot.v3/scketch.js +0 -96
  110. package/riot.v3/wireframe.js +0 -11
@@ -1,36 +0,0 @@
1
- {
2
- "name": "d3sitemap.example.react",
3
- "version": "0.1.0",
4
- "private": true,
5
- "dependencies": {
6
- "@testing-library/react": "^9.5.0",
7
- "@testing-library/user-event": "^7.2.1",
8
- "@yanqirenshi/assh0le": "0.0.3",
9
- "@yanqirenshi/d3.svg": "0.0.14",
10
- "deepmerge": "^4.2.2",
11
- "react": "^16.13.1",
12
- "react-dom": "^16.13.1",
13
- "react-scripts": "3.4.1"
14
- },
15
- "scripts": {
16
- "start": "react-scripts start",
17
- "build": "react-scripts build",
18
- "test": "react-scripts test",
19
- "eject": "react-scripts eject"
20
- },
21
- "eslintConfig": {
22
- "extends": "react-app"
23
- },
24
- "browserslist": {
25
- "production": [
26
- ">0.2%",
27
- "not dead",
28
- "not op_mini all"
29
- ],
30
- "development": [
31
- "last 1 chrome version",
32
- "last 1 firefox version",
33
- "last 1 safari version"
34
- ]
35
- }
36
- }
Binary file
@@ -1,43 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1" />
7
- <meta name="theme-color" content="#000000" />
8
- <meta
9
- name="description"
10
- content="Web site created using create-react-app"
11
- />
12
- <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13
- <!--
14
- manifest.json provides metadata used when your web app is installed on a
15
- user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16
- -->
17
- <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18
- <!--
19
- Notice the use of %PUBLIC_URL% in the tags above.
20
- It will be replaced with the URL of the `public` folder during the build.
21
- Only files inside the `public` folder can be referenced from the HTML.
22
-
23
- Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24
- work correctly both with client-side routing and a non-root public URL.
25
- Learn how to configure a non-root public URL by running `npm run build`.
26
- -->
27
- <title>React App</title>
28
- </head>
29
- <body>
30
- <noscript>You need to enable JavaScript to run this app.</noscript>
31
- <div id="root"></div>
32
- <!--
33
- This HTML file is a template.
34
- If you open it directly in the browser, you will see an empty page.
35
-
36
- You can add webfonts, meta tags, or analytics to this file.
37
- The build step will place the bundled scripts into the <body> tag.
38
-
39
- To begin the development, run `npm start` or `yarn start`.
40
- To create a production bundle, use `npm run build` or `yarn build`.
41
- -->
42
- </body>
43
- </html>
Binary file
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,3 +0,0 @@
1
- # https://www.robotstxt.org/robotstxt.html
2
- User-agent: *
3
- Disallow:
@@ -1,38 +0,0 @@
1
- .App {
2
- text-align: center;
3
- }
4
-
5
- .App-logo {
6
- height: 40vmin;
7
- pointer-events: none;
8
- }
9
-
10
- @media (prefers-reduced-motion: no-preference) {
11
- .App-logo {
12
- animation: App-logo-spin infinite 20s linear;
13
- }
14
- }
15
-
16
- .App-header {
17
- background-color: #282c34;
18
- min-height: 100vh;
19
- display: flex;
20
- flex-direction: column;
21
- align-items: center;
22
- justify-content: center;
23
- font-size: calc(10px + 2vmin);
24
- color: white;
25
- }
26
-
27
- .App-link {
28
- color: #61dafb;
29
- }
30
-
31
- @keyframes App-logo-spin {
32
- from {
33
- transform: rotate(0deg);
34
- }
35
- to {
36
- transform: rotate(360deg);
37
- }
38
- }
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import './App.css';
3
-
4
- import PageExample from './pages/PageExample';
5
-
6
- function App() {
7
- return (
8
- <div className="App">
9
- <PageExample />
10
- </div>
11
- );
12
- }
13
-
14
- export default App;
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import { render } from '@testing-library/react';
3
- import App from './App';
4
-
5
- test('renders learn react link', () => {
6
- const { getByText } = render(<App />);
7
- const linkElement = getByText(/learn react/i);
8
- expect(linkElement).toBeInTheDocument();
9
- });
@@ -1,11 +0,0 @@
1
- import WIREFRAME_DATA_FRAME from './WIREFRAME_DATA_FRAME';
2
- import WIREFRAME_DATA_MODAL from './WIREFRAME_DATA_MODAL';
3
- import WIREFRAME_DATA_DIALOG from './WIREFRAME_DATA_DIALOG';
4
-
5
- const WIREFRAME_DATA = [
6
- WIREFRAME_DATA_FRAME,
7
- WIREFRAME_DATA_MODAL,
8
- WIREFRAME_DATA_DIALOG,
9
- ];
10
-
11
- export default WIREFRAME_DATA;
@@ -1,65 +0,0 @@
1
- const WIREFRAME_DATA_DIALOG = {
2
- visible: false,
3
- element_type: 'dialog',
4
- rectangle: { w: 400, h: 260 },
5
- position: { x:-200, y:-200, z:0 },
6
- children: [
7
- {
8
- element_type: 'frame',
9
- rectangle: { w: 400, h: 50 },
10
- position: { x:0, y:0, z:0 },
11
- labels: [
12
- {
13
- text: 'DIALOG 01',
14
- position: { x: 20, y: 32 },
15
- font: { size: 24, color: '#7b7c7d', weight: 'bold' },
16
- },
17
- ],
18
- },
19
- {
20
- element_type: 'frame',
21
- rectangle: { w: 400, h: 150 },
22
- position: { x:0, y:50, z:0 },
23
- labels: [
24
- {
25
- text: 'Message ..............................................................',
26
- position: { x: 30, y: 35 },
27
- font: { size: 16, color: '#7b7c7d', weight: 'bold' },
28
- },
29
- {
30
- text: '..............................................................................',
31
- position: { x: 30, y: 60 },
32
- font: { size: 16, color: '#7b7c7d', weight: 'bold' },
33
- },
34
- {
35
- text: '..............................................................................',
36
- position: { x: 30, y: 85 },
37
- font: { size: 16, color: '#7b7c7d', weight: 'bold' },
38
- },
39
- ],
40
- },
41
- {
42
- element_type: 'frame',
43
- rectangle: { w: 400, h: 60 },
44
- position: { x:0, y:200, z:0 },
45
- children: [
46
- {
47
- element_type: 'button',
48
- rectangle: { w: 111, h: 40 },
49
- position: { x:20, y:10, z:0 },
50
- background: '#7b7c7d',
51
- round: 10,
52
- labels: [
53
- {
54
- text: 'BUTTON 01',
55
- position: { x: 15, y: 25 },
56
- font: { size: 16, color: '#7b7c7d' },
57
- },
58
- ],
59
- },
60
- ],
61
- },
62
- ],
63
- };
64
-
65
- export default WIREFRAME_DATA_DIALOG;
@@ -1,70 +0,0 @@
1
- const WIREFRAME_DATA_FRAME = {
2
- element_type: 'frame',
3
- rectangle: { w: 600, h: 800 },
4
- position: { x:-300, y:-400, z:0 },
5
- stroke: {
6
- color: '#afafb0',
7
- width: 1,
8
- },
9
- labels: [
10
- {
11
- text: 'NODE 01',
12
- position: { x: 20, y: 20 },
13
- font: { size: 16, color: '#7b7c7d' },
14
- },
15
- ],
16
- children: [
17
- {
18
- element_type: 'image',
19
- background: { color: '#dcdddd' },
20
- rectangle: { w: 100, h: 100 },
21
- position: { x:100, y:100, z:0 },
22
- stroke: null,
23
- labels: [
24
- {
25
- text: 'NODE 01',
26
- position: { x: 15, y: 55 },
27
- font: { size: 16, color: '#fff', weight: 'bold' },
28
- },
29
- ],
30
- children: [],
31
- },
32
- {
33
- element_type: 'button',
34
- rectangle: { w: 111, h: 50 },
35
- position: { x:100, y:500, z:0 },
36
- background: '#7b7c7d',
37
- round: 10,
38
- labels: [
39
- {
40
- text: 'BUTTON 01',
41
- position: { x: 20, y: 20 },
42
- font: { size: 16, color: '#7b7c7d' },
43
- },
44
- ],
45
- children: [],
46
- },
47
- {
48
- element_type: 'frame',
49
- rectangle: { w: 500, h: 100 },
50
- position: { x:50, y: 650, z:0 },
51
- stroke: {
52
- color: '#afafb0',
53
- width: 1,
54
- },
55
- children: [
56
- {
57
- element_type: 'button',
58
- rectangle: { w: 60, h: 60 },
59
- position: { x:20, y:20, z:0 },
60
- stroke: null,
61
- icons: [{ url: 'http://www.mark-sign.net/download02/data0108/chrome.png' }],
62
- round: 5,
63
- children: [],
64
- },
65
- ]
66
- }
67
- ],
68
- };
69
-
70
- export default WIREFRAME_DATA_FRAME;
@@ -1,10 +0,0 @@
1
- const WIREFRAME_DATA_MODAL = {
2
- visible: false,
3
- element_type: 'modal',
4
- rectangle: { w: 600, h: 800 },
5
- background: { color: '#333333', opacity: 0.6 },
6
- position: { x:-300, y:-400, z:0 },
7
- children: [],
8
- };
9
-
10
- export default WIREFRAME_DATA_MODAL;
@@ -1,13 +0,0 @@
1
- body {
2
- margin: 0;
3
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4
- 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5
- sans-serif;
6
- -webkit-font-smoothing: antialiased;
7
- -moz-osx-font-smoothing: grayscale;
8
- }
9
-
10
- code {
11
- font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12
- monospace;
13
- }
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import ReactDOM from 'react-dom';
3
- import './index.css';
4
- import App from './App';
5
- import * as serviceWorker from './serviceWorker';
6
-
7
- ReactDOM.render(
8
- <React.StrictMode>
9
- <App />
10
- </React.StrictMode>,
11
- document.getElementById('root')
12
- );
13
-
14
- // If you want your app to work offline and load faster, you can change
15
- // unregister() to register() below. Note this comes with some pitfalls.
16
- // Learn more about service workers: https://bit.ly/CRA-PWA
17
- serviceWorker.unregister();
@@ -1,111 +0,0 @@
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,23 +0,0 @@
1
- class DataBackground {
2
- template () {
3
- return {
4
- color: '#fff',
5
- opacity: 1.0,
6
- };
7
- }
8
- build (data) {
9
- let out = this.template();
10
-
11
- if (!data)
12
- return out;
13
-
14
- if (data.color) out.color = data.color;
15
- if (data.opacity) out.opacity = data.opacity;
16
-
17
- return out;
18
- };
19
- }
20
-
21
- const BACKGROUND = new DataBackground();
22
-
23
- export default BACKGROUND;
@@ -1,25 +0,0 @@
1
- class DataFont {
2
- template () {
3
- return {
4
- size: 16,
5
- color: '#fff',
6
- weight: 'normal',
7
- };
8
- }
9
- build (data) {
10
- let out = this.template();
11
-
12
- if (!data)
13
- return out;
14
-
15
- if (data.size) out.size = data.size;
16
- if (data.color) out.color = data.color;
17
- if (data.weight) out.weight = data.weight;
18
-
19
- return out;
20
- };
21
- }
22
-
23
- const FONT = new DataFont();
24
-
25
- export default FONT;
@@ -1,21 +0,0 @@
1
- class DataPosition {
2
- template () {
3
- return { x:0, y:0, z:0 };
4
- }
5
- build (data) {
6
- let out = this.template();
7
-
8
- if (!data)
9
- return out;
10
-
11
- if (data.x) out.x = data.x;
12
- if (data.y) out.y = data.y;
13
- if (data.z) out.z = data.z;
14
-
15
- return out;
16
- };
17
- }
18
-
19
- const POSITION = new DataPosition();
20
-
21
- export default POSITION;
@@ -1,20 +0,0 @@
1
- class DataRectangle {
2
- template () {
3
- return { w: 0, h: 0 };
4
- }
5
- build (data) {
6
- let out = this.template();
7
-
8
- if (!data)
9
- return out;
10
-
11
- if (data.w) out.w = data.w;
12
- if (data.h) out.h = data.h;
13
-
14
- return out;
15
- };
16
- }
17
-
18
- const RECTANGLE = new DataRectangle();
19
-
20
- export default RECTANGLE;
@@ -1,23 +0,0 @@
1
- class DataStroke {
2
- template () {
3
- return {
4
- color: '#afafb0',
5
- width: 1,
6
- };
7
- }
8
- build (data) {
9
- let out = this.template();
10
-
11
- if (!data)
12
- return null;
13
-
14
- if (data.color) out.color = data.color;
15
- if (data.width) out.width = data.width;
16
-
17
- return out;
18
- };
19
- }
20
-
21
- const STROKE = new DataStroke();
22
-
23
- export default STROKE;