synthesisui 0.16.186 → 0.16.187

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 (2) hide show
  1. package/dist/progress.js +24 -0
  2. package/package.json +1 -1
package/dist/progress.js CHANGED
@@ -14,6 +14,19 @@
14
14
  * writes a carriage return into a transcript.
15
15
  */
16
16
  const BAR_WIDTH = 24;
17
+ /**
18
+ * O INTERVALO MÍNIMO ENTRE DOIS QUADROS - e ele existe por causa do CLIPBOARD, não da velocidade.
19
+ *
20
+ * A linha se redesenha com `\r`, então na tela ela é UMA linha e a leitura é ótima. Copiar é outra
21
+ * história: o `\r` não sobrevive à seleção, então cada repintura vira um pedaço do texto colado. Em
22
+ * 08/08 o dono tentou copiar a saída de um `sync` e levou junto 2 172 quadros - um por arquivo de
23
+ * evidência -, o que enterrou o relatório que ele queria mostrar (dono, 08/08).
24
+ *
25
+ * 80ms é o teto do que um olho aproveita: acima de ~12 quadros por segundo a animação já lê como
26
+ * contínua, e o resto é trabalho que só o clipboard vê. No caso dele isso troca 2 172 quadros por
27
+ * algumas dezenas, sem tirar um único frame que alguém fosse perceber.
28
+ */
29
+ const MIN_FRAME_MS = 80;
17
30
  /** Every this-many items, the non-TTY path prints one line. Enough to see movement in
18
31
  * a piped log without turning it into the log. */
19
32
  const MILESTONE_EVERY = 25;
@@ -49,9 +62,12 @@ function tail(label, width) {
49
62
  export function startProgress(title, opts) {
50
63
  const write = opts?.write ?? ((s) => process.stdout.write(s));
51
64
  const tty = opts?.isTty ?? Boolean(process.stdout.isTTY);
65
+ const now = opts?.now ?? (() => Date.now());
52
66
  let total = opts?.total ?? 0;
53
67
  let done = 0;
54
68
  let last = "";
69
+ /** `-Infinity` para o PRIMEIRO passo pintar sempre: silêncio no começo lê como travado. */
70
+ let painted = Number.NEGATIVE_INFINITY;
55
71
  const paint = () => {
56
72
  const count = total > 0 ? `${done} of ${total}` : String(done);
57
73
  const line = ` ${bar(done, total)} ${count} ${tail(last, 40)}`;
@@ -64,6 +80,14 @@ export function startProgress(title, opts) {
64
80
  done += 1;
65
81
  last = label;
66
82
  if (tty) {
83
+ /**
84
+ * O ÚLTIMO SEMPRE PINTA, mesmo dentro da janela: parar num "2 100 de 2 172" e pular para o
85
+ * resumo faria a barra parecer que desistiu antes do fim.
86
+ */
87
+ const at = now();
88
+ if (at - painted < MIN_FRAME_MS && !(total > 0 && done === total))
89
+ return;
90
+ painted = at;
67
91
  paint();
68
92
  return;
69
93
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "synthesisui",
3
- "version": "0.16.186",
3
+ "version": "0.16.187",
4
4
  "description": "Bring SynthesisUI design systems into any project - tokens, typed components, whole pages and an agent-ready CLAUDE.md manifest.",
5
5
  "type": "module",
6
6
  "bin": {