synthesisui 0.16.66 → 0.16.69
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/doctor/transcribe.js +39 -19
- package/package.json +1 -1
|
@@ -32,19 +32,27 @@
|
|
|
32
32
|
* data-[checked]:bg-ocean-50 → states.checked
|
|
33
33
|
*/
|
|
34
34
|
/**
|
|
35
|
-
* Utility prefix →
|
|
35
|
+
* Utility prefix → the property name THE DOCUMENT USES, which is camelCase.
|
|
36
|
+
*
|
|
37
|
+
* Emitting kebab-case cost a whole slice in silence: the recipes validated,
|
|
38
|
+
* because `styleValue` is permissive about the value and says nothing about the
|
|
39
|
+
* key, and then not one metric could find them - a `RadioCard` with five real
|
|
40
|
+
* declarations had 2 of 8.6 weight applicable and read as unwritten (dono,
|
|
41
|
+
* 01/08). Valid and unread is the worst of the three outcomes.
|
|
42
|
+
*
|
|
43
|
+
* Only the ones that carry DESIGN, which is the
|
|
36
44
|
* whole point: `flex`, `items-center` and `w-full` are structure, they are
|
|
37
45
|
* identical in every design system, and a recipe carrying them would be
|
|
38
46
|
* transcribing layout rather than a look.
|
|
39
47
|
*/
|
|
40
48
|
const COLOR_PROPERTY = {
|
|
41
|
-
bg: "
|
|
49
|
+
bg: "backgroundColor",
|
|
42
50
|
text: "color",
|
|
43
|
-
border: "
|
|
44
|
-
ring: "
|
|
51
|
+
border: "borderColor",
|
|
52
|
+
ring: "outlineColor",
|
|
45
53
|
fill: "fill",
|
|
46
54
|
stroke: "stroke",
|
|
47
|
-
decoration: "
|
|
55
|
+
decoration: "textDecorationColor",
|
|
48
56
|
};
|
|
49
57
|
/** Tailwind's own spacing scale, in rem - the fixed part of the fixed table. */
|
|
50
58
|
const SPACING = {
|
|
@@ -73,15 +81,15 @@ const SPACING = {
|
|
|
73
81
|
};
|
|
74
82
|
const SPACING_PROPERTY = {
|
|
75
83
|
p: "padding",
|
|
76
|
-
px: "
|
|
77
|
-
py: "
|
|
78
|
-
pt: "
|
|
79
|
-
pr: "
|
|
80
|
-
pb: "
|
|
81
|
-
pl: "
|
|
84
|
+
px: "paddingInline",
|
|
85
|
+
py: "paddingBlock",
|
|
86
|
+
pt: "paddingTop",
|
|
87
|
+
pr: "paddingRight",
|
|
88
|
+
pb: "paddingBottom",
|
|
89
|
+
pl: "paddingLeft",
|
|
82
90
|
m: "margin",
|
|
83
|
-
mx: "
|
|
84
|
-
my: "
|
|
91
|
+
mx: "marginInline",
|
|
92
|
+
my: "marginBlock",
|
|
85
93
|
gap: "gap",
|
|
86
94
|
};
|
|
87
95
|
/** Tailwind's radius scale. */
|
|
@@ -182,13 +190,13 @@ export function readUtility(utility, declared) {
|
|
|
182
190
|
const own = `--radius-${rest}`;
|
|
183
191
|
if (declared.has(own)) {
|
|
184
192
|
return {
|
|
185
|
-
property: "
|
|
193
|
+
property: "borderRadius",
|
|
186
194
|
value: `{radius.${rest}}`,
|
|
187
195
|
token: own,
|
|
188
196
|
};
|
|
189
197
|
}
|
|
190
198
|
if (RADIUS[rest])
|
|
191
|
-
return { property: "
|
|
199
|
+
return { property: "borderRadius", value: RADIUS[rest] };
|
|
192
200
|
}
|
|
193
201
|
return null;
|
|
194
202
|
}
|
|
@@ -219,6 +227,7 @@ export function transcribe(classes, declared) {
|
|
|
219
227
|
states: {},
|
|
220
228
|
dark: {},
|
|
221
229
|
skipped: [],
|
|
230
|
+
literals: [],
|
|
222
231
|
fromToken: 0,
|
|
223
232
|
fromLiteral: 0,
|
|
224
233
|
};
|
|
@@ -259,16 +268,27 @@ export function transcribe(classes, declared) {
|
|
|
259
268
|
}
|
|
260
269
|
if (!decl || !target)
|
|
261
270
|
continue;
|
|
271
|
+
/**
|
|
272
|
+
* EVERYTHING IT READS TRAVELS, literals included - as DATA.
|
|
273
|
+
*
|
|
274
|
+
* Which of these becomes a recipe declaration is not this module's call: a
|
|
275
|
+
* literal cannot re-theme, and whether `#ffffff` is a white or a SURFACE
|
|
276
|
+
* depends on the two palettes, which only exist on the platform. An earlier
|
|
277
|
+
* version wrote literals straight into `base` and a dark preview rendered a
|
|
278
|
+
* white box with white text on it; the version after that dropped them and
|
|
279
|
+
* carried almost nothing. Both were this module deciding something it cannot
|
|
280
|
+
* see (dono, 01/08).
|
|
281
|
+
*
|
|
282
|
+
* So it reports the whole reading and the platform pairs base against dark
|
|
283
|
+
* to recover the role. See `exclusive-contract.ts`.
|
|
284
|
+
*/
|
|
262
285
|
// First write wins, matching how a class list resolves for the properties
|
|
263
286
|
// we read: later duplicates in the same list are almost always a merge
|
|
264
287
|
// artefact rather than an override.
|
|
265
288
|
if (target[decl.property] != null)
|
|
266
289
|
continue;
|
|
267
290
|
target[decl.property] = decl.value;
|
|
268
|
-
|
|
269
|
-
out.fromToken += 1;
|
|
270
|
-
else
|
|
271
|
-
out.fromLiteral += 1;
|
|
291
|
+
out.fromToken += 1;
|
|
272
292
|
}
|
|
273
293
|
return out;
|
|
274
294
|
}
|
package/package.json
CHANGED