Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f37dbbff0 | ||
|
|
df37f15f73 | ||
|
|
9c43a0a22b | ||
|
|
d41faddfca | ||
|
|
9e2409430c | ||
|
|
5f6e45af09 | ||
|
|
cccda24448 | ||
|
|
5cca60d830 | ||
|
|
ac750a36e7 | ||
|
|
01f373f0bd | ||
|
|
d00d21e2b6 | ||
|
|
deca1b6c37 | ||
|
|
5c35e68ab2 | ||
|
|
8b6bbdeb56 | ||
|
|
09bc09cca3 | ||
|
|
e57feda131 | ||
|
|
3242aa464b | ||
|
|
72b7ba39ef | ||
|
|
c2a0cfaef4 | ||
|
|
4c3337a232 | ||
|
|
825ae1f637 | ||
|
|
14a70cb024 | ||
|
|
425511d41f | ||
|
|
3e5239f3c6 | ||
|
|
2fa02086c9 | ||
|
|
28fa71b8ad | ||
|
|
dc691b522b | ||
|
|
29d7a5bcfc | ||
|
|
e0a0e083be |
No files matched your search
@@ -0,0 +1,116 @@
|
|||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434706543}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434706552}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434707852}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434707860}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434708466}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434708474}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/create-form-fragment","targetId":""},"timestamp":1768434709765}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/create-form-fragment","targetId":""},"timestamp":1768434709787}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs","targetId":"tabs-list"},"timestamp":1768434717888}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":201,"responseURL":"http://localhost:5000/tabs","targetId":"tabs-list"},"timestamp":1768434717903}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434717904}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434717913}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434738084}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434738093}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434739031}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434739040}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434746453}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434746496}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/create-form-fragment","targetId":""},"timestamp":1768434748859}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/create-form-fragment","targetId":""},"timestamp":1768434748866}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs","targetId":"tabs-list"},"timestamp":1768434773921}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":201,"responseURL":"http://localhost:5000/tabs","targetId":"tabs-list"},"timestamp":1768434773931}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434773931}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434773940}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/create-form-fragment","targetId":""},"timestamp":1768434810105}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/create-form-fragment","targetId":""},"timestamp":1768434810119}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs","targetId":"tabs-list"},"timestamp":1768434816383}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":201,"responseURL":"http://localhost:5000/tabs","targetId":"tabs-list"},"timestamp":1768434816399}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434816400}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434816414}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434944656}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434944756}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434945369}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434945427}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434946108}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434946162}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434946680}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434946736}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/create-form-fragment","targetId":""},"timestamp":1768434947640}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/create-form-fragment","targetId":""},"timestamp":1768434947656}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs","targetId":"tabs-list"},"timestamp":1768434953064}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":201,"responseURL":"http://localhost:5000/tabs","targetId":"tabs-list"},"timestamp":1768434953079}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434953080}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768434953093}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435103720}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435103776}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435104593}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435104647}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435105158}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435105253}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435275247}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435275315}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435276178}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435276278}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435276945}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435276998}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/create-form-fragment","targetId":""},"timestamp":1768435278150}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/create-form-fragment","targetId":""},"timestamp":1768435278162}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs","targetId":"tabs-list"},"timestamp":1768435281966}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":400,"responseURL":"http://localhost:5000/tabs","targetId":"tabs-list"},"timestamp":1768435281988}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435387623}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435387680}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435388399}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435388454}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/create-form-fragment","targetId":""},"timestamp":1768435389910}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/create-form-fragment","targetId":""},"timestamp":1768435389922}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs","targetId":"tabs-list"},"timestamp":1768435393213}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs","targetId":"tabs-list"},"timestamp":1768435393231}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435393233}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435393245}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/12/content-fragment","targetId":"tab-content"},"timestamp":1768435395729}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/12/content-fragment","targetId":"tab-content"},"timestamp":1768435395748}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/13/content-fragment","targetId":"tab-content"},"timestamp":1768435396771}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/13/content-fragment","targetId":"tab-content"},"timestamp":1768435396788}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/12/content-fragment","targetId":"tab-content"},"timestamp":1768435398656}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/12/content-fragment","targetId":"tab-content"},"timestamp":1768435398674}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/13/content-fragment","targetId":"tab-content"},"timestamp":1768435399748}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/13/content-fragment","targetId":"tab-content"},"timestamp":1768435399774}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435668310}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:DOMContentLoaded","message":"palette elements presence","data":{"hasPaletteButton":true,"hasPaletteModal":false,"hasPaletteContainer":false,"hasLightingController":false},"timestamp":1768435668311}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435668355}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435669841}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:DOMContentLoaded","message":"palette elements presence","data":{"hasPaletteButton":true,"hasPaletteModal":false,"hasPaletteContainer":false,"hasLightingController":false},"timestamp":1768435669842}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435669852}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:color-palette-btn","message":"color palette button clicked","data":{"hasPaletteModal":false,"modalActive":null},"timestamp":1768435672686}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:color-palette-btn","message":"color palette button clicked","data":{"hasPaletteModal":false,"modalActive":null},"timestamp":1768435673713}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:color-palette-btn","message":"color palette button clicked","data":{"hasPaletteModal":false,"modalActive":null},"timestamp":1768435674316}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:color-palette-btn","message":"color palette button clicked","data":{"hasPaletteModal":false,"modalActive":null},"timestamp":1768435674560}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:color-palette-btn","message":"color palette button clicked","data":{"hasPaletteModal":false,"modalActive":null},"timestamp":1768435680419}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:color-palette-btn","message":"color palette button clicked","data":{"hasPaletteModal":false,"modalActive":null},"timestamp":1768435680897}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435814285}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:DOMContentLoaded","message":"palette elements presence","data":{"hasPaletteButton":true,"hasPaletteModal":true,"hasPaletteContainer":false,"hasLightingController":false},"timestamp":1768435814287}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H3","location":"src/static/color_palette.js:DOMContentLoaded","message":"palette script loaded","data":{"hasButton":true,"hasModal":true,"hasClose":true},"timestamp":1768435814287}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435814350}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435815080}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H3","location":"src/static/color_palette.js:DOMContentLoaded","message":"palette script loaded","data":{"hasButton":true,"hasModal":true,"hasClose":true},"timestamp":1768435815081}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:DOMContentLoaded","message":"palette elements presence","data":{"hasPaletteButton":true,"hasPaletteModal":true,"hasPaletteContainer":false,"hasLightingController":false},"timestamp":1768435815082}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435815135}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435815724}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H3","location":"src/static/color_palette.js:DOMContentLoaded","message":"palette script loaded","data":{"hasButton":true,"hasModal":true,"hasClose":true},"timestamp":1768435815725}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:DOMContentLoaded","message":"palette elements presence","data":{"hasPaletteButton":true,"hasPaletteModal":true,"hasPaletteContainer":false,"hasLightingController":false},"timestamp":1768435815725}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435815778}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H4","location":"src/static/color_palette.js:openModal","message":"palette modal opened","data":{"active":true},"timestamp":1768435817104}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:color-palette-btn","message":"color palette button clicked","data":{"hasPaletteModal":true,"modalActive":true},"timestamp":1768435817105}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H4","location":"src/static/color_palette.js:closeModal","message":"palette modal closed","data":{"active":false},"timestamp":1768435820180}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435931118}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:DOMContentLoaded","message":"palette elements presence","data":{"hasPaletteButton":true,"hasPaletteModal":true,"hasPaletteContainer":true,"hasLightingController":false},"timestamp":1768435931120}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H3","location":"src/static/color_palette.js:DOMContentLoaded","message":"palette script loaded","data":{"hasButton":true,"hasModal":true,"hasClose":true,"hasContainer":true,"hasAddButton":true},"timestamp":1768435931119}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435931173}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:htmx:beforeRequest","message":"htmx request","data":{"path":"/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435931791}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H1","location":"src/templates/index.html:DOMContentLoaded","message":"palette elements presence","data":{"hasPaletteButton":true,"hasPaletteModal":true,"hasPaletteContainer":true,"hasLightingController":false},"timestamp":1768435931793}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H3","location":"src/static/color_palette.js:DOMContentLoaded","message":"palette script loaded","data":{"hasButton":true,"hasModal":true,"hasClose":true,"hasContainer":true,"hasAddButton":true},"timestamp":1768435931793}
|
||||||
|
{"sessionId":"debug-session","runId":"tabs-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:htmx:afterRequest","message":"htmx response","data":{"status":200,"responseURL":"http://localhost:5000/tabs/list-fragment","targetId":"tabs-list"},"timestamp":1768435931895}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H2","location":"src/templates/index.html:color-palette-btn","message":"color palette button clicked","data":{"hasPaletteModal":true,"modalActive":true},"timestamp":1768435933111}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H4","location":"src/static/color_palette.js:openModal","message":"palette modal opened","data":{"active":true},"timestamp":1768435933110}
|
||||||
|
{"sessionId":"debug-session","runId":"palette-pre-fix","hypothesisId":"H4","location":"src/static/color_palette.js:closeModal","message":"palette modal closed","data":{"active":false},"timestamp":1768435943332}
|
||||||
@@ -0,0 +1,235 @@
|
|||||||
|
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 19 November 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software.
|
||||||
|
|
||||||
|
A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public.
|
||||||
|
|
||||||
|
The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version.
|
||||||
|
|
||||||
|
An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
led-controller
|
||||||
|
Copyright (C) 2025 technicalkiwi
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see <http://www.gnu.org/licenses/>.
|
||||||
@@ -4,11 +4,17 @@ verify_ssl = true
|
|||||||
name = "pypi"
|
name = "pypi"
|
||||||
|
|
||||||
[packages]
|
[packages]
|
||||||
fastapi = "*"
|
mpremote = "*"
|
||||||
uvicorn = "*"
|
pyserial = "*"
|
||||||
jinja2 = "*"
|
esptool = "*"
|
||||||
|
pyjwt = "*"
|
||||||
|
watchfiles = "*"
|
||||||
|
|
||||||
[dev-packages]
|
[dev-packages]
|
||||||
|
|
||||||
[requires]
|
[requires]
|
||||||
python_version = "3.12"
|
python_version = "3.12"
|
||||||
|
|
||||||
|
[scripts]
|
||||||
|
web = "python /home/pi/led-controller/tests/web.py"
|
||||||
|
watch = "python -m watchfiles 'python /home/pi/led-controller/tests/web.py' /home/pi/led-controller/src /home/pi/led-controller/tests"
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"hash": {
|
"hash": {
|
||||||
"sha256": "12e13c349bc30c36612e452e3ee8b8f2f05b156bb788515a14a94f70aed33cf2"
|
"sha256": "24a0e63d49a769fb2bbc35d7d361aeb0c8563f2d65cbeb24acfae9e183d1c0ca"
|
||||||
},
|
},
|
||||||
"pipfile-spec": 6,
|
"pipfile-spec": 6,
|
||||||
"requires": {
|
"requires": {
|
||||||
@@ -16,284 +16,599 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"default": {
|
"default": {
|
||||||
"annotated-types": {
|
|
||||||
"hashes": [
|
|
||||||
"sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53",
|
|
||||||
"sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"
|
|
||||||
],
|
|
||||||
"markers": "python_version >= '3.8'",
|
|
||||||
"version": "==0.7.0"
|
|
||||||
},
|
|
||||||
"anyio": {
|
"anyio": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:673c0c244e15788651a4ff38710fea9675823028a6f08a5eda409e0c9840a028",
|
"sha256:41cfcc3a4c85d3f05c932da7c26d0201ac36f72abd4435ba90d0464a3ffed703",
|
||||||
"sha256:9f76d541cad6e36af7beb62e978876f3b41e3e04f2c1fbf0884604c0a9c4d93c"
|
"sha256:d405828884fc140aa80a3c667b8beed277f1dfedec42ba031bd6ac3db606ab6c"
|
||||||
],
|
],
|
||||||
"markers": "python_version >= '3.9'",
|
"markers": "python_version >= '3.9'",
|
||||||
"version": "==4.9.0"
|
"version": "==4.12.1"
|
||||||
|
},
|
||||||
|
"bitarray": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:004d518fa410e6da43386d20e07b576a41eb417ac67abf9f30fa75e125697199",
|
||||||
|
"sha256:014df8a9430276862392ac5d471697de042367996c49f32d0008585d2c60755a",
|
||||||
|
"sha256:01c5f0dc080b0ebb432f7a68ee1e88a76bd34f6d89c9568fcec65fb16ed71f0e",
|
||||||
|
"sha256:025d133bf4ca8cf75f904eeb8ea946228d7c043231866143f31946a6f4dd0bf3",
|
||||||
|
"sha256:0ca70ccf789446a6dfde40b482ec21d28067172cd1f8efd50d5548159fccad9e",
|
||||||
|
"sha256:0df69d26f21a9d2f1b20266f6737fa43f08aa5015c99900fb69f255fbe4dabb4",
|
||||||
|
"sha256:0f8069a807a3e6e3c361ce302ece4bf1c3b49962c1726d1d56587e8f48682861",
|
||||||
|
"sha256:15a2eff91f54d2b1f573cca8ca6fb58763ce8fea80e7899ab028f3987ef71cd5",
|
||||||
|
"sha256:15e8d0597cc6e8496de6f4dea2a6880c57e1251502a7072f5631108a1aa28521",
|
||||||
|
"sha256:165052a0e61c880f7093808a0c524ce1b3555bfa114c0dfb5c809cd07918a60d",
|
||||||
|
"sha256:178c5a4c7fdfb5cd79e372ae7f675390e670f3732e5bc68d327e01a5b3ff8d55",
|
||||||
|
"sha256:18214bac86341f1cc413772e66447d6cca10981e2880b70ecaf4e826c04f95e9",
|
||||||
|
"sha256:1a54d7e7999735faacdcbe8128e30207abc2caf9f9fd7102d180b32f1b78bfce",
|
||||||
|
"sha256:1a926fa554870642607fd10e66ee25b75fdd9a7ca4bbffa93d424e4ae2bf734a",
|
||||||
|
"sha256:1c8f2a5d8006db5a555e06f9437e76bf52537d3dfd130cb8ae2b30866aca32c9",
|
||||||
|
"sha256:21ca6a47bf20db9e7ad74ca04b3d479e4d76109b68333eb23535553d2705339e",
|
||||||
|
"sha256:22c540ed20167d3dbb1e2d868ca935180247d620c40eace90efa774504a40e3b",
|
||||||
|
"sha256:239578587b9c29469ab61149dda40a2fe714a6a4eca0f8ff9ea9439ec4b7bc30",
|
||||||
|
"sha256:25b9cff6c9856bc396232e2f609ea0c5ec1a8a24c500cee4cca96ba8a3cd50b6",
|
||||||
|
"sha256:26714898eb0d847aac8af94c4441c9cb50387847d0fe6b9fc4217c086cd68b80",
|
||||||
|
"sha256:28a85b056c0eb7f5d864c0ceef07034117e8ebfca756f50648c71950a568ba11",
|
||||||
|
"sha256:2a3d1b05ffdd3e95687942ae7b13c63689f85d3f15c39b33329e3cb9ce6c015f",
|
||||||
|
"sha256:2c3bb96b6026643ce24677650889b09073f60b9860a71765f843c99f9ab38b25",
|
||||||
|
"sha256:2fa23fdb3beab313950bbb49674e8a161e61449332d3997089fe3944953f1b77",
|
||||||
|
"sha256:2fe8c54b15a9cd4f93bc2aaceab354ec65af93370aa1496ba2f9c537a4855ee0",
|
||||||
|
"sha256:30989a2451b693c3f9359d91098a744992b5431a0be4858f1fdf0ec76b457125",
|
||||||
|
"sha256:31a4ad2b730128e273f1c22300da3e3631f125703e4fee0ac44d385abfb15671",
|
||||||
|
"sha256:337c8cd46a4c6568d367ed676cbf2d7de16f890bb31dbb54c44c1d6bb6d4a1de",
|
||||||
|
"sha256:33af25c4ff7723363cb8404dfc2eefeab4110b654f6c98d26aba8a08c745d860",
|
||||||
|
"sha256:3ea52df96566457735314794422274bd1962066bfb609e7eea9113d70cf04ffe",
|
||||||
|
"sha256:3eae38daffd77c9621ae80c16932eea3fb3a4af141fb7cc724d4ad93eff9210d",
|
||||||
|
"sha256:41b53711f89008ba2de62e4c2d2260a8b357072fd4f18e1351b28955db2719dc",
|
||||||
|
"sha256:451f9958850ea98440d542278368c8d1e1ea821e2494b204570ba34a340759df",
|
||||||
|
"sha256:46cf239856b87fe1c86dfbb3d459d840a8b1649e7922b1e0bfb6b6464692644a",
|
||||||
|
"sha256:4779f356083c62e29b4198d290b7b17a39a69702d150678b7efff0fdddf494a8",
|
||||||
|
"sha256:4902f4ecd5fcb6a5f482d7b0ae1c16c21f26fc5279b3b6127363d13ad8e7a9d9",
|
||||||
|
"sha256:4d73d4948dcc5591d880db8933004e01f1dd2296df9de815354d53469beb26fe",
|
||||||
|
"sha256:4d9984017314da772f5f7460add7a0301a4ffc06c72c2998bb16c300a6253607",
|
||||||
|
"sha256:4f298daaaea58d45e245a132d6d2bdfb6f856da50dc03d75ebb761439fb626cf",
|
||||||
|
"sha256:50ddbe3a7b4b6ab96812f5a4d570f401a2cdb95642fd04c062f98939610bbeee",
|
||||||
|
"sha256:5338a313f998e1be7267191b7caaae82563b4a2b42b393561055412a34042caa",
|
||||||
|
"sha256:5591daf81313096909d973fb2612fccd87528fdfdd39f6478bdce54543178954",
|
||||||
|
"sha256:56896ceeffe25946c4010320629e2d858ca763cd8ded273c81672a5edbcb1e0a",
|
||||||
|
"sha256:58a01ea34057463f7a98a4d6ff40160f65f945e924fec08a5b39e327e372875d",
|
||||||
|
"sha256:5bfac7f236ba1a4d402644bdce47fb9db02a7cf3214a1f637d3a88390f9e5428",
|
||||||
|
"sha256:5c5a8a83df95e51f7a7c2b083eaea134cbed39fc42c6aeb2e764ddb7ccccd43e",
|
||||||
|
"sha256:5f2fb10518f6b365f5b720e43a529c3b2324ca02932f609631a44edb347d8d54",
|
||||||
|
"sha256:64af877116edf051375b45f0bda648143176a017b13803ec7b3a3111dc05f4c5",
|
||||||
|
"sha256:6d70fa9c6d2e955bde8cd327ffc11f2cc34bc21944e5571a46ca501e7eadef24",
|
||||||
|
"sha256:6d79f659965290af60d6acc8e2716341865fe74609a7ede2a33c2f86ad893b8f",
|
||||||
|
"sha256:720963fee259291a88348ae9735d9deb5d334e84a016244f61c89f5a49aa400a",
|
||||||
|
"sha256:75a3b6e9c695a6570ea488db75b84bb592ff70a944957efa1c655867c575018b",
|
||||||
|
"sha256:792462abfeeca6cc8c6c1e6d27e14319682f0182f6b0ba37befe911af794db70",
|
||||||
|
"sha256:79ec4498a545733ecace48d780d22407411b07403a2e08b9a4d7596c0b97ebd7",
|
||||||
|
"sha256:7f14d6b303e55bd7d19b28309ef8014370e84a3806c5e452e078e7df7344d97a",
|
||||||
|
"sha256:7f65bd5d4cdb396295b6aa07f84ca659ac65c5c68b53956a6d95219e304b0ada",
|
||||||
|
"sha256:81c6b4a6c1af800d52a6fa32389ef8f4281583f4f99dc1a40f2bb47667281541",
|
||||||
|
"sha256:82a07de83dce09b4fa1bccbdc8bde8f188b131666af0dc9048ba0a0e448d8a3b",
|
||||||
|
"sha256:847c7f61964225fc489fe1d49eda7e0e0d253e98862c012cecf845f9ad45cdf4",
|
||||||
|
"sha256:84b52b2cf77bb7f703d16c4007b021078dbbe6cf8ffb57abe81a7bacfc175ef2",
|
||||||
|
"sha256:86685fa04067f7175f9718489ae755f6acde03593a1a9ca89305554af40e14fd",
|
||||||
|
"sha256:8a9c962c64a4c08def58b9799333e33af94ec53038cf151d36edacdb41f81646",
|
||||||
|
"sha256:8cbd4bfc933b33b85c43ef4c1f4d5e3e9d91975ea6368acf5fbac02bac06ea89",
|
||||||
|
"sha256:8ffe660e963ae711cb9e2b8d8461c9b1ad6167823837fc17d59d5e539fb898fa",
|
||||||
|
"sha256:94652da1a4ca7cfb69c15dd6986b205e0bd9c63a05029c3b48b4201085f527bd",
|
||||||
|
"sha256:969fd67de8c42affdb47b38b80f1eaa79ac0ef17d65407cdd931db1675315af1",
|
||||||
|
"sha256:9858dcbc23ba7eaadcd319786b982278a1a2b2020720b19db43e309579ff76fb",
|
||||||
|
"sha256:99d25aff3745c54e61ab340b98400c52ebec04290a62078155e0d7eb30380220",
|
||||||
|
"sha256:99f55e14e7c56f4fafe1343480c32b110ef03836c21ff7c48bae7add6818f77c",
|
||||||
|
"sha256:9d35d8f8a1c9ed4e2b08187b513f8a3c71958600129db3aa26d85ea3abfd1310",
|
||||||
|
"sha256:a2ba92f59e30ce915e9e79af37649432e3a212ddddf416d4d686b1b4825bcdb2",
|
||||||
|
"sha256:a2cb35a6efaa0e3623d8272471371a12c7e07b51a33e5efce9b58f655d864b4e",
|
||||||
|
"sha256:a358277122456666a8b2a0b9aa04f1b89d34e8aa41d08a6557d693e6abb6667c",
|
||||||
|
"sha256:a60da2f9efbed355edb35a1fb6829148676786c829fad708bb6bb47211b3593a",
|
||||||
|
"sha256:aa7dec53c25f1949513457ef8b0ea1fb40e76c672cc4d2daa8ad3c8d6b73491a",
|
||||||
|
"sha256:b1572ee0eb1967e71787af636bb7d1eb9c6735d5337762c450650e7f51844594",
|
||||||
|
"sha256:b4f10d3f304be7183fac79bf2cd997f82e16aa9a9f37343d76c026c6e435a8a8",
|
||||||
|
"sha256:bbbbfbb7d039b20d289ce56b1beb46138d65769d04af50c199c6ac4cb6054d52",
|
||||||
|
"sha256:c394a3f055b49f92626f83c1a0b6d6cd2c628f1ccd72481c3e3c6aa4695f3b20",
|
||||||
|
"sha256:c396358023b876cff547ce87f4e8ff8a2280598873a137e8cc69e115262260b8",
|
||||||
|
"sha256:c5ba07e58fd98c9782201e79eb8dd4225733d212a5a3700f9a84d329bd0463a6",
|
||||||
|
"sha256:c764fb167411d5afaef88138542a4bfa28bd5e5ded5e8e42df87cef965efd6e9",
|
||||||
|
"sha256:cbba763d99de0255a3e4938f25a8579930ac8aa089233cb2fb2ed7d04d4aff02",
|
||||||
|
"sha256:cbd1660fb48827381ce3a621a4fdc237959e1cd4e98b098952a8f624a0726425",
|
||||||
|
"sha256:cd761d158f67e288fd0ebe00c3b158095ce80a4bc7c32b60c7121224003ba70d",
|
||||||
|
"sha256:cdfbb27f2c46bb5bbdcee147530cbc5ca8ab858d7693924e88e30ada21b2c5e2",
|
||||||
|
"sha256:d2dbe8a3baf2d842e342e8acb06ae3844765d38df67687c144cdeb71f1bcb5d7",
|
||||||
|
"sha256:d5c931ec1c03111718cabf85f6012bb2815fa0ce578175567fa8d6f2cc15d3b4",
|
||||||
|
"sha256:df6d7bf3e15b7e6e202a16ff4948a51759354016026deb04ab9b5acbbe35e096",
|
||||||
|
"sha256:dfbe2aa45b273f49e715c5345d94874cb65a28482bf231af408891c260601b8d",
|
||||||
|
"sha256:e12769d3adcc419e65860de946df8d2ed274932177ac1cdb05186e498aaa9149",
|
||||||
|
"sha256:e5aed4754895942ae15ffa48c52d181e1c1463236fda68d2dba29c03aa61786b",
|
||||||
|
"sha256:e645b4c365d6f1f9e0799380ad6395268f3c3b898244a650aaeb8d9d27b74c35",
|
||||||
|
"sha256:ed3493a369fe849cce98542d7405c88030b355e4d2e113887cb7ecc86c205773",
|
||||||
|
"sha256:f08342dc8d19214faa7ef99574dea6c37a2790d6d04a9793ef8fa76c188dc08d",
|
||||||
|
"sha256:f0a55cf02d2cdd739b40ce10c09bbdd520e141217696add7a48b56e67bdfdfe6",
|
||||||
|
"sha256:f0ce9d9e07c75da8027c62b4c9f45771d1d8aae7dc9ad7fb606c6a5aedbe9741",
|
||||||
|
"sha256:f1f723e260c35e1c7c57a09d3a6ebe681bd56c83e1208ae3ce1869b7c0d10d4f",
|
||||||
|
"sha256:f2fcbe9b3a5996b417e030aa33a562e7e20dfc86271e53d7e841fc5df16268b8",
|
||||||
|
"sha256:f3fd8df63c41ff6a676d031956aebf68ebbc687b47c507da25501eb22eec341f",
|
||||||
|
"sha256:f8d3417db5e14a6789073b21ae44439a755289477901901bae378a57b905e148",
|
||||||
|
"sha256:fbf05678c2ae0064fb1b8de7e9e8f0fc30621b73c8477786dd0fb3868044a8c8",
|
||||||
|
"sha256:fc98ff43abad61f00515ad9a06213b7716699146e46eabd256cdfe7cb522bd97",
|
||||||
|
"sha256:ff1863f037dad765ef5963efc2e37d399ac023e192a6f2bb394e2377d023cefe"
|
||||||
|
],
|
||||||
|
"version": "==3.8.0"
|
||||||
|
},
|
||||||
|
"bitstring": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:69d1587f0ac18dc7d93fc7e80d5f447161a33e57027e726dc18a0a8bacf1711a",
|
||||||
|
"sha256:a08bc09d3857216d4c0f412a1611056f1cc2b64fd254fb1e8a0afba7cfa1a95a"
|
||||||
|
],
|
||||||
|
"markers": "python_version >= '3.8'",
|
||||||
|
"version": "==4.3.1"
|
||||||
|
},
|
||||||
|
"cffi": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:00bdf7acc5f795150faa6957054fbbca2439db2f775ce831222b66f192f03beb",
|
||||||
|
"sha256:07b271772c100085dd28b74fa0cd81c8fb1a3ba18b21e03d7c27f3436a10606b",
|
||||||
|
"sha256:087067fa8953339c723661eda6b54bc98c5625757ea62e95eb4898ad5e776e9f",
|
||||||
|
"sha256:0a1527a803f0a659de1af2e1fd700213caba79377e27e4693648c2923da066f9",
|
||||||
|
"sha256:0cf2d91ecc3fcc0625c2c530fe004f82c110405f101548512cce44322fa8ac44",
|
||||||
|
"sha256:0f6084a0ea23d05d20c3edcda20c3d006f9b6f3fefeac38f59262e10cef47ee2",
|
||||||
|
"sha256:12873ca6cb9b0f0d3a0da705d6086fe911591737a59f28b7936bdfed27c0d47c",
|
||||||
|
"sha256:19f705ada2530c1167abacb171925dd886168931e0a7b78f5bffcae5c6b5be75",
|
||||||
|
"sha256:1cd13c99ce269b3ed80b417dcd591415d3372bcac067009b6e0f59c7d4015e65",
|
||||||
|
"sha256:1e3a615586f05fc4065a8b22b8152f0c1b00cdbc60596d187c2a74f9e3036e4e",
|
||||||
|
"sha256:1f72fb8906754ac8a2cc3f9f5aaa298070652a0ffae577e0ea9bd480dc3c931a",
|
||||||
|
"sha256:1fc9ea04857caf665289b7a75923f2c6ed559b8298a1b8c49e59f7dd95c8481e",
|
||||||
|
"sha256:203a48d1fb583fc7d78a4c6655692963b860a417c0528492a6bc21f1aaefab25",
|
||||||
|
"sha256:2081580ebb843f759b9f617314a24ed5738c51d2aee65d31e02f6f7a2b97707a",
|
||||||
|
"sha256:21d1152871b019407d8ac3985f6775c079416c282e431a4da6afe7aefd2bccbe",
|
||||||
|
"sha256:24b6f81f1983e6df8db3adc38562c83f7d4a0c36162885ec7f7b77c7dcbec97b",
|
||||||
|
"sha256:256f80b80ca3853f90c21b23ee78cd008713787b1b1e93eae9f3d6a7134abd91",
|
||||||
|
"sha256:28a3a209b96630bca57cce802da70c266eb08c6e97e5afd61a75611ee6c64592",
|
||||||
|
"sha256:2c8f814d84194c9ea681642fd164267891702542f028a15fc97d4674b6206187",
|
||||||
|
"sha256:2de9a304e27f7596cd03d16f1b7c72219bd944e99cc52b84d0145aefb07cbd3c",
|
||||||
|
"sha256:38100abb9d1b1435bc4cc340bb4489635dc2f0da7456590877030c9b3d40b0c1",
|
||||||
|
"sha256:3925dd22fa2b7699ed2617149842d2e6adde22b262fcbfada50e3d195e4b3a94",
|
||||||
|
"sha256:3e17ed538242334bf70832644a32a7aae3d83b57567f9fd60a26257e992b79ba",
|
||||||
|
"sha256:3e837e369566884707ddaf85fc1744b47575005c0a229de3327f8f9a20f4efeb",
|
||||||
|
"sha256:3f4d46d8b35698056ec29bca21546e1551a205058ae1a181d871e278b0b28165",
|
||||||
|
"sha256:44d1b5909021139fe36001ae048dbdde8214afa20200eda0f64c068cac5d5529",
|
||||||
|
"sha256:45d5e886156860dc35862657e1494b9bae8dfa63bf56796f2fb56e1679fc0bca",
|
||||||
|
"sha256:4647afc2f90d1ddd33441e5b0e85b16b12ddec4fca55f0d9671fef036ecca27c",
|
||||||
|
"sha256:4671d9dd5ec934cb9a73e7ee9676f9362aba54f7f34910956b84d727b0d73fb6",
|
||||||
|
"sha256:53f77cbe57044e88bbd5ed26ac1d0514d2acf0591dd6bb02a3ae37f76811b80c",
|
||||||
|
"sha256:5eda85d6d1879e692d546a078b44251cdd08dd1cfb98dfb77b670c97cee49ea0",
|
||||||
|
"sha256:5fed36fccc0612a53f1d4d9a816b50a36702c28a2aa880cb8a122b3466638743",
|
||||||
|
"sha256:61d028e90346df14fedc3d1e5441df818d095f3b87d286825dfcbd6459b7ef63",
|
||||||
|
"sha256:66f011380d0e49ed280c789fbd08ff0d40968ee7b665575489afa95c98196ab5",
|
||||||
|
"sha256:6824f87845e3396029f3820c206e459ccc91760e8fa24422f8b0c3d1731cbec5",
|
||||||
|
"sha256:6c6c373cfc5c83a975506110d17457138c8c63016b563cc9ed6e056a82f13ce4",
|
||||||
|
"sha256:6d02d6655b0e54f54c4ef0b94eb6be0607b70853c45ce98bd278dc7de718be5d",
|
||||||
|
"sha256:6d50360be4546678fc1b79ffe7a66265e28667840010348dd69a314145807a1b",
|
||||||
|
"sha256:730cacb21e1bdff3ce90babf007d0a0917cc3e6492f336c2f0134101e0944f93",
|
||||||
|
"sha256:737fe7d37e1a1bffe70bd5754ea763a62a066dc5913ca57e957824b72a85e205",
|
||||||
|
"sha256:74a03b9698e198d47562765773b4a8309919089150a0bb17d829ad7b44b60d27",
|
||||||
|
"sha256:7553fb2090d71822f02c629afe6042c299edf91ba1bf94951165613553984512",
|
||||||
|
"sha256:7a66c7204d8869299919db4d5069a82f1561581af12b11b3c9f48c584eb8743d",
|
||||||
|
"sha256:7cc09976e8b56f8cebd752f7113ad07752461f48a58cbba644139015ac24954c",
|
||||||
|
"sha256:81afed14892743bbe14dacb9e36d9e0e504cd204e0b165062c488942b9718037",
|
||||||
|
"sha256:8941aaadaf67246224cee8c3803777eed332a19d909b47e29c9842ef1e79ac26",
|
||||||
|
"sha256:89472c9762729b5ae1ad974b777416bfda4ac5642423fa93bd57a09204712322",
|
||||||
|
"sha256:8ea985900c5c95ce9db1745f7933eeef5d314f0565b27625d9a10ec9881e1bfb",
|
||||||
|
"sha256:8eca2a813c1cb7ad4fb74d368c2ffbbb4789d377ee5bb8df98373c2cc0dee76c",
|
||||||
|
"sha256:92b68146a71df78564e4ef48af17551a5ddd142e5190cdf2c5624d0c3ff5b2e8",
|
||||||
|
"sha256:9332088d75dc3241c702d852d4671613136d90fa6881da7d770a483fd05248b4",
|
||||||
|
"sha256:94698a9c5f91f9d138526b48fe26a199609544591f859c870d477351dc7b2414",
|
||||||
|
"sha256:9a67fc9e8eb39039280526379fb3a70023d77caec1852002b4da7e8b270c4dd9",
|
||||||
|
"sha256:9de40a7b0323d889cf8d23d1ef214f565ab154443c42737dfe52ff82cf857664",
|
||||||
|
"sha256:a05d0c237b3349096d3981b727493e22147f934b20f6f125a3eba8f994bec4a9",
|
||||||
|
"sha256:afb8db5439b81cf9c9d0c80404b60c3cc9c3add93e114dcae767f1477cb53775",
|
||||||
|
"sha256:b18a3ed7d5b3bd8d9ef7a8cb226502c6bf8308df1525e1cc676c3680e7176739",
|
||||||
|
"sha256:b1e74d11748e7e98e2f426ab176d4ed720a64412b6a15054378afdb71e0f37dc",
|
||||||
|
"sha256:b21e08af67b8a103c71a250401c78d5e0893beff75e28c53c98f4de42f774062",
|
||||||
|
"sha256:b4c854ef3adc177950a8dfc81a86f5115d2abd545751a304c5bcf2c2c7283cfe",
|
||||||
|
"sha256:b882b3df248017dba09d6b16defe9b5c407fe32fc7c65a9c69798e6175601be9",
|
||||||
|
"sha256:baf5215e0ab74c16e2dd324e8ec067ef59e41125d3eade2b863d294fd5035c92",
|
||||||
|
"sha256:c649e3a33450ec82378822b3dad03cc228b8f5963c0c12fc3b1e0ab940f768a5",
|
||||||
|
"sha256:c654de545946e0db659b3400168c9ad31b5d29593291482c43e3564effbcee13",
|
||||||
|
"sha256:c6638687455baf640e37344fe26d37c404db8b80d037c3d29f58fe8d1c3b194d",
|
||||||
|
"sha256:c8d3b5532fc71b7a77c09192b4a5a200ea992702734a2e9279a37f2478236f26",
|
||||||
|
"sha256:cb527a79772e5ef98fb1d700678fe031e353e765d1ca2d409c92263c6d43e09f",
|
||||||
|
"sha256:cf364028c016c03078a23b503f02058f1814320a56ad535686f90565636a9495",
|
||||||
|
"sha256:d48a880098c96020b02d5a1f7d9251308510ce8858940e6fa99ece33f610838b",
|
||||||
|
"sha256:d68b6cef7827e8641e8ef16f4494edda8b36104d79773a334beaa1e3521430f6",
|
||||||
|
"sha256:d9b29c1f0ae438d5ee9acb31cadee00a58c46cc9c0b2f9038c6b0b3470877a8c",
|
||||||
|
"sha256:d9b97165e8aed9272a6bb17c01e3cc5871a594a446ebedc996e2397a1c1ea8ef",
|
||||||
|
"sha256:da68248800ad6320861f129cd9c1bf96ca849a2771a59e0344e88681905916f5",
|
||||||
|
"sha256:da902562c3e9c550df360bfa53c035b2f241fed6d9aef119048073680ace4a18",
|
||||||
|
"sha256:dbd5c7a25a7cb98f5ca55d258b103a2054f859a46ae11aaf23134f9cc0d356ad",
|
||||||
|
"sha256:dd4f05f54a52fb558f1ba9f528228066954fee3ebe629fc1660d874d040ae5a3",
|
||||||
|
"sha256:de8dad4425a6ca6e4e5e297b27b5c824ecc7581910bf9aee86cb6835e6812aa7",
|
||||||
|
"sha256:e11e82b744887154b182fd3e7e8512418446501191994dbf9c9fc1f32cc8efd5",
|
||||||
|
"sha256:e6e73b9e02893c764e7e8d5bb5ce277f1a009cd5243f8228f75f842bf937c534",
|
||||||
|
"sha256:f73b96c41e3b2adedc34a7356e64c8eb96e03a3782b535e043a986276ce12a49",
|
||||||
|
"sha256:f93fd8e5c8c0a4aa1f424d6173f14a892044054871c771f8566e4008eaa359d2",
|
||||||
|
"sha256:fc33c5141b55ed366cfaad382df24fe7dcbc686de5be719b207bb248e3053dc5",
|
||||||
|
"sha256:fc7de24befaeae77ba923797c7c87834c73648a05a4bde34b3b7e5588973a453",
|
||||||
|
"sha256:fe562eb1a64e67dd297ccc4f5addea2501664954f2692b69a76449ec7913ecbf"
|
||||||
|
],
|
||||||
|
"markers": "python_full_version >= '3.9' and platform_python_implementation != 'PyPy'",
|
||||||
|
"version": "==2.0.0"
|
||||||
},
|
},
|
||||||
"click": {
|
"click": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:27c491cc05d968d271d5a1db13e3b5a184636d9d930f148c50b038f0d0646202",
|
"sha256:12ff4785d337a1bb490bb7e9c2b1ee5da3112e94a8622f26a6c77f5d2fc6842a",
|
||||||
"sha256:61a3265b914e850b85317d0b3109c7f8cd35a670f963866005d6ef1d5175a12b"
|
"sha256:981153a64e25f12d547d3426c367a4857371575ee7ad18df2a6183ab0545b2a6"
|
||||||
],
|
],
|
||||||
"markers": "python_version >= '3.10'",
|
"markers": "python_version >= '3.10'",
|
||||||
"version": "==8.2.1"
|
"version": "==8.3.1"
|
||||||
},
|
},
|
||||||
"fastapi": {
|
"cryptography": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:1e2c2a2646905f9e83d32f04a3f86aff4a286669c6c950ca95b5fd68c2602681",
|
"sha256:00a5e7e87938e5ff9ff5447ab086a5706a957137e6e433841e9d24f38a065217",
|
||||||
"sha256:e94613d6c05e27be7ffebdd6ea5f388112e5e430c8f7d6494a9d1d88d43e814d"
|
"sha256:01ca9ff2885f3acc98c29f1860552e37f6d7c7d013d7334ff2a9de43a449315d",
|
||||||
|
"sha256:09859af8466b69bc3c27bdf4f5d84a665e0f7ab5088412e9e2ec49758eca5cbc",
|
||||||
|
"sha256:0abf1ffd6e57c67e92af68330d05760b7b7efb243aab8377e583284dbab72c71",
|
||||||
|
"sha256:1000713389b75c449a6e979ffc7dcc8ac90b437048766cef052d4d30b8220971",
|
||||||
|
"sha256:109d4ddfadf17e8e7779c39f9b18111a09efb969a301a31e987416a0191ed93a",
|
||||||
|
"sha256:10b01676fc208c3e6feeb25a8b83d81767e8059e1fe86e1dc62d10a3018fa926",
|
||||||
|
"sha256:10ca84c4668d066a9878890047f03546f3ae0a6b8b39b697457b7757aaf18dbc",
|
||||||
|
"sha256:15ab9b093e8f09daab0f2159bb7e47532596075139dd74365da52ecc9cb46c5d",
|
||||||
|
"sha256:191bb60a7be5e6f54e30ba16fdfae78ad3a342a0599eb4193ba88e3f3d6e185b",
|
||||||
|
"sha256:22d7e97932f511d6b0b04f2bfd818d73dcd5928db509460aaf48384778eb6d20",
|
||||||
|
"sha256:23b1a8f26e43f47ceb6d6a43115f33a5a37d57df4ea0ca295b780ae8546e8044",
|
||||||
|
"sha256:36e627112085bb3b81b19fed209c05ce2a52ee8b15d161b7c643a7d5a88491f3",
|
||||||
|
"sha256:39b6755623145ad5eff1dab323f4eae2a32a77a7abef2c5089a04a3d04366715",
|
||||||
|
"sha256:3b51b8ca4f1c6453d8829e1eb7299499ca7f313900dd4d89a24b8b87c0a780d4",
|
||||||
|
"sha256:402b58fc32614f00980b66d6e56a5b4118e6cb362ae8f3fda141ba4689bd4506",
|
||||||
|
"sha256:416260257577718c05135c55958b674000baef9a1c7d9e8f306ec60d71db850f",
|
||||||
|
"sha256:46acf53b40ea38f9c6c229599a4a13f0d46a6c3fa9ef19fc1a124d62e338dfa0",
|
||||||
|
"sha256:4b7387121ac7d15e550f5cb4a43aef2559ed759c35df7336c402bb8275ac9683",
|
||||||
|
"sha256:50fc3343ac490c6b08c0cf0d704e881d0d660be923fd3076db3e932007e726e3",
|
||||||
|
"sha256:516ea134e703e9fe26bcd1277a4b59ad30586ea90c365a87781d7887a646fe21",
|
||||||
|
"sha256:549e234ff32571b1f4076ac269fcce7a808d3bf98b76c8dd560e42dbc66d7d91",
|
||||||
|
"sha256:5d7f93296ee28f68447397bf5198428c9aeeab45705a55d53a6343455dcb2c3c",
|
||||||
|
"sha256:5ecfccd2329e37e9b7112a888e76d9feca2347f12f37918facbb893d7bb88ee8",
|
||||||
|
"sha256:6276eb85ef938dc035d59b87c8a7dc559a232f954962520137529d77b18ff1df",
|
||||||
|
"sha256:6b5063083824e5509fdba180721d55909ffacccc8adbec85268b48439423d78c",
|
||||||
|
"sha256:6eae65d4c3d33da080cff9c4ab1f711b15c1d9760809dad6ea763f3812d254cb",
|
||||||
|
"sha256:6f61efb26e76c45c4a227835ddeae96d83624fb0d29eb5df5b96e14ed1a0afb7",
|
||||||
|
"sha256:71e842ec9bc7abf543b47cf86b9a743baa95f4677d22baa4c7d5c69e49e9bc04",
|
||||||
|
"sha256:760f83faa07f8b64e9c33fc963d790a2edb24efb479e3520c14a45741cd9b2db",
|
||||||
|
"sha256:78a97cf6a8839a48c49271cdcbd5cf37ca2c1d6b7fdd86cc864f302b5e9bf459",
|
||||||
|
"sha256:7ce938a99998ed3c8aa7e7272dca1a610401ede816d36d0693907d863b10d9ea",
|
||||||
|
"sha256:8a6e050cb6164d3f830453754094c086ff2d0b2f3a897a1d9820f6139a1f0914",
|
||||||
|
"sha256:9394673a9f4de09e28b5356e7fff97d778f8abad85c9d5ac4a4b7e25a0de7717",
|
||||||
|
"sha256:94cd0549accc38d1494e1f8de71eca837d0509d0d44bf11d158524b0e12cebf9",
|
||||||
|
"sha256:a04bee9ab6a4da801eb9b51f1b708a1b5b5c9eb48c03f74198464c66f0d344ac",
|
||||||
|
"sha256:a23582810fedb8c0bc47524558fb6c56aac3fc252cb306072fd2815da2a47c32",
|
||||||
|
"sha256:a2c0cd47381a3229c403062f764160d57d4d175e022c1df84e168c6251a22eec",
|
||||||
|
"sha256:a8b17438104fed022ce745b362294d9ce35b4c2e45c1d958ad4a4b019285f4a1",
|
||||||
|
"sha256:a9a3008438615669153eb86b26b61e09993921ebdd75385ddd748702c5adfddb",
|
||||||
|
"sha256:b02cf04496f6576afffef5ddd04a0cb7d49cf6be16a9059d793a30b035f6b6ac",
|
||||||
|
"sha256:b419ae593c86b87014b9be7396b385491ad7f320bde96826d0dd174459e54665",
|
||||||
|
"sha256:c0a7bb1a68a5d3471880e264621346c48665b3bf1c3759d682fc0864c540bd9e",
|
||||||
|
"sha256:c70cc23f12726be8f8bc72e41d5065d77e4515efae3690326764ea1b07845cfb",
|
||||||
|
"sha256:c8daeb2d2174beb4575b77482320303f3d39b8e81153da4f0fb08eb5fe86a6c5",
|
||||||
|
"sha256:cb3d760a6117f621261d662bccc8ef5bc32ca673e037c83fbe565324f5c46936",
|
||||||
|
"sha256:d55f3dffadd674514ad19451161118fd010988540cee43d8bc20675e775925de",
|
||||||
|
"sha256:d89c3468de4cdc4f08a57e214384d0471911a3830fcdaf7a8cc587e42a866372",
|
||||||
|
"sha256:db391fa7c66df6762ee3f00c95a89e6d428f4d60e7abc8328f4fe155b5ac6e54",
|
||||||
|
"sha256:dfb781ff7eaa91a6f7fd41776ec37c5853c795d3b358d4896fdbb5df168af422",
|
||||||
|
"sha256:e5bf0ed4490068a2e72ac03d786693adeb909981cc596425d09032d372bcc849",
|
||||||
|
"sha256:e7aec276d68421f9574040c26e2a7c3771060bc0cff408bae1dcb19d3ab1e63c",
|
||||||
|
"sha256:ef639cb3372f69ec44915fafcd6698b6cc78fbe0c2ea41be867f6ed612811963",
|
||||||
|
"sha256:f260d0d41e9b4da1ed1e0f1ce571f97fe370b152ab18778e9e8f67d6af432018"
|
||||||
|
],
|
||||||
|
"markers": "python_version >= '3.8' and python_full_version not in '3.9.0, 3.9.1'",
|
||||||
|
"version": "==46.0.3"
|
||||||
|
},
|
||||||
|
"esptool": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:2ea9bcd7eb263d380a4fe0170856a10e4c65e3f38c757ebdc73584c8dd8322da"
|
||||||
],
|
],
|
||||||
"index": "pypi",
|
"index": "pypi",
|
||||||
"markers": "python_version >= '3.8'",
|
"version": "==5.1.0"
|
||||||
"version": "==0.115.12"
|
|
||||||
},
|
|
||||||
"h11": {
|
|
||||||
"hashes": [
|
|
||||||
"sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1",
|
|
||||||
"sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86"
|
|
||||||
],
|
|
||||||
"markers": "python_version >= '3.8'",
|
|
||||||
"version": "==0.16.0"
|
|
||||||
},
|
},
|
||||||
"idna": {
|
"idna": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9",
|
"sha256:771a87f49d9defaf64091e6e6fe9c18d4833f140bd19464795bc32d966ca37ea",
|
||||||
"sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"
|
"sha256:795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902"
|
||||||
],
|
],
|
||||||
"markers": "python_version >= '3.6'",
|
"markers": "python_version >= '3.8'",
|
||||||
"version": "==3.10"
|
"version": "==3.11"
|
||||||
},
|
},
|
||||||
"jinja2": {
|
"intelhex": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d",
|
"sha256:87cc5225657524ec6361354be928adfd56bcf2a3dcc646c40f8f094c39c07db4",
|
||||||
"sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67"
|
"sha256:892b7361a719f4945237da8ccf754e9513db32f5628852785aea108dcd250093"
|
||||||
|
],
|
||||||
|
"version": "==2.3.0"
|
||||||
|
},
|
||||||
|
"markdown-it-py": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:87327c59b172c5011896038353a81343b6754500a08cd7a4973bb48c6d578147",
|
||||||
|
"sha256:cb0a2b4aa34f932c007117b194e945bd74e0ec24133ceb5bac59009cda1cb9f3"
|
||||||
|
],
|
||||||
|
"markers": "python_version >= '3.10'",
|
||||||
|
"version": "==4.0.0"
|
||||||
|
},
|
||||||
|
"mdurl": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8",
|
||||||
|
"sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"
|
||||||
|
],
|
||||||
|
"markers": "python_version >= '3.7'",
|
||||||
|
"version": "==0.1.2"
|
||||||
|
},
|
||||||
|
"mpremote": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:11d134c69b21b487dae3d03eed54c8ccbf84c916c8732a3e069a97cae47be3d4",
|
||||||
|
"sha256:6bb75774648091dad6833af4f86c5bf6505f8d7aec211380f9e6996c01d23cb5"
|
||||||
],
|
],
|
||||||
"index": "pypi",
|
"index": "pypi",
|
||||||
"markers": "python_version >= '3.7'",
|
"version": "==1.27.0"
|
||||||
"version": "==3.1.6"
|
|
||||||
},
|
},
|
||||||
"markupsafe": {
|
"platformdirs": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:0bff5e0ae4ef2e1ae4fdf2dfd5b76c75e5c2fa4132d05fc1b0dabcd20c7e28c4",
|
"sha256:61d5cdcc6065745cdd94f0f878977f8de9437be93de97c1c12f853c9c0cdcbda",
|
||||||
"sha256:0f4ca02bea9a23221c0182836703cbf8930c5e9454bacce27e767509fa286a30",
|
"sha256:d03afa3963c806a9bed9d5125c8f4cb2fdaf74a55ab60e5d59b3fde758104d31"
|
||||||
"sha256:1225beacc926f536dc82e45f8a4d68502949dc67eea90eab715dea3a21c1b5f0",
|
|
||||||
"sha256:131a3c7689c85f5ad20f9f6fb1b866f402c445b220c19fe4308c0b147ccd2ad9",
|
|
||||||
"sha256:15ab75ef81add55874e7ab7055e9c397312385bd9ced94920f2802310c930396",
|
|
||||||
"sha256:1a9d3f5f0901fdec14d8d2f66ef7d035f2157240a433441719ac9a3fba440b13",
|
|
||||||
"sha256:1c99d261bd2d5f6b59325c92c73df481e05e57f19837bdca8413b9eac4bd8028",
|
|
||||||
"sha256:1e084f686b92e5b83186b07e8a17fc09e38fff551f3602b249881fec658d3eca",
|
|
||||||
"sha256:2181e67807fc2fa785d0592dc2d6206c019b9502410671cc905d132a92866557",
|
|
||||||
"sha256:2cb8438c3cbb25e220c2ab33bb226559e7afb3baec11c4f218ffa7308603c832",
|
|
||||||
"sha256:3169b1eefae027567d1ce6ee7cae382c57fe26e82775f460f0b2778beaad66c0",
|
|
||||||
"sha256:3809ede931876f5b2ec92eef964286840ed3540dadf803dd570c3b7e13141a3b",
|
|
||||||
"sha256:38a9ef736c01fccdd6600705b09dc574584b89bea478200c5fbf112a6b0d5579",
|
|
||||||
"sha256:3d79d162e7be8f996986c064d1c7c817f6df3a77fe3d6859f6f9e7be4b8c213a",
|
|
||||||
"sha256:444dcda765c8a838eaae23112db52f1efaf750daddb2d9ca300bcae1039adc5c",
|
|
||||||
"sha256:48032821bbdf20f5799ff537c7ac3d1fba0ba032cfc06194faffa8cda8b560ff",
|
|
||||||
"sha256:4aa4e5faecf353ed117801a068ebab7b7e09ffb6e1d5e412dc852e0da018126c",
|
|
||||||
"sha256:52305740fe773d09cffb16f8ed0427942901f00adedac82ec8b67752f58a1b22",
|
|
||||||
"sha256:569511d3b58c8791ab4c2e1285575265991e6d8f8700c7be0e88f86cb0672094",
|
|
||||||
"sha256:57cb5a3cf367aeb1d316576250f65edec5bb3be939e9247ae594b4bcbc317dfb",
|
|
||||||
"sha256:5b02fb34468b6aaa40dfc198d813a641e3a63b98c2b05a16b9f80b7ec314185e",
|
|
||||||
"sha256:6381026f158fdb7c72a168278597a5e3a5222e83ea18f543112b2662a9b699c5",
|
|
||||||
"sha256:6af100e168aa82a50e186c82875a5893c5597a0c1ccdb0d8b40240b1f28b969a",
|
|
||||||
"sha256:6c89876f41da747c8d3677a2b540fb32ef5715f97b66eeb0c6b66f5e3ef6f59d",
|
|
||||||
"sha256:6e296a513ca3d94054c2c881cc913116e90fd030ad1c656b3869762b754f5f8a",
|
|
||||||
"sha256:70a87b411535ccad5ef2f1df5136506a10775d267e197e4cf531ced10537bd6b",
|
|
||||||
"sha256:7e94c425039cde14257288fd61dcfb01963e658efbc0ff54f5306b06054700f8",
|
|
||||||
"sha256:846ade7b71e3536c4e56b386c2a47adf5741d2d8b94ec9dc3e92e5e1ee1e2225",
|
|
||||||
"sha256:88416bd1e65dcea10bc7569faacb2c20ce071dd1f87539ca2ab364bf6231393c",
|
|
||||||
"sha256:88b49a3b9ff31e19998750c38e030fc7bb937398b1f78cfa599aaef92d693144",
|
|
||||||
"sha256:8c4e8c3ce11e1f92f6536ff07154f9d49677ebaaafc32db9db4620bc11ed480f",
|
|
||||||
"sha256:8e06879fc22a25ca47312fbe7c8264eb0b662f6db27cb2d3bbbc74b1df4b9b87",
|
|
||||||
"sha256:9025b4018f3a1314059769c7bf15441064b2207cb3f065e6ea1e7359cb46db9d",
|
|
||||||
"sha256:93335ca3812df2f366e80509ae119189886b0f3c2b81325d39efdb84a1e2ae93",
|
|
||||||
"sha256:9778bd8ab0a994ebf6f84c2b949e65736d5575320a17ae8984a77fab08db94cf",
|
|
||||||
"sha256:9e2d922824181480953426608b81967de705c3cef4d1af983af849d7bd619158",
|
|
||||||
"sha256:a123e330ef0853c6e822384873bef7507557d8e4a082961e1defa947aa59ba84",
|
|
||||||
"sha256:a904af0a6162c73e3edcb969eeeb53a63ceeb5d8cf642fade7d39e7963a22ddb",
|
|
||||||
"sha256:ad10d3ded218f1039f11a75f8091880239651b52e9bb592ca27de44eed242a48",
|
|
||||||
"sha256:b424c77b206d63d500bcb69fa55ed8d0e6a3774056bdc4839fc9298a7edca171",
|
|
||||||
"sha256:b5a6b3ada725cea8a5e634536b1b01c30bcdcd7f9c6fff4151548d5bf6b3a36c",
|
|
||||||
"sha256:ba8062ed2cf21c07a9e295d5b8a2a5ce678b913b45fdf68c32d95d6c1291e0b6",
|
|
||||||
"sha256:ba9527cdd4c926ed0760bc301f6728ef34d841f405abf9d4f959c478421e4efd",
|
|
||||||
"sha256:bbcb445fa71794da8f178f0f6d66789a28d7319071af7a496d4d507ed566270d",
|
|
||||||
"sha256:bcf3e58998965654fdaff38e58584d8937aa3096ab5354d493c77d1fdd66d7a1",
|
|
||||||
"sha256:c0ef13eaeee5b615fb07c9a7dadb38eac06a0608b41570d8ade51c56539e509d",
|
|
||||||
"sha256:cabc348d87e913db6ab4aa100f01b08f481097838bdddf7c7a84b7575b7309ca",
|
|
||||||
"sha256:cdb82a876c47801bb54a690c5ae105a46b392ac6099881cdfb9f6e95e4014c6a",
|
|
||||||
"sha256:cfad01eed2c2e0c01fd0ecd2ef42c492f7f93902e39a42fc9ee1692961443a29",
|
|
||||||
"sha256:d16a81a06776313e817c951135cf7340a3e91e8c1ff2fac444cfd75fffa04afe",
|
|
||||||
"sha256:d8213e09c917a951de9d09ecee036d5c7d36cb6cb7dbaece4c71a60d79fb9798",
|
|
||||||
"sha256:e07c3764494e3776c602c1e78e298937c3315ccc9043ead7e685b7f2b8d47b3c",
|
|
||||||
"sha256:e17c96c14e19278594aa4841ec148115f9c7615a47382ecb6b82bd8fea3ab0c8",
|
|
||||||
"sha256:e444a31f8db13eb18ada366ab3cf45fd4b31e4db1236a4448f68778c1d1a5a2f",
|
|
||||||
"sha256:e6a2a455bd412959b57a172ce6328d2dd1f01cb2135efda2e4576e8a23fa3b0f",
|
|
||||||
"sha256:eaa0a10b7f72326f1372a713e73c3f739b524b3af41feb43e4921cb529f5929a",
|
|
||||||
"sha256:eb7972a85c54febfb25b5c4b4f3af4dcc731994c7da0d8a0b4a6eb0640e1d178",
|
|
||||||
"sha256:ee55d3edf80167e48ea11a923c7386f4669df67d7994554387f84e7d8b0a2bf0",
|
|
||||||
"sha256:f3818cb119498c0678015754eba762e0d61e5b52d34c8b13d770f0719f7b1d79",
|
|
||||||
"sha256:f8b3d067f2e40fe93e1ccdd6b2e1d16c43140e76f02fb1319a05cf2b79d99430",
|
|
||||||
"sha256:fcabf5ff6eea076f859677f5f0b6b5c1a51e70a376b0579e0eadef8db48c6b50"
|
|
||||||
],
|
],
|
||||||
"markers": "python_version >= '3.9'",
|
"markers": "python_version >= '3.10'",
|
||||||
"version": "==3.0.2"
|
"version": "==4.5.1"
|
||||||
},
|
},
|
||||||
"pydantic": {
|
"pycparser": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:7f853db3d0ce78ce8bbb148c401c2cdd6431b3473c0cdff2755c7690952a7b7a",
|
"sha256:78816d4f24add8f10a06d6f05b4d424ad9e96cfebf68a4ddc99c65c0720d00c2",
|
||||||
"sha256:f9c26ba06f9747749ca1e5c94d6a85cb84254577553c8785576fd38fa64dc0f7"
|
"sha256:e5c6e8d3fbad53479cab09ac03729e0a9faf2bee3db8208a550daf5af81a5934"
|
||||||
],
|
],
|
||||||
"markers": "python_version >= '3.9'",
|
"markers": "implementation_name != 'PyPy'",
|
||||||
"version": "==2.11.5"
|
"version": "==2.23"
|
||||||
},
|
},
|
||||||
"pydantic-core": {
|
"pygments": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:0069c9acc3f3981b9ff4cdfaf088e98d83440a4c7ea1bc07460af3d4dc22e72d",
|
"sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887",
|
||||||
"sha256:031c57d67ca86902726e0fae2214ce6770bbe2f710dc33063187a68744a5ecac",
|
"sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b"
|
||||||
"sha256:0405262705a123b7ce9f0b92f123334d67b70fd1f20a9372b907ce1080c7ba02",
|
|
||||||
"sha256:04a1a413977ab517154eebb2d326da71638271477d6ad87a769102f7c2488c56",
|
|
||||||
"sha256:09fb9dd6571aacd023fe6aaca316bd01cf60ab27240d7eb39ebd66a3a15293b4",
|
|
||||||
"sha256:0a39979dcbb70998b0e505fb1556a1d550a0781463ce84ebf915ba293ccb7e22",
|
|
||||||
"sha256:0a9f2c9dd19656823cb8250b0724ee9c60a82f3cdf68a080979d13092a3b0fef",
|
|
||||||
"sha256:0e03262ab796d986f978f79c943fc5f620381be7287148b8010b4097f79a39ec",
|
|
||||||
"sha256:0e5b2671f05ba48b94cb90ce55d8bdcaaedb8ba00cc5359f6810fc918713983d",
|
|
||||||
"sha256:0e6116757f7959a712db11f3e9c0a99ade00a5bbedae83cb801985aa154f071b",
|
|
||||||
"sha256:0fb2d542b4d66f9470e8065c5469ec676978d625a8b7a363f07d9a501a9cb36a",
|
|
||||||
"sha256:1082dd3e2d7109ad8b7da48e1d4710c8d06c253cbc4a27c1cff4fbcaa97a9e3f",
|
|
||||||
"sha256:1a8695a8d00c73e50bff9dfda4d540b7dee29ff9b8053e38380426a85ef10052",
|
|
||||||
"sha256:1e063337ef9e9820c77acc768546325ebe04ee38b08703244c1309cccc4f1bab",
|
|
||||||
"sha256:1ea40a64d23faa25e62a70ad163571c0b342b8bf66d5fa612ac0dec4f069d916",
|
|
||||||
"sha256:2058a32994f1fde4ca0480ab9d1e75a0e8c87c22b53a3ae66554f9af78f2fe8c",
|
|
||||||
"sha256:235f45e5dbcccf6bd99f9f472858849f73d11120d76ea8707115415f8e5ebebf",
|
|
||||||
"sha256:2807668ba86cb38c6817ad9bc66215ab8584d1d304030ce4f0887336f28a5e27",
|
|
||||||
"sha256:2b0a451c263b01acebe51895bfb0e1cc842a5c666efe06cdf13846c7418caa9a",
|
|
||||||
"sha256:2b3d326aaef0c0399d9afffeb6367d5e26ddc24d351dbc9c636840ac355dc5d8",
|
|
||||||
"sha256:2bfb5112df54209d820d7bf9317c7a6c9025ea52e49f46b6a2060104bba37de7",
|
|
||||||
"sha256:2f82865531efd18d6e07a04a17331af02cb7a651583c418df8266f17a63c6612",
|
|
||||||
"sha256:329467cecfb529c925cf2bbd4d60d2c509bc2fb52a20c1045bf09bb70971a9c1",
|
|
||||||
"sha256:3a1c81334778f9e3af2f8aeb7a960736e5cab1dfebfb26aabca09afd2906c039",
|
|
||||||
"sha256:3abcd9392a36025e3bd55f9bd38d908bd17962cc49bc6da8e7e96285336e2bca",
|
|
||||||
"sha256:3c6db6e52c6d70aa0d00d45cdb9b40f0433b96380071ea80b09277dba021ddf7",
|
|
||||||
"sha256:3dc625f4aa79713512d1976fe9f0bc99f706a9dee21dfd1810b4bbbf228d0e8a",
|
|
||||||
"sha256:3eb3fe62804e8f859c49ed20a8451342de53ed764150cb14ca71357c765dc2a6",
|
|
||||||
"sha256:44857c3227d3fb5e753d5fe4a3420d6376fa594b07b621e220cd93703fe21782",
|
|
||||||
"sha256:4b25d91e288e2c4e0662b8038a28c6a07eaac3e196cfc4ff69de4ea3db992a1b",
|
|
||||||
"sha256:4c5b0a576fb381edd6d27f0a85915c6daf2f8138dc5c267a57c08a62900758c7",
|
|
||||||
"sha256:4e61206137cbc65e6d5256e1166f88331d3b6238e082d9f74613b9b765fb9025",
|
|
||||||
"sha256:52fb90784e0a242bb96ec53f42196a17278855b0f31ac7c3cc6f5c1ec4811849",
|
|
||||||
"sha256:53a57d2ed685940a504248187d5685e49eb5eef0f696853647bf37c418c538f7",
|
|
||||||
"sha256:572c7e6c8bb4774d2ac88929e3d1f12bc45714ae5ee6d9a788a9fb35e60bb04b",
|
|
||||||
"sha256:5c4aa4e82353f65e548c476b37e64189783aa5384903bfea4f41580f255fddfa",
|
|
||||||
"sha256:5c92edd15cd58b3c2d34873597a1e20f13094f59cf88068adb18947df5455b4e",
|
|
||||||
"sha256:5f483cfb75ff703095c59e365360cb73e00185e01aaea067cd19acffd2ab20ea",
|
|
||||||
"sha256:61c18fba8e5e9db3ab908620af374db0ac1baa69f0f32df4f61ae23f15e586ac",
|
|
||||||
"sha256:6368900c2d3ef09b69cb0b913f9f8263b03786e5b2a387706c5afb66800efd51",
|
|
||||||
"sha256:64632ff9d614e5eecfb495796ad51b0ed98c453e447a76bcbeeb69615079fc7e",
|
|
||||||
"sha256:65132b7b4a1c0beded5e057324b7e16e10910c106d43675d9bd87d4f38dde162",
|
|
||||||
"sha256:6b99022f1d19bc32a4c2a0d544fc9a76e3be90f0b3f4af413f87d38749300e65",
|
|
||||||
"sha256:6bdfe4b3789761f3bcb4b1ddf33355a71079858958e3a552f16d5af19768fef2",
|
|
||||||
"sha256:6fa6dfc3e4d1f734a34710f391ae822e0a8eb8559a85c6979e14e65ee6ba2954",
|
|
||||||
"sha256:73662edf539e72a9440129f231ed3757faab89630d291b784ca99237fb94db2b",
|
|
||||||
"sha256:73cf6373c21bc80b2e0dc88444f41ae60b2f070ed02095754eb5a01df12256de",
|
|
||||||
"sha256:7cb8bc3605c29176e1b105350d2e6474142d7c1bd1d9327c4a9bdb46bf827acc",
|
|
||||||
"sha256:7f92c15cd1e97d4b12acd1cc9004fa092578acfa57b67ad5e43a197175d01a64",
|
|
||||||
"sha256:82f68293f055f51b51ea42fafc74b6aad03e70e191799430b90c13d643059ebb",
|
|
||||||
"sha256:83aa99b1285bc8f038941ddf598501a86f1536789740991d7d8756e34f1e74d9",
|
|
||||||
"sha256:87acbfcf8e90ca885206e98359d7dca4bcbb35abdc0ff66672a293e1d7a19101",
|
|
||||||
"sha256:87b31b6846e361ef83fedb187bb5b4372d0da3f7e28d85415efa92d6125d6e6d",
|
|
||||||
"sha256:881b21b5549499972441da4758d662aeea93f1923f953e9cbaff14b8b9565aef",
|
|
||||||
"sha256:8d55ab81c57b8ff8548c3e4947f119551253f4e3787a7bbc0b6b3ca47498a9d3",
|
|
||||||
"sha256:8f57a69461af2a5fa6e6bbd7a5f60d3b7e6cebb687f55106933188e79ad155c1",
|
|
||||||
"sha256:95237e53bb015f67b63c91af7518a62a8660376a6a0db19b89acc77a4d6199f5",
|
|
||||||
"sha256:96081f1605125ba0855dfda83f6f3df5ec90c61195421ba72223de35ccfb2f88",
|
|
||||||
"sha256:970919794d126ba8645f3837ab6046fb4e72bbc057b3709144066204c19a455d",
|
|
||||||
"sha256:9cb1da0f5a471435a7bc7e439b8a728e8b61e59784b2af70d7c169f8dd8ae290",
|
|
||||||
"sha256:9fcd347d2cc5c23b06de6d3b7b8275be558a0c90549495c699e379a80bf8379e",
|
|
||||||
"sha256:9fdac5d6ffa1b5a83bca06ffe7583f5576555e6c8b3a91fbd25ea7780f825f7d",
|
|
||||||
"sha256:a11c8d26a50bfab49002947d3d237abe4d9e4b5bdc8846a63537b6488e197808",
|
|
||||||
"sha256:a144d4f717285c6d9234a66778059f33a89096dfb9b39117663fd8413d582dcc",
|
|
||||||
"sha256:a2b911a5b90e0374d03813674bf0a5fbbb7741570dcd4b4e85a2e48d17def29d",
|
|
||||||
"sha256:a7ec89dc587667f22b6a0b6579c249fca9026ce7c333fc142ba42411fa243cdc",
|
|
||||||
"sha256:aa9d91b338f2df0508606f7009fde642391425189bba6d8c653afd80fd6bb64e",
|
|
||||||
"sha256:b0379a2b24882fef529ec3b4987cb5d003b9cda32256024e6fe1586ac45fc640",
|
|
||||||
"sha256:bc7aee6f634a6f4a95676fcb5d6559a2c2a390330098dba5e5a5f28a2e4ada30",
|
|
||||||
"sha256:bdc25f3681f7b78572699569514036afe3c243bc3059d3942624e936ec93450e",
|
|
||||||
"sha256:c083a3bdd5a93dfe480f1125926afcdbf2917ae714bdb80b36d34318b2bec5d9",
|
|
||||||
"sha256:c20c462aa4434b33a2661701b861604913f912254e441ab8d78d30485736115a",
|
|
||||||
"sha256:c2fc0a768ef76c15ab9238afa6da7f69895bb5d1ee83aeea2e3509af4472d0b9",
|
|
||||||
"sha256:c52b02ad8b4e2cf14ca7b3d918f3eb0ee91e63b3167c32591e57c4317e134f8f",
|
|
||||||
"sha256:c54c939ee22dc8e2d545da79fc5381f1c020d6d3141d3bd747eab59164dc89fb",
|
|
||||||
"sha256:c8e7af2f4e0194c22b5b37205bfb293d166a7344a5b0d0eaccebc376546d77d5",
|
|
||||||
"sha256:cca3868ddfaccfbc4bfb1d608e2ccaaebe0ae628e1416aeb9c4d88c001bb45ab",
|
|
||||||
"sha256:d3f26877a748dc4251cfcfda9dfb5f13fcb034f5308388066bcfe9031b63ae7d",
|
|
||||||
"sha256:d53b22f2032c42eaaf025f7c40c2e3b94568ae077a606f006d206a463bc69572",
|
|
||||||
"sha256:d87c561733f66531dced0da6e864f44ebf89a8fba55f31407b00c2f7f9449593",
|
|
||||||
"sha256:d946c8bf0d5c24bf4fe333af284c59a19358aa3ec18cb3dc4370080da1e8ad29",
|
|
||||||
"sha256:dac89aea9af8cd672fa7b510e7b8c33b0bba9a43186680550ccf23020f32d535",
|
|
||||||
"sha256:db4b41f9bd95fbe5acd76d89920336ba96f03e149097365afe1cb092fceb89a1",
|
|
||||||
"sha256:dc46a01bf8d62f227d5ecee74178ffc448ff4e5197c756331f71efcc66dc980f",
|
|
||||||
"sha256:dd14041875d09cc0f9308e37a6f8b65f5585cf2598a53aa0123df8b129d481f8",
|
|
||||||
"sha256:de4b83bb311557e439b9e186f733f6c645b9417c84e2eb8203f3f820a4b988bf",
|
|
||||||
"sha256:e799c050df38a639db758c617ec771fd8fb7a5f8eaaa4b27b101f266b216a246",
|
|
||||||
"sha256:e80b087132752f6b3d714f041ccf74403799d3b23a72722ea2e6ba2e892555b9",
|
|
||||||
"sha256:eb8c529b2819c37140eb51b914153063d27ed88e3bdc31b71198a198e921e011",
|
|
||||||
"sha256:eb9b459ca4df0e5c87deb59d37377461a538852765293f9e6ee834f0435a93b9",
|
|
||||||
"sha256:efec8db3266b76ef9607c2c4c419bdb06bf335ae433b80816089ea7585816f6a",
|
|
||||||
"sha256:f481959862f57f29601ccced557cc2e817bce7533ab8e01a797a48b49c9692b3",
|
|
||||||
"sha256:f517ca031dfc037a9c07e748cefd8d96235088b83b4f4ba8939105d20fa1dcd6",
|
|
||||||
"sha256:f889f7a40498cc077332c7ab6b4608d296d852182211787d4f3ee377aaae66e8",
|
|
||||||
"sha256:f8de619080e944347f5f20de29a975c2d815d9ddd8be9b9b7268e2e3ef68605a",
|
|
||||||
"sha256:f941635f2a3d96b2973e867144fde513665c87f13fe0e193c158ac51bfaaa7b2",
|
|
||||||
"sha256:fa754d1850735a0b0e03bcffd9d4b4343eb417e47196e4485d9cca326073a42c",
|
|
||||||
"sha256:fa854f5cf7e33842a892e5c73f45327760bc7bc516339fda888c75ae60edaeb6",
|
|
||||||
"sha256:fe5b32187cbc0c862ee201ad66c30cf218e5ed468ec8dc1cf49dec66e160cc4d"
|
|
||||||
],
|
],
|
||||||
"markers": "python_version >= '3.9'",
|
"markers": "python_version >= '3.8'",
|
||||||
"version": "==2.33.2"
|
"version": "==2.19.2"
|
||||||
},
|
},
|
||||||
"sniffio": {
|
"pyjwt": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2",
|
"sha256:3cc5772eb20009233caf06e9d8a0577824723b44e6648ee0a2aedb6cf9381953",
|
||||||
"sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"
|
"sha256:dcdd193e30abefd5debf142f9adfcdd2b58004e644f25406ffaebd50bd98dacb"
|
||||||
],
|
],
|
||||||
"markers": "python_version >= '3.7'",
|
"index": "pypi",
|
||||||
"version": "==1.3.1"
|
"version": "==2.10.1"
|
||||||
},
|
},
|
||||||
"starlette": {
|
"pyserial": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:595633ce89f8ffa71a015caed34a5b2dc1c0cdb3f0f1fbd1e69339cf2abeec35",
|
"sha256:3c77e014170dfffbd816e6ffc205e9842efb10be9f58ec16d3e8675b4925cddb",
|
||||||
"sha256:7f7361f34eed179294600af672f565727419830b54b7b084efe44bb82d2fccd5"
|
"sha256:c4451db6ba391ca6ca299fb3ec7bae67a5c55dde170964c7a14ceefec02f2cf0"
|
||||||
],
|
],
|
||||||
"markers": "python_version >= '3.9'",
|
"index": "pypi",
|
||||||
"version": "==0.46.2"
|
"version": "==3.5"
|
||||||
|
},
|
||||||
|
"pyyaml": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:00c4bdeba853cc34e7dd471f16b4114f4162dc03e6b7afcc2128711f0eca823c",
|
||||||
|
"sha256:0150219816b6a1fa26fb4699fb7daa9caf09eb1999f3b70fb6e786805e80375a",
|
||||||
|
"sha256:02893d100e99e03eda1c8fd5c441d8c60103fd175728e23e431db1b589cf5ab3",
|
||||||
|
"sha256:02ea2dfa234451bbb8772601d7b8e426c2bfa197136796224e50e35a78777956",
|
||||||
|
"sha256:0f29edc409a6392443abf94b9cf89ce99889a1dd5376d94316ae5145dfedd5d6",
|
||||||
|
"sha256:10892704fc220243f5305762e276552a0395f7beb4dbf9b14ec8fd43b57f126c",
|
||||||
|
"sha256:16249ee61e95f858e83976573de0f5b2893b3677ba71c9dd36b9cf8be9ac6d65",
|
||||||
|
"sha256:1d37d57ad971609cf3c53ba6a7e365e40660e3be0e5175fa9f2365a379d6095a",
|
||||||
|
"sha256:1ebe39cb5fc479422b83de611d14e2c0d3bb2a18bbcb01f229ab3cfbd8fee7a0",
|
||||||
|
"sha256:214ed4befebe12df36bcc8bc2b64b396ca31be9304b8f59e25c11cf94a4c033b",
|
||||||
|
"sha256:2283a07e2c21a2aa78d9c4442724ec1eb15f5e42a723b99cb3d822d48f5f7ad1",
|
||||||
|
"sha256:22ba7cfcad58ef3ecddc7ed1db3409af68d023b7f940da23c6c2a1890976eda6",
|
||||||
|
"sha256:27c0abcb4a5dac13684a37f76e701e054692a9b2d3064b70f5e4eb54810553d7",
|
||||||
|
"sha256:28c8d926f98f432f88adc23edf2e6d4921ac26fb084b028c733d01868d19007e",
|
||||||
|
"sha256:2e71d11abed7344e42a8849600193d15b6def118602c4c176f748e4583246007",
|
||||||
|
"sha256:34d5fcd24b8445fadc33f9cf348c1047101756fd760b4dacb5c3e99755703310",
|
||||||
|
"sha256:37503bfbfc9d2c40b344d06b2199cf0e96e97957ab1c1b546fd4f87e53e5d3e4",
|
||||||
|
"sha256:3c5677e12444c15717b902a5798264fa7909e41153cdf9ef7ad571b704a63dd9",
|
||||||
|
"sha256:3ff07ec89bae51176c0549bc4c63aa6202991da2d9a6129d7aef7f1407d3f295",
|
||||||
|
"sha256:41715c910c881bc081f1e8872880d3c650acf13dfa8214bad49ed4cede7c34ea",
|
||||||
|
"sha256:418cf3f2111bc80e0933b2cd8cd04f286338bb88bdc7bc8e6dd775ebde60b5e0",
|
||||||
|
"sha256:44edc647873928551a01e7a563d7452ccdebee747728c1080d881d68af7b997e",
|
||||||
|
"sha256:4a2e8cebe2ff6ab7d1050ecd59c25d4c8bd7e6f400f5f82b96557ac0abafd0ac",
|
||||||
|
"sha256:4ad1906908f2f5ae4e5a8ddfce73c320c2a1429ec52eafd27138b7f1cbe341c9",
|
||||||
|
"sha256:501a031947e3a9025ed4405a168e6ef5ae3126c59f90ce0cd6f2bfc477be31b7",
|
||||||
|
"sha256:5190d403f121660ce8d1d2c1bb2ef1bd05b5f68533fc5c2ea899bd15f4399b35",
|
||||||
|
"sha256:5498cd1645aa724a7c71c8f378eb29ebe23da2fc0d7a08071d89469bf1d2defb",
|
||||||
|
"sha256:5cf4e27da7e3fbed4d6c3d8e797387aaad68102272f8f9752883bc32d61cb87b",
|
||||||
|
"sha256:5e0b74767e5f8c593e8c9b5912019159ed0533c70051e9cce3e8b6aa699fcd69",
|
||||||
|
"sha256:5ed875a24292240029e4483f9d4a4b8a1ae08843b9c54f43fcc11e404532a8a5",
|
||||||
|
"sha256:5fcd34e47f6e0b794d17de1b4ff496c00986e1c83f7ab2fb8fcfe9616ff7477b",
|
||||||
|
"sha256:5fdec68f91a0c6739b380c83b951e2c72ac0197ace422360e6d5a959d8d97b2c",
|
||||||
|
"sha256:6344df0d5755a2c9a276d4473ae6b90647e216ab4757f8426893b5dd2ac3f369",
|
||||||
|
"sha256:64386e5e707d03a7e172c0701abfb7e10f0fb753ee1d773128192742712a98fd",
|
||||||
|
"sha256:652cb6edd41e718550aad172851962662ff2681490a8a711af6a4d288dd96824",
|
||||||
|
"sha256:66291b10affd76d76f54fad28e22e51719ef9ba22b29e1d7d03d6777a9174198",
|
||||||
|
"sha256:66e1674c3ef6f541c35191caae2d429b967b99e02040f5ba928632d9a7f0f065",
|
||||||
|
"sha256:6adc77889b628398debc7b65c073bcb99c4a0237b248cacaf3fe8a557563ef6c",
|
||||||
|
"sha256:79005a0d97d5ddabfeeea4cf676af11e647e41d81c9a7722a193022accdb6b7c",
|
||||||
|
"sha256:7c6610def4f163542a622a73fb39f534f8c101d690126992300bf3207eab9764",
|
||||||
|
"sha256:7f047e29dcae44602496db43be01ad42fc6f1cc0d8cd6c83d342306c32270196",
|
||||||
|
"sha256:8098f252adfa6c80ab48096053f512f2321f0b998f98150cea9bd23d83e1467b",
|
||||||
|
"sha256:850774a7879607d3a6f50d36d04f00ee69e7fc816450e5f7e58d7f17f1ae5c00",
|
||||||
|
"sha256:8d1fab6bb153a416f9aeb4b8763bc0f22a5586065f86f7664fc23339fc1c1fac",
|
||||||
|
"sha256:8da9669d359f02c0b91ccc01cac4a67f16afec0dac22c2ad09f46bee0697eba8",
|
||||||
|
"sha256:8dc52c23056b9ddd46818a57b78404882310fb473d63f17b07d5c40421e47f8e",
|
||||||
|
"sha256:9149cad251584d5fb4981be1ecde53a1ca46c891a79788c0df828d2f166bda28",
|
||||||
|
"sha256:93dda82c9c22deb0a405ea4dc5f2d0cda384168e466364dec6255b293923b2f3",
|
||||||
|
"sha256:96b533f0e99f6579b3d4d4995707cf36df9100d67e0c8303a0c55b27b5f99bc5",
|
||||||
|
"sha256:9c57bb8c96f6d1808c030b1687b9b5fb476abaa47f0db9c0101f5e9f394e97f4",
|
||||||
|
"sha256:9c7708761fccb9397fe64bbc0395abcae8c4bf7b0eac081e12b809bf47700d0b",
|
||||||
|
"sha256:9f3bfb4965eb874431221a3ff3fdcddc7e74e3b07799e0e84ca4a0f867d449bf",
|
||||||
|
"sha256:a33284e20b78bd4a18c8c2282d549d10bc8408a2a7ff57653c0cf0b9be0afce5",
|
||||||
|
"sha256:a80cb027f6b349846a3bf6d73b5e95e782175e52f22108cfa17876aaeff93702",
|
||||||
|
"sha256:b30236e45cf30d2b8e7b3e85881719e98507abed1011bf463a8fa23e9c3e98a8",
|
||||||
|
"sha256:b3bc83488de33889877a0f2543ade9f70c67d66d9ebb4ac959502e12de895788",
|
||||||
|
"sha256:b865addae83924361678b652338317d1bd7e79b1f4596f96b96c77a5a34b34da",
|
||||||
|
"sha256:b8bb0864c5a28024fac8a632c443c87c5aa6f215c0b126c449ae1a150412f31d",
|
||||||
|
"sha256:ba1cc08a7ccde2d2ec775841541641e4548226580ab850948cbfda66a1befcdc",
|
||||||
|
"sha256:bdb2c67c6c1390b63c6ff89f210c8fd09d9a1217a465701eac7316313c915e4c",
|
||||||
|
"sha256:c1ff362665ae507275af2853520967820d9124984e0f7466736aea23d8611fba",
|
||||||
|
"sha256:c2514fceb77bc5e7a2f7adfaa1feb2fb311607c9cb518dbc378688ec73d8292f",
|
||||||
|
"sha256:c3355370a2c156cffb25e876646f149d5d68f5e0a3ce86a5084dd0b64a994917",
|
||||||
|
"sha256:c458b6d084f9b935061bc36216e8a69a7e293a2f1e68bf956dcd9e6cbcd143f5",
|
||||||
|
"sha256:d0eae10f8159e8fdad514efdc92d74fd8d682c933a6dd088030f3834bc8e6b26",
|
||||||
|
"sha256:d76623373421df22fb4cf8817020cbb7ef15c725b9d5e45f17e189bfc384190f",
|
||||||
|
"sha256:ebc55a14a21cb14062aa4162f906cd962b28e2e9ea38f9b4391244cd8de4ae0b",
|
||||||
|
"sha256:eda16858a3cab07b80edaf74336ece1f986ba330fdb8ee0d6c0d68fe82bc96be",
|
||||||
|
"sha256:ee2922902c45ae8ccada2c5b501ab86c36525b883eff4255313a253a3160861c",
|
||||||
|
"sha256:efd7b85f94a6f21e4932043973a7ba2613b059c4a000551892ac9f1d11f5baf3",
|
||||||
|
"sha256:f7057c9a337546edc7973c0d3ba84ddcdf0daa14533c2065749c9075001090e6",
|
||||||
|
"sha256:fa160448684b4e94d80416c0fa4aac48967a969efe22931448d853ada8baf926",
|
||||||
|
"sha256:fc09d0aa354569bc501d4e787133afc08552722d3ab34836a80547331bb5d4a0"
|
||||||
|
],
|
||||||
|
"markers": "python_version >= '3.8'",
|
||||||
|
"version": "==6.0.3"
|
||||||
|
},
|
||||||
|
"reedsolo": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:2b6a3e402a1ee3e1eea3f932f81e6c0b7bbc615588074dca1dbbcdeb055002bd",
|
||||||
|
"sha256:c1359f02742751afe0f1c0de9f0772cc113835aa2855d2db420ea24393c87732"
|
||||||
|
],
|
||||||
|
"version": "==1.7.0"
|
||||||
|
},
|
||||||
|
"rich": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:73ff50c7c0c1c77c8243079283f4edb376f0f6442433aecb8ce7e6d0b92d1fe4",
|
||||||
|
"sha256:76bc51fe2e57d2b1be1f96c524b890b816e334ab4c1e45888799bfaab0021edd"
|
||||||
|
],
|
||||||
|
"markers": "python_full_version >= '3.8.0'",
|
||||||
|
"version": "==14.2.0"
|
||||||
|
},
|
||||||
|
"rich-click": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:48120531493f1533828da80e13e839d471979ec8d7d0ca7b35f86a1379cc74b6",
|
||||||
|
"sha256:9b195721a773b1acf0e16ff9ec68cef1e7d237e53471e6e3f7ade462f86c403a"
|
||||||
|
],
|
||||||
|
"markers": "python_version >= '3.8'",
|
||||||
|
"version": "==1.9.5"
|
||||||
},
|
},
|
||||||
"typing-extensions": {
|
"typing-extensions": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:a439e7c04b49fec3e5d3e2beaa21755cadbbdc391694e28ccdd36ca4a1408f8c",
|
"sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466",
|
||||||
"sha256:e6c81219bd689f51865d9e372991c540bda33a0379d5573cddb9a3a23f7caaef"
|
"sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548"
|
||||||
],
|
],
|
||||||
"markers": "python_version >= '3.8'",
|
"markers": "python_version < '3.13'",
|
||||||
"version": "==4.13.2"
|
"version": "==4.15.0"
|
||||||
},
|
},
|
||||||
"typing-inspection": {
|
"watchfiles": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:389055682238f53b04f7badcb49b989835495a96700ced5dab2d8feae4b26f51",
|
"sha256:00485f441d183717038ed2e887a7c868154f216877653121068107b227a2f64c",
|
||||||
"sha256:6ae134cc0203c33377d43188d4064e9b357dba58cff3185f22924610e70a9d28"
|
"sha256:03fa0f5237118a0c5e496185cafa92878568b652a2e9a9382a5151b1a0380a43",
|
||||||
],
|
"sha256:04e78dd0b6352db95507fd8cb46f39d185cf8c74e4cf1e4fbad1d3df96faf510",
|
||||||
"markers": "python_version >= '3.9'",
|
"sha256:059098c3a429f62fc98e8ec62b982230ef2c8df68c79e826e37b895bc359a9c0",
|
||||||
"version": "==0.4.1"
|
"sha256:08af70fd77eee58549cd69c25055dc344f918d992ff626068242259f98d598a2",
|
||||||
},
|
"sha256:0b495de0bb386df6a12b18335a0285dda90260f51bdb505503c02bcd1ce27a8b",
|
||||||
"uvicorn": {
|
"sha256:130e4876309e8686a5e37dba7d5e9bc77e6ed908266996ca26572437a5271e18",
|
||||||
"hashes": [
|
"sha256:14e0b1fe858430fc0251737ef3824c54027bedb8c37c38114488b8e131cf8219",
|
||||||
"sha256:0e929828f6186353a80b58ea719861d2629d766293b6d19baf086ba31d4f3328",
|
"sha256:17ef139237dfced9da49fb7f2232c86ca9421f666d78c264c7ffca6601d154c3",
|
||||||
"sha256:deb49af569084536d269fe0a6d67e3754f104cf03aba7c11c40f01aadf33c403"
|
"sha256:1a0bb430adb19ef49389e1ad368450193a90038b5b752f4ac089ec6942c4dff4",
|
||||||
|
"sha256:1db5d7ae38ff20153d542460752ff397fcf5c96090c1230803713cf3147a6803",
|
||||||
|
"sha256:28475ddbde92df1874b6c5c8aaeb24ad5be47a11f87cde5a28ef3835932e3e94",
|
||||||
|
"sha256:2edc3553362b1c38d9f06242416a5d8e9fe235c204a4072e988ce2e5bb1f69f6",
|
||||||
|
"sha256:30f7da3fb3f2844259cba4720c3fc7138eb0f7b659c38f3bfa65084c7fc7abce",
|
||||||
|
"sha256:311ff15a0bae3714ffb603e6ba6dbfba4065ab60865d15a6ec544133bdb21099",
|
||||||
|
"sha256:319b27255aacd9923b8a276bb14d21a5f7ff82564c744235fc5eae58d95422ae",
|
||||||
|
"sha256:35c53bd62a0b885bf653ebf6b700d1bf05debb78ad9292cf2a942b23513dc4c4",
|
||||||
|
"sha256:36193ed342f5b9842edd3532729a2ad55c4160ffcfa3700e0d54be496b70dd43",
|
||||||
|
"sha256:39574d6370c4579d7f5d0ad940ce5b20db0e4117444e39b6d8f99db5676c52fd",
|
||||||
|
"sha256:399600947b170270e80134ac854e21b3ccdefa11a9529a3decc1327088180f10",
|
||||||
|
"sha256:3a476189be23c3686bc2f4321dd501cb329c0a0469e77b7b534ee10129ae6374",
|
||||||
|
"sha256:3ad9fe1dae4ab4212d8c91e80b832425e24f421703b5a42ef2e4a1e215aff051",
|
||||||
|
"sha256:3bc570d6c01c206c46deb6e935a260be44f186a2f05179f52f7fcd2be086a94d",
|
||||||
|
"sha256:3dbd8cbadd46984f802f6d479b7e3afa86c42d13e8f0f322d669d79722c8ec34",
|
||||||
|
"sha256:3e6f39af2eab0118338902798b5aa6664f46ff66bc0280de76fca67a7f262a49",
|
||||||
|
"sha256:3f53fa183d53a1d7a8852277c92b967ae99c2d4dcee2bfacff8868e6e30b15f7",
|
||||||
|
"sha256:3f6d37644155fb5beca5378feb8c1708d5783145f2a0f1c4d5a061a210254844",
|
||||||
|
"sha256:3f7eb7da0eb23aa2ba036d4f616d46906013a68caf61b7fdbe42fc8b25132e77",
|
||||||
|
"sha256:3fa0b59c92278b5a7800d3ee7733da9d096d4aabcfabb9a928918bd276ef9b9b",
|
||||||
|
"sha256:421e29339983e1bebc281fab40d812742268ad057db4aee8c4d2bce0af43b741",
|
||||||
|
"sha256:4b943d3668d61cfa528eb949577479d3b077fd25fb83c641235437bc0b5bc60e",
|
||||||
|
"sha256:526e86aced14a65a5b0ec50827c745597c782ff46b571dbfe46192ab9e0b3c33",
|
||||||
|
"sha256:52e06553899e11e8074503c8e716d574adeeb7e68913115c4b3653c53f9bae42",
|
||||||
|
"sha256:544364b2b51a9b0c7000a4b4b02f90e9423d97fbbf7e06689236443ebcad81ab",
|
||||||
|
"sha256:5524298e3827105b61951a29c3512deb9578586abf3a7c5da4a8069df247cccc",
|
||||||
|
"sha256:55c7475190662e202c08c6c0f4d9e345a29367438cf8e8037f3155e10a88d5a5",
|
||||||
|
"sha256:563b116874a9a7ce6f96f87cd0b94f7faf92d08d0021e837796f0a14318ef8da",
|
||||||
|
"sha256:57ca5281a8b5e27593cb7d82c2ac927ad88a96ed406aa446f6344e4328208e9e",
|
||||||
|
"sha256:5c85794a4cfa094714fb9c08d4a218375b2b95b8ed1666e8677c349906246c05",
|
||||||
|
"sha256:5f3bde70f157f84ece3765b42b4a52c6ac1a50334903c6eaf765362f6ccca88a",
|
||||||
|
"sha256:5f3f58818dc0b07f7d9aa7fe9eb1037aecb9700e63e1f6acfed13e9fef648f5d",
|
||||||
|
"sha256:5fac835b4ab3c6487b5dbad78c4b3724e26bcc468e886f8ba8cc4306f68f6701",
|
||||||
|
"sha256:620bae625f4cb18427b1bb1a2d9426dc0dd5a5ba74c7c2cdb9de405f7b129863",
|
||||||
|
"sha256:672b8adf25b1a0d35c96b5888b7b18699d27d4194bac8beeae75be4b7a3fc9b2",
|
||||||
|
"sha256:6aae418a8b323732fa89721d86f39ec8f092fc2af67f4217a2b07fd3e93c6101",
|
||||||
|
"sha256:6c3631058c37e4a0ec440bf583bc53cdbd13e5661bb6f465bc1d88ee9a0a4d02",
|
||||||
|
"sha256:6c9c9262f454d1c4d8aaa7050121eb4f3aea197360553699520767daebf2180b",
|
||||||
|
"sha256:6e43d39a741e972bab5d8100b5cdacf69db64e34eb19b6e9af162bccf63c5cc6",
|
||||||
|
"sha256:7365b92c2e69ee952902e8f70f3ba6360d0d596d9299d55d7d386df84b6941fb",
|
||||||
|
"sha256:743185e7372b7bc7c389e1badcc606931a827112fbbd37f14c537320fca08620",
|
||||||
|
"sha256:74472234c8370669850e1c312490f6026d132ca2d396abfad8830b4f1c096957",
|
||||||
|
"sha256:74d5012b7630714b66be7b7b7a78855ef7ad58e8650c73afc4c076a1f480a8d6",
|
||||||
|
"sha256:77a13aea58bc2b90173bc69f2a90de8e282648939a00a602e1dc4ee23e26b66d",
|
||||||
|
"sha256:79ff6c6eadf2e3fc0d7786331362e6ef1e51125892c75f1004bd6b52155fb956",
|
||||||
|
"sha256:831a62658609f0e5c64178211c942ace999517f5770fe9436be4c2faeba0c0ef",
|
||||||
|
"sha256:836398932192dae4146c8f6f737d74baeac8b70ce14831a239bdb1ca882fc261",
|
||||||
|
"sha256:842178b126593addc05acf6fce960d28bc5fae7afbaa2c6c1b3a7b9460e5be02",
|
||||||
|
"sha256:8526e8f916bb5b9a0a777c8317c23ce65de259422bba5b31325a6fa6029d33af",
|
||||||
|
"sha256:859e43a1951717cc8de7f4c77674a6d389b106361585951d9e69572823f311d9",
|
||||||
|
"sha256:88863fbbc1a7312972f1c511f202eb30866370ebb8493aef2812b9ff28156a21",
|
||||||
|
"sha256:89eef07eee5e9d1fda06e38822ad167a044153457e6fd997f8a858ab7564a336",
|
||||||
|
"sha256:8c89f9f2f740a6b7dcc753140dd5e1ab9215966f7a3530d0c0705c83b401bd7d",
|
||||||
|
"sha256:8c91ed27800188c2ae96d16e3149f199d62f86c7af5f5f4d2c61a3ed8cd3666c",
|
||||||
|
"sha256:8ca65483439f9c791897f7db49202301deb6e15fe9f8fe2fed555bf986d10c31",
|
||||||
|
"sha256:8fbe85cb3201c7d380d3d0b90e63d520f15d6afe217165d7f98c9c649654db81",
|
||||||
|
"sha256:91d4c9a823a8c987cce8fa2690923b069966dabb196dd8d137ea2cede885fde9",
|
||||||
|
"sha256:9bb9f66367023ae783551042d31b1d7fd422e8289eedd91f26754a66f44d5cff",
|
||||||
|
"sha256:a173cb5c16c4f40ab19cecf48a534c409f7ea983ab8fed0741304a1c0a31b3f2",
|
||||||
|
"sha256:a36d8efe0f290835fd0f33da35042a1bb5dc0e83cbc092dcf69bce442579e88e",
|
||||||
|
"sha256:a55f3e9e493158d7bfdb60a1165035f1cf7d320914e7b7ea83fe22c6023b58fc",
|
||||||
|
"sha256:a625815d4a2bdca61953dbba5a39d60164451ef34c88d751f6c368c3ea73d404",
|
||||||
|
"sha256:a916a2932da8f8ab582f242c065f5c81bed3462849ca79ee357dd9551b0e9b01",
|
||||||
|
"sha256:ac3cc5759570cd02662b15fbcd9d917f7ecd47efe0d6b40474eafd246f91ea18",
|
||||||
|
"sha256:acb08650863767cbc58bca4813b92df4d6c648459dcaa3d4155681962b2aa2d3",
|
||||||
|
"sha256:aebfd0861a83e6c3d1110b78ad54704486555246e542be3e2bb94195eabb2606",
|
||||||
|
"sha256:afaeff7696e0ad9f02cbb8f56365ff4686ab205fcf9c4c5b6fdfaaa16549dd04",
|
||||||
|
"sha256:b27cf2eb1dda37b2089e3907d8ea92922b673c0c427886d4edc6b94d8dfe5db3",
|
||||||
|
"sha256:b2cd9e04277e756a2e2d2543d65d1e2166d6fd4c9b183f8808634fda23f17b14",
|
||||||
|
"sha256:b9c4702f29ca48e023ffd9b7ff6b822acdf47cb1ff44cb490a3f1d5ec8987e9c",
|
||||||
|
"sha256:bbe1ef33d45bc71cf21364df962af171f96ecaeca06bd9e3d0b583efb12aec82",
|
||||||
|
"sha256:bd404be08018c37350f0d6e34676bd1e2889990117a2b90070b3007f172d0610",
|
||||||
|
"sha256:bf0a91bfb5574a2f7fc223cf95eeea79abfefa404bf1ea5e339c0c1560ae99a0",
|
||||||
|
"sha256:bfb5862016acc9b869bb57284e6cb35fdf8e22fe59f7548858e2f971d045f150",
|
||||||
|
"sha256:bfff9740c69c0e4ed32416f013f3c45e2ae42ccedd1167ef2d805c000b6c71a5",
|
||||||
|
"sha256:c1f5210f1b8fc91ead1283c6fd89f70e76fb07283ec738056cf34d51e9c1d62c",
|
||||||
|
"sha256:c2047d0b6cea13b3316bdbafbfa0c4228ae593d995030fda39089d36e64fc03a",
|
||||||
|
"sha256:c22c776292a23bfc7237a98f791b9ad3144b02116ff10d820829ce62dff46d0b",
|
||||||
|
"sha256:c755367e51db90e75b19454b680903631d41f9e3607fbd941d296a020c2d752d",
|
||||||
|
"sha256:c882d69f6903ef6092bedfb7be973d9319940d56b8427ab9187d1ecd73438a70",
|
||||||
|
"sha256:cb467c999c2eff23a6417e58d75e5828716f42ed8289fe6b77a7e5a91036ca70",
|
||||||
|
"sha256:cdab464fee731e0884c35ae3588514a9bcf718d0e2c82169c1c4a85cc19c3c7f",
|
||||||
|
"sha256:ce19e06cbda693e9e7686358af9cd6f5d61312ab8b00488bc36f5aabbaf77e24",
|
||||||
|
"sha256:ce70f96a46b894b36eba678f153f052967a0d06d5b5a19b336ab0dbbd029f73e",
|
||||||
|
"sha256:cf57a27fb986c6243d2ee78392c503826056ffe0287e8794503b10fb51b881be",
|
||||||
|
"sha256:d1715143123baeeaeadec0528bb7441103979a1d5f6fd0e1f915383fea7ea6d5",
|
||||||
|
"sha256:d6ff426a7cb54f310d51bfe83fe9f2bbe40d540c741dc974ebc30e6aa238f52e",
|
||||||
|
"sha256:d7e7067c98040d646982daa1f37a33d3544138ea155536c2e0e63e07ff8a7e0f",
|
||||||
|
"sha256:db476ab59b6765134de1d4fe96a1a9c96ddf091683599be0f26147ea1b2e4b88",
|
||||||
|
"sha256:dcc5c24523771db3a294c77d94771abcfcb82a0e0ee8efd910c37c59ec1b31bb",
|
||||||
|
"sha256:de6da501c883f58ad50db3a32ad397b09ad29865b5f26f64c24d3e3281685849",
|
||||||
|
"sha256:e84087b432b6ac94778de547e08611266f1f8ffad28c0ee4c82e028b0fc5966d",
|
||||||
|
"sha256:eef58232d32daf2ac67f42dea51a2c80f0d03379075d44a587051e63cc2e368c",
|
||||||
|
"sha256:f096076119da54a6080e8920cbdaac3dbee667eb91dcc5e5b78840b87415bd44",
|
||||||
|
"sha256:f0ab1c1af0cb38e3f598244c17919fb1a84d1629cc08355b0074b6d7f53138ac",
|
||||||
|
"sha256:f27db948078f3823a6bb3b465180db8ebecf26dd5dae6f6180bd87383b6b4428",
|
||||||
|
"sha256:f537afb3276d12814082a2e9b242bdcf416c2e8fd9f799a737990a1dbe906e5b",
|
||||||
|
"sha256:f57b396167a2565a4e8b5e56a5a1c537571733992b226f4f1197d79e94cf0ae5",
|
||||||
|
"sha256:f8979280bdafff686ba5e4d8f97840f929a87ed9cdf133cbbd42f7766774d2aa",
|
||||||
|
"sha256:f9a2ae5c91cecc9edd47e041a930490c31c3afb1f5e6d71de3dc671bfaca02bf"
|
||||||
],
|
],
|
||||||
"index": "pypi",
|
"index": "pypi",
|
||||||
"markers": "python_version >= '3.9'",
|
"version": "==1.1.1"
|
||||||
"version": "==0.34.2"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"develop": {}
|
"develop": {}
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
from pydantic import BaseModel
|
|
||||||
|
|
||||||
class ColorUpdate(BaseModel):
|
|
||||||
barId: str
|
|
||||||
color: str
|
|
||||||
|
|
||||||
class PositionUpdate(BaseModel):
|
|
||||||
barId: str
|
|
||||||
x: int
|
|
||||||
y: int
|
|
||||||
|
|
||||||
class CreateBar(BaseModel):
|
|
||||||
barId: str
|
|
||||||
url: str
|
|
||||||
color: str
|
|
||||||
x: int
|
|
||||||
y: int
|
|
||||||
|
|
||||||
class DeleteBar(BaseModel):
|
|
||||||
barId: str
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
from fastapi import APIRouter, HTTPException
|
|
||||||
from .models import ColorUpdate, PositionUpdate, CreateBar, DeleteBar
|
|
||||||
from .settings_manager import SettingsManager
|
|
||||||
|
|
||||||
router = APIRouter(prefix="/api")
|
|
||||||
settings_manager = SettingsManager()
|
|
||||||
|
|
||||||
@router.get("/settings")
|
|
||||||
async def get_settings():
|
|
||||||
try:
|
|
||||||
return settings_manager.load_settings()
|
|
||||||
except Exception as e:
|
|
||||||
raise HTTPException(status_code=500, detail=f"Error reading settings: {str(e)}")
|
|
||||||
|
|
||||||
@router.post("/settings/color")
|
|
||||||
async def update_color(color_update: ColorUpdate):
|
|
||||||
try:
|
|
||||||
settings_manager.update_color(color_update.barId, color_update.color)
|
|
||||||
return {"success": True, "message": f"Color updated for {color_update.barId}"}
|
|
||||||
except Exception as e:
|
|
||||||
raise HTTPException(status_code=500, detail=f"Error updating settings: {str(e)}")
|
|
||||||
|
|
||||||
@router.post("/settings/position")
|
|
||||||
async def update_position(position_update: PositionUpdate):
|
|
||||||
try:
|
|
||||||
settings_manager.update_position(position_update.barId, position_update.x, position_update.y)
|
|
||||||
return {"success": True, "message": f"Position updated for {position_update.barId}"}
|
|
||||||
except Exception as e:
|
|
||||||
raise HTTPException(status_code=500, detail=f"Error updating settings: {str(e)}")
|
|
||||||
|
|
||||||
@router.post("/settings/create")
|
|
||||||
async def create_bar(create_bar: CreateBar):
|
|
||||||
try:
|
|
||||||
if settings_manager.bar_exists(create_bar.barId):
|
|
||||||
raise HTTPException(status_code=400, detail=f"Bar {create_bar.barId} already exists")
|
|
||||||
|
|
||||||
settings_manager.create_bar(
|
|
||||||
create_bar.barId,
|
|
||||||
create_bar.url,
|
|
||||||
create_bar.color,
|
|
||||||
create_bar.x,
|
|
||||||
create_bar.y
|
|
||||||
)
|
|
||||||
return {"success": True, "message": f"Bar {create_bar.barId} created"}
|
|
||||||
except Exception as e:
|
|
||||||
raise HTTPException(status_code=500, detail=f"Error creating bar: {str(e)}")
|
|
||||||
|
|
||||||
@router.delete("/settings/delete")
|
|
||||||
async def delete_bar(delete_bar: DeleteBar):
|
|
||||||
try:
|
|
||||||
if not settings_manager.bar_exists(delete_bar.barId):
|
|
||||||
raise HTTPException(status_code=404, detail=f"Bar {delete_bar.barId} not found")
|
|
||||||
|
|
||||||
settings_manager.delete_bar(delete_bar.barId)
|
|
||||||
return {"success": True, "message": f"Bar {delete_bar.barId} deleted"}
|
|
||||||
except Exception as e:
|
|
||||||
raise HTTPException(status_code=500, detail=f"Error deleting bar: {str(e)}")
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
import json
|
|
||||||
import os
|
|
||||||
from typing import Dict, Any
|
|
||||||
|
|
||||||
class SettingsManager:
|
|
||||||
def __init__(self, settings_file: str = "settings.json"):
|
|
||||||
self.settings_file = settings_file
|
|
||||||
|
|
||||||
def load_settings(self) -> Dict[str, Any]:
|
|
||||||
try:
|
|
||||||
with open(self.settings_file, "r") as f:
|
|
||||||
return json.load(f)
|
|
||||||
except FileNotFoundError:
|
|
||||||
return {}
|
|
||||||
|
|
||||||
def save_settings(self, settings: Dict[str, Any]) -> None:
|
|
||||||
with open(self.settings_file, "w") as f:
|
|
||||||
json.dump(settings, f, indent=2)
|
|
||||||
|
|
||||||
def update_color(self, bar_id: str, color: str) -> None:
|
|
||||||
settings = self.load_settings()
|
|
||||||
if bar_id in settings:
|
|
||||||
settings[bar_id]["color"] = color
|
|
||||||
self.save_settings(settings)
|
|
||||||
|
|
||||||
def update_position(self, bar_id: str, x: int, y: int) -> None:
|
|
||||||
settings = self.load_settings()
|
|
||||||
if bar_id in settings:
|
|
||||||
settings[bar_id]["x"] = x
|
|
||||||
settings[bar_id]["y"] = y
|
|
||||||
self.save_settings(settings)
|
|
||||||
|
|
||||||
def create_bar(self, bar_id: str, url: str, color: str, x: int, y: int) -> None:
|
|
||||||
settings = self.load_settings()
|
|
||||||
settings[bar_id] = {
|
|
||||||
"url": url,
|
|
||||||
"color": color,
|
|
||||||
"x": x,
|
|
||||||
"y": y
|
|
||||||
}
|
|
||||||
self.save_settings(settings)
|
|
||||||
|
|
||||||
def delete_bar(self, bar_id: str) -> None:
|
|
||||||
settings = self.load_settings()
|
|
||||||
if bar_id in settings:
|
|
||||||
del settings[bar_id]
|
|
||||||
self.save_settings(settings)
|
|
||||||
|
|
||||||
def bar_exists(self, bar_id: str) -> bool:
|
|
||||||
settings = self.load_settings()
|
|
||||||
return bar_id in settings
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
rm -f /home/pi/led-controller/.cursor/debug.log
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"1": {
|
||||||
|
"name": "Main Group",
|
||||||
|
"devices": [
|
||||||
|
"1",
|
||||||
|
"2",
|
||||||
|
"3"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
"name": "Accent Group",
|
||||||
|
"devices": [
|
||||||
|
"4",
|
||||||
|
"5"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"1": {
|
||||||
|
"name": "Default Colors",
|
||||||
|
"colors": [
|
||||||
|
"#FF0000",
|
||||||
|
"#00FF00",
|
||||||
|
"#0000FF",
|
||||||
|
"#FFFF00",
|
||||||
|
"#FF00FF",
|
||||||
|
"#00FFFF",
|
||||||
|
"#FFFFFF",
|
||||||
|
"#000000",
|
||||||
|
"#FFA500",
|
||||||
|
"#800080"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
"name": "Warm Colors",
|
||||||
|
"colors": [
|
||||||
|
"#FF6B6B",
|
||||||
|
"#FF8E53",
|
||||||
|
"#FFA07A",
|
||||||
|
"#FFD700",
|
||||||
|
"#FFA500",
|
||||||
|
"#FF6347"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"3": {
|
||||||
|
"name": "Cool Colors",
|
||||||
|
"colors": [
|
||||||
|
"#4ECDC4",
|
||||||
|
"#44A08D",
|
||||||
|
"#96CEB4",
|
||||||
|
"#A8E6CF",
|
||||||
|
"#5F9EA0",
|
||||||
|
"#4682B4"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"on": {
|
||||||
|
"min_delay": 10,
|
||||||
|
"max_delay": 10000
|
||||||
|
},
|
||||||
|
"off": {
|
||||||
|
"min_delay": 10,
|
||||||
|
"max_delay": 10000
|
||||||
|
},
|
||||||
|
"rainbow": {
|
||||||
|
"Step Rate": "n1",
|
||||||
|
"min_delay": 10,
|
||||||
|
"max_delay": 10000
|
||||||
|
},
|
||||||
|
"transition": {
|
||||||
|
"min_delay": 10,
|
||||||
|
"max_delay": 10000
|
||||||
|
},
|
||||||
|
"chase": {
|
||||||
|
"Colour 1 Length": "n1",
|
||||||
|
"Colour 2 Length": "n2",
|
||||||
|
"Step 1": "n3",
|
||||||
|
"Step 2": "n4",
|
||||||
|
"min_delay": 10,
|
||||||
|
"max_delay": 10000
|
||||||
|
},
|
||||||
|
"pulse": {
|
||||||
|
"Attack": "n1",
|
||||||
|
"Hold": "n2",
|
||||||
|
"Decay": "n3",
|
||||||
|
"min_delay": 10,
|
||||||
|
"max_delay": 10000
|
||||||
|
},
|
||||||
|
"circle": {
|
||||||
|
"Head Rate": "n1",
|
||||||
|
"Max Length": "n2",
|
||||||
|
"Tail Rate": "n3",
|
||||||
|
"Min Length": "n4",
|
||||||
|
"min_delay": 10,
|
||||||
|
"max_delay": 10000
|
||||||
|
},
|
||||||
|
"blink": {
|
||||||
|
"min_delay": 10,
|
||||||
|
"max_delay": 10000
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
{
|
||||||
|
"1": {
|
||||||
|
"name": "Warm White",
|
||||||
|
"pattern": "on",
|
||||||
|
"colors": [
|
||||||
|
"#FFE5B4",
|
||||||
|
"#FFDAB9",
|
||||||
|
"#FFE4B5"
|
||||||
|
],
|
||||||
|
"brightness": 200,
|
||||||
|
"delay": 100,
|
||||||
|
"n1": 10,
|
||||||
|
"n2": 10,
|
||||||
|
"n3": 10,
|
||||||
|
"n4": 10,
|
||||||
|
"n5": 0,
|
||||||
|
"n6": 0
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
"name": "Rainbow",
|
||||||
|
"pattern": "rainbow",
|
||||||
|
"colors": [
|
||||||
|
"#FF0000",
|
||||||
|
"#FF7F00",
|
||||||
|
"#FFFF00",
|
||||||
|
"#00FF00",
|
||||||
|
"#0000FF",
|
||||||
|
"#4B0082",
|
||||||
|
"#9400D3"
|
||||||
|
],
|
||||||
|
"brightness": 255,
|
||||||
|
"delay": 50,
|
||||||
|
"n1": 20,
|
||||||
|
"n2": 15,
|
||||||
|
"n3": 10,
|
||||||
|
"n4": 5,
|
||||||
|
"n5": 0,
|
||||||
|
"n6": 0
|
||||||
|
},
|
||||||
|
"3": {
|
||||||
|
"name": "Pulse Red",
|
||||||
|
"pattern": "pulse",
|
||||||
|
"colors": [
|
||||||
|
"#FF0000",
|
||||||
|
"#CC0000",
|
||||||
|
"#990000"
|
||||||
|
],
|
||||||
|
"brightness": 180,
|
||||||
|
"delay": 200,
|
||||||
|
"n1": 30,
|
||||||
|
"n2": 20,
|
||||||
|
"n3": 10,
|
||||||
|
"n4": 5,
|
||||||
|
"n5": 0,
|
||||||
|
"n6": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"1": {"name": "Default", "tabs": ["1", "2"], "scenes": ["1", "2"], "palette": ["#FF0000", "#00FF00", "#0000FF", "#FFFF00", "#FF00FF", "#00FFFF", "#FFFFFF", "#000000"]}, "2": {"name": "test", "type": "tabs", "tabs": ["12", "13"], "scenes": [], "palette": ["#b93c3c", "#3cb961"], "color_palette": ["#b93c3c", "#3cb961"]}}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"1": {
|
||||||
|
"name": "Default Scene",
|
||||||
|
"sequences": [
|
||||||
|
"1"
|
||||||
|
],
|
||||||
|
"groups": [
|
||||||
|
"1"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
"name": "Party Mode",
|
||||||
|
"sequences": [
|
||||||
|
"1",
|
||||||
|
"2"
|
||||||
|
],
|
||||||
|
"groups": [
|
||||||
|
"1",
|
||||||
|
"2"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"1": {
|
||||||
|
"group_name": "Main Group",
|
||||||
|
"presets": [
|
||||||
|
"1",
|
||||||
|
"2"
|
||||||
|
],
|
||||||
|
"sequence_duration": 3000,
|
||||||
|
"sequence_transition": 500,
|
||||||
|
"sequence_loop": true,
|
||||||
|
"sequence_repeat_count": 0,
|
||||||
|
"sequence_active": false,
|
||||||
|
"sequence_index": 0,
|
||||||
|
"sequence_start_time": 0
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
"group_name": "Accent Group",
|
||||||
|
"presets": [
|
||||||
|
"2",
|
||||||
|
"3"
|
||||||
|
],
|
||||||
|
"sequence_duration": 2000,
|
||||||
|
"sequence_transition": 300,
|
||||||
|
"sequence_loop": true,
|
||||||
|
"sequence_repeat_count": 0,
|
||||||
|
"sequence_active": false,
|
||||||
|
"sequence_index": 0,
|
||||||
|
"sequence_start_time": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"1": {"name": "Main", "names": ["1", "2", "3"], "presets": ["1", "2"]}, "2": {"name": "Accent", "names": ["4", "5"], "presets": ["2", "3"]}, "3": {"name": "", "names": [], "presets": []}, "4": {"name": "", "names": [], "presets": []}, "5": {"name": "", "names": [], "presets": []}, "6": {"name": "", "names": [], "presets": []}, "7": {"name": "", "names": [], "presets": []}, "8": {"name": "", "names": [], "presets": []}, "9": {"name": "", "names": [], "presets": []}, "10": {"name": "", "names": [], "presets": []}, "11": {"name": "", "names": [], "presets": []}, "12": {"name": "test2", "names": ["1"], "presets": [], "colors": ["#b93c3c", "#761e1e", "#ffffff"]}, "13": {"name": "test5", "names": ["1"], "presets": []}}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
import serial
|
||||||
|
import sys
|
||||||
|
|
||||||
|
print(sys.argv)
|
||||||
|
|
||||||
|
# Extract port (first arg if it's not a command)
|
||||||
|
commands = ["src", "lib", "ls", "reset", "follow", "db"]
|
||||||
|
port = None
|
||||||
|
if len(sys.argv) > 1 and sys.argv[1] not in commands:
|
||||||
|
port = sys.argv[1]
|
||||||
|
|
||||||
|
|
||||||
|
for cmd in sys.argv[1:]:
|
||||||
|
print(cmd)
|
||||||
|
match cmd:
|
||||||
|
case "src":
|
||||||
|
if port:
|
||||||
|
subprocess.call(["mpremote", "connect", port, "fs", "cp", "-r", ".", ":" ], cwd="src")
|
||||||
|
else:
|
||||||
|
print("Error: Port required for 'src' command")
|
||||||
|
case "lib":
|
||||||
|
if port:
|
||||||
|
subprocess.call(["mpremote", "connect", port, "fs", "cp", "-r", "lib", ":" ])
|
||||||
|
else:
|
||||||
|
print("Error: Port required for 'lib' command")
|
||||||
|
case "ls":
|
||||||
|
if port:
|
||||||
|
subprocess.call(["mpremote", "connect", port, "fs", "ls", ":" ])
|
||||||
|
else:
|
||||||
|
print("Error: Port required for 'ls' command")
|
||||||
|
case "reset":
|
||||||
|
if port:
|
||||||
|
with serial.Serial(port, baudrate=115200) as ser:
|
||||||
|
ser.write(b'\x03\x03\x04')
|
||||||
|
else:
|
||||||
|
print("Error: Port required for 'reset' command")
|
||||||
|
case "follow":
|
||||||
|
if port:
|
||||||
|
with serial.Serial(port, baudrate=115200) as ser:
|
||||||
|
while True:
|
||||||
|
if ser.in_waiting > 0: # Check if there is data in the buffer
|
||||||
|
data = ser.readline().decode('utf-8').strip() # Read and decode the data
|
||||||
|
print(data)
|
||||||
|
else:
|
||||||
|
print("Error: Port required for 'follow' command")
|
||||||
|
case "db":
|
||||||
|
if port:
|
||||||
|
subprocess.call(["mpremote", "connect", port, "fs", "cp", "-r", "db", ":" ])
|
||||||
|
else:
|
||||||
|
print("Error: Port required for 'db' command")
|
||||||
@@ -0,0 +1,504 @@
|
|||||||
|
# LED Controller API Specification
|
||||||
|
|
||||||
|
**Base URL:** `http://device-ip/` or `http://192.168.4.1/` (when in AP mode)
|
||||||
|
**Protocol:** HTTP/1.1
|
||||||
|
**Content-Type:** `application/json`
|
||||||
|
|
||||||
|
## Presets API
|
||||||
|
|
||||||
|
### GET /presets
|
||||||
|
|
||||||
|
List all presets.
|
||||||
|
|
||||||
|
**Response:** `200 OK`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"preset1": {
|
||||||
|
"name": "preset1",
|
||||||
|
"pattern": "on",
|
||||||
|
"colors": [[255, 0, 0]],
|
||||||
|
"delay": 100,
|
||||||
|
"n1": 0,
|
||||||
|
"n2": 0,
|
||||||
|
"n3": 0,
|
||||||
|
"n4": 0,
|
||||||
|
"n5": 0,
|
||||||
|
"n6": 0,
|
||||||
|
"n7": 0,
|
||||||
|
"n8": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### GET /presets/{name}
|
||||||
|
|
||||||
|
Get a specific preset by name.
|
||||||
|
|
||||||
|
**Response:** `200 OK`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "preset1",
|
||||||
|
"pattern": "on",
|
||||||
|
"colors": [[255, 0, 0]],
|
||||||
|
"delay": 100,
|
||||||
|
"n1": 0,
|
||||||
|
"n2": 0,
|
||||||
|
"n3": 0,
|
||||||
|
"n4": 0,
|
||||||
|
"n5": 0,
|
||||||
|
"n6": 0,
|
||||||
|
"n7": 0,
|
||||||
|
"n8": 0
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:** `404 Not Found`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Preset not found"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### POST /presets
|
||||||
|
|
||||||
|
Create a new preset.
|
||||||
|
|
||||||
|
**Request Body:**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "preset1",
|
||||||
|
"pattern": "on",
|
||||||
|
"colors": [[255, 0, 0]],
|
||||||
|
"delay": 100,
|
||||||
|
"n1": 0,
|
||||||
|
"n2": 0,
|
||||||
|
"n3": 0,
|
||||||
|
"n4": 0,
|
||||||
|
"n5": 0,
|
||||||
|
"n6": 0,
|
||||||
|
"n7": 0,
|
||||||
|
"n8": 0
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:** `201 Created` - Returns the created preset
|
||||||
|
|
||||||
|
**Response:** `400 Bad Request`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Name is required"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:** `409 Conflict`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Preset already exists"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### PUT /presets/{name}
|
||||||
|
|
||||||
|
Update an existing preset.
|
||||||
|
|
||||||
|
**Request Body:**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"delay": 200,
|
||||||
|
"colors": [[0, 255, 0]]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:** `200 OK` - Returns the updated preset
|
||||||
|
|
||||||
|
**Response:** `404 Not Found`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Preset not found"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### DELETE /presets/{name}
|
||||||
|
|
||||||
|
Delete a preset.
|
||||||
|
|
||||||
|
**Response:** `200 OK`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"message": "Preset deleted successfully"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:** `404 Not Found`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Preset not found"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Profiles API
|
||||||
|
|
||||||
|
### GET /profiles
|
||||||
|
|
||||||
|
List all profiles.
|
||||||
|
|
||||||
|
**Response:** `200 OK`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"profile1": {
|
||||||
|
"name": "profile1",
|
||||||
|
"description": "Profile description",
|
||||||
|
"scenes": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### GET /profiles/{name}
|
||||||
|
|
||||||
|
Get a specific profile by name.
|
||||||
|
|
||||||
|
**Response:** `200 OK`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "profile1",
|
||||||
|
"description": "Profile description",
|
||||||
|
"scenes": []
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:** `404 Not Found`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Profile not found"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### POST /profiles
|
||||||
|
|
||||||
|
Create a new profile.
|
||||||
|
|
||||||
|
**Request Body:**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "profile1",
|
||||||
|
"description": "Profile description",
|
||||||
|
"scenes": []
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:** `201 Created` - Returns the created profile
|
||||||
|
|
||||||
|
**Response:** `400 Bad Request`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Name is required"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:** `409 Conflict`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Profile already exists"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### PUT /profiles/{name}
|
||||||
|
|
||||||
|
Update an existing profile.
|
||||||
|
|
||||||
|
**Request Body:**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"description": "Updated description"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:** `200 OK` - Returns the updated profile
|
||||||
|
|
||||||
|
**Response:** `404 Not Found`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Profile not found"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### DELETE /profiles/{name}
|
||||||
|
|
||||||
|
Delete a profile.
|
||||||
|
|
||||||
|
**Response:** `200 OK`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"message": "Profile deleted successfully"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:** `404 Not Found`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Profile not found"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Scenes API
|
||||||
|
|
||||||
|
### GET /scenes
|
||||||
|
|
||||||
|
List all scenes. Optionally filter by profile using query parameter.
|
||||||
|
|
||||||
|
**Query Parameters:**
|
||||||
|
- `profile` (optional): Filter scenes by profile name
|
||||||
|
|
||||||
|
**Example:** `GET /scenes?profile=profile1`
|
||||||
|
|
||||||
|
**Response:** `200 OK`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"profile1:scene1": {
|
||||||
|
"name": "scene1",
|
||||||
|
"profile_name": "profile1",
|
||||||
|
"description": "Scene description",
|
||||||
|
"transition_time": 0,
|
||||||
|
"devices": [
|
||||||
|
{"device_name": "device1", "preset_name": "preset1"},
|
||||||
|
{"device_name": "device2", "preset_name": "preset2"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### GET /scenes/{profile_name}/{scene_name}
|
||||||
|
|
||||||
|
Get a specific scene.
|
||||||
|
|
||||||
|
**Response:** `200 OK`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "scene1",
|
||||||
|
"profile_name": "profile1",
|
||||||
|
"description": "Scene description",
|
||||||
|
"transition_time": 0,
|
||||||
|
"devices": [
|
||||||
|
{"device_name": "device1", "preset_name": "preset1"},
|
||||||
|
{"device_name": "device2", "preset_name": "preset2"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:** `404 Not Found`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Scene not found"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### POST /scenes
|
||||||
|
|
||||||
|
Create a new scene.
|
||||||
|
|
||||||
|
**Request Body:**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "scene1",
|
||||||
|
"profile_name": "profile1",
|
||||||
|
"description": "Scene description",
|
||||||
|
"transition_time": 0,
|
||||||
|
"devices": [
|
||||||
|
{"device_name": "device1", "preset_name": "preset1"},
|
||||||
|
{"device_name": "device2", "preset_name": "preset2"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:** `201 Created` - Returns the created scene
|
||||||
|
|
||||||
|
**Response:** `400 Bad Request`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Name is required"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Profile name is required"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:** `409 Conflict`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Scene already exists"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### PUT /scenes/{profile_name}/{scene_name}
|
||||||
|
|
||||||
|
Update an existing scene.
|
||||||
|
|
||||||
|
**Request Body:**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"transition_time": 500,
|
||||||
|
"description": "Updated description"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:** `200 OK` - Returns the updated scene
|
||||||
|
|
||||||
|
**Response:** `404 Not Found`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Scene not found"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### DELETE /scenes/{profile_name}/{scene_name}
|
||||||
|
|
||||||
|
Delete a scene.
|
||||||
|
|
||||||
|
**Response:** `200 OK`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"message": "Scene deleted successfully"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:** `404 Not Found`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Scene not found"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### POST /scenes/{profile_name}/{scene_name}/devices
|
||||||
|
|
||||||
|
Add a device assignment to a scene.
|
||||||
|
|
||||||
|
**Request Body:**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"device_name": "device1",
|
||||||
|
"preset_name": "preset1"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:** `200 OK` - Returns the updated scene
|
||||||
|
|
||||||
|
**Response:** `400 Bad Request`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Device name and preset name are required"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:** `404 Not Found`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Scene not found"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### DELETE /scenes/{profile_name}/{scene_name}/devices/{device_name}
|
||||||
|
|
||||||
|
Remove a device assignment from a scene.
|
||||||
|
|
||||||
|
**Response:** `200 OK` - Returns the updated scene
|
||||||
|
|
||||||
|
**Response:** `404 Not Found`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Scene not found"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Patterns API
|
||||||
|
|
||||||
|
### GET /patterns
|
||||||
|
|
||||||
|
Get the list of available pattern names.
|
||||||
|
|
||||||
|
**Response:** `200 OK`
|
||||||
|
```json
|
||||||
|
["on", "bl", "cl", "rb", "sb", "o"]
|
||||||
|
```
|
||||||
|
|
||||||
|
### POST /patterns
|
||||||
|
|
||||||
|
Add a new pattern name to the list.
|
||||||
|
|
||||||
|
**Request Body:**
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": "new_pattern"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:** `201 Created` - Returns the updated list of patterns
|
||||||
|
```json
|
||||||
|
["on", "bl", "cl", "rb", "sb", "o", "new_pattern"]
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:** `400 Bad Request`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Name is required"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:** `409 Conflict`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Pattern already exists"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### DELETE /patterns/{name}
|
||||||
|
|
||||||
|
Remove a pattern name from the list.
|
||||||
|
|
||||||
|
**Response:** `200 OK`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"message": "Pattern deleted successfully"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Response:** `404 Not Found`
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Pattern not found"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Error Responses
|
||||||
|
|
||||||
|
All endpoints may return the following error responses:
|
||||||
|
|
||||||
|
**400 Bad Request** - Invalid request data
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Error message"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**404 Not Found** - Resource not found
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Resource not found"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**409 Conflict** - Resource already exists
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Resource already exists"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**500 Internal Server Error** - Server error
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"error": "Error message"
|
||||||
|
}
|
||||||
|
```
|
||||||
@@ -0,0 +1,239 @@
|
|||||||
|
# Custom Color Picker Component
|
||||||
|
|
||||||
|
A cross-platform, cross-browser color picker component that provides a consistent user experience across all operating systems and browsers.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
✅ **Consistent UI** - Same appearance and behavior on Windows, macOS, Linux, iOS, and Android
|
||||||
|
✅ **Browser Support** - Works in Chrome, Firefox, Safari, Edge, Opera, and mobile browsers
|
||||||
|
✅ **Touch Support** - Full touch/gesture support for mobile devices
|
||||||
|
✅ **HSB Color Model** - Uses Hue, Saturation, Brightness for intuitive color selection
|
||||||
|
✅ **Multiple Input Methods** - Hex input, RGB inputs, and visual picker
|
||||||
|
✅ **Accessible** - Keyboard accessible and screen reader friendly
|
||||||
|
✅ **Customizable** - Easy to style and integrate
|
||||||
|
|
||||||
|
## Files
|
||||||
|
|
||||||
|
- `color-picker.js` - Main JavaScript component (14KB)
|
||||||
|
- `color-picker.css` - Stylesheet (4KB)
|
||||||
|
- `color-picker-demo.html` - Demo page showing usage examples
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
### 1. Include the files
|
||||||
|
|
||||||
|
```html
|
||||||
|
<link rel="stylesheet" href="color-picker.css">
|
||||||
|
<script src="color-picker.js"></script>
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Create a container element
|
||||||
|
|
||||||
|
```html
|
||||||
|
<div id="my-color-picker"></div>
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Initialize the color picker
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const picker = new ColorPicker('#my-color-picker', {
|
||||||
|
initialColor: '#FF0000',
|
||||||
|
onColorChange: (color) => {
|
||||||
|
console.log('Color changed to:', color);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### Constructor
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
new ColorPicker(container, options)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Parameters:**
|
||||||
|
- `container` (string|HTMLElement) - CSS selector or DOM element
|
||||||
|
- `options` (object) - Configuration options
|
||||||
|
|
||||||
|
**Options:**
|
||||||
|
- `initialColor` (string) - Initial color in hex format (default: '#FF0000')
|
||||||
|
- `onColorChange` (function) - Callback when color changes (receives hex color string)
|
||||||
|
- `showHexInput` (boolean) - Show hex input field (default: true)
|
||||||
|
|
||||||
|
### Methods
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// Get current color
|
||||||
|
const color = picker.getColor(); // Returns hex string like '#FF0000'
|
||||||
|
|
||||||
|
// Set color programmatically
|
||||||
|
picker.setColor('#00FF00');
|
||||||
|
|
||||||
|
// Open the picker panel
|
||||||
|
picker.open();
|
||||||
|
|
||||||
|
// Close the picker panel
|
||||||
|
picker.close();
|
||||||
|
|
||||||
|
// Toggle the picker panel
|
||||||
|
picker.toggle();
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage Examples
|
||||||
|
|
||||||
|
### Basic Usage
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const picker = new ColorPicker('#picker1', {
|
||||||
|
initialColor: '#FF0000'
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### With Callback
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const picker = new ColorPicker('#picker1', {
|
||||||
|
initialColor: '#FF0000',
|
||||||
|
onColorChange: (color) => {
|
||||||
|
document.body.style.backgroundColor = color;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Multiple Color Pickers
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const colors = ['#FF0000', '#00FF00', '#0000FF'];
|
||||||
|
const pickers = colors.map((color, index) => {
|
||||||
|
return new ColorPicker(`#picker-${index}`, {
|
||||||
|
initialColor: color,
|
||||||
|
onColorChange: (newColor) => {
|
||||||
|
colors[index] = newColor;
|
||||||
|
updateLEDColors(colors);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Dynamic Color Picker Creation
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
function addColorPicker(containerId, initialColor = '#000000') {
|
||||||
|
const container = document.createElement('div');
|
||||||
|
container.id = containerId;
|
||||||
|
document.getElementById('color-list').appendChild(container);
|
||||||
|
|
||||||
|
return new ColorPicker(container, {
|
||||||
|
initialColor: initialColor,
|
||||||
|
onColorChange: (color) => {
|
||||||
|
console.log(`Color ${containerId} changed to ${color}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add multiple pickers
|
||||||
|
addColorPicker('color-1', '#FF0000');
|
||||||
|
addColorPicker('color-2', '#00FF00');
|
||||||
|
```
|
||||||
|
|
||||||
|
## Styling
|
||||||
|
|
||||||
|
The color picker uses CSS classes that can be customized:
|
||||||
|
|
||||||
|
- `.color-picker-container` - Main container
|
||||||
|
- `.color-picker-preview` - Color preview button
|
||||||
|
- `.color-picker-panel` - Dropdown panel
|
||||||
|
- `.color-picker-main` - Main color area
|
||||||
|
- `.color-picker-hue` - Hue slider
|
||||||
|
- `.color-picker-controls` - Controls section
|
||||||
|
|
||||||
|
### Custom Styling Example
|
||||||
|
|
||||||
|
```css
|
||||||
|
.color-picker-preview {
|
||||||
|
width: 80px;
|
||||||
|
height: 80px;
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-panel {
|
||||||
|
background: #2d3748;
|
||||||
|
border-color: #4a5568;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Browser Compatibility
|
||||||
|
|
||||||
|
| Browser | Version | Status |
|
||||||
|
|---------|---------|--------|
|
||||||
|
| Chrome | 60+ | ✅ Full support |
|
||||||
|
| Firefox | 55+ | ✅ Full support |
|
||||||
|
| Safari | 12+ | ✅ Full support |
|
||||||
|
| Edge | 79+ | ✅ Full support |
|
||||||
|
| Opera | 47+ | ✅ Full support |
|
||||||
|
| Mobile Safari | iOS 12+ | ✅ Full support |
|
||||||
|
| Chrome Mobile | Android 7+ | ✅ Full support |
|
||||||
|
|
||||||
|
## Operating System Compatibility
|
||||||
|
|
||||||
|
- ✅ Windows 10/11
|
||||||
|
- ✅ macOS 10.14+
|
||||||
|
- ✅ Linux (all major distributions)
|
||||||
|
- ✅ iOS 12+
|
||||||
|
- ✅ Android 7+
|
||||||
|
|
||||||
|
## Color Format
|
||||||
|
|
||||||
|
The color picker uses **hex color format** (`#RRGGBB`):
|
||||||
|
- Always returns uppercase hex strings (e.g., `#FF0000`)
|
||||||
|
- Accepts both uppercase and lowercase input
|
||||||
|
- Automatically validates hex format
|
||||||
|
|
||||||
|
## Integration with LED Driver Mockups
|
||||||
|
|
||||||
|
The color picker is integrated into:
|
||||||
|
- `dashboard.html` - Color selection for patterns
|
||||||
|
- `presets.html` - Color selection when creating/editing presets
|
||||||
|
|
||||||
|
### Example: Getting Colors from Multiple Pickers
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const colorPickers = [];
|
||||||
|
|
||||||
|
function getSelectedColors() {
|
||||||
|
return colorPickers.map(picker => picker.getColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendColorsToDevice() {
|
||||||
|
const colors = getSelectedColors();
|
||||||
|
// Send to LED device via API
|
||||||
|
fetch('/api/colors', {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify({ colors: colors })
|
||||||
|
});
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Performance
|
||||||
|
|
||||||
|
- Lightweight: ~14KB JavaScript, ~4KB CSS
|
||||||
|
- Fast rendering: Uses Canvas API for color gradients
|
||||||
|
- Smooth interactions: Optimized event handling
|
||||||
|
- Memory efficient: No external dependencies
|
||||||
|
|
||||||
|
## Accessibility
|
||||||
|
|
||||||
|
- Keyboard navigation support
|
||||||
|
- ARIA labels on interactive elements
|
||||||
|
- High contrast cursor indicators
|
||||||
|
- Screen reader compatible
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Part of the LED Driver project. Use freely in your projects.
|
||||||
|
|
||||||
|
## Demo
|
||||||
|
|
||||||
|
See `color-picker-demo.html` for a live demonstration of the color picker component.
|
||||||
|
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
# UI Mockups
|
||||||
|
|
||||||
|
This directory contains HTML mockups and generated images for the LED Driver user interface.
|
||||||
|
|
||||||
|
## Files
|
||||||
|
|
||||||
|
### HTML Mockups
|
||||||
|
- **index.html** - Navigation page linking to all mockups
|
||||||
|
- **dashboard.html** - Main control panel for managing LED patterns and devices
|
||||||
|
- **pattern-selector.html** - Visual pattern selection interface
|
||||||
|
- **device-management.html** - Device and group management interface
|
||||||
|
- **settings.html** - Comprehensive settings configuration panel
|
||||||
|
|
||||||
|
### Generated Images
|
||||||
|
Images are automatically generated in the `images/` directory:
|
||||||
|
- `dashboard.png`
|
||||||
|
- `pattern-selector.png`
|
||||||
|
- `device-management.png`
|
||||||
|
- `settings.png`
|
||||||
|
- `index.png`
|
||||||
|
|
||||||
|
## Generating Images
|
||||||
|
|
||||||
|
To generate images from the HTML files, use the provided script:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install dependencies (if not already installed)
|
||||||
|
pipenv install playwright
|
||||||
|
pipenv run playwright install chromium
|
||||||
|
|
||||||
|
# Generate images
|
||||||
|
pipenv run python generate_images.py
|
||||||
|
```
|
||||||
|
|
||||||
|
The script will:
|
||||||
|
1. Check for available screenshot libraries (Playwright, Selenium, or html2image)
|
||||||
|
2. Generate PNG images from all HTML files
|
||||||
|
3. Save images to the `images/` directory
|
||||||
|
|
||||||
|
### Requirements
|
||||||
|
|
||||||
|
The script supports multiple screenshot libraries (in order of preference):
|
||||||
|
1. **Playwright** (recommended) - `pip install playwright && playwright install chromium`
|
||||||
|
2. **Selenium** - `pip install selenium` (requires ChromeDriver)
|
||||||
|
3. **html2image** - `pip install html2image`
|
||||||
|
|
||||||
|
## Viewing Mockups
|
||||||
|
|
||||||
|
Simply open any HTML file in a web browser to view the mockup. Start with `index.html` for navigation to all mockups.
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
- All mockups are responsive and work on desktop and mobile devices
|
||||||
|
- The mockups use modern CSS with gradients and smooth animations
|
||||||
|
- Interactive elements (buttons, sliders, etc.) are functional in the HTML but are mockups (no backend connection)
|
||||||
|
|
||||||
@@ -0,0 +1,210 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Chromium Color Picker Demo</title>
|
||||||
|
<link rel="stylesheet" href="color-picker-chromium.css">
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&family=Roboto+Mono&display=swap" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||||
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||||
|
min-height: 100vh;
|
||||||
|
padding: 40px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
max-width: 800px;
|
||||||
|
margin: 0 auto;
|
||||||
|
background: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 40px;
|
||||||
|
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
color: #202124;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
color: #5f6368;
|
||||||
|
margin-bottom: 32px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.demo-section {
|
||||||
|
margin-bottom: 40px;
|
||||||
|
padding: 24px;
|
||||||
|
background: #f8f9fa;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid #e8eaed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.demo-section h2 {
|
||||||
|
color: #202124;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-pickers {
|
||||||
|
display: flex;
|
||||||
|
gap: 24px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-display {
|
||||||
|
margin-top: 16px;
|
||||||
|
padding: 12px;
|
||||||
|
background: white;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-family: 'Roboto Mono', 'Courier New', monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
border: 1px solid #e8eaed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-display strong {
|
||||||
|
color: #4285f4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comparison {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 24px;
|
||||||
|
margin-top: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comparison-item {
|
||||||
|
padding: 16px;
|
||||||
|
background: white;
|
||||||
|
border-radius: 6px;
|
||||||
|
border: 1px solid #e8eaed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comparison-item h3 {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #202124;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<h1>Chromium-style Color Picker</h1>
|
||||||
|
<p>Color picker that matches the native Chromium browser color picker design</p>
|
||||||
|
|
||||||
|
<div class="demo-section">
|
||||||
|
<h2>Single Color Picker</h2>
|
||||||
|
<div class="color-pickers">
|
||||||
|
<div id="picker1"></div>
|
||||||
|
</div>
|
||||||
|
<div class="color-display">
|
||||||
|
Selected color: <strong id="color1-display">#FF0000</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="demo-section">
|
||||||
|
<h2>Multiple Color Pickers</h2>
|
||||||
|
<p style="margin-bottom: 16px; color: #5f6368; font-size: 14px;">Example: Multiple colors for LED patterns</p>
|
||||||
|
<div class="color-pickers">
|
||||||
|
<div id="picker2"></div>
|
||||||
|
<div id="picker3"></div>
|
||||||
|
<div id="picker4"></div>
|
||||||
|
</div>
|
||||||
|
<div class="color-display">
|
||||||
|
Colors: <strong id="colors-display">#FF0000, #00FF00, #0000FF</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="demo-section">
|
||||||
|
<h2>Features</h2>
|
||||||
|
<ul style="color: #5f6368; line-height: 1.8; font-size: 14px;">
|
||||||
|
<li>✅ Matches native Chromium browser color picker design</li>
|
||||||
|
<li>✅ Clean, minimal interface with native system fonts</li>
|
||||||
|
<li>✅ RGB number inputs (no sliders) - Chromium style</li>
|
||||||
|
<li>✅ Hex input with uppercase formatting</li>
|
||||||
|
<li>✅ HSB (Hue, Saturation, Brightness) color model</li>
|
||||||
|
<li>✅ Touch support for mobile devices</li>
|
||||||
|
<li>✅ Keyboard accessible</li>
|
||||||
|
<li>✅ Dark mode support</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="demo-section">
|
||||||
|
<h2>Design Notes</h2>
|
||||||
|
<div class="comparison">
|
||||||
|
<div class="comparison-item">
|
||||||
|
<h3>Chromium Style</h3>
|
||||||
|
<ul style="color: #5f6368; line-height: 1.8; font-size: 13px; list-style: none; padding-left: 0;">
|
||||||
|
<li>• RGB number inputs only</li>
|
||||||
|
<li>• Compact preview button</li>
|
||||||
|
<li>• Native system fonts</li>
|
||||||
|
<li>• Minimal borders and shadows</li>
|
||||||
|
<li>• Chromium color scheme</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="comparison-item">
|
||||||
|
<h3>Standard Style</h3>
|
||||||
|
<ul style="color: #5f6368; line-height: 1.8; font-size: 13px; list-style: none; padding-left: 0;">
|
||||||
|
<li>• RGB sliders + inputs</li>
|
||||||
|
<li>• Larger preview button</li>
|
||||||
|
<li>• Custom styling</li>
|
||||||
|
<li>• Enhanced shadows</li>
|
||||||
|
<li>• Custom color scheme</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="color-picker-chromium.js"></script>
|
||||||
|
<script>
|
||||||
|
// Initialize Chromium-style color pickers
|
||||||
|
const picker1 = new ColorPickerChromium('#picker1', {
|
||||||
|
initialColor: '#FF0000',
|
||||||
|
onColorChange: (color) => {
|
||||||
|
document.getElementById('color1-display').textContent = color;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const picker2 = new ColorPickerChromium('#picker2', {
|
||||||
|
initialColor: '#FF0000',
|
||||||
|
onColorChange: updateColors
|
||||||
|
});
|
||||||
|
|
||||||
|
const picker3 = new ColorPickerChromium('#picker3', {
|
||||||
|
initialColor: '#00FF00',
|
||||||
|
onColorChange: updateColors
|
||||||
|
});
|
||||||
|
|
||||||
|
const picker4 = new ColorPickerChromium('#picker4', {
|
||||||
|
initialColor: '#0000FF',
|
||||||
|
onColorChange: updateColors
|
||||||
|
});
|
||||||
|
|
||||||
|
function updateColors() {
|
||||||
|
const colors = [
|
||||||
|
picker2.getColor(),
|
||||||
|
picker3.getColor(),
|
||||||
|
picker4.getColor()
|
||||||
|
];
|
||||||
|
document.getElementById('colors-display').textContent = colors.join(', ');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
@@ -0,0 +1,253 @@
|
|||||||
|
/* Chromium-style Color Picker - Matches native browser color picker dialog */
|
||||||
|
|
||||||
|
.color-picker-container {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Preview button - opens the picker */
|
||||||
|
.color-picker-preview {
|
||||||
|
width: 40px;
|
||||||
|
height: 32px;
|
||||||
|
border: 1px solid #d0d0d0;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 0;
|
||||||
|
background: none;
|
||||||
|
transition: border-color 0.15s;
|
||||||
|
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-preview:hover {
|
||||||
|
border-color: #8ab4f8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-preview:active {
|
||||||
|
border-color: #4285f4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Main picker panel - always visible when open, styled like Chromium dialog */
|
||||||
|
.color-picker-panel {
|
||||||
|
position: absolute;
|
||||||
|
top: calc(100% + 4px);
|
||||||
|
left: 0;
|
||||||
|
z-index: 1000;
|
||||||
|
background: #ffffff;
|
||||||
|
border: 1px solid #dadce0;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.1);
|
||||||
|
padding: 16px;
|
||||||
|
min-width: 260px;
|
||||||
|
font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Color area - main saturation/brightness square + hue slider */
|
||||||
|
.color-picker-area {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Main color square - saturation (left-right) and brightness (top-bottom) */
|
||||||
|
.color-picker-main {
|
||||||
|
position: relative;
|
||||||
|
width: 200px;
|
||||||
|
height: 200px;
|
||||||
|
border: 1px solid #dadce0;
|
||||||
|
border-radius: 4px;
|
||||||
|
overflow: hidden;
|
||||||
|
cursor: crosshair;
|
||||||
|
touch-action: none;
|
||||||
|
background: #ffffff;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-canvas {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
user-select: none;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Cursor for main color area */
|
||||||
|
.color-picker-cursor {
|
||||||
|
position: absolute;
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
border: 2px solid #ffffff;
|
||||||
|
border-radius: 50%;
|
||||||
|
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||||
|
pointer-events: none;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hue slider - vertical strip on the right */
|
||||||
|
.color-picker-hue {
|
||||||
|
position: relative;
|
||||||
|
width: 24px;
|
||||||
|
height: 200px;
|
||||||
|
border: 1px solid #dadce0;
|
||||||
|
border-radius: 4px;
|
||||||
|
overflow: hidden;
|
||||||
|
cursor: pointer;
|
||||||
|
touch-action: none;
|
||||||
|
background: #ffffff;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hue slider cursor/indicator */
|
||||||
|
.color-picker-hue-cursor {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 6px;
|
||||||
|
border: 2px solid #ffffff;
|
||||||
|
border-radius: 2px;
|
||||||
|
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||||
|
pointer-events: none;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Controls section - hex and RGB inputs */
|
||||||
|
.color-picker-controls {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hex input field */
|
||||||
|
.color-picker-hex {
|
||||||
|
width: 100%;
|
||||||
|
padding: 7px 10px;
|
||||||
|
border: 1px solid #dadce0;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-family: 'Roboto Mono', 'Courier New', monospace;
|
||||||
|
font-size: 13px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
transition: border-color 0.15s, box-shadow 0.15s;
|
||||||
|
background: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-hex:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: #4285f4;
|
||||||
|
box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* RGB inputs container */
|
||||||
|
.color-picker-rgb {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
align-items: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-rgb-item {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-rgb-item label {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #5f6368;
|
||||||
|
text-align: left;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* RGB number input fields */
|
||||||
|
.color-picker-rgb-input {
|
||||||
|
width: 100%;
|
||||||
|
padding: 7px 10px;
|
||||||
|
border: 1px solid #dadce0;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 13px;
|
||||||
|
text-align: left;
|
||||||
|
transition: border-color 0.15s, box-shadow 0.15s;
|
||||||
|
background: #ffffff;
|
||||||
|
font-family: 'Roboto', sans-serif;
|
||||||
|
-moz-appearance: textfield;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-rgb-input::-webkit-outer-spin-button,
|
||||||
|
.color-picker-rgb-input::-webkit-inner-spin-button {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-rgb-input:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: #4285f4;
|
||||||
|
box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hide RGB sliders - Chromium uses only number inputs */
|
||||||
|
.color-picker-rgb-slider {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Responsive adjustments */
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
.color-picker-panel {
|
||||||
|
left: auto;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-main {
|
||||||
|
width: 180px;
|
||||||
|
height: 180px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-hue {
|
||||||
|
height: 180px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dark mode support */
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
.color-picker-panel {
|
||||||
|
background: #202124;
|
||||||
|
border-color: #5f6368;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-preview {
|
||||||
|
border-color: #5f6368;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-main,
|
||||||
|
.color-picker-hue {
|
||||||
|
border-color: #5f6368;
|
||||||
|
background: #202124;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-hex,
|
||||||
|
.color-picker-rgb-input {
|
||||||
|
background: #303134;
|
||||||
|
border-color: #5f6368;
|
||||||
|
color: #e8eaed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-rgb-item label {
|
||||||
|
color: #9aa0a6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-hex:focus,
|
||||||
|
.color-picker-rgb-input:focus {
|
||||||
|
border-color: #8ab4f8;
|
||||||
|
box-shadow: 0 0 0 2px rgba(138, 180, 248, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-preview:hover {
|
||||||
|
border-color: #8ab4f8;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,452 @@
|
|||||||
|
/**
|
||||||
|
* Chromium-style Color Picker Component
|
||||||
|
* Matches native Chromium browser color picker design
|
||||||
|
*/
|
||||||
|
|
||||||
|
class ColorPickerChromium {
|
||||||
|
constructor(container, options = {}) {
|
||||||
|
this.container = typeof container === 'string' ? document.querySelector(container) : container;
|
||||||
|
this.options = {
|
||||||
|
initialColor: options.initialColor || '#FF0000',
|
||||||
|
onColorChange: options.onColorChange || null,
|
||||||
|
showHexInput: options.showHexInput !== false,
|
||||||
|
...options
|
||||||
|
};
|
||||||
|
this.currentColor = this.options.initialColor;
|
||||||
|
this.isOpen = false;
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
this.createPicker();
|
||||||
|
this.setupEventListeners();
|
||||||
|
this.updateColor(this.options.initialColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
createPicker() {
|
||||||
|
this.container.innerHTML = '';
|
||||||
|
this.container.className = 'color-picker-container';
|
||||||
|
|
||||||
|
// Color preview button
|
||||||
|
this.previewBtn = document.createElement('button');
|
||||||
|
this.previewBtn.className = 'color-picker-preview';
|
||||||
|
this.previewBtn.type = 'button';
|
||||||
|
this.previewBtn.style.backgroundColor = this.currentColor;
|
||||||
|
this.previewBtn.setAttribute('aria-label', 'Open color picker');
|
||||||
|
|
||||||
|
// Dropdown panel
|
||||||
|
this.panel = document.createElement('div');
|
||||||
|
this.panel.className = 'color-picker-panel';
|
||||||
|
this.panel.style.display = 'none';
|
||||||
|
|
||||||
|
// Main color area (hue/saturation)
|
||||||
|
this.mainArea = document.createElement('div');
|
||||||
|
this.mainArea.className = 'color-picker-main';
|
||||||
|
this.mainCanvas = document.createElement('canvas');
|
||||||
|
this.mainCanvas.width = 200;
|
||||||
|
this.mainCanvas.height = 200;
|
||||||
|
this.mainCanvas.className = 'color-picker-canvas';
|
||||||
|
this.mainArea.appendChild(this.mainCanvas);
|
||||||
|
|
||||||
|
// Main area cursor
|
||||||
|
this.mainCursor = document.createElement('div');
|
||||||
|
this.mainCursor.className = 'color-picker-cursor';
|
||||||
|
this.mainArea.appendChild(this.mainCursor);
|
||||||
|
|
||||||
|
// Hue slider
|
||||||
|
this.hueArea = document.createElement('div');
|
||||||
|
this.hueArea.className = 'color-picker-hue';
|
||||||
|
this.hueCanvas = document.createElement('canvas');
|
||||||
|
this.hueCanvas.width = 24;
|
||||||
|
this.hueCanvas.height = 200;
|
||||||
|
this.hueCanvas.className = 'color-picker-canvas';
|
||||||
|
this.hueArea.appendChild(this.hueCanvas);
|
||||||
|
|
||||||
|
// Hue slider cursor
|
||||||
|
this.hueCursor = document.createElement('div');
|
||||||
|
this.hueCursor.className = 'color-picker-hue-cursor';
|
||||||
|
this.hueArea.appendChild(this.hueCursor);
|
||||||
|
|
||||||
|
// Controls section
|
||||||
|
this.controls = document.createElement('div');
|
||||||
|
this.controls.className = 'color-picker-controls';
|
||||||
|
|
||||||
|
// Hex input
|
||||||
|
if (this.options.showHexInput) {
|
||||||
|
this.hexInput = document.createElement('input');
|
||||||
|
this.hexInput.type = 'text';
|
||||||
|
this.hexInput.className = 'color-picker-hex';
|
||||||
|
this.hexInput.placeholder = '#000000';
|
||||||
|
this.hexInput.maxLength = 7;
|
||||||
|
this.controls.appendChild(this.hexInput);
|
||||||
|
}
|
||||||
|
|
||||||
|
// RGB inputs (Chromium style - no sliders, just number inputs)
|
||||||
|
this.rgbContainer = document.createElement('div');
|
||||||
|
this.rgbContainer.className = 'color-picker-rgb';
|
||||||
|
|
||||||
|
['R', 'G', 'B'].forEach((label) => {
|
||||||
|
const wrapper = document.createElement('div');
|
||||||
|
wrapper.className = 'color-picker-rgb-item';
|
||||||
|
wrapper.dataset.channel = label.toLowerCase();
|
||||||
|
|
||||||
|
const labelEl = document.createElement('label');
|
||||||
|
labelEl.textContent = label;
|
||||||
|
|
||||||
|
const input = document.createElement('input');
|
||||||
|
input.type = 'number';
|
||||||
|
input.className = 'color-picker-rgb-input';
|
||||||
|
input.min = 0;
|
||||||
|
input.max = 255;
|
||||||
|
input.value = 0;
|
||||||
|
input.dataset.channel = label.toLowerCase();
|
||||||
|
|
||||||
|
wrapper.appendChild(labelEl);
|
||||||
|
wrapper.appendChild(input);
|
||||||
|
this.rgbContainer.appendChild(wrapper);
|
||||||
|
|
||||||
|
this[`rgb${label}`] = input;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.controls.appendChild(this.rgbContainer);
|
||||||
|
|
||||||
|
// Assemble panel
|
||||||
|
const pickerArea = document.createElement('div');
|
||||||
|
pickerArea.className = 'color-picker-area';
|
||||||
|
pickerArea.appendChild(this.mainArea);
|
||||||
|
pickerArea.appendChild(this.hueArea);
|
||||||
|
|
||||||
|
this.panel.appendChild(pickerArea);
|
||||||
|
this.panel.appendChild(this.controls);
|
||||||
|
|
||||||
|
// Assemble container
|
||||||
|
this.container.appendChild(this.previewBtn);
|
||||||
|
this.container.appendChild(this.panel);
|
||||||
|
|
||||||
|
// Draw canvases
|
||||||
|
this.drawHueCanvas();
|
||||||
|
this.drawMainCanvas(1.0); // Start with full saturation
|
||||||
|
}
|
||||||
|
|
||||||
|
setupEventListeners() {
|
||||||
|
// Toggle panel
|
||||||
|
this.previewBtn.addEventListener('click', (e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
this.toggle();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Close on outside click
|
||||||
|
document.addEventListener('click', (e) => {
|
||||||
|
if (!this.container.contains(e.target) && this.isOpen) {
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Main area interaction
|
||||||
|
let isMainDragging = false;
|
||||||
|
this.mainCanvas.addEventListener('mousedown', (e) => {
|
||||||
|
isMainDragging = true;
|
||||||
|
this.handleMainAreaClick(e);
|
||||||
|
});
|
||||||
|
this.mainCanvas.addEventListener('mousemove', (e) => {
|
||||||
|
if (isMainDragging) {
|
||||||
|
this.handleMainAreaClick(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
document.addEventListener('mouseup', () => {
|
||||||
|
isMainDragging = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Touch support for main area
|
||||||
|
this.mainCanvas.addEventListener('touchstart', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
isMainDragging = true;
|
||||||
|
this.handleMainAreaClick(e.touches[0]);
|
||||||
|
});
|
||||||
|
this.mainCanvas.addEventListener('touchmove', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
if (isMainDragging) {
|
||||||
|
this.handleMainAreaClick(e.touches[0]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.mainCanvas.addEventListener('touchend', () => {
|
||||||
|
isMainDragging = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Hue slider interaction
|
||||||
|
let isHueDragging = false;
|
||||||
|
this.hueCanvas.addEventListener('mousedown', (e) => {
|
||||||
|
isHueDragging = true;
|
||||||
|
this.handleHueClick(e);
|
||||||
|
});
|
||||||
|
this.hueCanvas.addEventListener('mousemove', (e) => {
|
||||||
|
if (isHueDragging) {
|
||||||
|
this.handleHueClick(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
document.addEventListener('mouseup', () => {
|
||||||
|
isHueDragging = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Touch support for hue slider
|
||||||
|
this.hueCanvas.addEventListener('touchstart', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
isHueDragging = true;
|
||||||
|
this.handleHueClick(e.touches[0]);
|
||||||
|
});
|
||||||
|
this.hueCanvas.addEventListener('touchmove', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
if (isHueDragging) {
|
||||||
|
this.handleHueClick(e.touches[0]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.hueCanvas.addEventListener('touchend', () => {
|
||||||
|
isHueDragging = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Hex input
|
||||||
|
if (this.hexInput) {
|
||||||
|
this.hexInput.addEventListener('input', (e) => {
|
||||||
|
const value = e.target.value;
|
||||||
|
if (/^#[0-9A-Fa-f]{6}$/.test(value)) {
|
||||||
|
this.updateColor(value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.hexInput.addEventListener('blur', (e) => {
|
||||||
|
const value = e.target.value;
|
||||||
|
if (!/^#[0-9A-Fa-f]{6}$/.test(value) && value.length > 0) {
|
||||||
|
e.target.value = this.currentColor;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// RGB inputs (Chromium style - only number inputs)
|
||||||
|
['R', 'G', 'B'].forEach(label => {
|
||||||
|
this[`rgb${label}`].addEventListener('input', (e) => {
|
||||||
|
let value = parseInt(e.target.value) || 0;
|
||||||
|
value = Math.max(0, Math.min(255, value)); // Clamp to 0-255
|
||||||
|
e.target.value = value;
|
||||||
|
const r = parseInt(this.rgbR.value) || 0;
|
||||||
|
const g = parseInt(this.rgbG.value) || 0;
|
||||||
|
const b = parseInt(this.rgbB.value) || 0;
|
||||||
|
const hex = this.rgbToHex(r, g, b);
|
||||||
|
this.updateColor(hex, false); // Don't update RGB inputs to avoid loop
|
||||||
|
});
|
||||||
|
|
||||||
|
this[`rgb${label}`].addEventListener('blur', (e) => {
|
||||||
|
let value = parseInt(e.target.value) || 0;
|
||||||
|
value = Math.max(0, Math.min(255, value));
|
||||||
|
e.target.value = value;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
drawHueCanvas() {
|
||||||
|
const ctx = this.hueCanvas.getContext('2d');
|
||||||
|
const gradient = ctx.createLinearGradient(0, 0, 0, 200);
|
||||||
|
|
||||||
|
for (let i = 0; i <= 6; i++) {
|
||||||
|
const hue = i * 60;
|
||||||
|
gradient.addColorStop(i / 6, `hsl(${hue}, 100%, 50%)`);
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.fillStyle = gradient;
|
||||||
|
ctx.fillRect(0, 0, 24, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
drawMainCanvas(hue) {
|
||||||
|
const ctx = this.mainCanvas.getContext('2d');
|
||||||
|
|
||||||
|
// Saturation gradient (left to right)
|
||||||
|
const satGradient = ctx.createLinearGradient(0, 0, 200, 0);
|
||||||
|
satGradient.addColorStop(0, `hsl(${hue}, 0%, 50%)`);
|
||||||
|
satGradient.addColorStop(1, `hsl(${hue}, 100%, 50%)`);
|
||||||
|
ctx.fillStyle = satGradient;
|
||||||
|
ctx.fillRect(0, 0, 200, 200);
|
||||||
|
|
||||||
|
// Brightness gradient (top to bottom)
|
||||||
|
const brightGradient = ctx.createLinearGradient(0, 0, 0, 200);
|
||||||
|
brightGradient.addColorStop(0, 'rgba(255, 255, 255, 0)');
|
||||||
|
brightGradient.addColorStop(1, 'rgba(0, 0, 0, 1)');
|
||||||
|
ctx.fillStyle = brightGradient;
|
||||||
|
ctx.fillRect(0, 0, 200, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
handleMainAreaClick(e) {
|
||||||
|
const rect = this.mainCanvas.getBoundingClientRect();
|
||||||
|
const x = Math.max(0, Math.min(200, e.clientX - rect.left));
|
||||||
|
const y = Math.max(0, Math.min(200, e.clientY - rect.top));
|
||||||
|
|
||||||
|
const saturation = x / 200;
|
||||||
|
const brightness = 1 - (y / 200);
|
||||||
|
|
||||||
|
this.updateColorFromHSB(this.hue, saturation, brightness);
|
||||||
|
this.updateCursor(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
handleHueClick(e) {
|
||||||
|
const rect = this.hueCanvas.getBoundingClientRect();
|
||||||
|
const y = Math.max(0, Math.min(200, e.clientY - rect.top));
|
||||||
|
const hue = (y / 200) * 360;
|
||||||
|
|
||||||
|
this.hue = hue;
|
||||||
|
this.drawMainCanvas(hue);
|
||||||
|
this.updateHueCursor(y);
|
||||||
|
|
||||||
|
// Recalculate color with new hue
|
||||||
|
const rect2 = this.mainCanvas.getBoundingClientRect();
|
||||||
|
const x = parseFloat(this.mainCursor.style.left) || 0;
|
||||||
|
const y2 = parseFloat(this.mainCursor.style.top) || 0;
|
||||||
|
const saturation = x / 200;
|
||||||
|
const brightness = 1 - (y2 / 200);
|
||||||
|
this.updateColorFromHSB(hue, saturation, brightness);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateColorFromHSB(h, s, v) {
|
||||||
|
const rgb = this.hsbToRgb(h, s, v);
|
||||||
|
const hex = this.rgbToHex(rgb.r, rgb.g, rgb.b);
|
||||||
|
this.updateColor(hex);
|
||||||
|
}
|
||||||
|
|
||||||
|
hsbToRgb(h, s, v) {
|
||||||
|
h = h / 360;
|
||||||
|
const i = Math.floor(h * 6);
|
||||||
|
const f = h * 6 - i;
|
||||||
|
const p = v * (1 - s);
|
||||||
|
const q = v * (1 - f * s);
|
||||||
|
const t = v * (1 - (1 - f) * s);
|
||||||
|
|
||||||
|
let r, g, b;
|
||||||
|
switch (i % 6) {
|
||||||
|
case 0: r = v; g = t; b = p; break;
|
||||||
|
case 1: r = q; g = v; b = p; break;
|
||||||
|
case 2: r = p; g = v; b = t; break;
|
||||||
|
case 3: r = p; g = q; b = v; break;
|
||||||
|
case 4: r = t; g = p; b = v; break;
|
||||||
|
case 5: r = v; g = p; b = q; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
r: Math.round(r * 255),
|
||||||
|
g: Math.round(g * 255),
|
||||||
|
b: Math.round(b * 255)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
rgbToHex(r, g, b) {
|
||||||
|
return '#' + [r, g, b].map(x => {
|
||||||
|
const hex = x.toString(16);
|
||||||
|
return hex.length === 1 ? '0' + hex : hex;
|
||||||
|
}).join('').toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
hexToRgb(hex) {
|
||||||
|
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
||||||
|
return result ? {
|
||||||
|
r: parseInt(result[1], 16),
|
||||||
|
g: parseInt(result[2], 16),
|
||||||
|
b: parseInt(result[3], 16)
|
||||||
|
} : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
rgbToHsb(r, g, b) {
|
||||||
|
r /= 255;
|
||||||
|
g /= 255;
|
||||||
|
b /= 255;
|
||||||
|
|
||||||
|
const max = Math.max(r, g, b);
|
||||||
|
const min = Math.min(r, g, b);
|
||||||
|
const diff = max - min;
|
||||||
|
|
||||||
|
let h = 0;
|
||||||
|
if (diff !== 0) {
|
||||||
|
if (max === r) {
|
||||||
|
h = ((g - b) / diff) % 6) * 60;
|
||||||
|
} else if (max === g) {
|
||||||
|
h = ((b - r) / diff + 2) * 60;
|
||||||
|
} else {
|
||||||
|
h = ((r - g) / diff + 4) * 60;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (h < 0) h += 360;
|
||||||
|
|
||||||
|
const s = max === 0 ? 0 : diff / max;
|
||||||
|
const v = max;
|
||||||
|
|
||||||
|
return { h, s, v };
|
||||||
|
}
|
||||||
|
|
||||||
|
updateColor(hex, updateInputs = true) {
|
||||||
|
this.currentColor = hex.toUpperCase();
|
||||||
|
this.previewBtn.style.backgroundColor = this.currentColor;
|
||||||
|
|
||||||
|
const rgb = this.hexToRgb(this.currentColor);
|
||||||
|
if (!rgb) return;
|
||||||
|
|
||||||
|
const hsb = this.rgbToHsb(rgb.r, rgb.g, rgb.b);
|
||||||
|
this.hue = hsb.h;
|
||||||
|
|
||||||
|
// Update main canvas
|
||||||
|
this.drawMainCanvas(this.hue);
|
||||||
|
|
||||||
|
// Update cursors
|
||||||
|
const x = hsb.s * 200;
|
||||||
|
const y = (1 - hsb.v) * 200;
|
||||||
|
this.updateCursor(x, y);
|
||||||
|
this.updateHueCursor((this.hue / 360) * 200);
|
||||||
|
|
||||||
|
// Update inputs
|
||||||
|
if (updateInputs) {
|
||||||
|
if (this.hexInput) {
|
||||||
|
this.hexInput.value = this.currentColor;
|
||||||
|
}
|
||||||
|
if (this.rgbR) {
|
||||||
|
this.rgbR.value = rgb.r;
|
||||||
|
this.rgbG.value = rgb.g;
|
||||||
|
this.rgbB.value = rgb.b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Callback
|
||||||
|
if (this.options.onColorChange) {
|
||||||
|
this.options.onColorChange(this.currentColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateCursor(x, y) {
|
||||||
|
this.mainCursor.style.left = `${x}px`;
|
||||||
|
this.mainCursor.style.top = `${y}px`;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateHueCursor(y) {
|
||||||
|
this.hueCursor.style.top = `${y}px`;
|
||||||
|
}
|
||||||
|
|
||||||
|
toggle() {
|
||||||
|
this.isOpen ? this.close() : this.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
open() {
|
||||||
|
this.panel.style.display = 'block';
|
||||||
|
this.isOpen = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
close() {
|
||||||
|
this.panel.style.display = 'none';
|
||||||
|
this.isOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
getColor() {
|
||||||
|
return this.currentColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
setColor(color) {
|
||||||
|
this.updateColor(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Export for use in other scripts
|
||||||
|
if (typeof module !== 'undefined' && module.exports) {
|
||||||
|
module.exports = ColorPickerChromium;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,153 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Color Picker Demo - Cross-Platform</title>
|
||||||
|
<link rel="stylesheet" href="color-picker.css">
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
||||||
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||||
|
min-height: 100vh;
|
||||||
|
padding: 40px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
max-width: 800px;
|
||||||
|
margin: 0 auto;
|
||||||
|
background: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 40px;
|
||||||
|
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
color: #667eea;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
color: #666;
|
||||||
|
margin-bottom: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.demo-section {
|
||||||
|
margin-bottom: 40px;
|
||||||
|
padding: 24px;
|
||||||
|
background: #f7fafc;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.demo-section h2 {
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
font-size: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-pickers {
|
||||||
|
display: flex;
|
||||||
|
gap: 24px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-display {
|
||||||
|
margin-top: 16px;
|
||||||
|
padding: 12px;
|
||||||
|
background: white;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-family: 'Courier New', monospace;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-display strong {
|
||||||
|
color: #667eea;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<h1>Custom Color Picker</h1>
|
||||||
|
<p>Consistent color picker that works the same across all operating systems and browsers</p>
|
||||||
|
|
||||||
|
<div class="demo-section">
|
||||||
|
<h2>Single Color Picker</h2>
|
||||||
|
<div class="color-pickers">
|
||||||
|
<div id="picker1"></div>
|
||||||
|
</div>
|
||||||
|
<div class="color-display">
|
||||||
|
Selected color: <strong id="color1-display">#FF0000</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="demo-section">
|
||||||
|
<h2>Multiple Color Pickers</h2>
|
||||||
|
<p style="margin-bottom: 16px;">Example: Multiple colors for LED patterns</p>
|
||||||
|
<div class="color-pickers">
|
||||||
|
<div id="picker2"></div>
|
||||||
|
<div id="picker3"></div>
|
||||||
|
<div id="picker4"></div>
|
||||||
|
</div>
|
||||||
|
<div class="color-display">
|
||||||
|
Colors: <strong id="colors-display">#FF0000, #00FF00, #0000FF</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="demo-section">
|
||||||
|
<h2>Features</h2>
|
||||||
|
<ul style="color: #666; line-height: 1.8;">
|
||||||
|
<li>✅ Consistent UI across Windows, macOS, Linux, iOS, Android</li>
|
||||||
|
<li>✅ Works in Chrome, Firefox, Safari, Edge, Opera</li>
|
||||||
|
<li>✅ Touch support for mobile devices</li>
|
||||||
|
<li>✅ HSB (Hue, Saturation, Brightness) color model</li>
|
||||||
|
<li>✅ Hex and RGB input support</li>
|
||||||
|
<li>✅ Keyboard accessible</li>
|
||||||
|
<li>✅ Customizable styling</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="color-picker.js"></script>
|
||||||
|
<script>
|
||||||
|
// Initialize color pickers
|
||||||
|
const picker1 = new ColorPicker('#picker1', {
|
||||||
|
initialColor: '#FF0000',
|
||||||
|
onColorChange: (color) => {
|
||||||
|
document.getElementById('color1-display').textContent = color;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const picker2 = new ColorPicker('#picker2', {
|
||||||
|
initialColor: '#FF0000',
|
||||||
|
onColorChange: updateColors
|
||||||
|
});
|
||||||
|
|
||||||
|
const picker3 = new ColorPicker('#picker3', {
|
||||||
|
initialColor: '#00FF00',
|
||||||
|
onColorChange: updateColors
|
||||||
|
});
|
||||||
|
|
||||||
|
const picker4 = new ColorPicker('#picker4', {
|
||||||
|
initialColor: '#0000FF',
|
||||||
|
onColorChange: updateColors
|
||||||
|
});
|
||||||
|
|
||||||
|
function updateColors() {
|
||||||
|
const colors = [
|
||||||
|
picker2.getColor(),
|
||||||
|
picker3.getColor(),
|
||||||
|
picker4.getColor()
|
||||||
|
];
|
||||||
|
document.getElementById('colors-display').textContent = colors.join(', ');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
@@ -0,0 +1,282 @@
|
|||||||
|
/* Color Picker Styles - Consistent across all browsers and OS */
|
||||||
|
|
||||||
|
.color-picker-container {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-preview {
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
border: 2px solid #e0e0e0;
|
||||||
|
border-radius: 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 0;
|
||||||
|
background: none;
|
||||||
|
transition: all 0.2s;
|
||||||
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-preview:hover {
|
||||||
|
border-color: #667eea;
|
||||||
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-preview:active {
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-panel {
|
||||||
|
position: absolute;
|
||||||
|
top: calc(100% + 8px);
|
||||||
|
left: 0;
|
||||||
|
z-index: 1000;
|
||||||
|
background: white;
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
border-radius: 12px;
|
||||||
|
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
|
||||||
|
padding: 16px;
|
||||||
|
min-width: 280px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-area {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-main {
|
||||||
|
position: relative;
|
||||||
|
width: 200px;
|
||||||
|
height: 200px;
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
cursor: crosshair;
|
||||||
|
touch-action: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-canvas {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
user-select: none;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-cursor {
|
||||||
|
position: absolute;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
border: 2px solid white;
|
||||||
|
border-radius: 50%;
|
||||||
|
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
|
||||||
|
pointer-events: none;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-hue {
|
||||||
|
position: relative;
|
||||||
|
width: 20px;
|
||||||
|
height: 200px;
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
cursor: pointer;
|
||||||
|
touch-action: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-hue-cursor {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 4px;
|
||||||
|
border: 2px solid white;
|
||||||
|
border-radius: 2px;
|
||||||
|
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
|
||||||
|
pointer-events: none;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-controls {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-hex {
|
||||||
|
width: 100%;
|
||||||
|
padding: 8px 12px;
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-family: 'Courier New', monospace;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
text-transform: uppercase;
|
||||||
|
transition: border-color 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-hex:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: #667eea;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-rgb {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-rgb-item {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-rgb-item label {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #666;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-rgb-slider {
|
||||||
|
width: 100%;
|
||||||
|
height: 6px;
|
||||||
|
border-radius: 3px;
|
||||||
|
background: #e0e0e0;
|
||||||
|
outline: none;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-rgb-slider::-webkit-slider-thumb {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
appearance: none;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #667eea;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 2px solid white;
|
||||||
|
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-rgb-slider::-webkit-slider-thumb:hover {
|
||||||
|
transform: scale(1.1);
|
||||||
|
box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-rgb-slider::-moz-range-thumb {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #667eea;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 2px solid white;
|
||||||
|
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-rgb-slider::-moz-range-thumb:hover {
|
||||||
|
transform: scale(1.1);
|
||||||
|
box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Color-specific slider backgrounds */
|
||||||
|
.color-picker-rgb-item[data-channel="r"] .color-picker-rgb-slider {
|
||||||
|
background: linear-gradient(to right, #000000, #ff0000);
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-rgb-item[data-channel="g"] .color-picker-rgb-slider {
|
||||||
|
background: linear-gradient(to right, #000000, #00ff00);
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-rgb-item[data-channel="b"] .color-picker-rgb-slider {
|
||||||
|
background: linear-gradient(to right, #000000, #0000ff);
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-rgb-input {
|
||||||
|
width: 100%;
|
||||||
|
padding: 6px 8px;
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
text-align: center;
|
||||||
|
transition: border-color 0.2s;
|
||||||
|
-moz-appearance: textfield;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-rgb-input::-webkit-outer-spin-button,
|
||||||
|
.color-picker-rgb-input::-webkit-inner-spin-button {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-rgb-input:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: #667eea;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Responsive adjustments */
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
.color-picker-panel {
|
||||||
|
left: auto;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-main {
|
||||||
|
width: 180px;
|
||||||
|
height: 180px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-hue {
|
||||||
|
height: 180px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Dark mode support (optional) */
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
.color-picker-panel {
|
||||||
|
background: #2d3748;
|
||||||
|
border-color: #4a5568;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-preview {
|
||||||
|
border-color: #4a5568;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-main,
|
||||||
|
.color-picker-hue {
|
||||||
|
border-color: #4a5568;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-hex,
|
||||||
|
.color-picker-rgb-input {
|
||||||
|
background: #1a202c;
|
||||||
|
border-color: #4a5568;
|
||||||
|
color: #e2e8f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-rgb-item label {
|
||||||
|
color: #a0aec0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-rgb-slider {
|
||||||
|
background: #4a5568 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-rgb-slider::-webkit-slider-thumb,
|
||||||
|
.color-picker-rgb-slider::-moz-range-thumb {
|
||||||
|
background: #667eea;
|
||||||
|
border-color: #2d3748;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,474 @@
|
|||||||
|
/**
|
||||||
|
* Custom Color Picker Component
|
||||||
|
* Consistent across all operating systems and browsers
|
||||||
|
*/
|
||||||
|
|
||||||
|
class ColorPicker {
|
||||||
|
constructor(container, options = {}) {
|
||||||
|
this.container = typeof container === 'string' ? document.querySelector(container) : container;
|
||||||
|
this.options = {
|
||||||
|
initialColor: options.initialColor || '#FF0000',
|
||||||
|
onColorChange: options.onColorChange || null,
|
||||||
|
showHexInput: options.showHexInput !== false,
|
||||||
|
...options
|
||||||
|
};
|
||||||
|
this.currentColor = this.options.initialColor;
|
||||||
|
this.isOpen = false;
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
init() {
|
||||||
|
this.createPicker();
|
||||||
|
this.setupEventListeners();
|
||||||
|
this.updateColor(this.options.initialColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
createPicker() {
|
||||||
|
this.container.innerHTML = '';
|
||||||
|
this.container.className = 'color-picker-container';
|
||||||
|
|
||||||
|
// Color preview button
|
||||||
|
this.previewBtn = document.createElement('button');
|
||||||
|
this.previewBtn.className = 'color-picker-preview';
|
||||||
|
this.previewBtn.type = 'button';
|
||||||
|
this.previewBtn.style.backgroundColor = this.currentColor;
|
||||||
|
this.previewBtn.setAttribute('aria-label', 'Open color picker');
|
||||||
|
|
||||||
|
// Dropdown panel
|
||||||
|
this.panel = document.createElement('div');
|
||||||
|
this.panel.className = 'color-picker-panel';
|
||||||
|
this.panel.style.display = 'none';
|
||||||
|
|
||||||
|
// Main color area (hue/saturation)
|
||||||
|
this.mainArea = document.createElement('div');
|
||||||
|
this.mainArea.className = 'color-picker-main';
|
||||||
|
this.mainCanvas = document.createElement('canvas');
|
||||||
|
this.mainCanvas.width = 200;
|
||||||
|
this.mainCanvas.height = 200;
|
||||||
|
this.mainCanvas.className = 'color-picker-canvas';
|
||||||
|
this.mainArea.appendChild(this.mainCanvas);
|
||||||
|
|
||||||
|
// Main area cursor
|
||||||
|
this.mainCursor = document.createElement('div');
|
||||||
|
this.mainCursor.className = 'color-picker-cursor';
|
||||||
|
this.mainArea.appendChild(this.mainCursor);
|
||||||
|
|
||||||
|
// Hue slider
|
||||||
|
this.hueArea = document.createElement('div');
|
||||||
|
this.hueArea.className = 'color-picker-hue';
|
||||||
|
this.hueCanvas = document.createElement('canvas');
|
||||||
|
this.hueCanvas.width = 20;
|
||||||
|
this.hueCanvas.height = 200;
|
||||||
|
this.hueCanvas.className = 'color-picker-canvas';
|
||||||
|
this.hueArea.appendChild(this.hueCanvas);
|
||||||
|
|
||||||
|
// Hue slider cursor
|
||||||
|
this.hueCursor = document.createElement('div');
|
||||||
|
this.hueCursor.className = 'color-picker-hue-cursor';
|
||||||
|
this.hueArea.appendChild(this.hueCursor);
|
||||||
|
|
||||||
|
// Controls section
|
||||||
|
this.controls = document.createElement('div');
|
||||||
|
this.controls.className = 'color-picker-controls';
|
||||||
|
|
||||||
|
// Hex input
|
||||||
|
if (this.options.showHexInput) {
|
||||||
|
this.hexInput = document.createElement('input');
|
||||||
|
this.hexInput.type = 'text';
|
||||||
|
this.hexInput.className = 'color-picker-hex';
|
||||||
|
this.hexInput.placeholder = '#000000';
|
||||||
|
this.hexInput.maxLength = 7;
|
||||||
|
this.controls.appendChild(this.hexInput);
|
||||||
|
}
|
||||||
|
|
||||||
|
// RGB inputs and sliders
|
||||||
|
this.rgbContainer = document.createElement('div');
|
||||||
|
this.rgbContainer.className = 'color-picker-rgb';
|
||||||
|
|
||||||
|
['R', 'G', 'B'].forEach((label, index) => {
|
||||||
|
const wrapper = document.createElement('div');
|
||||||
|
wrapper.className = 'color-picker-rgb-item';
|
||||||
|
wrapper.dataset.channel = label.toLowerCase();
|
||||||
|
|
||||||
|
const labelEl = document.createElement('label');
|
||||||
|
labelEl.textContent = label;
|
||||||
|
|
||||||
|
const slider = document.createElement('input');
|
||||||
|
slider.type = 'range';
|
||||||
|
slider.className = 'color-picker-rgb-slider';
|
||||||
|
slider.min = 0;
|
||||||
|
slider.max = 255;
|
||||||
|
slider.value = 0;
|
||||||
|
slider.dataset.channel = label.toLowerCase();
|
||||||
|
|
||||||
|
const input = document.createElement('input');
|
||||||
|
input.type = 'number';
|
||||||
|
input.className = 'color-picker-rgb-input';
|
||||||
|
input.min = 0;
|
||||||
|
input.max = 255;
|
||||||
|
input.value = 0;
|
||||||
|
input.dataset.channel = label.toLowerCase();
|
||||||
|
|
||||||
|
wrapper.appendChild(labelEl);
|
||||||
|
wrapper.appendChild(slider);
|
||||||
|
wrapper.appendChild(input);
|
||||||
|
this.rgbContainer.appendChild(wrapper);
|
||||||
|
|
||||||
|
this[`rgb${label}Slider`] = slider;
|
||||||
|
this[`rgb${label}`] = input;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.controls.appendChild(this.rgbContainer);
|
||||||
|
|
||||||
|
// Assemble panel
|
||||||
|
const pickerArea = document.createElement('div');
|
||||||
|
pickerArea.className = 'color-picker-area';
|
||||||
|
pickerArea.appendChild(this.mainArea);
|
||||||
|
pickerArea.appendChild(this.hueArea);
|
||||||
|
|
||||||
|
this.panel.appendChild(pickerArea);
|
||||||
|
this.panel.appendChild(this.controls);
|
||||||
|
|
||||||
|
// Assemble container
|
||||||
|
this.container.appendChild(this.previewBtn);
|
||||||
|
this.container.appendChild(this.panel);
|
||||||
|
|
||||||
|
// Draw canvases
|
||||||
|
this.drawHueCanvas();
|
||||||
|
this.drawMainCanvas(1.0); // Start with full saturation
|
||||||
|
}
|
||||||
|
|
||||||
|
setupEventListeners() {
|
||||||
|
// Toggle panel
|
||||||
|
this.previewBtn.addEventListener('click', (e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
this.toggle();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Close on outside click
|
||||||
|
document.addEventListener('click', (e) => {
|
||||||
|
if (!this.container.contains(e.target) && this.isOpen) {
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Main area interaction
|
||||||
|
let isMainDragging = false;
|
||||||
|
this.mainCanvas.addEventListener('mousedown', (e) => {
|
||||||
|
isMainDragging = true;
|
||||||
|
this.handleMainAreaClick(e);
|
||||||
|
});
|
||||||
|
this.mainCanvas.addEventListener('mousemove', (e) => {
|
||||||
|
if (isMainDragging) {
|
||||||
|
this.handleMainAreaClick(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
document.addEventListener('mouseup', () => {
|
||||||
|
isMainDragging = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Touch support for main area
|
||||||
|
this.mainCanvas.addEventListener('touchstart', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
isMainDragging = true;
|
||||||
|
this.handleMainAreaClick(e.touches[0]);
|
||||||
|
});
|
||||||
|
this.mainCanvas.addEventListener('touchmove', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
if (isMainDragging) {
|
||||||
|
this.handleMainAreaClick(e.touches[0]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.mainCanvas.addEventListener('touchend', () => {
|
||||||
|
isMainDragging = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Hue slider interaction
|
||||||
|
let isHueDragging = false;
|
||||||
|
this.hueCanvas.addEventListener('mousedown', (e) => {
|
||||||
|
isHueDragging = true;
|
||||||
|
this.handleHueClick(e);
|
||||||
|
});
|
||||||
|
this.hueCanvas.addEventListener('mousemove', (e) => {
|
||||||
|
if (isHueDragging) {
|
||||||
|
this.handleHueClick(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
document.addEventListener('mouseup', () => {
|
||||||
|
isHueDragging = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Touch support for hue slider
|
||||||
|
this.hueCanvas.addEventListener('touchstart', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
isHueDragging = true;
|
||||||
|
this.handleHueClick(e.touches[0]);
|
||||||
|
});
|
||||||
|
this.hueCanvas.addEventListener('touchmove', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
if (isHueDragging) {
|
||||||
|
this.handleHueClick(e.touches[0]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.hueCanvas.addEventListener('touchend', () => {
|
||||||
|
isHueDragging = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Hex input
|
||||||
|
if (this.hexInput) {
|
||||||
|
this.hexInput.addEventListener('input', (e) => {
|
||||||
|
const value = e.target.value;
|
||||||
|
if (/^#[0-9A-Fa-f]{6}$/.test(value)) {
|
||||||
|
this.updateColor(value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.hexInput.addEventListener('blur', (e) => {
|
||||||
|
const value = e.target.value;
|
||||||
|
if (!/^#[0-9A-Fa-f]{6}$/.test(value) && value.length > 0) {
|
||||||
|
e.target.value = this.currentColor;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// RGB inputs and sliders
|
||||||
|
['R', 'G', 'B'].forEach(label => {
|
||||||
|
// Slider change
|
||||||
|
this[`rgb${label}Slider`].addEventListener('input', (e) => {
|
||||||
|
const value = parseInt(e.target.value) || 0;
|
||||||
|
this[`rgb${label}`].value = value;
|
||||||
|
const r = parseInt(this.rgbR.value) || 0;
|
||||||
|
const g = parseInt(this.rgbG.value) || 0;
|
||||||
|
const b = parseInt(this.rgbB.value) || 0;
|
||||||
|
const hex = this.rgbToHex(r, g, b);
|
||||||
|
this.updateColor(hex, false); // Don't update RGB inputs/sliders to avoid loop
|
||||||
|
});
|
||||||
|
|
||||||
|
// Input change
|
||||||
|
this[`rgb${label}`].addEventListener('input', (e) => {
|
||||||
|
let value = parseInt(e.target.value) || 0;
|
||||||
|
value = Math.max(0, Math.min(255, value)); // Clamp to 0-255
|
||||||
|
e.target.value = value;
|
||||||
|
this[`rgb${label}Slider`].value = value;
|
||||||
|
const r = parseInt(this.rgbR.value) || 0;
|
||||||
|
const g = parseInt(this.rgbG.value) || 0;
|
||||||
|
const b = parseInt(this.rgbB.value) || 0;
|
||||||
|
const hex = this.rgbToHex(r, g, b);
|
||||||
|
this.updateColor(hex, false); // Don't update RGB inputs/sliders to avoid loop
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
drawHueCanvas() {
|
||||||
|
const ctx = this.hueCanvas.getContext('2d');
|
||||||
|
const gradient = ctx.createLinearGradient(0, 0, 0, 200);
|
||||||
|
|
||||||
|
for (let i = 0; i <= 6; i++) {
|
||||||
|
const hue = i * 60;
|
||||||
|
gradient.addColorStop(i / 6, `hsl(${hue}, 100%, 50%)`);
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.fillStyle = gradient;
|
||||||
|
ctx.fillRect(0, 0, 20, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
drawMainCanvas(hue) {
|
||||||
|
const ctx = this.mainCanvas.getContext('2d');
|
||||||
|
|
||||||
|
// Saturation gradient (left to right)
|
||||||
|
const satGradient = ctx.createLinearGradient(0, 0, 200, 0);
|
||||||
|
satGradient.addColorStop(0, `hsl(${hue}, 0%, 50%)`);
|
||||||
|
satGradient.addColorStop(1, `hsl(${hue}, 100%, 50%)`);
|
||||||
|
ctx.fillStyle = satGradient;
|
||||||
|
ctx.fillRect(0, 0, 200, 200);
|
||||||
|
|
||||||
|
// Brightness gradient (top to bottom)
|
||||||
|
const brightGradient = ctx.createLinearGradient(0, 0, 0, 200);
|
||||||
|
brightGradient.addColorStop(0, 'rgba(255, 255, 255, 0)');
|
||||||
|
brightGradient.addColorStop(1, 'rgba(0, 0, 0, 1)');
|
||||||
|
ctx.fillStyle = brightGradient;
|
||||||
|
ctx.fillRect(0, 0, 200, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
handleMainAreaClick(e) {
|
||||||
|
const rect = this.mainCanvas.getBoundingClientRect();
|
||||||
|
const x = Math.max(0, Math.min(200, e.clientX - rect.left));
|
||||||
|
const y = Math.max(0, Math.min(200, e.clientY - rect.top));
|
||||||
|
|
||||||
|
const saturation = x / 200;
|
||||||
|
const brightness = 1 - (y / 200);
|
||||||
|
|
||||||
|
this.updateColorFromHSB(this.hue, saturation, brightness);
|
||||||
|
this.updateCursor(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
handleHueClick(e) {
|
||||||
|
const rect = this.hueCanvas.getBoundingClientRect();
|
||||||
|
const y = Math.max(0, Math.min(200, e.clientY - rect.top));
|
||||||
|
const hue = (y / 200) * 360;
|
||||||
|
|
||||||
|
this.hue = hue;
|
||||||
|
this.drawMainCanvas(hue);
|
||||||
|
this.updateHueCursor(y);
|
||||||
|
|
||||||
|
// Recalculate color with new hue
|
||||||
|
const rect2 = this.mainCanvas.getBoundingClientRect();
|
||||||
|
const x = parseFloat(this.mainCursor.style.left) || 0;
|
||||||
|
const y2 = parseFloat(this.mainCursor.style.top) || 0;
|
||||||
|
const saturation = x / 200;
|
||||||
|
const brightness = 1 - (y2 / 200);
|
||||||
|
this.updateColorFromHSB(hue, saturation, brightness);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateColorFromHSB(h, s, v) {
|
||||||
|
const rgb = this.hsbToRgb(h, s, v);
|
||||||
|
const hex = this.rgbToHex(rgb.r, rgb.g, rgb.b);
|
||||||
|
this.updateColor(hex);
|
||||||
|
}
|
||||||
|
|
||||||
|
hsbToRgb(h, s, v) {
|
||||||
|
h = h / 360;
|
||||||
|
const i = Math.floor(h * 6);
|
||||||
|
const f = h * 6 - i;
|
||||||
|
const p = v * (1 - s);
|
||||||
|
const q = v * (1 - f * s);
|
||||||
|
const t = v * (1 - (1 - f) * s);
|
||||||
|
|
||||||
|
let r, g, b;
|
||||||
|
switch (i % 6) {
|
||||||
|
case 0: r = v; g = t; b = p; break;
|
||||||
|
case 1: r = q; g = v; b = p; break;
|
||||||
|
case 2: r = p; g = v; b = t; break;
|
||||||
|
case 3: r = p; g = q; b = v; break;
|
||||||
|
case 4: r = t; g = p; b = v; break;
|
||||||
|
case 5: r = v; g = p; b = q; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
r: Math.round(r * 255),
|
||||||
|
g: Math.round(g * 255),
|
||||||
|
b: Math.round(b * 255)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
rgbToHex(r, g, b) {
|
||||||
|
return '#' + [r, g, b].map(x => {
|
||||||
|
const hex = x.toString(16);
|
||||||
|
return hex.length === 1 ? '0' + hex : hex;
|
||||||
|
}).join('').toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
hexToRgb(hex) {
|
||||||
|
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
||||||
|
return result ? {
|
||||||
|
r: parseInt(result[1], 16),
|
||||||
|
g: parseInt(result[2], 16),
|
||||||
|
b: parseInt(result[3], 16)
|
||||||
|
} : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
rgbToHsb(r, g, b) {
|
||||||
|
r /= 255;
|
||||||
|
g /= 255;
|
||||||
|
b /= 255;
|
||||||
|
|
||||||
|
const max = Math.max(r, g, b);
|
||||||
|
const min = Math.min(r, g, b);
|
||||||
|
const diff = max - min;
|
||||||
|
|
||||||
|
let h = 0;
|
||||||
|
if (diff !== 0) {
|
||||||
|
if (max === r) {
|
||||||
|
h = ((g - b) / diff) % 6) * 60;
|
||||||
|
} else if (max === g) {
|
||||||
|
h = ((b - r) / diff + 2) * 60;
|
||||||
|
} else {
|
||||||
|
h = ((r - g) / diff + 4) * 60;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (h < 0) h += 360;
|
||||||
|
|
||||||
|
const s = max === 0 ? 0 : diff / max;
|
||||||
|
const v = max;
|
||||||
|
|
||||||
|
return { h, s, v };
|
||||||
|
}
|
||||||
|
|
||||||
|
updateColor(hex, updateInputs = true) {
|
||||||
|
this.currentColor = hex.toUpperCase();
|
||||||
|
this.previewBtn.style.backgroundColor = this.currentColor;
|
||||||
|
|
||||||
|
const rgb = this.hexToRgb(this.currentColor);
|
||||||
|
if (!rgb) return;
|
||||||
|
|
||||||
|
const hsb = this.rgbToHsb(rgb.r, rgb.g, rgb.b);
|
||||||
|
this.hue = hsb.h;
|
||||||
|
|
||||||
|
// Update main canvas
|
||||||
|
this.drawMainCanvas(this.hue);
|
||||||
|
|
||||||
|
// Update cursors
|
||||||
|
const x = hsb.s * 200;
|
||||||
|
const y = (1 - hsb.v) * 200;
|
||||||
|
this.updateCursor(x, y);
|
||||||
|
this.updateHueCursor((this.hue / 360) * 200);
|
||||||
|
|
||||||
|
// Update inputs
|
||||||
|
if (updateInputs) {
|
||||||
|
if (this.hexInput) {
|
||||||
|
this.hexInput.value = this.currentColor;
|
||||||
|
}
|
||||||
|
if (this.rgbR) {
|
||||||
|
this.rgbR.value = rgb.r;
|
||||||
|
this.rgbG.value = rgb.g;
|
||||||
|
this.rgbB.value = rgb.b;
|
||||||
|
}
|
||||||
|
if (this.rgbRSlider) {
|
||||||
|
this.rgbRSlider.value = rgb.r;
|
||||||
|
this.rgbGSlider.value = rgb.g;
|
||||||
|
this.rgbBSlider.value = rgb.b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Callback
|
||||||
|
if (this.options.onColorChange) {
|
||||||
|
this.options.onColorChange(this.currentColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
updateCursor(x, y) {
|
||||||
|
this.mainCursor.style.left = `${x}px`;
|
||||||
|
this.mainCursor.style.top = `${y}px`;
|
||||||
|
}
|
||||||
|
|
||||||
|
updateHueCursor(y) {
|
||||||
|
this.hueCursor.style.top = `${y}px`;
|
||||||
|
}
|
||||||
|
|
||||||
|
toggle() {
|
||||||
|
this.isOpen ? this.close() : this.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
open() {
|
||||||
|
this.panel.style.display = 'block';
|
||||||
|
this.isOpen = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
close() {
|
||||||
|
this.panel.style.display = 'none';
|
||||||
|
this.isOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
getColor() {
|
||||||
|
return this.currentColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
setColor(color) {
|
||||||
|
this.updateColor(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Export for use in other scripts
|
||||||
|
if (typeof module !== 'undefined' && module.exports) {
|
||||||
|
module.exports = ColorPicker;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,359 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>LED Driver - Dashboard</title>
|
||||||
|
<link rel="stylesheet" href="color-picker.css">
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
||||||
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||||
|
min-height: 100vh;
|
||||||
|
padding: 20px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
max-width: 1200px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
background: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 24px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.header h1 {
|
||||||
|
color: #667eea;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header p {
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||||
|
gap: 24px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
background: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 24px;
|
||||||
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||||
|
transition: transform 0.2s, box-shadow 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.card h2 {
|
||||||
|
color: #667eea;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
font-size: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pattern-selector {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pattern-btn {
|
||||||
|
padding: 16px;
|
||||||
|
border: 2px solid #e0e0e0;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: white;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pattern-btn:hover {
|
||||||
|
border-color: #667eea;
|
||||||
|
background: #f0f0ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pattern-btn.active {
|
||||||
|
border-color: #667eea;
|
||||||
|
background: #667eea;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider-group {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider-group label {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider {
|
||||||
|
width: 100%;
|
||||||
|
height: 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: #e0e0e0;
|
||||||
|
outline: none;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider::-webkit-slider-thumb {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
appearance: none;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #667eea;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider::-moz-range-thumb {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #667eea;
|
||||||
|
cursor: pointer;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.value-display {
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #667eea;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-group {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-picker-wrapper {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
padding: 12px 24px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background: #667eea;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover {
|
||||||
|
background: #5568d3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary {
|
||||||
|
background: #e0e0e0;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary:hover {
|
||||||
|
background: #d0d0d0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-list {
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-item {
|
||||||
|
padding: 12px;
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-status {
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #4caf50;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-status.offline {
|
||||||
|
background: #f44336;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-full {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<div class="header">
|
||||||
|
<h1>LED Driver Control Panel</h1>
|
||||||
|
<p>Manage your LED devices and patterns</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid">
|
||||||
|
<!-- Pattern Selection -->
|
||||||
|
<div class="card">
|
||||||
|
<h2>Pattern Selection</h2>
|
||||||
|
<div class="pattern-selector">
|
||||||
|
<div class="pattern-btn active">On</div>
|
||||||
|
<div class="pattern-btn">Off</div>
|
||||||
|
<div class="pattern-btn">Blink</div>
|
||||||
|
<div class="pattern-btn">Chase</div>
|
||||||
|
<div class="pattern-btn">Circle</div>
|
||||||
|
<div class="pattern-btn">Pulse</div>
|
||||||
|
<div class="pattern-btn">Rainbow</div>
|
||||||
|
<div class="pattern-btn">Transition</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Brightness & Speed -->
|
||||||
|
<div class="card">
|
||||||
|
<h2>Brightness & Speed</h2>
|
||||||
|
<div class="slider-group">
|
||||||
|
<label>
|
||||||
|
Brightness
|
||||||
|
<span class="value-display" id="brightness-value">100</span>%
|
||||||
|
</label>
|
||||||
|
<input type="range" class="slider" id="brightness" min="0" max="100" value="100">
|
||||||
|
</div>
|
||||||
|
<div class="slider-group">
|
||||||
|
<label>
|
||||||
|
Delay
|
||||||
|
<span class="value-display" id="delay-value">100</span>ms
|
||||||
|
</label>
|
||||||
|
<input type="range" class="slider" id="delay" min="10" max="1000" value="100" step="10">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Color Selection -->
|
||||||
|
<div class="card">
|
||||||
|
<h2>Colors</h2>
|
||||||
|
<div class="color-picker-group">
|
||||||
|
<input type="color" class="color-input" value="#000000">
|
||||||
|
<input type="color" class="color-input" value="#FF0000">
|
||||||
|
<input type="color" class="color-input" value="#00FF00">
|
||||||
|
<input type="color" class="color-input" value="#0000FF">
|
||||||
|
</div>
|
||||||
|
<div class="actions">
|
||||||
|
<button class="btn btn-secondary btn-full">Add Color</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Device Status -->
|
||||||
|
<div class="card">
|
||||||
|
<h2>Connected Devices</h2>
|
||||||
|
<ul class="device-list">
|
||||||
|
<li class="device-item">
|
||||||
|
<div>
|
||||||
|
<strong>led-device1</strong>
|
||||||
|
<div style="font-size: 0.875rem; color: #666;">Group: group1</div>
|
||||||
|
</div>
|
||||||
|
<div class="device-status"></div>
|
||||||
|
</li>
|
||||||
|
<li class="device-item">
|
||||||
|
<div>
|
||||||
|
<strong>led-device2</strong>
|
||||||
|
<div style="font-size: 0.875rem; color: #666;">Group: group2</div>
|
||||||
|
</div>
|
||||||
|
<div class="device-status"></div>
|
||||||
|
</li>
|
||||||
|
<li class="device-item">
|
||||||
|
<div>
|
||||||
|
<strong>led-device3</strong>
|
||||||
|
<div style="font-size: 0.875rem; color: #666;">No group</div>
|
||||||
|
</div>
|
||||||
|
<div class="device-status offline"></div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Action Buttons -->
|
||||||
|
<div class="card">
|
||||||
|
<div class="actions">
|
||||||
|
<button class="btn btn-primary btn-full">Apply Settings</button>
|
||||||
|
<button class="btn btn-secondary btn-full">Save to Device</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Brightness slider
|
||||||
|
document.getElementById('brightness').addEventListener('input', function(e) {
|
||||||
|
document.getElementById('brightness-value').textContent = e.target.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Delay slider
|
||||||
|
document.getElementById('delay').addEventListener('input', function(e) {
|
||||||
|
document.getElementById('delay-value').textContent = e.target.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Pattern selection
|
||||||
|
document.querySelectorAll('.pattern-btn').forEach(btn => {
|
||||||
|
btn.addEventListener('click', function() {
|
||||||
|
document.querySelectorAll('.pattern-btn').forEach(b => b.classList.remove('active'));
|
||||||
|
this.classList.add('active');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Initialize color pickers
|
||||||
|
const colorPickers = [];
|
||||||
|
const initialColors = ['#000000', '#FF0000'];
|
||||||
|
|
||||||
|
function addColorPicker(color = '#000000') {
|
||||||
|
const container = document.createElement('div');
|
||||||
|
container.className = 'color-picker-wrapper';
|
||||||
|
document.getElementById('color-pickers').appendChild(container);
|
||||||
|
|
||||||
|
const picker = new ColorPicker(container, {
|
||||||
|
initialColor: color,
|
||||||
|
onColorChange: (newColor) => {
|
||||||
|
console.log('Color changed:', newColor);
|
||||||
|
// Update device colors
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
colorPickers.push(picker);
|
||||||
|
return picker;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add initial color pickers
|
||||||
|
initialColors.forEach(color => addColorPicker(color));
|
||||||
|
</script>
|
||||||
|
<script src="color-picker.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
@@ -0,0 +1,418 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>LED Driver - Device Management</title>
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
||||||
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||||
|
min-height: 100vh;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
max-width: 1200px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
background: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 24px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header h1 {
|
||||||
|
color: #667eea;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
padding: 12px 24px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background: #667eea;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover {
|
||||||
|
background: #5568d3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tabs {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
background: white;
|
||||||
|
padding: 8px;
|
||||||
|
border-radius: 12px;
|
||||||
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab {
|
||||||
|
flex: 1;
|
||||||
|
padding: 12px 24px;
|
||||||
|
border: none;
|
||||||
|
background: transparent;
|
||||||
|
border-radius: 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: 500;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab.active {
|
||||||
|
background: #667eea;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-content {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tab-content.active {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
background: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 24px;
|
||||||
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card h2 {
|
||||||
|
color: #667eea;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-item, .group-item {
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 16px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-item:hover, .group-item:hover {
|
||||||
|
border-color: #667eea;
|
||||||
|
box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-info, .group-info {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-name, .group-name {
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 1.125rem;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-details, .group-details {
|
||||||
|
font-size: 0.875rem;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-badge {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 4px 12px;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-online {
|
||||||
|
background: #d4edda;
|
||||||
|
color: #155724;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-offline {
|
||||||
|
background: #f8d7da;
|
||||||
|
color: #721c24;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-indicator {
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #4caf50;
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-indicator.offline {
|
||||||
|
background: #f44336;
|
||||||
|
}
|
||||||
|
|
||||||
|
.device-actions, .group-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-icon {
|
||||||
|
padding: 8px 12px;
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
background: white;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-icon:hover {
|
||||||
|
border-color: #667eea;
|
||||||
|
color: #667eea;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group label {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group input, .form-group select {
|
||||||
|
width: 100%;
|
||||||
|
padding: 12px;
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group input:focus, .form-group select:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: #667eea;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
margin-top: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary {
|
||||||
|
background: #e0e0e0;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary:hover {
|
||||||
|
background: #d0d0d0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.group-devices {
|
||||||
|
margin-top: 12px;
|
||||||
|
padding-top: 12px;
|
||||||
|
border-top: 1px solid #e0e0e0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.group-device-tag {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 4px 8px;
|
||||||
|
background: #f0f0f0;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
margin-right: 8px;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<div class="header">
|
||||||
|
<h1>Device & Group Management</h1>
|
||||||
|
<button class="btn btn-primary" onclick="showAddDeviceModal()">+ Add Device</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tabs">
|
||||||
|
<button class="tab active" onclick="switchTab('devices')">Devices</button>
|
||||||
|
<button class="tab" onclick="switchTab('groups')">Groups</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Devices Tab -->
|
||||||
|
<div id="devices-tab" class="tab-content active">
|
||||||
|
<div class="card">
|
||||||
|
<h2>Connected Devices</h2>
|
||||||
|
<div class="device-item">
|
||||||
|
<div class="device-info">
|
||||||
|
<div class="device-name">
|
||||||
|
<span class="status-indicator"></span>
|
||||||
|
led-device1
|
||||||
|
</div>
|
||||||
|
<div class="device-details">
|
||||||
|
<span class="status-badge status-online">Online</span>
|
||||||
|
MAC: AA:BB:CC:DD:EE:01 | Group: group1 | Pattern: Rainbow
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="device-actions">
|
||||||
|
<button class="btn-icon" title="Edit">✏️</button>
|
||||||
|
<button class="btn-icon" title="Settings">⚙️</button>
|
||||||
|
<button class="btn-icon" title="Remove">🗑️</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="device-item">
|
||||||
|
<div class="device-info">
|
||||||
|
<div class="device-name">
|
||||||
|
<span class="status-indicator"></span>
|
||||||
|
led-device2
|
||||||
|
</div>
|
||||||
|
<div class="device-details">
|
||||||
|
<span class="status-badge status-online">Online</span>
|
||||||
|
MAC: AA:BB:CC:DD:EE:02 | Group: group2 | Pattern: Chase
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="device-actions">
|
||||||
|
<button class="btn-icon" title="Edit">✏️</button>
|
||||||
|
<button class="btn-icon" title="Settings">⚙️</button>
|
||||||
|
<button class="btn-icon" title="Remove">🗑️</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="device-item">
|
||||||
|
<div class="device-info">
|
||||||
|
<div class="device-name">
|
||||||
|
<span class="status-indicator offline"></span>
|
||||||
|
led-device3
|
||||||
|
</div>
|
||||||
|
<div class="device-details">
|
||||||
|
<span class="status-badge status-offline">Offline</span>
|
||||||
|
MAC: AA:BB:CC:DD:EE:03 | No group | Pattern: On
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="device-actions">
|
||||||
|
<button class="btn-icon" title="Edit">✏️</button>
|
||||||
|
<button class="btn-icon" title="Settings">⚙️</button>
|
||||||
|
<button class="btn-icon" title="Remove">🗑️</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Groups Tab -->
|
||||||
|
<div id="groups-tab" class="tab-content">
|
||||||
|
<div class="card">
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;">
|
||||||
|
<h2>Groups</h2>
|
||||||
|
<button class="btn btn-primary" onclick="showAddGroupModal()">+ Create Group</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="group-item">
|
||||||
|
<div class="group-info">
|
||||||
|
<div class="group-name">group1</div>
|
||||||
|
<div class="group-details">
|
||||||
|
Pattern: On | Brightness: 100% | Delay: 100ms
|
||||||
|
</div>
|
||||||
|
<div class="group-devices">
|
||||||
|
<span class="group-device-tag">led-device1</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="group-actions">
|
||||||
|
<button class="btn-icon" title="Edit">✏️</button>
|
||||||
|
<button class="btn-icon" title="Apply">▶️</button>
|
||||||
|
<button class="btn-icon" title="Delete">🗑️</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="group-item">
|
||||||
|
<div class="group-info">
|
||||||
|
<div class="group-name">group2</div>
|
||||||
|
<div class="group-details">
|
||||||
|
Pattern: Chase | Brightness: 75% | Delay: 200ms
|
||||||
|
</div>
|
||||||
|
<div class="group-devices">
|
||||||
|
<span class="group-device-tag">led-device2</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="group-actions">
|
||||||
|
<button class="btn-icon" title="Edit">✏️</button>
|
||||||
|
<button class="btn-icon" title="Apply">▶️</button>
|
||||||
|
<button class="btn-icon" title="Delete">🗑️</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Modal (simplified) -->
|
||||||
|
<div id="modal" style="display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center;">
|
||||||
|
<div class="card" style="max-width: 500px; margin: 20px;">
|
||||||
|
<h2 id="modal-title">Add Device</h2>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Device Name</label>
|
||||||
|
<input type="text" id="device-name" placeholder="led-device4">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>MAC Address</label>
|
||||||
|
<input type="text" id="device-mac" placeholder="AA:BB:CC:DD:EE:04">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Group</label>
|
||||||
|
<select id="device-group">
|
||||||
|
<option value="">No group</option>
|
||||||
|
<option value="group1">group1</option>
|
||||||
|
<option value="group2">group2</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="form-actions">
|
||||||
|
<button class="btn btn-secondary" onclick="closeModal()">Cancel</button>
|
||||||
|
<button class="btn btn-primary" onclick="saveDevice()">Save</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function switchTab(tab) {
|
||||||
|
document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
|
||||||
|
document.querySelectorAll('.tab-content').forEach(c => c.classList.remove('active'));
|
||||||
|
|
||||||
|
event.target.classList.add('active');
|
||||||
|
document.getElementById(tab + '-tab').classList.add('active');
|
||||||
|
}
|
||||||
|
|
||||||
|
function showAddDeviceModal() {
|
||||||
|
document.getElementById('modal').style.display = 'flex';
|
||||||
|
document.getElementById('modal-title').textContent = 'Add Device';
|
||||||
|
}
|
||||||
|
|
||||||
|
function showAddGroupModal() {
|
||||||
|
document.getElementById('modal').style.display = 'flex';
|
||||||
|
document.getElementById('modal-title').textContent = 'Create Group';
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeModal() {
|
||||||
|
document.getElementById('modal').style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveDevice() {
|
||||||
|
alert('Device saved! (This is a mockup)');
|
||||||
|
closeModal();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Generate images from HTML mockup files
|
||||||
|
Uses Playwright to render HTML and take screenshots
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
try:
|
||||||
|
from playwright.sync_api import sync_playwright
|
||||||
|
PLAYWRIGHT_AVAILABLE = True
|
||||||
|
except ImportError:
|
||||||
|
PLAYWRIGHT_AVAILABLE = False
|
||||||
|
|
||||||
|
try:
|
||||||
|
from selenium import webdriver
|
||||||
|
from selenium.webdriver.chrome.options import Options
|
||||||
|
from selenium.webdriver.chrome.service import Service
|
||||||
|
SELENIUM_AVAILABLE = True
|
||||||
|
except ImportError:
|
||||||
|
SELENIUM_AVAILABLE = False
|
||||||
|
|
||||||
|
try:
|
||||||
|
from html2image import Html2Image
|
||||||
|
HTML2IMAGE_AVAILABLE = True
|
||||||
|
except ImportError:
|
||||||
|
HTML2IMAGE_AVAILABLE = False
|
||||||
|
|
||||||
|
|
||||||
|
def generate_with_playwright(html_file, output_file, width=1920, height=1080):
|
||||||
|
"""Generate image using Playwright"""
|
||||||
|
with sync_playwright() as p:
|
||||||
|
browser = p.chromium.launch(headless=True)
|
||||||
|
page = browser.new_page(viewport={'width': width, 'height': height})
|
||||||
|
page.goto(f'file://{html_file.absolute()}')
|
||||||
|
# Wait for page to load
|
||||||
|
page.wait_for_timeout(1000)
|
||||||
|
page.screenshot(path=str(output_file), full_page=True)
|
||||||
|
browser.close()
|
||||||
|
print(f"✓ Generated {output_file.name} using Playwright")
|
||||||
|
|
||||||
|
|
||||||
|
def generate_with_selenium(html_file, output_file, width=1920, height=1080):
|
||||||
|
"""Generate image using Selenium"""
|
||||||
|
chrome_options = Options()
|
||||||
|
chrome_options.add_argument('--headless')
|
||||||
|
chrome_options.add_argument('--no-sandbox')
|
||||||
|
chrome_options.add_argument('--disable-dev-shm-usage')
|
||||||
|
chrome_options.add_argument(f'--window-size={width},{height}')
|
||||||
|
|
||||||
|
driver = webdriver.Chrome(options=chrome_options)
|
||||||
|
try:
|
||||||
|
driver.get(f'file://{html_file.absolute()}')
|
||||||
|
# Wait for page to load
|
||||||
|
import time
|
||||||
|
time.sleep(2)
|
||||||
|
driver.save_screenshot(str(output_file))
|
||||||
|
print(f"✓ Generated {output_file.name} using Selenium")
|
||||||
|
finally:
|
||||||
|
driver.quit()
|
||||||
|
|
||||||
|
|
||||||
|
def generate_with_html2image(html_file, output_file, width=1920, height=1080):
|
||||||
|
"""Generate image using html2image"""
|
||||||
|
hti = Html2Image(size=(width, height))
|
||||||
|
hti.screenshot(
|
||||||
|
html_file=str(html_file),
|
||||||
|
save_as=output_file.name,
|
||||||
|
size=(width, height)
|
||||||
|
)
|
||||||
|
print(f"✓ Generated {output_file.name} using html2image")
|
||||||
|
|
||||||
|
|
||||||
|
def generate_image(html_file, output_dir, width=1920, height=1080):
|
||||||
|
"""Generate image from HTML file using available method"""
|
||||||
|
html_path = Path(html_file)
|
||||||
|
output_path = output_dir / f"{html_path.stem}.png"
|
||||||
|
|
||||||
|
if PLAYWRIGHT_AVAILABLE:
|
||||||
|
try:
|
||||||
|
generate_with_playwright(html_path, output_path, width, height)
|
||||||
|
return True
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Playwright failed: {e}, trying alternatives...")
|
||||||
|
|
||||||
|
if SELENIUM_AVAILABLE:
|
||||||
|
try:
|
||||||
|
generate_with_selenium(html_path, output_path, width, height)
|
||||||
|
return True
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Selenium failed: {e}, trying alternatives...")
|
||||||
|
|
||||||
|
if HTML2IMAGE_AVAILABLE:
|
||||||
|
try:
|
||||||
|
generate_with_html2image(html_path, output_path, width, height)
|
||||||
|
return True
|
||||||
|
except Exception as e:
|
||||||
|
print(f"html2image failed: {e}")
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Main function to generate images from all HTML files"""
|
||||||
|
script_dir = Path(__file__).parent
|
||||||
|
output_dir = script_dir / "images"
|
||||||
|
output_dir.mkdir(exist_ok=True)
|
||||||
|
|
||||||
|
html_files = list(script_dir.glob("*.html"))
|
||||||
|
|
||||||
|
if not html_files:
|
||||||
|
print("No HTML files found in mockups directory")
|
||||||
|
return
|
||||||
|
|
||||||
|
print(f"Found {len(html_files)} HTML file(s)")
|
||||||
|
print(f"Output directory: {output_dir}")
|
||||||
|
print()
|
||||||
|
|
||||||
|
# Check available libraries
|
||||||
|
if not any([PLAYWRIGHT_AVAILABLE, SELENIUM_AVAILABLE, HTML2IMAGE_AVAILABLE]):
|
||||||
|
print("ERROR: No screenshot library available!")
|
||||||
|
print("\nPlease install one of the following:")
|
||||||
|
print(" pip install playwright && playwright install chromium")
|
||||||
|
print(" pip install selenium")
|
||||||
|
print(" pip install html2image")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
print("Available screenshot libraries:")
|
||||||
|
if PLAYWRIGHT_AVAILABLE:
|
||||||
|
print(" ✓ Playwright")
|
||||||
|
if SELENIUM_AVAILABLE:
|
||||||
|
print(" ✓ Selenium")
|
||||||
|
if HTML2IMAGE_AVAILABLE:
|
||||||
|
print(" ✓ html2image")
|
||||||
|
print()
|
||||||
|
|
||||||
|
# Generate images
|
||||||
|
success_count = 0
|
||||||
|
for html_file in html_files:
|
||||||
|
print(f"Generating image from {html_file.name}...")
|
||||||
|
if generate_image(html_file, output_dir):
|
||||||
|
success_count += 1
|
||||||
|
else:
|
||||||
|
print(f"✗ Failed to generate image from {html_file.name}")
|
||||||
|
print()
|
||||||
|
|
||||||
|
print(f"Successfully generated {success_count}/{len(html_files)} images")
|
||||||
|
print(f"Images saved to: {output_dir}")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
|
||||||
|
After Width: | Height: | Size: 625 KiB |
|
After Width: | Height: | Size: 600 KiB |
|
After Width: | Height: | Size: 585 KiB |
|
After Width: | Height: | Size: 714 KiB |
|
After Width: | Height: | Size: 508 KiB |
|
After Width: | Height: | Size: 562 KiB |
|
After Width: | Height: | Size: 904 KiB |
@@ -0,0 +1,136 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>LED Driver - UI Mockups</title>
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
||||||
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||||
|
min-height: 100vh;
|
||||||
|
padding: 40px 20px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
max-width: 800px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
text-align: center;
|
||||||
|
color: white;
|
||||||
|
margin-bottom: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header h1 {
|
||||||
|
font-size: 3rem;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header p {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mockups-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||||
|
gap: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mockup-card {
|
||||||
|
background: white;
|
||||||
|
border-radius: 16px;
|
||||||
|
padding: 32px;
|
||||||
|
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
|
||||||
|
transition: all 0.3s;
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mockup-card:hover {
|
||||||
|
transform: translateY(-4px);
|
||||||
|
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.mockup-icon {
|
||||||
|
font-size: 3rem;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mockup-title {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #667eea;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mockup-description {
|
||||||
|
color: #666;
|
||||||
|
line-height: 1.6;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<div class="header">
|
||||||
|
<h1>LED Driver UI Mockups</h1>
|
||||||
|
<p>Example user interfaces for the LED driver system</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mockups-grid">
|
||||||
|
<a href="dashboard.html" class="mockup-card">
|
||||||
|
<div class="mockup-icon">📊</div>
|
||||||
|
<div class="mockup-title">Dashboard</div>
|
||||||
|
<div class="mockup-description">
|
||||||
|
Main control panel for managing LED patterns, brightness, colors, and device status.
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="pattern-selector.html" class="mockup-card">
|
||||||
|
<div class="mockup-icon">🎨</div>
|
||||||
|
<div class="mockup-title">Pattern Selector</div>
|
||||||
|
<div class="mockup-description">
|
||||||
|
Visual interface for selecting from available LED patterns: On, Off, Blink, Chase, Circle, Pulse, Rainbow, and Transition.
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="device-management.html" class="mockup-card">
|
||||||
|
<div class="mockup-icon">🔧</div>
|
||||||
|
<div class="mockup-title">Device Management</div>
|
||||||
|
<div class="mockup-description">
|
||||||
|
Manage connected LED devices and groups. View device status, assign groups, and configure device settings.
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="settings.html" class="mockup-card">
|
||||||
|
<div class="mockup-icon">⚙️</div>
|
||||||
|
<div class="mockup-title">Settings</div>
|
||||||
|
<div class="mockup-description">
|
||||||
|
Comprehensive settings panel for configuring LED pin, color order, pattern parameters, and network settings.
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a href="presets.html" class="mockup-card">
|
||||||
|
<div class="mockup-icon">💾</div>
|
||||||
|
<div class="mockup-title">Presets</div>
|
||||||
|
<div class="mockup-description">
|
||||||
|
Save, load, and manage preset configurations with pattern, colors, delay, and all N1-N8 parameters for quick pattern switching.
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
@@ -0,0 +1,310 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>LED Driver - Pattern Selector</title>
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
||||||
|
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
||||||
|
min-height: 100vh;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
max-width: 1400px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 40px;
|
||||||
|
color: #2d3748;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header h1 {
|
||||||
|
font-size: 2.5rem;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header p {
|
||||||
|
font-size: 1.125rem;
|
||||||
|
color: #718096;
|
||||||
|
}
|
||||||
|
|
||||||
|
.patterns-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
||||||
|
gap: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pattern-card {
|
||||||
|
background: white;
|
||||||
|
border-radius: 16px;
|
||||||
|
padding: 24px;
|
||||||
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s;
|
||||||
|
border: 3px solid transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pattern-card:hover {
|
||||||
|
transform: translateY(-4px);
|
||||||
|
box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
|
||||||
|
border-color: #667eea;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pattern-card.selected {
|
||||||
|
border-color: #667eea;
|
||||||
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pattern-icon {
|
||||||
|
width: 100%;
|
||||||
|
height: 180px;
|
||||||
|
border-radius: 12px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 3rem;
|
||||||
|
background: #f7fafc;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pattern-card.selected .pattern-icon {
|
||||||
|
background: rgba(255, 255, 255, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pattern-name {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pattern-description {
|
||||||
|
font-size: 0.875rem;
|
||||||
|
color: #718096;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pattern-card.selected .pattern-description {
|
||||||
|
color: rgba(255, 255, 255, 0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pattern-preview {
|
||||||
|
display: flex;
|
||||||
|
gap: 4px;
|
||||||
|
margin-top: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-dot {
|
||||||
|
flex: 1;
|
||||||
|
height: 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: #e2e8f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pattern-card.selected .preview-dot {
|
||||||
|
background: rgba(255, 255, 255, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
margin-top: 40px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
padding: 16px 48px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 1.125rem;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s;
|
||||||
|
margin: 0 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background: #667eea;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover {
|
||||||
|
background: #5568d3;
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 8px 16px rgba(102, 126, 234, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary {
|
||||||
|
background: white;
|
||||||
|
color: #667eea;
|
||||||
|
border: 2px solid #667eea;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary:hover {
|
||||||
|
background: #f0f0ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Pattern-specific icons */
|
||||||
|
.icon-on { background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%); }
|
||||||
|
.icon-off { background: #2d3748; }
|
||||||
|
.icon-blink { background: linear-gradient(90deg, #ffd700 25%, #2d3748 25%, #2d3748 50%, #ffd700 50%); }
|
||||||
|
.icon-chase { background: linear-gradient(90deg, #ff0000 0%, #ff6666 50%, #ff0000 100%); }
|
||||||
|
.icon-circle { background: radial-gradient(circle, #00ff00 0%, #66ff66 50%, #00ff00 100%); }
|
||||||
|
.icon-pulse { background: radial-gradient(circle, #0000ff 0%, #6666ff 50%, #0000ff 100%); }
|
||||||
|
.icon-rainbow { background: linear-gradient(90deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3); }
|
||||||
|
.icon-transition { background: linear-gradient(135deg, #ff0000 0%, #0000ff 100%); }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<div class="header">
|
||||||
|
<h1>Select LED Pattern</h1>
|
||||||
|
<p>Choose a pattern to display on your LED devices</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="patterns-grid">
|
||||||
|
<div class="pattern-card" data-pattern="on">
|
||||||
|
<div class="pattern-icon icon-on">💡</div>
|
||||||
|
<div class="pattern-name">On</div>
|
||||||
|
<div class="pattern-description">Solid color display - LEDs stay on with selected color</div>
|
||||||
|
<div class="pattern-preview">
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pattern-card" data-pattern="off">
|
||||||
|
<div class="pattern-icon icon-off">⚫</div>
|
||||||
|
<div class="pattern-name">Off</div>
|
||||||
|
<div class="pattern-description">Turn all LEDs off</div>
|
||||||
|
<div class="pattern-preview">
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pattern-card" data-pattern="blink">
|
||||||
|
<div class="pattern-icon icon-blink">✨</div>
|
||||||
|
<div class="pattern-name">Blink</div>
|
||||||
|
<div class="pattern-description">All LEDs blink on and off together</div>
|
||||||
|
<div class="pattern-preview">
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pattern-card" data-pattern="chase">
|
||||||
|
<div class="pattern-icon icon-chase">🏃</div>
|
||||||
|
<div class="pattern-name">Chase</div>
|
||||||
|
<div class="pattern-description">Light chases along the LED strip</div>
|
||||||
|
<div class="pattern-preview">
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pattern-card" data-pattern="circle">
|
||||||
|
<div class="pattern-icon icon-circle">⭕</div>
|
||||||
|
<div class="pattern-name">Circle</div>
|
||||||
|
<div class="pattern-description">Circular pattern that rotates around the strip</div>
|
||||||
|
<div class="pattern-preview">
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pattern-card" data-pattern="pulse">
|
||||||
|
<div class="pattern-icon icon-pulse">💓</div>
|
||||||
|
<div class="pattern-name">Pulse</div>
|
||||||
|
<div class="pattern-description">Pulsing effect that fades in and out</div>
|
||||||
|
<div class="pattern-preview">
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pattern-card" data-pattern="rainbow">
|
||||||
|
<div class="pattern-icon icon-rainbow">🌈</div>
|
||||||
|
<div class="pattern-name">Rainbow</div>
|
||||||
|
<div class="pattern-description">Smooth rainbow color transition across LEDs</div>
|
||||||
|
<div class="pattern-preview">
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pattern-card" data-pattern="transition">
|
||||||
|
<div class="pattern-icon icon-transition">🔄</div>
|
||||||
|
<div class="pattern-name">Transition</div>
|
||||||
|
<div class="pattern-description">Smooth color transition between selected colors</div>
|
||||||
|
<div class="pattern-preview">
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
<div class="preview-dot"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="actions">
|
||||||
|
<button class="btn btn-secondary" onclick="window.history.back()">Cancel</button>
|
||||||
|
<button class="btn btn-primary" id="apply-btn">Apply Pattern</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
let selectedPattern = null;
|
||||||
|
|
||||||
|
document.querySelectorAll('.pattern-card').forEach(card => {
|
||||||
|
card.addEventListener('click', function() {
|
||||||
|
document.querySelectorAll('.pattern-card').forEach(c => c.classList.remove('selected'));
|
||||||
|
this.classList.add('selected');
|
||||||
|
selectedPattern = this.dataset.pattern;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById('apply-btn').addEventListener('click', function() {
|
||||||
|
if (selectedPattern) {
|
||||||
|
alert(`Applying pattern: ${selectedPattern}`);
|
||||||
|
// In real implementation, this would send the pattern to the device
|
||||||
|
} else {
|
||||||
|
alert('Please select a pattern first');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
@@ -0,0 +1,968 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>LED Driver - Presets</title>
|
||||||
|
<link rel="stylesheet" href="color-picker.css">
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
||||||
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||||
|
min-height: 100vh;
|
||||||
|
padding: 20px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
max-width: 1400px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
background: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 24px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header h1 {
|
||||||
|
color: #667eea;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header p {
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.controls {
|
||||||
|
background: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 20px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||||
|
display: flex;
|
||||||
|
gap: 16px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-box {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 200px;
|
||||||
|
padding: 12px;
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-box:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: #667eea;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-group {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-select {
|
||||||
|
padding: 12px;
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 1rem;
|
||||||
|
background: white;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-select:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: #667eea;
|
||||||
|
}
|
||||||
|
|
||||||
|
.view-toggle {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.view-btn {
|
||||||
|
padding: 8px 16px;
|
||||||
|
border: none;
|
||||||
|
background: white;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.view-btn.active {
|
||||||
|
background: #667eea;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.presets-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||||
|
gap: 24px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preset-card {
|
||||||
|
background: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 24px;
|
||||||
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||||
|
transition: all 0.3s;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 3px solid transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preset-card:hover {
|
||||||
|
transform: translateY(-4px);
|
||||||
|
box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
|
||||||
|
border-color: #667eea;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preset-card.selected {
|
||||||
|
border-color: #667eea;
|
||||||
|
background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.preset-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: start;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preset-name {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pattern-badge {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 4px 12px;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 600;
|
||||||
|
background: #667eea;
|
||||||
|
color: white;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pattern-badge.on { background: #4caf50; }
|
||||||
|
.pattern-badge.off { background: #757575; }
|
||||||
|
.pattern-badge.blink { background: #ff9800; }
|
||||||
|
.pattern-badge.chase { background: #f44336; }
|
||||||
|
.pattern-badge.circle { background: #00bcd4; }
|
||||||
|
.pattern-badge.pulse { background: #e91e63; }
|
||||||
|
.pattern-badge.rainbow { background: linear-gradient(90deg, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3); }
|
||||||
|
.pattern-badge.transition { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
|
||||||
|
|
||||||
|
.color-preview {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-swatch {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 2px solid #e0e0e0;
|
||||||
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.preset-info {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 12px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-label {
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-value {
|
||||||
|
color: #667eea;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preset-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
margin-top: 16px;
|
||||||
|
padding-top: 16px;
|
||||||
|
border-top: 1px solid #e0e0e0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
padding: 10px 20px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background: #667eea;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover {
|
||||||
|
background: #5568d3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary {
|
||||||
|
background: #e0e0e0;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary:hover {
|
||||||
|
background: #d0d0d0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-danger {
|
||||||
|
background: #f44336;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-danger:hover {
|
||||||
|
background: #d32f2f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-icon {
|
||||||
|
padding: 8px;
|
||||||
|
min-width: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-large {
|
||||||
|
padding: 16px 32px;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Modal Styles */
|
||||||
|
.modal {
|
||||||
|
display: none;
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
z-index: 1000;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal.active {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-content {
|
||||||
|
background: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 32px;
|
||||||
|
max-width: 600px;
|
||||||
|
width: 100%;
|
||||||
|
max-height: 90vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header {
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-header h2 {
|
||||||
|
color: #667eea;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group label {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group input,
|
||||||
|
.form-group select {
|
||||||
|
width: 100%;
|
||||||
|
padding: 12px;
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group input:focus,
|
||||||
|
.form-group select:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: #667eea;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group small {
|
||||||
|
display: block;
|
||||||
|
margin-top: 4px;
|
||||||
|
color: #666;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-inputs {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-input-wrapper {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-input-wrapper {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.params-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.n-value-input {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.n-value-input:focus {
|
||||||
|
border-color: #667eea;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.param-input {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.param-input label {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.param-input input {
|
||||||
|
padding: 8px;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.modal-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
margin-top: 24px;
|
||||||
|
padding-top: 24px;
|
||||||
|
border-top: 1px solid #e0e0e0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
background: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 60px 40px;
|
||||||
|
text-align: center;
|
||||||
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state-icon {
|
||||||
|
font-size: 4rem;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state h2 {
|
||||||
|
color: #667eea;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state p {
|
||||||
|
color: #666;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<div class="header">
|
||||||
|
<div>
|
||||||
|
<h1>Preset Management</h1>
|
||||||
|
<p>Save and manage your favorite LED pattern configurations</p>
|
||||||
|
</div>
|
||||||
|
<div style="display: flex; gap: 12px; align-items: center;">
|
||||||
|
<button class="btn btn-secondary btn-large" onclick="syncPresets()" title="Sync all presets to all devices">🔄 Sync Presets to All Devices</button>
|
||||||
|
<button class="btn btn-primary btn-large" onclick="showCreateModal()">+ Create Preset</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" class="search-box" placeholder="Search presets..." id="search-input">
|
||||||
|
<div class="filter-group">
|
||||||
|
<select class="filter-select" id="pattern-filter">
|
||||||
|
<option value="">All Patterns</option>
|
||||||
|
<option value="on">On</option>
|
||||||
|
<option value="off">Off</option>
|
||||||
|
<option value="blink">Blink</option>
|
||||||
|
<option value="chase">Chase</option>
|
||||||
|
<option value="circle">Circle</option>
|
||||||
|
<option value="pulse">Pulse</option>
|
||||||
|
<option value="rainbow">Rainbow</option>
|
||||||
|
<option value="transition">Transition</option>
|
||||||
|
</select>
|
||||||
|
<select class="filter-select" id="sort-select">
|
||||||
|
<option value="name">Sort by Name</option>
|
||||||
|
<option value="recent">Recently Used</option>
|
||||||
|
<option value="created">Recently Created</option>
|
||||||
|
</select>
|
||||||
|
<div class="view-toggle">
|
||||||
|
<button class="view-btn active" onclick="setView('grid')" id="view-grid">Grid</button>
|
||||||
|
<button class="view-btn" onclick="setView('list')" id="view-list">List</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="presets-grid" id="presets-container">
|
||||||
|
<!-- Preset Card 1 -->
|
||||||
|
<div class="preset-card" data-pattern="rainbow" data-name="Fast Rainbow">
|
||||||
|
<div class="preset-header">
|
||||||
|
<div>
|
||||||
|
<div class="preset-name">Fast Rainbow</div>
|
||||||
|
<span class="pattern-badge rainbow">Rainbow</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="color-preview">
|
||||||
|
<div class="color-swatch" style="background: #FF0000;"></div>
|
||||||
|
<div class="color-swatch" style="background: #00FF00;"></div>
|
||||||
|
<div class="color-swatch" style="background: #0000FF;"></div>
|
||||||
|
</div>
|
||||||
|
<div class="preset-info">
|
||||||
|
<div class="info-item">
|
||||||
|
<span class="info-label">Delay:</span>
|
||||||
|
<span class="info-value">30ms</span>
|
||||||
|
</div>
|
||||||
|
<div class="info-item">
|
||||||
|
<span class="info-label">N1:</span>
|
||||||
|
<span class="info-value">10</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="preset-actions">
|
||||||
|
<button class="btn btn-primary" onclick="applyPreset('Fast Rainbow')">Apply</button>
|
||||||
|
<button class="btn btn-secondary btn-icon" onclick="editPreset('Fast Rainbow')" title="Edit">✏️</button>
|
||||||
|
<button class="btn btn-danger btn-icon" onclick="deletePreset('Fast Rainbow')" title="Delete">🗑️</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Preset Card 2 -->
|
||||||
|
<div class="preset-card" data-pattern="pulse" data-name="Slow Pulse">
|
||||||
|
<div class="preset-header">
|
||||||
|
<div>
|
||||||
|
<div class="preset-name">Slow Pulse</div>
|
||||||
|
<span class="pattern-badge pulse">Pulse</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="color-preview">
|
||||||
|
<div class="color-swatch" style="background: #FF0000;"></div>
|
||||||
|
<div class="color-swatch" style="background: #0000FF;"></div>
|
||||||
|
</div>
|
||||||
|
<div class="preset-info">
|
||||||
|
<div class="info-item">
|
||||||
|
<span class="info-label">Delay:</span>
|
||||||
|
<span class="info-value">200ms</span>
|
||||||
|
</div>
|
||||||
|
<div class="info-item">
|
||||||
|
<span class="info-label">N1:</span>
|
||||||
|
<span class="info-value">500</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="preset-actions">
|
||||||
|
<button class="btn btn-primary" onclick="applyPreset('Slow Pulse')">Apply</button>
|
||||||
|
<button class="btn btn-secondary btn-icon" onclick="editPreset('Slow Pulse')" title="Edit">✏️</button>
|
||||||
|
<button class="btn btn-danger btn-icon" onclick="deletePreset('Slow Pulse')" title="Delete">🗑️</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Preset Card 3 -->
|
||||||
|
<div class="preset-card" data-pattern="chase" data-name="Red Blue Chase">
|
||||||
|
<div class="preset-header">
|
||||||
|
<div>
|
||||||
|
<div class="preset-name">Red Blue Chase</div>
|
||||||
|
<span class="pattern-badge chase">Chase</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="color-preview">
|
||||||
|
<div class="color-swatch" style="background: #FF0000;"></div>
|
||||||
|
<div class="color-swatch" style="background: #0000FF;"></div>
|
||||||
|
</div>
|
||||||
|
<div class="preset-info">
|
||||||
|
<div class="info-item">
|
||||||
|
<span class="info-label">Delay:</span>
|
||||||
|
<span class="info-value">100ms</span>
|
||||||
|
</div>
|
||||||
|
<div class="info-item">
|
||||||
|
<span class="info-label">N1:</span>
|
||||||
|
<span class="info-value">5</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="preset-actions">
|
||||||
|
<button class="btn btn-primary" onclick="applyPreset('Red Blue Chase')">Apply</button>
|
||||||
|
<button class="btn btn-secondary btn-icon" onclick="editPreset('Red Blue Chase')" title="Edit">✏️</button>
|
||||||
|
<button class="btn btn-danger btn-icon" onclick="deletePreset('Red Blue Chase')" title="Delete">🗑️</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Preset Card 4 -->
|
||||||
|
<div class="preset-card" data-pattern="circle" data-name="Loading Circle">
|
||||||
|
<div class="preset-header">
|
||||||
|
<div>
|
||||||
|
<div class="preset-name">Loading Circle</div>
|
||||||
|
<span class="pattern-badge circle">Circle</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="color-preview">
|
||||||
|
<div class="color-swatch" style="background: #00FF00;"></div>
|
||||||
|
</div>
|
||||||
|
<div class="preset-info">
|
||||||
|
<div class="info-item">
|
||||||
|
<span class="info-label">Delay:</span>
|
||||||
|
<span class="info-value">50ms</span>
|
||||||
|
</div>
|
||||||
|
<div class="info-item">
|
||||||
|
<span class="info-label">N1:</span>
|
||||||
|
<span class="info-value">50</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="preset-actions">
|
||||||
|
<button class="btn btn-primary" onclick="applyPreset('Loading Circle')">Apply</button>
|
||||||
|
<button class="btn btn-secondary btn-icon" onclick="editPreset('Loading Circle')" title="Edit">✏️</button>
|
||||||
|
<button class="btn btn-danger btn-icon" onclick="deletePreset('Loading Circle')" title="Delete">🗑️</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Preset Card 5 -->
|
||||||
|
<div class="preset-card" data-pattern="blink" data-name="Party Blink">
|
||||||
|
<div class="preset-header">
|
||||||
|
<div>
|
||||||
|
<div class="preset-name">Party Blink</div>
|
||||||
|
<span class="pattern-badge blink">Blink</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="color-preview">
|
||||||
|
<div class="color-swatch" style="background: #FF00FF;"></div>
|
||||||
|
<div class="color-swatch" style="background: #00FFFF;"></div>
|
||||||
|
<div class="color-swatch" style="background: #FFFF00;"></div>
|
||||||
|
</div>
|
||||||
|
<div class="preset-info">
|
||||||
|
<div class="info-item">
|
||||||
|
<span class="info-label">Delay:</span>
|
||||||
|
<span class="info-value">150ms</span>
|
||||||
|
</div>
|
||||||
|
<div class="info-item">
|
||||||
|
<span class="info-label">N1:</span>
|
||||||
|
<span class="info-value">0</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="preset-actions">
|
||||||
|
<button class="btn btn-primary" onclick="applyPreset('Party Blink')">Apply</button>
|
||||||
|
<button class="btn btn-secondary btn-icon" onclick="editPreset('Party Blink')" title="Edit">✏️</button>
|
||||||
|
<button class="btn btn-danger btn-icon" onclick="deletePreset('Party Blink')" title="Delete">🗑️</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Preset Card 6 -->
|
||||||
|
<div class="preset-card" data-pattern="transition" data-name="Smooth Transition">
|
||||||
|
<div class="preset-header">
|
||||||
|
<div>
|
||||||
|
<div class="preset-name">Smooth Transition</div>
|
||||||
|
<span class="pattern-badge transition">Transition</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="color-preview">
|
||||||
|
<div class="color-swatch" style="background: #FF0000;"></div>
|
||||||
|
<div class="color-swatch" style="background: #00FF00;"></div>
|
||||||
|
<div class="color-swatch" style="background: #0000FF;"></div>
|
||||||
|
<div class="color-swatch" style="background: #FFFF00;"></div>
|
||||||
|
</div>
|
||||||
|
<div class="preset-info">
|
||||||
|
<div class="info-item">
|
||||||
|
<span class="info-label">Delay:</span>
|
||||||
|
<span class="info-value">100ms</span>
|
||||||
|
</div>
|
||||||
|
<div class="info-item">
|
||||||
|
<span class="info-label">N1:</span>
|
||||||
|
<span class="info-value">0</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="preset-actions">
|
||||||
|
<button class="btn btn-primary" onclick="applyPreset('Smooth Transition')">Apply</button>
|
||||||
|
<button class="btn btn-secondary btn-icon" onclick="editPreset('Smooth Transition')" title="Edit">✏️</button>
|
||||||
|
<button class="btn btn-danger btn-icon" onclick="deletePreset('Smooth Transition')" title="Delete">🗑️</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Create/Edit Preset Modal -->
|
||||||
|
<div class="modal" id="preset-modal">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h2 id="modal-title">Create Preset</h2>
|
||||||
|
<p>Configure your preset settings</p>
|
||||||
|
</div>
|
||||||
|
<form id="preset-form">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="preset-name">Preset Name *</label>
|
||||||
|
<input type="text" id="preset-name" required placeholder="Enter preset name">
|
||||||
|
<small>Unique identifier for this preset</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="preset-pattern">Pattern *</label>
|
||||||
|
<select id="preset-pattern" required>
|
||||||
|
<option value="on">On</option>
|
||||||
|
<option value="off">Off</option>
|
||||||
|
<option value="blink">Blink</option>
|
||||||
|
<option value="chase">Chase</option>
|
||||||
|
<option value="circle">Circle</option>
|
||||||
|
<option value="pulse">Pulse</option>
|
||||||
|
<option value="rainbow">Rainbow</option>
|
||||||
|
<option value="transition">Transition</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Colors *</label>
|
||||||
|
<div class="color-inputs" id="color-inputs">
|
||||||
|
<!-- Color pickers will be added here -->
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn btn-secondary" onclick="addColorPicker()" style="margin-top: 8px;">+ Add Color</button>
|
||||||
|
<small>Minimum 2 colors required</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="preset-delay">
|
||||||
|
Delay (ms) *
|
||||||
|
<span id="delay-value-display" style="margin-left: 12px; color: #667eea; font-weight: 600;">100</span>
|
||||||
|
</label>
|
||||||
|
<input type="range" id="preset-delay" min="10" max="1000" value="100" step="10" required>
|
||||||
|
<small>Animation speed (10-1000 milliseconds)</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="step-offset">Step Offset</label>
|
||||||
|
<input type="number" id="step-offset" value="0" min="-1000" max="1000">
|
||||||
|
<small>Step offset for group synchronization. Applied per device when preset is used in a group.</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="step-increment">Step Increment</label>
|
||||||
|
<input type="number" id="step-increment" value="1" min="1" max="255">
|
||||||
|
<small>Amount step counter increments per cycle. Controls pattern advancement speed.</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Pattern Parameters (N1-N8)</label>
|
||||||
|
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;">
|
||||||
|
<small style="margin: 0;">Pattern-specific parameters (0-255, varies by pattern)</small>
|
||||||
|
<button type="button" class="btn btn-secondary" onclick="setAllNValues(0)" style="padding: 6px 12px; font-size: 0.75rem;">Reset All to 0</button>
|
||||||
|
</div>
|
||||||
|
<div class="params-grid">
|
||||||
|
<div class="param-input">
|
||||||
|
<label>N1</label>
|
||||||
|
<input type="number" id="n1" min="0" max="255" value="0" class="n-value-input">
|
||||||
|
</div>
|
||||||
|
<div class="param-input">
|
||||||
|
<label>N2</label>
|
||||||
|
<input type="number" id="n2" min="0" max="255" value="0" class="n-value-input">
|
||||||
|
</div>
|
||||||
|
<div class="param-input">
|
||||||
|
<label>N3</label>
|
||||||
|
<input type="number" id="n3" min="0" max="255" value="0" class="n-value-input">
|
||||||
|
</div>
|
||||||
|
<div class="param-input">
|
||||||
|
<label>N4</label>
|
||||||
|
<input type="number" id="n4" min="0" max="255" value="0" class="n-value-input">
|
||||||
|
</div>
|
||||||
|
<div class="param-input">
|
||||||
|
<label>N5</label>
|
||||||
|
<input type="number" id="n5" min="0" max="255" value="0" class="n-value-input">
|
||||||
|
</div>
|
||||||
|
<div class="param-input">
|
||||||
|
<label>N6</label>
|
||||||
|
<input type="number" id="n6" min="0" max="255" value="0" class="n-value-input">
|
||||||
|
</div>
|
||||||
|
<div class="param-input">
|
||||||
|
<label>N7</label>
|
||||||
|
<input type="number" id="n7" min="0" max="255" value="0" class="n-value-input">
|
||||||
|
</div>
|
||||||
|
<div class="param-input">
|
||||||
|
<label>N8</label>
|
||||||
|
<input type="number" id="n8" min="0" max="255" value="0" class="n-value-input">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap;">
|
||||||
|
<button type="button" class="btn btn-secondary" onclick="setAllNValues(0)" style="padding: 8px 16px; font-size: 0.875rem;">Set All to 0</button>
|
||||||
|
<button type="button" class="btn btn-secondary" onclick="copyNValuesFromCurrent()" style="padding: 8px 16px; font-size: 0.875rem;">Copy from Current Settings</button>
|
||||||
|
<button type="button" class="btn btn-secondary" onclick="showNValueHelp()" style="padding: 8px 16px; font-size: 0.875rem;">ℹ️ Parameter Help</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-actions">
|
||||||
|
<button type="button" class="btn btn-secondary" onclick="closeModal()">Cancel</button>
|
||||||
|
<button type="submit" class="btn btn-primary">Save Preset</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
let currentView = 'grid';
|
||||||
|
let editingPreset = null;
|
||||||
|
|
||||||
|
// Delay slider update
|
||||||
|
document.getElementById('preset-delay').addEventListener('input', function(e) {
|
||||||
|
document.getElementById('delay-value-display').textContent = e.target.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Search functionality
|
||||||
|
document.getElementById('search-input').addEventListener('input', function(e) {
|
||||||
|
filterPresets();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Filter functionality
|
||||||
|
document.getElementById('pattern-filter').addEventListener('change', function(e) {
|
||||||
|
filterPresets();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Sort functionality
|
||||||
|
document.getElementById('sort-select').addEventListener('change', function(e) {
|
||||||
|
sortPresets(e.target.value);
|
||||||
|
});
|
||||||
|
|
||||||
|
function filterPresets() {
|
||||||
|
const search = document.getElementById('search-input').value.toLowerCase();
|
||||||
|
const patternFilter = document.getElementById('pattern-filter').value;
|
||||||
|
const cards = document.querySelectorAll('.preset-card');
|
||||||
|
|
||||||
|
cards.forEach(card => {
|
||||||
|
const name = card.dataset.name.toLowerCase();
|
||||||
|
const pattern = card.dataset.pattern;
|
||||||
|
const matchesSearch = name.includes(search);
|
||||||
|
const matchesPattern = !patternFilter || pattern === patternFilter;
|
||||||
|
|
||||||
|
if (matchesSearch && matchesPattern) {
|
||||||
|
card.style.display = '';
|
||||||
|
} else {
|
||||||
|
card.style.display = 'none';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function sortPresets(sortBy) {
|
||||||
|
const container = document.getElementById('presets-container');
|
||||||
|
const cards = Array.from(container.querySelectorAll('.preset-card'));
|
||||||
|
|
||||||
|
cards.sort((a, b) => {
|
||||||
|
if (sortBy === 'name') {
|
||||||
|
return a.dataset.name.localeCompare(b.dataset.name);
|
||||||
|
} else if (sortBy === 'recent') {
|
||||||
|
// In real implementation, would use actual usage data
|
||||||
|
return 0;
|
||||||
|
} else if (sortBy === 'created') {
|
||||||
|
// In real implementation, would use creation timestamps
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
cards.forEach(card => container.appendChild(card));
|
||||||
|
}
|
||||||
|
|
||||||
|
function setView(view) {
|
||||||
|
currentView = view;
|
||||||
|
const container = document.getElementById('presets-container');
|
||||||
|
const gridBtn = document.getElementById('view-grid');
|
||||||
|
const listBtn = document.getElementById('view-list');
|
||||||
|
|
||||||
|
if (view === 'grid') {
|
||||||
|
container.style.gridTemplateColumns = 'repeat(auto-fill, minmax(300px, 1fr))';
|
||||||
|
gridBtn.classList.add('active');
|
||||||
|
listBtn.classList.remove('active');
|
||||||
|
} else {
|
||||||
|
container.style.gridTemplateColumns = '1fr';
|
||||||
|
gridBtn.classList.remove('active');
|
||||||
|
listBtn.classList.add('active');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showCreateModal() {
|
||||||
|
editingPreset = null;
|
||||||
|
document.getElementById('modal-title').textContent = 'Create Preset';
|
||||||
|
document.getElementById('preset-form').reset();
|
||||||
|
document.getElementById('preset-delay').value = 100;
|
||||||
|
document.getElementById('delay-value-display').textContent = '100';
|
||||||
|
// Reset to 2 colors
|
||||||
|
initializeColorPickers();
|
||||||
|
document.getElementById('preset-modal').classList.add('active');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize color pickers function (defined before showCreateModal)
|
||||||
|
const presetColorPickers = [];
|
||||||
|
|
||||||
|
function initializeColorPickers() {
|
||||||
|
const colorInputs = document.getElementById('color-inputs');
|
||||||
|
colorInputs.innerHTML = '';
|
||||||
|
presetColorPickers.length = 0;
|
||||||
|
addColorPicker('#FF0000');
|
||||||
|
addColorPicker('#0000FF');
|
||||||
|
}
|
||||||
|
|
||||||
|
function addColorPicker(color = '#00FF00') {
|
||||||
|
const colorInputs = document.getElementById('color-inputs');
|
||||||
|
const wrapper = document.createElement('div');
|
||||||
|
wrapper.className = 'color-input-wrapper';
|
||||||
|
colorInputs.appendChild(wrapper);
|
||||||
|
|
||||||
|
const picker = new ColorPicker(wrapper, {
|
||||||
|
initialColor: color,
|
||||||
|
onColorChange: (newColor) => {
|
||||||
|
console.log('Preset color changed:', newColor);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
presetColorPickers.push(picker);
|
||||||
|
return picker;
|
||||||
|
}
|
||||||
|
|
||||||
|
function editPreset(name) {
|
||||||
|
editingPreset = name;
|
||||||
|
document.getElementById('modal-title').textContent = 'Edit Preset';
|
||||||
|
// In real implementation, would load preset data
|
||||||
|
document.getElementById('preset-name').value = name;
|
||||||
|
document.getElementById('preset-modal').classList.add('active');
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeModal() {
|
||||||
|
document.getElementById('preset-modal').classList.remove('active');
|
||||||
|
editingPreset = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function applyPreset(name) {
|
||||||
|
alert(`Applying preset: ${name}\n(In real implementation, this would send preset configuration to device(s))`);
|
||||||
|
}
|
||||||
|
|
||||||
|
function deletePreset(name) {
|
||||||
|
if (confirm(`Delete preset "${name}"?`)) {
|
||||||
|
alert(`Preset "${name}" deleted\n(In real implementation, this would remove the preset from storage)`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function syncPresets() {
|
||||||
|
if (confirm('Sync all presets to all devices?\nThis will send all presets from master to all devices via ESPNow.')) {
|
||||||
|
alert('Syncing presets to all devices...\n(In real implementation, this would send all presets via ESPNow to all devices)');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setAllNValues(value) {
|
||||||
|
for (let i = 1; i <= 8; i++) {
|
||||||
|
document.getElementById(`n${i}`).value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyNValuesFromCurrent() {
|
||||||
|
// In real implementation, this would copy from current device settings
|
||||||
|
alert('Copying N values from current device settings...\n(In real implementation, this would load current N1-N8 values from the active device)');
|
||||||
|
// Example: would set values like this:
|
||||||
|
// document.getElementById('n1').value = currentSettings.n1;
|
||||||
|
// ... etc
|
||||||
|
}
|
||||||
|
|
||||||
|
function showNValueHelp() {
|
||||||
|
const helpText = `
|
||||||
|
Pattern Parameter Guide:
|
||||||
|
|
||||||
|
Rainbow:
|
||||||
|
N1: Step increment (1-255, default: 1)
|
||||||
|
|
||||||
|
Pulse:
|
||||||
|
N1: Attack time in ms (0-255)
|
||||||
|
N2: Hold time in ms (0-255)
|
||||||
|
N3: Decay time in ms (0-255)
|
||||||
|
|
||||||
|
Chase:
|
||||||
|
N1: LEDs of color 0 (1-255)
|
||||||
|
N2: LEDs of color 1 (1-255)
|
||||||
|
N3: Step movement on odd steps (can be negative)
|
||||||
|
N4: Step movement on even steps (can be negative)
|
||||||
|
|
||||||
|
Circle:
|
||||||
|
N1: Head moves per second (1-255)
|
||||||
|
N2: Max length in LEDs (1-255)
|
||||||
|
N3: Tail moves per second (1-255)
|
||||||
|
N4: Min length in LEDs (0-255)
|
||||||
|
|
||||||
|
Other patterns:
|
||||||
|
N1-N8: Reserved for future pattern enhancements
|
||||||
|
|
||||||
|
All values range from 0-255 unless otherwise specified.
|
||||||
|
`;
|
||||||
|
alert(helpText);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Form submission
|
||||||
|
document.getElementById('preset-form').addEventListener('submit', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
const name = document.getElementById('preset-name').value;
|
||||||
|
const action = editingPreset ? 'updated' : 'created';
|
||||||
|
alert(`Preset "${name}" ${action}!\n(In real implementation, this would save the preset to storage)`);
|
||||||
|
closeModal();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Close modal on outside click
|
||||||
|
document.getElementById('preset-modal').addEventListener('click', function(e) {
|
||||||
|
if (e.target === this) {
|
||||||
|
closeModal();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<script src="color-picker.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
@@ -0,0 +1,491 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>LED Driver - Settings</title>
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
||||||
|
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
||||||
|
min-height: 100vh;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
max-width: 1000px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
background: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 24px;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.header h1 {
|
||||||
|
color: #667eea;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header p {
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card {
|
||||||
|
background: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 24px;
|
||||||
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card h2 {
|
||||||
|
color: #667eea;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
border-bottom: 2px solid #e0e0e0;
|
||||||
|
padding-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group {
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group label {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group input[type="text"],
|
||||||
|
.form-group input[type="number"],
|
||||||
|
.form-group input[type="password"],
|
||||||
|
.form-group select {
|
||||||
|
width: 100%;
|
||||||
|
padding: 12px;
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 1rem;
|
||||||
|
transition: border-color 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group input:focus,
|
||||||
|
.form-group select:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: #667eea;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group input[type="range"] {
|
||||||
|
width: 100%;
|
||||||
|
height: 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: #e0e0e0;
|
||||||
|
outline: none;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group input[type="range"]::-webkit-slider-thumb {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
appearance: none;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #667eea;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group input[type="range"]::-moz-range-thumb {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #667eea;
|
||||||
|
cursor: pointer;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.value-display {
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #667eea;
|
||||||
|
min-width: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group small {
|
||||||
|
display: block;
|
||||||
|
margin-top: 4px;
|
||||||
|
color: #666;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-group {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkbox-group input[type="checkbox"] {
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-order {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-order-option {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 120px;
|
||||||
|
padding: 12px;
|
||||||
|
border: 2px solid #e0e0e0;
|
||||||
|
border-radius: 8px;
|
||||||
|
text-align: center;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-order-option:hover {
|
||||||
|
border-color: #667eea;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-order-option.selected {
|
||||||
|
border-color: #667eea;
|
||||||
|
background: #667eea;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-order-option .color-boxes {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 4px;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-box {
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-box.r { background: #ff0000; }
|
||||||
|
.color-box.g { background: #00ff00; }
|
||||||
|
.color-box.b { background: #0000ff; }
|
||||||
|
|
||||||
|
.actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
margin-top: 32px;
|
||||||
|
padding-top: 24px;
|
||||||
|
border-top: 2px solid #e0e0e0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
padding: 12px 24px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background: #667eea;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover {
|
||||||
|
background: #5568d3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary {
|
||||||
|
background: #e0e0e0;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary:hover {
|
||||||
|
background: #d0d0d0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-danger {
|
||||||
|
background: #f44336;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-danger:hover {
|
||||||
|
background: #d32f2f;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-full {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-divider {
|
||||||
|
height: 1px;
|
||||||
|
background: #e0e0e0;
|
||||||
|
margin: 24px 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<div class="header">
|
||||||
|
<h1>Device Settings</h1>
|
||||||
|
<p>Configure your LED driver device settings</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Basic Settings -->
|
||||||
|
<div class="card">
|
||||||
|
<h2>Basic Settings</h2>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Device Name</label>
|
||||||
|
<input type="text" id="device-name" value="led-device1" placeholder="led-device1">
|
||||||
|
<small>Unique identifier for this device</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>LED Pin</label>
|
||||||
|
<input type="number" id="led-pin" value="10" min="0" max="40">
|
||||||
|
<small>GPIO pin number connected to LED data line</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Number of LEDs</label>
|
||||||
|
<input type="number" id="num-leds" value="50" min="1" max="1000">
|
||||||
|
<small>Total number of LEDs in your strip</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Color Order</label>
|
||||||
|
<div class="color-order">
|
||||||
|
<div class="color-order-option selected" data-order="rgb">
|
||||||
|
RGB
|
||||||
|
<div class="color-boxes">
|
||||||
|
<div class="color-box r"></div>
|
||||||
|
<div class="color-box g"></div>
|
||||||
|
<div class="color-box b"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="color-order-option" data-order="rbg">
|
||||||
|
RBG
|
||||||
|
<div class="color-boxes">
|
||||||
|
<div class="color-box r"></div>
|
||||||
|
<div class="color-box b"></div>
|
||||||
|
<div class="color-box g"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="color-order-option" data-order="grb">
|
||||||
|
GRB
|
||||||
|
<div class="color-boxes">
|
||||||
|
<div class="color-box g"></div>
|
||||||
|
<div class="color-box r"></div>
|
||||||
|
<div class="color-box b"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="color-order-option" data-order="gbr">
|
||||||
|
GBR
|
||||||
|
<div class="color-boxes">
|
||||||
|
<div class="color-box g"></div>
|
||||||
|
<div class="color-box b"></div>
|
||||||
|
<div class="color-box r"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="color-order-option" data-order="brg">
|
||||||
|
BRG
|
||||||
|
<div class="color-boxes">
|
||||||
|
<div class="color-box b"></div>
|
||||||
|
<div class="color-box r"></div>
|
||||||
|
<div class="color-box g"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="color-order-option" data-order="bgr">
|
||||||
|
BGR
|
||||||
|
<div class="color-boxes">
|
||||||
|
<div class="color-box b"></div>
|
||||||
|
<div class="color-box g"></div>
|
||||||
|
<div class="color-box r"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Pattern Settings -->
|
||||||
|
<div class="card">
|
||||||
|
<h2>Pattern Settings</h2>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Pattern</label>
|
||||||
|
<select id="pattern">
|
||||||
|
<option value="on">On</option>
|
||||||
|
<option value="off">Off</option>
|
||||||
|
<option value="blink">Blink</option>
|
||||||
|
<option value="chase">Chase</option>
|
||||||
|
<option value="circle">Circle</option>
|
||||||
|
<option value="pulse">Pulse</option>
|
||||||
|
<option value="rainbow">Rainbow</option>
|
||||||
|
<option value="transition">Transition</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>
|
||||||
|
Brightness
|
||||||
|
<span class="value-display" id="brightness-value">100</span>%
|
||||||
|
</label>
|
||||||
|
<input type="range" id="brightness" min="0" max="100" value="100">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>
|
||||||
|
Delay
|
||||||
|
<span class="value-display" id="delay-value">100</span>ms
|
||||||
|
</label>
|
||||||
|
<input type="range" id="delay" min="10" max="1000" value="100" step="10">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Advanced Settings -->
|
||||||
|
<div class="card">
|
||||||
|
<h2>Advanced Settings</h2>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Step Counter</label>
|
||||||
|
<input type="text" id="step-counter" value="0" readonly style="background: #f5f5f5; cursor: not-allowed;">
|
||||||
|
<small>Current step position in pattern (read-only)</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="step-increment">
|
||||||
|
Step Increment
|
||||||
|
</label>
|
||||||
|
<input type="number" id="step-increment" value="1" min="1" max="255">
|
||||||
|
<small>Amount step counter increments per cycle. Controls pattern advancement speed.</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Pattern Parameters</label>
|
||||||
|
<div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;">
|
||||||
|
<div>
|
||||||
|
<label style="font-size: 0.875rem;">N1</label>
|
||||||
|
<input type="number" id="n1" value="0" min="0" max="255">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label style="font-size: 0.875rem;">N2</label>
|
||||||
|
<input type="number" id="n2" value="0" min="0" max="255">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label style="font-size: 0.875rem;">N3</label>
|
||||||
|
<input type="number" id="n3" value="0" min="0" max="255">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label style="font-size: 0.875rem;">N4</label>
|
||||||
|
<input type="number" id="n4" value="0" min="0" max="255">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label style="font-size: 0.875rem;">N5</label>
|
||||||
|
<input type="number" id="n5" value="0" min="0" max="255">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label style="font-size: 0.875rem;">N6</label>
|
||||||
|
<input type="number" id="n6" value="0" min="0" max="255">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<small>Pattern-specific parameters (varies by pattern)</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Device ID</label>
|
||||||
|
<input type="number" id="device-id" value="1" min="0">
|
||||||
|
<small>Unique numeric identifier</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="checkbox-group">
|
||||||
|
<input type="checkbox" id="debug" checked>
|
||||||
|
<label for="debug" style="margin: 0;">Debug Mode</label>
|
||||||
|
</div>
|
||||||
|
<small>Enable debug logging</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Network Settings -->
|
||||||
|
<div class="card">
|
||||||
|
<h2>Network Settings</h2>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Access Point Name</label>
|
||||||
|
<input type="text" id="ap-name" value="led-AA:BB:CC:DD:EE:01" placeholder="led-device">
|
||||||
|
<small>WiFi access point name for device configuration</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Access Point Password</label>
|
||||||
|
<input type="password" id="ap-password" placeholder="Leave empty for open network">
|
||||||
|
<small>Password for the access point (optional)</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="checkbox-group">
|
||||||
|
<input type="checkbox" id="ap-enabled" checked>
|
||||||
|
<label for="ap-enabled" style="margin: 0;">Enable Access Point</label>
|
||||||
|
</div>
|
||||||
|
<small>Allow device to create its own WiFi network</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Actions -->
|
||||||
|
<div class="card">
|
||||||
|
<div class="actions">
|
||||||
|
<button class="btn btn-secondary btn-full" onclick="resetSettings()">Reset to Defaults</button>
|
||||||
|
<button class="btn btn-primary btn-full" onclick="saveSettings()">Save Settings</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// Brightness slider
|
||||||
|
document.getElementById('brightness').addEventListener('input', function(e) {
|
||||||
|
document.getElementById('brightness-value').textContent = e.target.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Delay slider
|
||||||
|
document.getElementById('delay').addEventListener('input', function(e) {
|
||||||
|
document.getElementById('delay-value').textContent = e.target.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Color order selection
|
||||||
|
document.querySelectorAll('.color-order-option').forEach(option => {
|
||||||
|
option.addEventListener('click', function() {
|
||||||
|
document.querySelectorAll('.color-order-option').forEach(o => o.classList.remove('selected'));
|
||||||
|
this.classList.add('selected');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function saveSettings() {
|
||||||
|
alert('Settings saved! (This is a mockup)');
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetSettings() {
|
||||||
|
if (confirm('Reset all settings to defaults?')) {
|
||||||
|
alert('Settings reset! (This is a mockup)');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"grps": [
|
||||||
|
{
|
||||||
|
"n": "group1",
|
||||||
|
"pt": "on",
|
||||||
|
"cl": [
|
||||||
|
"000000",
|
||||||
|
"000000"
|
||||||
|
],
|
||||||
|
"br": 100,
|
||||||
|
"dl": 100,
|
||||||
|
"n1": 0,
|
||||||
|
"n2": 0,
|
||||||
|
"n3": 0,
|
||||||
|
"n4": 0,
|
||||||
|
"n5": 0,
|
||||||
|
"n6": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"n": "group2",
|
||||||
|
"pt": "on",
|
||||||
|
"cl": [
|
||||||
|
"000000",
|
||||||
|
"000000"
|
||||||
|
],
|
||||||
|
"br": 100,
|
||||||
|
"dl": 100
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
from microdot.microdot import Microdot, Request, Response, abort, redirect, \
|
||||||
|
send_file # noqa: F401
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
try:
|
||||||
|
from functools import wraps
|
||||||
|
except ImportError: # pragma: no cover
|
||||||
|
# MicroPython does not currently implement functools.wraps
|
||||||
|
def wraps(wrapped):
|
||||||
|
def _(wrapper):
|
||||||
|
return wrapper
|
||||||
|
return _
|
||||||
@@ -0,0 +1,159 @@
|
|||||||
|
import jwt
|
||||||
|
from microdot.microdot import invoke_handler
|
||||||
|
from microdot.helpers import wraps
|
||||||
|
|
||||||
|
|
||||||
|
class SessionDict(dict):
|
||||||
|
"""A session dictionary.
|
||||||
|
|
||||||
|
The session dictionary is a standard Python dictionary that has been
|
||||||
|
extended with convenience ``save()`` and ``delete()`` methods.
|
||||||
|
"""
|
||||||
|
def __init__(self, request, session_dict):
|
||||||
|
super().__init__(session_dict)
|
||||||
|
self.request = request
|
||||||
|
|
||||||
|
def save(self):
|
||||||
|
"""Update the session cookie."""
|
||||||
|
self.request.app._session.update(self.request, self)
|
||||||
|
|
||||||
|
def delete(self):
|
||||||
|
"""Delete the session cookie."""
|
||||||
|
self.request.app._session.delete(self.request)
|
||||||
|
|
||||||
|
|
||||||
|
class Session:
|
||||||
|
"""Session handling
|
||||||
|
|
||||||
|
:param app: The application instance.
|
||||||
|
:param secret_key: The secret key, as a string or bytes object.
|
||||||
|
:param cookie_options: A dictionary with cookie options to pass as
|
||||||
|
arguments to :meth:`Response.set_cookie()
|
||||||
|
<microdot.Response.set_cookie>`.
|
||||||
|
"""
|
||||||
|
secret_key = None
|
||||||
|
|
||||||
|
def __init__(self, app=None, secret_key=None, cookie_options=None):
|
||||||
|
self.secret_key = secret_key
|
||||||
|
self.cookie_options = cookie_options or {}
|
||||||
|
if app is not None:
|
||||||
|
self.initialize(app)
|
||||||
|
|
||||||
|
def initialize(self, app, secret_key=None, cookie_options=None):
|
||||||
|
if secret_key is not None:
|
||||||
|
self.secret_key = secret_key
|
||||||
|
if cookie_options is not None:
|
||||||
|
self.cookie_options = cookie_options
|
||||||
|
if 'path' not in self.cookie_options:
|
||||||
|
self.cookie_options['path'] = '/'
|
||||||
|
if 'http_only' not in self.cookie_options:
|
||||||
|
self.cookie_options['http_only'] = True
|
||||||
|
app._session = self
|
||||||
|
|
||||||
|
def get(self, request):
|
||||||
|
"""Retrieve the user session.
|
||||||
|
|
||||||
|
:param request: The client request.
|
||||||
|
|
||||||
|
The return value is a session dictionary with the data stored in the
|
||||||
|
user's session, or ``{}`` if the session data is not available or
|
||||||
|
invalid.
|
||||||
|
"""
|
||||||
|
if not self.secret_key:
|
||||||
|
raise ValueError('The session secret key is not configured')
|
||||||
|
if hasattr(request.g, '_session'):
|
||||||
|
return request.g._session
|
||||||
|
session = request.cookies.get('session')
|
||||||
|
if session is None:
|
||||||
|
request.g._session = SessionDict(request, {})
|
||||||
|
return request.g._session
|
||||||
|
request.g._session = SessionDict(request, self.decode(session))
|
||||||
|
return request.g._session
|
||||||
|
|
||||||
|
def update(self, request, session):
|
||||||
|
"""Update the user session.
|
||||||
|
|
||||||
|
:param request: The client request.
|
||||||
|
:param session: A dictionary with the update session data for the user.
|
||||||
|
|
||||||
|
Applications would normally not call this method directly, instead they
|
||||||
|
would use the :meth:`SessionDict.save` method on the session
|
||||||
|
dictionary, which calls this method. For example::
|
||||||
|
|
||||||
|
@app.route('/')
|
||||||
|
@with_session
|
||||||
|
def index(request, session):
|
||||||
|
session['foo'] = 'bar'
|
||||||
|
session.save()
|
||||||
|
return 'Hello, World!'
|
||||||
|
|
||||||
|
Calling this method adds a cookie with the updated session to the
|
||||||
|
request currently being processed.
|
||||||
|
"""
|
||||||
|
if not self.secret_key:
|
||||||
|
raise ValueError('The session secret key is not configured')
|
||||||
|
|
||||||
|
encoded_session = self.encode(session)
|
||||||
|
|
||||||
|
@request.after_request
|
||||||
|
def _update_session(request, response):
|
||||||
|
response.set_cookie('session', encoded_session,
|
||||||
|
**self.cookie_options)
|
||||||
|
return response
|
||||||
|
|
||||||
|
def delete(self, request):
|
||||||
|
"""Remove the user session.
|
||||||
|
|
||||||
|
:param request: The client request.
|
||||||
|
|
||||||
|
Applications would normally not call this method directly, instead they
|
||||||
|
would use the :meth:`SessionDict.delete` method on the session
|
||||||
|
dictionary, which calls this method. For example::
|
||||||
|
|
||||||
|
@app.route('/')
|
||||||
|
@with_session
|
||||||
|
def index(request, session):
|
||||||
|
session.delete()
|
||||||
|
return 'Hello, World!'
|
||||||
|
|
||||||
|
Calling this method adds a cookie removal header to the request
|
||||||
|
currently being processed.
|
||||||
|
"""
|
||||||
|
@request.after_request
|
||||||
|
def _delete_session(request, response):
|
||||||
|
response.delete_cookie('session', **self.cookie_options)
|
||||||
|
return response
|
||||||
|
|
||||||
|
def encode(self, payload, secret_key=None):
|
||||||
|
return jwt.encode(payload, secret_key or self.secret_key,
|
||||||
|
algorithm='HS256')
|
||||||
|
|
||||||
|
def decode(self, session, secret_key=None):
|
||||||
|
try:
|
||||||
|
payload = jwt.decode(session, secret_key or self.secret_key,
|
||||||
|
algorithms=['HS256'])
|
||||||
|
except jwt.exceptions.PyJWTError: # pragma: no cover
|
||||||
|
return {}
|
||||||
|
return payload
|
||||||
|
|
||||||
|
|
||||||
|
def with_session(f):
|
||||||
|
"""Decorator that passes the user session to the route handler.
|
||||||
|
|
||||||
|
The session dictionary is passed to the decorated function as an argument
|
||||||
|
after the request object. Example::
|
||||||
|
|
||||||
|
@app.route('/')
|
||||||
|
@with_session
|
||||||
|
def index(request, session):
|
||||||
|
return 'Hello, World!'
|
||||||
|
|
||||||
|
Note that the decorator does not save the session. To update the session,
|
||||||
|
call the :func:`session.save() <microdot.session.SessionDict.save>` method.
|
||||||
|
"""
|
||||||
|
@wraps(f)
|
||||||
|
async def wrapper(request, *args, **kwargs):
|
||||||
|
return await invoke_handler(
|
||||||
|
f, request, request.app._session.get(request), *args, **kwargs)
|
||||||
|
|
||||||
|
return wrapper
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
from utemplate import recompile
|
||||||
|
|
||||||
|
_loader = None
|
||||||
|
|
||||||
|
|
||||||
|
class Template:
|
||||||
|
"""A template object.
|
||||||
|
|
||||||
|
:param template: The filename of the template to render, relative to the
|
||||||
|
configured template directory.
|
||||||
|
"""
|
||||||
|
@classmethod
|
||||||
|
def initialize(cls, template_dir='templates',
|
||||||
|
loader_class=recompile.Loader):
|
||||||
|
"""Initialize the templating subsystem.
|
||||||
|
|
||||||
|
:param template_dir: the directory where templates are stored. This
|
||||||
|
argument is optional. The default is to load
|
||||||
|
templates from a *templates* subdirectory.
|
||||||
|
:param loader_class: the ``utemplate.Loader`` class to use when loading
|
||||||
|
templates. This argument is optional. The default
|
||||||
|
is the ``recompile.Loader`` class, which
|
||||||
|
automatically recompiles templates when they
|
||||||
|
change.
|
||||||
|
"""
|
||||||
|
global _loader
|
||||||
|
_loader = loader_class(None, template_dir)
|
||||||
|
|
||||||
|
def __init__(self, template):
|
||||||
|
if _loader is None: # pragma: no cover
|
||||||
|
self.initialize()
|
||||||
|
#: The name of the template
|
||||||
|
self.name = template
|
||||||
|
self.template = _loader.load(template)
|
||||||
|
|
||||||
|
def generate(self, *args, **kwargs):
|
||||||
|
"""Return a generator that renders the template in chunks, with the
|
||||||
|
given arguments."""
|
||||||
|
return self.template(*args, **kwargs)
|
||||||
|
|
||||||
|
def render(self, *args, **kwargs):
|
||||||
|
"""Render the template with the given arguments and return it as a
|
||||||
|
string."""
|
||||||
|
return ''.join(self.generate(*args, **kwargs))
|
||||||
|
|
||||||
|
def generate_async(self, *args, **kwargs):
|
||||||
|
"""Return an asynchronous generator that renders the template in
|
||||||
|
chunks, using the given arguments."""
|
||||||
|
class sync_to_async_iter():
|
||||||
|
def __init__(self, iter):
|
||||||
|
self.iter = iter
|
||||||
|
|
||||||
|
def __aiter__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
async def __anext__(self):
|
||||||
|
try:
|
||||||
|
return next(self.iter)
|
||||||
|
except StopIteration:
|
||||||
|
raise StopAsyncIteration
|
||||||
|
|
||||||
|
return sync_to_async_iter(self.generate(*args, **kwargs))
|
||||||
|
|
||||||
|
async def render_async(self, *args, **kwargs):
|
||||||
|
"""Render the template with the given arguments asynchronously and
|
||||||
|
return it as a string."""
|
||||||
|
response = ''
|
||||||
|
async for chunk in self.generate_async(*args, **kwargs):
|
||||||
|
response += chunk
|
||||||
|
return response
|
||||||
@@ -0,0 +1,231 @@
|
|||||||
|
import binascii
|
||||||
|
import hashlib
|
||||||
|
from microdot import Request, Response
|
||||||
|
from microdot.microdot import MUTED_SOCKET_ERRORS, print_exception
|
||||||
|
from microdot.helpers import wraps
|
||||||
|
|
||||||
|
|
||||||
|
class WebSocketError(Exception):
|
||||||
|
"""Exception raised when an error occurs in a WebSocket connection."""
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class WebSocket:
|
||||||
|
"""A WebSocket connection object.
|
||||||
|
|
||||||
|
An instance of this class is sent to handler functions to manage the
|
||||||
|
WebSocket connection.
|
||||||
|
"""
|
||||||
|
CONT = 0
|
||||||
|
TEXT = 1
|
||||||
|
BINARY = 2
|
||||||
|
CLOSE = 8
|
||||||
|
PING = 9
|
||||||
|
PONG = 10
|
||||||
|
|
||||||
|
#: Specify the maximum message size that can be received when calling the
|
||||||
|
#: ``receive()`` method. Messages with payloads that are larger than this
|
||||||
|
#: size will be rejected and the connection closed. Set to 0 to disable
|
||||||
|
#: the size check (be aware of potential security issues if you do this),
|
||||||
|
#: or to -1 to use the value set in
|
||||||
|
#: ``Request.max_body_length``. The default is -1.
|
||||||
|
#:
|
||||||
|
#: Example::
|
||||||
|
#:
|
||||||
|
#: WebSocket.max_message_length = 4 * 1024 # up to 4KB messages
|
||||||
|
max_message_length = -1
|
||||||
|
|
||||||
|
def __init__(self, request):
|
||||||
|
self.request = request
|
||||||
|
self.closed = False
|
||||||
|
|
||||||
|
async def handshake(self):
|
||||||
|
response = self._handshake_response()
|
||||||
|
await self.request.sock[1].awrite(
|
||||||
|
b'HTTP/1.1 101 Switching Protocols\r\n')
|
||||||
|
await self.request.sock[1].awrite(b'Upgrade: websocket\r\n')
|
||||||
|
await self.request.sock[1].awrite(b'Connection: Upgrade\r\n')
|
||||||
|
await self.request.sock[1].awrite(
|
||||||
|
b'Sec-WebSocket-Accept: ' + response + b'\r\n\r\n')
|
||||||
|
|
||||||
|
async def receive(self):
|
||||||
|
"""Receive a message from the client."""
|
||||||
|
while True:
|
||||||
|
opcode, payload = await self._read_frame()
|
||||||
|
send_opcode, data = self._process_websocket_frame(opcode, payload)
|
||||||
|
if send_opcode: # pragma: no cover
|
||||||
|
await self.send(data, send_opcode)
|
||||||
|
elif data: # pragma: no branch
|
||||||
|
return data
|
||||||
|
|
||||||
|
async def send(self, data, opcode=None):
|
||||||
|
"""Send a message to the client.
|
||||||
|
|
||||||
|
:param data: the data to send, given as a string or bytes.
|
||||||
|
:param opcode: a custom frame opcode to use. If not given, the opcode
|
||||||
|
is ``TEXT`` or ``BINARY`` depending on the type of the
|
||||||
|
data.
|
||||||
|
"""
|
||||||
|
frame = self._encode_websocket_frame(
|
||||||
|
opcode or (self.TEXT if isinstance(data, str) else self.BINARY),
|
||||||
|
data)
|
||||||
|
await self.request.sock[1].awrite(frame)
|
||||||
|
|
||||||
|
async def close(self):
|
||||||
|
"""Close the websocket connection."""
|
||||||
|
if not self.closed: # pragma: no cover
|
||||||
|
self.closed = True
|
||||||
|
await self.send(b'', self.CLOSE)
|
||||||
|
|
||||||
|
def _handshake_response(self):
|
||||||
|
connection = False
|
||||||
|
upgrade = False
|
||||||
|
websocket_key = None
|
||||||
|
for header, value in self.request.headers.items():
|
||||||
|
h = header.lower()
|
||||||
|
if h == 'connection':
|
||||||
|
connection = True
|
||||||
|
if 'upgrade' not in value.lower():
|
||||||
|
return self.request.app.abort(400)
|
||||||
|
elif h == 'upgrade':
|
||||||
|
upgrade = True
|
||||||
|
if not value.lower() == 'websocket':
|
||||||
|
return self.request.app.abort(400)
|
||||||
|
elif h == 'sec-websocket-key':
|
||||||
|
websocket_key = value
|
||||||
|
if not connection or not upgrade or not websocket_key:
|
||||||
|
return self.request.app.abort(400)
|
||||||
|
d = hashlib.sha1(websocket_key.encode())
|
||||||
|
d.update(b'258EAFA5-E914-47DA-95CA-C5AB0DC85B11')
|
||||||
|
return binascii.b2a_base64(d.digest())[:-1]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _parse_frame_header(cls, header):
|
||||||
|
fin = header[0] & 0x80
|
||||||
|
opcode = header[0] & 0x0f
|
||||||
|
if fin == 0 or opcode == cls.CONT: # pragma: no cover
|
||||||
|
raise WebSocketError('Continuation frames not supported')
|
||||||
|
has_mask = header[1] & 0x80
|
||||||
|
length = header[1] & 0x7f
|
||||||
|
if length == 126:
|
||||||
|
length = -2
|
||||||
|
elif length == 127:
|
||||||
|
length = -8
|
||||||
|
return fin, opcode, has_mask, length
|
||||||
|
|
||||||
|
def _process_websocket_frame(self, opcode, payload):
|
||||||
|
if opcode == self.TEXT:
|
||||||
|
payload = payload.decode()
|
||||||
|
elif opcode == self.BINARY:
|
||||||
|
pass
|
||||||
|
elif opcode == self.CLOSE:
|
||||||
|
raise WebSocketError('Websocket connection closed')
|
||||||
|
elif opcode == self.PING:
|
||||||
|
return self.PONG, payload
|
||||||
|
elif opcode == self.PONG: # pragma: no branch
|
||||||
|
return None, None
|
||||||
|
return None, payload
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _encode_websocket_frame(cls, opcode, payload):
|
||||||
|
frame = bytearray()
|
||||||
|
frame.append(0x80 | opcode)
|
||||||
|
if opcode == cls.TEXT:
|
||||||
|
payload = payload.encode()
|
||||||
|
if len(payload) < 126:
|
||||||
|
frame.append(len(payload))
|
||||||
|
elif len(payload) < (1 << 16):
|
||||||
|
frame.append(126)
|
||||||
|
frame.extend(len(payload).to_bytes(2, 'big'))
|
||||||
|
else:
|
||||||
|
frame.append(127)
|
||||||
|
frame.extend(len(payload).to_bytes(8, 'big'))
|
||||||
|
frame.extend(payload)
|
||||||
|
return frame
|
||||||
|
|
||||||
|
async def _read_frame(self):
|
||||||
|
header = await self.request.sock[0].read(2)
|
||||||
|
if len(header) != 2: # pragma: no cover
|
||||||
|
raise WebSocketError('Websocket connection closed')
|
||||||
|
fin, opcode, has_mask, length = self._parse_frame_header(header)
|
||||||
|
if length == -2:
|
||||||
|
length = await self.request.sock[0].read(2)
|
||||||
|
length = int.from_bytes(length, 'big')
|
||||||
|
elif length == -8:
|
||||||
|
length = await self.request.sock[0].read(8)
|
||||||
|
length = int.from_bytes(length, 'big')
|
||||||
|
max_allowed_length = Request.max_body_length \
|
||||||
|
if self.max_message_length == -1 else self.max_message_length
|
||||||
|
if length > max_allowed_length:
|
||||||
|
raise WebSocketError('Message too large')
|
||||||
|
if has_mask: # pragma: no cover
|
||||||
|
mask = await self.request.sock[0].read(4)
|
||||||
|
payload = await self.request.sock[0].read(length)
|
||||||
|
if has_mask: # pragma: no cover
|
||||||
|
payload = bytes(x ^ mask[i % 4] for i, x in enumerate(payload))
|
||||||
|
return opcode, payload
|
||||||
|
|
||||||
|
|
||||||
|
async def websocket_upgrade(request):
|
||||||
|
"""Upgrade a request handler to a websocket connection.
|
||||||
|
|
||||||
|
This function can be called directly inside a route function to process a
|
||||||
|
WebSocket upgrade handshake, for example after the user's credentials are
|
||||||
|
verified. The function returns the websocket object::
|
||||||
|
|
||||||
|
@app.route('/echo')
|
||||||
|
async def echo(request):
|
||||||
|
if not authenticate_user(request):
|
||||||
|
abort(401)
|
||||||
|
ws = await websocket_upgrade(request)
|
||||||
|
while True:
|
||||||
|
message = await ws.receive()
|
||||||
|
await ws.send(message)
|
||||||
|
"""
|
||||||
|
ws = WebSocket(request)
|
||||||
|
await ws.handshake()
|
||||||
|
|
||||||
|
@request.after_request
|
||||||
|
async def after_request(request, response):
|
||||||
|
return Response.already_handled
|
||||||
|
|
||||||
|
return ws
|
||||||
|
|
||||||
|
|
||||||
|
def websocket_wrapper(f, upgrade_function):
|
||||||
|
@wraps(f)
|
||||||
|
async def wrapper(request, *args, **kwargs):
|
||||||
|
ws = await upgrade_function(request)
|
||||||
|
try:
|
||||||
|
await f(request, ws, *args, **kwargs)
|
||||||
|
except OSError as exc:
|
||||||
|
if exc.errno not in MUTED_SOCKET_ERRORS: # pragma: no cover
|
||||||
|
raise
|
||||||
|
except WebSocketError:
|
||||||
|
pass
|
||||||
|
except Exception as exc:
|
||||||
|
print_exception(exc)
|
||||||
|
finally: # pragma: no cover
|
||||||
|
try:
|
||||||
|
await ws.close()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return Response.already_handled
|
||||||
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
|
def with_websocket(f):
|
||||||
|
"""Decorator to make a route a WebSocket endpoint.
|
||||||
|
|
||||||
|
This decorator is used to define a route that accepts websocket
|
||||||
|
connections. The route then receives a websocket object as a second
|
||||||
|
argument that it can use to send and receive messages::
|
||||||
|
|
||||||
|
@app.route('/echo')
|
||||||
|
@with_websocket
|
||||||
|
async def echo(request, ws):
|
||||||
|
while True:
|
||||||
|
message = await ws.receive()
|
||||||
|
await ws.send(message)
|
||||||
|
"""
|
||||||
|
return websocket_wrapper(f, websocket_upgrade)
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
class Loader:
|
||||||
|
|
||||||
|
def __init__(self, pkg, dir):
|
||||||
|
if dir == ".":
|
||||||
|
dir = ""
|
||||||
|
else:
|
||||||
|
dir = dir.replace("/", ".") + "."
|
||||||
|
if pkg and pkg != "__main__":
|
||||||
|
dir = pkg + "." + dir
|
||||||
|
self.p = dir
|
||||||
|
|
||||||
|
def load(self, name):
|
||||||
|
name = name.replace(".", "_")
|
||||||
|
return __import__(self.p + name, None, None, (name,)).render
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
# (c) 2014-2020 Paul Sokolovsky. MIT license.
|
||||||
|
try:
|
||||||
|
from uos import stat, remove
|
||||||
|
except:
|
||||||
|
from os import stat, remove
|
||||||
|
from . import source
|
||||||
|
|
||||||
|
|
||||||
|
class Loader(source.Loader):
|
||||||
|
|
||||||
|
def load(self, name):
|
||||||
|
o_path = self.pkg_path + self.compiled_path(name)
|
||||||
|
i_path = self.pkg_path + self.dir + "/" + name
|
||||||
|
try:
|
||||||
|
o_stat = stat(o_path)
|
||||||
|
i_stat = stat(i_path)
|
||||||
|
if i_stat[8] > o_stat[8]:
|
||||||
|
# input file is newer, remove output to force recompile
|
||||||
|
remove(o_path)
|
||||||
|
finally:
|
||||||
|
return super().load(name)
|
||||||
@@ -0,0 +1,188 @@
|
|||||||
|
# (c) 2014-2019 Paul Sokolovsky. MIT license.
|
||||||
|
from . import compiled
|
||||||
|
|
||||||
|
|
||||||
|
class Compiler:
|
||||||
|
|
||||||
|
START_CHAR = "{"
|
||||||
|
STMNT = "%"
|
||||||
|
STMNT_END = "%}"
|
||||||
|
EXPR = "{"
|
||||||
|
EXPR_END = "}}"
|
||||||
|
|
||||||
|
def __init__(self, file_in, file_out, indent=0, seq=0, loader=None):
|
||||||
|
self.file_in = file_in
|
||||||
|
self.file_out = file_out
|
||||||
|
self.loader = loader
|
||||||
|
self.seq = seq
|
||||||
|
self._indent = indent
|
||||||
|
self.stack = []
|
||||||
|
self.in_literal = False
|
||||||
|
self.flushed_header = False
|
||||||
|
self.args = "*a, **d"
|
||||||
|
|
||||||
|
def indent(self, adjust=0):
|
||||||
|
if not self.flushed_header:
|
||||||
|
self.flushed_header = True
|
||||||
|
self.indent()
|
||||||
|
self.file_out.write("def render%s(%s):\n" % (str(self.seq) if self.seq else "", self.args))
|
||||||
|
self.stack.append("def")
|
||||||
|
self.file_out.write(" " * (len(self.stack) + self._indent + adjust))
|
||||||
|
|
||||||
|
def literal(self, s):
|
||||||
|
if not s:
|
||||||
|
return
|
||||||
|
if not self.in_literal:
|
||||||
|
self.indent()
|
||||||
|
self.file_out.write('yield """')
|
||||||
|
self.in_literal = True
|
||||||
|
self.file_out.write(s.replace('"', '\\"'))
|
||||||
|
|
||||||
|
def close_literal(self):
|
||||||
|
if self.in_literal:
|
||||||
|
self.file_out.write('"""\n')
|
||||||
|
self.in_literal = False
|
||||||
|
|
||||||
|
def render_expr(self, e):
|
||||||
|
self.indent()
|
||||||
|
self.file_out.write('yield str(' + e + ')\n')
|
||||||
|
|
||||||
|
def parse_statement(self, stmt):
|
||||||
|
tokens = stmt.split(None, 1)
|
||||||
|
if tokens[0] == "args":
|
||||||
|
if len(tokens) > 1:
|
||||||
|
self.args = tokens[1]
|
||||||
|
else:
|
||||||
|
self.args = ""
|
||||||
|
elif tokens[0] == "set":
|
||||||
|
self.indent()
|
||||||
|
self.file_out.write(stmt[3:].strip() + "\n")
|
||||||
|
elif tokens[0] == "include":
|
||||||
|
if not self.flushed_header:
|
||||||
|
# If there was no other output, we still need a header now
|
||||||
|
self.indent()
|
||||||
|
tokens = tokens[1].split(None, 1)
|
||||||
|
args = ""
|
||||||
|
if len(tokens) > 1:
|
||||||
|
args = tokens[1]
|
||||||
|
if tokens[0][0] == "{":
|
||||||
|
self.indent()
|
||||||
|
# "1" as fromlist param is uPy hack
|
||||||
|
self.file_out.write('_ = __import__(%s.replace(".", "_"), None, None, 1)\n' % tokens[0][2:-2])
|
||||||
|
self.indent()
|
||||||
|
self.file_out.write("yield from _.render(%s)\n" % args)
|
||||||
|
return
|
||||||
|
|
||||||
|
with self.loader.input_open(tokens[0][1:-1]) as inc:
|
||||||
|
self.seq += 1
|
||||||
|
c = Compiler(inc, self.file_out, len(self.stack) + self._indent, self.seq)
|
||||||
|
inc_id = self.seq
|
||||||
|
self.seq = c.compile()
|
||||||
|
self.indent()
|
||||||
|
self.file_out.write("yield from render%d(%s)\n" % (inc_id, args))
|
||||||
|
elif len(tokens) > 1:
|
||||||
|
if tokens[0] == "elif":
|
||||||
|
assert self.stack[-1] == "if"
|
||||||
|
self.indent(-1)
|
||||||
|
self.file_out.write(stmt + ":\n")
|
||||||
|
else:
|
||||||
|
self.indent()
|
||||||
|
self.file_out.write(stmt + ":\n")
|
||||||
|
self.stack.append(tokens[0])
|
||||||
|
else:
|
||||||
|
if stmt.startswith("end"):
|
||||||
|
assert self.stack[-1] == stmt[3:]
|
||||||
|
self.stack.pop(-1)
|
||||||
|
elif stmt == "else":
|
||||||
|
assert self.stack[-1] == "if"
|
||||||
|
self.indent(-1)
|
||||||
|
self.file_out.write("else:\n")
|
||||||
|
else:
|
||||||
|
assert False
|
||||||
|
|
||||||
|
def parse_line(self, l):
|
||||||
|
while l:
|
||||||
|
start = l.find(self.START_CHAR)
|
||||||
|
if start == -1:
|
||||||
|
self.literal(l)
|
||||||
|
return
|
||||||
|
self.literal(l[:start])
|
||||||
|
self.close_literal()
|
||||||
|
sel = l[start + 1]
|
||||||
|
#print("*%s=%s=" % (sel, EXPR))
|
||||||
|
if sel == self.STMNT:
|
||||||
|
end = l.find(self.STMNT_END)
|
||||||
|
assert end > 0
|
||||||
|
stmt = l[start + len(self.START_CHAR + self.STMNT):end].strip()
|
||||||
|
self.parse_statement(stmt)
|
||||||
|
end += len(self.STMNT_END)
|
||||||
|
l = l[end:]
|
||||||
|
if not self.in_literal and l == "\n":
|
||||||
|
break
|
||||||
|
elif sel == self.EXPR:
|
||||||
|
# print("EXPR")
|
||||||
|
end = l.find(self.EXPR_END)
|
||||||
|
assert end > 0
|
||||||
|
expr = l[start + len(self.START_CHAR + self.EXPR):end].strip()
|
||||||
|
self.render_expr(expr)
|
||||||
|
end += len(self.EXPR_END)
|
||||||
|
l = l[end:]
|
||||||
|
else:
|
||||||
|
self.literal(l[start])
|
||||||
|
l = l[start + 1:]
|
||||||
|
|
||||||
|
def header(self):
|
||||||
|
self.file_out.write("# Autogenerated file\n")
|
||||||
|
|
||||||
|
def compile(self):
|
||||||
|
self.header()
|
||||||
|
for l in self.file_in:
|
||||||
|
self.parse_line(l)
|
||||||
|
self.close_literal()
|
||||||
|
return self.seq
|
||||||
|
|
||||||
|
|
||||||
|
class Loader(compiled.Loader):
|
||||||
|
|
||||||
|
def __init__(self, pkg, dir):
|
||||||
|
super().__init__(pkg, dir)
|
||||||
|
self.dir = dir
|
||||||
|
if pkg == "__main__":
|
||||||
|
# if pkg isn't really a package, don't bother to use it
|
||||||
|
# it means we're running from "filesystem directory", not
|
||||||
|
# from a package.
|
||||||
|
pkg = None
|
||||||
|
|
||||||
|
self.pkg_path = ""
|
||||||
|
if pkg:
|
||||||
|
p = __import__(pkg)
|
||||||
|
if isinstance(p.__path__, str):
|
||||||
|
# uPy
|
||||||
|
self.pkg_path = p.__path__
|
||||||
|
else:
|
||||||
|
# CPy
|
||||||
|
self.pkg_path = p.__path__[0]
|
||||||
|
self.pkg_path += "/"
|
||||||
|
|
||||||
|
def input_open(self, template):
|
||||||
|
path = self.pkg_path + self.dir + "/" + template
|
||||||
|
return open(path)
|
||||||
|
|
||||||
|
def compiled_path(self, template):
|
||||||
|
return self.dir + "/" + template.replace(".", "_") + ".py"
|
||||||
|
|
||||||
|
def load(self, name):
|
||||||
|
try:
|
||||||
|
return super().load(name)
|
||||||
|
except (OSError, ImportError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
compiled_path = self.pkg_path + self.compiled_path(name)
|
||||||
|
|
||||||
|
f_in = self.input_open(name)
|
||||||
|
f_out = open(compiled_path, "w")
|
||||||
|
c = Compiler(f_in, f_out, loader=self)
|
||||||
|
c.compile()
|
||||||
|
f_in.close()
|
||||||
|
f_out.close()
|
||||||
|
return super().load(name)
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
from fastapi import FastAPI, Request, HTTPException
|
|
||||||
from fastapi.responses import HTMLResponse
|
|
||||||
from fastapi.staticfiles import StaticFiles
|
|
||||||
from fastapi.templating import Jinja2Templates
|
|
||||||
from api.routes import router
|
|
||||||
import uvicorn
|
|
||||||
|
|
||||||
app = FastAPI(title="Bar Control System", version="1.0.0")
|
|
||||||
|
|
||||||
app.mount("/static", StaticFiles(directory="static"), name="static")
|
|
||||||
templates = Jinja2Templates(directory="templates")
|
|
||||||
|
|
||||||
app.include_router(router)
|
|
||||||
|
|
||||||
@app.get("/", response_class=HTMLResponse)
|
|
||||||
async def read_root(request: Request):
|
|
||||||
return templates.TemplateResponse("index.html", {"request": request})
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
uvicorn.run(app, host="0.0.0.0", port=8000, reload=True)
|
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Local development web server - imports and runs main.py with port 5000
|
||||||
|
"""
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import asyncio
|
||||||
|
|
||||||
|
# Add src and lib to path
|
||||||
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))
|
||||||
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'lib'))
|
||||||
|
|
||||||
|
# Import the main module
|
||||||
|
from src import main as main_module
|
||||||
|
|
||||||
|
# Override the port in the main function
|
||||||
|
async def run_local():
|
||||||
|
"""Run main with port 5000 for local development."""
|
||||||
|
from settings import Settings
|
||||||
|
import gc
|
||||||
|
|
||||||
|
# Mock MicroPython modules for local development
|
||||||
|
class MockMachine:
|
||||||
|
class WDT:
|
||||||
|
def __init__(self, timeout):
|
||||||
|
pass
|
||||||
|
def feed(self):
|
||||||
|
pass
|
||||||
|
import sys as sys_module
|
||||||
|
sys_module.modules['machine'] = MockMachine()
|
||||||
|
|
||||||
|
class MockESPNow:
|
||||||
|
def __init__(self):
|
||||||
|
self.active_value = False
|
||||||
|
self.peers = []
|
||||||
|
def active(self, value):
|
||||||
|
self.active_value = value
|
||||||
|
print(f"[MOCK] ESPNow active: {value}")
|
||||||
|
def add_peer(self, peer):
|
||||||
|
self.peers.append(peer)
|
||||||
|
print(f"[MOCK] Added peer: {peer.hex() if hasattr(peer, 'hex') else peer}")
|
||||||
|
async def asend(self, peer, data):
|
||||||
|
print(f"[MOCK] Would send to {peer.hex() if hasattr(peer, 'hex') else peer}: {data}")
|
||||||
|
|
||||||
|
class MockAIOESPNow:
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
def active(self, value):
|
||||||
|
return MockESPNow()
|
||||||
|
def add_peer(self, peer):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class MockNetwork:
|
||||||
|
class WLAN:
|
||||||
|
def __init__(self, interface):
|
||||||
|
self.interface = interface
|
||||||
|
def active(self, value):
|
||||||
|
print(f"[MOCK] WLAN({self.interface}) active: {value}")
|
||||||
|
STA_IF = 0
|
||||||
|
|
||||||
|
# Replace MicroPython modules with mocks
|
||||||
|
sys_module.modules['aioespnow'] = type('module', (), {'AIOESPNow': MockESPNow})()
|
||||||
|
sys_module.modules['network'] = MockNetwork()
|
||||||
|
|
||||||
|
# Mock gc if needed
|
||||||
|
if not hasattr(gc, 'collect'):
|
||||||
|
class MockGC:
|
||||||
|
def collect(self):
|
||||||
|
pass
|
||||||
|
gc = MockGC()
|
||||||
|
|
||||||
|
settings = Settings()
|
||||||
|
print("Starting LED Controller Web Server (Local Development)")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
# Mock network
|
||||||
|
import network
|
||||||
|
network.WLAN(network.STA_IF).active(True)
|
||||||
|
|
||||||
|
# Mock ESPNow
|
||||||
|
import aioespnow
|
||||||
|
e = aioespnow.AIOESPNow()
|
||||||
|
e.active(True)
|
||||||
|
e.add_peer(b"\xbb\xbb\xbb\xbb\xbb\xbb")
|
||||||
|
|
||||||
|
from microdot import Microdot, send_file
|
||||||
|
from microdot.websocket import with_websocket
|
||||||
|
|
||||||
|
import controllers.preset as preset
|
||||||
|
import controllers.profile as profile
|
||||||
|
import controllers.group as group
|
||||||
|
import controllers.sequence as sequence
|
||||||
|
import controllers.tab as tab
|
||||||
|
import controllers.palette as palette
|
||||||
|
import controllers.scene as scene
|
||||||
|
|
||||||
|
app = Microdot()
|
||||||
|
|
||||||
|
# Mount model controllers as subroutes
|
||||||
|
app.mount(preset.controller, '/presets')
|
||||||
|
app.mount(profile.controller, '/profiles')
|
||||||
|
app.mount(group.controller, '/groups')
|
||||||
|
app.mount(sequence.controller, '/sequences')
|
||||||
|
app.mount(tab.controller, '/tabs')
|
||||||
|
app.mount(palette.controller, '/palettes')
|
||||||
|
app.mount(scene.controller, '/scenes')
|
||||||
|
|
||||||
|
# Serve index.html at root
|
||||||
|
@app.route('/')
|
||||||
|
def index(request):
|
||||||
|
"""Serve the main web UI."""
|
||||||
|
return send_file('src/templates/index.html')
|
||||||
|
|
||||||
|
# Static file route
|
||||||
|
@app.route("/static/<path:path>")
|
||||||
|
def static_handler(request, path):
|
||||||
|
"""Serve static files."""
|
||||||
|
if '..' in path:
|
||||||
|
return 'Not found', 404
|
||||||
|
return send_file('src/static/' + path)
|
||||||
|
|
||||||
|
@app.route('/ws')
|
||||||
|
@with_websocket
|
||||||
|
async def ws(request, ws):
|
||||||
|
while True:
|
||||||
|
data = await ws.receive()
|
||||||
|
if data:
|
||||||
|
await e.asend(b"\xbb\xbb\xbb\xbb\xbb\xbb", data)
|
||||||
|
print(data)
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
|
||||||
|
# Use port 5000 for local development
|
||||||
|
port = 5000
|
||||||
|
print(f"Starting server on http://0.0.0.0:{port}")
|
||||||
|
print(f"Open http://localhost:{port} in your browser")
|
||||||
|
print("=" * 60)
|
||||||
|
|
||||||
|
try:
|
||||||
|
await app.start_server(host="0.0.0.0", port=port, debug=True)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("\nShutting down server...")
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
# Change to project root
|
||||||
|
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
# Override settings path for local development
|
||||||
|
import settings as settings_module
|
||||||
|
settings_module.Settings.SETTINGS_FILE = os.path.join(os.getcwd(), 'settings.json')
|
||||||
|
|
||||||
|
asyncio.run(run_local())
|
||||||
@@ -1,20 +1 @@
|
|||||||
{
|
{"session_secret_key": "06a2a6ac631cc8db0658373b37f7fe922a8a3ed3a27229e1adb5448cb368f2b7"}
|
||||||
"dj": {
|
|
||||||
"url": "ws://192.168.4.1/ws",
|
|
||||||
"color": "#1d011e",
|
|
||||||
"x": 614,
|
|
||||||
"y": 123
|
|
||||||
},
|
|
||||||
"bar2": {
|
|
||||||
"url": "ws://192.168.4.1/ws",
|
|
||||||
"color": "#3d0f00",
|
|
||||||
"x": 616,
|
|
||||||
"y": 330
|
|
||||||
},
|
|
||||||
"bar5": {
|
|
||||||
"url": "ws://192.168.4.1/ws",
|
|
||||||
"color": "#300d2a",
|
|
||||||
"x": 618,
|
|
||||||
"y": 567
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import settings
|
||||||
|
import util.wifi as wifi
|
||||||
|
from settings import Settings
|
||||||
|
|
||||||
|
s = Settings()
|
||||||
|
|
||||||
|
name = s.get('name', 'led-controller')
|
||||||
|
wifi.ap(name, '')
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
# Controllers package
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
from microdot import Microdot
|
||||||
|
from models.group import Group
|
||||||
|
import json
|
||||||
|
|
||||||
|
controller = Microdot()
|
||||||
|
groups = Group()
|
||||||
|
|
||||||
|
@controller.get('')
|
||||||
|
async def list_groups(request):
|
||||||
|
"""List all groups."""
|
||||||
|
return json.dumps(groups), 200, {'Content-Type': 'application/json'}
|
||||||
|
|
||||||
|
@controller.get('/<id>')
|
||||||
|
async def get_group(request, id):
|
||||||
|
"""Get a specific group by ID."""
|
||||||
|
group = groups.read(id)
|
||||||
|
if group:
|
||||||
|
return json.dumps(group), 200, {'Content-Type': 'application/json'}
|
||||||
|
return json.dumps({"error": "Group not found"}), 404
|
||||||
|
|
||||||
|
@controller.post('')
|
||||||
|
async def create_group(request):
|
||||||
|
"""Create a new group."""
|
||||||
|
try:
|
||||||
|
data = request.json or {}
|
||||||
|
name = data.get("name", "")
|
||||||
|
group_id = groups.create(name)
|
||||||
|
if data:
|
||||||
|
groups.update(group_id, data)
|
||||||
|
return json.dumps(groups.read(group_id)), 201, {'Content-Type': 'application/json'}
|
||||||
|
except Exception as e:
|
||||||
|
return json.dumps({"error": str(e)}), 400
|
||||||
|
|
||||||
|
@controller.put('/<id>')
|
||||||
|
async def update_group(request, id):
|
||||||
|
"""Update an existing group."""
|
||||||
|
try:
|
||||||
|
data = request.json
|
||||||
|
if groups.update(id, data):
|
||||||
|
return json.dumps(groups.read(id)), 200, {'Content-Type': 'application/json'}
|
||||||
|
return json.dumps({"error": "Group not found"}), 404
|
||||||
|
except Exception as e:
|
||||||
|
return json.dumps({"error": str(e)}), 400
|
||||||
|
|
||||||
|
@controller.delete('/<id>')
|
||||||
|
async def delete_group(request, id):
|
||||||
|
"""Delete a group."""
|
||||||
|
if groups.delete(id):
|
||||||
|
return json.dumps({"message": "Group deleted successfully"}), 200
|
||||||
|
return json.dumps({"error": "Group not found"}), 404
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
from microdot import Microdot
|
||||||
|
from models.pallet import Palette
|
||||||
|
import json
|
||||||
|
|
||||||
|
controller = Microdot()
|
||||||
|
palettes = Palette()
|
||||||
|
|
||||||
|
@controller.get('')
|
||||||
|
async def list_palettes(request):
|
||||||
|
"""List all palettes."""
|
||||||
|
return json.dumps(palettes), 200, {'Content-Type': 'application/json'}
|
||||||
|
|
||||||
|
@controller.get('/<id>')
|
||||||
|
async def get_palette(request, id):
|
||||||
|
"""Get a specific palette by ID."""
|
||||||
|
palette = palettes.read(id)
|
||||||
|
if palette:
|
||||||
|
return json.dumps(palette), 200, {'Content-Type': 'application/json'}
|
||||||
|
return json.dumps({"error": "Palette not found"}), 404
|
||||||
|
|
||||||
|
@controller.post('')
|
||||||
|
async def create_palette(request):
|
||||||
|
"""Create a new palette."""
|
||||||
|
try:
|
||||||
|
data = request.json or {}
|
||||||
|
name = data.get("name", "")
|
||||||
|
colors = data.get("colors", None)
|
||||||
|
palette_id = palettes.create(name, colors)
|
||||||
|
if data:
|
||||||
|
palettes.update(palette_id, data)
|
||||||
|
return json.dumps(palettes.read(palette_id)), 201, {'Content-Type': 'application/json'}
|
||||||
|
except Exception as e:
|
||||||
|
return json.dumps({"error": str(e)}), 400
|
||||||
|
|
||||||
|
@controller.put('/<id>')
|
||||||
|
async def update_palette(request, id):
|
||||||
|
"""Update an existing palette."""
|
||||||
|
try:
|
||||||
|
data = request.json
|
||||||
|
if palettes.update(id, data):
|
||||||
|
return json.dumps(palettes.read(id)), 200, {'Content-Type': 'application/json'}
|
||||||
|
return json.dumps({"error": "Palette not found"}), 404
|
||||||
|
except Exception as e:
|
||||||
|
return json.dumps({"error": str(e)}), 400
|
||||||
|
|
||||||
|
@controller.delete('/<id>')
|
||||||
|
async def delete_palette(request, id):
|
||||||
|
"""Delete a palette."""
|
||||||
|
if palettes.delete(id):
|
||||||
|
return json.dumps({"message": "Palette deleted successfully"}), 200
|
||||||
|
return json.dumps({"error": "Palette not found"}), 404
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
from microdot import Microdot
|
||||||
|
from models.pattern import Pattern
|
||||||
|
import json
|
||||||
|
|
||||||
|
controller = Microdot()
|
||||||
|
patterns = Pattern()
|
||||||
|
|
||||||
|
|
||||||
|
@controller.get('')
|
||||||
|
async def list_patterns(request):
|
||||||
|
"""List all patterns."""
|
||||||
|
return json.dumps(patterns), 200, {'Content-Type': 'application/json'}
|
||||||
|
|
||||||
|
|
||||||
|
@controller.get('/<id>')
|
||||||
|
async def get_pattern(request, id):
|
||||||
|
"""Get a specific pattern by ID."""
|
||||||
|
pattern = patterns.read(id)
|
||||||
|
if pattern is not None:
|
||||||
|
return json.dumps(pattern), 200, {'Content-Type': 'application/json'}
|
||||||
|
return json.dumps({"error": "Pattern not found"}), 404
|
||||||
|
|
||||||
|
|
||||||
|
@controller.post('')
|
||||||
|
async def create_pattern(request):
|
||||||
|
"""Create a new pattern."""
|
||||||
|
try:
|
||||||
|
data = request.json or {}
|
||||||
|
name = data.get("name", "")
|
||||||
|
pattern_id = patterns.create(name, data.get("data", {}))
|
||||||
|
if data:
|
||||||
|
patterns.update(pattern_id, data)
|
||||||
|
return json.dumps(patterns.read(pattern_id)), 201, {'Content-Type': 'application/json'}
|
||||||
|
except Exception as e:
|
||||||
|
return json.dumps({"error": str(e)}), 400
|
||||||
|
|
||||||
|
|
||||||
|
@controller.put('/<id>')
|
||||||
|
async def update_pattern(request, id):
|
||||||
|
"""Update an existing pattern."""
|
||||||
|
try:
|
||||||
|
data = request.json
|
||||||
|
if patterns.update(id, data):
|
||||||
|
return json.dumps(patterns.read(id)), 200, {'Content-Type': 'application/json'}
|
||||||
|
return json.dumps({"error": "Pattern not found"}), 404
|
||||||
|
except Exception as e:
|
||||||
|
return json.dumps({"error": str(e)}), 400
|
||||||
|
|
||||||
|
|
||||||
|
@controller.delete('/<id>')
|
||||||
|
async def delete_pattern(request, id):
|
||||||
|
"""Delete a pattern."""
|
||||||
|
if patterns.delete(id):
|
||||||
|
return json.dumps({"message": "Pattern deleted successfully"}), 200
|
||||||
|
return json.dumps({"error": "Pattern not found"}), 404
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
from microdot import Microdot
|
||||||
|
from models.preset import Preset
|
||||||
|
import json
|
||||||
|
|
||||||
|
controller = Microdot()
|
||||||
|
presets = Preset()
|
||||||
|
|
||||||
|
@controller.get('')
|
||||||
|
async def list_presets(request):
|
||||||
|
"""List all presets."""
|
||||||
|
return json.dumps(presets), 200, {'Content-Type': 'application/json'}
|
||||||
|
|
||||||
|
@controller.get('/<id>')
|
||||||
|
async def get_preset(request, id):
|
||||||
|
"""Get a specific preset by ID."""
|
||||||
|
preset = presets.read(id)
|
||||||
|
if preset:
|
||||||
|
return json.dumps(preset), 200, {'Content-Type': 'application/json'}
|
||||||
|
return json.dumps({"error": "Preset not found"}), 404
|
||||||
|
|
||||||
|
@controller.post('')
|
||||||
|
async def create_preset(request):
|
||||||
|
"""Create a new preset."""
|
||||||
|
try:
|
||||||
|
data = request.json
|
||||||
|
preset_id = presets.create()
|
||||||
|
if presets.update(preset_id, data):
|
||||||
|
return json.dumps(presets.read(preset_id)), 201, {'Content-Type': 'application/json'}
|
||||||
|
return json.dumps({"error": "Failed to create preset"}), 400
|
||||||
|
except Exception as e:
|
||||||
|
return json.dumps({"error": str(e)}), 400
|
||||||
|
|
||||||
|
@controller.put('/<id>')
|
||||||
|
async def update_preset(request, id):
|
||||||
|
"""Update an existing preset."""
|
||||||
|
try:
|
||||||
|
data = request.json
|
||||||
|
if presets.update(id, data):
|
||||||
|
return json.dumps(presets.read(id)), 200, {'Content-Type': 'application/json'}
|
||||||
|
return json.dumps({"error": "Preset not found"}), 404
|
||||||
|
except Exception as e:
|
||||||
|
return json.dumps({"error": str(e)}), 400
|
||||||
|
|
||||||
|
@controller.delete('/<id>')
|
||||||
|
async def delete_preset(request, id):
|
||||||
|
"""Delete a preset."""
|
||||||
|
if presets.delete(id):
|
||||||
|
return json.dumps({"message": "Preset deleted successfully"}), 200
|
||||||
|
return json.dumps({"error": "Preset not found"}), 404
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
from microdot import Microdot
|
||||||
|
from microdot.session import with_session
|
||||||
|
from models.profile import Profile
|
||||||
|
import json
|
||||||
|
|
||||||
|
controller = Microdot()
|
||||||
|
profiles = Profile()
|
||||||
|
|
||||||
|
@controller.get('')
|
||||||
|
async def list_profiles(request):
|
||||||
|
"""List all profiles."""
|
||||||
|
return json.dumps(profiles), 200, {'Content-Type': 'application/json'}
|
||||||
|
|
||||||
|
@controller.get('/current')
|
||||||
|
@with_session
|
||||||
|
async def get_current_profile(request, session):
|
||||||
|
"""Get the current profile ID from session (or fallback)."""
|
||||||
|
profile_list = profiles.list()
|
||||||
|
current_id = session.get('current_profile')
|
||||||
|
if not current_id and profile_list:
|
||||||
|
current_id = profile_list[0]
|
||||||
|
session['current_profile'] = str(current_id)
|
||||||
|
session.save()
|
||||||
|
if current_id:
|
||||||
|
profile = profiles.read(current_id)
|
||||||
|
return json.dumps({"id": current_id, "profile": profile}), 200, {'Content-Type': 'application/json'}
|
||||||
|
return json.dumps({"error": "No profile available"}), 404
|
||||||
|
|
||||||
|
@controller.get('/<id>')
|
||||||
|
async def get_profile(request, id):
|
||||||
|
"""Get a specific profile by ID."""
|
||||||
|
profile = profiles.read(id)
|
||||||
|
if profile:
|
||||||
|
return json.dumps(profile), 200, {'Content-Type': 'application/json'}
|
||||||
|
return json.dumps({"error": "Profile not found"}), 404
|
||||||
|
|
||||||
|
@controller.post('/<id>/apply')
|
||||||
|
@with_session
|
||||||
|
async def apply_profile(request, session, id):
|
||||||
|
"""Apply a profile by saving it to session."""
|
||||||
|
if not profiles.read(id):
|
||||||
|
return json.dumps({"error": "Profile not found"}), 404
|
||||||
|
session['current_profile'] = str(id)
|
||||||
|
session.save()
|
||||||
|
return json.dumps({"message": "Profile applied", "id": str(id)}), 200, {'Content-Type': 'application/json'}
|
||||||
|
|
||||||
|
@controller.post('')
|
||||||
|
async def create_profile(request):
|
||||||
|
"""Create a new profile."""
|
||||||
|
try:
|
||||||
|
data = request.json or {}
|
||||||
|
name = data.get("name", "")
|
||||||
|
profile_id = profiles.create(name)
|
||||||
|
if data:
|
||||||
|
profiles.update(profile_id, data)
|
||||||
|
return json.dumps(profiles.read(profile_id)), 201, {'Content-Type': 'application/json'}
|
||||||
|
except Exception as e:
|
||||||
|
return json.dumps({"error": str(e)}), 400
|
||||||
|
|
||||||
|
@controller.put('/current')
|
||||||
|
@with_session
|
||||||
|
async def update_current_profile(request, session):
|
||||||
|
"""Update the current profile using session (or fallback)."""
|
||||||
|
try:
|
||||||
|
data = request.json or {}
|
||||||
|
profile_list = profiles.list()
|
||||||
|
current_id = session.get('current_profile')
|
||||||
|
if not current_id and profile_list:
|
||||||
|
current_id = profile_list[0]
|
||||||
|
session['current_profile'] = str(current_id)
|
||||||
|
session.save()
|
||||||
|
if not current_id:
|
||||||
|
return json.dumps({"error": "No profile available"}), 404
|
||||||
|
if profiles.update(current_id, data):
|
||||||
|
return json.dumps(profiles.read(current_id)), 200, {'Content-Type': 'application/json'}
|
||||||
|
return json.dumps({"error": "Profile not found"}), 404
|
||||||
|
except Exception as e:
|
||||||
|
return json.dumps({"error": str(e)}), 400
|
||||||
|
|
||||||
|
@controller.put('/<id>')
|
||||||
|
async def update_profile(request, id):
|
||||||
|
"""Update an existing profile."""
|
||||||
|
try:
|
||||||
|
data = request.json
|
||||||
|
if profiles.update(id, data):
|
||||||
|
return json.dumps(profiles.read(id)), 200, {'Content-Type': 'application/json'}
|
||||||
|
return json.dumps({"error": "Profile not found"}), 404
|
||||||
|
except Exception as e:
|
||||||
|
return json.dumps({"error": str(e)}), 400
|
||||||
|
|
||||||
|
@controller.delete('/<id>')
|
||||||
|
async def delete_profile(request, id):
|
||||||
|
"""Delete a profile."""
|
||||||
|
if profiles.delete(id):
|
||||||
|
return json.dumps({"message": "Profile deleted successfully"}), 200
|
||||||
|
return json.dumps({"error": "Profile not found"}), 404
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
from microdot import Microdot
|
||||||
|
from models.scene import Scene
|
||||||
|
import json
|
||||||
|
|
||||||
|
controller = Microdot()
|
||||||
|
scenes = Scene()
|
||||||
|
|
||||||
|
@controller.get('')
|
||||||
|
async def list_scenes(request):
|
||||||
|
"""List all scenes."""
|
||||||
|
return json.dumps(scenes), 200, {'Content-Type': 'application/json'}
|
||||||
|
|
||||||
|
@controller.get('/<id>')
|
||||||
|
async def get_scene(request, id):
|
||||||
|
"""Get a specific scene by ID."""
|
||||||
|
scene = scenes.read(id)
|
||||||
|
if scene:
|
||||||
|
return json.dumps(scene), 200, {'Content-Type': 'application/json'}
|
||||||
|
return json.dumps({"error": "Scene not found"}), 404
|
||||||
|
|
||||||
|
@controller.post('')
|
||||||
|
async def create_scene(request):
|
||||||
|
"""Create a new scene."""
|
||||||
|
try:
|
||||||
|
data = request.json
|
||||||
|
scene_id = scenes.create()
|
||||||
|
if scenes.update(scene_id, data):
|
||||||
|
return json.dumps(scenes.read(scene_id)), 201, {'Content-Type': 'application/json'}
|
||||||
|
return json.dumps({"error": "Failed to create scene"}), 400
|
||||||
|
except Exception as e:
|
||||||
|
return json.dumps({"error": str(e)}), 400
|
||||||
|
|
||||||
|
@controller.put('/<id>')
|
||||||
|
async def update_scene(request, id):
|
||||||
|
"""Update an existing scene."""
|
||||||
|
try:
|
||||||
|
data = request.json
|
||||||
|
if scenes.update(id, data):
|
||||||
|
return json.dumps(scenes.read(id)), 200, {'Content-Type': 'application/json'}
|
||||||
|
return json.dumps({"error": "Scene not found"}), 404
|
||||||
|
except Exception as e:
|
||||||
|
return json.dumps({"error": str(e)}), 400
|
||||||
|
|
||||||
|
@controller.delete('/<id>')
|
||||||
|
async def delete_scene(request, id):
|
||||||
|
"""Delete a scene."""
|
||||||
|
if scenes.delete(id):
|
||||||
|
return json.dumps({"message": "Scene deleted successfully"}), 200
|
||||||
|
return json.dumps({"error": "Scene not found"}), 404
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
from microdot import Microdot
|
||||||
|
from models.squence import Sequence
|
||||||
|
import json
|
||||||
|
|
||||||
|
controller = Microdot()
|
||||||
|
sequences = Sequence()
|
||||||
|
|
||||||
|
@controller.get('')
|
||||||
|
async def list_sequences(request):
|
||||||
|
"""List all sequences."""
|
||||||
|
return json.dumps(sequences), 200, {'Content-Type': 'application/json'}
|
||||||
|
|
||||||
|
@controller.get('/<id>')
|
||||||
|
async def get_sequence(request, id):
|
||||||
|
"""Get a specific sequence by ID."""
|
||||||
|
sequence = sequences.read(id)
|
||||||
|
if sequence:
|
||||||
|
return json.dumps(sequence), 200, {'Content-Type': 'application/json'}
|
||||||
|
return json.dumps({"error": "Sequence not found"}), 404
|
||||||
|
|
||||||
|
@controller.post('')
|
||||||
|
async def create_sequence(request):
|
||||||
|
"""Create a new sequence."""
|
||||||
|
try:
|
||||||
|
data = request.json or {}
|
||||||
|
group_name = data.get("group_name", "")
|
||||||
|
preset_names = data.get("presets", None)
|
||||||
|
sequence_id = sequences.create(group_name, preset_names)
|
||||||
|
if data:
|
||||||
|
sequences.update(sequence_id, data)
|
||||||
|
return json.dumps(sequences.read(sequence_id)), 201, {'Content-Type': 'application/json'}
|
||||||
|
except Exception as e:
|
||||||
|
return json.dumps({"error": str(e)}), 400
|
||||||
|
|
||||||
|
@controller.put('/<id>')
|
||||||
|
async def update_sequence(request, id):
|
||||||
|
"""Update an existing sequence."""
|
||||||
|
try:
|
||||||
|
data = request.json
|
||||||
|
if sequences.update(id, data):
|
||||||
|
return json.dumps(sequences.read(id)), 200, {'Content-Type': 'application/json'}
|
||||||
|
return json.dumps({"error": "Sequence not found"}), 404
|
||||||
|
except Exception as e:
|
||||||
|
return json.dumps({"error": str(e)}), 400
|
||||||
|
|
||||||
|
@controller.delete('/<id>')
|
||||||
|
async def delete_sequence(request, id):
|
||||||
|
"""Delete a sequence."""
|
||||||
|
if sequences.delete(id):
|
||||||
|
return json.dumps({"message": "Sequence deleted successfully"}), 200
|
||||||
|
return json.dumps({"error": "Sequence not found"}), 404
|
||||||
@@ -0,0 +1,414 @@
|
|||||||
|
from microdot import Microdot, send_file
|
||||||
|
from microdot.session import with_session
|
||||||
|
from models.tab import Tab
|
||||||
|
from models.profile import Profile
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
|
||||||
|
controller = Microdot()
|
||||||
|
tabs = Tab()
|
||||||
|
profiles = Profile()
|
||||||
|
|
||||||
|
def get_current_profile_id(session=None):
|
||||||
|
"""Get the current active profile ID from session or fallback to first."""
|
||||||
|
profile_list = profiles.list()
|
||||||
|
session_profile = None
|
||||||
|
if session is not None:
|
||||||
|
session_profile = session.get('current_profile')
|
||||||
|
if session_profile and session_profile in profile_list:
|
||||||
|
return session_profile
|
||||||
|
if profile_list:
|
||||||
|
return profile_list[0]
|
||||||
|
return None
|
||||||
|
|
||||||
|
def get_profile_tab_order(profile_id):
|
||||||
|
"""Get the tab order for a profile."""
|
||||||
|
if not profile_id:
|
||||||
|
return []
|
||||||
|
profile = profiles.read(profile_id)
|
||||||
|
if profile:
|
||||||
|
# Support both "tab_order" (old) and "tabs" (new) format
|
||||||
|
return profile.get("tabs", profile.get("tab_order", []))
|
||||||
|
return []
|
||||||
|
|
||||||
|
def get_current_tab_id(request, session=None):
|
||||||
|
"""Get the current tab ID from session."""
|
||||||
|
if session:
|
||||||
|
current_tab = session.get('current_tab')
|
||||||
|
if current_tab:
|
||||||
|
return current_tab
|
||||||
|
|
||||||
|
# Fallback to first tab in current profile if no session
|
||||||
|
profile_id = get_current_profile_id(session)
|
||||||
|
if profile_id:
|
||||||
|
profile = profiles.read(profile_id)
|
||||||
|
if profile:
|
||||||
|
# Support both "tabs" (new) and "tab_order" (old) format
|
||||||
|
tabs_list = profile.get("tabs", profile.get("tab_order", []))
|
||||||
|
if tabs_list:
|
||||||
|
return tabs_list[0]
|
||||||
|
return None
|
||||||
|
|
||||||
|
@controller.get('')
|
||||||
|
async def list_tabs(request):
|
||||||
|
"""List all tabs."""
|
||||||
|
return json.dumps(tabs), 200, {'Content-Type': 'application/json'}
|
||||||
|
|
||||||
|
# HTML Fragment endpoints for htmx - must be before /<id> route
|
||||||
|
@controller.get('/list-fragment')
|
||||||
|
@with_session
|
||||||
|
async def tabs_list_fragment(request, session):
|
||||||
|
"""Return HTML fragment for the tabs list."""
|
||||||
|
profile_id = get_current_profile_id(session)
|
||||||
|
# #region agent log
|
||||||
|
try:
|
||||||
|
os.makedirs('/home/pi/led-controller/.cursor', exist_ok=True)
|
||||||
|
with open('/home/pi/led-controller/.cursor/debug.log', 'a') as _log:
|
||||||
|
_log.write(json.dumps({
|
||||||
|
"sessionId": "debug-session",
|
||||||
|
"runId": "tabs-pre-fix",
|
||||||
|
"hypothesisId": "H1",
|
||||||
|
"location": "src/controllers/tab.py:tabs_list_fragment",
|
||||||
|
"message": "tabs list fragment",
|
||||||
|
"data": {
|
||||||
|
"profile_id": profile_id,
|
||||||
|
"profile_count": len(profiles.list())
|
||||||
|
},
|
||||||
|
"timestamp": int(time.time() * 1000)
|
||||||
|
}) + "\n")
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
# #endregion
|
||||||
|
if not profile_id:
|
||||||
|
return '<div class="tabs-list">No profile selected</div>', 200, {'Content-Type': 'text/html'}
|
||||||
|
|
||||||
|
tab_order = get_profile_tab_order(profile_id)
|
||||||
|
current_tab_id = get_current_tab_id(request, session)
|
||||||
|
|
||||||
|
html = '<div class="tabs-list">'
|
||||||
|
for tab_id in tab_order:
|
||||||
|
tab_data = tabs.read(tab_id)
|
||||||
|
if tab_data:
|
||||||
|
active_class = 'active' if str(tab_id) == str(current_tab_id) else ''
|
||||||
|
tab_name = tab_data.get('name', 'Tab ' + str(tab_id))
|
||||||
|
html += (
|
||||||
|
'<button class="tab-button ' + active_class + '" '
|
||||||
|
'hx-get="/tabs/' + str(tab_id) + '/content-fragment" '
|
||||||
|
'hx-target="#tab-content" '
|
||||||
|
'hx-swap="innerHTML" '
|
||||||
|
'hx-push-url="true" '
|
||||||
|
'hx-trigger="click" '
|
||||||
|
'onclick="document.querySelectorAll(\'.tab-button\').forEach(b => b.classList.remove(\'active\')); this.classList.add(\'active\');">'
|
||||||
|
+ tab_name +
|
||||||
|
'</button>'
|
||||||
|
)
|
||||||
|
html += '</div>'
|
||||||
|
return html, 200, {'Content-Type': 'text/html'}
|
||||||
|
|
||||||
|
@controller.get('/create-form-fragment')
|
||||||
|
async def create_tab_form_fragment(request):
|
||||||
|
"""Return the create tab form HTML fragment."""
|
||||||
|
html = '''
|
||||||
|
<h2>Add New Tab</h2>
|
||||||
|
<form hx-post="/tabs"
|
||||||
|
hx-target="#tabs-list"
|
||||||
|
hx-swap="innerHTML"
|
||||||
|
hx-headers='{"Accept": "text/html"}'
|
||||||
|
hx-on::after-request="if(event.detail.successful) { document.getElementById('add-tab-modal').classList.remove('active'); document.body.dispatchEvent(new Event('tabs-updated')); }">
|
||||||
|
<label>Tab Name:</label>
|
||||||
|
<input type="text" name="name" placeholder="Enter tab name" required>
|
||||||
|
<label>Device IDs (comma-separated):</label>
|
||||||
|
<input type="text" name="ids" placeholder="1,2,3" value="1">
|
||||||
|
<div class="modal-actions">
|
||||||
|
<button type="submit" class="btn btn-primary">Add</button>
|
||||||
|
<button type="button" class="btn btn-secondary" onclick="document.getElementById('add-tab-modal').classList.remove('active')">Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
'''
|
||||||
|
return html, 200, {'Content-Type': 'text/html'}
|
||||||
|
|
||||||
|
@controller.get('/current')
|
||||||
|
@with_session
|
||||||
|
async def get_current_tab(request, session):
|
||||||
|
"""Get the current tab from session."""
|
||||||
|
current_tab_id = get_current_tab_id(request, session)
|
||||||
|
if not current_tab_id:
|
||||||
|
accept_header = request.headers.get('Accept', '')
|
||||||
|
wants_html = 'text/html' in accept_header
|
||||||
|
if wants_html:
|
||||||
|
return '<div class="error">No current tab set</div>', 404, {'Content-Type': 'text/html'}
|
||||||
|
return json.dumps({"error": "No current tab set"}), 404
|
||||||
|
|
||||||
|
return await tab_content_fragment.__wrapped__(request, session, current_tab_id)
|
||||||
|
|
||||||
|
@controller.get('/<id>/content-fragment')
|
||||||
|
@with_session
|
||||||
|
async def tab_content_fragment(request, session, id):
|
||||||
|
"""Return HTML fragment for tab content."""
|
||||||
|
# Handle 'current' as a special case
|
||||||
|
if id == 'current':
|
||||||
|
return await get_current_tab(request, session)
|
||||||
|
|
||||||
|
tab = tabs.read(id)
|
||||||
|
if not tab:
|
||||||
|
return '<div>Tab not found</div>', 404, {'Content-Type': 'text/html'}
|
||||||
|
|
||||||
|
# Set this tab as the current tab in session
|
||||||
|
session['current_tab'] = str(id)
|
||||||
|
session.save()
|
||||||
|
|
||||||
|
# If this is a direct page load (not HTMX), return full UI so CSS loads.
|
||||||
|
if not request.headers.get('HX-Request'):
|
||||||
|
return send_file('templates/index.html')
|
||||||
|
|
||||||
|
tab_name = tab.get('name', 'Tab ' + str(id))
|
||||||
|
device_ids = ', '.join(tab.get('names', []))
|
||||||
|
|
||||||
|
html = (
|
||||||
|
'<div class="left-panel">'
|
||||||
|
'<div class="left-panel-header">'
|
||||||
|
'<div class="ids-display">'
|
||||||
|
'<label>IDs: </label>'
|
||||||
|
'<span id="current-ids">' + device_ids + '</span>'
|
||||||
|
'</div>'
|
||||||
|
'<button id="toggle-left-panel" class="btn btn-small left-panel-toggle" title="Collapse/expand controls">◀</button>'
|
||||||
|
'</div>'
|
||||||
|
'<div class="left-panel-body">'
|
||||||
|
'<div class="color-palette-section">'
|
||||||
|
'<h3>Color Palette</h3>'
|
||||||
|
'<div id="color-palette" class="color-palette" data-tab-id="' + str(id) + '">'
|
||||||
|
'<!-- Colors will be loaded here -->'
|
||||||
|
'</div>'
|
||||||
|
'<div class="palette-actions">'
|
||||||
|
'<input type="color" id="tab-color-input" value="#ffffff">'
|
||||||
|
'<button class="btn btn-small" id="tab-color-add-btn">Add Color</button>'
|
||||||
|
'<button class="btn btn-small" id="tab-color-add-from-palette-btn">Add from Palette</button>'
|
||||||
|
'</div>'
|
||||||
|
'</div>'
|
||||||
|
'<div class="controls-section">'
|
||||||
|
'<div class="control-group">'
|
||||||
|
'<label for="brightness-slider">Brightness:</label>'
|
||||||
|
'<input type="range" id="brightness-slider" min="0" max="255" value="127" class="slider">'
|
||||||
|
'<span id="brightness-value" class="slider-value">127</span>'
|
||||||
|
'</div>'
|
||||||
|
'<div class="control-group">'
|
||||||
|
'<label for="delay-slider">Delay:</label>'
|
||||||
|
'<input type="range" id="delay-slider" min="0" max="1000" value="0" class="slider">'
|
||||||
|
'<span id="delay-value" class="slider-value">100 ms</span>'
|
||||||
|
'</div>'
|
||||||
|
'</div>'
|
||||||
|
'<div class="n-params-section">'
|
||||||
|
'<h3>N Parameters</h3>'
|
||||||
|
'<div class="n-params-grid">'
|
||||||
|
'<div class="n-param-group">'
|
||||||
|
'<label for="n1-input" id="n1-label">n1:</label>'
|
||||||
|
'<input type="number" id="n1-input" min="0" max="255" value="10" class="n-input">'
|
||||||
|
'</div>'
|
||||||
|
'<div class="n-param-group">'
|
||||||
|
'<label for="n2-input" id="n2-label">n2:</label>'
|
||||||
|
'<input type="number" id="n2-input" min="0" max="255" value="10" class="n-input">'
|
||||||
|
'</div>'
|
||||||
|
'<div class="n-param-group">'
|
||||||
|
'<label for="n3-input" id="n3-label">n3:</label>'
|
||||||
|
'<input type="number" id="n3-input" min="0" max="255" value="10" class="n-input">'
|
||||||
|
'</div>'
|
||||||
|
'<div class="n-param-group">'
|
||||||
|
'<label for="n4-input" id="n4-label">n4:</label>'
|
||||||
|
'<input type="number" id="n4-input" min="0" max="255" value="10" class="n-input">'
|
||||||
|
'</div>'
|
||||||
|
'<div class="n-param-group">'
|
||||||
|
'<label for="n5-input" id="n5-label">n5:</label>'
|
||||||
|
'<input type="number" id="n5-input" min="0" max="255" value="10" class="n-input">'
|
||||||
|
'</div>'
|
||||||
|
'<div class="n-param-group">'
|
||||||
|
'<label for="n6-input" id="n6-label">n6:</label>'
|
||||||
|
'<input type="number" id="n6-input" min="0" max="255" value="10" class="n-input">'
|
||||||
|
'</div>'
|
||||||
|
'<div class="n-param-group">'
|
||||||
|
'<label for="n7-input" id="n7-label">n7:</label>'
|
||||||
|
'<input type="number" id="n7-input" min="0" max="255" value="10" class="n-input">'
|
||||||
|
'</div>'
|
||||||
|
'<div class="n-param-group">'
|
||||||
|
'<label for="n8-input" id="n8-label">n8:</label>'
|
||||||
|
'<input type="number" id="n8-input" min="0" max="255" value="10" class="n-input">'
|
||||||
|
'</div>'
|
||||||
|
'</div>'
|
||||||
|
'</div>'
|
||||||
|
'</div>'
|
||||||
|
'</div>'
|
||||||
|
'<div class="right-panel">'
|
||||||
|
'<div class="presets-section">'
|
||||||
|
'<h3>Presets</h3>'
|
||||||
|
'<div id="presets-list-tab" class="presets-list">'
|
||||||
|
'<!-- Presets will be loaded here -->'
|
||||||
|
'</div>'
|
||||||
|
'</div>'
|
||||||
|
'</div>'
|
||||||
|
)
|
||||||
|
return html, 200, {'Content-Type': 'text/html'}
|
||||||
|
|
||||||
|
@controller.get('/<id>')
|
||||||
|
async def get_tab(request, id):
|
||||||
|
"""Get a specific tab by ID."""
|
||||||
|
tab = tabs.read(id)
|
||||||
|
if tab:
|
||||||
|
return json.dumps(tab), 200, {'Content-Type': 'application/json'}
|
||||||
|
return json.dumps({"error": "Tab not found"}), 404
|
||||||
|
|
||||||
|
@controller.put('/<id>')
|
||||||
|
async def update_tab(request, id):
|
||||||
|
"""Update an existing tab."""
|
||||||
|
try:
|
||||||
|
data = request.json
|
||||||
|
if tabs.update(id, data):
|
||||||
|
return json.dumps(tabs.read(id)), 200, {'Content-Type': 'application/json'}
|
||||||
|
return json.dumps({"error": "Tab not found"}), 404
|
||||||
|
except Exception as e:
|
||||||
|
return json.dumps({"error": str(e)}), 400
|
||||||
|
|
||||||
|
@controller.delete('/<id>')
|
||||||
|
@with_session
|
||||||
|
async def delete_tab(request, id, session):
|
||||||
|
"""Delete a tab."""
|
||||||
|
# Check if this is an htmx request (wants HTML fragment)
|
||||||
|
accept_header = request.headers.get('Accept', '')
|
||||||
|
wants_html = 'text/html' in accept_header
|
||||||
|
|
||||||
|
# Handle 'current' tab ID
|
||||||
|
if id == 'current':
|
||||||
|
current_tab_id = get_current_tab_id(request, session)
|
||||||
|
if current_tab_id:
|
||||||
|
id = current_tab_id
|
||||||
|
else:
|
||||||
|
if wants_html:
|
||||||
|
return '<div class="error">No current tab to delete</div>', 404, {'Content-Type': 'text/html'}
|
||||||
|
return json.dumps({"error": "No current tab to delete"}), 404
|
||||||
|
|
||||||
|
if tabs.delete(id):
|
||||||
|
# Remove from profile's tabs
|
||||||
|
profile_id = get_current_profile_id(session)
|
||||||
|
if profile_id:
|
||||||
|
profile = profiles.read(profile_id)
|
||||||
|
if profile:
|
||||||
|
# Support both "tabs" (new) and "tab_order" (old) format
|
||||||
|
tabs_list = profile.get('tabs', profile.get('tab_order', []))
|
||||||
|
if id in tabs_list:
|
||||||
|
tabs_list.remove(id)
|
||||||
|
profile['tabs'] = tabs_list
|
||||||
|
# Remove old tab_order if it exists
|
||||||
|
if 'tab_order' in profile:
|
||||||
|
del profile['tab_order']
|
||||||
|
profiles.update(profile_id, profile)
|
||||||
|
|
||||||
|
# Clear session if the deleted tab was the current tab
|
||||||
|
current_tab_id = get_current_tab_id(request, session)
|
||||||
|
if current_tab_id == id:
|
||||||
|
if 'current_tab' in session:
|
||||||
|
session.pop('current_tab', None)
|
||||||
|
session.save()
|
||||||
|
|
||||||
|
if wants_html:
|
||||||
|
return await tabs_list_fragment.__wrapped__(request, session)
|
||||||
|
else:
|
||||||
|
return json.dumps({"message": "Tab deleted successfully"}), 200, {'Content-Type': 'application/json'}
|
||||||
|
|
||||||
|
if wants_html:
|
||||||
|
return '<div class="error">Tab not found</div>', 404, {'Content-Type': 'text/html'}
|
||||||
|
return json.dumps({"error": "Tab not found"}), 404
|
||||||
|
|
||||||
|
@controller.post('')
|
||||||
|
@with_session
|
||||||
|
async def create_tab(request, session):
|
||||||
|
"""Create a new tab."""
|
||||||
|
# Check if this is an htmx request (wants HTML fragment)
|
||||||
|
accept_header = request.headers.get('Accept', '')
|
||||||
|
wants_html = 'text/html' in accept_header
|
||||||
|
# #region agent log
|
||||||
|
try:
|
||||||
|
os.makedirs('/home/pi/led-controller/.cursor', exist_ok=True)
|
||||||
|
with open('/home/pi/led-controller/.cursor/debug.log', 'a') as _log:
|
||||||
|
_log.write(json.dumps({
|
||||||
|
"sessionId": "debug-session",
|
||||||
|
"runId": "tabs-pre-fix",
|
||||||
|
"hypothesisId": "H3",
|
||||||
|
"location": "src/controllers/tab.py:create_tab_htmx",
|
||||||
|
"message": "create tab with session",
|
||||||
|
"data": {
|
||||||
|
"wants_html": wants_html,
|
||||||
|
"has_form": bool(request.form),
|
||||||
|
"accept": accept_header
|
||||||
|
},
|
||||||
|
"timestamp": int(time.time() * 1000)
|
||||||
|
}) + "\n")
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
# #endregion
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Handle form data (htmx) or JSON
|
||||||
|
if request.form:
|
||||||
|
name = request.form.get('name', '').strip()
|
||||||
|
ids_str = request.form.get('ids', '1').strip()
|
||||||
|
names = [id.strip() for id in ids_str.split(',') if id.strip()]
|
||||||
|
preset_ids = None
|
||||||
|
else:
|
||||||
|
data = request.json or {}
|
||||||
|
name = data.get("name", "")
|
||||||
|
names = data.get("names", None)
|
||||||
|
preset_ids = data.get("presets", None)
|
||||||
|
|
||||||
|
if not name:
|
||||||
|
if wants_html:
|
||||||
|
return '<div class="error">Tab name cannot be empty</div>', 400, {'Content-Type': 'text/html'}
|
||||||
|
return json.dumps({"error": "Tab name cannot be empty"}), 400
|
||||||
|
|
||||||
|
tab_id = tabs.create(name, names, preset_ids)
|
||||||
|
|
||||||
|
# Add to current profile's tabs
|
||||||
|
profile_id = get_current_profile_id(session)
|
||||||
|
if profile_id:
|
||||||
|
profile = profiles.read(profile_id)
|
||||||
|
if profile:
|
||||||
|
# Support both "tabs" (new) and "tab_order" (old) format
|
||||||
|
tabs_list = profile.get('tabs', profile.get('tab_order', []))
|
||||||
|
if tab_id not in tabs_list:
|
||||||
|
tabs_list.append(tab_id)
|
||||||
|
profile['tabs'] = tabs_list
|
||||||
|
# Remove old tab_order if it exists
|
||||||
|
if 'tab_order' in profile:
|
||||||
|
del profile['tab_order']
|
||||||
|
profiles.update(profile_id, profile)
|
||||||
|
# #region agent log
|
||||||
|
try:
|
||||||
|
os.makedirs('/home/pi/led-controller/.cursor', exist_ok=True)
|
||||||
|
with open('/home/pi/led-controller/.cursor/debug.log', 'a') as _log:
|
||||||
|
_log.write(json.dumps({
|
||||||
|
"sessionId": "debug-session",
|
||||||
|
"runId": "tabs-pre-fix",
|
||||||
|
"hypothesisId": "H4",
|
||||||
|
"location": "src/controllers/tab.py:create_tab_htmx",
|
||||||
|
"message": "tab created and profile updated",
|
||||||
|
"data": {
|
||||||
|
"tab_id": tab_id,
|
||||||
|
"profile_id": profile_id,
|
||||||
|
"profile_tabs": tabs_list if profile_id and profile else None
|
||||||
|
},
|
||||||
|
"timestamp": int(time.time() * 1000)
|
||||||
|
}) + "\n")
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
# #endregion
|
||||||
|
|
||||||
|
if wants_html:
|
||||||
|
# Return HTML fragment for tabs list
|
||||||
|
return await tabs_list_fragment.__wrapped__(request, session)
|
||||||
|
else:
|
||||||
|
# Return JSON response
|
||||||
|
return json.dumps(tabs.read(tab_id)), 201, {'Content-Type': 'application/json'}
|
||||||
|
except Exception as e:
|
||||||
|
import sys
|
||||||
|
sys.print_exception(e)
|
||||||
|
if wants_html:
|
||||||
|
return f'<div class="error">Error: {str(e)}</div>', 400, {'Content-Type': 'text/html'}
|
||||||
|
return json.dumps({"error": str(e)}), 400
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
import asyncio
|
||||||
|
from settings import Settings
|
||||||
|
import gc
|
||||||
|
import machine
|
||||||
|
from microdot import Microdot, send_file
|
||||||
|
from microdot.websocket import with_websocket
|
||||||
|
from microdot.session import Session
|
||||||
|
|
||||||
|
import aioespnow
|
||||||
|
import network
|
||||||
|
import controllers.preset as preset
|
||||||
|
import controllers.profile as profile
|
||||||
|
import controllers.group as group
|
||||||
|
import controllers.sequence as sequence
|
||||||
|
import controllers.tab as tab
|
||||||
|
import controllers.palette as palette
|
||||||
|
import controllers.scene as scene
|
||||||
|
import controllers.pattern as pattern
|
||||||
|
|
||||||
|
|
||||||
|
async def main(port=80):
|
||||||
|
settings = Settings()
|
||||||
|
print("Starting")
|
||||||
|
|
||||||
|
network.WLAN(network.STA_IF).active(True)
|
||||||
|
|
||||||
|
|
||||||
|
e = aioespnow.AIOESPNow()
|
||||||
|
e.active(True)
|
||||||
|
e.add_peer(b"\xbb\xbb\xbb\xbb\xbb\xbb")
|
||||||
|
|
||||||
|
app = Microdot()
|
||||||
|
|
||||||
|
# Initialize sessions with a secret key from settings
|
||||||
|
secret_key = settings.get('session_secret_key', 'led-controller-secret-key-change-in-production')
|
||||||
|
Session(app, secret_key=secret_key)
|
||||||
|
|
||||||
|
# Mount model controllers as subroutes
|
||||||
|
# Verify controllers are Microdot instances before mounting
|
||||||
|
controllers_to_mount = [
|
||||||
|
('/presets', preset, 'preset'),
|
||||||
|
('/profiles', profile, 'profile'),
|
||||||
|
('/groups', group, 'group'),
|
||||||
|
('/sequences', sequence, 'sequence'),
|
||||||
|
('/tabs', tab, 'tab'),
|
||||||
|
('/palettes', palette, 'palette'),
|
||||||
|
('/scenes', scene, 'scene'),
|
||||||
|
]
|
||||||
|
|
||||||
|
# Mount model controllers as subroutes
|
||||||
|
app.mount(preset.controller, '/presets')
|
||||||
|
app.mount(profile.controller, '/profiles')
|
||||||
|
app.mount(group.controller, '/groups')
|
||||||
|
app.mount(sequence.controller, '/sequences')
|
||||||
|
app.mount(tab.controller, '/tabs')
|
||||||
|
app.mount(palette.controller, '/palettes')
|
||||||
|
app.mount(scene.controller, '/scenes')
|
||||||
|
app.mount(pattern.controller, '/patterns')
|
||||||
|
|
||||||
|
# Serve index.html at root
|
||||||
|
@app.route('/')
|
||||||
|
def index(request):
|
||||||
|
"""Serve the main web UI."""
|
||||||
|
return send_file('templates/index.html')
|
||||||
|
|
||||||
|
# Static file route
|
||||||
|
@app.route("/static/<path:path>")
|
||||||
|
def static_handler(request, path):
|
||||||
|
"""Serve static files."""
|
||||||
|
if '..' in path:
|
||||||
|
# Directory traversal is not allowed
|
||||||
|
return 'Not found', 404
|
||||||
|
return send_file('static/' + path)
|
||||||
|
|
||||||
|
@app.route('/ws')
|
||||||
|
@with_websocket
|
||||||
|
async def ws(request, ws):
|
||||||
|
while True:
|
||||||
|
data = await ws.receive()
|
||||||
|
if data:
|
||||||
|
await e.asend(b"\xbb\xbb\xbb\xbb\xbb\xbb", data)
|
||||||
|
print(data)
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
server = asyncio.create_task(app.start_server(host="0.0.0.0", port=port))
|
||||||
|
|
||||||
|
wdt = machine.WDT(timeout=10000)
|
||||||
|
wdt.feed()
|
||||||
|
|
||||||
|
while True:
|
||||||
|
gc.collect()
|
||||||
|
for i in range(60):
|
||||||
|
wdt.feed()
|
||||||
|
await asyncio.sleep_ms(500)
|
||||||
|
# cleanup before ending the application
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
asyncio.run(main())
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
# Models package
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
from models.model import Model
|
||||||
|
|
||||||
|
class Group(Model):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
def create(self, name=""):
|
||||||
|
next_id = self.get_next_id()
|
||||||
|
self[next_id] = {
|
||||||
|
"name": name,
|
||||||
|
"devices": [],
|
||||||
|
"pattern": "on",
|
||||||
|
"colors": ["000000", "FF0000"],
|
||||||
|
"brightness": 100,
|
||||||
|
"delay": 100,
|
||||||
|
"step_offset": 0,
|
||||||
|
"step_increment": 1,
|
||||||
|
"n1": 0,
|
||||||
|
"n2": 0,
|
||||||
|
"n3": 0,
|
||||||
|
"n4": 0,
|
||||||
|
"n5": 0,
|
||||||
|
"n6": 0,
|
||||||
|
"n7": 0,
|
||||||
|
"n8": 0
|
||||||
|
}
|
||||||
|
self.save()
|
||||||
|
return next_id
|
||||||
|
|
||||||
|
def read(self, id):
|
||||||
|
id_str = str(id)
|
||||||
|
return self.get(id_str, None)
|
||||||
|
|
||||||
|
def update(self, id, data):
|
||||||
|
id_str = str(id)
|
||||||
|
if id_str not in self:
|
||||||
|
return False
|
||||||
|
self[id_str].update(data)
|
||||||
|
self.save()
|
||||||
|
return True
|
||||||
|
|
||||||
|
def delete(self, id):
|
||||||
|
id_str = str(id)
|
||||||
|
if id_str not in self:
|
||||||
|
return False
|
||||||
|
self.pop(id_str)
|
||||||
|
self.save()
|
||||||
|
return True
|
||||||
|
|
||||||
|
def list(self):
|
||||||
|
return list(self.keys())
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
|
class Model(dict):
|
||||||
|
def __new__(cls, *args, **kwargs):
|
||||||
|
# Singleton pattern: return existing instance if it exists
|
||||||
|
if not hasattr(cls, '_instance'):
|
||||||
|
cls._instance = super().__new__(cls)
|
||||||
|
return cls._instance
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
# Only initialize once (check if already initialized)
|
||||||
|
if hasattr(self, '_initialized'):
|
||||||
|
return
|
||||||
|
|
||||||
|
# Create /db directory if it doesn't exist (MicroPython compatible)
|
||||||
|
try:
|
||||||
|
os.mkdir("/db")
|
||||||
|
except OSError:
|
||||||
|
pass # Directory already exists, which is fine
|
||||||
|
self.class_name = self.__class__.__name__
|
||||||
|
self.file = f"/db/{self.class_name.lower()}.json"
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
self.load() # Load settings from file during initialization
|
||||||
|
self._initialized = True
|
||||||
|
|
||||||
|
def set_defaults(self):
|
||||||
|
self.clear()
|
||||||
|
|
||||||
|
def get_next_id(self):
|
||||||
|
"""Get the next available ID for creating a new record."""
|
||||||
|
if not self:
|
||||||
|
return "1"
|
||||||
|
max_id = max((int(k) for k in self.keys() if k.isdigit()), default=0)
|
||||||
|
return str(max_id + 1)
|
||||||
|
|
||||||
|
def save(self):
|
||||||
|
try:
|
||||||
|
# Ensure directory exists
|
||||||
|
try:
|
||||||
|
os.mkdir("/db")
|
||||||
|
except OSError:
|
||||||
|
pass # Directory already exists
|
||||||
|
j = json.dumps(self)
|
||||||
|
with open(self.file, 'w') as file:
|
||||||
|
file.write(j)
|
||||||
|
print(f"{self.class_name} saved successfully to {self.file}")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error saving {self.class_name} to {self.file}: {e}")
|
||||||
|
import sys
|
||||||
|
sys.print_exception(e)
|
||||||
|
|
||||||
|
def load(self):
|
||||||
|
try:
|
||||||
|
with open(self.file, 'r') as file:
|
||||||
|
loaded_settings = json.load(file)
|
||||||
|
self.update(loaded_settings)
|
||||||
|
print(f"{self.class_name} loaded successfully.")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error loading {self.class_name}")
|
||||||
|
self.set_defaults()
|
||||||
|
self.save()
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
from models.model import Model
|
||||||
|
|
||||||
|
class Palette(Model):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
def create(self, name="", colors=None):
|
||||||
|
next_id = self.get_next_id()
|
||||||
|
self[next_id] = {
|
||||||
|
"name": name,
|
||||||
|
"colors": colors if colors else []
|
||||||
|
}
|
||||||
|
self.save()
|
||||||
|
return next_id
|
||||||
|
|
||||||
|
def read(self, id):
|
||||||
|
id_str = str(id)
|
||||||
|
return self.get(id_str, None)
|
||||||
|
|
||||||
|
def update(self, id, data):
|
||||||
|
id_str = str(id)
|
||||||
|
if id_str not in self:
|
||||||
|
return False
|
||||||
|
self[id_str].update(data)
|
||||||
|
self.save()
|
||||||
|
return True
|
||||||
|
|
||||||
|
def delete(self, id):
|
||||||
|
id_str = str(id)
|
||||||
|
if id_str not in self:
|
||||||
|
return False
|
||||||
|
self.pop(id_str)
|
||||||
|
self.save()
|
||||||
|
return True
|
||||||
|
|
||||||
|
def list(self):
|
||||||
|
return list(self.keys())
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
from models.model import Model
|
||||||
|
|
||||||
|
|
||||||
|
class Pattern(Model):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
def create(self, name="", data=None):
|
||||||
|
pattern_name = str(name).strip()
|
||||||
|
if not pattern_name:
|
||||||
|
pattern_name = self.get_next_id()
|
||||||
|
self[pattern_name] = data if isinstance(data, dict) else {}
|
||||||
|
self.save()
|
||||||
|
return pattern_name
|
||||||
|
|
||||||
|
def read(self, id):
|
||||||
|
id_str = str(id)
|
||||||
|
return self.get(id_str, None)
|
||||||
|
|
||||||
|
def update(self, id, data):
|
||||||
|
id_str = str(id)
|
||||||
|
if id_str not in self:
|
||||||
|
return False
|
||||||
|
if isinstance(data, dict):
|
||||||
|
self[id_str].update(data)
|
||||||
|
self.save()
|
||||||
|
return True
|
||||||
|
|
||||||
|
def delete(self, id):
|
||||||
|
id_str = str(id)
|
||||||
|
if id_str not in self:
|
||||||
|
return False
|
||||||
|
self.pop(id_str)
|
||||||
|
self.save()
|
||||||
|
return True
|
||||||
|
|
||||||
|
def list(self):
|
||||||
|
return list(self.keys())
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
from models.model import Model
|
||||||
|
|
||||||
|
class Preset(Model):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
def create(self):
|
||||||
|
next_id = self.get_next_id()
|
||||||
|
self[next_id] = {
|
||||||
|
"name": "",
|
||||||
|
"pattern": "",
|
||||||
|
"colors": [],
|
||||||
|
"brightness": 0,
|
||||||
|
"delay": 0,
|
||||||
|
"n1": 0,
|
||||||
|
"n2": 0,
|
||||||
|
"n3": 0,
|
||||||
|
"n4": 0,
|
||||||
|
"n5": 0,
|
||||||
|
"n6": 0,
|
||||||
|
"n7": 0,
|
||||||
|
"n8": 0,
|
||||||
|
}
|
||||||
|
self.save()
|
||||||
|
return next_id
|
||||||
|
|
||||||
|
|
||||||
|
def read(self, id):
|
||||||
|
id_str = str(id)
|
||||||
|
if id_str not in self:
|
||||||
|
return None
|
||||||
|
return self[id_str]
|
||||||
|
|
||||||
|
def update(self, id, data):
|
||||||
|
id_str = str(id)
|
||||||
|
if id_str not in self:
|
||||||
|
return False
|
||||||
|
self[id_str].update(data)
|
||||||
|
self.save()
|
||||||
|
return True
|
||||||
|
|
||||||
|
def delete(self, id):
|
||||||
|
id_str = str(id)
|
||||||
|
if id_str not in self:
|
||||||
|
return False
|
||||||
|
self.pop(id_str)
|
||||||
|
self.save()
|
||||||
|
return True
|
||||||
|
|
||||||
|
def list(self):
|
||||||
|
return list(self.keys())
|
||||||
|
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
from models.model import Model
|
||||||
|
|
||||||
|
class Profile(Model):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
def create(self, name="", profile_type="tabs"):
|
||||||
|
"""
|
||||||
|
Create a new profile.
|
||||||
|
profile_type: "tabs" or "scenes" (ignoring scenes for now)
|
||||||
|
"""
|
||||||
|
next_id = self.get_next_id()
|
||||||
|
self[next_id] = {
|
||||||
|
"name": name,
|
||||||
|
"type": profile_type, # "tabs" or "scenes"
|
||||||
|
"tabs": [], # Array of tab IDs
|
||||||
|
"scenes": [], # Array of scene IDs (for future use)
|
||||||
|
"palette": []
|
||||||
|
}
|
||||||
|
self.save()
|
||||||
|
return next_id
|
||||||
|
|
||||||
|
def read(self, id):
|
||||||
|
id_str = str(id)
|
||||||
|
return self.get(id_str, None)
|
||||||
|
|
||||||
|
def update(self, id, data):
|
||||||
|
id_str = str(id)
|
||||||
|
if id_str not in self:
|
||||||
|
return False
|
||||||
|
self[id_str].update(data)
|
||||||
|
self.save()
|
||||||
|
return True
|
||||||
|
|
||||||
|
def delete(self, id):
|
||||||
|
id_str = str(id)
|
||||||
|
if id_str not in self:
|
||||||
|
return False
|
||||||
|
self.pop(id_str)
|
||||||
|
self.save()
|
||||||
|
return True
|
||||||
|
|
||||||
|
def list(self):
|
||||||
|
return list(self.keys())
|
||||||
|
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
from models.model import Model
|
||||||
|
|
||||||
|
class Scene(Model):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
def create(self, name="", sequences=None, groups=None):
|
||||||
|
next_id = self.get_next_id()
|
||||||
|
self[next_id] = {
|
||||||
|
"name": name,
|
||||||
|
"sequences": sequences if sequences else [],
|
||||||
|
"groups": groups if groups else []
|
||||||
|
}
|
||||||
|
self.save()
|
||||||
|
return next_id
|
||||||
|
|
||||||
|
def read(self, id):
|
||||||
|
id_str = str(id)
|
||||||
|
return self.get(id_str, None)
|
||||||
|
|
||||||
|
def update(self, id, data):
|
||||||
|
id_str = str(id)
|
||||||
|
if id_str not in self:
|
||||||
|
return False
|
||||||
|
self[id_str].update(data)
|
||||||
|
self.save()
|
||||||
|
return True
|
||||||
|
|
||||||
|
def delete(self, id):
|
||||||
|
id_str = str(id)
|
||||||
|
if id_str not in self:
|
||||||
|
return False
|
||||||
|
self.pop(id_str)
|
||||||
|
self.save()
|
||||||
|
return True
|
||||||
|
|
||||||
|
def list(self):
|
||||||
|
return list(self.keys())
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
from models.model import Model
|
||||||
|
|
||||||
|
class Sequence(Model):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
def create(self, group_name="", preset_names=None):
|
||||||
|
next_id = self.get_next_id()
|
||||||
|
self[next_id] = {
|
||||||
|
"group_name": group_name,
|
||||||
|
"presets": preset_names if preset_names else [],
|
||||||
|
"sequence_duration": 3000, # Duration per preset in ms
|
||||||
|
"sequence_transition": 500, # Transition time in ms
|
||||||
|
"sequence_loop": False,
|
||||||
|
"sequence_repeat_count": 0, # 0 = infinite
|
||||||
|
"sequence_active": False,
|
||||||
|
"sequence_index": 0,
|
||||||
|
"sequence_start_time": 0
|
||||||
|
}
|
||||||
|
self.save()
|
||||||
|
return next_id
|
||||||
|
|
||||||
|
def read(self, id):
|
||||||
|
id_str = str(id)
|
||||||
|
return self.get(id_str, None)
|
||||||
|
|
||||||
|
def update(self, id, data):
|
||||||
|
id_str = str(id)
|
||||||
|
if id_str not in self:
|
||||||
|
return False
|
||||||
|
self[id_str].update(data)
|
||||||
|
self.save()
|
||||||
|
return True
|
||||||
|
|
||||||
|
def delete(self, id):
|
||||||
|
id_str = str(id)
|
||||||
|
if id_str not in self:
|
||||||
|
return False
|
||||||
|
self.pop(id_str)
|
||||||
|
self.save()
|
||||||
|
return True
|
||||||
|
|
||||||
|
def list(self):
|
||||||
|
return list(self.keys())
|
||||||