synthesisui 0.16.207 → 0.16.209

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.
@@ -758,6 +758,26 @@ export async function doctor(opts) {
758
758
  console.log("");
759
759
  console.log(body(`Token coverage ${meter(d.coverage)} ${paint.strong(`${String(d.coverage).padStart(3)}%`)}`));
760
760
  console.log(body(paint.dim(` ${d.tokenUses} from the system, ${d.findings.length} by hand${d.phantomUses > 0 ? `, ${d.phantomUses} naming nothing` : ""}`)));
761
+ /**
762
+ * ZERO NUM REPO QUE ORIGINOU O SISTEMA É O ESTADO CERTO, e sem esta linha ele lê como falha
763
+ * NOSSA.
764
+ *
765
+ * "Token coverage 0% - 1 from the system, 4433 by hand" é literalmente verdade e ainda assim
766
+ * engana: quando o sistema foi medido A PARTIR daqui, esses valores escritos à mão são a FONTE
767
+ * de onde os tokens saíram, não um desvio deles. Não há nada consertado ainda porque não havia
768
+ * nada quebrado - o passo seguinte é o código passar a apontar para os nomes que agora existem.
769
+ *
770
+ * O sinal é `measured.system`: a pasta de onde o import mediu. Ele só existe quando este
771
+ * repositório é a origem, então a frase não aparece para quem instalou um sistema de fora - ali
772
+ * um zero significa outra coisa e merece outra frase.
773
+ *
774
+ * A lei 14 em uma linha: um zero pelado lê como falha nossa, um zero com motivo lê como fato.
775
+ */
776
+ if (d.tokenUses === 0 && measured.system) {
777
+ console.log(body(paint.dim(` zero is the expected start here - this system was measured FROM`)));
778
+ console.log(body(paint.dim(` \`${measured.system}\`, so these values are its source, not a drift`)));
779
+ console.log(body(paint.dim(` from it. They count once the code points at the names they became.`)));
780
+ }
761
781
  // The strongest number leads, not trails: it used to sit two screens
762
782
  // down, after the phantom list (30/07). For the reader who already owns
763
783
  // a system - the ICP - THIS line is the report.
@@ -262,6 +262,26 @@ kind) {
262
262
  */
263
263
  export function judgeFragments(seen, declared, admitted) {
264
264
  return seen.map((f) => {
265
+ /**
266
+ * UMA DECLARAÇÃO SEM LEITOR CUJO VALOR É UM TOKEN QUE ELES JÁ DECLARAM.
267
+ *
268
+ * `h1 { font-size: var(--text-h1) }` num CSS global não tem leitor, e a frase que ia junto -
269
+ * *"os estilos que ela carrega não chegam a receita nenhuma"* - é falsa: `--text-h1` está
270
+ * declarado, capturado, e vale 2rem no sistema dele. O que não foi capturado é a LIGAÇÃO, qual
271
+ * elemento veste qual token.
272
+ *
273
+ * Medido em 11/08 na base tipográfica dele: das 13 declarações do `src/styles.css` arquivadas
274
+ * como sem leitor, SETE são desta forma - `--font-sans` (3x), `--text-h1`, `--text-h2`,
275
+ * `--text-h3` e `--color-blue-600`. Nenhuma delas carrega um valor que o sistema não tenha.
276
+ *
277
+ * A referência precisa apontar para algo DECLARADO. Um `var(--nao-existe)` continua sendo o que
278
+ * era: o browser descarta a declaração, e ali não há token nenhum a reivindicar.
279
+ */
280
+ if (f.reason === "shape-not-read") {
281
+ const ref = /:\s*var\(\s*(--[a-z0-9-]+)/i.exec(f.text);
282
+ if (ref && declared.has(ref[1]))
283
+ return { ...f, reason: "binding-not-read" };
284
+ }
265
285
  if (f.reason)
266
286
  return f;
267
287
  switch (f.shape) {
@@ -46,6 +46,11 @@ const OWNER = {
46
46
  function verdictOf(reason) {
47
47
  switch (reason) {
48
48
  case "shape-not-read":
49
+ /**
50
+ * A LIGAÇÃO TAMBÉM É TRABALHO DE LEITOR - o que muda é a frase, não o veredito. O valor já
51
+ * está no sistema; o que falta é um leitor que registre qual elemento veste qual token.
52
+ */
53
+ case "binding-not-read":
49
54
  return "no-reader";
50
55
  case "value-not-read":
51
56
  return "value-gap";
@@ -56,6 +56,7 @@ const BECAUSE = {
56
56
  computed: "the value is assembled at render time, so it is not in the source at any level and there is nothing to read",
57
57
  "component-not-admitted": "read, and it belongs to a component this scope does not admit into the system - the styles exist and no recipe claims them",
58
58
  "sheet-not-imported": "this is a sass partial and no stylesheet imports it, so your own build never compiles it - it paints nothing today, here or anywhere",
59
+ "binding-not-read": "the value here is a token your system already declares, so nothing is lost - what is not captured is which element wears it",
59
60
  };
60
61
  /**
61
62
  * O ledger de uma varredura, a partir dos fragmentos vistos.
@@ -1325,12 +1325,44 @@ function layerFor(out, when, at) {
1325
1325
  * attempt.
1326
1326
  */
1327
1327
  const INLINE_STYLE = /style=\{\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}\}/;
1328
+ /**
1329
+ * AS PROPRIEDADES, SEPARADAS PELA VÍRGULA QUE SEPARA - e não pela que está dentro de um valor.
1330
+ *
1331
+ * `split(",")` partia `var(--color-track, var(--color-darkgray-300))` ao meio e entregava duas
1332
+ * metades que não são nada. Vírgula dentro de parêntese ou de aspas pertence ao valor.
1333
+ */
1334
+ function splitProperties(body) {
1335
+ const out = [];
1336
+ let depth = 0;
1337
+ let quote = null;
1338
+ let start = 0;
1339
+ for (let i = 0; i < body.length; i += 1) {
1340
+ const c = body[i];
1341
+ if (quote) {
1342
+ if (c === quote && body[i - 1] !== "\\")
1343
+ quote = null;
1344
+ continue;
1345
+ }
1346
+ if (c === '"' || c === "'" || c === "`")
1347
+ quote = c;
1348
+ else if (c === "(" || c === "[")
1349
+ depth += 1;
1350
+ else if (c === ")" || c === "]")
1351
+ depth -= 1;
1352
+ else if (c === "," && depth === 0) {
1353
+ out.push(body.slice(start, i));
1354
+ start = i + 1;
1355
+ }
1356
+ }
1357
+ out.push(body.slice(start));
1358
+ return out;
1359
+ }
1328
1360
  export function readInlineStyle(source) {
1329
1361
  const m = INLINE_STYLE.exec(source);
1330
1362
  if (!m)
1331
1363
  return {};
1332
1364
  const out = {};
1333
- for (const piece of m[1].split(",")) {
1365
+ for (const piece of splitProperties(m[1])) {
1334
1366
  const colon = piece.indexOf(":");
1335
1367
  if (colon === -1)
1336
1368
  continue;
@@ -1339,10 +1371,24 @@ export function readInlineStyle(source) {
1339
1371
  .trim()
1340
1372
  .replace(/^["']|["']$/g, "");
1341
1373
  let value = piece.slice(colon + 1).trim();
1374
+ /**
1375
+ * UMA STRING ENTRE ASPAS ESTÁ NO FONTE, e o que ela tem dentro não muda isso.
1376
+ *
1377
+ * O guarda descartava todo valor com parêntese, e com isso todo `var()`, `linear-gradient()`,
1378
+ * `calc()` e `rgb()` escrito em estilo inline - que são exatamente os valores que carregam
1379
+ * decisão de design. Medido em 11/08 no repo dele: 2 dos 6 fragmentos que o censo chamava de
1380
+ * `computed` eram literais, entre eles
1381
+ * `style={{ stroke: "var(--color-track, var(--color-darkgray-300))" }}`.
1382
+ *
1383
+ * A distinção certa não é "tem parêntese", é "está no fonte": literal entre aspas se lê inteiro,
1384
+ * e só o que NÃO está entre aspas passa pelo guarda de expressão.
1385
+ */
1386
+ const quoted = /^(["'])([\s\S]*)\1$/.exec(value);
1387
+ if (quoted)
1388
+ value = quoted[2];
1342
1389
  // A value computed at runtime is not in the source, so there is nothing to read.
1343
- if (!value || /[`$]|\?|=>|\(/.test(value))
1390
+ else if (!value || /[`$]|\?|=>|\(/.test(value))
1344
1391
  continue;
1345
- value = value.replace(/^["']|["']$/g, "");
1346
1392
  if (!/^[a-zA-Z][\w]*$/.test(prop))
1347
1393
  continue;
1348
1394
  if (/[<>{}@;]/.test(value))
@@ -85,8 +85,17 @@ export const CHECKER_SINCE = "0.16.202";
85
85
  * Ou seja, o `READER` estava errado e ninguém tinha sido avisado. A marca nasceu em `0.16.202`,
86
86
  * bisseccionada: o censo de 0.16.201 difere do de então, o de 0.16.202 é byte a byte igual.
87
87
  *
88
- * ANDOU PARA `0.16.207` no mesmo dia, e desta vez o portão é que mandou. `fragmentsOfSource` parou
89
- * de tomar operando de `===` e texto de comentário por classe - 11 das 26 declarações que o censo
90
- * dele listava como ilegíveis eram acusação NOSSA. Um censo medido antes disto carrega as onze.
88
+ * ANDOU DUAS VEZES no mesmo dia, e nas duas foi o portão que mandou:
89
+ *
90
+ * 0.16.207 `fragmentsOfSource` parou de tomar operando de `===` e texto de comentário por
91
+ * classe - 11 das 26 declarações que o censo dele listava como ilegíveis eram
92
+ * acusação NOSSA
93
+ * 0.16.208 `readInlineStyle` parou de descartar valor com parêntese - `var()` e
94
+ * `linear-gradient()` em `style={{}}` chegam na receita, e 2 dos 6 fragmentos
95
+ * chamados de `computed` eram literais no fonte
96
+ * 0.16.209 uma declaração global cujo valor é token JÁ declarado deixou de ser arquivada
97
+ * como "nenhum leitor entende esta forma" - 7 das 13 da base tipográfica dele
98
+ *
99
+ * Um censo medido antes disto carrega as duas leituras erradas.
91
100
  */
92
- export const READER_SINCE = "0.16.207";
101
+ export const READER_SINCE = "0.16.209";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "synthesisui",
3
- "version": "0.16.207",
3
+ "version": "0.16.209",
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": {