gitmaps 1.1.9 → 1.1.11

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/app/analytics.db CHANGED
Binary file
package/app/layout.tsx CHANGED
@@ -877,8 +877,8 @@ export default function RootLayout({ children }: { children: any }) {
877
877
  {/* Sticky Zoom Controls — floating pill, bottom-right */}
878
878
  <div id="detailModeSwitch" className="detail-mode-switch" title="Toggle preview-focused detail mode">
879
879
  <button id="toggleDetailMode" type="button" className="detail-mode-btn">
880
- <span className="detail-mode-label">Preview mode</span>
881
- <span id="detailModeState" className="detail-mode-state">Auto</span>
880
+ <span className="detail-mode-label">Renderer</span>
881
+ <span id="detailModeState" className="detail-mode-state">Preview</span>
882
882
  </button>
883
883
  </div>
884
884
 
@@ -458,9 +458,9 @@ export function setupEventListeners(ctx: CanvasContext) {
458
458
  const mode = getDetailMode();
459
459
  detailModeToggle.classList.toggle('active', mode === 'preview');
460
460
  detailModeToggle.setAttribute('title', mode === 'preview'
461
- ? 'Preview mode forced on click to restore auto detail switching'
462
- : 'Auto detail switching click to keep preview mode on at every zoom');
463
- if (stateEl) stateEl.textContent = mode === 'preview' ? 'Preview' : 'Auto';
461
+ ? 'Preview mode stays in the preview renderer at every zoom. Click to switch to classic cards.'
462
+ : 'Classic modeold full-card renderer. Click to switch back to preview mode.');
463
+ if (stateEl) stateEl.textContent = mode === 'preview' ? 'Preview' : 'Classic';
464
464
  };
465
465
  updateDetailModeUi();
466
466
  detailModeToggle.addEventListener('click', () => {
@@ -468,8 +468,8 @@ export function setupEventListeners(ctx: CanvasContext) {
468
468
  updateDetailModeUi();
469
469
  rerenderCurrentView(ctx);
470
470
  showToast(next === 'preview'
471
- ? 'Preview mode forced on'
472
- : 'Auto detail switching restored', 'info');
471
+ ? 'Preview mode enabled'
472
+ : 'Classic mode enabled', 'info');
473
473
  });
474
474
  }
475
475
 
@@ -18,11 +18,11 @@ describe('low zoom preview helpers', () => {
18
18
  expect(getLowZoomPreviewText({ path: 'bin.dat', ext: 'dat', isBinary: true, content: 'abc' }, 0)).toBe('');
19
19
  });
20
20
 
