synthesisui 0.16.306 → 0.16.307
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/commands/import.js +33 -0
- package/dist/doctor/value-ledger.js +153 -0
- package/dist/install-marks.js +11 -1
- package/package.json +1 -1
package/dist/commands/import.js
CHANGED
|
@@ -34,6 +34,7 @@ import { buildLedger, describeLedger, } from "../doctor/style-ledger.js";
|
|
|
34
34
|
import { MUI_DEFAULT_SPACING, readStyledComponents, spacingOf, } from "../doctor/style-props.js";
|
|
35
35
|
import { buildTable } from "../doctor/tokens.js";
|
|
36
36
|
import { definitionSpan, parseClass, readInlineStyle, rootClasses, rootTag, transcribe, } from "../doctor/transcribe.js";
|
|
37
|
+
import { accountClasses, invariantHolds, sumAccounts, } from "../doctor/value-ledger.js";
|
|
37
38
|
import { transcribeVariants } from "../doctor/variant-read.js";
|
|
38
39
|
import { frontierKind, packageRoot } from "../frontier-kind.js";
|
|
39
40
|
import { keyframesInSheets } from "../global-keyframes.js";
|
|
@@ -2105,6 +2106,25 @@ export async function takeCensus(root, opts) {
|
|
|
2105
2106
|
const target = c?.canonical ?? (c?.bucket === "exclusive" ? c.name : null);
|
|
2106
2107
|
return target ? safePartName(target) : null;
|
|
2107
2108
|
}, (pkg) => versions[pkg]);
|
|
2109
|
+
/**
|
|
2110
|
+
* A CONTABILIDADE POR VALOR, contada AQUI porque o material é daqui: os tokens de classe que
|
|
2111
|
+
* vestem cada componente admitido (os nós do sketch e as camadas condicionais cruas), contra
|
|
2112
|
+
* os tokens que o CSS dele declara. Ver `Census.values` e `doctor/value-ledger.ts` - é a
|
|
2113
|
+
* reconciliação do item 11, e a soma fecha com `seen` por construção.
|
|
2114
|
+
*/
|
|
2115
|
+
const valueByComponent = {};
|
|
2116
|
+
for (const [lookName, look] of Object.entries(looks)) {
|
|
2117
|
+
const tokens = [];
|
|
2118
|
+
for (const node of look.sketch ?? []) {
|
|
2119
|
+
tokens.push(...(node.classes ?? "").split(/\s+/).filter(Boolean));
|
|
2120
|
+
}
|
|
2121
|
+
for (const layer of look.rawLayers ?? [])
|
|
2122
|
+
tokens.push(...layer.classes);
|
|
2123
|
+
if (tokens.length > 0) {
|
|
2124
|
+
valueByComponent[lookName] = accountClasses(tokens, declaredValues);
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
const valuesTotal = sumAccounts(Object.values(valueByComponent));
|
|
2108
2128
|
return {
|
|
2109
2129
|
census: 1,
|
|
2110
2130
|
project: {
|
|
@@ -2261,6 +2281,19 @@ export async function takeCensus(root, opts) {
|
|
|
2261
2281
|
},
|
|
2262
2282
|
}
|
|
2263
2283
|
: {}),
|
|
2284
|
+
/**
|
|
2285
|
+
* A conta por VALOR - ver o tipo. Ausente quando nenhum componente veste classe, e ausente
|
|
2286
|
+
* quando a soma não fecha: uma conta que viola a própria invariante é bug NOSSO, e um censo
|
|
2287
|
+
* sem o campo é honesto enquanto um campo errado governaria telas. Hoje ela fecha por
|
|
2288
|
+
* construção; o portão existe para o dia em que uma derivação (a engine do D3) não fechar.
|
|
2289
|
+
*/
|
|
2290
|
+
...(valuesTotal.seen > 0 && invariantHolds(valuesTotal)
|
|
2291
|
+
? {
|
|
2292
|
+
values: {
|
|
2293
|
+
classes: { ...valuesTotal, byComponent: valueByComponent },
|
|
2294
|
+
},
|
|
2295
|
+
}
|
|
2296
|
+
: {}),
|
|
2264
2297
|
...(architectures.length > 0
|
|
2265
2298
|
? {
|
|
2266
2299
|
architectures: architectures.slice(0, 6).map((a) => ({
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { parseClass, readUtility } from "./transcribe.js";
|
|
2
|
+
/**
|
|
3
|
+
* AS PROPRIEDADES QUE SÃO ARRANJO - a definição de "estrutura", por propriedade resolvida.
|
|
4
|
+
*
|
|
5
|
+
* O critério do dono (D4): estrutura é onde "token é impossível por definição" - não existe
|
|
6
|
+
* decisão de vocabulário em `display: flex`. Espaçamento e tamanho NÃO entram: `gap`, `padding`
|
|
7
|
+
* e `height` são decisões de escala (a métrica de Spacing & Proportion existe para elas).
|
|
8
|
+
*/
|
|
9
|
+
const STRUCTURAL_PROPERTIES = new Set([
|
|
10
|
+
"display",
|
|
11
|
+
"position",
|
|
12
|
+
"top",
|
|
13
|
+
"right",
|
|
14
|
+
"bottom",
|
|
15
|
+
"left",
|
|
16
|
+
"inset",
|
|
17
|
+
"insetInline",
|
|
18
|
+
"insetBlock",
|
|
19
|
+
"zIndex",
|
|
20
|
+
"overflow",
|
|
21
|
+
"overflowX",
|
|
22
|
+
"overflowY",
|
|
23
|
+
"flexDirection",
|
|
24
|
+
"flexWrap",
|
|
25
|
+
"alignItems",
|
|
26
|
+
"alignContent",
|
|
27
|
+
"alignSelf",
|
|
28
|
+
"justifyContent",
|
|
29
|
+
"justifyItems",
|
|
30
|
+
"justifySelf",
|
|
31
|
+
"placeItems",
|
|
32
|
+
"placeContent",
|
|
33
|
+
"order",
|
|
34
|
+
"flex",
|
|
35
|
+
"flexGrow",
|
|
36
|
+
"flexShrink",
|
|
37
|
+
"flexBasis",
|
|
38
|
+
"gridColumn",
|
|
39
|
+
"gridRow",
|
|
40
|
+
"gridTemplateColumns",
|
|
41
|
+
"gridTemplateRows",
|
|
42
|
+
"pointerEvents",
|
|
43
|
+
"userSelect",
|
|
44
|
+
"textAlign",
|
|
45
|
+
"verticalAlign",
|
|
46
|
+
"whiteSpace",
|
|
47
|
+
"objectFit",
|
|
48
|
+
"objectPosition",
|
|
49
|
+
"visibility",
|
|
50
|
+
"isolation",
|
|
51
|
+
"textOverflow",
|
|
52
|
+
"borderCollapse",
|
|
53
|
+
]);
|
|
54
|
+
/**
|
|
55
|
+
* TOKENS DE ARRANJO QUE O RESOLVEDOR NÃO DEVOLVE COMO DECLARAÇÃO - a metade utilitária da mesma
|
|
56
|
+
* definição. `w-full` e `truncate` não são decisão de vocabulário; `hidden` e `sr-only` são
|
|
57
|
+
* visibilidade. Lista CONSERVADORA de propósito: o que não estiver aqui e não resolver cai em
|
|
58
|
+
* `unread`, que é o lado certo de errar - um arranjo cobrado como lacuna custa uma linha; uma
|
|
59
|
+
* decisão de estilo escondida como "estrutura" custa a confiança na métrica.
|
|
60
|
+
*/
|
|
61
|
+
const STRUCTURAL_TOKENS = new Set([
|
|
62
|
+
/** Os valores de display crus - a mesma lista que o juiz de fragmento chama de STRUCTURE. */
|
|
63
|
+
"flex",
|
|
64
|
+
"inline-flex",
|
|
65
|
+
"grid",
|
|
66
|
+
"inline-grid",
|
|
67
|
+
"block",
|
|
68
|
+
"inline-block",
|
|
69
|
+
"inline",
|
|
70
|
+
"contents",
|
|
71
|
+
"flow-root",
|
|
72
|
+
"flex-row",
|
|
73
|
+
"flex-col",
|
|
74
|
+
"flex-row-reverse",
|
|
75
|
+
"flex-col-reverse",
|
|
76
|
+
"w-full",
|
|
77
|
+
"h-full",
|
|
78
|
+
"w-fit",
|
|
79
|
+
"h-fit",
|
|
80
|
+
"w-max",
|
|
81
|
+
"w-min",
|
|
82
|
+
"min-w-0",
|
|
83
|
+
"shrink",
|
|
84
|
+
"shrink-0",
|
|
85
|
+
"grow",
|
|
86
|
+
"grow-0",
|
|
87
|
+
"flex-1",
|
|
88
|
+
"flex-auto",
|
|
89
|
+
"flex-none",
|
|
90
|
+
"hidden",
|
|
91
|
+
"sr-only",
|
|
92
|
+
"not-sr-only",
|
|
93
|
+
"truncate",
|
|
94
|
+
"group",
|
|
95
|
+
"peer",
|
|
96
|
+
"isolate",
|
|
97
|
+
]);
|
|
98
|
+
/**
|
|
99
|
+
* O destino de UM token de classe. Exportado para o julgamento por valor e a triagem lerem a
|
|
100
|
+
* MESMA resposta - duas cópias desta decisão é como o item 11 nasceu.
|
|
101
|
+
*/
|
|
102
|
+
export function destinationOf(cls, declared) {
|
|
103
|
+
const { utility } = parseClass(cls);
|
|
104
|
+
if (STRUCTURAL_TOKENS.has(utility))
|
|
105
|
+
return "structure";
|
|
106
|
+
const read = readUtility(utility, declared);
|
|
107
|
+
if (read) {
|
|
108
|
+
return STRUCTURAL_PROPERTIES.has(read.property)
|
|
109
|
+
? "structure"
|
|
110
|
+
: "interpreted";
|
|
111
|
+
}
|
|
112
|
+
return "unread";
|
|
113
|
+
}
|
|
114
|
+
/** A conta de uma lista de tokens - a soma SEMPRE fecha com `seen`, por construção. */
|
|
115
|
+
export function accountClasses(tokens, declared) {
|
|
116
|
+
const account = {
|
|
117
|
+
seen: 0,
|
|
118
|
+
interpreted: 0,
|
|
119
|
+
structure: 0,
|
|
120
|
+
unread: 0,
|
|
121
|
+
answered: 0,
|
|
122
|
+
unknown: 0,
|
|
123
|
+
};
|
|
124
|
+
for (const cls of tokens) {
|
|
125
|
+
account.seen += 1;
|
|
126
|
+
account[destinationOf(cls, declared)] += 1;
|
|
127
|
+
}
|
|
128
|
+
return account;
|
|
129
|
+
}
|
|
130
|
+
/** Soma de contas - o total do censo é a soma das contas por componente, nunca outra medição. */
|
|
131
|
+
export function sumAccounts(accounts) {
|
|
132
|
+
const out = {
|
|
133
|
+
seen: 0,
|
|
134
|
+
interpreted: 0,
|
|
135
|
+
structure: 0,
|
|
136
|
+
unread: 0,
|
|
137
|
+
answered: 0,
|
|
138
|
+
unknown: 0,
|
|
139
|
+
};
|
|
140
|
+
for (const a of accounts) {
|
|
141
|
+
out.seen += a.seen;
|
|
142
|
+
out.interpreted += a.interpreted;
|
|
143
|
+
out.structure += a.structure;
|
|
144
|
+
out.unread += a.unread;
|
|
145
|
+
out.answered += a.answered;
|
|
146
|
+
out.unknown += a.unknown;
|
|
147
|
+
}
|
|
148
|
+
return out;
|
|
149
|
+
}
|
|
150
|
+
/** A invariante do item 11, como pergunta - o spec das populações a assere, o portão a exige. */
|
|
151
|
+
export function invariantHolds(a) {
|
|
152
|
+
return (a.interpreted + a.structure + a.unread + a.answered + a.unknown === a.seen);
|
|
153
|
+
}
|
package/dist/install-marks.js
CHANGED
|
@@ -288,7 +288,17 @@ export const CHECKER_SINCE = "0.16.250";
|
|
|
288
288
|
*
|
|
289
289
|
* Um censo medido antes carrega a poluição e a perda; quem remede ganha os três de uma vez.
|
|
290
290
|
*/
|
|
291
|
-
|
|
291
|
+
/**
|
|
292
|
+
* 0.16.306 -> 0.16.307 em 25/08: o censo passa a carregar `values` - a CONTABILIDADE POR VALOR
|
|
293
|
+
* (item 11). Todo token de classe que veste um componente admitido tem um destino, e a soma fecha
|
|
294
|
+
* por construção: `interpreted + structure + unread + answered + unknown == seen`. É a
|
|
295
|
+
* reconciliação entre o ledger (que conta lugares) e a produção (que trabalha em valores) - 86%
|
|
296
|
+
* contra 50% no mesmo repositório, sem uma linha ligando os dois.
|
|
297
|
+
*
|
|
298
|
+
* Campo novo: um censo medido antes não o tem, e a tela de cobertura (D4: três colunas, estrutura
|
|
299
|
+
* visível fora da métrica) só pode ser honesta sobre quem remedir. É o que esta marca avisa.
|
|
300
|
+
*/
|
|
301
|
+
export const READER_SINCE = "0.16.307";
|
|
292
302
|
/**
|
|
293
303
|
* O QUE ESTÁ INSTALADO AQUI FICOU PARA TRÁS - e as DUAS condições que fazem isso ser verdade.
|
|
294
304
|
*
|
package/package.json
CHANGED