Repository navigation
feat: gráfico de colaboradores (0.8.0) #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1c524b7
feat: gráfico de colaboradores con una burbuja por persona
jlopez994 3823d58
fix: el gráfico de colaboradores se redibuja tras recargar oculto y n…
jlopez994 5867c25
fix: el gráfico de colaboradores no recalcula las líneas en el mismo …
jlopez994 5196a87
fix: paso mínimo de la espiral y comentario de la caché de líneas
jlopez994 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) { | ||
| 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; })); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.