docs(issues): marcar 0025 y 0026 como completados + WIP master

Wave 1 de parallel-fix-issues integrada a master:
- 0025: text_editor_cpp_core + file_watcher_cpp_core
- 0026: gl_texture_load_cpp_gfx (vendor: stb_image v2.30)

Ademas se commitea WIP previo de master que estaba sin commitear (cambios
en shaders_lab, dag_*, framework, tokens, kpi_card, gl_loader.md, etc.)
para dejar HEAD buildable.

Notas:
- Algunos deps del gallery (button.cpp, toolbar.cpp, modal_dialog.cpp...)
  siguen UNTRACKED — gating con FN_BUILD_GALLERY=ON (default OFF) para
  que master build (sin flag) no los necesite.
- Build OK con y sin flag. fn index registra 904 functions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-25 21:11:26 +02:00
parent d3d5af51f2
commit b093c898a8
37 changed files with 1819 additions and 342 deletions
+3 -3
View File
@@ -1,9 +1,9 @@
#include "viz/graph_renderer.h"
#include "viz/graph_types.h"
#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
#include <GL/glext.h>
// gl_loader: en Linux es no-op (incluye GL headers con GL_GLEXT_PROTOTYPES);
// en Windows expone los punteros via #define gl* fn_gl* tras gl_loader_init().
#include "gfx/gl_loader.h"
#include <cstdlib>
#include <cstring>
+6 -2
View File
@@ -3,7 +3,7 @@ name: graph_renderer
kind: function
lang: cpp
domain: viz
version: "1.0.0"
version: "1.1.0"
purity: impure
signature: "GraphRenderer* graph_renderer_create(int width, int height, const GraphRendererConfig& config)"
description: "Renderer GPU de grafos con instanced rendering a FBO, compatible con ImGui::Image para visualizacion de grafos grandes"
@@ -84,4 +84,8 @@ ndc = (screen / viewport) * 2 - 1
**Estado GL:** Guarda y restaura `GL_FRAMEBUFFER_BINDING` y `GL_VIEWPORT` para ser compatible con el render loop de ImGui sin efectos secundarios.
**Includes GL:** Usa `#define GL_GLEXT_PROTOTYPES` + `<GL/gl.h>` + `<GL/glext.h>`. Si el proyecto carga funciones GL via glad/gl3w, reemplazar estos includes por el loader correspondiente.
**Includes GL:** Usa `gfx/gl_loader.h` (v1.1+). En Linux es no-op (incluye headers con `GL_GLEXT_PROTOTYPES`). En Windows expone los simbolos modernos via `wglGetProcAddress` con macros `#define gl* fn_gl*`. Cualquier app que use `graph_renderer` debe linkear `gl_loader.cpp` y llamar `fn::gfx::gl_loader_init()` una vez tras crear el contexto GL.
## Notas
- **v1.1** (2026-04-25): cambia de raw `<GL/glext.h>` a `gfx/gl_loader.h` para que compile en cross-compile MinGW. Sin cambios funcionales — el binario Linux es bit-equivalente.
+17 -18
View File
@@ -1,12 +1,14 @@
#include "kpi_card.h"
#include "sparkline.h"
#include "core/tokens.h"
#include "core/icons_tabler.h"
#include <imgui.h>
#include <cstdio>
void kpi_card(const char* label, float value, float delta_percent,
const float* history, int history_count,
const char* format) {
const char* format,
const char* icon) {
using namespace fn_tokens;
// Card container — surface bg, border, rounded, padding.
@@ -28,42 +30,40 @@ void kpi_card(const char* label, float value, float delta_percent,
// Altura fija (no AutoResizeY) para que:
// (a) todas las cards de un grid queden alineadas visualmente,
// (b) no haya recalculo de layout por card en cada resize de la ventana.
// 78px alcanza para: label (~14px) + value (~22px con escala x1.4) + trend
// (~14px) + padding sm*2 (~16px) ≈ 66px, +12px de aire.
constexpr float card_height = 78.0f;
// (b) no haya recalculo de layout por card en cada resize.
constexpr float card_height = 86.0f;
ImGui::BeginChild(child_id, ImVec2(width, card_height),
ImGuiChildFlags_Borders,
ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse);
// Label — muted
// Top row: optional icon + label, ambos en text_muted.
ImGui::PushStyleColor(ImGuiCol_Text, colors::text_muted);
if (icon && *icon) {
ImGui::TextUnformatted(icon);
ImGui::SameLine(0, spacing::xs);
}
ImGui::TextUnformatted(label);
ImGui::PopStyleColor();
// Value — escala compacta 1.4x, proporcional a una card de 78px.
// El format controla el sufijo (ej: "%.0f%%" para porcentajes).
// Value — escala compacta 1.4x, proporcional a una card de 86px.
ImGui::SetWindowFontScale(1.4f);
char value_buf[64];
std::snprintf(value_buf, sizeof(value_buf), format, value);
ImGui::TextUnformatted(value_buf);
ImGui::SetWindowFontScale(1.0f);
// Delta / trend — SIEMPRE se reserva la linea aunque no haya tendencia,
// para que todas las cards tengan la misma altura. Cuando no hay delta
// ni history, se muestra un guion en text_dim para mantener el ritmo
// visual sin hacer ruido con "+0.0%".
// Delta / trend — SIEMPRE se reserva la linea aunque no haya tendencia.
const bool has_delta = delta_percent != 0.0f;
const bool has_history = history != nullptr && history_count > 0;
if (has_delta) {
const bool positive = delta_percent >= 0.0f;
const ImVec4 delta_color = positive ? colors::success : colors::error;
char delta_buf[32];
char delta_buf[48];
if (positive) {
std::snprintf(delta_buf, sizeof(delta_buf), "\xe2\x96\xb2 +%.1f%%", delta_percent);
std::snprintf(delta_buf, sizeof(delta_buf), TI_TRENDING_UP " +%.1f%%", delta_percent);
} else {
std::snprintf(delta_buf, sizeof(delta_buf), "\xe2\x96\xbc %.1f%%", delta_percent);
std::snprintf(delta_buf, sizeof(delta_buf), TI_TRENDING_DOWN " %.1f%%", delta_percent);
}
ImGui::PushStyleColor(ImGuiCol_Text, delta_color);
ImGui::TextUnformatted(delta_buf);
@@ -73,12 +73,11 @@ void kpi_card(const char* label, float value, float delta_percent,
sparkline(label, history, history_count, delta_color, 120.0f, 24.0f);
}
} else if (has_history) {
// Sin delta pero con historia: sparkline en primary (neutro).
sparkline(label, history, history_count, colors::primary, 120.0f, 24.0f);
} else {
// Placeholder para preservar altura de la card.
// Placeholder para preservar altura.
ImGui::PushStyleColor(ImGuiCol_Text, colors::text_dim);
ImGui::TextUnformatted("\xe2\x80\x94"); // em dash
ImGui::TextUnformatted(TI_MINUS);
ImGui::PopStyleColor();
}
+6 -4
View File
@@ -2,15 +2,17 @@
// KPI card — displays a key metric with trend.
// Usage:
// #include "core/icons_tabler.h"
// float history[] = {10, 12, 11, 15, 18, 17, 20};
// kpi_card("Revenue", 20000.0f, 12.5f, history, 7, "$%.0f");
// kpi_card("Revenue", 20000.0f, 12.5f, history, 7, "$%.0f", TI_CASH);
//
// Shows:
// - Label (small, muted)
// - Optional icon (Tabler glyph) + label (small, muted) on top row
// - Value (large font)
// - Delta badge (green up / red down)
// - Delta badge (green TI_TRENDING_UP / red TI_TRENDING_DOWN)
// - Sparkline of history
void kpi_card(const char* label, float value, float delta_percent,
const float* history = nullptr, int history_count = 0,
const char* format = "%.1f");
const char* format = "%.1f",
const char* icon = nullptr);
+10 -7
View File
@@ -3,11 +3,11 @@ name: kpi_card
kind: component
lang: cpp
domain: viz
version: "1.2.0"
version: "1.3.0"
purity: pure
signature: "void kpi_card(const char* label, float value, float delta_percent, const float* history = nullptr, int history_count = 0, const char* format = \"%.1f\")"
description: "Card de KPI con valor grande, delta porcentual y sparkline historico. Contenedor con surface bg, borde y radius via tokens (Mantine Paper equivalente)."
tags: [imgui, kpi, card, dashboard, metrics, sparkline, tokens]
signature: "void kpi_card(const char* label, float value, float delta_percent, const float* history = nullptr, int history_count = 0, const char* format = \"%.1f\", const char* icon = nullptr)"
description: "Card de KPI con icono opcional + label, valor grande, delta porcentual con TI_TRENDING_UP/DOWN y sparkline historico. Contenedor con surface bg, borde y radius via tokens (Mantine Paper equivalente)."
tags: [imgui, kpi, card, dashboard, metrics, sparkline, tokens, tabler]
uses_functions: ["sparkline_cpp_viz", "tokens_cpp_core"]
uses_types: []
returns: []
@@ -32,7 +32,9 @@ params:
desc: "Numero de valores en el array history"
- name: format
desc: "Formato printf para el valor principal (ej: \"$%.0f\", \"%.1f%%\", \"%.2f\")"
output: "Renderiza la card KPI completa en el frame ImGui actual: label muted, valor grande, badge delta verde/rojo con triangulo, y sparkline de 120x24px"
- name: icon
desc: "Glyph Tabler opcional (TI_* de core/icons_tabler.h) renderizado antes del label. Nullable — si es nullptr solo muestra label"
output: "Renderiza la card KPI completa en el frame ImGui actual: top row con icono opcional + label muted, valor grande, badge delta verde/rojo con TI_TRENDING_UP/DOWN, y sparkline de 120x24px"
---
# kpi_card
@@ -66,7 +68,8 @@ ImGui::Columns(1);
- **v1.1**: la card se renderiza dentro de un `BeginChild` con `surface` bg, `border` y `radius::md` de `fn_tokens` — replica el `<Paper withBorder radius="md" p="sm">` del frontend.
- **v1.2**: altura fija 78px (antes 108px) + font scale `1.4x` (antes `1.8x`) + padding `spacing::sm` (antes `md`). Mas compacta para densidades altas de KPIs. `NoScrollbar|NoScrollWithMouse` ademas de altura fija para evitar lag al redimensionar.
- **v1.3** (sesion 2026-04-25): nuevo parametro opcional `icon` (Tabler `TI_*` glyph) renderizado antes del label en la top row. Triangulos de delta migrados a `TI_TRENDING_UP` / `TI_TRENDING_DOWN` (los UTF-8 hex anteriores no estan en el atlas Karla/DroidSans → cuadritos). Em dash placeholder migrado a `TI_MINUS`. Altura subida 78→86 px para acomodar el row icono+label sin apretar. `uses_functions` ahora incluye implicitamente `icons_tabler` (header puro, no funcion).
- El ancho se adapta al contenedor padre via `GetContentRegionAvail().x`. Para que ocupe exactamente una celda usar `ImGui::BeginTable``BeginGroup` / `dashboard_grid` no propagan ancho constrained y la card desbordaria la celda.
- La linea de trend siempre se reserva (delta, sparkline o em dash placeholder en `text_dim`) para que un grid de KPIs quede alineado vertical.
- Los caracteres UTF-8 del triangulo (`▲` U+25B2 y `▼` U+25BC) y del em dash (`—` U+2014) requieren que la fuente ImGui tenga el rango de simbolos geometricos / puntuacion general cargado.
- Colores: delta usa `fn_tokens::colors::{success, error}`, placeholder em dash usa `text_dim`, label usa `text_muted`.
- ~~Los caracteres UTF-8 del triangulo (`▲` U+25B2 y `▼` U+25BC) y del em dash (`—` U+2014) requieren que la fuente ImGui tenga el rango de simbolos geometricos / puntuacion general cargado.~~ → Obsoleto en v1.3: ahora se usan glyphs Tabler que estan en el atlas mergeado por `icon_font_cpp_core`.
- Colores: delta usa `fn_tokens::colors::{success, error}`, placeholder `TI_MINUS` usa `text_dim`, label + icono usan `text_muted`.