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,128 @@
1
+ import type { FlashState } from "./const";
2
+ import type { EwtInstallDialog } from "./install-dialog";
3
+
4
+ export class InstallButton extends HTMLElement {
5
+ public static isSupported = "serial" in navigator;
6
+
7
+ public static isAllowed = window.isSecureContext;
8
+
9
+ private static style = `
10
+ button {
11
+ position: relative;
12
+ cursor: pointer;
13
+ font-size: 14px;
14
+ padding: 8px 28px;
15
+ color: var(--esp-tools-button-text-color, #fff);
16
+ background-color: var(--esp-tools-button-color, #03a9f4);
17
+ border: none;
18
+ border-radius: 4px;
19
+ box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), 0 3px 1px -2px rgba(0,0,0,.12), 0 1px 5px 0 rgba(0,0,0,.2);
20
+ }
21
+ button::before {
22
+ content: " ";
23
+ position: absolute;
24
+ top: 0;
25
+ bottom: 0;
26
+ left: 0;
27
+ right: 0;
28
+ opacity: 0.2;
29
+ border-radius: 4px;
30
+ }
31
+ button:hover {
32
+ box-shadow: 0 4px 8px 0 rgba(0,0,0,.14), 0 1px 7px 0 rgba(0,0,0,.12), 0 3px 1px -1px rgba(0,0,0,.2);
33
+ }
34
+ button:hover::before {
35
+ background-color: rgba(255,255,255,.8);
36
+ }
37
+ button:focus {
38
+ outline: none;
39
+ }
40
+ button:focus::before {
41
+ background-color: white;
42
+ }
43
+ button:active::before {
44
+ background-color: grey;
45
+ }
46
+ :host([active]) button {
47
+ color: rgba(0, 0, 0, 0.38);
48
+ background-color: rgba(0, 0, 0, 0.12);
49
+ box-shadow: none;
50
+ cursor: unset;
51
+ pointer-events: none;
52
+ }
53
+ improv-wifi-launch-button {
54
+ display: block;
55
+ margin-top: 16px;
56
+ }
57
+ .hidden {
58
+ display: none;
59
+ }`;
60
+
61
+ public manifest?: string;
62
+
63
+ public eraseFirst?: boolean;
64
+
65
+ public hideProgress?: boolean;
66
+
67
+ public showLog?: boolean;
68
+
69
+ public logConsole?: boolean;
70
+
71
+ public state?: FlashState;
72
+
73
+ public renderRoot?: ShadowRoot;
74
+
75
+ public overrides: EwtInstallDialog["overrides"];
76
+
77
+ public static preload() {
78
+ import("./connect");
79
+ }
80
+
81
+ public connectedCallback() {
82
+ if (this.renderRoot) {
83
+ return;
84
+ }
85
+
86
+ this.renderRoot = this.attachShadow({ mode: "open" });
87
+
88
+ if (!InstallButton.isSupported || !InstallButton.isAllowed) {
89
+ this.toggleAttribute("install-unsupported", true);
90
+ this.renderRoot.innerHTML = !InstallButton.isAllowed
91
+ ? "<slot name='not-allowed'>You can only install ESP devices on HTTPS websites or on the localhost.</slot>"
92
+ : "<slot name='unsupported'>Your browser does not support installing things on ESP devices. Use Google Chrome or Microsoft Edge.</slot>";
93
+ return;
94
+ }
95
+
96
+ this.toggleAttribute("install-supported", true);
97
+
98
+ this.addEventListener("mouseover", InstallButton.preload);
99
+
100
+ const slot = document.createElement("slot");
101
+
102
+ slot.addEventListener("click", async (ev) => {
103
+ ev.preventDefault();
104
+ const mod = await import("./connect");
105
+ mod.connect(this);
106
+ });
107
+
108
+ slot.name = "activate";
109
+ const button = document.createElement("button");
110
+ button.innerText = "CONNECT";
111
+ slot.append(button);
112
+ if (
113
+ "adoptedStyleSheets" in Document.prototype &&
114
+ "replaceSync" in CSSStyleSheet.prototype
115
+ ) {
116
+ const sheet = new CSSStyleSheet();
117
+ sheet.replaceSync(InstallButton.style);
118
+ this.renderRoot.adoptedStyleSheets = [sheet];
119
+ } else {
120
+ const styleSheet = document.createElement("style");
121
+ styleSheet.innerText = InstallButton.style;
122
+ this.renderRoot.append(styleSheet);
123
+ }
124
+ this.renderRoot.append(slot);
125
+ }
126
+ }
127
+
128
+ customElements.define("esp-web-install-button", InstallButton);