21
- test('increases world-space font size as zoom goes down', () => {
22
- const near = getLowZoomScale(0.25);
21
+ test('keeps zoomed-out on-screen text smaller than zoomed-in text', () => {
23
22
  const far = getLowZoomScale(0.1);
24
- expect(far.titleFont).toBeGreaterThan(near.titleFont);
25
- expect(far.bodyFont).toBeGreaterThan(near.bodyFont);
23
+ const near = getLowZoomScale(1);
24
+ expect(far.titleFont * 0.1).toBeLessThan(near.titleFont * 1);
25
+ expect(far.bodyFont * 0.1).toBeLessThan(near.bodyFont * 1);
26
26
  });
27
27
 
28
28
  test('wraps preview text into bounded lines with ellipsis', () => {
@@ -34,7 +34,12 @@ describe('low zoom preview helpers', () => {
34
34
  test('preview capacity estimates stay positive', () => {
35
35
  expect(estimatePreviewCharsPerLine(580, 0.25)).toBeGreaterThan(8);
36
36
  expect(estimateTitleCharsPerLine(580, 0.25)).toBeGreaterThan(8);
37
- expect(estimatePreviewLineCapacity(700, 0.25)).toBeGreaterThanOrEqual(2);
37
+ expect(estimatePreviewLineCapacity(700, 0.25)).toBeGreaterThanOrEqual(3);
38
+ });
39
+
40
+ test('higher zoom yields substantially more visible preview lines', () => {
41
+ expect(estimatePreviewLineCapacity(700, 1)).toBeGreaterThanOrEqual(20);
42
+ expect(estimatePreviewLineCapacity(700, 0.1)).toBeLessThan(estimatePreviewLineCapacity(700, 1));
38
43
  });
39
44
 
40
45
  test('title typography is larger than body typography for readability', () => {
@@ -3,17 +3,21 @@ const PREVIEWABLE_EXTS = new Set([
3
3
  ]);
4
4
 
5
5
  export function getLowZoomScale(zoom: number) {
6
- const clampedZoom = Math.max(0.08, Math.min(0.25, zoom));
7
- const progress = (0.25 - clampedZoom) / (0.25 - 0.08);
8
- const desiredScreenTitle = 14 + progress * 6;
9
- const desiredScreenBody = 9 + progress * 4;
6
+ const clampedZoom = Math.max(0.08, Math.min(1, zoom));
7
+ const progress = (clampedZoom - 0.08) / (1 - 0.08);
8
+
9
+ const desiredScreenTitle = 8 + progress * 8;
10
+ const desiredScreenBody = 5.5 + progress * 6.5;
11
+ const desiredScreenPadding = 6 + progress * 8;
12
+ const desiredScreenGap = 4 + progress * 4;
13
+
10
14
  return {
11
15
  titleFont: desiredScreenTitle / clampedZoom,
12
16
  titleLineHeight: (desiredScreenTitle * 1.08) / clampedZoom,
13
17
  bodyFont: desiredScreenBody / clampedZoom,
14
- bodyLineHeight: (desiredScreenBody * 1.45) / clampedZoom,
15
- padding: (12 + progress * 6) / clampedZoom,
16
- gap: (7 + progress * 3) / clampedZoom,
18
+ bodyLineHeight: (desiredScreenBody * 1.35) / clampedZoom,
19
+ padding: desiredScreenPadding / clampedZoom,
20
+ gap: desiredScreenGap / clampedZoom,
17
21
  radius: 10 / clampedZoom,
18
22
  };
19
23
  }
@@ -83,22 +87,26 @@ function ellipsizeWrappedLines(lines: string[], maxLines: number) {
83
87
 
84
88
  export function estimatePreviewLineCapacity(height: number, zoom: number): number {
85
89
  const scale = getLowZoomScale(zoom);
86
- const available = Math.max(scale.bodyLineHeight, height - scale.padding * 2 - scale.titleLineHeight * 2 - scale.bodyFont - scale.gap * 4);
87
- return Math.max(2, Math.floor(available / scale.bodyLineHeight));
90
+ const titleLines = zoom >= 0.35 ? 2 : 1;
91
+ const available = Math.max(
92
+ scale.bodyLineHeight * 2,
93
+ height - scale.padding * 2 - scale.titleLineHeight * titleLines - scale.bodyFont - scale.gap * 3,
94
+ );
95
+ return Math.max(zoom >= 0.6 ? 20 : zoom >= 0.35 ? 12 : 3, Math.floor(available / scale.bodyLineHeight));
88
96
  }
89
97
 
90
98
  export function estimateTitleCharsPerLine(width: number, zoom: number): number {
91
99
  const scale = getLowZoomScale(zoom);
92
- const available = Math.max(80, width - scale.padding * 2 - Math.max(14, width * 0.02));
93
- const avgCharWidth = Math.max(7, scale.titleFont * 0.58);
94
- return Math.max(8, Math.floor(available / avgCharWidth));
100
+ const available = Math.max(120, width - scale.padding * 2 - Math.max(12, width * 0.018));
101
+ const avgCharWidth = Math.max(5.5, scale.titleFont * 0.56);
102
+ return Math.max(12, Math.floor(available / avgCharWidth));
95
103
  }
96
104
 
97
105
  export function estimatePreviewCharsPerLine(width: number, zoom: number): number {
98
106
  const scale = getLowZoomScale(zoom);
99
- const available = Math.max(60, width - scale.padding * 2 - Math.max(14, width * 0.02));
100
- const avgCharWidth = Math.max(6, scale.bodyFont * 0.6);
101
- return Math.max(8, Math.floor(available / avgCharWidth));
107
+ const available = Math.max(100, width - scale.padding * 2 - Math.max(12, width * 0.018));
108
+ const avgCharWidth = Math.max(5, scale.bodyFont * 0.58);
109
+ return Math.max(10, Math.floor(available / avgCharWidth));
102
110
  }
103
111
 
104
112
  export function renderLowZoomPreviewCanvas(
@@ -135,10 +143,11 @@ export function renderLowZoomPreviewCanvas(
135
143
  roundRect(ctx, 0, 0, width, height, Math.max(6, scale.radius));
136
144
  ctx.fill();
137
145
 
146
+ const accentWidth = Math.max(6, width * 0.012);
138
147
  ctx.fillStyle = accentColor;
139
- ctx.fillRect(0, 0, Math.max(10, width * 0.02), height);
148
+ ctx.fillRect(0, 0, accentWidth, height);
140
149
 
141
- const leftInset = scale.padding + Math.max(14, width * 0.02);
150
+ const leftInset = scale.padding + accentWidth + scale.gap * 0.8;
142
151
  const topInset = scale.padding;
143
152
  const maxTextWidth = Math.max(40, width - leftInset - scale.padding);
144
153
 
@@ -146,19 +155,21 @@ export function renderLowZoomPreviewCanvas(
146
155
  ctx.font = `700 ${scale.titleFont}px "JetBrains Mono", monospace`;
147
156
  ctx.fillStyle = '#f8fafc';
148
157
  const title = path.split('/').pop() || path;
149
- const titleLines = wrapPreviewText(title, estimateTitleCharsPerLine(width, zoom), 2);
158
+ const maxTitleLines = zoom >= 0.35 ? 2 : 1;
159
+ const titleLines = wrapPreviewText(title, estimateTitleCharsPerLine(width, zoom), maxTitleLines);
150
160
  titleLines.forEach((line, index) => {
151
161
  ctx.fillText(trimToWidth(ctx, line, maxTextWidth), leftInset, topInset + index * scale.titleLineHeight);
152
162
  });
153
163
 
154
- const subtitleY = topInset + titleLines.length * scale.titleLineHeight + scale.gap * 0.8;
155
- ctx.font = `${Math.max(scale.bodyFont * 0.8, 9 / Math.max(zoom, 0.08))}px "JetBrains Mono", monospace`;
164
+ const subtitleY = topInset + titleLines.length * scale.titleLineHeight + scale.gap * 0.65;
165
+ const subtitleFont = Math.max(scale.bodyFont * 0.82, 6 / Math.max(zoom, 0.08));
166
+ ctx.font = `${subtitleFont}px "JetBrains Mono", monospace`;
156
167
  ctx.fillStyle = 'rgba(226,232,240,0.72)';
157
168
  const pathParts = path.split('/');
158
- const subtitle = pathParts.length > 1 ? pathParts.slice(Math.max(0, pathParts.length - 3), -1).join(' / ') : 'root';
169
+ const subtitle = pathParts.length > 1 ? pathParts.slice(Math.max(0, pathParts.length - 2), -1).join(' / ') : 'root';
159
170
  ctx.fillText(trimToWidth(ctx, subtitle, maxTextWidth), leftInset, subtitleY);
160
171
 
161
- const previewY = subtitleY + Math.max(scale.bodyFont * 0.8, 9 / Math.max(zoom, 0.08)) + scale.gap * 1.35;
172
+ const previewY = subtitleY + subtitleFont + scale.gap;
162
173
  const rawPreview = getLowZoomPreviewText(file, scrollTop) || 'Preview unavailable';
163
174
  const wrapped = wrapPreviewText(
164
175
  rawPreview,
@@ -53,12 +53,12 @@ export function markTransformActive() {
53
53
 
54
54
  // Track current LOD mode so we can detect transitions
55
55
  let _currentLodMode: 'full' | 'pill' = 'full';
56
- let _detailMode: 'auto' | 'preview' = (() => {
56
+ let _detailMode: 'classic' | 'preview' = (() => {
57
57
  try {
58
58
  const stored = localStorage.getItem(LOW_ZOOM_MODE_STORAGE_KEY);
59
- return stored === 'preview' ? 'preview' : 'auto';
59
+ return stored === 'classic' ? 'classic' : 'preview';
60
60
  } catch {
61
- return 'auto';
61
+ return 'preview';
62
62
  }
63
63
  })();
64
64
 
@@ -99,19 +99,19 @@ export function getPinnedCards(): Set<string> {
99
99
  return _pinnedCards;
100
100
  }
101
101
 
102
- export function getDetailMode(): 'auto' | 'preview' {
102
+ export function getDetailMode(): 'classic' | 'preview' {
103
103
  return _detailMode;
104
104
  }
105
105
 
106
- export function setDetailMode(mode: 'auto' | 'preview') {
106
+ export function setDetailMode(mode: 'classic' | 'preview') {
107
107
  _detailMode = mode;
108
108
  try {
109
109
  localStorage.setItem(LOW_ZOOM_MODE_STORAGE_KEY, mode);
110
110
  } catch { }
111
111
  }
112
112
 
113
- export function toggleDetailMode(): 'auto' | 'preview' {
114
- const next = _detailMode === 'preview' ? 'auto' : 'preview';
113
+ export function toggleDetailMode(): 'classic' | 'preview' {
114
+ const next = _detailMode === 'preview' ? 'classic' : 'preview';
115
115
  setDetailMode(next);
116
116
  return next;
117
117
  }
@@ -323,7 +323,7 @@ export function performViewportCulling(ctx: CanvasContext) {
323
323
  // Phase 4c: also materialize deferred CardManager cards
324
324
  // Reuse zoom from worldRect (already snapped) — avoids redundant ctx.snap()
325
325
  const zoom = worldRect.zoom;
326
- const isLowZoom = _detailMode === 'preview' || zoom <= LOD_ZOOM_THRESHOLD;
326
+ const isLowZoom = _detailMode === 'preview';
327
327
 
328
328
  // Important: never materialize full cards while in low-zoom pill mode.
329
329
  // Otherwise CardManager keeps mounting heavyweight cards right when the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitmaps",
3
- "version": "1.1.9",
3
+ "version": "1.1.11",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "gitmaps": "cli.ts"