feat(vwb-v3): Architecture Thin Client fonctionnelle

API = Source de vérité unique (SQLite + Flask)
- Backend: API v3 avec session, workflow, capture, execute
- Frontend: Vanilla TypeScript, pas de state local
- Contrats stricts pour les actions RPA
- Drag & drop pour réorganiser les étapes
- Insertion d'étapes entre deux existantes
- Bibliothèque de captures (sessionStorage)
- Exécution avec coordonnées statiques (pyautogui)

Fonctionne mais fragile (coordonnées fixes, pas de détection visuelle)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Dom
2026-01-23 12:07:13 +01:00
parent a9a53991bc
commit 858e6007f9
23 changed files with 6813 additions and 6 deletions

View File

@@ -0,0 +1,830 @@
/* VWB v3 - Thin Client Styles */
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: #1a1a2e;
color: #eee;
min-height: 100vh;
}
header {
background: #16213e;
padding: 1rem 2rem;
display: flex;
align-items: center;
gap: 1rem;
border-bottom: 1px solid #0f3460;
}
header h1 {
font-size: 1.5rem;
font-weight: 600;
}
.badge {
background: #e94560;
color: white;
padding: 0.25rem 0.75rem;
border-radius: 1rem;
font-size: 0.75rem;
font-weight: 500;
}
main {
display: grid;
grid-template-columns: 220px 1fr 320px 300px;
gap: 1rem;
padding: 1rem;
height: calc(100vh - 60px);
overflow: hidden;
}
.sidebar {
display: flex;
flex-direction: column;
gap: 1rem;
}
.panel {
background: #16213e;
border-radius: 8px;
padding: 1rem;
border: 1px solid #0f3460;
}
.panel h2 {
font-size: 1rem;
margin-bottom: 1rem;
color: #94a3b8;
text-transform: uppercase;
letter-spacing: 0.05em;
}
/* Formulaire création workflow */
#create-workflow-form {
display: flex;
gap: 0.5rem;
margin-bottom: 1rem;
}
#create-workflow-form input {
flex: 1;
padding: 0.5rem;
border: 1px solid #0f3460;
border-radius: 4px;
background: #1a1a2e;
color: #eee;
}
#create-workflow-form button {
padding: 0.5rem 1rem;
background: #e94560;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
/* Liste workflows */
#workflow-list {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.workflow-item {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.75rem;
background: #1a1a2e;
border-radius: 4px;
cursor: pointer;
transition: background 0.2s;
}
.workflow-item:hover {
background: #0f3460;
}
.workflow-item.active {
background: #0f3460;
border-left: 3px solid #e94560;
}
.workflow-item .name {
flex: 1;
font-weight: 500;
}
.workflow-item .count {
font-size: 0.75rem;
color: #94a3b8;
}
.workflow-item .delete-btn {
background: transparent;
border: none;
color: #94a3b8;
cursor: pointer;
font-size: 1.25rem;
line-height: 1;
padding: 0 0.25rem;
}
.workflow-item .delete-btn:hover {
color: #e94560;
}
/* Zone centrale */
.main-content {
display: flex;
flex-direction: column;
gap: 1rem;
overflow: hidden;
min-width: 0;
}
/* Section capture */
.capture-section {
display: flex;
flex-direction: column;
overflow: hidden;
}
.capture-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 0.75rem;
}
.capture-header h4 {
margin: 0;
color: #94a3b8;
}
.toggle-btn {
padding: 0.25rem 0.5rem;
background: #0f3460;
color: #94a3b8;
border: 1px solid #1a5276;
border-radius: 4px;
cursor: pointer;
font-size: 0.75rem;
}
.toggle-btn:hover {
background: #1a5276;
}
#capture-content {
flex: 1;
overflow-y: auto;
}
#capture-content.collapsed {
display: none;
}
.toolbar {
background: #16213e;
padding: 1rem;
border-radius: 8px;
border: 1px solid #0f3460;
}
.toolbar h3 {
margin-bottom: 1rem;
}
#action-buttons {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.action-btn {
padding: 0.5rem 1rem;
background: #0f3460;
color: white;
border: 1px solid #1a5276;
border-radius: 4px;
cursor: pointer;
font-size: 0.875rem;
transition: all 0.2s;
}
.action-btn:hover {
background: #1a5276;
border-color: #2471a3;
}
/* Liste des étapes */
.steps-container {
background: #16213e;
border-radius: 8px;
padding: 1rem;
border: 1px solid #0f3460;
flex: 1;
overflow-y: auto;
min-height: 200px;
}
.steps-container h4 {
margin-bottom: 1rem;
color: #94a3b8;
position: sticky;
top: 0;
background: #16213e;
padding-bottom: 0.5rem;
}
#steps-list {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.step-item {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.75rem;
background: #1a1a2e;
border-radius: 4px;
cursor: pointer;
transition: all 0.2s;
border: 2px solid transparent;
}
.step-item:hover {
background: #0f3460;
}
.step-item.selected {
border-color: #e94560;
background: #0f3460;
}
.step-item .order {
width: 24px;
height: 24px;
background: #0f3460;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.75rem;
font-weight: 600;
}
.step-item .type {
font-weight: 500;
color: #3498db;
}
.step-item .label {
flex: 1;
color: #94a3b8;
font-size: 0.875rem;
}
.step-item .anchor-badge {
font-size: 0.625rem;
background: #27ae60;
color: white;
padding: 0.125rem 0.5rem;
border-radius: 1rem;
}
/* Drag & Drop */
.step-item .drag-handle {
cursor: grab;
color: #64748b;
font-size: 1rem;
padding: 0 0.25rem;
user-select: none;
}
.step-item .drag-handle:hover {
color: #94a3b8;
}
.step-item .drag-handle:active {
cursor: grabbing;
}
.step-item.dragging {
opacity: 0.5;
border: 2px dashed #3498db;
}
.step-item.drag-over {
border-top: 3px solid #e94560;
margin-top: -3px;
}
.step-item[draggable="true"] {
cursor: default;
}
/* Bouton d'insertion entre les étapes */
.insert-step-btn {
display: flex;
align-items: center;
justify-content: center;
height: 20px;
margin: 2px 0;
cursor: pointer;
opacity: 0.3;
transition: opacity 0.2s;
}
.insert-step-btn:hover {
opacity: 1;
}
.insert-step-btn .insert-icon {
width: 20px;
height: 20px;
background: #3498db;
color: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
font-weight: bold;
}
.insert-step-btn:hover .insert-icon {
background: #2980b9;
transform: scale(1.1);
}
/* Menu contextuel d'insertion */
.insert-menu {
background: #16213e;
border: 1px solid #0f3460;
border-radius: 8px;
padding: 0.5rem;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
z-index: 100;
min-width: 180px;
}
.insert-menu-header {
font-size: 0.75rem;
color: #94a3b8;
padding: 0.25rem 0.5rem;
margin-bottom: 0.25rem;
}
.insert-menu-item {
display: block;
width: 100%;
padding: 0.5rem 0.75rem;
background: transparent;
border: none;
color: #eee;
text-align: left;
cursor: pointer;
border-radius: 4px;
font-size: 0.875rem;
}
.insert-menu-item:hover {
background: #0f3460;
}
/* Zone capture */
.capture-zone {
background: #16213e;
border-radius: 8px;
padding: 1rem;
border: 1px solid #0f3460;
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
}
.capture-btn {
padding: 0.75rem 1.5rem;
background: #27ae60;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 1rem;
margin-bottom: 1rem;
}
.capture-btn:hover {
background: #2ecc71;
}
#capture-preview {
margin-top: 1rem;
}
#capture-preview .capture-container {
position: relative;
display: inline-block;
max-width: 100%;
overflow: hidden;
}
#capture-preview img {
max-width: 100%;
max-height: 250px;
border-radius: 4px;
display: block;
cursor: crosshair;
object-fit: contain;
}
#selection-overlay {
position: absolute;
border: 2px dashed #e94560;
background: rgba(233, 69, 96, 0.3);
pointer-events: none;
display: none;
z-index: 10;
}
.capture-info {
margin-top: 0.5rem;
font-size: 0.75rem;
color: #94a3b8;
}
.capture-hint {
font-size: 0.8rem;
color: #94a3b8;
margin-bottom: 1rem;
}
.capture-zone h4 {
margin-bottom: 0.75rem;
color: #94a3b8;
}
.capture-controls {
display: flex;
flex-wrap: wrap;
gap: 0.75rem;
margin-bottom: 1rem;
align-items: center;
}
.timer-control {
display: flex;
align-items: center;
gap: 0.5rem;
}
.timer-control label {
font-size: 0.875rem;
color: #94a3b8;
}
.timer-control select {
padding: 0.5rem;
background: #1a1a2e;
border: 1px solid #0f3460;
border-radius: 4px;
color: #eee;
}
.capture-btn.secondary {
background: #3498db;
}
.capture-btn.secondary:hover {
background: #2980b9;
}
.timer-countdown {
font-size: 3rem;
font-weight: bold;
text-align: center;
color: #e94560;
padding: 2rem;
animation: pulse 1s infinite;
}
.timer-countdown.hidden {
display: none;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
.fullscreen-btn {
margin-top: 0.5rem;
padding: 0.5rem 1rem;
background: #0f3460;
color: white;
border: 1px solid #1a5276;
border-radius: 4px;
cursor: pointer;
}
.fullscreen-btn:hover {
background: #1a5276;
}
.fullscreen-btn.hidden {
display: none;
}
/* Bibliothèque de captures */
.capture-library {
background: #1a1a2e;
border-radius: 4px;
padding: 0.75rem;
margin-top: 0.75rem;
max-height: 120px;
overflow-y: auto;
}
.capture-library h5 {
margin-bottom: 0.5rem;
color: #94a3b8;
font-size: 0.8rem;
display: flex;
align-items: center;
gap: 0.5rem;
}
#library-count {
font-size: 0.75rem;
color: #64748b;
}
#capture-library-list {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.library-item {
position: relative;
cursor: pointer;
border: 2px solid transparent;
border-radius: 4px;
transition: border-color 0.2s;
}
.library-item:hover {
border-color: #3498db;
}
.library-item.selected {
border-color: #e94560;
}
.library-item img {
width: 60px;
height: 45px;
object-fit: cover;
border-radius: 2px;
}
.library-item .delete-lib {
position: absolute;
top: -8px;
right: -8px;
width: 20px;
height: 20px;
background: #e74c3c;
color: white;
border: none;
border-radius: 50%;
cursor: pointer;
font-size: 12px;
line-height: 1;
display: none;
}
.library-item:hover .delete-lib {
display: block;
}
/* Modal plein écran */
.fullscreen-modal {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.95);
z-index: 1000;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.fullscreen-modal.hidden {
display: none;
}
.fullscreen-modal .close-btn {
position: absolute;
top: 20px;
right: 20px;
padding: 0.75rem 1.5rem;
background: #e74c3c;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 1rem;
z-index: 1001;
}
.fullscreen-modal .modal-content {
position: relative;
max-width: 95vw;
max-height: 90vh;
}
.fullscreen-modal img {
max-width: 100%;
max-height: 85vh;
cursor: crosshair;
}
.fullscreen-modal #fullscreen-overlay {
position: absolute;
border: 3px dashed #e94560;
background: rgba(233, 69, 96, 0.3);
pointer-events: none;
display: none;
}
.fullscreen-modal .instructions {
color: #94a3b8;
margin-top: 1rem;
text-align: center;
}
/* Panneau étape sélectionnée */
#selected-step {
font-size: 0.875rem;
}
.step-details h4 {
margin-bottom: 0.75rem;
color: #3498db;
}
.step-details p {
margin-bottom: 0.5rem;
}
.params-form {
margin-top: 1rem;
}
.params-form label {
display: block;
margin-bottom: 0.75rem;
}
.params-form input {
width: 100%;
padding: 0.5rem;
margin-top: 0.25rem;
background: #1a1a2e;
border: 1px solid #0f3460;
border-radius: 4px;
color: #eee;
}
.params-form button {
padding: 0.5rem 1rem;
background: #3498db;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
}
.anchor-info {
margin-top: 1rem;
padding: 0.75rem;
background: #1a1a2e;
border-radius: 4px;
}
.anchor-info h5 {
margin-bottom: 0.5rem;
color: #27ae60;
}
.anchor-thumb {
max-width: 100%;
border-radius: 4px;
margin: 0.5rem 0;
}
.need-anchor {
margin-top: 1rem;
padding: 0.75rem;
background: rgba(231, 76, 60, 0.2);
border: 1px solid #e74c3c;
border-radius: 4px;
}
.warning {
color: #e74c3c;
margin-bottom: 0.5rem;
}
/* Panneau exécution */
#execution-status {
font-size: 0.875rem;
}
.exec-info {
margin-bottom: 1rem;
}
.status {
font-weight: 600;
margin-bottom: 0.5rem;
}
.status-running { color: #3498db; }
.status-paused { color: #f39c12; }
.status-completed { color: #27ae60; }
.status-error { color: #e74c3c; }
.status-cancelled { color: #95a5a6; }
.progress-bar {
height: 8px;
background: #1a1a2e;
border-radius: 4px;
overflow: hidden;
margin: 0.5rem 0;
}
.progress {
height: 100%;
background: #3498db;
transition: width 0.3s;
}
.progress-text {
font-size: 0.75rem;
color: #94a3b8;
}
.exec-buttons {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
}
.exec-buttons button {
padding: 0.5rem 1rem;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 0.875rem;
}
.exec-buttons .primary {
background: #27ae60;
color: white;
}
.exec-buttons .danger {
background: #e74c3c;
color: white;
}
/* Utilitaires */
.empty {
color: #94a3b8;
font-style: italic;
text-align: center;
padding: 1rem;
}
.error {
color: #e74c3c;
font-size: 0.875rem;
}