Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
321 lines (312 loc) · 20.3 KB
/
Copy pathindex.html
File metadata and controls
321 lines (312 loc) · 20.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
<!doctype html>
<!-- SPDX-License-Identifier: GPL-3.0-or-later -->
<!-- Copyright (C) 2026 Sipeed Co., Ltd. -->
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- --bg10, the default dark shell. A hosted build also gains the web manifest link
and its build stamp here (src/pwa/shell.mjs); the portable build does not. -->
<meta name="theme-color" content="#1B1B1C" />
<title data-i18n="app.title">SLogic Logic Analyzer</title>
<!--
Declaring an icon is what stops the browser probing /favicon.ico at the DOMAIN root -
which, for a project page served from a subdirectory, is not this site's to serve and
404s. Vite rewrites this href with the build's base, so it follows the subdirectory.
-->
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<script>
// The app was renamed logicweb -> slogicweb (0.1.0). Carry every stored preference
// (theme, language, panel width, workspace...) to the new keys before anything below
// reads them; a key already written under the new name wins. Runs once per key.
try {
for (const store of [localStorage, sessionStorage]) {
for (let i = store.length - 1; i >= 0; i--) {
const key = store.key(i);
if (!key || !key.startsWith('logicweb.')) continue;
const next = 's' + key;
if (store.getItem(next) === null) store.setItem(next, store.getItem(key));
store.removeItem(key);
}
}
} catch {
// Storage blocked (private mode, policy): start from defaults.
}
</script>
<script>
try {
const stored = localStorage.getItem('slogicweb.theme');
const mode = stored === 'light' || stored === 'dark' || stored === 'system' ? stored : 'dark';
const dark = mode === 'dark' || (mode === 'system' && matchMedia('(prefers-color-scheme: dark)').matches);
document.documentElement.setAttribute('data-theme', dark ? 'dark' : 'light');
} catch {
document.documentElement.setAttribute('data-theme', 'dark');
}
</script>
<script>
try {
const raw = localStorage.getItem('slogicweb.panelWidth');
const n = raw === null ? NaN : Number(raw);
if (Number.isFinite(n) && n > 0) {
document.documentElement.style.setProperty('--side-panel-w',
Math.min(560, Math.max(200, Math.round(n))) + 'px');
}
} catch {
}
</script>
<script>
try {
const workspace = JSON.parse(localStorage.getItem('slogicweb.workspace') ?? 'null');
if (workspace?.version === 1 && workspace.detailedLabels === false) {
document.documentElement.setAttribute('data-toolbar-labels', 'off');
}
} catch {
}
</script>
<link rel="stylesheet" href="/src/ui/style.css" />
</head>
<body>
<div id="app">
<div id="toolbar">
<button id="btn-connect" class="toolbar-item toolbar-device" title="Connect device" aria-label="Device">
<span class="toolbar-item-media">
<svg class="toolbar-item-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" data-icon="inline-start">
<rect x="3" y="4" width="14" height="13" rx="2"></rect>
<path d="M7 8h6M7 12h3M17 9h4v6h-2a2 2 0 0 1-2-2"></path>
</svg>
</span>
<span class="toolbar-item-label" aria-hidden="true" data-i18n="toolbar.shortDevice">Device</span>
</button>
<span class="toolbar-separator" role="separator" aria-orientation="vertical"></span>
<button id="transport" class="toolbar-item primary" data-i18n-title="toolbar.startTitle" title="Capture on the connected device" aria-label="Capture">
<span class="toolbar-item-media">
<svg class="toolbar-item-icon transport-play" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" data-icon="inline-start">
<path d="m8 5 11 7-11 7Z"></path>
</svg>
<svg class="toolbar-item-icon transport-stop" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" data-icon="inline-start">
<rect x="6" y="6" width="12" height="12" rx="2"></rect>
</svg>
</span>
<span class="toolbar-item-label" aria-hidden="true" data-i18n="toolbar.shortStart">Capture</span>
</button>
<button id="btn-open" class="toolbar-item" data-i18n-title="toolbar.openTitle" title="Load a sigrok .sr session or a .lwcap" aria-label="Open…" aria-controls="open-menu" aria-expanded="false">
<span class="toolbar-item-media">
<svg class="toolbar-item-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" data-icon="inline-start">
<path d="M3 7V5a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z"></path>
<path d="M3 7h18"></path>
</svg>
</span>
<span class="toolbar-item-label" aria-hidden="true" data-i18n="toolbar.shortOpen">Open</span>
</button>
<button id="btn-save" class="toolbar-item" data-i18n-title="toolbar.saveTitle" title="Save this capture (.lwcap, or .sr for PulseView)" aria-label="Save" aria-controls="save-menu" aria-expanded="false">
<span class="toolbar-item-media">
<svg class="toolbar-item-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" data-icon="inline-start">
<path d="M5 3h12l4 4v14H3V3Z"></path>
<path d="M7 3v6h10V3M7 21v-8h10v8"></path>
</svg>
</span>
<span class="toolbar-item-label" aria-hidden="true" data-i18n="toolbar.shortSave">Save</span>
</button>
<span class="toolbar-separator" role="separator" aria-orientation="vertical"></span>
<div class="toolbar-group" role="group" aria-label="View and settings" data-i18n-aria-label="toolbar.viewGroup">
<button id="btn-fullscreen" class="toolbar-item toolbar-fullscreen" data-i18n-title="toolbar.enterFullscreenTitle" title="Enter fullscreen" aria-label="Fullscreen" aria-pressed="false">
<span class="toolbar-item-media">
<svg class="toolbar-item-icon fullscreen-icon-enter" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" data-icon="inline-start">
<path d="M8 3H3v5M16 3h5v5M8 21H3v-5M16 21h5v-5"></path>
</svg>
<svg class="toolbar-item-icon fullscreen-icon-exit" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" data-icon="inline-start">
<path d="M4 9h5V4M20 9h-5V4M4 15h5v5M20 15h-5v5"></path>
</svg>
</span>
<span class="toolbar-item-label" aria-hidden="true" data-i18n="toolbar.shortFullscreen">Fullscreen</span>
</button>
<button id="btn-settings" class="toolbar-item toolbar-settings" data-i18n-title="settings.titleHint" title="Display preferences" aria-label="Settings" aria-haspopup="dialog" aria-controls="settings-dialog">
<span class="toolbar-item-media">
<svg class="toolbar-item-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" data-icon="inline-start">
<path d="M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3"></path>
<path d="M1 14h6M9 8h6M17 16h6"></path>
</svg>
</span>
<span class="toolbar-item-label" aria-hidden="true" data-i18n="toolbar.shortSettings">Settings</span>
</button>
</div>
<span class="spacer"></span>
<div class="toolbar-group" role="group" aria-label="Agent, language and theme" data-i18n-aria-label="toolbar.switchGroup">
<button id="btn-agent" class="toolbar-item toolbar-agent" data-i18n-title="toolbar.agentTitle" title="Agent connection" aria-label="Agent connection" aria-controls="agent-menu" aria-expanded="false">
<span class="toolbar-item-media">
<svg class="toolbar-item-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" data-icon="inline-start">
<path d="M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9Z"></path>
<path d="M18.5 16.5l.8 2.2 2.2.8-2.2.8-.8 2.2-.8-2.2-2.2-.8 2.2-.8Z"></path>
</svg>
</span>
<span class="toolbar-item-label" aria-hidden="true" data-i18n="toolbar.shortAgent">Agent</span>
</button>
<button id="btn-language" class="toolbar-item toolbar-language" data-i18n-title="toolbar.languageTitle" title="Choose language" aria-label="Choose language" aria-controls="language-menu" aria-expanded="false">
<span class="toolbar-item-media">
<svg class="toolbar-item-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" data-icon="inline-start">
<path d="m5 8 6 6M4 14l6-6 2-3M2 5h12M7 2h1M22 22l-5-10-5 10M14 18h6"></path>
</svg>
</span>
<span class="toolbar-item-label" aria-hidden="true" data-i18n="toolbar.shortLanguage">Language</span>
</button>
<button id="btn-theme" class="toolbar-item toolbar-theme" data-i18n-title="toolbar.themeTitle" title="Toggle theme" aria-label="Toggle theme" aria-controls="theme-menu" aria-expanded="false">
<span class="toolbar-item-media">
<svg class="toolbar-item-icon theme-icon-light" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" data-icon="inline-start">
<circle cx="12" cy="12" r="4"></circle>
<path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"></path>
</svg>
<svg class="toolbar-item-icon theme-icon-dark" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" data-icon="inline-start">
<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"></path>
</svg>
<svg class="toolbar-item-icon theme-icon-system" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false" data-icon="inline-start">
<rect x="2" y="3" width="20" height="14" rx="2"></rect>
<path d="M8 21h8M12 17v4"></path>
</svg>
</span>
<span class="toolbar-item-label" aria-hidden="true" data-i18n="toolbar.shortTheme">Theme</span>
</button>
</div>
</div>
<!-- The only copy of the status error: a user cannot miss it, it clears on
dismiss and stays hidden while there is no error. Full-width above the main
row so it cannot scroll out of view with the channel list. -->
<div id="error-banner" class="error-banner" role="alert" hidden>
<svg class="error-banner-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
<path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z"></path>
<path d="M12 9v4M12 17h.01"></path>
</svg>
<div class="error-banner-body">
<span id="error-banner-text" class="error-banner-text"></span>
<span id="error-banner-guidance" class="error-banner-guidance" hidden></span>
<details id="error-banner-details" class="error-banner-details" hidden>
<summary data-i18n="error.details">Technical details</summary>
<span id="error-banner-detail-text"></span>
</details>
</div>
<button id="error-banner-retry" class="error-banner-retry" type="button" hidden
data-i18n="connectHelp.retry">Retry</button>
<!-- A settings-only remedy: Capture/Stop stays the one control that starts a capture. -->
<button id="error-banner-action" class="error-banner-action" type="button" hidden></button>
<button id="error-banner-dismiss" class="error-banner-dismiss" type="button"
aria-label="Close" data-i18n-aria-label="shortcuts.close">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
<path d="M18 6 6 18M6 6l12 12"></path>
</svg>
</button>
</div>
<!-- Browser-support notice: info, not an error. Shown only when this browser cannot
connect a device (no WebUSB, or an insecure context); the file viewer and
decoders still work, so it is dismissible and never blocks the page. -->
<div id="platform-notice" class="platform-notice" role="status" hidden>
<svg class="platform-notice-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
<circle cx="12" cy="12" r="10"></circle>
<path d="M12 16v-4M12 8h.01"></path>
</svg>
<span id="platform-notice-text" class="platform-notice-text"></span>
<button id="platform-notice-dismiss" class="error-banner-dismiss platform-notice-dismiss" type="button"
aria-label="Dismiss" data-i18n-aria-label="notice.dismiss">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
<path d="M18 6 6 18M6 6l12 12"></path>
</svg>
</button>
</div>
<!-- Opened-file notice: info about the file just opened (an old .sr whose extra
probes were not loaded). Same look as the browser-support notice; it clears on
dismiss, on the next Open and when a capture starts. -->
<div id="file-notice" class="platform-notice" role="status" hidden>
<svg class="platform-notice-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
<circle cx="12" cy="12" r="10"></circle>
<path d="M12 16v-4M12 8h.01"></path>
</svg>
<span id="file-notice-text" class="platform-notice-text"></span>
<button id="file-notice-dismiss" class="error-banner-dismiss platform-notice-dismiss" type="button"
aria-label="Dismiss" data-i18n-aria-label="notice.dismiss">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
<path d="M18 6 6 18M6 6l12 12"></path>
</svg>
</button>
</div>
<div id="main">
<div id="scroll-area">
<!-- Channel names, waveforms, decoder annotations and readouts are data: the
browser must never machine-translate them (the empty hint opts back in). -->
<div id="labels-col" translate="no">
<!-- The corner cell (DESIGN §3.4): capture summary and Fit over the overview,
+ Decoder and the trigger-column caption over the ruler. App fills the
text; the fallbacks below are the English catalog values. -->
<div id="labels-spacer" class="corner-cell" role="group" aria-label="View controls">
<div class="corner-overview">
<button id="corner-summary" class="corner-summary" type="button"
title="No capture yet. Click to open the Capture panel."><span class="corner-summary-text">No capture</span></button>
<button id="corner-fit" class="corner-btn corner-fit" type="button" disabled
title="Fit is unavailable: there is no capture to fit yet." aria-label="Fit">
<svg class="corner-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
<path d="M8 7l-5 5 5 5M16 7l5 5-5 5"></path>
</svg>
<span class="corner-fit-span" aria-hidden="true"></span>
</button>
</div>
<div class="corner-ruler">
<button id="corner-add-decoder" class="corner-btn corner-add-decoder" type="button"
title="Add a protocol decoder: opens the Decoders panel with the decoder picker" aria-label="Add decoder">
<svg class="corner-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">
<path d="M12 5v14M5 12h14"></path>
</svg>
<span class="corner-add-text" aria-hidden="true" translate="yes">+ Decoder</span>
</button>
<span id="corner-trigger" class="corner-trigger" title="Trigger column: each row's slot below sets that channel's trigger">T</span>
</div>
</div>
<div id="channel-list"></div>
</div>
<div id="plot-col">
<canvas id="overview" aria-hidden="true"></canvas>
<canvas id="axis"></canvas>
<div id="plot" translate="no">
<div id="wave-stack"></div>
<div id="empty-hint" translate="yes">
<div class="empty-hint-body">
<span data-i18n="emptyHint.line1">No capture loaded.</span><br />
<span id="empty-hint-detail" data-i18n="emptyHint.line2">Open a .sr or .lwcap file (or drag it here), or connect an SLogic16/32 U3.</span>
<!-- Static boot progress: a slow network shows this instead of a dead hint.
main.ts removes it once App has constructed. Localized here because the
catalogs are not loaded yet (same record and matching as i18n.ts). -->
<span id="empty-hint-starting" class="empty-hint-starting"><br />Starting…</span>
<script>
try {
const tag = (localStorage.getItem('slogicweb.lang') || navigator.language || '').toLowerCase();
const text = tag.startsWith('zh') ? '正在启动…' : tag.startsWith('fr') ? 'Démarrage…'
: tag.startsWith('ru') ? 'Запуск…' : null;
if (text) document.getElementById('empty-hint-starting').lastChild.textContent = text;
} catch {
}
</script>
</div>
</div>
<!-- Shown while files are dragged over the window (app.ts wireDropOverlay). -->
<div id="drop-overlay" class="drop-overlay" translate="yes" aria-hidden="true">
<span data-i18n="drop.overlay">Drop .sr / .lwcap to open</span>
</div>
</div>
</div>
</div>
<div id="panel-resizer" role="separator" aria-orientation="vertical" tabindex="0"
aria-controls="side-panel" aria-label="Resize sidebar"
data-i18n-aria-label="panel.resizeLabel"
data-i18n-title="panel.resizeTitle" title="Drag to resize the sidebar"></div>
<div id="side-panel"></div>
</div>
<!-- Bottom bar: context-sensitive mouse hints for the area under the pointer.
Errors are not summarized here; the top alert banner is their only home. -->
<div id="interaction-bar" class="interaction-bar" role="status" aria-live="polite"
aria-atomic="true" aria-label="Mouse controls"
data-i18n-aria-label="hints.barLabel">
<span id="interaction-area" class="interaction-area"></span>
<ul id="interaction-hints" class="interaction-hints"></ul>
</div>
</div>
<input id="file-input" type="file" multiple hidden
accept=".sr,.lwcap" />
<script type="module" src="/src/ui/main.ts"></script>
</body>
</html>