synthesisui 0.16.127 → 0.16.128
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 +2 -2
- package/dist/doctor/transcribe.js +37 -3
- package/package.json +1 -1
package/dist/commands/import.js
CHANGED
|
@@ -1444,12 +1444,12 @@ function sayBrokenRefs(c) {
|
|
|
1444
1444
|
const uses = broken.reduce((n, b) => n + b.count, 0);
|
|
1445
1445
|
console.log("");
|
|
1446
1446
|
console.log(section("These resolve to nothing"));
|
|
1447
|
-
console.log(body(`${uses} reference${uses === 1 ? "" : "s"} to ${broken.length} token${broken.length === 1 ? "" : "s"} your CSS never declares. A ${paint.strong("var()")} with no declaration paints no colour - not a different colour.`));
|
|
1447
|
+
console.log(body(`${uses} reference${uses === 1 ? "" : "s"} to ${broken.length} token${broken.length === 1 ? "" : "s"} your CSS never declares. A ${paint.strong("var()")} with no declaration paints no colour - not a different colour. Where exactly one declared token differs by a namespace, the recipe now uses THAT one, so the look survives; the rest travel as the value you typed.`));
|
|
1448
1448
|
console.log("");
|
|
1449
1449
|
for (const b of broken.slice(0, 8)) {
|
|
1450
1450
|
const where = `${b.count}× in ${b.files} file${b.files === 1 ? "" : "s"}`;
|
|
1451
1451
|
console.log(body(b.meant
|
|
1452
|
-
? `${paint.strong(`var(${b.name})`)} ${paint.faint(where)} - you declare ${paint.strong(b.meant)}
|
|
1452
|
+
? `${paint.strong(`var(${b.name})`)} ${paint.faint(where)} - you declare ${paint.strong(b.meant)}, and that is what the recipe carries. Fix the class and the two agree.`
|
|
1453
1453
|
: `${paint.strong(`var(${b.name})`)} ${paint.faint(`${where}, and nothing close is declared`)}`));
|
|
1454
1454
|
}
|
|
1455
1455
|
if (broken.length > 8) {
|
|
@@ -1179,10 +1179,44 @@ function resolveArbitrary(inner, declared) {
|
|
|
1179
1179
|
return /[<>{}@;]/.test(raw) ? null : { value: raw };
|
|
1180
1180
|
}
|
|
1181
1181
|
const name = v[1];
|
|
1182
|
-
if (
|
|
1183
|
-
return { value:
|
|
1184
|
-
|
|
1182
|
+
if (declared.has(name))
|
|
1183
|
+
return { value: tokenRefFor(name), token: name };
|
|
1184
|
+
/**
|
|
1185
|
+
* A `var()` THEY NEVER DECLARED, WHEN THEY DECLARED IT UNDER ITS NAMESPACE.
|
|
1186
|
+
*
|
|
1187
|
+
* `bg-[var(--ocean-200)]` where the theme declares `--color-ocean-200` is their own
|
|
1188
|
+
* defect - Tailwind v4 namespaces the property and they wrote the bare name - and it is
|
|
1189
|
+
* ALSO unambiguous: exactly one declared token differs from it by a namespace. The census
|
|
1190
|
+
* already computes that answer for the report (`brokenRefs.meant`); carrying the broken
|
|
1191
|
+
* name into the recipe instead meant the declaration reached the document and painted
|
|
1192
|
+
* nothing, because `var(--ocean-200)` exists in their stylesheet and in none of ours.
|
|
1193
|
+
*
|
|
1194
|
+
* Measured on his library (test50, dono, 04/08): 6 declarations across 5 components, all
|
|
1195
|
+
* colours, all dead - and invisible to the ref validator, which only ever looks for `{…}`.
|
|
1196
|
+
*
|
|
1197
|
+
* A name that matches NO namespace stays the literal it was: that one is broken in their
|
|
1198
|
+
* repo too, and inventing a target would be the guess. It travels as the value they typed
|
|
1199
|
+
* and is reported by `brokenRefs`.
|
|
1200
|
+
*/
|
|
1201
|
+
const meant = MEANT_NAMESPACES.map((ns) => `--${ns}-${name.slice(2)}`).find((candidate) => declared.has(candidate));
|
|
1202
|
+
if (meant)
|
|
1203
|
+
return { value: tokenRefFor(meant), token: meant };
|
|
1204
|
+
return { value: raw };
|
|
1185
1205
|
}
|
|
1206
|
+
/**
|
|
1207
|
+
* The namespaces a bare name could have been written under, in the order Tailwind v4 uses
|
|
1208
|
+
* them. Mirrors `NAMESPACES` in `broken-refs.ts`, which computes the same answer for the
|
|
1209
|
+
* report - two readers of one fact, and the fact is "exactly one declared token differs
|
|
1210
|
+
* from this by a prefix".
|
|
1211
|
+
*/
|
|
1212
|
+
const MEANT_NAMESPACES = [
|
|
1213
|
+
"color",
|
|
1214
|
+
"spacing",
|
|
1215
|
+
"radius",
|
|
1216
|
+
"shadow",
|
|
1217
|
+
"font",
|
|
1218
|
+
"text",
|
|
1219
|
+
];
|
|
1186
1220
|
/**
|
|
1187
1221
|
* A declared custom property, as a token ref in the document's own namespace.
|
|
1188
1222
|
*
|
package/package.json
CHANGED