@happy-nut/monacori 0.1.11 → 0.1.12

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.
package/dist/render.js CHANGED
@@ -84,8 +84,14 @@ export function splitDiffForLazy(diffHtml, files) {
84
84
  }
85
85
  // The toolbar's review-status row (file/hunk counts, index + live status). Extracted so the in-place
86
86
  // update path can re-render just this strip; renderDiffHtml wraps it in <div class="review-status">.
87
- export function renderReviewStatus(input) {
88
- return `<span>${input.files} <span data-i18n="status.files">files</span></span><span>${input.hunks} <span data-i18n="status.hunks">hunks</span></span>${input.ignoreWhitespace ? '<span class="ws-ignored" data-i18n="status.wsIgnored" data-i18n-title="status.wsIgnored.title" title="Whitespace ignored — Cmd/Ctrl+Shift+W">ws ignored</span>' : ""}<span class="index-status" id="index-status" data-i18n-title="status.index.title" title="Go-to-definition index">${input.embeddedFiles}/${input.sourceFileCount} indexed</span><span class="index-progress hidden" id="index-progress" aria-hidden="true"><span class="index-progress-bar"></span></span><span class="live-status ${input.watch ? "watching" : ""}" id="live-status"${input.watch ? ' data-i18n="status.watching"' : ""}>${input.watch ? "watching" : escapeHtml(input.generatedAt ?? new Date().toISOString())}</span>`;
87
+ export function renderReviewStatus(_input) {
88
+ // Deliberately empty. The reviewer asked for a clean header: file/hunk counts duplicate the Changes
89
+ // tab, the raw generatedAt ISO string is unreadable, and "<embedded>/<total> indexed" is a STATIC
90
+ // ratio (not a live counter), so it reads as a frozen/broken progress number. Symbol-index progress
91
+ // now surfaces only as the thin footer-progress bar (setIndexProgress still drives it via null-guards);
92
+ // the "viewed" toggle is a separate button outside this strip, so it stays. `.review-status:empty`
93
+ // collapses the now-empty strip so it takes no space next to the breadcrumb.
94
+ return "";
89
95
  }
90
96
  export function renderDiffHtml(input) {
91
97
  const totalHunks = input.files.reduce((sum, file) => sum + file.hunks.length, 0);
@@ -123,6 +129,7 @@ export function renderDiffHtml(input) {
123
129
  : `<div class="tab-panel" id="files-panel">${sourceNav}</div>`,
124
130
  "</div>",
125
131
  `<div class="sidebar-footer"><span class="app-version">monacori${packageVersion ? " v" + escapeHtml(packageVersion) : ""}</span><span id="app-update-flag" class="app-update-flag hidden" data-i18n="sidebar.updateAvailable" data-i18n-title="settings.updateAvailable" title="Update available">update available</span><button type="button" id="terminal-toggle" class="settings-btn terminal-toggle hidden" data-i18n-title="terminal.toggle" title="Toggle terminal (Ctrl+\`)" aria-label="Toggle terminal"><svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 7l4 5-4 5"/><path d="M13 17h6"/></svg></button><button type="button" id="app-info-btn" class="settings-btn" aria-haspopup="dialog" data-i18n-aria="about.title" data-i18n-title="about.title" aria-label="About monacori" title="About monacori">⚙</button></div>`,
132
+ '<div id="footer-progress" class="footer-progress hidden" aria-hidden="true"><div class="footer-progress-bar"></div></div>',
126
133
  "</aside>",
127
134
  '<div class="sidebar-resizer" aria-hidden="true"></div>',
128
135
  '<main class="content">',
@@ -174,6 +181,8 @@ export function renderDiffHtml(input) {
174
181
  '<button type="button" id="app-info-update" class="plain-button app-info-update hidden" data-i18n="settings.updateRestart">Update &amp; Restart</button>',
175
182
  '<label class="settings-label" for="settings-language" data-i18n="settings.language">Language</label>',
176
183
  '<select id="settings-language" class="settings-select"><option value="en">English</option><option value="ko">한국어</option></select>',
184
+ '<label class="settings-label" for="settings-theme" data-i18n="settings.theme">Theme</label>',
185
+ '<select id="settings-theme" class="settings-select"><option value="dark" data-i18n="theme.dark">Dark</option><option value="light" data-i18n="theme.light">Light</option></select>',
177
186
  '<div class="app-info-keys">' +
178
187
  '<div class="app-info-keys-h" data-i18n="settings.kbd.title">Keyboard shortcuts</div>' +
179
188
  '<div class="keys-cat" data-i18n="settings.kbd.cat.nav">Navigation</div>' +
package/dist/util.js CHANGED
@@ -1,4 +1,4 @@
1
- import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
1
+ import { closeSync, existsSync, openSync, readFileSync, readSync, readdirSync, statSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { createHash } from "node:crypto";
4
4
  export function stripHtmlTags(value) {
@@ -56,8 +56,18 @@ export function languageForPath(path) {
56
56
  return "text";
57
57
  }
58
58
  export function isLikelyBinary(path) {
59
- const sample = readFileSync(path).subarray(0, 8000);
60
- return sample.includes(0);
59
+ // Read only the first 8KB — a NUL byte in the head is our binary heuristic. The previous version read
60
+ // the WHOLE file just to slice 8KB off it, which on a large repo means re-reading every tracked file
61
+ // in full on each build (a major chunk of the per-second watch cost).
62
+ const fd = openSync(path, "r");
63
+ try {
64
+ const buf = Buffer.alloc(8000);
65
+ const n = readSync(fd, buf, 0, 8000, 0);
66
+ return buf.subarray(0, n).includes(0);
67
+ }
68
+ finally {
69
+ closeSync(fd);
70
+ }
61
71
  }
62
72
  export function readOption(args, name) {
63
73
  const index = args.indexOf(name);