gitmaps 1.0.0 → 1.1.1

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 (145) hide show
  1. package/README.md +265 -122
  2. package/app/[...slug]/page.client.tsx +1 -0
  3. package/app/[...slug]/page.tsx +6 -0
  4. package/app/[owner]/[repo]/page.client.tsx +5 -0
  5. package/app/[slug]/page.client.tsx +5 -0
  6. package/app/analytics.db +0 -0
  7. package/app/api/analytics/route.ts +64 -0
  8. package/app/api/auth/positions/route.ts +95 -33
  9. package/app/api/build-info/route.ts +19 -0
  10. package/app/api/chat/route.ts +13 -2
  11. package/app/api/manifest.json/route.ts +20 -0
  12. package/app/api/og-image/route.ts +14 -0
  13. package/app/api/pwa-icon/route.ts +14 -0
  14. package/app/api/repo/clone-stream/route.ts +20 -12
  15. package/app/api/repo/file-content/route.ts +73 -20
  16. package/app/api/repo/imports/route.ts +21 -3
  17. package/app/api/repo/list/route.ts +30 -0
  18. package/app/api/repo/load/route.test.ts +62 -0
  19. package/app/api/repo/load/route.ts +41 -1
  20. package/app/api/repo/pdf-thumb/route.ts +127 -0
  21. package/app/api/repo/resolve-slug/route.ts +51 -0
  22. package/app/api/repo/tree/route.ts +188 -104
  23. package/app/api/repo/upload/route.ts +6 -9
  24. package/app/api/sw.js/route.ts +70 -0
  25. package/app/api/version/route.ts +26 -0
  26. package/app/galaxy-canvas/page.client.tsx +2 -0
  27. package/app/galaxy-canvas/page.tsx +5 -0
  28. package/app/globals.css +5844 -4694
  29. package/app/icon.png +0 -0
  30. package/app/layout.tsx +1284 -467
  31. package/app/lib/auto-arrange.test.ts +158 -0
  32. package/app/lib/auto-arrange.ts +147 -0
  33. package/app/lib/canvas-export.ts +358 -358
  34. package/app/lib/canvas-text.ts +4 -72
  35. package/app/lib/canvas.ts +625 -564
  36. package/app/lib/card-arrangement.ts +21 -7
  37. package/app/lib/card-context-menu.tsx +2 -2
  38. package/app/lib/card-groups.ts +9 -2
  39. package/app/lib/cards.tsx +1361 -914
  40. package/app/lib/chat.tsx +65 -9
  41. package/app/lib/code-editor.ts +86 -2
  42. package/app/lib/connections.tsx +34 -43
  43. package/app/lib/context.test.ts +32 -0
  44. package/app/lib/context.ts +19 -3
  45. package/app/lib/cursor-sharing.ts +34 -0
  46. package/app/lib/events.tsx +76 -73
  47. package/app/lib/export-canvas.ts +287 -0
  48. package/app/lib/file-card-plugin.ts +148 -134
  49. package/app/lib/file-modal.tsx +49 -0
  50. package/app/lib/file-preview.ts +486 -400
  51. package/app/lib/github-import.test.ts +424 -0
  52. package/app/lib/global-search.ts +48 -27
  53. package/app/lib/initial-route-hydration.test.ts +283 -0
  54. package/app/lib/initial-route-hydration.ts +202 -0
  55. package/app/lib/landing-reset.test.ts +99 -0
  56. package/app/lib/landing-reset.ts +106 -0
  57. package/app/lib/landing-shell.test.ts +75 -0
  58. package/app/lib/large-repo-optimization.ts +37 -0
  59. package/app/lib/layers.tsx +17 -18
  60. package/app/lib/layout-snapshots.ts +320 -0
  61. package/app/lib/loading.test.ts +69 -0
  62. package/app/lib/loading.tsx +160 -45
  63. package/app/lib/mount-cleanup.test.ts +52 -0
  64. package/app/lib/mount-cleanup.ts +34 -0
  65. package/app/lib/mount-init.test.ts +123 -0
  66. package/app/lib/mount-init.ts +107 -0
  67. package/app/lib/mount-lifecycle.test.ts +39 -0
  68. package/app/lib/mount-lifecycle.ts +12 -0
  69. package/app/lib/mount-route-wiring.test.ts +87 -0
  70. package/app/lib/mount-route-wiring.ts +84 -0
  71. package/app/lib/multi-repo.ts +14 -0
  72. package/app/lib/onboarding-tutorial.ts +278 -0
  73. package/app/lib/perf-overlay.ts +78 -0
  74. package/app/lib/positions.ts +191 -122
  75. package/app/lib/recent-commits.test.ts +869 -0
  76. package/app/lib/recent-commits.ts +227 -0
  77. package/app/lib/repo-handoff.test.ts +23 -0
  78. package/app/lib/repo-handoff.ts +16 -0
  79. package/app/lib/repo-progressive.ts +119 -0
  80. package/app/lib/repo-select.test.ts +61 -0
  81. package/app/lib/repo-select.ts +74 -0
  82. package/app/lib/repo.tsx +1383 -977
  83. package/app/lib/role.ts +228 -0
  84. package/app/lib/route-catchall.test.ts +27 -0
  85. package/app/lib/route-repo-entry.test.ts +95 -0
  86. package/app/lib/route-repo-entry.ts +36 -0
  87. package/app/lib/router-contract.test.ts +22 -0
  88. package/app/lib/router-contract.ts +19 -0
  89. package/app/lib/shared-layout.test.ts +86 -0
  90. package/app/lib/shared-layout.ts +82 -0
  91. package/app/lib/shortcuts-panel.ts +2 -0
  92. package/app/lib/status-bar.test.ts +118 -0
  93. package/app/lib/status-bar.ts +365 -128
  94. package/app/lib/sync-controls.test.ts +43 -0
  95. package/app/lib/sync-controls.tsx +303 -0
  96. package/app/lib/test-dom.ts +145 -0
  97. package/app/lib/test-fixtures/router-contract/[...slug]/page.tsx +3 -0
  98. package/app/lib/test-fixtures/router-contract/api/health/route.ts +3 -0
  99. package/app/lib/test-fixtures/router-contract/api/version/route.ts +3 -0
  100. package/app/lib/test-fixtures/router-contract/galaxy-canvas/page.tsx +3 -0
  101. package/app/lib/test-fixtures/router-contract/page.tsx +3 -0
  102. package/app/lib/transclusion-smoke.test.ts +163 -0
  103. package/app/lib/tutorial.ts +301 -0
  104. package/app/lib/version.ts +93 -0
  105. package/app/lib/viewport-culling.ts +740 -728
  106. package/app/lib/virtual-files.ts +456 -0
  107. package/app/lib/webgl-text.ts +189 -0
  108. package/app/lib/{galaxydraw-bridge.ts → xydraw-bridge.ts} +485 -477
  109. package/app/lib/{galaxydraw.test.ts → xydraw.test.ts} +228 -229
  110. package/app/og-image.png +0 -0
  111. package/app/page.client.tsx +70 -215
  112. package/app/page.tsx +27 -92
  113. package/app/state/machine.js +13 -0
  114. package/banner.png +0 -0
  115. package/package.json +17 -8
  116. package/server.ts +11 -1
  117. package/app/api/connections/route.ts +0 -72
  118. package/app/api/positions/route.ts +0 -80
  119. package/app/api/repo/browse/route.ts +0 -55
  120. package/app/lib/pr-review.ts +0 -374
  121. package/packages/galaxydraw/README.md +0 -296
  122. package/packages/galaxydraw/banner.png +0 -0
  123. package/packages/galaxydraw/demo/build-static.ts +0 -100
  124. package/packages/galaxydraw/demo/client.ts +0 -154
  125. package/packages/galaxydraw/demo/dist/client.js +0 -8
  126. package/packages/galaxydraw/demo/index.html +0 -256
  127. package/packages/galaxydraw/demo/server.ts +0 -96
  128. package/packages/galaxydraw/dist/index.js +0 -984
  129. package/packages/galaxydraw/dist/index.js.map +0 -16
  130. package/packages/galaxydraw/node_modules/.bin/tsc.bunx +0 -0
  131. package/packages/galaxydraw/node_modules/.bin/tsc.exe +0 -0
  132. package/packages/galaxydraw/node_modules/.bin/tsserver.bunx +0 -0
  133. package/packages/galaxydraw/node_modules/.bin/tsserver.exe +0 -0
  134. package/packages/galaxydraw/package.json +0 -49
  135. package/packages/galaxydraw/perf.test.ts +0 -284
  136. package/packages/galaxydraw/src/core/cards.ts +0 -435
  137. package/packages/galaxydraw/src/core/engine.ts +0 -339
  138. package/packages/galaxydraw/src/core/events.ts +0 -81
  139. package/packages/galaxydraw/src/core/layout.ts +0 -136
  140. package/packages/galaxydraw/src/core/minimap.ts +0 -216
  141. package/packages/galaxydraw/src/core/state.ts +0 -177
  142. package/packages/galaxydraw/src/core/viewport.ts +0 -106
  143. package/packages/galaxydraw/src/galaxydraw.css +0 -166
  144. package/packages/galaxydraw/src/index.ts +0 -40
  145. package/packages/galaxydraw/tsconfig.json +0 -30
