Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 0.8.0

- Contributors chart: the chart icon in the Contributors view (or `Show Contributors Chart`) opens a bubble per
person, sized by their commits to the current branch, and a table with everyone's commits, share and lines added
and deleted. Hover a bubble or a row for the details; it updates when you switch branch or commit.
- Visual File History: red and cyan swap places, so neighboring rows are easier to tell apart in light themes too.

## 0.7.0

- Contributors view in the Source Control panel: everyone who committed to the current branch, by number of commits
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ No account, no sign-in, no trial, no paywall, no telemetry. MIT licensed.
lists every commit that touched the file, renames included. Select some lines and run `Show Line History` (editor
context menu) to see only the commits that changed them. Click a commit to open its diff.
- **Contributors.** A *Contributors* view in the Source Control panel lists everyone who committed to the current
branch, by number of commits. Expand a person to see their commits; click one for its files and diffs.
branch, by number of commits. Expand a person to see their commits; click one for its files and diffs. The chart
icon in its title (`Show Contributors Chart`) opens a bubble per person, sized by their commits, with a table of
everyone's commits, share and lines added and deleted. Hover a bubble or a row for the details.
- **Visual file history.** `Show Visual File History` (editor context menu, Explorer, or the icon in the File History
view) puts every commit to a file on a timeline: one row per author, dots sized by the lines changed, and added and
deleted lines underneath. Hover a dot for the commit, click it for its diff, or move between commits with the arrow
Expand Down
3 changes: 2 additions & 1 deletion extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const grafo = require('./src/grafo-vista');
const historia = require('./src/historia-vista');
const revisiones = require('./src/revisiones');
const contribuidores = require('./src/contribuidores');
const reparto = require('./src/reparto-vista');

const t = vscode.l10n.t;
let salida;
Expand Down Expand Up @@ -62,7 +63,7 @@ function activate(context) {
grafo.registrar(context, protegido);
historia.registrar(context, protegido, ficheroDelHistorial);
revisiones.registrar(context, protegido);
contribuidores.registrar(context, log);
reparto.registrar(context, protegido, log, contribuidores.registrar(context, log));
}

