refactor: key colors targets → CSS source type, HA target improvements
Lint & Test / test (push) Successful in 1m26s

Key Colors refactor:
- New `key_colors` CSS source type with inline rectangles
- KeyColorsColorStripStream: extracts N colors from screen regions
- CSS editor: EntitySelect for picture source, IconSelect for color mode
- Configure Regions button on card opens pattern canvas editor
- Live WS preview at 5 FPS with rectangle overlay + color swatches
- Removed KC target type, pattern template entity, and related API routes
- Removed KC/pattern template sections from Targets tab

HA light target improvements:
- Update rate, transition, mappings, brightness VS now editable via PUT
- Card crosslinks for HA source, CSS source, brightness VS
- HA connection status icon, text metrics (Hz, uptime)
- Brightness value source selector in editor
This commit is contained in:
2026-03-28 15:28:22 +03:00
parent 89d1b13854
commit 3e6760f726
46 changed files with 2707 additions and 789 deletions
+198 -39
View File
@@ -956,11 +956,15 @@
background: none;
border: none;
cursor: pointer;
font-size: 1.1rem;
padding: 0 4px;
line-height: 1;
}
.btn-icon-inline .icon {
width: 16px;
height: 16px;
}
.btn-danger-text {
color: var(--danger-color, #f44336);
}
@@ -1474,13 +1478,17 @@
}
.gradient-stop-remove-btn {
font-size: 0.75rem;
padding: 0;
width: 26px;
height: 26px;
flex: 0 0 26px;
}
.gradient-stop-remove-btn .icon {
width: 14px;
height: 14px;
}
.gradient-stop-bidir-btn.active {
background: var(--primary-color);
color: var(--primary-contrast);
@@ -1492,6 +1500,89 @@
flex: 1;
}
/* ── HA Light Mapping rows ────────────────────────────────── */
#ha-light-mappings-list {
display: flex;
flex-direction: column;
gap: 8px;
margin-bottom: 4px;
}
.ha-light-mapping-row {
border: 1px solid var(--border-color);
border-radius: 6px;
padding: 10px;
background: var(--bg-secondary, var(--bg-color));
}
.ha-mapping-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
}
.ha-mapping-header .ha-mapping-label {
font-weight: 600;
font-size: 0.85rem;
display: flex;
align-items: center;
gap: 6px;
color: var(--text-secondary);
}
.ha-mapping-header .ha-mapping-label .icon {
width: 16px;
height: 16px;
opacity: 0.7;
}
.btn-remove-mapping {
background: none;
border: none;
color: var(--danger-color, #dc3545);
cursor: pointer;
padding: 2px 6px;
opacity: 0.7;
transition: opacity 0.15s;
}
.btn-remove-mapping .icon {
width: 16px;
height: 16px;
}
.btn-remove-mapping:hover {
opacity: 1;
}
.ha-mapping-fields {
display: flex;
flex-direction: column;
gap: 8px;
}
.ha-mapping-field label {
display: block;
font-size: 0.85rem;
margin-bottom: 3px;
color: var(--text-muted);
}
.ha-mapping-range-row {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 8px;
}
.ha-mapping-range-row label {
display: block;
font-size: 0.85rem;
margin-bottom: 3px;
color: var(--text-muted);
}
/* ── Custom gradient presets list ───────────────────────────── */
.custom-presets-list {
@@ -1547,7 +1638,6 @@
}
.color-cycle-remove-btn {
font-size: 0.6rem;
padding: 0;
width: 36px;
height: 14px;
@@ -1555,6 +1645,11 @@
line-height: 1;
}
.color-cycle-remove-btn .icon {
width: 12px;
height: 12px;
}
.color-cycle-add-btn {
width: 36px;
height: 28px;
@@ -1566,31 +1661,79 @@
/* ── Notification per-app overrides (unified color + sound) ──── */
.notif-override-row {
display: grid;
grid-template-columns: 1fr auto auto auto;
gap: 4px 4px;
align-items: center;
margin-bottom: 6px;
padding-bottom: 6px;
border-bottom: 1px solid var(--border-color);
#notification-app-overrides-list {
display: flex;
flex-direction: column;
gap: 8px;
margin-bottom: 4px;
}
.notif-override-row .notif-override-name,
.notif-override-row .notif-override-sound {
.notif-override-row {
border: 1px solid var(--border-color);
border-radius: 6px;
padding: 10px;
background: var(--bg-secondary, var(--bg-color));
}
.notif-override-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
}
.notif-override-label {
font-weight: 600;
font-size: 0.85rem;
display: flex;
align-items: center;
gap: 6px;
color: var(--text-secondary);
}
.notif-override-label .icon {
width: 16px;
height: 16px;
opacity: 0.7;
}
.btn-remove-override {
background: none;
border: none;
color: var(--danger-color, #dc3545);
cursor: pointer;
padding: 2px 6px;
opacity: 0.7;
transition: opacity 0.15s;
}
.btn-remove-override:hover {
opacity: 1;
}
.btn-remove-override .icon {
width: 16px;
height: 16px;
}
.notif-override-fields {
display: flex;
flex-direction: column;
gap: 8px;
}
.notif-override-app-row {
display: flex;
align-items: center;
gap: 6px;
}
.notif-override-app-row .notif-override-name {
flex: 1;
min-width: 0;
}
/* Sound select spans the first column, volume spans browse+color columns */
.notif-override-row .notif-override-sound {
grid-column: 1;
}
.notif-override-row .notif-override-volume {
grid-column: 2 / 4;
width: 100%;
}
.notif-override-row .notif-override-color {
.notif-override-app-row .notif-override-color {
width: 26px;
height: 26px;
border: 1px solid var(--border-color);
@@ -1598,6 +1741,24 @@
padding: 1px;
cursor: pointer;
background: transparent;
flex-shrink: 0;
}
.notif-override-sound-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 6px;
align-items: center;
}
.notif-override-sound-row .notif-override-sound,
.notif-override-sound-row .entity-select-trigger {
min-width: 0;
width: 100%;
}
.notif-override-sound-row .notif-override-volume {
width: 100%;
}
@@ -1671,7 +1832,7 @@
#composite-layers-list {
display: flex;
flex-direction: column;
gap: 6px;
gap: 8px;
margin-bottom: 8px;
}
@@ -1679,10 +1840,10 @@
display: flex;
flex-direction: column;
gap: 4px;
padding: 6px 8px;
padding: 10px;
border: 1px solid var(--border-color);
border-radius: 4px;
background: var(--card-bg);
border-radius: 6px;
background: var(--bg-secondary, var(--bg-color));
}
.composite-layer-header {
@@ -1802,22 +1963,20 @@
.composite-layer-remove-btn {
background: none;
border: none;
color: var(--text-muted);
font-size: 0.85rem;
width: 26px;
height: 26px;
flex: 0 0 26px;
display: flex;
align-items: center;
justify-content: center;
color: var(--danger-color, #dc3545);
cursor: pointer;
border-radius: 4px;
transition: color 0.2s, background 0.2s;
padding: 2px 6px;
opacity: 0.7;
transition: opacity 0.15s;
}
.composite-layer-remove-btn .icon {
width: 16px;
height: 16px;
}
.composite-layer-remove-btn:hover {
color: var(--danger-color);
background: color-mix(in srgb, var(--danger-color) 10%, transparent);
opacity: 1;
}
.composite-layer-range-toggle-label {