@j3ehcmz/ui 0.2.0 → 0.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Cambios de @j3ehcmz/ui
2
2
 
3
+ ## 0.2.1 — 27-nov-2026
4
+
5
+ - Medición de rendimiento: cada carga manda también su desglose (`antes` = redirecciones/caché, `dns`, `conexion`, `tls`, `espera`, `bajada`, `proto`) y `via` («local» si Traefik marcó `Server-Timing: hcmz`, si no «internet»). Los módulos deben tener `lib/registro-errores.ts` de la plantilla del 27-nov para reenviarlos; con la versión vieja se ignoran (nada se rompe).
6
+
3
7
  ## 0.2.0 — 8-nov-2026
4
8
 
5
9
  Piezas que el inventario encontró copiadas en 3 o más módulos. **Retrocompatible**: todo lo que existía en 0.1.x
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@j3ehcmz/ui",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Sistema de diseño de los módulos del Portal HCMZ: tokens, tema Tailwind v4, barra de módulo y componentes.",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -22,6 +22,18 @@ const rutaGenerica = (p: string) =>
22
22
  .join("/")
23
23
  .slice(0, 200) || "/";
24
24
 
25
+ const tramo = (a: number, b: number) => (a > 0 && b >= a ? b - a : undefined);
26
+ /** Etapas de la carga de la página (Navigation Timing). Con redirecciones a otro dominio el navegador no da sus tiempos, pero sí empuja fetchStart. */
27
+ const desglose = (n: PerformanceNavigationTiming) => ({
28
+ antes: n.fetchStart > 0 ? n.fetchStart : undefined,
29
+ dns: tramo(n.domainLookupStart, n.domainLookupEnd),
30
+ conexion: tramo(n.connectStart, n.connectEnd),
31
+ tls: tramo(n.secureConnectionStart, n.connectEnd),
32
+ espera: tramo(n.requestStart, n.responseStart),
33
+ bajada: tramo(n.responseStart, n.responseEnd),
34
+ proto: n.nextHopProtocol || undefined,
35
+ });
36
+
25
37
  let vitalesIniciadas = false;
26
38
 
27
39
  function medirVitales() {
@@ -84,6 +96,9 @@ function medirVitales() {
84
96
  ancho: innerWidth,
85
97
  red,
86
98
  nav: n?.type,
99
+ // desglose de la carga (ms): dónde se va el tiempo. «antes» = redirecciones (p. ej. Access) y caché antes de pedir la página
100
+ ...(n ? desglose(n) : {}),
101
+ via: n?.serverTiming?.some((s) => s.name === "hcmz") ? "local" : "internet",
87
102
  }),
88
103
  );
89
104
  };