@@ -8,7 +8,7 @@
8
8
  */
9
9
  import { measure } from 'measure-fn';
10
10
  import type { CanvasContext } from './context';
11
- import { savePosition } from './positions';
11
+ import { savePosition, flushPositions } from './positions';
12
12
  import { updateMinimap } from './canvas';
13
13
  import { renderConnections } from './connections';
14
14
 
@@ -35,11 +35,19 @@ function getSelectedCardsInfo(ctx: CanvasContext): CardInfo[] {
35
35
  const x = parseFloat(card.style.left);
36
36
  const y = parseFloat(card.style.top);
37
37
  if (isNaN(x) || isNaN(y)) return;
38
+ // In pill mode, card might be display:none (0px) or rendered as a pill (~24px).
39
+ let cw = card.offsetWidth;
40
+ let ch = card.offsetHeight;
41
+ if (!cw || cw < 100) cw = 580;
42
+ if (!ch || ch < 100) ch = 700;
43
+
44
+ const pos = ctx.positions?.get(path);
45
+ const def = ctx.deferredCards?.get(path);
38
46
  infos.push({
39
47
  path, card,
40
48
  x, y,
41
- w: card.offsetWidth || 580,
42
- h: card.offsetHeight || 400,
49
+ w: pos?.width || def?.size?.width || cw,
50
+ h: pos?.height || def?.size?.height || ch,
43
51
  });
44
52
  }
