Skip to content

Commit 6fd07f2

Browse files
iamdanfoxbulldozer-bot[bot]
authored andcommitted
HTML debugging view (#73)
A HTML debugging view can be generated to help iterate on the formatter logic
1 parent 38936ae commit 6fd07f2

37 files changed

Lines changed: 12188 additions & 59 deletions

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,5 @@ generated/
5555

5656
# Blueprint theme
5757
__init__.pyc
58+
59+
node_modules/

‎debugger/.gitignore‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*
24+
public/*.js

‎debugger/README.md‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
2+
3+
## Available Scripts
4+
5+
In the project directory, you can run:
6+
7+
### `yarn start`
8+
9+
Runs the app in the development mode.<br />
10+
Open <code>localhost:3000</code> to view it in the browser.
11+
12+
The page will reload if you make edits.<br />
13+
You will also see any lint errors in the console.
14+
15+
### `yarn test`
16+
17+
Launches the test runner in the interactive watch mode.<br />
18+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
19+
20+
### `yarn build`
21+
22+
Builds the app for production to the `build` folder.<br />
23+
It correctly bundles React in production mode and optimizes the build for the best performance.
24+
25+
The build is minified and the filenames include the hashes.<br />
26+
Your app is ready to be deployed!
27+
28+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
29+
30+
### `yarn eject`
31+
32+
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
33+
34+
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
35+
36+
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
37+
38+
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
39+
40+
## Learn More
41+
42+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
43+
44+
To learn React, check out the [React documentation](https://reactjs.org/).

‎debugger/package.json‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "debugger",
3+
"version": "0.1.0",
4+
"private": true,
5+
"dependencies": {
6+
"@types/jest": "24.0.23",
7+
"@types/node": "12.12.7",
8+
"@types/react": "16.9.11",
9+
"@types/react-dom": "16.9.4",
10+
"react": "^16.11.0",
11+
"react-dom": "^16.11.0",
12+
"react-scripts": "3.2.0",
13+
"typescript": "3.7.2",
14+
"@blueprintjs/core": "^3.20.0",
15+
"react-treebeard": "^3.2.4"
16+
},
17+
"scripts": {
18+
"start": "react-scripts start",
19+
"build": "react-scripts build",
20+
"test": "react-scripts test",
21+
"eject": "react-scripts eject"
22+
},
23+
"eslintConfig": {
24+
"extends": "react-app"
25+
},
26+
"browserslist": {
27+
"production": [
28+
">0.2%",
29+
"not dead",
30+
"not op_mini all"
31+
],
32+
"development": [
33+
"last 1 chrome version",
34+
"last 1 firefox version",
35+
"last 1 safari version"
36+
]
37+
}
38+
}

‎debugger/public/index.html‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1" />
6+
<meta name="theme-color" content="#000000" />
7+
<title>React App</title>
8+
<script src="output.js"></script>
9+
</head>
10+
<body>
11+
<noscript>You need to enable JavaScript to run this app.</noscript>
12+
<div id="root"></div>
13+
<!--
14+
This HTML file is a template.
15+
If you open it directly in the browser, you will see an empty page.
16+
17+
You can add webfonts, meta tags, or analytics to this file.
18+
The build step will place the bundled scripts into the <body> tag.
19+
20+
To begin the development, run `npm start` or `yarn start`.
21+
To create a production bundle, use `npm run build` or `yarn build`.
22+
-->
23+
</body>
24+
</html>

‎debugger/src/App.css‎

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
.App code {
2+
white-space: pre; font-family: monospace; line-height: 1em;
3+
}
4+
5+
/* TreeDoc */
6+
7+
.TreeDoc .doc-level {
8+
margin-left: 20px;
9+
}
10+
11+
.TreeDoc {
12+
width: 1600px;
13+
}
14+
15+
.TreeDoc .doc-level {
16+
outline: 1px dotted lightgrey;
17+
}
18+
19+
.TreeDoc .doc-level:hover {
20+
outline: 1px solid grey;
21+
}
22+
23+
.TreeDoc .doc-level:hover > .highlight {
24+
background-color: hsl(120, 61%, 80%);
25+
}
26+
27+
.TreeDoc .doc-break {
28+
background: hsl(0, 60%, 90%);
29+
}
30+
31+
/** these are breaks being referenced by a conditional indent when you hover over it */
32+
.TreeDoc .doc-break.referenced {
33+
background: hsl(60, 100%, 78%);
34+
}
35+
36+
.TreeDoc .banner {
37+
background-color: rgba(138, 155, 168, 0.15);
38+
}
39+
40+
/* Collapse empty level banner */
41+
.TreeDoc .banner:empty {
42+
display: none;
43+
}
44+
45+
/* DecisionTree */
46+
47+
.TreeAndDoc {
48+
display: flex;
49+
flex-direction: row;
50+
width: 100%;
51+
height: 1000px;
52+
max-height: 1000px;
53+
}
54+
55+
.TreeAndDoc > * {
56+
flex-grow: 1;
57+
flex-basis: 50%;
58+
/** necessary to prevent overflow */
59+
max-width: 50%;
60+
}
61+
62+
.TreeAndDoc .DecisionTree {
63+
margin: 10px 0;
64+
overflow: scroll;
65+
}
66+
67+
/**
68+
* Since the Treebeard tree has a different background, we want to make sure it always takes up the space or else
69+
* it looks ugly.
70+
*/
71+
.TreeAndDoc .DecisionTree > ul {
72+
min-height: 100%;
73+
}
74+
75+
.TreeAndDoc .InlineDocs {
76+
display: flex;
77+
flex-direction: column;
78+
overflow: scroll;
79+
}
80+
81+
.TreeAndDoc .InlineDocs .InlineDoc {
82+
flex-grow: 1;
83+
flex-basis: auto;
84+
}
85+
86+
.HighlightInlineDoc {
87+
flex-grow: 0;
88+
flex-shrink: 1;
89+
}
90+
91+
/* InlineDoc */
92+
93+
.InlineDoc .doc-level.referenced {
94+
border-radius: 2px;
95+
background-color: hsla(56, 100%, 51%, 0.4);
96+
}
97+
98+
/** Inside a referenced level, highlight direct children very specifically. */
99+
.InlineDoc .doc-level.referenced > .highlight {
100+
background-color: hsl(120, 61%, 80%);
101+
}
102+
103+
/** Inside a referenced level, highlight nested inner levels with progressively more red to indicate depth. */
104+
.InlineDoc .doc-level.referenced .doc-level {
105+
background: hsla(0, 40%, 50%, 0.15);
106+
/*outline: 2px solid hsla(0, 40%, 0%, 0.3);*/
107+
}
108+
109+
/* Ops */
110+
111+
.Ops span.token:hover {
112+
outline: 1px solid black;
113+
}
114+
115+
.Ops span.token:hover span.tokenBody {
116+
text-decoration: underline;
117+
}
118+
119+
.Ops span.open-op, .Ops span.close-op, .Ops span.break {
120+
position: relative;
121+
width: 3px;
122+
height: 1em;
123+
display: inline-block;
124+
margin: 0 1px;
125+
}
126+
127+
.Ops span.open-op {
128+
background: green;
129+
}
130+
131+
.Ops span.close-op {
132+
background: red;
133+
}
134+
135+
.Ops span.break.FillMode-UNIFIED {
136+
background: #777;
137+
}
138+
139+
.Ops span.break.FillMode-INDEPENDENT {
140+
background: #333;
141+
}
142+
143+
.Ops span.break.FillMode-FORCED {
144+
background: #000;
145+
width: 5px;
146+
}
147+
148+
.Ops span.break.conditional {
149+
height: 0.4em;
150+
width: 0.4em;
151+
vertical-align: middle;
152+
}

‎debugger/src/App.test.tsx‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import App from './App';
4+
5+
it('renders without crashing', () => {
6+
const div = document.createElement('div');
7+
ReactDOM.render(<App />, div);
8+
ReactDOM.unmountComponentAtNode(div);
9+
});

0 commit comments

Comments
 (0)