tasmota-esp-web-tools 9.0.2 → 10.0.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/dist/components/ewt-littlefs-manager.d.ts +43 -0
- package/dist/components/ewt-littlefs-manager.js +819 -0
- package/dist/flash.js +4 -30
- package/dist/install-dialog.d.ts +11 -0
- package/dist/install-dialog.js +336 -0
- package/dist/partition.d.ts +26 -0
- package/dist/partition.js +129 -0
- package/dist/util/esp32s2-reconnect.d.ts +22 -0
- package/dist/util/esp32s2-reconnect.js +45 -0
- package/dist/util/partition.d.ts +4 -0
- package/dist/util/partition.js +59 -0
- package/{js/modules/index-BK6drzlv.js → dist/web/index-t2Vsxqjj.js} +1 -1
- package/dist/web/install-button.js +1 -1
- package/dist/web/{install-dialog-Xo7JovVA.js → install-dialog-CVebVk1R.js} +515 -36
- package/dist/web/{styles-ntwzvT31.js → styles-CWxbqh-J.js} +1 -1
- package/dist/web/wasm/littlefs/index.d.ts +91 -0
- package/dist/web/wasm/littlefs/index.js +611 -0
- package/dist/web/wasm/littlefs/littlefs.js +505 -0
- package/dist/web/wasm/littlefs/littlefs.wasm +0 -0
- package/{dist/web/index-BK6drzlv.js → js/modules/index-t2Vsxqjj.js} +1 -1
- package/js/modules/install-button.js +1 -1
- package/js/modules/{install-dialog-Xo7JovVA.js → install-dialog-CVebVk1R.js} +515 -36
- package/js/modules/{styles-ntwzvT31.js → styles-CWxbqh-J.js} +1 -1
- package/js/modules/wasm/littlefs/index.d.ts +91 -0
- package/js/modules/wasm/littlefs/index.js +611 -0
- package/js/modules/wasm/littlefs/littlefs.js +505 -0
- package/js/modules/wasm/littlefs/littlefs.wasm +0 -0
- package/package.json +3 -2
- package/.devcontainer/Dockerfile +0 -16
- package/.devcontainer/devcontainer.json +0 -21
- package/.github/dependabot.yml +0 -10
- package/.github/workflows/build_upload.yml +0 -78
- package/.github/workflows/ci.yml +0 -24
- package/.prettierignore +0 -1
- package/BAUD_RATE_CONFIGURATION.md +0 -291
- package/BAUD_RATE_IMPROVEMENT.md +0 -195
- package/CHANGELOG_IMPROVEMENTS.md +0 -246
- package/ESP32_S2_USB_RECONNECT.md +0 -108
- package/FINAL_SUMMARY.md +0 -153
- package/example-baud-rate.html +0 -276
- package/manifest-example-p4-variants.json +0 -61
- package/rollup.config.mjs +0 -36
- package/script/build +0 -8
- package/script/develop +0 -17
- package/src/components/ewt-button.ts +0 -25
- package/src/components/ewt-checkbox.ts +0 -14
- package/src/components/ewt-circular-progress.ts +0 -14
- package/src/components/ewt-console.ts +0 -166
- package/src/components/ewt-dialog.ts +0 -22
- package/src/components/ewt-formfield.ts +0 -14
- package/src/components/ewt-icon-button.ts +0 -14
- package/src/components/ewt-list-item.ts +0 -14
- package/src/components/ewt-select.ts +0 -23
- package/src/components/ewt-textfield.ts +0 -23
- package/src/components/svg.ts +0 -27
- package/src/connect.ts +0 -55
- package/src/const.ts +0 -122
- package/src/flash.ts +0 -361
- package/src/install-button.ts +0 -126
- package/src/install-dialog.ts +0 -1114
- package/src/no-port-picked/index.ts +0 -10
- package/src/no-port-picked/no-port-picked-dialog.ts +0 -167
- package/src/pages/ewt-page-message.ts +0 -39
- package/src/pages/ewt-page-progress.ts +0 -44
- package/src/styles.ts +0 -34
- package/src/util/chip-family-name.ts +0 -46
- package/src/util/console-color.ts +0 -284
- package/src/util/file-download.ts +0 -17
- package/src/util/fire-event.ts +0 -20
- package/src/util/line-break-transformer.ts +0 -20
- package/src/util/manifest.ts +0 -18
- package/src/util/sleep.ts +0 -2
- package/static/logos/2smart.png +0 -0
- package/static/logos/canairio.png +0 -0
- package/static/logos/clockwise.png +0 -0
- package/static/logos/espeasy.png +0 -0
- package/static/logos/esphome.svg +0 -1
- package/static/logos/luciferin_logo.png +0 -0
- package/static/logos/squeezelite-esp32.png +0 -0
- package/static/logos/tasmota.svg +0 -1
- package/static/logos/wled.png +0 -0
- package/static/screenshots/dashboard.png +0 -0
- package/static/screenshots/logs.png +0 -0
- package/static/social.png +0 -0
- package/tsconfig.json +0 -20
package/example-baud-rate.html
DELETED
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<title>ESP Web Tools - Flash Speed Configuration</title>
|
|
6
|
-
<meta name="viewport" content="width=device-width" />
|
|
7
|
-
<script type="module" src="https://unpkg.com/esp-web-tools@latest/dist/web/install-button.js?module"></script>
|
|
8
|
-
<style>
|
|
9
|
-
body {
|
|
10
|
-
font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, sans-serif;
|
|
11
|
-
padding: 0;
|
|
12
|
-
margin: 0;
|
|
13
|
-
background: #f5f5f5;
|
|
14
|
-
}
|
|
15
|
-
.header {
|
|
16
|
-
background: #03a9f4;
|
|
17
|
-
color: white;
|
|
18
|
-
padding: 15px 20px;
|
|
19
|
-
display: flex;
|
|
20
|
-
justify-content: space-between;
|
|
21
|
-
align-items: center;
|
|
22
|
-
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
23
|
-
}
|
|
24
|
-
.header h1 {
|
|
25
|
-
margin: 0;
|
|
26
|
-
font-size: 24px;
|
|
27
|
-
font-weight: 500;
|
|
28
|
-
}
|
|
29
|
-
.header-controls {
|
|
30
|
-
display: flex;
|
|
31
|
-
gap: 10px;
|
|
32
|
-
align-items: center;
|
|
33
|
-
}
|
|
34
|
-
.header-controls label {
|
|
35
|
-
font-size: 14px;
|
|
36
|
-
margin-right: 5px;
|
|
37
|
-
}
|
|
38
|
-
select {
|
|
39
|
-
padding: 8px 12px;
|
|
40
|
-
border: none;
|
|
41
|
-
border-radius: 4px;
|
|
42
|
-
background: white;
|
|
43
|
-
font-size: 14px;
|
|
44
|
-
cursor: pointer;
|
|
45
|
-
min-width: 180px;
|
|
46
|
-
}
|
|
47
|
-
.container {
|
|
48
|
-
max-width: 1000px;
|
|
49
|
-
margin: 0 auto;
|
|
50
|
-
padding: 20px;
|
|
51
|
-
}
|
|
52
|
-
.info-box {
|
|
53
|
-
background: white;
|
|
54
|
-
padding: 20px;
|
|
55
|
-
border-radius: 8px;
|
|
56
|
-
margin-bottom: 20px;
|
|
57
|
-
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
58
|
-
}
|
|
59
|
-
.info-box h2 {
|
|
60
|
-
margin-top: 0;
|
|
61
|
-
color: #03a9f4;
|
|
62
|
-
}
|
|
63
|
-
.install-section {
|
|
64
|
-
background: white;
|
|
65
|
-
padding: 30px;
|
|
66
|
-
border-radius: 8px;
|
|
67
|
-
text-align: center;
|
|
68
|
-
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
69
|
-
margin-bottom: 20px;
|
|
70
|
-
}
|
|
71
|
-
.install-section h2 {
|
|
72
|
-
margin-top: 0;
|
|
73
|
-
color: #333;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
esp-web-install-button {
|
|
77
|
-
margin: 20px 0;
|
|
78
|
-
}
|
|
79
|
-
table {
|
|
80
|
-
width: 100%;
|
|
81
|
-
border-collapse: collapse;
|
|
82
|
-
margin: 20px 0;
|
|
83
|
-
}
|
|
84
|
-
th, td {
|
|
85
|
-
padding: 12px;
|
|
86
|
-
text-align: left;
|
|
87
|
-
border-bottom: 1px solid #ddd;
|
|
88
|
-
}
|
|
89
|
-
th {
|
|
90
|
-
background: #f5f5f5;
|
|
91
|
-
font-weight: 600;
|
|
92
|
-
color: #333;
|
|
93
|
-
}
|
|
94
|
-
tr:hover {
|
|
95
|
-
background: #f9f9f9;
|
|
96
|
-
}
|
|
97
|
-
.note {
|
|
98
|
-
background: #fff3cd;
|
|
99
|
-
border-left: 4px solid #ffc107;
|
|
100
|
-
padding: 15px;
|
|
101
|
-
margin: 20px 0;
|
|
102
|
-
border-radius: 4px;
|
|
103
|
-
}
|
|
104
|
-
.note strong {
|
|
105
|
-
color: #856404;
|
|
106
|
-
}
|
|
107
|
-
</style>
|
|
108
|
-
</head>
|
|
109
|
-
<body>
|
|
110
|
-
<div class="header">
|
|
111
|
-
<h1>ESP Web Tools - Flash Speed Configuration</h1>
|
|
112
|
-
<div class="header-controls">
|
|
113
|
-
<label for="baudRate">Flash Speed:</label>
|
|
114
|
-
<select id="baudRate">
|
|
115
|
-
<option value="">115200 Baud (Default)</option>
|
|
116
|
-
<option value="230400">230400 Baud</option>
|
|
117
|
-
<option value="460800">460800 Baud</option>
|
|
118
|
-
<option value="921600">921600 Baud</option>
|
|
119
|
-
<option value="1500000">1500000 Baud</option>
|
|
120
|
-
<option value="2000000" selected>2000000 Baud (Recommended)</option>
|
|
121
|
-
</select>
|
|
122
|
-
</div>
|
|
123
|
-
</div>
|
|
124
|
-
|
|
125
|
-
<div class="container">
|
|
126
|
-
<div class="info-box">
|
|
127
|
-
<h2>About Flash Speed</h2>
|
|
128
|
-
<p>
|
|
129
|
-
The flash speed (baud rate) determines how fast firmware is written to your ESP device.
|
|
130
|
-
Higher speeds are faster but require compatible USB-Serial chips.
|
|
131
|
-
</p>
|
|
132
|
-
<p>
|
|
133
|
-
<strong>Default (115200 Baud):</strong> Maximum compatibility, works with all chips.<br>
|
|
134
|
-
<strong>Recommended (2000000 Baud):</strong> ~17x faster, works with modern USB-Serial chips.
|
|
135
|
-
</p>
|
|
136
|
-
</div>
|
|
137
|
-
|
|
138
|
-
<div class="install-section">
|
|
139
|
-
<h2>Install Firmware</h2>
|
|
140
|
-
<esp-web-install-button
|
|
141
|
-
id="installButton"
|
|
142
|
-
manifest="manifest.json"
|
|
143
|
-
baud-rate="2000000">
|
|
144
|
-
<button slot="activate" style="
|
|
145
|
-
padding: 12px 32px;
|
|
146
|
-
font-size: 16px;
|
|
147
|
-
background: #03a9f4;
|
|
148
|
-
color: white;
|
|
149
|
-
border: none;
|
|
150
|
-
border-radius: 4px;
|
|
151
|
-
cursor: pointer;
|
|
152
|
-
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
|
|
153
|
-
">Install Firmware</button>
|
|
154
|
-
</esp-web-install-button>
|
|
155
|
-
</div>
|
|
156
|
-
|
|
157
|
-
<div class="info-box">
|
|
158
|
-
<h2>Performance Comparison</h2>
|
|
159
|
-
<table>
|
|
160
|
-
<thead>
|
|
161
|
-
<tr>
|
|
162
|
-
<th>Baud Rate</th>
|
|
163
|
-
<th>Speed</th>
|
|
164
|
-
<th>3 MB Firmware</th>
|
|
165
|
-
<th>Compatibility</th>
|
|
166
|
-
</tr>
|
|
167
|
-
</thead>
|
|
168
|
-
<tbody>
|
|
169
|
-
<tr>
|
|
170
|
-
<td>115200 (Default)</td>
|
|
171
|
-
<td>~11 KB/s</td>
|
|
172
|
-
<td>~4.5 minutes</td>
|
|
173
|
-
<td>✅ All chips</td>
|
|
174
|
-
</tr>
|
|
175
|
-
<tr>
|
|
176
|
-
<td>230400</td>
|
|
177
|
-
<td>~22 KB/s</td>
|
|
178
|
-
<td>~2.3 minutes</td>
|
|
179
|
-
<td>✅ Very compatible</td>
|
|
180
|
-
</tr>
|
|
181
|
-
<tr>
|
|
182
|
-
<td>460800</td>
|
|
183
|
-
<td>~44 KB/s</td>
|
|
184
|
-
<td>~70 seconds</td>
|
|
185
|
-
<td>✅ Almost all</td>
|
|
186
|
-
</tr>
|
|
187
|
-
<tr>
|
|
188
|
-
<td>921600</td>
|
|
189
|
-
<td>~88 KB/s</td>
|
|
190
|
-
<td>~35 seconds</td>
|
|
191
|
-
<td>✅ Most modern</td>
|
|
192
|
-
</tr>
|
|
193
|
-
<tr>
|
|
194
|
-
<td>1500000</td>
|
|
195
|
-
<td>~143 KB/s</td>
|
|
196
|
-
<td>~21 seconds</td>
|
|
197
|
-
<td>✅ Modern chips</td>
|
|
198
|
-
</tr>
|
|
199
|
-
<tr style="background: #e8f5e9;">
|
|
200
|
-
<td><strong>2000000 (Recommended)</strong></td>
|
|
201
|
-
<td><strong>~200 KB/s</strong></td>
|
|
202
|
-
<td><strong>~15 seconds</strong></td>
|
|
203
|
-
<td>✅ Modern chips</td>
|
|
204
|
-
</tr>
|
|
205
|
-
</tbody>
|
|
206
|
-
</table>
|
|
207
|
-
</div>
|
|
208
|
-
|
|
209
|
-
<div class="info-box">
|
|
210
|
-
<h2>USB-Serial Chip Compatibility</h2>
|
|
211
|
-
<table>
|
|
212
|
-
<thead>
|
|
213
|
-
<tr>
|
|
214
|
-
<th>Chip</th>
|
|
215
|
-
<th>Max Baud Rate</th>
|
|
216
|
-
<th>Notes</th>
|
|
217
|
-
</tr>
|
|
218
|
-
</thead>
|
|
219
|
-
<tbody>
|
|
220
|
-
<tr>
|
|
221
|
-
<td>CP2102N</td>
|
|
222
|
-
<td>2000000</td>
|
|
223
|
-
<td>✅ Newer version, full speed</td>
|
|
224
|
-
</tr>
|
|
225
|
-
<tr>
|
|
226
|
-
<td>CP2104</td>
|
|
227
|
-
<td>2000000</td>
|
|
228
|
-
<td>✅ Full speed support</td>
|
|
229
|
-
</tr>
|
|
230
|
-
<tr>
|
|
231
|
-
<td>CH340C/G/E</td>
|
|
232
|
-
<td>2000000</td>
|
|
233
|
-
<td>✅ Newer versions support full speed</td>
|
|
234
|
-
</tr>
|
|
235
|
-
<tr>
|
|
236
|
-
<td>FT232H</td>
|
|
237
|
-
<td>2000000</td>
|
|
238
|
-
<td>✅ Full speed support</td>
|
|
239
|
-
</tr>
|
|
240
|
-
<tr>
|
|
241
|
-
<td>Native USB (ESP32-C3/S3/C6)</td>
|
|
242
|
-
<td>2000000</td>
|
|
243
|
-
<td>✅ Built-in USB, full speed</td>
|
|
244
|
-
</tr>
|
|
245
|
-
<tr>
|
|
246
|
-
<td>CP2102 (old)</td>
|
|
247
|
-
<td>921600</td>
|
|
248
|
-
<td>⚠️ Older version, limited speed</td>
|
|
249
|
-
</tr>
|
|
250
|
-
</tbody>
|
|
251
|
-
</table>
|
|
252
|
-
</div>
|
|
253
|
-
|
|
254
|
-
<div class="note">
|
|
255
|
-
<strong>Note:</strong> If you experience connection issues or failed flashing, try selecting a lower baud rate from the dropdown above.
|
|
256
|
-
The default 115200 baud works with all devices but is slower.
|
|
257
|
-
</div>
|
|
258
|
-
</div>
|
|
259
|
-
|
|
260
|
-
<script>
|
|
261
|
-
const baudRateSelect = document.getElementById('baudRate');
|
|
262
|
-
const installButton = document.getElementById('installButton');
|
|
263
|
-
|
|
264
|
-
baudRateSelect.addEventListener('change', function() {
|
|
265
|
-
const selectedRate = this.value;
|
|
266
|
-
|
|
267
|
-
// Update install button
|
|
268
|
-
if (selectedRate === '') {
|
|
269
|
-
installButton.removeAttribute('baud-rate');
|
|
270
|
-
} else {
|
|
271
|
-
installButton.setAttribute('baud-rate', selectedRate);
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
</script>
|
|
275
|
-
</body>
|
|
276
|
-
</html>
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ESP32-P4 Firmware Example",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"home_assistant_domain": "example",
|
|
5
|
-
"new_install_prompt_erase": true,
|
|
6
|
-
"builds": [
|
|
7
|
-
{
|
|
8
|
-
"chipFamily": "ESP32-P4",
|
|
9
|
-
"chipVariant": "rev0",
|
|
10
|
-
"parts": [
|
|
11
|
-
{
|
|
12
|
-
"path": "bootloader_p4_rev0.bin",
|
|
13
|
-
"offset": 0
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"path": "partition-table.bin",
|
|
17
|
-
"offset": 32768
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"path": "firmware_p4_rev0.bin",
|
|
21
|
-
"offset": 65536
|
|
22
|
-
}
|
|
23
|
-
]
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"chipFamily": "ESP32-P4",
|
|
27
|
-
"chipVariant": "rev300",
|
|
28
|
-
"parts": [
|
|
29
|
-
{
|
|
30
|
-
"path": "bootloader_p4_rev300.bin",
|
|
31
|
-
"offset": 0
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"path": "partition-table.bin",
|
|
35
|
-
"offset": 32768
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"path": "firmware_p4_rev300.bin",
|
|
39
|
-
"offset": 65536
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"chipFamily": "ESP32-S3",
|
|
45
|
-
"parts": [
|
|
46
|
-
{
|
|
47
|
-
"path": "bootloader_s3.bin",
|
|
48
|
-
"offset": 0
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"path": "partition-table.bin",
|
|
52
|
-
"offset": 32768
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
"path": "firmware_s3.bin",
|
|
56
|
-
"offset": 65536
|
|
57
|
-
}
|
|
58
|
-
]
|
|
59
|
-
}
|
|
60
|
-
]
|
|
61
|
-
}
|
package/rollup.config.mjs
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import nodeResolve from "@rollup/plugin-node-resolve";
|
|
2
|
-
import json from "@rollup/plugin-json";
|
|
3
|
-
import terser from "@rollup/plugin-terser";
|
|
4
|
-
import babel from "@rollup/plugin-babel";
|
|
5
|
-
|
|
6
|
-
const config = {
|
|
7
|
-
input: "dist/install-button.js",
|
|
8
|
-
output: {
|
|
9
|
-
dir: "dist/web",
|
|
10
|
-
format: "module",
|
|
11
|
-
},
|
|
12
|
-
external: ["https://www.improv-wifi.com/sdk-js/launch-button.js"],
|
|
13
|
-
preserveEntrySignatures: false,
|
|
14
|
-
plugins: [
|
|
15
|
-
nodeResolve(),
|
|
16
|
-
babel({
|
|
17
|
-
babelHelpers: "bundled",
|
|
18
|
-
plugins: ["@babel/plugin-proposal-class-properties"],
|
|
19
|
-
}),
|
|
20
|
-
json(),
|
|
21
|
-
],
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
if (process.env.NODE_ENV === "production") {
|
|
25
|
-
config.plugins.push(
|
|
26
|
-
terser({
|
|
27
|
-
ecma: 2019,
|
|
28
|
-
toplevel: true,
|
|
29
|
-
format: {
|
|
30
|
-
comments: false,
|
|
31
|
-
},
|
|
32
|
-
})
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export default config;
|
package/script/build
DELETED
package/script/develop
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Stop on errors
|
|
2
|
-
set -e
|
|
3
|
-
|
|
4
|
-
cd "$(dirname "$0")/.."
|
|
5
|
-
|
|
6
|
-
rm -rf dist
|
|
7
|
-
|
|
8
|
-
# Quit all background tasks when script exits
|
|
9
|
-
trap "kill 0" EXIT
|
|
10
|
-
|
|
11
|
-
# Run tsc once as rollup expects those files
|
|
12
|
-
tsc || true
|
|
13
|
-
|
|
14
|
-
npm exec -- serve -p 5001 &
|
|
15
|
-
npm exec -- tsc --watch &
|
|
16
|
-
npm exec -- rollup -c --watch &
|
|
17
|
-
wait
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { css } from "lit";
|
|
2
|
-
import { ButtonBase } from "@material/mwc-button/mwc-button-base";
|
|
3
|
-
import { styles } from "@material/mwc-button/styles.css";
|
|
4
|
-
|
|
5
|
-
declare global {
|
|
6
|
-
interface HTMLElementTagNameMap {
|
|
7
|
-
"ewt-button": EwtButton;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export class EwtButton extends ButtonBase {
|
|
12
|
-
static override styles = [
|
|
13
|
-
styles,
|
|
14
|
-
css`
|
|
15
|
-
.mdc-button {
|
|
16
|
-
min-width: initial;
|
|
17
|
-
}
|
|
18
|
-
:host([text-left]) .mdc-button__label {
|
|
19
|
-
text-align: left;
|
|
20
|
-
}
|
|
21
|
-
`,
|
|
22
|
-
];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
customElements.define("ewt-button", EwtButton);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { CheckboxBase } from "@material/mwc-checkbox/mwc-checkbox-base";
|
|
2
|
-
import { styles } from "@material/mwc-checkbox/mwc-checkbox.css";
|
|
3
|
-
|
|
4
|
-
declare global {
|
|
5
|
-
interface HTMLElementTagNameMap {
|
|
6
|
-
"ewt-checkbox": EwtCheckbox;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export class EwtCheckbox extends CheckboxBase {
|
|
11
|
-
static override styles = [styles];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
customElements.define("ewt-checkbox", EwtCheckbox);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { CircularProgressBase } from "@material/mwc-circular-progress/mwc-circular-progress-base";
|
|
2
|
-
import { styles } from "@material/mwc-circular-progress/mwc-circular-progress.css";
|
|
3
|
-
|
|
4
|
-
declare global {
|
|
5
|
-
interface HTMLElementTagNameMap {
|
|
6
|
-
"ewt-circular-progress": EwtCircularProgress;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export class EwtCircularProgress extends CircularProgressBase {
|
|
11
|
-
static override styles = [styles];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
customElements.define("ewt-circular-progress", EwtCircularProgress);
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { ColoredConsole, coloredConsoleStyles } from "../util/console-color";
|
|
2
|
-
import { sleep } from "../util/sleep";
|
|
3
|
-
import { LineBreakTransformer } from "../util/line-break-transformer";
|
|
4
|
-
import { Logger } from "../const";
|
|
5
|
-
|
|
6
|
-
export class EwtConsole extends HTMLElement {
|
|
7
|
-
public port!: SerialPort;
|
|
8
|
-
public logger!: Logger;
|
|
9
|
-
public allowInput = true;
|
|
10
|
-
|
|
11
|
-
private _console?: ColoredConsole;
|
|
12
|
-
private _cancelConnection?: () => Promise<void>;
|
|
13
|
-
|
|
14
|
-
public logs(): string {
|
|
15
|
-
return this._console?.logs() || "";
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public connectedCallback() {
|
|
19
|
-
if (this._console) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const shadowRoot = this.attachShadow({ mode: "open" });
|
|
23
|
-
|
|
24
|
-
shadowRoot.innerHTML = `
|
|
25
|
-
<style>
|
|
26
|
-
:host, input {
|
|
27
|
-
background-color: #1c1c1c;
|
|
28
|
-
color: #ddd;
|
|
29
|
-
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier,
|
|
30
|
-
monospace;
|
|
31
|
-
line-height: 1.45;
|
|
32
|
-
display: flex;
|
|
33
|
-
flex-direction: column;
|
|
34
|
-
}
|
|
35
|
-
form {
|
|
36
|
-
display: flex;
|
|
37
|
-
align-items: center;
|
|
38
|
-
padding: 0 8px 0 16px;
|
|
39
|
-
}
|
|
40
|
-
input {
|
|
41
|
-
flex: 1;
|
|
42
|
-
padding: 4px;
|
|
43
|
-
margin: 0 8px;
|
|
44
|
-
border: 0;
|
|
45
|
-
outline: none;
|
|
46
|
-
}
|
|
47
|
-
${coloredConsoleStyles}
|
|
48
|
-
</style>
|
|
49
|
-
<div class="log"></div>
|
|
50
|
-
${
|
|
51
|
-
this.allowInput
|
|
52
|
-
? `<form>
|
|
53
|
-
>
|
|
54
|
-
<input autofocus>
|
|
55
|
-
</form>
|
|
56
|
-
`
|
|
57
|
-
: ""
|
|
58
|
-
}
|
|
59
|
-
`;
|
|
60
|
-
|
|
61
|
-
this._console = new ColoredConsole(this.shadowRoot!.querySelector("div")!);
|
|
62
|
-
|
|
63
|
-
if (this.allowInput) {
|
|
64
|
-
const input = this.shadowRoot!.querySelector("input")!;
|
|
65
|
-
|
|
66
|
-
this.addEventListener("click", () => {
|
|
67
|
-
// Only focus input if user didn't select some text
|
|
68
|
-
if (getSelection()?.toString() === "") {
|
|
69
|
-
input.focus();
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
input.addEventListener("keydown", (ev) => {
|
|
74
|
-
if (ev.key === "Enter") {
|
|
75
|
-
ev.preventDefault();
|
|
76
|
-
ev.stopPropagation();
|
|
77
|
-
this._sendCommand();
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const abortController = new AbortController();
|
|
83
|
-
const connection = this._connect(abortController.signal);
|
|
84
|
-
this._cancelConnection = () => {
|
|
85
|
-
abortController.abort();
|
|
86
|
-
return connection;
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
private async _connect(abortSignal: AbortSignal) {
|
|
91
|
-
this.logger.debug("Starting console read loop");
|
|
92
|
-
try {
|
|
93
|
-
await this.port
|
|
94
|
-
.readable!.pipeThrough(
|
|
95
|
-
new TextDecoderStream() as ReadableWritablePair<string, Uint8Array>,
|
|
96
|
-
{
|
|
97
|
-
signal: abortSignal,
|
|
98
|
-
},
|
|
99
|
-
)
|
|
100
|
-
.pipeThrough(new TransformStream(new LineBreakTransformer()))
|
|
101
|
-
.pipeTo(
|
|
102
|
-
new WritableStream({
|
|
103
|
-
write: (chunk) => {
|
|
104
|
-
this._console!.addLine(chunk.replace("\r", ""));
|
|
105
|
-
},
|
|
106
|
-
}),
|
|
107
|
-
);
|
|
108
|
-
if (!abortSignal.aborted) {
|
|
109
|
-
this._console!.addLine("");
|
|
110
|
-
this._console!.addLine("");
|
|
111
|
-
this._console!.addLine("Terminal disconnected");
|
|
112
|
-
}
|
|
113
|
-
} catch (e) {
|
|
114
|
-
this._console!.addLine("");
|
|
115
|
-
this._console!.addLine("");
|
|
116
|
-
this._console!.addLine(`Terminal disconnected: ${e}`);
|
|
117
|
-
} finally {
|
|
118
|
-
await sleep(100);
|
|
119
|
-
this.logger.debug("Finished console read loop");
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
private async _sendCommand() {
|
|
124
|
-
const input = this.shadowRoot!.querySelector("input")!;
|
|
125
|
-
const command = input.value;
|
|
126
|
-
const encoder = new TextEncoder();
|
|
127
|
-
const writer = this.port.writable!.getWriter();
|
|
128
|
-
await writer.write(encoder.encode(command + "\r\n"));
|
|
129
|
-
this._console!.addLine(`> ${command}\r\n`);
|
|
130
|
-
input.value = "";
|
|
131
|
-
input.focus();
|
|
132
|
-
try {
|
|
133
|
-
writer.releaseLock();
|
|
134
|
-
} catch (err) {
|
|
135
|
-
console.error("Ignoring release lock error", err);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
public async disconnect() {
|
|
140
|
-
if (this._cancelConnection) {
|
|
141
|
-
await this._cancelConnection();
|
|
142
|
-
this._cancelConnection = undefined;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
public async reset() {
|
|
147
|
-
this.logger.debug("Triggering reset.");
|
|
148
|
-
await this.port.setSignals({
|
|
149
|
-
dataTerminalReady: false,
|
|
150
|
-
requestToSend: true,
|
|
151
|
-
});
|
|
152
|
-
await this.port.setSignals({
|
|
153
|
-
dataTerminalReady: false,
|
|
154
|
-
requestToSend: false,
|
|
155
|
-
});
|
|
156
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
customElements.define("ewt-console", EwtConsole);
|
|
161
|
-
|
|
162
|
-
declare global {
|
|
163
|
-
interface HTMLElementTagNameMap {
|
|
164
|
-
"ewt-console": EwtConsole;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { DialogBase } from "@material/mwc-dialog/mwc-dialog-base";
|
|
2
|
-
import { styles } from "@material/mwc-dialog/mwc-dialog.css";
|
|
3
|
-
import { css } from "lit";
|
|
4
|
-
|
|
5
|
-
declare global {
|
|
6
|
-
interface HTMLElementTagNameMap {
|
|
7
|
-
"ewt-dialog": EwtDialog;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export class EwtDialog extends DialogBase {
|
|
12
|
-
static override styles = [
|
|
13
|
-
styles,
|
|
14
|
-
css`
|
|
15
|
-
.mdc-dialog__title {
|
|
16
|
-
padding-right: 52px;
|
|
17
|
-
}
|
|
18
|
-
`,
|
|
19
|
-
];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
customElements.define("ewt-dialog", EwtDialog);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { FormfieldBase } from "@material/mwc-formfield/mwc-formfield-base";
|
|
2
|
-
import { styles } from "@material/mwc-formfield/mwc-formfield.css";
|
|
3
|
-
|
|
4
|
-
declare global {
|
|
5
|
-
interface HTMLElementTagNameMap {
|
|
6
|
-
"ewt-formfield": EwtFormfield;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export class EwtFormfield extends FormfieldBase {
|
|
11
|
-
static override styles = [styles];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
customElements.define("ewt-formfield", EwtFormfield);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IconButtonBase } from "@material/mwc-icon-button/mwc-icon-button-base";
|
|
2
|
-
import { styles } from "@material/mwc-icon-button/mwc-icon-button.css";
|
|
3
|
-
|
|
4
|
-
declare global {
|
|
5
|
-
interface HTMLElementTagNameMap {
|
|
6
|
-
"ewt-icon-button": EwtIconButton;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export class EwtIconButton extends IconButtonBase {
|
|
11
|
-
static override styles = [styles];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
customElements.define("ewt-icon-button", EwtIconButton);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ListItemBase } from "@material/mwc-list/mwc-list-item-base";
|
|
2
|
-
import { styles } from "@material/mwc-list/mwc-list-item.css";
|
|
3
|
-
|
|
4
|
-
declare global {
|
|
5
|
-
interface HTMLElementTagNameMap {
|
|
6
|
-
"ewt-list-item": EwtListItem;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export class EwtListItem extends ListItemBase {
|
|
11
|
-
static override styles = [styles];
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
customElements.define("ewt-list-item", EwtListItem);
|