ework-web 0.10.39 → 0.10.40

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/remote-file.ts +17 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ework-web",
3
- "version": "0.10.39",
3
+ "version": "0.10.40",
4
4
  "type": "module",
5
5
  "description": "ework-web — standalone multi-project issue tracker. Local SQLite-backed, no external API dependency. Bun + TypeScript + SSR HTML.",
6
6
  "license": "MIT",
@@ -118,7 +118,7 @@ export async function browseRemoteFile(
118
118
  throw new RemoteFileError(err.error ?? `daemon returned ${readResp.status}`, readResp.status);
119
119
  }
120
120
  const data = (await readResp.json()) as FileContent;
121
- return { html: renderFileContent(data, endpoint, daemonLabel, viewerLogin) };
121
+ return { html: renderFileContent(data, rawPath, endpoint, daemonLabel, viewerLogin) };
122
122
  }
123
123
 
124
124
  function renderDirListing(
@@ -179,6 +179,7 @@ ${tabNavHTML("sessions", user)}
179
179
 
180
180
  function renderFileContent(
181
181
  data: FileContent,
182
+ rawPath: string,
182
183
  endpoint: string,
183
184
  daemonLabel: string,
184
185
  viewerLogin?: string
@@ -187,16 +188,16 @@ function renderFileContent(
187
188
  const daemonParam = `&daemon=${enc(endpoint)}`;
188
189
  const user = viewerLogin ? { login: viewerLogin, is_admin: 0 } : undefined;
189
190
 
190
- const ext = (data.path.split(".").pop() || "").toLowerCase();
191
+ const ext = (rawPath.split(".").pop() || "").toLowerCase();
191
192
  const isMd = ext === "md" || ext === "markdown";
192
- const lang = extToLang(data.path);
193
+ const lang = extToLang(rawPath);
193
194
  const fullText = data.rows.map((r) => r.t).join("\n");
194
195
  const shownBytes = data.rows.reduce((s, r) => s + r.t.length + 1, 0);
195
196
 
196
197
  let body: string;
197
198
  if (isMd) {
198
199
  body = `<div class="md-render">${renderMarkdown(fullText, "")}</div>`;
199
- } else if (lang && shownBytes <= 100000) {
200
+ } else if (lang && shownBytes <= 256000) {
200
201
  const nums = data.rows.map((r) => r.n).join("\n");
201
202
  body = `<div class="fv-code"><pre class="fv-gutter">${escapeHtml(nums)}</pre><pre class="fv-src"><code class="hljs language-${escapeHtml(lang)}">${hljsHighlight(fullText, lang)}</code></pre></div>`;
202
203
  } else {
@@ -210,6 +211,18 @@ function renderFileContent(
210
211
  <title>ework-web · ${escapeHtml(data.path)}</title>
211
212
  <link rel="stylesheet" href="/static/highlight.css">
212
213
  <style>${THEME_CSS}
214
+ .hljs{color:var(--text);background:transparent}
215
+ .hljs-comment,.hljs-quote{color:var(--text-muted);font-style:italic}
216
+ .hljs-keyword,.hljs-selector-tag,.hljs-built_in,.hljs-type{color:#d73a49;font-weight:600}
217
+ .hljs-string,.hljs-attr,.hljs-template-tag,.hljs-addition{color:#032f62}
218
+ .hljs-number,.hljs-literal,.hljs-variable,.hljs-template-variable{color:#005cc5}
219
+ .hljs-title,.hljs-section,.hljs-name,.hljs-function .hljs-title{color:#6f42c1;font-weight:600}
220
+ .hljs-tag{color:var(--text-muted)}
221
+ .hljs-attribute{color:#005cc5}
222
+ .hljs-regexp,.hljs-link{color:#032f62}
223
+ .hljs-deletion{color:#b31d28;background-color:#ffeef0}
224
+ .hljs-addition{background-color:#f0fff4}
225
+ @media(prefers-color-scheme:dark){.hljs-keyword,.hljs-selector-tag,.hljs-built_in,.hljs-type{color:#ff7b72}.hljs-string,.hljs-attr,.hljs-template-tag{color:#a5d6ff}.hljs-number,.hljs-literal,.hljs-variable{color:#79c0ff}.hljs-title,.hljs-section,.hljs-name,.hljs-function .hljs-title{color:#d2a8ff}.hljs-comment,.hljs-quote{color:#8b949e}.hljs-deletion{color:#ffa198;background:#67060c}.hljs-addition{background:#033a16}}
213
226
  .nav{display:flex;align-items:center;gap:.5rem;padding:.55rem 1rem;background:var(--header-bg);color:var(--header-text);font-size:13px}
214
227
  .nav a{color:var(--header-text);opacity:.95}
215
228
  .wrap{max-width:1100px;margin:0 auto;padding:1rem}