alibai 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,480 @@
1
+ "use strict";
2
+
3
+ const demoComments = new Map();
4
+
5
+ function commentStorageKey(runId) {
6
+ return `alibai-comments:${location.pathname}:${runId}`;
7
+ }
8
+
9
+ function readDemoComments(runId) {
10
+ if (demoComments.has(runId)) return demoComments.get(runId);
11
+ try {
12
+ const data = JSON.parse(localStorage.getItem(commentStorageKey(runId)));
13
+ return data && typeof data === "object" && !Array.isArray(data) ? data : {};
14
+ }
15
+ catch { return {}; }
16
+ }
17
+
18
+ async function loadComments(runId) {
19
+ if (document.documentElement.dataset.runsUrl) return readDemoComments(runId);
20
+ const response = await fetch(`./api/comments/${runId}`);
21
+ if (!response.ok) throw new Error(String(response.status));
22
+ return response.json();
23
+ }
24
+
25
+ async function saveComment(runId, exhibitId, change) {
26
+ if (!document.documentElement.dataset.runsUrl) {
27
+ const response = await fetch(`./api/comments/${runId}/${exhibitId}`, {
28
+ method: "POST",
29
+ headers: { "Content-Type": "application/json" },
30
+ body: JSON.stringify(change),
31
+ });
32
+ if (response.status === 409) return null;
33
+ if (!response.ok) throw new Error(String(response.status));
34
+ return response.json();
35
+ }
36
+
37
+ const comments = readDemoComments(runId);
38
+ const thread = [...(comments[exhibitId] ?? [])];
39
+ const { id, action, text } = change;
40
+ const index = thread.findIndex((comment) => comment.id === id);
41
+ if (action === "delete") {
42
+ if (index === -1) return thread;
43
+ thread.splice(index, 1);
44
+ } else if (action === "add") {
45
+ if (index >= 0) return thread[index].text === text ? thread : null;
46
+ thread.push({ id, text, createdAt: new Date().toISOString() });
47
+ } else {
48
+ if (index === -1) return null;
49
+ if (thread[index].text === text) return thread;
50
+ thread[index] = { ...thread[index], text, updatedAt: new Date().toISOString() };
51
+ }
52
+ if (thread.length) comments[exhibitId] = thread;
53
+ else delete comments[exhibitId];
54
+ try {
55
+ localStorage.setItem(commentStorageKey(runId), JSON.stringify(comments));
56
+ demoComments.delete(runId);
57
+ } catch {
58
+ demoComments.set(runId, comments);
59
+ }
60
+ return thread;
61
+ }
62
+
63
+ function escapeHtml(text) {
64
+ return text.replace(/[&<>"']/g, (char) => `&#${char.charCodeAt(0)};`);
65
+ }
66
+
67
+ // Renders matches with `match` and the text between them with `rest`.
68
+ function replaceOutside(text, pattern, match, rest) {
69
+ let html = "";
70
+ let last = 0;
71
+ for (const found of text.matchAll(pattern)) {
72
+ html += rest(text.slice(last, found.index)) + match(found);
73
+ last = found.index + found[0].length;
74
+ }
75
+ return html + rest(text.slice(last));
76
+ }
77
+
78
+ const boldMarkdown = (html) => html.replace(/\*\*(?=\S)([^*\n]*?\S)\*\*/g, "<strong>$1</strong>");
79
+ const linkPattern = /\[([^\]\n]+)\]\((https?:\/\/[^\s()<>"]+)\)|https?:\/\/[^\s<>"]*[^\s<>".,:;!?')\]]/g;
80
+
81
+ function inlineMarkdown(text) {
82
+ return replaceOutside(text, /`([^`\n]+)`/g, ([, code]) => `<code>${escapeHtml(code)}</code>`, (plain) =>
83
+ replaceOutside(plain, linkPattern, ([url, label, href]) =>
84
+ `<a href="${escapeHtml(href ?? url)}" target="_blank" rel="noopener noreferrer">${
85
+ label === undefined ? escapeHtml(url) : boldMarkdown(escapeHtml(label))}</a>`,
86
+ (rest) => boldMarkdown(escapeHtml(rest))));
87
+ }
88
+
89
+ // Every piece of comment text passes through escapeHtml before it is emitted;
90
+ // only the tags written here (p, br, pre, code, strong, http(s) links) reach the page.
91
+ function markdownToHtml(source) {
92
+ return replaceOutside(source.replace(/\r\n?/g, "\n"), /```[^`\n]*\n([\s\S]*?)\n?```/g,
93
+ ([, code]) => `<pre><code>${escapeHtml(code)}</code></pre>`,
94
+ (text) => text.split(/\n{2,}/).map((part) => part.replace(/^\n+|\n+$/g, "")).filter((part) => part.trim())
95
+ .map((part) => `<p>${inlineMarkdown(part).replaceAll("\n", "<br>")}</p>`).join(""));
96
+ }
97
+
98
+ function commentBody(text) {
99
+ const body = el("div", "comment-body");
100
+ body.innerHTML = markdownToHtml(text);
101
+ return body;
102
+ }
103
+
104
+ function relativeTime(value) {
105
+ const seconds = (new Date(value) - Date.now()) / 1000;
106
+ const format = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
107
+ for (const [unit, size, limit] of [["second", 1, 45], ["minute", 60, 3600], ["hour", 3600, 86400], ["day", 86400, 604800]]) {
108
+ if (Math.abs(seconds) < limit) return unit === "second" ? format.format(0, "second") : format.format(Math.round(seconds / size), unit);
109
+ }
110
+ return new Intl.DateTimeFormat(locale, { dateStyle: "medium", timeStyle: "short" }).format(new Date(value));
111
+ }
112
+
113
+ function commentDate(comment, relative) {
114
+ const full = new Intl.DateTimeFormat(locale, { dateStyle: "full", timeStyle: "long" });
115
+ const date = (value) => {
116
+ const node = el("time", "", relative ? relativeTime(value) : formats.timestamp.format(new Date(value)));
117
+ node.dateTime = value;
118
+ node.title = full.format(new Date(value));
119
+ return node;
120
+ };
121
+ const meta = el("span", "comment-meta", date(comment.createdAt));
122
+ if (comment.updatedAt) {
123
+ const edited = el("span", "comment-edited", t("commentEdited"));
124
+ edited.title = full.format(new Date(comment.updatedAt));
125
+ meta.append(" · ", edited);
126
+ }
127
+ return meta;
128
+ }
129
+
130
+ function commentsTitle(count) {
131
+ return el("h4", "comments-title", t("comments"), el("span", "comments-count", ` · ${formats.count.format(count)}`));
132
+ }
133
+
134
+ // Report and print copies: timestamp and body only.
135
+ function renderReportComments(thread) {
136
+ return el("div", "comments", commentsTitle(thread.length), el("ul", "comment-list", ...thread.map((comment) =>
137
+ el("li", "comment", el("div", "comment-head", commentDate(comment, false)), commentBody(comment.text)))));
138
+ }
139
+
140
+ function commentEditor({ value = "", label, submitLabel, hint, isCompact, onSubmit, onCancel }) {
141
+ const field = el("textarea", "");
142
+ field.rows = 2;
143
+ field.maxLength = 4000;
144
+ field.value = value;
145
+ field.placeholder = t("writeComment");
146
+ field.setAttribute("aria-label", label);
147
+ const submit = el("button", "comment-submit", submitLabel);
148
+ submit.type = "submit";
149
+ const actions = el("div", "comment-buttons");
150
+ if (onCancel) {
151
+ const cancel = el("button", "comment-cancel", t("cancel"));
152
+ cancel.type = "button";
153
+ cancel.addEventListener("click", onCancel);
154
+ actions.append(cancel);
155
+ }
156
+ actions.append(submit);
157
+ const hintNode = el("span", "comment-hint", hint);
158
+ const form = el("form", "comment-form", field, el("div", "comment-footer", hintNode, actions));
159
+ let busy = false;
160
+ const sync = () => {
161
+ submit.disabled = busy || !field.value.trim();
162
+ const compact = Boolean(isCompact?.()) && !field.value && !form.contains(document.activeElement);
163
+ form.classList.toggle("compact", compact);
164
+ field.rows = compact ? 1 : 2;
165
+ if (!CSS.supports("field-sizing", "content")) {
166
+ field.style.height = "";
167
+ field.style.height = `${field.scrollHeight + 2}px`;
168
+ }
169
+ };
170
+ field.addEventListener("input", sync);
171
+ form.addEventListener("focusin", sync);
172
+ form.addEventListener("focusout", () => setTimeout(sync));
173
+ field.addEventListener("keydown", (event) => {
174
+ if (event.isComposing || event.keyCode === 229) return;
175
+ if (event.key === "Enter" && (event.metaKey || event.ctrlKey)) {
176
+ event.preventDefault();
177
+ form.requestSubmit();
178
+ } else if (event.key === "Escape" && onCancel) {
179
+ event.preventDefault();
180
+ onCancel();
181
+ }
182
+ });
183
+ form.addEventListener("submit", (event) => {
184
+ event.preventDefault();
185
+ const text = field.value.trim();
186
+ if (text && !busy) onSubmit(text);
187
+ });
188
+ sync();
189
+ return {
190
+ form, field, sync,
191
+ set busy(value) {
192
+ busy = value;
193
+ field.readOnly = value;
194
+ sync();
195
+ },
196
+ };
197
+ }
198
+
199
+ function commentMenu(items) {
200
+ const button = iconControl(el("button", "icon-control comment-menu-button"), t("commentActions"),
201
+ "M5 12h.01M12 12h.01M19 12h.01");
202
+ button.type = "button";
203
+ button.setAttribute("aria-haspopup", "menu");
204
+ button.setAttribute("aria-expanded", "false");
205
+ const menu = el("div", "comment-menu");
206
+ menu.setAttribute("role", "menu");
207
+ menu.hidden = true;
208
+ const wrap = el("div", "comment-menu-wrap", button, menu);
209
+ const entries = items.map(({ action, label, run }) => {
210
+ const item = el("button", `comment-menu-item ${action}`, label);
211
+ item.type = "button";
212
+ item.tabIndex = -1;
213
+ item.dataset.action = action;
214
+ item.setAttribute("role", "menuitem");
215
+ item.addEventListener("click", () => {
216
+ close();
217
+ run();
218
+ });
219
+ return item;
220
+ });
221
+ menu.append(...entries);
222
+ const outside = (event) => {
223
+ if (!wrap.contains(event.target)) close();
224
+ };
225
+ function close(restoreFocus = false) {
226
+ if (menu.hidden) return;
227
+ menu.hidden = true;
228
+ button.setAttribute("aria-expanded", "false");
229
+ document.removeEventListener("click", outside, true);
230
+ if (restoreFocus) button.focus();
231
+ }
232
+ function open(index = 0) {
233
+ menu.hidden = false;
234
+ button.setAttribute("aria-expanded", "true");
235
+ document.addEventListener("click", outside, true);
236
+ entries.at(index).focus();
237
+ }
238
+ button.addEventListener("click", () => menu.hidden ? open() : close(true));
239
+ button.addEventListener("keydown", (event) => {
240
+ if (event.key !== "ArrowDown" && event.key !== "ArrowUp") return;
241
+ event.preventDefault();
242
+ open(event.key === "ArrowUp" ? -1 : 0);
243
+ });
244
+ menu.addEventListener("keydown", (event) => {
245
+ const index = entries.indexOf(document.activeElement);
246
+ const moves = { ArrowDown: index + 1, ArrowUp: index - 1, Home: 0, End: -1 };
247
+ if (event.key === "Escape") {
248
+ event.preventDefault();
249
+ close(true);
250
+ } else if (Object.hasOwn(moves, event.key)) {
251
+ event.preventDefault();
252
+ entries.at(moves[event.key] % entries.length).focus();
253
+ }
254
+ });
255
+ menu.addEventListener("focusout", (event) => {
256
+ if (!wrap.contains(event.relatedTarget)) close();
257
+ });
258
+ return { wrap, button };
259
+ }
260
+
261
+ function renderCommentThread(runId, exhibitId, comments) {
262
+ let title = commentsTitle(0);
263
+ const list = el("ul", "comment-list");
264
+ const message = el("p", "comment-status");
265
+ message.setAttribute("role", "status");
266
+ let thread = [];
267
+ const composer = commentEditor({
268
+ label: t("commentText"), submitLabel: t("submitComment"), hint: t("commentHint"),
269
+ isCompact: () => thread.length === 0,
270
+ onSubmit: (text) => {
271
+ if (previousAdd?.text !== text) previousAdd = { id: crypto.randomUUID(), action: "add", text };
272
+ update(previousAdd, () => {
273
+ composer.field.value = "";
274
+ previousAdd = undefined;
275
+ return composer.field;
276
+ });
277
+ },
278
+ });
279
+ composer.form.classList.add("comment-composer");
280
+ composer.field.disabled = true;
281
+ const section = el("section", "comments", title, list, composer.form, message);
282
+ let previousAdd;
283
+ const menuButtons = new Map();
284
+
285
+ function show(data) {
286
+ thread = data;
287
+ const fresh = commentsTitle(thread.length);
288
+ title.replaceWith(fresh);
289
+ title = fresh;
290
+ menuButtons.clear();
291
+ list.replaceChildren(...thread.map(renderComment));
292
+ list.hidden = thread.length === 0;
293
+ composer.sync();
294
+ }
295
+
296
+ function renderComment(comment) {
297
+ const item = el("li", "comment");
298
+ const body = commentBody(comment.text);
299
+ const { wrap, button } = commentMenu([
300
+ { action: "edit", label: t("editComment"), run: () => edit() },
301
+ { action: "delete", label: t("deleteComment"), run: () => confirmDelete() },
302
+ ]);
303
+ menuButtons.set(comment.id, button);
304
+ item.append(el("div", "comment-head", commentDate(comment, true), wrap), body);
305
+ let editor;
306
+ function edit() {
307
+ const restore = () => {
308
+ editor.form.replaceWith(body);
309
+ wrap.hidden = false;
310
+ button.focus();
311
+ };
312
+ editor = commentEditor({
313
+ value: comment.text, label: t("editCommentLabel"), submitLabel: t("saveComment"), hint: t("saveHint"),
314
+ onCancel: restore,
315
+ onSubmit: (text) => update({ id: comment.id, action: "edit", text }, () => () => menuButtons.get(comment.id), editor),
316
+ });
317
+ editor.form.classList.add("comment-edit-form");
318
+ body.replaceWith(editor.form);
319
+ wrap.hidden = true;
320
+ editor.field.focus();
321
+ editor.field.setSelectionRange(editor.field.value.length, editor.field.value.length);
322
+ }
323
+ function confirmDelete() {
324
+ const cancel = el("button", "comment-cancel", t("cancel"));
325
+ cancel.type = "button";
326
+ const remove = el("button", "comment-submit danger", t("deleteComment"));
327
+ remove.type = "button";
328
+ const confirm = el("div", "comment-confirm", el("span", "", t("deleteConfirm")), el("div", "comment-buttons", cancel, remove));
329
+ confirm.setAttribute("role", "group");
330
+ confirm.setAttribute("aria-label", t("deleteConfirm"));
331
+ item.append(confirm);
332
+ wrap.hidden = true;
333
+ cancel.addEventListener("click", () => {
334
+ confirm.remove();
335
+ wrap.hidden = false;
336
+ button.focus();
337
+ });
338
+ confirm.addEventListener("keydown", (event) => {
339
+ if (event.key === "Escape") cancel.click();
340
+ });
341
+ remove.addEventListener("click", () => update({ id: comment.id, action: "delete" }, () => composer.field));
342
+ cancel.focus();
343
+ }
344
+ return item;
345
+ }
346
+
347
+ async function update(change, done, editor = composer) {
348
+ const buttons = [...section.querySelectorAll("button")].filter((button) => !button.disabled);
349
+ for (const button of buttons) button.disabled = true;
350
+ editor.busy = true;
351
+ message.textContent = "";
352
+ let focus;
353
+ try {
354
+ const saved = await saveComment(runId, exhibitId, change);
355
+ if (saved === null) {
356
+ message.textContent = t("commentConflict");
357
+ return;
358
+ }
359
+ focus = done();
360
+ show(saved);
361
+ } catch {
362
+ message.textContent = t("commentSaveError");
363
+ } finally {
364
+ for (const button of buttons) button.disabled = false;
365
+ editor.busy = false;
366
+ if (document.activeElement === document.body || section.contains(document.activeElement)) {
367
+ (typeof focus === "function" ? focus() : focus)?.focus({ preventScroll: true });
368
+ }
369
+ }
370
+ }
371
+
372
+ comments.then((data) => {
373
+ if (!data) message.textContent = t("commentLoadError");
374
+ else {
375
+ show(data[exhibitId] ?? []);
376
+ composer.field.disabled = false;
377
+ }
378
+ });
379
+ return section;
380
+ }
381
+
382
+ function inlineAsset(url, type) {
383
+ return fetch(url).then(async (response) => {
384
+ if (!response.ok) throw new Error(String(response.status));
385
+ const blob = await response.blob();
386
+ if (type && !type.test(blob.type)) throw new Error("Unexpected asset type.");
387
+ return new Promise((resolve, reject) => {
388
+ const reader = new FileReader();
389
+ reader.onload = () => resolve(reader.result);
390
+ reader.onerror = () => reject(reader.error);
391
+ reader.readAsDataURL(blob);
392
+ });
393
+ });
394
+ }
395
+
396
+ let reportStyles;
397
+ function inlineReportStyles() {
398
+ return reportStyles ??= Promise.all(["./tokens.css", "./viewer.css"].map(async (path) => {
399
+ const response = await fetch(path);
400
+ if (!response.ok) throw new Error(String(response.status));
401
+ return response.text();
402
+ })).then(async (sheets) => {
403
+ const css = sheets.join("\n");
404
+ const fonts = new Map(await Promise.all(
405
+ [...css.matchAll(/url\("(\.\/fonts\/[^"]+)"\)/g)].map(async ([, path]) =>
406
+ [path, await inlineAsset(path)])));
407
+ return css.replace(/url\("(\.\/fonts\/[^"]+)"\)/g, (match, path) => `url("${fonts.get(path)}")`);
408
+ }).catch((error) => {
409
+ reportStyles = undefined;
410
+ throw error;
411
+ });
412
+ }
413
+
414
+ async function buildReport(run, exhibits, selected) {
415
+ const included = exhibits.map((exhibit, index) => ({ exhibit, index }))
416
+ .filter(({ exhibit }) => selected.has(exhibit.item.id));
417
+ const paths = new Set(included.flatMap(({ exhibit: { kind, item } }) =>
418
+ kind === "ui" ? [item.before, item.after].filter(Boolean) : []));
419
+ const [css, comments, images] = await Promise.all([
420
+ inlineReportStyles(),
421
+ loadComments(run.id).catch(() => null),
422
+ Promise.all([...paths].map(async (path) => {
423
+ const data = await inlineAsset(screenshotUrl(run.id, path), /^image\/(?:png|jpeg|webp)$/).catch(() => null);
424
+ return [path, data];
425
+ })).then((entries) => new Map(entries)),
426
+ ]);
427
+ const report = document.implementation.createHTMLDocument(`${run.title} · alibai`);
428
+ report.documentElement.lang = locale;
429
+ report.documentElement.dataset.theme = document.documentElement.dataset.theme;
430
+ const charset = el("meta", "");
431
+ charset.setAttribute("charset", "utf-8");
432
+ const viewport = el("meta", "");
433
+ viewport.name = "viewport";
434
+ viewport.content = "width=device-width, initial-scale=1";
435
+ report.head.prepend(charset, viewport);
436
+ report.head.append(el("style", "", css));
437
+ const { summary } = renderCaseSummary(run, exhibits);
438
+ const cards = included.map(({ exhibit, index }) => {
439
+ const card = renderExhibit(run, exhibit, index, images);
440
+ const thread = comments?.[exhibit.item.id];
441
+ if (thread?.length) card.append(renderReportComments(thread));
442
+ return card;
443
+ });
444
+ report.body.append(el("main", "case-report", summary,
445
+ el("section", "report-evidence", el("h2", "", t("selectedEvidence")),
446
+ ...(comments === null ? [el("p", "warning", t("reportCommentsUnavailable"))] : []),
447
+ el("ol", "timeline", ...cards))));
448
+ return "<!doctype html>\n" + report.documentElement.outerHTML;
449
+ }
450
+
451
+ async function exportReport(run, exhibits, selected, print) {
452
+ const report = await buildReport(run, exhibits, selected);
453
+ if (!print) {
454
+ const href = URL.createObjectURL(new Blob([report], { type: "text/html;charset=utf-8" }));
455
+ const download = link("", href);
456
+ download.download = `alibai-${run.id.slice(0, 8)}.html`;
457
+ download.click();
458
+ setTimeout(() => URL.revokeObjectURL(href), 30_000);
459
+ return;
460
+ }
461
+
462
+ const frame = el("iframe", "report-print-frame");
463
+ frame.setAttribute("aria-hidden", "true");
464
+ frame.tabIndex = -1;
465
+ document.body.append(frame);
466
+ try {
467
+ const page = frame.contentDocument;
468
+ page.open();
469
+ page.write(report);
470
+ page.close();
471
+ await Promise.all([...page.images].map((image) => image.decode().catch(() => {})));
472
+ await page.fonts.ready;
473
+ await new Promise((resolve) => {
474
+ frame.contentWindow.addEventListener("afterprint", resolve, { once: true });
475
+ frame.contentWindow.print();
476
+ });
477
+ } finally {
478
+ frame.remove();
479
+ }
480
+ }
package/viewer/index.html CHANGED
@@ -8,6 +8,7 @@
8
8
  <link rel="stylesheet" href="./tokens.css">
9
9
  <link rel="stylesheet" href="./viewer.css">
10
10
  <script src="./messages.js" defer></script>
11
+ <script src="./evidence.js" defer></script>
11
12
  <script src="./viewer.js" defer></script>
12
13
  </head>
13
14
  <body>
@@ -67,6 +67,15 @@ const messages = {
67
67
  noScreenshot: "No screenshot recorded",
68
68
  screenshotAlt: "{label} — {action}",
69
69
  comparison: "Before and after comparison for {action}",
70
+ showSlider: "Open full-screen slider",
71
+ closeComparison: "Close comparison",
72
+ enlargeScreenshot: "Enlarge {label} screenshot — {action}",
73
+ closeScreenshot: "Close screenshot",
74
+ copyScreenshot: "Copy {label} screenshot — {action}",
75
+ screenshotCopyPending: "Copying {label} screenshot…",
76
+ screenshotCopyBusy: "Copy in progress. Try again shortly.",
77
+ screenshotCopied: "{label} screenshot copied.",
78
+ screenshotCopyFailed: "Could not copy {label} screenshot.",
70
79
  position: "{before} before, {after} after",
71
80
  screenshots: "Screenshots",
72
81
  threw: "Threw: see error",
@@ -75,9 +84,68 @@ const messages = {
75
84
  error: "Error",
76
85
  unavailable: "Case unavailable",
77
86
  back: "Back to case files",
87
+ caseNavigation: "Case navigation",
88
+ previousCase: "Previous case",
89
+ nextCase: "Next case",
90
+ comments: "Comments",
91
+ writeComment: "Write a comment…",
92
+ commentText: "Comment text",
93
+ submitComment: "Comment",
94
+ saveComment: "Save",
95
+ commentHint: "⌘/Ctrl+Enter to comment",
96
+ saveHint: "⌘/Ctrl+Enter to save · Esc to cancel",
97
+ commentActions: "Comment actions",
98
+ editCommentLabel: "Edit comment",
99
+ deleteConfirm: "Delete this comment?",
100
+ casePosition: "{current} / {total}",
101
+ editComment: "Edit",
102
+ deleteComment: "Delete",
103
+ commentEdited: "Edited",
104
+ cancel: "Cancel",
105
+ commentLoadError: "Could not load comments. Reload to try again.",
106
+ commentSaveError: "Could not save the change. Try again.",
107
+ commentConflict: "This comment changed in another tab. Reload to see the current thread.",
108
+ selectAll: "Select all",
109
+ selectExhibit: "Select {exhibit}",
110
+ selectedCount: "{count} selected",
111
+ clearSelection: "Clear",
112
+ htmlReport: "HTML report",
113
+ reportActions: "Export selected evidence",
114
+ selectedEvidence: "Selected evidence",
115
+ preparingReport: "Preparing report…",
116
+ reportError: "Could not open the report. Check your browser settings and try again.",
117
+ reportCommentsUnavailable: "This report omits comments because they could not be loaded.",
78
118
  },
79
119
  ko: {
80
120
  languageName: "한국어",
121
+ comments: "댓글",
122
+ writeComment: "댓글을 입력하세요…",
123
+ commentText: "댓글 내용",
124
+ submitComment: "댓글 달기",
125
+ saveComment: "저장",
126
+ commentHint: "⌘/Ctrl+Enter로 댓글 달기",
127
+ saveHint: "⌘/Ctrl+Enter로 저장 · Esc로 취소",
128
+ commentActions: "댓글 메뉴",
129
+ editCommentLabel: "댓글 수정",
130
+ deleteConfirm: "이 댓글을 삭제할까요?",
131
+ casePosition: "{current} / {total}",
132
+ editComment: "수정",
133
+ deleteComment: "삭제",
134
+ commentEdited: "수정됨",
135
+ cancel: "취소",
136
+ commentLoadError: "댓글을 불러오지 못했습니다. 새로고침 후 다시 시도해 주세요.",
137
+ commentSaveError: "변경 사항을 저장하지 못했습니다. 다시 시도해 주세요.",
138
+ commentConflict: "다른 탭에서 댓글이 변경되었습니다. 새로고침하면 현재 댓글을 볼 수 있습니다.",
139
+ selectAll: "전체 선택",
140
+ selectExhibit: "{exhibit} 선택",
141
+ selectedCount: "{count}개 선택",
142
+ clearSelection: "해제",
143
+ htmlReport: "HTML 보고서",
144
+ reportActions: "선택한 증거 내보내기",
145
+ selectedEvidence: "선택한 증거",
146
+ preparingReport: "보고서를 준비하는 중…",
147
+ reportError: "보고서를 열지 못했습니다. 브라우저 설정을 확인한 후 다시 시도해 주세요.",
148
+ reportCommentsUnavailable: "댓글을 불러올 수 없어 이 보고서에서 제외했습니다.",
81
149
  homeLabel: "alibai 홈",
82
150
  breadcrumbLabel: "현재 위치",
83
151
  languageLabel: "뷰어 언어",
@@ -142,6 +210,15 @@ const messages = {
142
210
  noScreenshot: "기록된 스크린샷 없음",
143
211
  screenshotAlt: "{label} — {action}",
144
212
  comparison: "{action}의 변경 전후 비교",
213
+ showSlider: "전체 화면에서 슬라이더 열기",
214
+ closeComparison: "비교 닫기",
215
+ enlargeScreenshot: "{label} 스크린샷 확대 — {action}",
216
+ closeScreenshot: "스크린샷 닫기",
217
+ copyScreenshot: "{label} 스크린샷 복사 — {action}",
218
+ screenshotCopyPending: "{label} 스크린샷을 복사하는 중입니다.",
219
+ screenshotCopyBusy: "복사 중입니다. 잠시 후 다시 시도해 주세요.",
220
+ screenshotCopied: "{label} 스크린샷을 복사했습니다.",
221
+ screenshotCopyFailed: "{label} 스크린샷을 복사할 수 없습니다.",
145
222
  position: "변경 전 {before}, 변경 후 {after}",
146
223
  screenshots: "스크린샷",
147
224
  threw: "예외 발생 (오류 참조)",
@@ -150,9 +227,40 @@ const messages = {
150
227
  error: "오류",
151
228
  unavailable: "사건 기록을 찾을 수 없음",
152
229
  back: "사건 기록으로 돌아가기",
230
+ caseNavigation: "사건 이동",
231
+ previousCase: "이전 사건",
232
+ nextCase: "다음 사건",
153
233
  },
154
234
  ja: {
155
235
  languageName: "日本語",
236
+ comments: "コメント",
237
+ writeComment: "コメントを入力…",
238
+ commentText: "コメントの内容",
239
+ submitComment: "コメントする",
240
+ saveComment: "保存",
241
+ commentHint: "⌘/Ctrl+Enter でコメント",
242
+ saveHint: "⌘/Ctrl+Enter で保存・Esc でキャンセル",
243
+ commentActions: "コメントのメニュー",
244
+ editCommentLabel: "コメントを編集",
245
+ deleteConfirm: "このコメントを削除しますか?",
246
+ casePosition: "{current} / {total}",
247
+ editComment: "編集",
248
+ deleteComment: "削除",
249
+ commentEdited: "編集済み",
250
+ cancel: "キャンセル",
251
+ commentLoadError: "コメントを読み込めませんでした。ページを再読み込みしてください。",
252
+ commentSaveError: "変更を保存できませんでした。もう一度お試しください。",
253
+ commentConflict: "別のタブでコメントが変更されました。再読み込みして最新のコメントを確認してください。",
254
+ selectAll: "すべて選択",
255
+ selectExhibit: "{exhibit}を選択",
256
+ selectedCount: "{count}件選択",
257
+ clearSelection: "解除",
258
+ htmlReport: "HTML レポート",
259
+ reportActions: "選択した証拠をエクスポート",
260
+ selectedEvidence: "選択した証拠",
261
+ preparingReport: "レポートを準備中…",
262
+ reportError: "レポートを開けませんでした。ブラウザーの設定を確認してから再試行してください。",
263
+ reportCommentsUnavailable: "コメントを読み込めなかったため、このレポートには含まれていません。",
156
264
  homeLabel: "alibai ホーム",
157
265
  breadcrumbLabel: "パンくずリスト",
158
266
  languageLabel: "ビューアーの言語",
@@ -217,6 +325,15 @@ const messages = {
217
325
  noScreenshot: "スクリーンショットの記録なし",
218
326
  screenshotAlt: "{label} — {action}",
219
327
  comparison: "{action}の変更前後を比較",
328
+ showSlider: "全画面でスライダーを開く",
329
+ closeComparison: "比較を閉じる",
330
+ enlargeScreenshot: "{label}のスクリーンショットを拡大 — {action}",
331
+ closeScreenshot: "スクリーンショットを閉じる",
332
+ copyScreenshot: "{label}のスクリーンショットをコピー — {action}",
333
+ screenshotCopyPending: "{label}のスクリーンショットをコピーしています。",
334
+ screenshotCopyBusy: "コピー中です。少し待ってからもう一度お試しください。",
335
+ screenshotCopied: "{label}のスクリーンショットをコピーしました。",
336
+ screenshotCopyFailed: "{label}のスクリーンショットをコピーできませんでした。",
220
337
  position: "変更前 {before}、変更後 {after}",
221
338
  screenshots: "スクリーンショット",
222
339
  threw: "例外発生(エラーを参照)",
@@ -225,6 +342,9 @@ const messages = {
225
342
  error: "エラー",
226
343
  unavailable: "事件記録が見つかりません",
227
344
  back: "事件記録に戻る",
345
+ caseNavigation: "事件間の移動",
346
+ previousCase: "前の事件",
347
+ nextCase: "次の事件",
228
348
  },
229
349
  };
230
350
 
package/viewer/tokens.css CHANGED
@@ -16,7 +16,7 @@
16
16
  --al-tape-ink: #2B2200; /* text on tape */
17
17
  --al-tape-text: #8A6400; /* tape-colored text on paper (AA) */
18
18
  /* semantic */
19
- --al-pass: #1C7F46;
19
+ --al-pass: #1A7742;
20
20
  --al-pass-bg: #E2F3E8;
21
21
  --al-fail: #C2332A;
22
22
  --al-fail-bg: #FBE5E2;