synthesisui 0.16.191 → 0.16.193
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/dist/anatomy-read.js +55 -36
- package/dist/progress.js +36 -10
- package/package.json +1 -1
package/dist/anatomy-read.js
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
*/
|
|
32
32
|
import { readSxProps } from "./doctor/style-props.js";
|
|
33
33
|
import { transcribe, } from "./doctor/transcribe.js";
|
|
34
|
-
import { frontierKind } from "./frontier-kind.js";
|
|
34
|
+
import { frontierKind, packageRoot } from "./frontier-kind.js";
|
|
35
35
|
/** The ten forms, closed. A renderer that accepts any tag draws anything. */
|
|
36
36
|
const FORMS = new Set([
|
|
37
37
|
"image",
|
|
@@ -174,6 +174,49 @@ function frontierSx(node, sketch) {
|
|
|
174
174
|
const trimmed = raw?.trim();
|
|
175
175
|
return trimmed ? { sx: trimmed.slice(0, 400) } : {};
|
|
176
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* O QUE O SKETCH MEDIU NAQUELE NÓ - e é UMA função porque três ramos precisam dela.
|
|
179
|
+
*
|
|
180
|
+
* A leitura autorada diz a FORMA; o sketch guarda os fatos daquele elemento, alcançáveis pelo índice
|
|
181
|
+
* `at`. Isto era um bloco solto no meio do caminhamento, e o ramo de FRONTEIRA saía por um `continue`
|
|
182
|
+
* antes de chegar nele - então `behaviourProps`, `contentFrom`, `passes` e `repeats` nunca chegavam
|
|
183
|
+
* num nó que nomeia uma biblioteca.
|
|
184
|
+
*
|
|
185
|
+
* Medido no repo do dono em 09/08, DEPOIS de o conserto da travessia ter subido: `behaviourProps` em
|
|
186
|
+
* 15 nós de fronteira e ZERO chegando, `contentFrom` em 23 e zero. O detector de perda apontou; a
|
|
187
|
+
* causa era este `continue`.
|
|
188
|
+
*
|
|
189
|
+
* É a terceira vez que o mesmo formato cobra: um ramo que retorna antes do trabalho comum. O `upgrade`
|
|
190
|
+
* pulava a medição, o `repointToSteps` enumerava ramos e esquecia um, e agora este. Por isso vira
|
|
191
|
+
* função - uma lista de campos copiada à mão nasce desatualizada no próximo campo.
|
|
192
|
+
*/
|
|
193
|
+
function measuredAt(node, sketch) {
|
|
194
|
+
const out = {};
|
|
195
|
+
if (typeof node.at !== "number") {
|
|
196
|
+
if (node.when)
|
|
197
|
+
out.when = node.when;
|
|
198
|
+
if (node.atRest === false)
|
|
199
|
+
out.atRest = false;
|
|
200
|
+
return out;
|
|
201
|
+
}
|
|
202
|
+
const measured = sketch?.[node.at];
|
|
203
|
+
const when = node.when ?? measured?.when;
|
|
204
|
+
if (when)
|
|
205
|
+
out.when = when;
|
|
206
|
+
const atRest = node.atRest ?? measured?.atRest;
|
|
207
|
+
if (atRest === false)
|
|
208
|
+
out.atRest = false;
|
|
209
|
+
if (measured?.contentFrom)
|
|
210
|
+
out.contentFrom = measured.contentFrom;
|
|
211
|
+
if (measured?.behaviourProps &&
|
|
212
|
+
Object.keys(measured.behaviourProps).length > 0)
|
|
213
|
+
out.behaviourProps = measured.behaviourProps;
|
|
214
|
+
if (measured?.passes && Object.keys(measured.passes).length > 0)
|
|
215
|
+
out.passes = measured.passes;
|
|
216
|
+
if (measured?.repeats)
|
|
217
|
+
out.repeats = measured.repeats;
|
|
218
|
+
return out;
|
|
219
|
+
}
|
|
177
220
|
export function resolveAnatomy(read, declared, deps,
|
|
178
221
|
/** Their name → the slug it reaches in this system. See `RefResolver`. */
|
|
179
222
|
resolve,
|
|
@@ -284,6 +327,8 @@ sxSpacing) {
|
|
|
284
327
|
ref: slug || safePartName(name),
|
|
285
328
|
...(slug && slug !== safePartName(name) ? { refName: name } : {}),
|
|
286
329
|
...frontierClasses(node, sketch),
|
|
330
|
+
/** Um componente DELE também é um nó, e o que o sketch mediu nele vale igual. */
|
|
331
|
+
...measuredAt(node, sketch),
|
|
287
332
|
...holds,
|
|
288
333
|
});
|
|
289
334
|
continue;
|
|
@@ -291,7 +336,12 @@ sxSpacing) {
|
|
|
291
336
|
const from = String(node.from ?? "").trim();
|
|
292
337
|
if (!from)
|
|
293
338
|
continue;
|
|
294
|
-
|
|
339
|
+
/**
|
|
340
|
+
* PELA RAIZ DO PACOTE. O manifesto declara `@base-ui/react` e o código importa
|
|
341
|
+
* `@base-ui/react/menu` - o mesmo defeito consertado no `import.ts` em 09/08, e este era o
|
|
342
|
+
* segundo site. Uma receita de headless sem versão é um palpite datado.
|
|
343
|
+
*/
|
|
344
|
+
const version = deps?.[packageRoot(from)] ?? deps?.[from];
|
|
295
345
|
if (!external.some((e) => e.from === from))
|
|
296
346
|
external.push({ from, version });
|
|
297
347
|
out.push({
|
|
@@ -300,6 +350,8 @@ sxSpacing) {
|
|
|
300
350
|
...(version ? { version } : {}),
|
|
301
351
|
...frontierClasses(node, sketch),
|
|
302
352
|
...frontierSx(node, sketch),
|
|
353
|
+
/** O que o sketch mediu naquele nó - o `continue` abaixo o pulava. */
|
|
354
|
+
...measuredAt(node, sketch),
|
|
303
355
|
...holds,
|
|
304
356
|
});
|
|
305
357
|
continue;
|
|
@@ -309,40 +361,7 @@ sxSpacing) {
|
|
|
309
361
|
* THE GUARD TRAVELS WITH THE NODE, off the sketch it points at - so neither a
|
|
310
362
|
* reading nor the deriver has to carry it, and both get it.
|
|
311
363
|
*/
|
|
312
|
-
|
|
313
|
-
const measured = sketch?.[node.at];
|
|
314
|
-
const when = node.when ?? measured?.when;
|
|
315
|
-
if (when)
|
|
316
|
-
node_.when = when;
|
|
317
|
-
const atRest = node.atRest ?? measured?.atRest;
|
|
318
|
-
if (atRest === false)
|
|
319
|
-
node_.atRest = false;
|
|
320
|
-
/**
|
|
321
|
-
* WHAT THE NODE WRITES AND WHICH BEHAVIOUR PROPS IT CARRIES - the two facts that
|
|
322
|
-
* turn a styled shell into a component somebody can rebuild. Same lookup as the
|
|
323
|
-
* guard, one line up: measured on the sketch, dropped by every seam after it.
|
|
324
|
-
*/
|
|
325
|
-
if (measured?.contentFrom)
|
|
326
|
-
node_.contentFrom = measured.contentFrom;
|
|
327
|
-
if (measured?.behaviourProps &&
|
|
328
|
-
Object.keys(measured.behaviourProps).length > 0)
|
|
329
|
-
node_.behaviourProps = measured.behaviourProps;
|
|
330
|
-
/**
|
|
331
|
-
* O QUE ELE RECEBE E O QUE ELE REPETE, pela mesma consulta. As duas peças que fazem uma
|
|
332
|
-
* receita de TELA carregar a fiação de dados, e não só a casca - ver `SketchNode.passes`
|
|
333
|
-
* e `SketchNode.repeats`.
|
|
334
|
-
*/
|
|
335
|
-
if (measured?.passes && Object.keys(measured.passes).length > 0)
|
|
336
|
-
node_.passes = measured.passes;
|
|
337
|
-
if (measured?.repeats)
|
|
338
|
-
node_.repeats = measured.repeats;
|
|
339
|
-
}
|
|
340
|
-
else {
|
|
341
|
-
if (node.when)
|
|
342
|
-
node_.when = node.when;
|
|
343
|
-
if (node.atRest === false)
|
|
344
|
-
node_.atRest = false;
|
|
345
|
-
}
|
|
364
|
+
Object.assign(node_, measuredAt(node, sketch));
|
|
346
365
|
/**
|
|
347
366
|
* A PART THAT IS A LIBRARY ELEMENT CARRIES BOTH FACTS - see `AnatomyRead.from`.
|
|
348
367
|
* Inert for the renderer, which dispatches on `as`; read by the usage snippet,
|
package/dist/progress.js
CHANGED
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
* skill runs the CLI with no TTY and pipes the output, so it gets a plain milestone
|
|
13
13
|
* line every so often. Neither has to know about the other, and the non-TTY path never
|
|
14
14
|
* writes a carriage return into a transcript.
|
|
15
|
+
*
|
|
16
|
+
* E OS DOIS ESCREVEM EM `stderr`, porque progresso não é resultado: quem redireciona a saída fica com
|
|
17
|
+
* o relatório limpo, e quem está na tela continua vendo tudo.
|
|
15
18
|
*/
|
|
16
19
|
const BAR_WIDTH = 24;
|
|
17
20
|
/**
|
|
@@ -22,11 +25,11 @@ const BAR_WIDTH = 24;
|
|
|
22
25
|
* 08/08 o dono tentou copiar a saída de um `sync` e levou junto 2 172 quadros - um por arquivo de
|
|
23
26
|
* evidência -, o que enterrou o relatório que ele queria mostrar (dono, 08/08).
|
|
24
27
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
+
* 250ms, e o número subiu de 80ms em 09/08 por uma razão de LEITURA e não só de clipboard: a linha
|
|
29
|
+
* mostra o arquivo sendo lido, e a 12 quadros por segundo o nome vira borrão. A quatro por segundo dá
|
|
30
|
+
* para de fato ler o que está passando - fica melhor na tela E três vezes menor no texto colado.
|
|
28
31
|
*/
|
|
29
|
-
const MIN_FRAME_MS =
|
|
32
|
+
const MIN_FRAME_MS = 250;
|
|
30
33
|
/** Every this-many items, the non-TTY path prints one line. Enough to see movement in
|
|
31
34
|
* a piped log without turning it into the log. */
|
|
32
35
|
const MILESTONE_EVERY = 25;
|
|
@@ -60,7 +63,20 @@ function tail(label, width) {
|
|
|
60
63
|
return `…${label.slice(-(width - 1))}`;
|
|
61
64
|
}
|
|
62
65
|
export function startProgress(title, opts) {
|
|
63
|
-
|
|
66
|
+
/**
|
|
67
|
+
* O PROGRESSO VAI PARA `stderr`, como o banner de fase ao lado - e isto é o que torna a saída
|
|
68
|
+
* copiável com garantia, e não com esperança.
|
|
69
|
+
*
|
|
70
|
+
* Uma barra é PROGRESSO, não resultado. O banner de fase já seguia essa regra desde 01/08 pelo
|
|
71
|
+
* mesmo motivo; a barra tinha ficado no `stdout` por descuido. Com ela em `stderr`, `sync > arquivo`
|
|
72
|
+
* e `sync | pbcopy` entregam o relatório limpo sem depender de o terminal honrar `\x1b[2K` - e na
|
|
73
|
+
* tela nada muda, porque o terminal mostra os dois.
|
|
74
|
+
*
|
|
75
|
+
* O dono viu isso duas vezes: na primeira eram 2 172 quadros no clipboard, e na segunda, já com o
|
|
76
|
+
* limite de tempo, ainda sobravam mais de cem. Depender do comportamento do terminal de cada pessoa
|
|
77
|
+
* é depender do que a gente não controla.
|
|
78
|
+
*/
|
|
79
|
+
const write = opts?.write ?? ((s) => process.stderr.write(s));
|
|
64
80
|
const tty = opts?.isTty ?? Boolean(process.stdout.isTTY);
|
|
65
81
|
const now = opts?.now ?? (() => Date.now());
|
|
66
82
|
let total = opts?.total ?? 0;
|
|
@@ -68,12 +84,22 @@ export function startProgress(title, opts) {
|
|
|
68
84
|
let last = "";
|
|
69
85
|
/** `-Infinity` para o PRIMEIRO passo pintar sempre: silêncio no começo lê como travado. */
|
|
70
86
|
let painted = Number.NEGATIVE_INFINITY;
|
|
87
|
+
/**
|
|
88
|
+
* APAGAR A LINHA, e não pintar espaços por cima dela.
|
|
89
|
+
*
|
|
90
|
+
* A versão anterior voltava o cursor com `\r` e escrevia 80 caracteres, sobrando espaços para cobrir
|
|
91
|
+
* o quadro mais longo. Na tela funciona; no clipboard não: o terminal do dono guardava cada escrita
|
|
92
|
+
* como conteúdo NOVO, então colar trazia os quadros um atrás do outro separados por corridas de
|
|
93
|
+
* espaço - foi exatamente o que ele mostrou depois do primeiro conserto (dono, 09/08).
|
|
94
|
+
*
|
|
95
|
+
* `\x1b[2K` é a instrução explícita de LIMPAR A LINHA. Um terminal que a honra substitui a linha no
|
|
96
|
+
* próprio buffer em vez de acrescentar, e aí a seleção pega uma linha só. E como não há mais nada a
|
|
97
|
+
* cobrir, o preenchimento some junto: menos 65 bytes por quadro, e nenhuma corrida de espaço no
|
|
98
|
+
* texto colado.
|
|
99
|
+
*/
|
|
71
100
|
const paint = () => {
|
|
72
101
|
const count = total > 0 ? `${done} of ${total}` : String(done);
|
|
73
|
-
|
|
74
|
-
// Pad to the previous width so a shorter label cannot leave the tail of a
|
|
75
|
-
// longer one behind on the line.
|
|
76
|
-
write(`\r${line.padEnd(80)}`);
|
|
102
|
+
write(`\x1b[2K\r ${bar(done, total)} ${count} ${tail(last, 40)}`);
|
|
77
103
|
};
|
|
78
104
|
return {
|
|
79
105
|
step(label) {
|
|
@@ -103,7 +129,7 @@ export function startProgress(title, opts) {
|
|
|
103
129
|
},
|
|
104
130
|
done(summary) {
|
|
105
131
|
if (tty)
|
|
106
|
-
write(
|
|
132
|
+
write("\x1b[2K\r");
|
|
107
133
|
if (summary)
|
|
108
134
|
write(` ${summary}\n`);
|
|
109
135
|
},
|
package/package.json
CHANGED