@csszyx/mcp-server 0.14.3 → 0.14.5
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/index.mjs +22 -3
- package/llms-full.txt +23 -9
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -603,8 +603,26 @@ const reverseSchema = z.object({
|
|
|
603
603
|
'Tailwind CSS class string to convert. Example: "p-4 bg-blue-500 hover:text-white"'
|
|
604
604
|
)
|
|
605
605
|
});
|
|
606
|
+
function roundTrip(szObject, recognized) {
|
|
607
|
+
const originalWarn = console.warn;
|
|
608
|
+
console.warn = () => {
|
|
609
|
+
};
|
|
610
|
+
let emitted;
|
|
611
|
+
try {
|
|
612
|
+
emitted = transform(szObject).className;
|
|
613
|
+
} finally {
|
|
614
|
+
console.warn = originalWarn;
|
|
615
|
+
}
|
|
616
|
+
const want = sortStrings([...recognized]);
|
|
617
|
+
const got = sortStrings(emitted.split(/\s+/).filter(Boolean));
|
|
618
|
+
const ok = want.length === got.length && want.every((cls, i) => cls === got[i]);
|
|
619
|
+
return { ok, emitted };
|
|
620
|
+
}
|
|
606
621
|
function handleReverse(input) {
|
|
607
|
-
const
|
|
622
|
+
const classes = input.classes.trim();
|
|
623
|
+
const { szObject, unrecognized } = classNameToSzObject(classes);
|
|
624
|
+
const unrecognizedSet = new Set(unrecognized);
|
|
625
|
+
const recognized = classes.split(/\s+/).filter((cls) => cls && !unrecognizedSet.has(cls));
|
|
608
626
|
return {
|
|
609
627
|
content: [
|
|
610
628
|
{
|
|
@@ -614,7 +632,8 @@ function handleReverse(input) {
|
|
|
614
632
|
szObject,
|
|
615
633
|
unrecognized: unrecognized.length > 0 ? unrecognized : void 0,
|
|
616
634
|
totalRecognized: Object.keys(szObject).length,
|
|
617
|
-
totalUnrecognized: unrecognized.length
|
|
635
|
+
totalUnrecognized: unrecognized.length,
|
|
636
|
+
roundTrip: roundTrip(szObject, recognized)
|
|
618
637
|
},
|
|
619
638
|
null,
|
|
620
639
|
2
|
|
@@ -759,7 +778,7 @@ const TOOLS = [
|
|
|
759
778
|
},
|
|
760
779
|
{
|
|
761
780
|
name: "csszyx_reverse",
|
|
762
|
-
description: "Convert a Tailwind CSS class string into a csszyx sz object. Input: class string. Output: structured sz object
|
|
781
|
+
description: "Convert a Tailwind CSS class string into a csszyx sz object. Input: class string. Output: structured sz object, unrecognized classes, and roundTrip \u2014 the object compiled back to classes, with ok=false when that differs from the input. Do not use an answer whose roundTrip.ok is false.",
|
|
763
782
|
inputSchema: {
|
|
764
783
|
type: "object",
|
|
765
784
|
properties: {
|
package/llms-full.txt
CHANGED
|
@@ -3453,15 +3453,18 @@ Controlling the font weight.
|
|
|
3453
3453
|
|
|
3454
3454
|
Controlling the font width.
|
|
3455
3455
|
|
|
3456
|
-
| Concept | CSS Rule
|
|
3457
|
-
| :--------------------- |
|
|
3458
|
-
| Font Stretch 50% | `font-stretch: 50%`
|
|
3459
|
-
| Font Stretch 75% | `font-stretch: 75%`
|
|
3460
|
-
| Font Stretch 100% | `font-stretch: 100%`
|
|
3461
|
-
| Font Stretch 125% | `font-stretch: 125%`
|
|
3462
|
-
| Font Stretch 150% | `font-stretch: 150%`
|
|
3463
|
-
| Font Stretch
|
|
3464
|
-
|
|
|
3456
|
+
| Concept | CSS Rule | Tailwind v4 Class | `sz` Prop (Object Syntax) | Note |
|
|
3457
|
+
| :--------------------- | :------------------------------ | :----------------------------- | :----------------------------------- | :---------------------------------------------------------------------------------- |
|
|
3458
|
+
| Font Stretch 50% | `font-stretch: 50%` | `font-stretch-50%` | `{ fontStretch: '50%' }` | |
|
|
3459
|
+
| Font Stretch 75% | `font-stretch: 75%` | `font-stretch-75%` | `{ fontStretch: '75%' }` | |
|
|
3460
|
+
| Font Stretch 100% | `font-stretch: 100%` | `font-stretch-100%` | `{ fontStretch: '100%' }` | |
|
|
3461
|
+
| Font Stretch 125% | `font-stretch: 125%` | `font-stretch-125%` | `{ fontStretch: '125%' }` | |
|
|
3462
|
+
| Font Stretch 150% | `font-stretch: 150%` | `font-stretch-150%` | `{ fontStretch: '150%' }` | |
|
|
3463
|
+
| Font Stretch Keyword | `font-stretch: condensed` | `font-stretch-condensed` | `{ fontStretch: 'condensed' }` | Keywords keep the `font-stretch-` prefix; `font-condensed` is not a Tailwind class. |
|
|
3464
|
+
| Font Stretch Keyword | `font-stretch: expanded` | `font-stretch-expanded` | `{ fontStretch: 'expanded' }` | |
|
|
3465
|
+
| Font Stretch Keyword | `font-stretch: ultra-condensed` | `font-stretch-ultra-condensed` | `{ fontStretch: 'ultra-condensed' }` | |
|
|
3466
|
+
| Font Stretch Arbitrary | `font-stretch: 110%` | `font-stretch-[110%]` | `{ fontStretch: '110%' }` | |
|
|
3467
|
+
| CSS Variable | `font-stretch: var(--s)` | `font-stretch-(--s)` | `{ fontStretch: '--s' }` | |
|
|
3465
3468
|
|
|
3466
3469
|
## Font Variant Numeric
|
|
3467
3470
|
|
|
@@ -4266,9 +4269,20 @@ npx @csszyx/cli migrate --resolve-todos .csszyx-todo.json
|
|
|
4266
4269
|
|
|
4267
4270
|
Reads `.csszyx-todo.json` and applies it during migration.
|
|
4268
4271
|
`--resolve-todos` is **read-only**: it never writes to the todo file.
|
|
4272
|
+
On a file an earlier pass already migrated, the classes the map decides merge into the
|
|
4273
|
+
element's existing `sz={{ … }}` object; a key that object already sets is left alone and
|
|
4274
|
+
reported, and undecided classes keep their `@sz-todo` marker.
|
|
4269
4275
|
Still-unresolved classes appear in the console and log only.
|
|
4270
4276
|
Re-run `--audit` to get a fresh snapshot when ready.
|
|
4271
4277
|
|
|
4278
|
+
### Which engine runs
|
|
4279
|
+
|
|
4280
|
+
`migrate` runs on the native Rust engine, and falls back to the TypeScript one when the
|
|
4281
|
+
platform has no prebuilt binary — both write the same output byte for byte, so the fallback
|
|
4282
|
+
costs time and nothing else. `CSSZYX_MIGRATE_ENGINE=ts` forces the TypeScript engine;
|
|
4283
|
+
`CSSZYX_MIGRATE_ENGINE=rust` requires the native one and fails when it is absent, rather than
|
|
4284
|
+
quietly running the other.
|
|
4285
|
+
|
|
4272
4286
|
### `--inject-todos` — mark unrecognized classes in code
|
|
4273
4287
|
|
|
4274
4288
|
```bash
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@csszyx/mcp-server",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.5",
|
|
4
4
|
"description": "Model Context Protocol (MCP) server for csszyx — enables AI agents to understand and generate sz props",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
32
32
|
"zod": "^4.4.3",
|
|
33
|
-
"@csszyx/
|
|
34
|
-
"@csszyx/unplugin": "0.14.
|
|
35
|
-
"@csszyx/
|
|
33
|
+
"@csszyx/compiler": "0.14.5",
|
|
34
|
+
"@csszyx/unplugin": "0.14.5",
|
|
35
|
+
"@csszyx/cli": "0.14.5"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^22.20.1",
|