Skip to content

Commit 0ac1c14

Browse files
committed
initial release
1 parent 00bead4 commit 0ac1c14

13 files changed

Lines changed: 12134 additions & 73 deletions

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.DS_Store
22
node_modules
3-
/dist
43

54
# local env files
65
.env.local

dist/construct-devtool.js

Lines changed: 11894 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/construct-devtool.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/construct-devtool.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/construct-devtool.min.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/demo.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<meta charset="utf-8">
2+
<title>construct-devtool demo</title>
3+
<script src="https://unpkg.com/vue"></script>
4+
<script src="./construct-devtool.js"></script>
5+
6+
7+
<construct-devtool></construct-devtool>
8+

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@
66
"serve": "vue-cli-service serve",
77
"build": "vue-cli-service build",
88
"lint": "vue-cli-service lint",
9-
"wc": "vue-cli-service build --target wc --name construct-devtool ./src/components/DevTool.vue"
9+
"wc": "vue-cli-service build --target wc --name construct-devtool ./src/App.vue"
1010
},
1111
"dependencies": {
12+
"@fortawesome/fontawesome-free": "^5.7.1",
13+
"@fortawesome/fontawesome-svg-core": "^1.2.14",
14+
"@fortawesome/free-brands-svg-icons": "^5.7.1",
15+
"@fortawesome/free-solid-svg-icons": "^5.7.1",
16+
"@fortawesome/vue-fontawesome": "^0.1.5",
1217
"electron": "^4.0.4",
1318
"vue": "^2.5.22"
1419
},

public/favicon.ico

-1.12 KB
Binary file not shown.

public/index.html

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/App.vue

Lines changed: 186 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,201 @@
11
<template>
22
<div id="app">
3-
<DevTool/>
3+
<div id="devtool">
4+
<div class="bubble" @click="showBS = true">
5+
<font-awesome-icon class="icon" :icon="faCog"/>
6+
</div>
7+
<div class="overlay" :class="{ active: showBS }">
8+
</div>
9+
<div class="modal" :class="{ active: showBS }">
10+
<div class="modal-content">
11+
<font-awesome-icon class="icon close" @click="showBS = false" :icon="faTimes"/>
12+
13+
<div class="item" @click="reloadPage">
14+
<font-awesome-icon class="icon" :icon="faSync"/>
15+
<span>Reload</span>
16+
</div>
17+
18+
<div class="item" @click="openDevTools">
19+
<font-awesome-icon class="icon" :icon="faDev"/>
20+
<span>DevTools</span>
21+
</div>
22+
23+
</div>
24+
</div>
25+
</div>
426
</div>
527
</template>
628

729
<script>
8-
import DevTool from './components/DevTool.vue';
30+
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
31+
import { config, dom } from '@fortawesome/fontawesome-svg-core';
32+
import {
33+
faSync,
34+
faCog,
35+
faTimes,
36+
} from '@fortawesome/free-solid-svg-icons';
37+
import { faDev } from '@fortawesome/free-brands-svg-icons';
38+
39+
config.autoAddCss = false;
940
1041
export default {
11-
name: 'app',
42+
name: 'DevTool',
1243
components: {
13-
DevTool,
44+
FontAwesomeIcon,
45+
},
46+
data() {
47+
return {
48+
showBS: false,
49+
};
50+
},
51+
computed: {
52+
faSync() {
53+
return faSync;
54+
},
55+
faCog() {
56+
return faCog;
57+
},
58+
faTimes() {
59+
return faTimes;
60+
},
61+
faDev() {
62+
return faDev;
63+
},
64+
},
65+
methods: {
66+
reloadPage() {
67+
const event = new Event('reloadPage');
68+
document.dispatchEvent(event);
69+
},
70+
openDevTools() {
71+
const event = new Event('openDevTools');
72+
document.dispatchEvent(event);
73+
},
74+
},
75+
mounted() {
76+
// This will only work on your root Vue component since it's using $parent
77+
const { shadowRoot } = this.$parent.$options;
78+
const id = 'fa-styles';
79+
80+
if (!shadowRoot.getElementById(`${id}`)) {
81+
const faStyles = document.createElement('style');
82+
faStyles.setAttribute('id', id);
83+
faStyles.textContent = dom.css();
84+
shadowRoot.appendChild(faStyles);
85+
}
1486
},
1587
};
1688
</script>
1789

1890
<style>
19-
#app {
20-
font-family: 'Avenir', Helvetica, Arial, sans-serif;
21-
-webkit-font-smoothing: antialiased;
22-
-moz-osx-font-smoothing: grayscale;
23-
text-align: center;
24-
color: #2c3e50;
25-
margin-top: 60px;
26-
}
91+
#devtool {
92+
display: flex;
93+
justify-content: center;
94+
95+
font-family: 'Avenir', Helvetica, Arial, sans-serif;
96+
-webkit-font-smoothing: antialiased;
97+
-moz-osx-font-smoothing: grayscale;
98+
text-align: center;
99+
color: #2c3e50;
100+
margin-top: 60px;
101+
}
102+
103+
.bubble {
104+
position: fixed;
105+
right: 5px;
106+
bottom: 5px;
107+
108+
justify-content: center;
109+
110+
background-color: #005fff;
111+
height: 50px;
112+
width: 50px;
113+
line-height: 50px;
114+
text-align: center;
115+
border-radius: 25px;
116+
color: #fff;
117+
cursor: pointer;
118+
}
119+
120+
.overlay {
121+
transition: background-color .25s;
122+
background-color: rgba(0, 0, 0, 0.0);
123+
position: fixed;
124+
top: 0;
125+
left: 0;
126+
height: 100%;
127+
width: 100%;
128+
pointer-events: none;
129+
}
130+
131+
.overlay.active {
132+
background-color: rgba(0, 0, 0, 0.7);
133+
}
134+
135+
.modal {
136+
transition: all .25s;
137+
background-color: #fff;
138+
position: fixed;
139+
bottom: -150px;
140+
height: 100px;
141+
width: 80%;
142+
143+
/* material card */
144+
border-radius: 2px 2px 0 0;
145+
padding: 1rem;
146+
}
147+
148+
.modal.active {
149+
bottom: 0;
150+
box-shadow: 0 19px 38px rgba(0, 0, 0, 0.30), 0 15px 12px rgba(0, 0, 0, 0.22);
151+
}
152+
153+
.close {
154+
position: absolute;
155+
right: 5px;
156+
top: 2px;
157+
background-color: transparent;
158+
border: none;
159+
width: 16px;
160+
cursor: pointer;
161+
outline: none;
162+
}
163+
164+
.modal-content {
165+
display: flex;
166+
justify-content: center;
167+
align-items: center;
168+
height: 100%;
169+
}
170+
171+
.item {
172+
display: flex;
173+
justify-content: center;
174+
align-items: center;
175+
flex-direction: column;
176+
177+
border-radius: 2px;
178+
padding: 10px;
179+
margin: 15px;
180+
width: 100px;
181+
height: 50px;
182+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
183+
184+
cursor: pointer;
185+
186+
transition: background-color .25s;
187+
}
188+
189+
.item:hover {
190+
background-color: rgba(0, 0, 0, 0.12);
191+
}
192+
193+
.icon {
194+
width: 16px;
195+
}
196+
197+
.item > .icon {
198+
width: 16px;
199+
margin: 7px;
200+
}
27201
</style>

0 commit comments

Comments
 (0)