tasmota-esp-web-tools 8.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 (115) hide show
  1. package/.devcontainer/Dockerfile +16 -0
  2. package/.devcontainer/devcontainer.json +44 -0
  3. package/.github/dependabot.yml +10 -0
  4. package/.github/release-drafter.yml +12 -0
  5. package/.github/workflows/ci.yml +22 -0
  6. package/.github/workflows/npmpublish.yml +22 -0
  7. package/.github/workflows/release-drafter.yml +14 -0
  8. package/.prettierignore +1 -0
  9. package/README.md +68 -0
  10. package/dist/components/ewt-button.d.ts +9 -0
  11. package/dist/components/ewt-button.js +17 -0
  12. package/dist/components/ewt-checkbox.d.ts +9 -0
  13. package/dist/components/ewt-checkbox.js +6 -0
  14. package/dist/components/ewt-circular-progress.d.ts +9 -0
  15. package/dist/components/ewt-circular-progress.js +6 -0
  16. package/dist/components/ewt-console.d.ts +20 -0
  17. package/dist/components/ewt-console.js +141 -0
  18. package/dist/components/ewt-dialog.d.ts +9 -0
  19. package/dist/components/ewt-dialog.js +14 -0
  20. package/dist/components/ewt-formfield.d.ts +9 -0
  21. package/dist/components/ewt-formfield.js +6 -0
  22. package/dist/components/ewt-icon-button.d.ts +9 -0
  23. package/dist/components/ewt-icon-button.js +6 -0
  24. package/dist/components/ewt-list-item.d.ts +9 -0
  25. package/dist/components/ewt-list-item.js +6 -0
  26. package/dist/components/ewt-select.d.ts +9 -0
  27. package/dist/components/ewt-select.js +15 -0
  28. package/dist/components/ewt-textfield.d.ts +9 -0
  29. package/dist/components/ewt-textfield.js +15 -0
  30. package/dist/components/svg.d.ts +3 -0
  31. package/dist/components/svg.js +24 -0
  32. package/dist/connect.d.ts +3 -0
  33. package/dist/connect.js +33 -0
  34. package/dist/const.d.ts +94 -0
  35. package/dist/const.js +1 -0
  36. package/dist/flash.d.ts +4 -0
  37. package/dist/flash.js +191 -0
  38. package/dist/install-button.d.ts +17 -0
  39. package/dist/install-button.js +96 -0
  40. package/dist/install-dialog.d.ts +70 -0
  41. package/dist/install-dialog.js +899 -0
  42. package/dist/no-port-picked/index.d.ts +2 -0
  43. package/dist/no-port-picked/index.js +7 -0
  44. package/dist/no-port-picked/no-port-picked-dialog.d.ts +15 -0
  45. package/dist/no-port-picked/no-port-picked-dialog.js +149 -0
  46. package/dist/pages/ewt-page-message.d.ts +14 -0
  47. package/dist/pages/ewt-page-message.js +34 -0
  48. package/dist/pages/ewt-page-progress.d.ts +14 -0
  49. package/dist/pages/ewt-page-progress.js +39 -0
  50. package/dist/styles.d.ts +1 -0
  51. package/dist/styles.js +32 -0
  52. package/dist/util/chip-family-name.d.ts +3 -0
  53. package/dist/util/chip-family-name.js +17 -0
  54. package/dist/util/console-color.d.ts +19 -0
  55. package/dist/util/console-color.js +265 -0
  56. package/dist/util/file-download.d.ts +2 -0
  57. package/dist/util/file-download.js +15 -0
  58. package/dist/util/fire-event.d.ts +5 -0
  59. package/dist/util/fire-event.js +12 -0
  60. package/dist/util/line-break-transformer.d.ts +5 -0
  61. package/dist/util/line-break-transformer.js +17 -0
  62. package/dist/util/manifest.d.ts +2 -0
  63. package/dist/util/manifest.js +12 -0
  64. package/dist/util/sleep.d.ts +1 -0
  65. package/dist/util/sleep.js +1 -0
  66. package/dist/web/connect-3012e6dd.js +886 -0
  67. package/dist/web/esp32-5f88817f.js +1 -0
  68. package/dist/web/esp32c3-596796ad.js +1 -0
  69. package/dist/web/esp32s2-f7a69530.js +1 -0
  70. package/dist/web/esp32s3-314fbacd.js +1 -0
  71. package/dist/web/esp8266-c68f89af.js +1 -0
  72. package/dist/web/index-f110c132.js +126 -0
  73. package/dist/web/install-button.js +1 -0
  74. package/package.json +36 -0
  75. package/rollup.config.js +28 -0
  76. package/script/build +8 -0
  77. package/script/develop +17 -0
  78. package/script/stubgen.py +161 -0
  79. package/src/components/ewt-button.ts +25 -0
  80. package/src/components/ewt-checkbox.ts +14 -0
  81. package/src/components/ewt-circular-progress.ts +14 -0
  82. package/src/components/ewt-console.ts +163 -0
  83. package/src/components/ewt-dialog.ts +22 -0
  84. package/src/components/ewt-formfield.ts +14 -0
  85. package/src/components/ewt-icon-button.ts +14 -0
  86. package/src/components/ewt-list-item.ts +14 -0
  87. package/src/components/ewt-select.ts +23 -0
  88. package/src/components/ewt-textfield.ts +23 -0
  89. package/src/components/svg.ts +27 -0
  90. package/src/connect.ts +42 -0
  91. package/src/const.ts +101 -0
  92. package/src/flash.ts +240 -0
  93. package/src/install-button.ts +128 -0
  94. package/src/install-dialog.ts +981 -0
  95. package/src/no-port-picked/index.ts +10 -0
  96. package/src/no-port-picked/no-port-picked-dialog.ts +158 -0
  97. package/src/pages/ewt-page-message.ts +39 -0
  98. package/src/pages/ewt-page-progress.ts +44 -0
  99. package/src/styles.ts +34 -0
  100. package/src/util/chip-family-name.ts +28 -0
  101. package/src/util/console-color.ts +283 -0
  102. package/src/util/file-download.ts +17 -0
  103. package/src/util/fire-event.ts +20 -0
  104. package/src/util/line-break-transformer.ts +20 -0
  105. package/src/util/manifest.ts +18 -0
  106. package/src/util/sleep.ts +2 -0
  107. package/static/logos/canairio.png +0 -0
  108. package/static/logos/espeasy.png +0 -0
  109. package/static/logos/esphome.svg +1 -0
  110. package/static/logos/tasmota.svg +1 -0
  111. package/static/logos/wled.png +0 -0
  112. package/static/screenshots/dashboard.png +0 -0
  113. package/static/screenshots/logs.png +0 -0
  114. package/static/social.png +0 -0
  115. package/tsconfig.json +21 -0
