Restyle New QC Sheet GUI to OmniRoute visual language (#25)
Some checks failed
Mirror to Gitea / mirror (push) Has been cancelled
Some checks failed
Mirror to Gitea / mirror (push) Has been cancelled
* Restyle New QC Sheet GUI to match OmniRoute visual language.
Dark graph-paper canvas, coral-to-violet tokens, traffic-light card chrome, and a terminal-style status panel replace the teal Material form while keeping the Set/Ink/Serial workflow and pywebview bridge.
Co-authored-by: Diaco Soltanpour <s-diaco@users.noreply.github.com>
* Flatten GUI chrome so the form sits on the graph-paper canvas.
Remove the nested traffic-light window, drop desktop/demo.html, and keep
the OmniRoute grid visible behind the operator form in both themes.
Co-authored-by: Diaco Soltanpour <s-diaco@users.noreply.github.com>
* Stop the form panel from stretching so the graph-paper canvas shows through.
Co-authored-by: Diaco Soltanpour <s-diaco@users.noreply.github.com>
* Make floating field labels transparent so the grid shows through.
Co-authored-by: Diaco Soltanpour <s-diaco@users.noreply.github.com>
* Set field-label backgrounds to 50% opacity of the canvas color.
Co-authored-by: Diaco Soltanpour <s-diaco@users.noreply.github.com>
* Float field labels on focus or value, Material outlined style.
Empty labels sit inside the box; they move up to the border when the
field is focused or has a value.
Co-authored-by: Diaco Soltanpour <s-diaco@users.noreply.github.com>
* Revert "Float field labels on focus or value, Material outlined style."
This reverts commit 757781f7a0.
* Sit field labels just above the boxes, clear of the border.
Co-authored-by: Diaco Soltanpour <s-diaco@users.noreply.github.com>
* Give field labels more clearance above the input borders.
Co-authored-by: Diaco Soltanpour <s-diaco@users.noreply.github.com>
* Place field labels in document flow above the inputs.
Co-authored-by: Diaco Soltanpour <s-diaco@users.noreply.github.com>
* Sync the ink combobox text as soon as the set's ink list rebuilds.
Previously the visible value stayed on the old ink until the box was
clicked, because rebuild only copied the select when the input was empty.
Co-authored-by: Diaco Soltanpour <s-diaco@users.noreply.github.com>
* Reopen combobox on input mousedown after selection.
Selecting an option closes the list without blurring the input, so a later
click never fires focus. Open the panel on mousedown as well.
Co-authored-by: Diaco Soltanpour <s-diaco@users.noreply.github.com>
* Require the combobox mousedown handler to call open().
The previous substring only checked that a mousedown listener exists.
Co-authored-by: Diaco Soltanpour <s-diaco@users.noreply.github.com>
---------
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Diaco Soltanpour <s-diaco@users.noreply.github.com>
This commit is contained in:
@@ -1,157 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>New QC Sheet · 0.2.0</title>
|
||||
<!--
|
||||
Static UI mock of src/xlsx_clean/web_app.py (_build_page).
|
||||
Demo only — no create-datasheet behavior.
|
||||
-->
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<script>
|
||||
tailwind.config = {
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
primary: "#0f766e",
|
||||
secondary: "#115e59",
|
||||
accent: "#14b8a6",
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
body {
|
||||
font-family: Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
background: #f8fafc;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.field {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
.field label {
|
||||
position: absolute;
|
||||
top: -0.55rem;
|
||||
left: 0.75rem;
|
||||
padding: 0 0.25rem;
|
||||
font-size: 0.75rem;
|
||||
line-height: 1;
|
||||
color: #0f766e;
|
||||
background: #fff;
|
||||
z-index: 1;
|
||||
}
|
||||
.field select,
|
||||
.field input {
|
||||
width: 100%;
|
||||
appearance: none;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 0.25rem;
|
||||
background: #fff;
|
||||
padding: 0.85rem 2.25rem 0.85rem 0.85rem;
|
||||
font-size: 1rem;
|
||||
color: #0f172a;
|
||||
outline: none;
|
||||
}
|
||||
.field select:focus,
|
||||
.field input:focus {
|
||||
border-color: #0f766e;
|
||||
box-shadow: inset 0 0 0 1px #0f766e;
|
||||
}
|
||||
.field .chevron {
|
||||
pointer-events: none;
|
||||
position: absolute;
|
||||
right: 0.85rem;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
color: #64748b;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
.btn-primary {
|
||||
width: 100%;
|
||||
border: none;
|
||||
border-radius: 0.25rem;
|
||||
background: #0f766e;
|
||||
color: #fff;
|
||||
font-size: 0.95rem;
|
||||
font-weight: 500;
|
||||
letter-spacing: 0.02em;
|
||||
text-transform: uppercase;
|
||||
padding: 0.7rem 1rem;
|
||||
cursor: default;
|
||||
}
|
||||
.btn-primary:hover {
|
||||
background: #115e59;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main class="w-full max-w-xl mx-auto p-6 flex flex-col gap-4">
|
||||
<h1 class="text-3xl font-bold text-teal-800 m-0">New QC Sheet</h1>
|
||||
<p class="text-gray-600 m-0">
|
||||
Create a new QC datasheet from the latest matching workbook.
|
||||
</p>
|
||||
|
||||
<div class="field">
|
||||
<label>Select Set</label>
|
||||
<select aria-label="Select Set" tabindex="-1">
|
||||
<option selected>Kimia Razi</option>
|
||||
<option>inco</option>
|
||||
</select>
|
||||
<span class="chevron" aria-hidden="true">▾</span>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label>Select Ink Color</label>
|
||||
<select aria-label="Select Ink Color" tabindex="-1">
|
||||
<option selected>KRCY1100T Blue</option>
|
||||
<option>KRBK1300T Black</option>
|
||||
<option>KRBK1314T Black</option>
|
||||
<option>KRBR1200T Brown</option>
|
||||
<option>KRBG1600T Beige</option>
|
||||
<option>KRHN1700T Honey</option>
|
||||
<option>KRPK1500T Pink</option>
|
||||
</select>
|
||||
<span class="chevron" aria-hidden="true">▾</span>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label>Serial:</label>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="e.g. 1234/A"
|
||||
value=""
|
||||
aria-label="Serial"
|
||||
tabindex="-1"
|
||||
readonly
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label>Backend</label>
|
||||
<select aria-label="Backend" tabindex="-1">
|
||||
<option selected>ooxml</option>
|
||||
<option>com</option>
|
||||
</select>
|
||||
<span class="chevron" aria-hidden="true">▾</span>
|
||||
</div>
|
||||
|
||||
<p class="text-sm text-amber-700 m-0">
|
||||
COM backend requires Windows with Microsoft Excel; use ooxml here.
|
||||
</p>
|
||||
|
||||
<div class="w-full p-3 rounded bg-gray-50 text-slate-700">
|
||||
Ready.
|
||||
</div>
|
||||
|
||||
<button type="button" class="btn-primary" tabindex="-1">
|
||||
Create datasheet
|
||||
</button>
|
||||
|
||||
<p class="w-full text-right text-xs text-gray-400 m-0">v0.2.0</p>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -130,7 +130,7 @@ def main(argv: list[str] | None = None) -> None:
|
||||
width=args.width,
|
||||
height=args.height,
|
||||
min_size=(450, 400),
|
||||
background_color="#f8fafc",
|
||||
background_color="#0b0e14",
|
||||
)
|
||||
webview.start()
|
||||
|
||||
|
||||
@@ -4,6 +4,15 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>New QC Sheet</title>
|
||||
<script>
|
||||
try {
|
||||
if (localStorage.getItem("xlsx-clean-theme") === "light") {
|
||||
document.documentElement.setAttribute("data-theme", "light");
|
||||
}
|
||||
} catch (error) {
|
||||
/* localStorage may be unavailable in some WebView embeds */
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: "Inter";
|
||||
@@ -22,17 +31,55 @@
|
||||
}
|
||||
|
||||
:root {
|
||||
--primary: #0f766e;
|
||||
--secondary: #115e59;
|
||||
--accent: #14b8a6;
|
||||
--slate-50: #f8fafc;
|
||||
--slate-300: #cbd5e1;
|
||||
--slate-500: #64748b;
|
||||
--slate-700: #334155;
|
||||
--status-ready: #f8fafc;
|
||||
--status-success: #f0fdfa;
|
||||
--status-skipped: #fffbeb;
|
||||
--status-error: #fef2f2;
|
||||
--primary: #e54d5e;
|
||||
--primary-hover: #c93d4e;
|
||||
--accent: #6366f1;
|
||||
--accent-2: #8b5cf6;
|
||||
--accent-3: #a855f7;
|
||||
--success: #22c55e;
|
||||
--warning: #f59e0b;
|
||||
--error: #ef4444;
|
||||
--bg: #0b0e14;
|
||||
--bg-alt: #111520;
|
||||
--surface: #161b22;
|
||||
--surface-2: #1c2230;
|
||||
--border: rgba(255, 255, 255, 0.08);
|
||||
--border-strong: rgba(255, 255, 255, 0.14);
|
||||
--grid-line: rgba(255, 255, 255, 0.06);
|
||||
--grid-size: 32px;
|
||||
--text: #e6e6ef;
|
||||
--text-muted: #8b8b9e;
|
||||
--text-dim: #5a5a6e;
|
||||
--grad-brand: linear-gradient(135deg, var(--primary), var(--accent-3));
|
||||
--grad-soft: linear-gradient(135deg, rgba(229, 77, 94, 0.12), rgba(168, 85, 247, 0.12));
|
||||
--font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
|
||||
--font-mono: ui-monospace, "JetBrains Mono", "Fira Code", "SF Mono", monospace;
|
||||
--radius: 14px;
|
||||
--radius-sm: 9px;
|
||||
--ease: cubic-bezier(0.22, 1, 0.36, 1);
|
||||
--status-ready: transparent;
|
||||
--status-success: rgba(34, 197, 94, 0.12);
|
||||
--status-skipped: rgba(245, 158, 11, 0.12);
|
||||
--status-error: rgba(239, 68, 68, 0.12);
|
||||
--label-bg: rgba(11, 14, 20, 0.5);
|
||||
}
|
||||
|
||||
html[data-theme="light"] {
|
||||
--bg: #f9f9fb;
|
||||
--bg-alt: #f0f0f5;
|
||||
--surface: #ffffff;
|
||||
--surface-2: #f5f5fa;
|
||||
--border: rgba(0, 0, 0, 0.08);
|
||||
--border-strong: rgba(0, 0, 0, 0.14);
|
||||
--grid-line: rgba(0, 0, 0, 0.07);
|
||||
--text: #1a1a2e;
|
||||
--text-muted: #71717a;
|
||||
--text-dim: #9a9aa5;
|
||||
--grad-soft: linear-gradient(135deg, rgba(229, 77, 94, 0.08), rgba(168, 85, 247, 0.08));
|
||||
--status-success: rgba(34, 197, 94, 0.1);
|
||||
--status-skipped: rgba(245, 158, 11, 0.12);
|
||||
--status-error: rgba(239, 68, 68, 0.1);
|
||||
--label-bg: rgba(249, 249, 251, 0.5);
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
@@ -40,10 +87,24 @@
|
||||
body {
|
||||
min-height: 100vh;
|
||||
margin: 0;
|
||||
background: var(--slate-50);
|
||||
color: var(--slate-700);
|
||||
font-family: "Inter", sans-serif;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font-family: var(--font-sans);
|
||||
font-size: 15px;
|
||||
line-height: 1.5;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
body::before {
|
||||
content: "";
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: -1;
|
||||
pointer-events: none;
|
||||
background-image:
|
||||
linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
|
||||
linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
|
||||
background-size: var(--grid-size) var(--grid-size);
|
||||
}
|
||||
|
||||
.page {
|
||||
@@ -54,23 +115,72 @@
|
||||
|
||||
.panel {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
width: min(100%, 36rem);
|
||||
margin: auto;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.heading-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.theme-toggle {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
min-width: 52px;
|
||||
height: 28px;
|
||||
margin-top: 2px;
|
||||
padding: 0 8px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--surface-2);
|
||||
color: var(--text);
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
font-size: 0.7rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.theme-toggle:hover {
|
||||
background: var(--bg-alt);
|
||||
border-color: var(--border-strong);
|
||||
}
|
||||
|
||||
.theme-toggle:focus-visible {
|
||||
outline: 2px solid var(--accent-3);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.eyebrow {
|
||||
margin: 0 0 8px;
|
||||
color: var(--primary);
|
||||
font-size: 0.75rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
color: var(--secondary);
|
||||
color: var(--text);
|
||||
font-size: 1.875rem;
|
||||
font-weight: 700;
|
||||
line-height: 2.25rem;
|
||||
line-height: 1.15;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
margin: 8px 0 24px;
|
||||
color: #475569;
|
||||
margin: 8px 0 22px;
|
||||
color: var(--text-muted);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
@@ -78,34 +188,35 @@
|
||||
|
||||
.field {
|
||||
position: relative;
|
||||
display: block;
|
||||
padding-top: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.field-label {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
top: 0;
|
||||
left: 11px;
|
||||
margin-left: 4px;
|
||||
padding: 0 4px;
|
||||
background: var(--slate-50);
|
||||
background: var(--label-bg);
|
||||
color: var(--primary);
|
||||
font-size: 0.75rem;
|
||||
line-height: 1rem;
|
||||
line-height: 1.2;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
select, input {
|
||||
width: 100%;
|
||||
align-self: stretch;
|
||||
min-height: 54px;
|
||||
padding: 16px 12px 6px;
|
||||
border: 1px solid var(--slate-300);
|
||||
border-radius: 4px;
|
||||
padding: 16px 12px;
|
||||
border: 1px solid var(--border-strong);
|
||||
border-radius: var(--radius-sm);
|
||||
outline: none;
|
||||
background: #fff;
|
||||
color: #0f172a;
|
||||
background: var(--surface-2);
|
||||
color: var(--text);
|
||||
font: inherit;
|
||||
transition: border-color 150ms ease, box-shadow 150ms ease;
|
||||
transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
|
||||
}
|
||||
|
||||
.combobox-input {
|
||||
@@ -130,12 +241,12 @@
|
||||
|
||||
.combobox-caret {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 12px;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: var(--slate-500);
|
||||
height: 54px;
|
||||
color: var(--text-muted);
|
||||
pointer-events: none;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
@@ -149,10 +260,10 @@
|
||||
max-height: 220px;
|
||||
overflow-y: auto;
|
||||
padding: 4px 0;
|
||||
background: #fff;
|
||||
border: 1px solid var(--slate-300);
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 4px 12px rgb(15 23 42 / 12%);
|
||||
background: var(--surface-2);
|
||||
border: 1px solid var(--border-strong);
|
||||
border-radius: var(--radius-sm);
|
||||
box-shadow: 0 12px 32px rgb(0 0 0 / 35%);
|
||||
}
|
||||
|
||||
.combobox-panel[hidden] { display: none; }
|
||||
@@ -160,49 +271,49 @@
|
||||
.combobox-option {
|
||||
padding: 8px 12px;
|
||||
cursor: pointer;
|
||||
color: var(--slate-700);
|
||||
color: var(--text);
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
.combobox-option[aria-selected="true"],
|
||||
.combobox-option:hover {
|
||||
background: var(--status-success);
|
||||
color: var(--secondary);
|
||||
background: var(--grad-soft);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.combobox-option[hidden] { display: none; }
|
||||
|
||||
.combobox-empty {
|
||||
padding: 8px 12px;
|
||||
color: var(--slate-500);
|
||||
color: var(--text-muted);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
select:focus, input:focus,
|
||||
.combobox-input:focus {
|
||||
border-color: var(--primary);
|
||||
box-shadow: 0 0 0 2px rgb(20 184 166 / 25%);
|
||||
border-color: var(--accent);
|
||||
box-shadow: 0 0 0 3px rgb(99 102 241 / 28%);
|
||||
}
|
||||
|
||||
select:disabled, input:disabled,
|
||||
.combobox-input:disabled {
|
||||
cursor: not-allowed;
|
||||
background: #f1f5f9;
|
||||
color: var(--slate-500);
|
||||
background: var(--bg-alt);
|
||||
color: var(--text-dim);
|
||||
}
|
||||
|
||||
.divider {
|
||||
height: 1px;
|
||||
margin: 24px 0;
|
||||
background: var(--slate-300);
|
||||
margin: 22px 0;
|
||||
background: var(--border);
|
||||
}
|
||||
|
||||
button {
|
||||
#create-button {
|
||||
width: 100%;
|
||||
min-height: 42px;
|
||||
min-height: 44px;
|
||||
border: 0;
|
||||
border-radius: 4px;
|
||||
background: var(--primary);
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--grad-brand);
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
@@ -210,46 +321,56 @@
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
transition: background-color 150ms ease, box-shadow 150ms ease;
|
||||
box-shadow: 0 8px 22px -10px var(--primary);
|
||||
transition: transform 150ms var(--ease), box-shadow 150ms var(--ease), filter 150ms var(--ease);
|
||||
}
|
||||
|
||||
button:hover:not(:disabled) {
|
||||
background: var(--secondary);
|
||||
box-shadow: 0 2px 5px rgb(15 118 110 / 25%);
|
||||
#create-button:hover:not(:disabled) {
|
||||
filter: brightness(1.06);
|
||||
box-shadow: 0 10px 26px -8px var(--primary);
|
||||
}
|
||||
|
||||
button:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
#create-button:focus-visible {
|
||||
outline: 2px solid var(--accent-3);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
button:disabled { cursor: not-allowed; opacity: 0.65; }
|
||||
#create-button:disabled { cursor: not-allowed; opacity: 0.65; }
|
||||
|
||||
.status {
|
||||
min-height: 48px;
|
||||
margin-top: 16px;
|
||||
padding: 12px;
|
||||
border-radius: 4px;
|
||||
color: var(--slate-700);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-sm);
|
||||
color: var(--text-muted);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.8rem;
|
||||
line-height: 1.45;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.status::before {
|
||||
content: "$ ";
|
||||
color: var(--primary);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.status-ready { background: var(--status-ready); }
|
||||
.status-success { background: var(--status-success); color: #115e59; }
|
||||
.status-skipped { background: var(--status-skipped); color: #92400e; }
|
||||
.status-error { background: var(--status-error); color: #b91c1c; }
|
||||
.status-success { background: var(--status-success); color: var(--success); }
|
||||
.status-skipped { background: var(--status-skipped); color: var(--warning); }
|
||||
.status-error { background: var(--status-error); color: var(--error); }
|
||||
|
||||
.version {
|
||||
margin: auto 0 0;
|
||||
padding-top: 24px;
|
||||
color: #94a3b8;
|
||||
margin-top: 16px;
|
||||
color: var(--text-dim);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.75rem;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.page { padding: 18px; }
|
||||
.page { padding: 14px; }
|
||||
h1 { font-size: 1.5rem; }
|
||||
}
|
||||
</style>
|
||||
@@ -257,7 +378,20 @@
|
||||
<body>
|
||||
<main class="page">
|
||||
<section class="panel" aria-labelledby="heading">
|
||||
<h1 id="heading">New QC Sheet</h1>
|
||||
<div class="heading-row">
|
||||
<div>
|
||||
<p class="eyebrow">QC datasheet</p>
|
||||
<h1 id="heading">New QC Sheet</h1>
|
||||
</div>
|
||||
<button
|
||||
id="theme-toggle"
|
||||
class="theme-toggle"
|
||||
type="button"
|
||||
aria-label="Switch to light theme"
|
||||
title="Switch theme">
|
||||
Aa
|
||||
</button>
|
||||
</div>
|
||||
<p class="subtitle">Create a new QC datasheet from the latest matching workbook.</p>
|
||||
|
||||
<div class="fields">
|
||||
@@ -320,6 +454,39 @@
|
||||
const serialInput = document.getElementById("serial-input");
|
||||
const createBtn = document.getElementById("create-button");
|
||||
const status = document.getElementById("status");
|
||||
const themeToggle = document.getElementById("theme-toggle");
|
||||
|
||||
function isLightTheme() {
|
||||
return document.documentElement.getAttribute("data-theme") === "light";
|
||||
}
|
||||
|
||||
function syncThemeToggle() {
|
||||
const light = isLightTheme();
|
||||
themeToggle.setAttribute(
|
||||
"aria-label",
|
||||
light ? "Switch to dark theme" : "Switch to light theme"
|
||||
);
|
||||
themeToggle.textContent = light ? "Dark" : "Light";
|
||||
}
|
||||
|
||||
function applyTheme(theme) {
|
||||
if (theme === "light") {
|
||||
document.documentElement.setAttribute("data-theme", "light");
|
||||
} else {
|
||||
document.documentElement.removeAttribute("data-theme");
|
||||
}
|
||||
try {
|
||||
localStorage.setItem("xlsx-clean-theme", theme);
|
||||
} catch (error) {
|
||||
/* ignore quota / privacy mode */
|
||||
}
|
||||
syncThemeToggle();
|
||||
}
|
||||
|
||||
themeToggle.addEventListener("click", () => {
|
||||
applyTheme(isLightTheme() ? "dark" : "light");
|
||||
});
|
||||
syncThemeToggle();
|
||||
|
||||
// Builds a searchable combobox. The underlying <select> stays as the
|
||||
// semantic source of truth; the visible widget is a text <input> plus a
|
||||
@@ -424,14 +591,15 @@
|
||||
empty.textContent = "No matches";
|
||||
empty.hidden = true;
|
||||
panelEl.append(empty);
|
||||
if (selectEl.value && !inputEl.value) {
|
||||
inputEl.value = selectEl.value;
|
||||
}
|
||||
inputEl.value = selectEl.value || "";
|
||||
inputDirty = false;
|
||||
syncDisabled();
|
||||
};
|
||||
|
||||
inputEl.addEventListener("focus", open);
|
||||
inputEl.addEventListener("mousedown", () => {
|
||||
open();
|
||||
});
|
||||
inputEl.addEventListener("input", () => {
|
||||
inputDirty = true;
|
||||
if (!openState) open();
|
||||
@@ -587,4 +755,4 @@
|
||||
window.addEventListener("pywebviewready", initialize);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -37,7 +37,7 @@ def test_main_initializes_api_before_opening_window():
|
||||
"width": 900,
|
||||
"height": 700,
|
||||
"min_size": (450, 400),
|
||||
"background_color": "#f8fafc",
|
||||
"background_color": "#0b0e14",
|
||||
},
|
||||
),
|
||||
("start",),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import re
|
||||
from html.parser import HTMLParser
|
||||
from pathlib import Path
|
||||
|
||||
from xlsx_clean.paths import package_file
|
||||
|
||||
@@ -31,6 +32,8 @@ def test_ui_asset_exists_and_has_required_bridge_content():
|
||||
"get_inks(setDropdown.value)",
|
||||
"api.create(",
|
||||
"finally",
|
||||
'inputEl.value = selectEl.value || ""',
|
||||
'inputEl.addEventListener("mousedown", () => {\n open();\n });',
|
||||
):
|
||||
assert expected in content
|
||||
|
||||
@@ -38,6 +41,12 @@ def test_ui_asset_exists_and_has_required_bridge_content():
|
||||
assert "quasar" not in content.lower()
|
||||
assert "cdn" not in content.lower()
|
||||
assert not re.search(r"https?://", content)
|
||||
assert "#0b0e14" in content
|
||||
assert "#e54d5e" in content
|
||||
assert "background-size: var(--grid-size) var(--grid-size)" in content
|
||||
assert "background: transparent" in content
|
||||
assert "tl-red" not in content
|
||||
assert 'class="chrome"' not in content
|
||||
StrictHtmlParser().feed(content)
|
||||
|
||||
|
||||
@@ -48,3 +57,7 @@ def test_ui_font_sources_are_bundled_locally():
|
||||
assert font_urls == ["../fonts/Inter-Regular.ttf", "../fonts/Inter-Bold.ttf"]
|
||||
for font_url in font_urls:
|
||||
assert (package_file("ui") / font_url).resolve().is_file()
|
||||
|
||||
|
||||
def test_demo_html_is_not_shipped():
|
||||
assert not Path("desktop/demo.html").exists()
|
||||
|
||||
Reference in New Issue
Block a user