feat: web UI with AP, Wi-Fi client, mDNS, presets, OTA and DDP
- Wi-Fi access point led-XXXXXX plus a client network, configurable mDNS name and static client address - Preset tiles with an editor, drag to reorder, default presets, global brightness, Run and Edit modes, collapsible menu on phones - 35 patterns ported from led-driver, up to 512 LEDs, colour order, max brightness and data pin settings - Over-the-air updates (POST /ota) with rollback, and a CLI in tools/ota.py - DDP receiver on UDP 4048 with tools/ddp_test.py - LED refresh every 10 ms; lwIP sockets raised to 16 so mDNS, HTTP and DDP can run together Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
89f996096c
commit
9a04d28ecf
32 files changed
+6210
-398
No files matched your search
+594
-112
@@ -1,121 +1,603 @@
|
||||
:root {
|
||||
--bg: #f6f6f7;
|
||||
--fg: #1d1d1f;
|
||||
--muted: #6e6e73;
|
||||
--card: #ffffff;
|
||||
--accent: #2563eb;
|
||||
--border: #d2d2d7;
|
||||
}
|
||||
/* Styled to match led-controller: dark grey panels, a darker header, grey buttons, purple selection */
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root:not([data-theme="light"]) {
|
||||
--bg: #111114;
|
||||
--fg: #f2f2f5;
|
||||
--muted: #9a9aa3;
|
||||
--card: #1c1c21;
|
||||
--accent: #5b8cff;
|
||||
--border: #34343c;
|
||||
}
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
:root[data-theme="dark"] {
|
||||
--bg: #111114;
|
||||
--fg: #f2f2f5;
|
||||
--muted: #9a9aa3;
|
||||
--card: #1c1c21;
|
||||
--accent: #5b8cff;
|
||||
--border: #34343c;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0 16px 32px;
|
||||
background: var(--bg);
|
||||
color: var(--fg);
|
||||
font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
||||
background-color: #2e2e2e;
|
||||
color: white;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
header {
|
||||
max-width: 560px;
|
||||
margin: 0 auto;
|
||||
padding: 16px 0 8px;
|
||||
}
|
||||
|
||||
h1 { margin: 0 0 12px; font-size: 1.5rem; }
|
||||
h2 { font-size: 1.1rem; margin: 20px 0 8px; }
|
||||
|
||||
nav { display: flex; gap: 8px; }
|
||||
|
||||
main {
|
||||
max-width: 560px;
|
||||
margin: 0 auto;
|
||||
background: var(--card);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 12px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
section > * + * { margin-top: 12px; }
|
||||
|
||||
label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
output { font-weight: 400; color: var(--muted); }
|
||||
|
||||
.row { display: flex; gap: 16px; flex-wrap: wrap; }
|
||||
.row > label { flex: 1 1 140px; }
|
||||
|
||||
select, input[type="text"], input:not([type]), input[type="password"] {
|
||||
font: inherit;
|
||||
padding: 8px 10px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
background: var(--bg);
|
||||
color: var(--fg);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
input[type="color"] {
|
||||
width: 100%;
|
||||
height: 44px;
|
||||
padding: 2px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
background: var(--bg);
|
||||
}
|
||||
|
||||
input[type="range"] { width: 100%; accent-color: var(--accent); }
|
||||
|
||||
button {
|
||||
font: inherit;
|
||||
padding: 8px 14px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
background: var(--bg);
|
||||
color: var(--fg);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button.tab.active,
|
||||
button[type="submit"] {
|
||||
background: var(--accent);
|
||||
border-color: var(--accent);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.list { list-style: none; padding: 0; margin: 0; }
|
||||
.list li + li { margin-top: 6px; }
|
||||
button.net { width: 100%; text-align: left; }
|
||||
|
||||
.muted { color: var(--muted); font-size: 0.9rem; }
|
||||
|
||||
[hidden] { display: none !important; }
|
||||
|
||||
form { display: flex; flex-direction: column; gap: 12px; }
|
||||
/* Header: title, tabs */
|
||||
header {
|
||||
background-color: #1a1a1a;
|
||||
padding: 0.75rem 1rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
border-bottom: 2px solid #4a4a4a;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
font-size: 1.35rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
nav {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
button.tab {
|
||||
padding: 0.45rem 0.9rem;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
background-color: #3a3a3a;
|
||||
color: white;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button.tab:hover { background-color: #4a4a4a; }
|
||||
|
||||
button.tab.active {
|
||||
background-color: #6a5acd;
|
||||
}
|
||||
|
||||
/* Run/Edit mode switch: the label is the mode it switches to */
|
||||
button.mode-toggle {
|
||||
padding: 0.45rem 0.9rem;
|
||||
border: 1px solid #6a5acd;
|
||||
border-radius: 4px;
|
||||
background-color: transparent;
|
||||
color: white;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button.mode-toggle:hover { background-color: #3a3a3a; }
|
||||
|
||||
body.mode-edit button.mode-toggle {
|
||||
background-color: #6a5acd;
|
||||
}
|
||||
|
||||
/* Run mode: the Edit button and drag handles are not shown */
|
||||
body.mode-run button.preset-edit {
|
||||
display: none;
|
||||
}
|
||||
|
||||
body.mode-run .preset-tile-row {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* Main panel */
|
||||
main {
|
||||
padding: 1rem;
|
||||
max-width: 760px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
section > * + * { margin-top: 0.85rem; }
|
||||
|
||||
h2 {
|
||||
font-size: 1.1rem;
|
||||
font-weight: 600;
|
||||
margin-top: 1.25rem;
|
||||
}
|
||||
|
||||
/* Form controls */
|
||||
label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.35rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
output {
|
||||
font-weight: 400;
|
||||
color: #bdbdbd;
|
||||
}
|
||||
|
||||
select,
|
||||
input[type="text"],
|
||||
input:not([type]),
|
||||
input[type="password"],
|
||||
input[type="number"] {
|
||||
font: inherit;
|
||||
padding: 0.4rem 0.5rem;
|
||||
background-color: #2e2e2e;
|
||||
border: 1px solid #4a4a4a;
|
||||
border-radius: 4px;
|
||||
color: white;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
input[type="color"] {
|
||||
width: 100%;
|
||||
height: 2.5rem;
|
||||
padding: 0.15rem;
|
||||
background-color: #2e2e2e;
|
||||
border: 1px solid #4a4a4a;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
input[type="range"] {
|
||||
width: 100%;
|
||||
accent-color: #6a5acd;
|
||||
}
|
||||
|
||||
input[type="checkbox"] {
|
||||
accent-color: #6a5acd;
|
||||
}
|
||||
|
||||
button {
|
||||
font: inherit;
|
||||
padding: 0.45rem 0.9rem;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
background-color: #4a4a4a;
|
||||
color: white;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
button:hover { background-color: #5a5a5a; }
|
||||
|
||||
button:disabled {
|
||||
opacity: 0.45;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
button[type="submit"] {
|
||||
background-color: #6a5acd;
|
||||
}
|
||||
|
||||
button[type="submit"]:hover { background-color: #7b6bdb; }
|
||||
|
||||
form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
form button { align-self: flex-start; }
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.row > label { flex: 1 1 140px; }
|
||||
|
||||
.field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
|
||||
.swatches {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.swatches input[type="color"] { width: 3.5rem; }
|
||||
|
||||
.checks {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
label.check {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
label.check input { width: auto; }
|
||||
|
||||
details {
|
||||
background-color: #3a3a3a;
|
||||
border-radius: 4px;
|
||||
padding: 0.6rem 0.8rem;
|
||||
}
|
||||
|
||||
details summary {
|
||||
cursor: pointer;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
details > * + * { margin-top: 0.6rem; }
|
||||
|
||||
.muted {
|
||||
color: #bdbdbd;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.list {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.list li + li { margin-top: 0.35rem; }
|
||||
|
||||
button.net {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
background-color: #3a3a3a;
|
||||
}
|
||||
|
||||
button.net:hover { background-color: #4a4a4a; }
|
||||
|
||||
/* Preset tiles: as led-controller's pattern buttons, filled with the preset colours */
|
||||
.preset-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
|
||||
gap: 0.6rem;
|
||||
}
|
||||
|
||||
button.preset-tile {
|
||||
height: 5rem;
|
||||
padding: 0 0.5rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 0.12rem;
|
||||
position: relative;
|
||||
background-color: #3a3a3a;
|
||||
border: 3px solid #000;
|
||||
border-radius: 4px;
|
||||
color: white;
|
||||
text-align: center;
|
||||
text-shadow: 0 0 2px rgba(0, 0, 0, 0.8), 0 1px 2px rgba(0, 0, 0, 0.6);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
button.preset-tile:hover { filter: brightness(1.12); }
|
||||
|
||||
button.preset-tile.active {
|
||||
border-color: #ffffff;
|
||||
outline: 3px solid #ffffff;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.header-bright {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-weight: 500;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.header-bright input[type="range"] { width: 7rem; }
|
||||
|
||||
.header-bright output { min-width: 2.5rem; color: #bdbdbd; font-weight: 400; }
|
||||
|
||||
button.tab-action {
|
||||
padding: 0.45rem 0.9rem;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
background-color: #6a5acd;
|
||||
color: white;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button.tab-action:hover { background-color: #7b6bdb; }
|
||||
|
||||
.preset-tile-name {
|
||||
font-weight: 600;
|
||||
font-size: 0.9rem;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.preset-tile-pattern {
|
||||
font-size: 0.75rem;
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.preset-tile-row {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.3rem;
|
||||
}
|
||||
|
||||
.preset-tile-row.dragging {
|
||||
opacity: 0.6;
|
||||
outline: 2px dashed #bdbdbd;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.preset-tile-row { touch-action: pan-y; }
|
||||
|
||||
button.preset-edit {
|
||||
padding: 0.2rem 0.5rem;
|
||||
font-size: 0.8rem;
|
||||
background-color: #3a3a3a;
|
||||
}
|
||||
|
||||
button.preset-edit:hover { background-color: #4a4a4a; }
|
||||
|
||||
/* Child window (the preset editor) */
|
||||
.modal {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
padding: 1rem;
|
||||
overflow-y: auto;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
background-color: #2e2e2e;
|
||||
padding: 1.25rem;
|
||||
border-radius: 8px;
|
||||
width: 100%;
|
||||
max-width: 480px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.85rem;
|
||||
margin: auto 0;
|
||||
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.modal-head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.modal-head h2 {
|
||||
margin: 0;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
button.modal-close {
|
||||
background: none;
|
||||
font-size: 1.5rem;
|
||||
line-height: 1;
|
||||
padding: 0 0.4rem;
|
||||
}
|
||||
|
||||
button.modal-close:hover { background: #3a3a3a; }
|
||||
|
||||
.modal-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
button.btn-secondary { background-color: #3a3a3a; }
|
||||
button.btn-secondary:hover { background-color: #4a4a4a; }
|
||||
button.btn-danger { background-color: #d32f2f; }
|
||||
button.btn-danger:hover { background-color: #c62828; }
|
||||
|
||||
/* Phones and small tablets */
|
||||
html {
|
||||
-webkit-text-size-adjust: 100%;
|
||||
text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
overflow-x: hidden;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
main {
|
||||
width: 100%;
|
||||
padding-left: max(1rem, env(safe-area-inset-left));
|
||||
padding-right: max(1rem, env(safe-area-inset-right));
|
||||
padding-bottom: max(1rem, env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
/* The menu toggle only shows on phones */
|
||||
button.menu-toggle {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
header {
|
||||
padding: 0.6rem max(0.75rem, env(safe-area-inset-left));
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
flex: 1;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
/* ☰ button: three bars, pushed to the right of the title */
|
||||
button.menu-toggle {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 2.75rem;
|
||||
height: 2.75rem;
|
||||
min-height: 2.75rem;
|
||||
padding: 0;
|
||||
background-color: #3a3a3a;
|
||||
}
|
||||
|
||||
button.menu-toggle:hover { background-color: #4a4a4a; }
|
||||
|
||||
button.menu-toggle[aria-expanded="true"] {
|
||||
background-color: #6a5acd;
|
||||
}
|
||||
|
||||
.menu-bars {
|
||||
position: relative;
|
||||
display: block;
|
||||
width: 1.25rem;
|
||||
height: 2px;
|
||||
background-color: white;
|
||||
border-radius: 1px;
|
||||
}
|
||||
|
||||
.menu-bars::before,
|
||||
.menu-bars::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
background-color: white;
|
||||
border-radius: 1px;
|
||||
}
|
||||
|
||||
.menu-bars::before { top: -6px; }
|
||||
.menu-bars::after { top: 6px; }
|
||||
|
||||
/* The menu is collapsed until the toggle opens it */
|
||||
nav {
|
||||
display: none;
|
||||
width: 100%;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
|
||||
header.menu-open nav {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
nav > button.tab,
|
||||
nav > button.mode-toggle,
|
||||
nav > button.tab-action {
|
||||
flex: 1 1 auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.header-bright {
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.header-bright input[type="range"] {
|
||||
flex: 1;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
/* 16px inputs stop iOS from zooming into the page when focused */
|
||||
select,
|
||||
input[type="text"],
|
||||
input:not([type]),
|
||||
input[type="password"],
|
||||
input[type="number"],
|
||||
input[type="color"],
|
||||
input[type="file"] {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
/* Bigger touch targets */
|
||||
button,
|
||||
button.tab,
|
||||
button.tab-action,
|
||||
button.preset-edit {
|
||||
min-height: 2.75rem;
|
||||
padding: 0.5rem 0.9rem;
|
||||
}
|
||||
|
||||
button.preset-edit {
|
||||
min-height: 2.25rem;
|
||||
}
|
||||
|
||||
input[type="range"] {
|
||||
height: 1.75rem;
|
||||
}
|
||||
|
||||
.preset-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
button.preset-tile {
|
||||
height: 5.5rem;
|
||||
}
|
||||
|
||||
.row > label {
|
||||
flex: 1 1 100%;
|
||||
}
|
||||
|
||||
.row > button {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
/* The preset editor fills the screen; its buttons stack */
|
||||
.modal {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
min-height: 100%;
|
||||
max-width: none;
|
||||
margin: 0;
|
||||
border-radius: 0;
|
||||
padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
|
||||
max(1.25rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.modal-actions {
|
||||
flex-direction: column-reverse;
|
||||
justify-content: stretch;
|
||||
}
|
||||
|
||||
.modal-actions > button {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.modal-head h2 {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
button.modal-close {
|
||||
min-height: 2.75rem;
|
||||
min-width: 2.75rem;
|
||||
font-size: 1.75rem;
|
||||
}
|
||||
|
||||
/* Settings forms: the buttons span the width */
|
||||
form button {
|
||||
align-self: stretch;
|
||||
}
|
||||
|
||||
button.net {
|
||||
min-height: 2.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (hover: none) {
|
||||
/* No hover on touch screens: keep the pressed state visible instead */
|
||||
button.preset-tile:hover {
|
||||
filter: none;
|
||||
}
|
||||
|
||||
button.preset-tile:active {
|
||||
filter: brightness(1.15);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user