@@ -0,0 +1,16 @@
1
+ # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.177.0/containers/typescript-node/.devcontainer/base.Dockerfile
2
+
3
+ # [Choice] Node.js version: 16, 14, 12
4
+ ARG VARIANT="16-buster"
5
+ FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT}
6
+
7
+ # [Optional] Uncomment this section to install additional OS packages.
8
+ # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
9
+ # && apt-get -y install --no-install-recommends <your-package-list-here>
10
+
11
+ # [Optional] Uncomment if you want to install an additional version of node using nvm
12
+ # ARG EXTRA_NODE_VERSION=10
13
+ # RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
14
+
15
+ # [Optional] Uncomment if you want to install more global node packages
16
+ # RUN su node -c "npm install -g <your-package-list -here>"
@@ -0,0 +1,44 @@
1
+ // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2
+ // https://github.com/microsoft/vscode-dev-containers/tree/v0.177.0/containers/typescript-node
3
+ {
4
+ "name": "Node.js & TypeScript",
5
+ "build": {
6
+ "dockerfile": "Dockerfile",
7
+ // Update 'VARIANT' to pick a Node version: 12, 14, 16
8
+ "args": {
9
+ "VARIANT": "16"
10
+ }
11
+ },
12
+
13
+ // Add the IDs of extensions you want installed when the container is created.
14
+ "extensions": [
15
+ "dbaeumer.vscode-eslint",
16
+ "esbenp.prettier-vscode",
17
+ "bierner.lit-html",
18
+ "runem.lit-plugin"
19
+ ],
20
+
21
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
22
+ "forwardPorts": [5000],
23
+
24
+ // Use 'postCreateCommand' to run commands after the container is created.
25
+ "postCreateCommand": "npm install",
26
+
27
+ // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
28
+ "remoteUser": "node",
29
+
30
+ "settings": {
31
+ "files.eol": "\n",
32
+ "editor.tabSize": 2,
33
+ "editor.formatOnPaste": false,
34
+ "editor.formatOnSave": true,
35
+ "editor.formatOnType": true,
36
+ "[typescript]": {
37
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
38
+ },
39
+ "[javascript]": {
40
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
41
+ },
42
+ "files.trimTrailingWhitespace": true
43
+ }
44
+ }
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: weekly
7
+ - package-ecosystem: "npm"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "weekly"
@@ -0,0 +1,12 @@
1
+ categories:
2
+ - title: "Breaking Changes"
3
+ labels:
4
+ - "breaking change"
5
+ - title: "Dependencies"
6
+ collapse-after: 1
7
+ labels:
8
+ - "dependencies"
9
+ template: |
10
+ ## What's Changed
11
+
12
+ $CHANGES
@@ -0,0 +1,22 @@
1
+ # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2
+ # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3
+
4
+ name: CI
5
+
6
+ on:
7
+ push:
8
+ pull_request:
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - uses: actions/checkout@v3
16
+ - name: Use Node.js
17
+ uses: actions/setup-node@v3
18
+ with:
19
+ node-version: 16
20
+ - run: npm ci
21
+ - run: script/build
22
+ - run: npm exec -- prettier --check src
@@ -0,0 +1,22 @@
1
+ # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
+ # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3
+
4
+ name: Node.js Package
5
+
6
+ on:
7
+ release:
8
+ types: [published]
9
+
10
+ jobs:
11
+ publish-npm:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v3
15
+ - uses: actions/setup-node@v3
16
+ with:
17
+ node-version: 16
18
+ registry-url: https://registry.npmjs.org/
19
+ - run: npm ci
20
+ - run: npm publish
21
+ env:
22
+ NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
@@ -0,0 +1,14 @@
1
+ name: Release Drafter
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ update_release_draft:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: release-drafter/release-drafter@v5
13
+ env:
14
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1 @@
1
+ src/vendor
package/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # ESP Web Tools
2
+
3
+ Allow flashing ESPHome or other ESP-based firmwares via the browser. Will automatically detect the board type and select a supported firmware. [See website for full documentation.](https://esphome.github.io/esp-web-tools/)
4
+
5
+ ```html
6
+ <esp-web-install-button
7
+ manifest="firmware_esphome/manifest.json"
8
+ ></esp-web-install-button>
9
+ ```
10
+
11
+ Example manifest:
12
+
13
+ ```json
14
+ {
15
+ "name": "ESPHome",
16
+ "version": "2021.10.3",
17
+ "home_assistant_domain": "esphome",
18
+ "funding_url": "https://esphome.io/guides/supporters.html",
19
+ "builds": [
20
+ {
21
+ "chipFamily": "ESP32",
22
+ "parts": [
23
+ { "path": "bootloader_dout_40m.bin", "offset": 4096 },
24
+ { "path": "partitions.bin", "offset": 32768 },
25
+ { "path": "boot_app0.bin", "offset": 57344 },
26
+ { "path": "esp32.bin", "offset": 65536 }
27
+ ]
28
+ },
29
+ {
30
+ "chipFamily": "ESP32-C3",
31
+ "parts": [
32
+ { "path": "bootloader_dout_40m.bin", "offset": 0 },
33
+ { "path": "partitions.bin", "offset": 32768 },
34
+ { "path": "boot_app0.bin", "offset": 57344 },
35
+ { "path": "esp32-c3.bin", "offset": 65536 }
36
+ ]
37
+ },
38
+ {
39
+ "chipFamily": "ESP32-S2",
40
+ "parts": [
41
+ { "path": "bootloader_dout_40m.bin", "offset": 4096 },
42
+ { "path": "partitions.bin", "offset": 32768 },
43
+ { "path": "boot_app0.bin", "offset": 57344 },
44
+ { "path": "esp32-s2.bin", "offset": 65536 }
45
+ ]
46
+ },
47
+ {
48
+ "chipFamily": "ESP32-S3",
49
+ "parts": [
50
+ { "path": "bootloader_dout_40m.bin", "offset": 4096 },
51
+ { "path": "partitions.bin", "offset": 32768 },
52
+ { "path": "boot_app0.bin", "offset": 57344 },
53
+ { "path": "esp32-s3.bin", "offset": 65536 }
54
+ ]
55
+ },
56
+ {
57
+ "chipFamily": "ESP8266",
58
+ "parts": [
59
+ { "path": "esp8266.bin", "offset": 0 }
60
+ ]
61
+ }
62
+ ]
63
+ }
64
+ ```
65
+
66
+ ## Development
67
+
68
+ Run `script/develop`. This starts a server. Open it on http://localhost:5001.
@@ -0,0 +1,9 @@
1
+ import { ButtonBase } from "@material/mwc-button/mwc-button-base";
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ "ewt-button": EwtButton;
5
+ }
6
+ }
7
+ export declare class EwtButton extends ButtonBase {
8
+ static styles: import("lit").CSSResult[];
9
+ }
@@ -0,0 +1,17 @@
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
+ export class EwtButton extends ButtonBase {
5
+ }
6
+ EwtButton.styles = [
7
+ styles,
8
+ css `
9
+ .mdc-button {
10
+ min-width: initial;
11
+ }
12
+ :host([text-left]) .mdc-button__label {
13
+ text-align: left;
14
+ }
15
+ `,
16
+ ];
17
+ customElements.define("ewt-button", EwtButton);
@@ -0,0 +1,9 @@
1
+ import { CheckboxBase } from "@material/mwc-checkbox/mwc-checkbox-base";
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ "ewt-checkbox": EwtCheckbox;
5
+ }
6
+ }
7
+ export declare class EwtCheckbox extends CheckboxBase {
8
+ static styles: import("lit").CSSResult[];
9
+ }
@@ -0,0 +1,6 @@
1
+ import { CheckboxBase } from "@material/mwc-checkbox/mwc-checkbox-base";
2
+ import { styles } from "@material/mwc-checkbox/mwc-checkbox.css";
3
+ export class EwtCheckbox extends CheckboxBase {
4
+ }
5
+ EwtCheckbox.styles = [styles];
6
+ customElements.define("ewt-checkbox", EwtCheckbox);
@@ -0,0 +1,9 @@
1
+ import { CircularProgressBase } from "@material/mwc-circular-progress/mwc-circular-progress-base";
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ "ewt-circular-progress": EwtCircularProgress;
5
+ }
6
+ }
7
+ export declare class EwtCircularProgress extends CircularProgressBase {
8
+ static styles: import("lit").CSSResult[];
9
+ }
@@ -0,0 +1,6 @@
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
+ export class EwtCircularProgress extends CircularProgressBase {
4
+ }
5
+ EwtCircularProgress.styles = [styles];
6
+ customElements.define("ewt-circular-progress", EwtCircularProgress);
@@ -0,0 +1,20 @@
1
+ /// <reference types="w3c-web-serial" />
2
+ import { Logger } from "../const";
3
+ export declare class EwtConsole extends HTMLElement {
4
+ port: SerialPort;
5
+ logger: Logger;
6
+ allowInput: boolean;
7
+ private _console?;
8
+ private _cancelConnection?;
9
+ logs(): string;
10
+ connectedCallback(): void;
11
+ private _connect;
12
+ private _sendCommand;
13
+ disconnect(): Promise<void>;
14
+ reset(): Promise<void>;
15
+ }
16
+ declare global {
17
+ interface HTMLElementTagNameMap {
18
+ "ewt-console": EwtConsole;
19
+ }
20
+ }
@@ -0,0 +1,141 @@
1
+ import { ColoredConsole, coloredConsoleStyles } from "../util/console-color";
2
+ import { sleep } from "../util/sleep";
3
+ import { LineBreakTransformer } from "../util/line-break-transformer";
4
+ export class EwtConsole extends HTMLElement {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.allowInput = true;
8
+ }
9
+ logs() {
10
+ var _a;
11
+ return ((_a = this._console) === null || _a === void 0 ? void 0 : _a.logs()) || "";
12
+ }
13
+ connectedCallback() {
14
+ if (this._console) {
15
+ return;
16
+ }
17
+ const shadowRoot = this.attachShadow({ mode: "open" });
18
+ shadowRoot.innerHTML = `
19
+ <style>
20
+ :host, input {
21
+ background-color: #1c1c1c;
22
+ color: #ddd;
23
+ font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier,
24
+ monospace;
25
+ line-height: 1.45;
26
+ display: flex;
27
+ flex-direction: column;
28
+ }
29
+ form {
30
+ display: flex;
31
+ align-items: center;
32
+ padding: 0 8px 0 16px;
33
+ }
34
+ input {
35
+ flex: 1;
36
+ padding: 4px;
37
+ margin: 0 8px;
38
+ border: 0;
39
+ outline: none;
40
+ }
41
+ ${coloredConsoleStyles}
42
+ </style>
43
+ <div class="log"></div>
44
+ ${this.allowInput
45
+ ? `<form>
46
+ >
47
+ <input autofocus>
48
+ </form>
49
+ `
50
+ : ""}
51
+ `;
52
+ this._console = new ColoredConsole(this.shadowRoot.querySelector("div"));
53
+ if (this.allowInput) {
54
+ const input = this.shadowRoot.querySelector("input");
55
+ this.addEventListener("click", () => {
56
+ var _a;
57
+ // Only focus input if user didn't select some text
58
+ if (((_a = getSelection()) === null || _a === void 0 ? void 0 : _a.toString()) === "") {
59
+ input.focus();
60
+ }
61
+ });
62
+ input.addEventListener("keydown", (ev) => {
63
+ if (ev.key === "Enter") {
64
+ ev.preventDefault();
65
+ ev.stopPropagation();
66
+ this._sendCommand();
67
+ }
68
+ });
69
+ }
70
+ const abortController = new AbortController();
71
+ const connection = this._connect(abortController.signal);
72
+ this._cancelConnection = () => {
73
+ abortController.abort();
74
+ return connection;
75
+ };
76
+ }
77
+ async _connect(abortSignal) {
78
+ this.logger.debug("Starting console read loop");
79
+ try {
80
+ await this.port
81
+ .readable.pipeThrough(new TextDecoderStream(), {
82
+ signal: abortSignal,
83
+ })
84
+ .pipeThrough(new TransformStream(new LineBreakTransformer()))
85
+ .pipeTo(new WritableStream({
86
+ write: (chunk) => {
87
+ this._console.addLine(chunk.replace("\r", ""));
88
+ },
89
+ }));
90
+ if (!abortSignal.aborted) {
91
+ this._console.addLine("");
92
+ this._console.addLine("");
93
+ this._console.addLine("Terminal disconnected");
94
+ }
95
+ }
96
+ catch (e) {
97
+ this._console.addLine("");
98
+ this._console.addLine("");
99
+ this._console.addLine(`Terminal disconnected: ${e}`);
100
+ }
101
+ finally {
102
+ await sleep(100);
103
+ this.logger.debug("Finished console read loop");
104
+ }
105
+ }
106
+ async _sendCommand() {
107
+ const input = this.shadowRoot.querySelector("input");
108
+ const command = input.value;
109
+ const encoder = new TextEncoder();
110
+ const writer = this.port.writable.getWriter();
111
+ await writer.write(encoder.encode(command + "\r\n"));
112
+ this._console.addLine(`> ${command}\r\n`);
113
+ input.value = "";
114
+ input.focus();
115
+ try {
116
+ writer.releaseLock();
117
+ }
118
+ catch (err) {
119
+ console.error("Ignoring release lock error", err);
120
+ }
121
+ }
122
+ async disconnect() {
123
+ if (this._cancelConnection) {
124
+ await this._cancelConnection();
125
+ this._cancelConnection = undefined;
126
+ }
127
+ }
128
+ async reset() {
129
+ this.logger.debug("Triggering reset.");
130
+ await this.port.setSignals({
131
+ dataTerminalReady: false,
132
+ requestToSend: true,
133
+ });
134
+ await this.port.setSignals({
135
+ dataTerminalReady: false,
136
+ requestToSend: false,
137
+ });
138
+ await new Promise((resolve) => setTimeout(resolve, 1000));
139
+ }
140
+ }
141
+ customElements.define("ewt-console", EwtConsole);
@@ -0,0 +1,9 @@
1
+ import { DialogBase } from "@material/mwc-dialog/mwc-dialog-base";
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ "ewt-dialog": EwtDialog;
5
+ }
6
+ }
7
+ export declare class EwtDialog extends DialogBase {
8
+ static styles: import("lit").CSSResult[];
9
+ }
@@ -0,0 +1,14 @@
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
+ export class EwtDialog extends DialogBase {
5
+ }
6
+ EwtDialog.styles = [
7
+ styles,
8
+ css `
9
+ .mdc-dialog__title {
10
+ padding-right: 52px;
11
+ }
12
+ `,
13
+ ];
14
+ customElements.define("ewt-dialog", EwtDialog);
@@ -0,0 +1,9 @@
1
+ import { FormfieldBase } from "@material/mwc-formfield/mwc-formfield-base";
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ "ewt-formfield": EwtFormfield;
5
+ }
6
+ }
7
+ export declare class EwtFormfield extends FormfieldBase {
8
+ static styles: import("lit").CSSResult[];
9
+ }
@@ -0,0 +1,6 @@
1
+ import { FormfieldBase } from "@material/mwc-formfield/mwc-formfield-base";
2
+ import { styles } from "@material/mwc-formfield/mwc-formfield.css";
3
+ export class EwtFormfield extends FormfieldBase {
4
+ }
5
+ EwtFormfield.styles = [styles];
6
+ customElements.define("ewt-formfield", EwtFormfield);
@@ -0,0 +1,9 @@
1
+ import { IconButtonBase } from "@material/mwc-icon-button/mwc-icon-button-base";
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ "ewt-icon-button": EwtIconButton;
5
+ }
6
+ }
7
+ export declare class EwtIconButton extends IconButtonBase {
8
+ static styles: import("lit").CSSResult[];
9
+ }
@@ -0,0 +1,6 @@
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
+ export class EwtIconButton extends IconButtonBase {
4
+ }
5
+ EwtIconButton.styles = [styles];
6
+ customElements.define("ewt-icon-button", EwtIconButton);
@@ -0,0 +1,9 @@
1
+ import { ListItemBase } from "@material/mwc-list/mwc-list-item-base";
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ "ewt-list-item": EwtListItem;
5
+ }
6
+ }
7
+ export declare class EwtListItem extends ListItemBase {
8
+ static styles: import("lit").CSSResult[];
9
+ }
@@ -0,0 +1,6 @@
1
+ import { ListItemBase } from "@material/mwc-list/mwc-list-item-base";
2
+ import { styles } from "@material/mwc-list/mwc-list-item.css";
3
+ export class EwtListItem extends ListItemBase {
4
+ }
5
+ EwtListItem.styles = [styles];
6
+ customElements.define("ewt-list-item", EwtListItem);
@@ -0,0 +1,9 @@
1
+ import { SelectBase } from "@material/mwc-select/mwc-select-base";
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ "ewt-select": EwtSelect;
5
+ }
6
+ }
7
+ export declare class EwtSelect extends SelectBase {
8
+ static styles: import("lit").CSSResult[];
9
+ }
@@ -0,0 +1,15 @@
1
+ import { SelectBase } from "@material/mwc-select/mwc-select-base";
2
+ import { styles } from "@material/mwc-select/mwc-select.css";
3
+ import { css } from "lit";
4
+ export class EwtSelect extends SelectBase {
5
+ }
6
+ EwtSelect.styles = [
7
+ styles,
8
+ // rem -> em conversion
9
+ css `
10
+ .mdc-floating-label {
11
+ line-height: 1.15em;
12
+ }
13
+ `,
14
+ ];
15
+ customElements.define("ewt-select", EwtSelect);
@@ -0,0 +1,9 @@
1
+ import { TextFieldBase } from "@material/mwc-textfield/mwc-textfield-base";
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ "ewt-textfield": EwtTextfield;
5
+ }
6
+ }
7
+ export declare class EwtTextfield extends TextFieldBase {
8
+ static styles: import("lit").CSSResult[];
9
+ }
@@ -0,0 +1,15 @@
1
+ import { TextFieldBase } from "@material/mwc-textfield/mwc-textfield-base";
2
+ import { styles } from "@material/mwc-textfield/mwc-textfield.css";
3
+ import { css } from "lit";
4
+ export class EwtTextfield extends TextFieldBase {
5
+ }
6
+ EwtTextfield.styles = [
7
+ styles,
8
+ // rem -> em conversion
9
+ css `
10
+ .mdc-floating-label {
11
+ line-height: 1.15em;
12
+ }
13
+ `,
14
+ ];
15
+ customElements.define("ewt-textfield", EwtTextfield);
@@ -0,0 +1,3 @@
1
+ export declare const closeIcon: import("lit-html").TemplateResult<2>;
2
+ export declare const firmwareIcon: import("lit-html").TemplateResult<2>;
3
+ export declare const chipIcon: import("lit-html").TemplateResult<2>;
@@ -0,0 +1,24 @@
1
+ import { svg } from "lit";
2
+ export const closeIcon = svg `
3
+ <svg width="24" height="24" viewBox="0 0 24 24">
4
+ <path
5
+ d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"
6
+ />
7
+ </svg>
8
+ `;
9
+ export const firmwareIcon = svg `
10
+ <svg viewBox="0 0 24 24" title="Software">
11
+ <path
12
+ fill="currentColor"
13
+ d="M9.5,8.5L11,10L8,13L11,16L9.5,17.5L5,13L9.5,8.5M14.5,17.5L13,16L16,13L13,10L14.5,8.5L19,13L14.5,17.5M21,2H3A2,2 0 0,0 1,4V20A2,2 0 0,0 3,22H21A2,2 0 0,0 23,20V4A2,2 0 0,0 21,2M21,20H3V6H21V20Z"
14
+ />
15
+ </svg>
16
+ `;
17
+ export const chipIcon = svg `
18
+ <svg viewBox="0 0 24 24" title="Chipset">
19
+ <path
20
+ fill="currentColor"
21
+ d="M6,4H18V5H21V7H18V9H21V11H18V13H21V15H18V17H21V19H18V20H6V19H3V17H6V15H3V13H6V11H3V9H6V7H3V5H6V4M11,15V18H12V15H11M13,15V18H14V15H13M15,15V18H16V15H15Z"
22
+ />
23
+ </svg>
24
+ `;
@@ -0,0 +1,3 @@
1
+ import type { InstallButton } from "./install-button.js";
2
+ import "./install-dialog.js";
3
+ export declare const connect: (button: InstallButton) => Promise<void>;
@@ -0,0 +1,33 @@
1
+ import "./install-dialog.js";
2
+ export const connect = async (button) => {
3
+ let port;
4
+ try {
5
+ port = await navigator.serial.requestPort();
6
+ }
7
+ catch (err) {
8
+ if (err.name === "NotFoundError") {
9
+ import("./no-port-picked/index").then((mod) => mod.openNoPortPickedDialog(() => connect(button)));
10
+ return;
11
+ }
12
+ alert(`Error: ${err.message}`);
13
+ return;
14
+ }
15
+ if (!port) {
16
+ return;
17
+ }
18
+ try {
19
+ await port.open({ baudRate: 115200 });
20
+ }
21
+ catch (err) {
22
+ alert(err.message);
23
+ return;
24
+ }
25
+ const el = document.createElement("ewt-install-dialog");
26
+ el.port = port;
27
+ el.manifestPath = button.manifest || button.getAttribute("manifest");
28
+ el.overrides = button.overrides;
29
+ el.addEventListener("closed", () => {
30
+ port.close();
31
+ }, { once: true });
32
+ document.body.appendChild(el);
33
+ };