45
53
  });
@@ -69,16 +77,19 @@ function getSelectedCardsInfo(ctx: CanvasContext): CardInfo[] {
69
77
  if (infos.length < selected.length) {
70
78
  selected.forEach(path => {
71
79
  if (seen.has(path)) return;
72
- const pill = document.querySelector(`.file-card-pill[data-path="${CSS.escape(path)}"]`) as HTMLElement;
80
+ const pill = document.querySelector(`.file-pill[data-path="${CSS.escape(path)}"]`) as HTMLElement;
73
81
  if (pill) {
74
82
  const x = parseFloat(pill.style.left);
75
83
  const y = parseFloat(pill.style.top);
76
84
  if (isNaN(x) || isNaN(y)) return;
85
+ // Pills are tiny (~24px) — use stored size or default card size
86
+ const pos = ctx.positions?.get(path);
87
+ const def = ctx.deferredCards?.get(path);
77
88
  infos.push({
78
89
  path, card: null,
79
90
  x, y,
80
- w: pill.offsetWidth || 580,
81
- h: pill.offsetHeight || 400,
91
+ w: pos?.width || def?.size?.width || 580,
92
+ h: pos?.height || def?.size?.height || 700,
82
93
  });
83
94
  }
84
95
  });
@@ -104,7 +115,7 @@ function applyPosition(ctx: CanvasContext, info: CardInfo, newX: number, newY: n
104
115
  }
105
116
 
106
117
  // Update pill element
107
- const pill = document.querySelector(`.file-card-pill[data-path="${CSS.escape(info.path)}"]`) as HTMLElement;
118
+ const pill = document.querySelector(`.file-pill[data-path="${CSS.escape(info.path)}"]`) as HTMLElement;
108
119
  if (pill) {
109
120
  pill.style.left = `${newX}px`;
110
121
  pill.style.top = `${newY}px`;
@@ -126,6 +137,7 @@ export function arrangeRow(ctx: CanvasContext) {
126
137
  savePosition(ctx, commitHash, info.path, curX, startY);
127
138
  curX += info.w + gap;
128
139
  });
140
+ flushPositions(ctx); // Force immediate save — don't rely on debounce for batch arrange
129
141
  renderConnections(ctx);
130
142
  updateMinimap(ctx);
131
143
  });
