Files
excalidraw-mcp-sentinel/frontend/index.html
T
63209f9d5a feat: add test suite, CI/CD pipeline, setup wizard, and upstream feature ports (#6)
Establish comprehensive quality infrastructure for a project that previously
had zero tests, enabling confident refactoring and community contributions
with automated guardrails. Port upstream enhancements for font normalization,
image element support, and arrow binding preservation.

🏗️ Testing infrastructure:
- Unit tests for SQLite persistence layer and element validation helpers
- Integration tests for REST API, WebSocket broadcast, and arrow binding
- E2E tests with Playwright for canvas rendering and real-time sync
- Vitest + Playwright configuration with proper isolation

👷 CI/CD pipeline:
- Auto-versioning from conventional commits on push to main
- Auto-publish to NPM and Docker Hub on GitHub release
- Matrix testing across Node 18/20/22 with pinned dependencies
- Docker health check with diagnostic logging on failure
- Preserve rollup status checks for branch protection gates

📦 Developer experience:
- Interactive setup wizard for first-time configuration
- Canvas clear confirmation and scene description tools
- Frontend helpers extracted for testability

🔧 Upstream feature ports:
- Font family normalization (string names to numeric IDs)
- Image element support with file management API
- Arrow binding preservation through server round-trips
- Vite config fix for font subsetting worker chunk names
- Idempotent database initialization for standalone Docker mode

🐛 Docker fixes:
- Set EXCALIDRAW_DB_PATH in both Dockerfiles to writable /app/data/
- Make initDb() idempotent and closeDb() reset-safe for test isolation

🎯 Provides the safety net needed for rapid iteration — every PR is
validated across 120 test cases before merge, and releases are fully
automated from commit to published package.

Co-authored-by: sanjibdevnathlabs <devnath.sanjib@gmail.com>
2026-03-13 12:08:07 +05:30

465 lines
12 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Excalidraw POC - Backend API Integration</title>
<style>
body {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
background-color: #f5f5f5;
}
.header {
position: relative;
background: #fff;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
padding: 10px 20px;
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
gap: 10px;
}
.header h1 {
margin: 0;
color: #333;
font-size: 24px;
}
.controls {
display: flex;
gap: 10px;
flex-wrap: wrap;
}
button {
padding: 8px 16px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
transition: background-color 0.2s;
}
.btn-primary {
background-color: #007bff;
color: white;
}
.btn-primary:hover {
background-color: #0056b3;
}
.btn-secondary {
background-color: #6c757d;
color: white;
}
.btn-secondary:hover {
background-color: #545b62;
}
.btn-success {
background-color: #28a745;
color: white;
}
.btn-success:hover {
background-color: #218838;
}
.btn-danger {
background-color: #dc3545;
color: white;
}
.btn-danger:hover {
background-color: #c82333;
}
.status {
display: flex;
align-items: center;
gap: 8px;
font-size: 14px;
}
.status-dot {
width: 8px;
height: 8px;
border-radius: 50%;
}
.status-connected {
background-color: #28a745;
}
.status-disconnected {
background-color: #dc3545;
}
.canvas-container {
height: calc(100vh - 80px);
width: 100%;
position: relative;
}
.api-panel {
position: fixed;
right: 20px;
top: 100px;
background: white;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
padding: 20px;
width: 300px;
max-height: 400px;
overflow-y: auto;
z-index: 1000;
}
.api-panel h3 {
margin: 0 0 15px 0;
color: #333;
font-size: 18px;
}
.api-form {
display: flex;
flex-direction: column;
gap: 10px;
}
.form-group {
display: flex;
flex-direction: column;
gap: 5px;
}
label {
font-weight: 500;
color: #555;
font-size: 14px;
}
input, select {
padding: 8px;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 14px;
}
.form-row {
display: flex;
gap: 10px;
}
.form-row .form-group {
flex: 1;
}
.toggle-panel {
position: fixed;
right: 20px;
top: 60px;
background: #007bff;
color: white;
border: none;
border-radius: 4px;
padding: 10px;
cursor: pointer;
font-size: 14px;
z-index: 1001;
}
.api-panel.hidden {
display: none;
}
.notification {
position: fixed;
top: 20px;
right: 20px;
padding: 12px 16px;
border-radius: 4px;
color: white;
font-size: 14px;
z-index: 1002;
animation: slideIn 0.3s ease;
}
.notification.success {
background-color: #28a745;
}
.notification.error {
background-color: #dc3545;
}
@keyframes slideIn {
from {
transform: translateX(100%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
.element-count {
font-size: 14px;
color: #666;
}
.loading {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
font-size: 16px;
color: #666;
}
.loading-content {
text-align: center;
}
.loading-content div:first-child {
margin-bottom: 10px;
}
/* Button group — joined buttons with shared style */
.btn-group {
display: inline-flex;
border-radius: 6px;
overflow: hidden;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.btn-group .btn-group-item {
border-radius: 0;
border: none;
padding: 8px 14px;
font-size: 13px;
font-weight: 500;
background: #4caf50;
color: #fff;
transition: background 0.2s;
border-right: 1px solid rgba(255,255,255,0.18);
}
.btn-group .btn-group-item:last-child { border-right: none; }
.btn-group .btn-group-item:hover:not(:disabled) { background: #43a047; }
.btn-group .btn-group-item:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-group .btn-group-item.btn-group-busy { opacity: 0.7; cursor: wait; }
/* Floating toast — centered in the header */
.toast {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
background: #333;
color: #fff;
font-size: 13px;
font-weight: 500;
padding: 5px 16px;
border-radius: 999px;
pointer-events: none;
white-space: nowrap;
animation: toast-in 0.25s ease, toast-out 0.4s ease 1.6s forwards;
z-index: 10;
}
@keyframes toast-in {
from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes toast-out {
from { opacity: 1; }
to { opacity: 0; }
}
/* Header left group */
.header-left {
display: flex;
align-items: center;
gap: 10px;
}
.header-left h1 { margin: 0; color: #333; font-size: 24px; }
/* Clickable tenant badge — opens workspace switcher */
.tenant-badge-btn {
font-size: 12px;
font-weight: 600;
background: #e9ecef;
color: #495057;
padding: 4px 12px;
border-radius: 999px;
white-space: nowrap;
max-width: 200px;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
border: 1px solid transparent;
transition: background 0.15s, border-color 0.15s;
}
.tenant-badge-btn:hover {
background: #dee2e6;
border-color: #ced4da;
}
.tenant-label {
color: #868e96;
font-weight: 400;
}
/* Menu overlay + panel */
.menu-overlay {
position: fixed;
inset: 0;
background: rgba(0,0,0,0.15);
z-index: 2000;
}
.menu-panel {
position: absolute;
top: 56px;
left: 100px;
width: 320px;
max-height: calc(100vh - 80px);
background: #fff;
border-radius: 10px;
box-shadow: 0 8px 30px rgba(0,0,0,0.18);
overflow: hidden;
display: flex;
flex-direction: column;
}
.menu-header {
padding: 14px 16px 10px;
font-size: 13px;
font-weight: 700;
color: #888;
text-transform: uppercase;
letter-spacing: 0.5px;
border-bottom: 1px solid #f0f0f0;
}
.menu-search-wrap {
padding: 8px 10px 4px;
}
.menu-search {
width: 100%;
padding: 7px 10px;
font-size: 13px;
border: 1px solid #ddd;
border-radius: 6px;
outline: none;
box-sizing: border-box;
transition: border-color 0.15s;
}
.menu-search:focus {
border-color: #4caf50;
}
.menu-list {
overflow-y: auto;
max-height: 320px;
padding: 6px;
}
.menu-item {
display: flex;
flex-direction: column;
align-items: flex-start;
width: 100%;
padding: 10px 12px;
border: none;
background: none;
border-radius: 6px;
cursor: pointer;
text-align: left;
font-size: 14px;
position: relative;
transition: background 0.15s;
}
.menu-item:hover { background: #f5f5f5; }
.menu-item-active { background: #e8f5e9; }
.menu-item-active:hover { background: #c8e6c9; }
.menu-item-name {
font-weight: 600;
color: #333;
}
.menu-item-path {
font-size: 11px;
color: #999;
margin-top: 2px;
word-break: break-all;
}
.menu-item-check {
position: absolute;
right: 12px;
top: 50%;
transform: translateY(-50%);
color: #4caf50;
font-weight: 700;
font-size: 16px;
}
.menu-empty {
padding: 20px;
text-align: center;
color: #aaa;
font-size: 13px;
}
/* Clear canvas confirmation dialog */
.confirm-dialog {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 360px;
background: #fff;
border-radius: 12px;
box-shadow: 0 12px 40px rgba(0,0,0,0.22);
padding: 24px;
}
.confirm-title {
font-size: 18px;
font-weight: 700;
color: #333;
margin-bottom: 8px;
}
.confirm-msg {
font-size: 14px;
color: #666;
margin: 0 0 16px;
line-height: 1.4;
}
.confirm-checkbox-label {
display: flex;
align-items: center;
gap: 8px;
font-size: 13px;
color: #555;
cursor: pointer;
margin-bottom: 20px;
font-weight: 400;
}
.confirm-checkbox-label input[type="checkbox"] {
width: 16px;
height: 16px;
cursor: pointer;
}
.confirm-actions {
display: flex;
justify-content: flex-end;
gap: 10px;
}
</style>
</head>
<body>
<div id="root"></div>
<script type="module" src="./src/main.tsx"></script>
</body>
</html>