@youtyan/code-viewer 0.9.1 → 0.9.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@youtyan/code-viewer",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "Local browser-based code and git diff viewer",
5
5
  "type": "module",
6
6
  "bin": {
package/web/app.js CHANGED
@@ -247,6 +247,22 @@ ${lines.join(`
247
247
  };
248
248
  }
249
249
 
250
+ // web-src/core/changed-paths.ts
251
+ function changedPathCoversPath(changed, path) {
252
+ return path === changed || path.startsWith(`${changed}/`);
253
+ }
254
+ function changedPathsCoverPath(changedPaths, path) {
255
+ if (!changedPaths)
256
+ return true;
257
+ if (changedPaths.has(path))
258
+ return true;
259
+ for (const changed of changedPaths) {
260
+ if (changedPathCoversPath(changed, path))
261
+ return true;
262
+ }
263
+ return false;
264
+ }
265
+
250
266
  // web-src/core/expand-logic.ts
251
267
  function initExpandState(prevHunkEndNew, hunkNewStart) {
252
268
  return {
@@ -23697,7 +23713,7 @@ ${entry.message}` : entry.detail ?? entry.message ?? "";
23697
23713
  function invalidateLoadedCard(card, file, changedPaths, measuredHeight) {
23698
23714
  if (!card.classList.contains("loaded") && !card.classList.contains("loading"))
23699
23715
  return false;
23700
- if (changedPaths && !changedPaths.has(file.path))
23716
+ if (!changedPathsCoverPath(changedPaths, file.path))
23701
23717
  return false;
23702
23718
  card.dataset.reqId = String(++CLIENT_REQ_SEQ);
23703
23719
  card.style.minHeight = `${measuredHeight ?? card.offsetHeight}px`;
@@ -23787,13 +23803,12 @@ ${entry.message}` : entry.detail ?? entry.message ?? "";
23787
23803
  const pathsUnknown = !changedPaths;
23788
23804
  const contentMayNeedReload = !listSame || pathsUnknown || (changedPaths ? newFiles.some((file) => {
23789
23805
  const key = fileKey(file);
23790
- return prevCardSignatures.get(key) !== newCardSigs.get(key) || changedPaths.has(file.path);
23806
+ return prevCardSignatures.get(key) !== newCardSigs.get(key) || changedPathsCoverPath(changedPaths, file.path);
23791
23807
  }) : false);
23792
23808
  if (contentMayNeedReload)
23793
23809
  resetLoadScheduling();
23794
23810
  let invalidatedCards = 0;
23795
23811
  if (listSame && domIntact) {
23796
- const pathsUnknown2 = !changedPaths;
23797
23812
  const cardsByKey = collectDiffCardsByKey(target);
23798
23813
  const measuredHeights = new Map;
23799
23814
  for (const f2 of newFiles) {
@@ -23808,7 +23823,7 @@ ${entry.message}` : entry.detail ?? entry.message ?? "";
23808
23823
  const oldSig = prevCardSignatures.get(key);
23809
23824
  const newSig = newCardSigs.get(key) ?? computeCardSignature(f2);
23810
23825
  const sigChanged = oldSig !== newSig;
23811
- const pathHint = pathsUnknown2 || changedPaths.has(f2.path);
23826
+ const pathHint = changedPathsCoverPath(changedPaths, f2.path);
23812
23827
  if (!sigChanged && !pathHint) {
23813
23828
  continue;
23814
23829
  }
@@ -36593,6 +36608,11 @@ code-viewer query agent-help`
36593
36608
  SERVER_SCOPE_WATCH_LIMIT_MIN = settings.scope.watch_limit_min;
36594
36609
  if (typeof settings.scope.watch_limit_max === "number")
36595
36610
  SERVER_SCOPE_WATCH_LIMIT_MAX = settings.scope.watch_limit_max;
36611
+ if (typeof settings.scope.watch_recursive === "boolean") {
36612
+ const watchSection = document.querySelector("#watch-settings-section");
36613
+ if (watchSection)
36614
+ watchSection.hidden = settings.scope.watch_recursive;
36615
+ }
36596
36616
  return settings;
36597
36617
  } catch {
36598
36618
  return null;
@@ -40079,7 +40099,7 @@ code-viewer query agent-help`
40079
40099
  return;
40080
40100
  if (isBlobOrBlameFileRoute(route)) {
40081
40101
  const viewingPath = route.path;
40082
- if (paths && viewingPath && !paths.has(viewingPath))
40102
+ if (viewingPath && !changedPathsCoverPath(paths, viewingPath))
40083
40103
  return;
40084
40104
  dispatchFileRoute(route, { refresh: true });
40085
40105
  return;
@@ -40127,7 +40147,7 @@ code-viewer query agent-help`
40127
40147
  const route = STATE.route;
40128
40148
  if (isBlobOrBlameFileRoute(route)) {
40129
40149
  const viewingPath = route.path;
40130
- if (paths && viewingPath && !paths.has(viewingPath))
40150
+ if (viewingPath && !changedPathsCoverPath(paths, viewingPath))
40131
40151
  return;
40132
40152
  }
40133
40153
  if (STATE.autoUpdate) {
package/web/index.html CHANGED
@@ -191,7 +191,7 @@
191
191
  </label>
192
192
  <p id="datastore-s3-tooltip-help" class="scope-settings-help"></p>
193
193
  </div>
194
- <div class="scope-settings-section">
194
+ <div id="watch-settings-section" class="scope-settings-section">
195
195
  <strong id="watch-section-title" class="scope-settings-section-title">File change watcher</strong>
196
196
  <label for="scope-watch-limit">Maximum directories to watch</label>
197
197
  <div class="scope-watch-limit-row">