@@ -146,6 +158,7 @@ export function arrangeColumn(ctx: CanvasContext) {
146
158
  savePosition(ctx, commitHash, info.path, startX, curY);
147
159
  curY += info.h + gap;
148
160
  });
161
+ flushPositions(ctx);
149
162
  renderConnections(ctx);
150
163
  updateMinimap(ctx);
151
164
  });
@@ -182,6 +195,7 @@ export function arrangeGrid(ctx: CanvasContext) {
182
195
  savePosition(ctx, commitHash, info.path, x, y);
183
196
  });
184
197
 
198
+ flushPositions(ctx);
185
199
  renderConnections(ctx);
186
200
  updateMinimap(ctx);
187
201
  });
@@ -93,8 +93,8 @@ function ContextMenu({ onAction, onActionLayer, onSelectFolder, isInActiveLayer,
93
93
  </div>
94
94
  </div>
95
95
  {isInActiveLayer && (
96
- <button className="ctx-item" onClick={() => onAction('remove-from-layer')} style="color: #ef4444">
97
- Remove from Layer
96
+ <button className="ctx-item" onClick={() => onAction('remove-from-layer')} style="color: #60a5fa">
97
+ Move to Main
98
98
  </button>
99
99
  )}
100
100
  <div className="ctx-divider"></div>
@@ -24,8 +24,8 @@ const activeGroups = new Map<string, CollapsedGroup>();
24
24
 
25
25
  // ─── Persistence ─────────────────────────────────────────
26
26
  function getStorageKey(): string {
27
- const hash = location.hash?.slice(1) || 'default';
28
- return `gitmaps:collapsed-dirs:${hash}`;
27
+ const repoPath = _ctx?.snap().context.repoPath || 'default';
28
+ return `gitmaps:collapsed-dirs:${repoPath}`;
29
29
  }
30
30
 
31
31
  function saveState() {
@@ -45,6 +45,13 @@ function loadState() {
45
45
  } catch { }
46
46
  }
47
47
 
48
+ export function resetCardGroups() {
49
+ for (const group of activeGroups.values()) {
50
+ group.groupCard.remove();
51
+ }
52
+ activeGroups.clear();
53
+ }
54
+
48
55
  // ─── Group card rendering ────────────────────────────────
49
56
  function createGroupCard(dir: string, files: CollapsedGroup['files']): HTMLElement {
50
57
  const card = document.createElement('div');