function deactivate() { }
Expand Down
10 changes: 8 additions & 2 deletions l10n/bundle.l10n.es.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@
"1 author": "1 autor",
"1 commit": "1 commit",
"All branches": "Todas las ramas",
"Author": "Autor",
"binary": "binario",
"Branch {0} is not fully merged. Delete it anyway?": "La rama {0} no está fusionada del todo. ¿Borrarla igualmente?",
"Branch, tag or commit SHA": "Rama, tag o SHA de un commit",
"Branches to show": "Ramas que se muestran",
"Checked out in worktree {0}": "Con checkout en el worktree {0}",
"Commit Graph": "Grafo de commits",
"Commits": "Commits",
"Compare {0} with…": "Comparar {0} con…",
"Compare: base": "Comparar: base",
"Contributors": "Colaboradores",
"Copied": "Copiado",
"Copied {0}": "Copiado {0}",
"Copy SHA": "Copiar SHA",
Expand Down Expand Up @@ -52,9 +55,11 @@
"No git repository is open": "No hay ningún repositorio git abierto",
"Not a valid name for a git ref": "Git no acepta ese nombre",
"Not a valid ref: {0}": "No es una ref válida: {0}",
"on {0}": "en {0}",
"Only the local tag is deleted.": "Solo se borra el tag local.",
"Open a file in a git repository first": "Abre antes un fichero de un repositorio git",
"Open a file tracked by git to see its history.": "Abre un fichero que siga git para ver su historial.",
"Open a folder with a git repository first": "Abre antes una carpeta con un repositorio git",
"Open changes": "Abrir cambios",
"Open on {0}": "Abrir en {0}",
"Others ({0})": "Otros ({0})",
Expand All @@ -68,6 +73,7 @@
"Reset {0} to {1} and discard all changes?": "¿Reset de {0} a {1} descartando todos los cambios?",
"Restore": "Restaurar",
"Restore {0} to its version in {1}?": "¿Restaurar {0} a su versión de {1}?",
"Share of commits per author": "Reparto de commits por autor",
"Show commit": "Ver commit",
"Show Commit Files": "Ver ficheros del commit",
"Show Commit Graph": "Ver grafo de commits",
Expand All @@ -88,6 +94,6 @@
"Uncommitted changes and the commits after {0} on this branch are lost.": "Se pierden los cambios sin commit y los commits de esta rama posteriores a {0}.",
"Uncommitted changes to this file are lost.": "Se pierden los cambios sin commit de este fichero.",
"Visual History": "Historial visual",
"Working Tree": "Árbol de trabajo",
"working tree": "árbol de trabajo"
"working tree": "árbol de trabajo",
"Working Tree": "Árbol de trabajo"
}
44 changes: 44 additions & 0 deletions media/burbujas.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// @ts-check
// Empaquetado de burbujas: cada círculo, del más grande al más pequeño, en el primer hueco libre de una espiral.
// Lo carga el webview como script y los tests con require.
(function (exportar) {
'use strict';

// radios en cualquier unidad → centros {x, y, r} sin solaparse, alrededor de (0, 0). aspecto > 1 estira la
// espiral a lo ancho para llenar un panel apaisado
function empaquetar(radios, { hueco = 2, aspecto = 1 } = {}) {
const sitios = [];
const positivos = radios.filter(r => r > 0);
// relativo también al mayor: con 10.000 commits frente a 1, un paso del menor daría millones de vueltas
const paso = positivos.length ? Math.max(0.5, Math.max(Math.min(...positivos), Math.max(...positivos) / 50) / 4) : 1;
for (const r of radios) {
let x = 0;
let y = 0;
if (sitios.length) {
// sin tope: la espiral acaba saliendo de todo lo ya colocado
for (let a = 0; ; a += 0.05) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

baja — La espiral avanza 0,05 rad por paso con un paso radial de menor/4 (mínimo 0,5) y comprueba todas las burbujas ya colocadas en cada iteración. Con mucha diferencia entre el radio mayor y el menor (un autor con decenas de miles de commits frente a otros con 1) salen decenas de miles de iteraciones por burbuja. Multiplicado por 40 burbujas, son cientos de millones de comprobaciones en el hilo principal del webview, y se repite en cada redimensionado.

Suggested change
for (let a = 0; ; a += 0.05) {
Hacer el paso relativo al radio mayor, no al menor (por ejemplo `Math.max(menor, mayor / 50) / 4`). Otra opción es avanzar el ángulo de forma que la longitud de arco por paso se mantenga constante (`a += paso / Math.max(d, 1)`), para que el coste no crezca con la diferencia de tamaños.

const d = paso * a;
x = d * Math.cos(a) * aspecto;
y = d * Math.sin(a);
if (sitios.every(s => Math.hypot(s.x - x, s.y - y) >= s.r + r + hueco)) { break; }
}
}
sitios.push({ x, y, r });
}
return sitios;
}

// escala y centra los sitios en una caja de ancho × alto (píxeles), con un margen
function encajar(sitios, ancho, alto, margen = 4) {
const izq = Math.min(...sitios.map(s => s.x - s.r));
const der = Math.max(...sitios.map(s => s.x + s.r));
const arr = Math.min(...sitios.map(s => s.y - s.r));
const aba = Math.max(...sitios.map(s => s.y + s.r));
const k = Math.min((ancho - 2 * margen) / (der - izq), (alto - 2 * margen) / (aba - arr));
const dx = ancho / 2 - ((izq + der) / 2) * k;
const dy = alto / 2 - ((arr + aba) / 2) * k;
return sitios.map(s => ({ x: s.x * k + dx, y: s.y * k + dy, r: s.r * k }));
}

exportar({ empaquetar, encajar });
}(typeof module !== 'undefined' ? f => { module.exports = f; } : f => { /** @type {any} */ (window).BURBUJAS = f; }));
12 changes: 0 additions & 12 deletions media/historia.css
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
:root {
/* orden comprobado con el validador de paleta (daltonismo, filas vecinas); amarillo y magenta se confundían */
--c0: var(--vscode-charts-blue, #3794ff);
--c1: var(--vscode-charts-orange, #d18616);
--c2: var(--vscode-charts-purple, #b180d7);
--c3: var(--vscode-charts-green, #89d185);
--c4: var(--vscode-charts-red, #f14c4c);
--c5: var(--vscode-terminal-ansiCyan, #29b8db);
--mas: var(--vscode-gitDecoration-addedResourceForeground, #81b88b);
--menos: var(--vscode-gitDecoration-deletedResourceForeground, #c74e39);
--borde: var(--vscode-widget-border, rgba(128, 128, 128, .25));
--suave: var(--vscode-descriptionForeground);
--fondo: var(--vscode-editor-background);
--salida: cubic-bezier(.22, 1, .36, 1);
--muelle: cubic-bezier(.34, 1.56, .64, 1);
--etiquetas: 168px;
}

Expand Down
15 changes: 15 additions & 0 deletions media/paleta.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* Común a los webviews de autores (historial visual, gráfico de colaboradores).
Orden comprobado con el validador de paleta en tema claro y oscuro: ningún par vecino se confunde con daltonismo */
:root {
--c0: var(--vscode-charts-blue, #3794ff);
--c1: var(--vscode-charts-orange, #d18616);
--c2: var(--vscode-charts-purple, #b180d7);
--c3: var(--vscode-charts-green, #89d185);
--c4: var(--vscode-terminal-ansiCyan, #29b8db);
--c5: var(--vscode-charts-red, #f14c4c);
--borde: var(--vscode-widget-border, rgba(128, 128, 128, .25));
--suave: var(--vscode-descriptionForeground);
--fondo: var(--vscode-editor-background);
--salida: cubic-bezier(.22, 1, .36, 1);
--muelle: cubic-bezier(.34, 1.56, .64, 1);
}
128 changes: 128 additions & 0 deletions media/reparto.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
:root {
--mas: var(--vscode-gitDecoration-addedResourceForeground, #81b88b);
--menos: var(--vscode-gitDecoration-deletedResourceForeground, #c74e39);
--alto: 300px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
margin: 0;
padding: 16px 16px 24px;
color: var(--vscode-foreground);
background: var(--fondo);
font-family: var(--vscode-font-family);
font-size: var(--vscode-font-size);
}

.cabecera { margin-bottom: 16px; }
.cabecera h1 { margin: 0; overflow: hidden; font-size: 1.15em; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.resumen { margin: 4px 0 0; color: var(--suave); font-variant-numeric: tabular-nums; }
.aviso { color: var(--suave); }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.reparto { display: grid; gap: 20px; }
.reparto[aria-busy="true"] {
height: var(--alto);
border-radius: 6px;
background: linear-gradient(90deg, transparent 0, color-mix(in srgb, var(--vscode-foreground) 6%, transparent) 50%, transparent 100%) 0 0 / 200% 100%;
animation: brillo 1.4s linear infinite;
}
@keyframes brillo { to { background-position: -200% 0; } }

.lienzo { height: var(--alto); min-width: 0; }
.nube { display: block; overflow: visible; }
/* relleno tenue con borde del color: el texto va con la tinta del tema y se lee en claro y en oscuro */
.burbuja { cursor: default; transform-box: fill-box; transform-origin: center; }
.burbuja circle {
--tinta: var(--suave);
fill: color-mix(in srgb, var(--tinta) 32%, var(--fondo));
stroke: var(--tinta);
stroke-width: 1.5;
transition: fill .15s ease-out, opacity .15s ease-out;
}
.burbuja.c0 circle { --tinta: var(--c0); } .burbuja.c1 circle { --tinta: var(--c1); } .burbuja.c2 circle { --tinta: var(--c2); }
.burbuja.c3 circle { --tinta: var(--c3); } .burbuja.c4 circle { --tinta: var(--c4); } .burbuja.c5 circle { --tinta: var(--c5); }
.burbuja.activo circle { fill: color-mix(in srgb, var(--tinta) 60%, var(--fondo)); stroke-width: 2.5; }
.enfocando .burbuja:not(.activo) { opacity: .35; }
.burbuja text { fill: var(--vscode-foreground); font-size: 12px; text-anchor: middle; pointer-events: none; font-variant-numeric: tabular-nums; }
.burbuja .nombre { font-weight: 600; }
.burbuja .cuenta { fill: var(--suave); font-size: 11px; }
.burbuja.activo .cuenta { fill: var(--vscode-foreground); }

.globo {
position: absolute;
top: 0;
left: 0;
z-index: 3;
display: grid;
gap: 2px;
max-width: min(320px, calc(100vw - 16px));
padding: 8px 10px;
color: var(--vscode-editorHoverWidget-foreground, var(--vscode-foreground));
background: var(--vscode-editorHoverWidget-background, var(--fondo));
border: 1px solid var(--vscode-editorHoverWidget-border, var(--borde));
border-radius: 6px;
box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
pointer-events: none;
font-variant-numeric: tabular-nums;
animation: aparecer .12s var(--salida);
}
.globo strong { overflow-wrap: anywhere; }
.globo .suave { color: var(--suave); overflow-wrap: anywhere; }
@keyframes aparecer { from { opacity: 0; } }

.lista { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.lista th { padding: 0 8px 6px; color: var(--suave); font-weight: 500; text-align: left; border-bottom: 1px solid var(--borde); }
.lista td { padding: 6px 8px; vertical-align: middle; }
.lista .num { width: 1%; text-align: right; white-space: nowrap; }
.lista td.lineas { min-width: 8.5em; }
.lista tbody tr { cursor: default; outline: none; transition: background .15s ease-out; }
.lista tbody tr:hover, .lista tbody tr.activo { background: var(--vscode-list-hoverBackground); }
.lista tbody tr:focus-visible { outline: 1px solid var(--vscode-focusBorder); outline-offset: -1px; }
.lista td:first-child { border-radius: 4px 0 0 4px; }
.lista td:last-child { border-radius: 0 4px 4px 0; }

.autor { max-width: 0; }
.nombre { display: flex; align-items: center; gap: 8px; min-width: 0; }
/* con el nombre repetido, el correo es lo primero que se recorta */
.nombre .texto { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.correo { flex: 0 100 auto; min-width: 0; overflow: hidden; color: var(--suave); text-overflow: ellipsis; white-space: nowrap; }
.muestra { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--suave); }
.c0 .muestra, .c0 .barra i { background: var(--c0); } .c1 .muestra, .c1 .barra i { background: var(--c1); }
.c2 .muestra, .c2 .barra i { background: var(--c2); } .c3 .muestra, .c3 .barra i { background: var(--c3); }
.c4 .muestra, .c4 .barra i { background: var(--c4); } .c5 .muestra, .c5 .barra i { background: var(--c5); }

/* barra fina: compara con precisión lo que las burbujas solo enseñan a ojo */
.barra { display: block; height: 3px; margin: 5px 0 0 18px; }
.barra i {
display: block;
width: calc(var(--parte) * 100%);
min-width: 2px;
height: 100%;
border-radius: 2px;
background: var(--suave);
transform-origin: left;
}
.mas { color: var(--mas); }
.menos { color: var(--menos); }

/* primera vez: las burbujas brotan de mayor a menor y las barras crecen desde la izquierda */
.animar .burbuja { animation: brotar .45s var(--muelle) var(--retardo) both; }
.animar .barra i { animation: crecer .5s var(--salida) var(--retardo) both; }
@keyframes brotar { from { transform: scale(0); opacity: 0; } }
@keyframes crecer { from { transform: scaleX(0); } }

@media (max-width: 560px) {
:root { --alto: 240px; }
body { padding: 12px 8px 16px; }
}
@media (max-width: 400px) {
.lista .lineas { display: none; }
}

@media (prefers-reduced-motion: reduce) {
.reparto[aria-busy="true"], .animar .burbuja, .animar .barra i, .globo { animation: none !important; }
.burbuja circle, .lista tbody tr { transition: none; }
}
Loading