@csszyx/mcp-server 0.14.0 → 0.14.2
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 +9 -8
- package/llms-full.txt +52 -16
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
6
6
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
7
7
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
8
8
|
import { ListToolsRequestSchema, CallToolRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
9
|
-
import { sortStrings, SPECIAL_VARIANTS, KNOWN_VARIANTS, PROPERTY_MAP, transform, transformSource, SUGGESTION_MAP, BOOLEAN_SHORTHANDS, REMOVED_BOOLEAN_SUGAR } from '@csszyx/compiler';
|
|
9
|
+
import { sortStrings, SPECIAL_VARIANTS, KNOWN_VARIANTS, PROPERTY_MAP, transform, transformSource, SUGGESTION_MAP, BOOLEAN_SHORTHANDS, REMOVED_BOOLEAN_SUGAR, KNOWN_SPECIAL_PROPERTIES } from '@csszyx/compiler';
|
|
10
10
|
import { z } from 'zod';
|
|
11
11
|
import { migrateSource, classNameToSzObject } from '@csszyx/cli';
|
|
12
12
|
import { parseThemeBlocks, hasTokens } from '@csszyx/unplugin';
|
|
@@ -201,11 +201,12 @@ Without it: \`Property 'sz' does not exist on type 'DetailedHTMLProps<...>'\`.
|
|
|
201
201
|
- **"No prebuilt native binary" warning / \`native engine unavailable\`**: the
|
|
202
202
|
default \`rust\` parser's native binary is missing (unsupported arch, optional
|
|
203
203
|
deps omitted, or a cross-platform frozen lockfile). It is NOT broken and classes
|
|
204
|
-
are UNCHANGED \u2014
|
|
205
|
-
|
|
206
|
-
the build succeeds;
|
|
207
|
-
|
|
208
|
-
|
|
204
|
+
are UNCHANGED \u2014 there is ONE engine shipped in two builds, native and wasm, and
|
|
205
|
+
they are parity-gated to emit identical output. csszyx auto-falls back to the
|
|
206
|
+
wasm build and the build succeeds; only parse speed differs. Ignore the warning,
|
|
207
|
+
or install the matching \`@csszyx/core-<platform>\` package, or set
|
|
208
|
+
\`build.parser\` explicitly to silence it. Only an EXPLICIT \`parser:'rust'\`
|
|
209
|
+
hard-fails. Do NOT tell the user to debug their styles over this.
|
|
209
210
|
- **A class generates no CSS**: it wasn't safelisted. The file must contain a
|
|
210
211
|
statically analyzable \`sz=\` or \`szv(\` (the prescan qualifies files by those
|
|
211
212
|
tokens). Arbitrary values (\`m:'20px'\`\u2192\`m-[20px]\`) and large numbers
|
|
@@ -669,8 +670,8 @@ function validateEntry(key, value) {
|
|
|
669
670
|
suggestion: `Use { ${removed.key}: ${JSON.stringify(removed.value)} } instead.`
|
|
670
671
|
};
|
|
671
672
|
}
|
|
672
|
-
const isSpecial = ["
|
|
673
|
-
const isKnown = key in PROPERTY_MAP || BOOLEAN_SHORTHANDS.has(key) || KNOWN_VARIANTS.has(key) || isSpecial;
|
|
673
|
+
const isSpecial = ["@container", "*"].includes(key) || key.startsWith("@") || key.startsWith("[");
|
|
674
|
+
const isKnown = key in PROPERTY_MAP || BOOLEAN_SHORTHANDS.has(key) || KNOWN_SPECIAL_PROPERTIES.has(key) || KNOWN_VARIANTS.has(key) || isSpecial;
|
|
674
675
|
return isKnown ? void 0 : {
|
|
675
676
|
key,
|
|
676
677
|
message: `Unknown prop '${key}'. Not a valid sz key, variant, or special prop.`
|
package/llms-full.txt
CHANGED
|
@@ -244,6 +244,12 @@ sz={{ '@container': true, '@md': { display: 'flex' } }}
|
|
|
244
244
|
{ p: 4, bg: 'blue-500', display: 'flex', flexDir: 'col', w: '333px', mt: 4, text: 'lg' }
|
|
245
245
|
```
|
|
246
246
|
|
|
247
|
+
Known CSS-name aliases and removed migration keys are rejected rather than
|
|
248
|
+
auto-mapped: the compiler warns and emits no class. Rename the source to the
|
|
249
|
+
canonical key or replacement shape. A truly unknown key is different: it warns
|
|
250
|
+
but still emits a kebab-case candidate so an intentional Tailwind `@utility`
|
|
251
|
+
can serve it.
|
|
252
|
+
|
|
247
253
|
## Type safety — unknown keys are TypeScript errors
|
|
248
254
|
|
|
249
255
|
The `sz` prop type is **closed**: a key that is not a known sz prop or variant is a
|
|
@@ -675,16 +681,17 @@ Strategy for static analysis vs runtime generation.
|
|
|
675
681
|
|
|
676
682
|
**Core Decision**: `CSSzyx` uses **AST Parsing**, not Regex Scanning. This allows for smarter static extraction and shake-tree logic.
|
|
677
683
|
|
|
678
|
-
| Concept | Tailwind Scanner (Regex) | `sz` Compiler (AST) | Note
|
|
679
|
-
| :---------------------------- | :----------------------- | :----------------------- |
|
|
680
|
-
| **String Interpolation** | ❌ Fails `bg-${color}` | ✅ **Runtime Support** | Compiler marks as dynamic, handled at runtime via variable injection.
|
|
681
|
-
| **Conditionals** | ❌ Fails logic | ✅ **Static Extraction** | `{ bg: active ? 'blue' : 'gray' }` and `{ scale: shrunk ? 75 : 100 }` → both branches compiled to static Tailwind classes at build time. A runtime branch uses a CSS variable; an opposite `undefined`, `null`, `false`, or empty-string branch omits both the utility and variable value. Numeric `0` remains valid.
|
|
682
|
-
| **Variable reference** | ❌ Not applicable | ✅ **Build time** | `sz={myVar}` — pass variable directly when no override needed. Compiler resolves the binding to its object literal initializer (incl. `as const`, `satisfies`, explicit type annotation).
|
|
683
|
-
| **Object Spread** | ❌ Fails spread | ✅ **Static Analysis** | `sz={{ ...baseProps, key: val }}` — use spread only when overriding/adding; last key wins. Resolved at build time for local literals. Multiple/nested spreads supported. Imported vars fall back to `_sz()` — no crash. When runtime `sz` emits CSS variables beside one direct object-literal JSX prop spread, or one conditional with object-literal branches, generated variables merge into every branch's `style`; unresolved/multiple JSX spreads retain a collision diagnostic.
|
|
684
|
-
| **Array variable items** | ❌ Not applicable | ✅ **Build time** | `sz={[varA, varB]}` and `sz={[varA, cond && varB]}` — LATER WINS composition. All-static-object arrays deep-merge at build (later leaf wins per key path, sibling keys survive) into one className; arrays with strings/conditions/dynamic elements emit `_szcn(...)` — a compiler-injected helper (`_` = generated code, never hand-authored; the unmemoized twin of `szcn`) applying the same later-wins rule per property group at runtime. Finite ternary elements and finite conditional object properties compile to conditional class strings; only truly dynamic elements (e.g. a forwarded `szsc` slot) pass through `_szPart` (string passthrough / sz-object compile).
|
|
685
|
-
| **Ternary variable branches** | ❌ Not applicable | ✅ **Build time** | `sz={cond ? varA : varB}` — both branches compiled to static strings when variables are local literals.
|
|
686
|
-
| **
|
|
687
|
-
| **
|
|
684
|
+
| Concept | Tailwind Scanner (Regex) | `sz` Compiler (AST) | Note |
|
|
685
|
+
| :---------------------------- | :----------------------- | :----------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
686
|
+
| **String Interpolation** | ❌ Fails `bg-${color}` | ✅ **Runtime Support** | Compiler marks as dynamic, handled at runtime via variable injection. |
|
|
687
|
+
| **Conditionals** | ❌ Fails logic | ✅ **Static Extraction** | `{ bg: active ? 'blue' : 'gray' }` and `{ scale: shrunk ? 75 : 100 }` → both branches compiled to static Tailwind classes at build time. A runtime branch uses a CSS variable; an opposite `undefined`, `null`, `false`, or empty-string branch omits both the utility and variable value. Numeric `0` remains valid. A runtime value on a KEYWORD-valued key — `display`, `position`, `items`, `textAlign`, `borderStyle`, `bgSize` and their neighbours — takes no CSS variable at all: Tailwind's `<prefix>-(--var)` form for these either matches no utility or resolves to a different CSS property, so the class and the variable are dropped and the build reports it. Use `szv()` to name the values. Static values on the same keys are unaffected, as is the runtime lowering. |
|
|
688
|
+
| **Variable reference** | ❌ Not applicable | ✅ **Build time** | `sz={myVar}` — pass variable directly when no override needed. Compiler resolves the binding to its object literal initializer (incl. `as const`, `satisfies`, explicit type annotation). |
|
|
689
|
+
| **Object Spread** | ❌ Fails spread | ✅ **Static Analysis** | `sz={{ ...baseProps, key: val }}` — use spread only when overriding/adding; last key wins. Resolved at build time for local literals. Multiple/nested spreads supported. Imported vars fall back to `_sz()` — no crash. When runtime `sz` emits CSS variables beside one direct object-literal JSX prop spread, or one conditional with object-literal branches, generated variables merge into every branch's `style`; unresolved/multiple JSX spreads retain a collision diagnostic. |
|
|
690
|
+
| **Array variable items** | ❌ Not applicable | ✅ **Build time** | `sz={[varA, varB]}` and `sz={[varA, cond && varB]}` — LATER WINS composition. All-static-object arrays deep-merge at build (later leaf wins per key path, sibling keys survive) into one className; arrays with strings/conditions/dynamic elements emit `_szcn(...)` — a compiler-injected helper (`_` = generated code, never hand-authored; the unmemoized twin of `szcn`) applying the same later-wins rule per property group at runtime. Finite ternary elements and finite conditional object properties compile to conditional class strings; only truly dynamic elements (e.g. a forwarded `szsc` slot) pass through `_szPart` (string passthrough / sz-object compile). |
|
|
691
|
+
| **Ternary variable branches** | ❌ Not applicable | ✅ **Build time** | `sz={cond ? varA : varB}` — both branches compiled to static strings when variables are local literals. A branch spelled `undefined`, `null`, `false`, or `{}` is the EMPTY style and compiles to no classes, so `sz={cond ? varA : undefined}` folds just like `: {}`. A chain — `a ? x : b ? y : z` — compiles too, up to 8 tests; the emitted expression keeps the same nesting, so each test is only reached when every test before it was falsy. Past 8 the attribute keeps the runtime path. |
|
|
692
|
+
| **Guarded style (`&&`)** | ❌ Not applicable | ✅ **Build time** | `sz={cond && varA}` compiles to the ternary it already is, because a falsy left operand is the empty style. `sz={a \|\| varA}` does NOT compile: `\|\|` yields its LEFT operand when the test passes, and that value can be a style the fold would drop. |
|
|
693
|
+
| **Chained variables** | ❌ Not applicable | ✅ **Build time** | `const b = { ...a, key: val }; <div sz={b} />` — compiler resolves the chain recursively. |
|
|
694
|
+
| **Safelist** | Required for dynamic | **Not Required** | Auto-detected for static logic; Auto-injected for runtime values. |
|
|
688
695
|
|
|
689
696
|
**Performance Rule**: Prefer **Static Strings** in `sz` objects.
|
|
690
697
|
|
|
@@ -1076,6 +1083,22 @@ Controlling the style of an element's borders.
|
|
|
1076
1083
|
| **Hidden** | `border-style: hidden` | `border-hidden` | `{ borderStyle: 'hidden' }` | |
|
|
1077
1084
|
| **None** | `border-style: none` | `border-none` | `{ borderStyle: 'none' }` | |
|
|
1078
1085
|
|
|
1086
|
+
The style applies to **every side**. Tailwind has no per-side border-style
|
|
1087
|
+
utility, so a style keyword on a side key (`{ borderB: 'none' }`) generates no
|
|
1088
|
+
CSS — csszyx drops the class and reports it. Use `borderStyle` for the style, and
|
|
1089
|
+
a number on the side key for its width:
|
|
1090
|
+
|
|
1091
|
+
```jsx
|
|
1092
|
+
// ❌ border-b-none — Tailwind serves no rule, so the border stays
|
|
1093
|
+
<div sz={{ borderB: 'none' }} />
|
|
1094
|
+
|
|
1095
|
+
// ✅ remove the style on every side
|
|
1096
|
+
<div sz={{ borderStyle: 'none' }} />
|
|
1097
|
+
|
|
1098
|
+
// ✅ or take the bottom border to zero width
|
|
1099
|
+
<div sz={{ borderB: 0 }} />
|
|
1100
|
+
```
|
|
1101
|
+
|
|
1079
1102
|
## Divide Width
|
|
1080
1103
|
|
|
1081
1104
|
Utilities for controlling the border width between elements.
|
|
@@ -1257,7 +1280,9 @@ moved into their layer (`{ maskLinear: { from } }` etc.), `maskShape` moved to
|
|
|
1257
1280
|
`{ maskRadial: { shape } }`, `maskVia` was removed with no equivalent (Tailwind
|
|
1258
1281
|
has no via stop for masks), and gradient layer values on `mask`
|
|
1259
1282
|
(`{ mask: 'linear-45' }`) moved to the layer keys. `mask` carries only a direct
|
|
1260
|
-
mask-image: `none`, `url(…)`, a CSS variable, or an arbitrary value.
|
|
1283
|
+
mask-image: `none`, `url(…)`, a CSS variable, or an arbitrary value. The
|
|
1284
|
+
compiler warns and emits no class for every removed flat key; it never preserves
|
|
1285
|
+
them as custom-utility fallbacks.
|
|
1261
1286
|
|
|
1262
1287
|
### mask-image: Gradient Masks
|
|
1263
1288
|
|
|
@@ -3069,11 +3094,20 @@ needs "Use Workspace Version".
|
|
|
3069
3094
|
- Insert numeric suggestions without quotes and string suggestions with quotes. Suggestions are not validation: Tailwind 4 numeric values are open-ended.
|
|
3070
3095
|
- Preserve TypeScript's base completions. On cancellation, timeout, or internal failure, return the untouched base result.
|
|
3071
3096
|
|
|
3072
|
-
Defaults: `enabled: true`, `values: true`, `
|
|
3073
|
-
`deadlineMs: 20`, `failureThreshold: 3`. Usually emit only `{ "name":
|
|
3097
|
+
Defaults: `enabled: true`, `values: true`, `themeValues: false`,
|
|
3098
|
+
`maxEntries: 512`, `deadlineMs: 20`, `failureThreshold: 3`. Usually emit only `{ "name":
|
|
3074
3099
|
"@csszyx/ts-plugin" }`; do not add tuning options without a demonstrated need.
|
|
3075
3100
|
|
|
3076
|
-
**
|
|
3101
|
+
**Theme preview:** `themeValues: true` adds custom colors, spacings, fonts,
|
|
3102
|
+
text sizes, font weights, radii, shadows, and breakpoint keys from the leaf
|
|
3103
|
+
project's generated `.csszyx/theme.d.ts`. The declaration must already belong
|
|
3104
|
+
to the TypeScript Program. Parsing is AST-based and bounded (128 KiB source,
|
|
3105
|
+
2,000 tokens, 128 characters per token); missing/malformed input fails open.
|
|
3106
|
+
The plugin performs no CSS/filesystem scan, direct I/O, watcher, network, or
|
|
3107
|
+
Tailwind/config execution. VS Code extension users set
|
|
3108
|
+
`csszyx.themeValues: true`; the default remains off during host certification.
|
|
3109
|
+
|
|
3110
|
+
**Not provided by this plugin:** hover previews,
|
|
3077
3111
|
diagnostics, syntax highlighting, Tailwind config/plugin execution, network, or
|
|
3078
3112
|
telemetry. Those capabilities must not be inferred. The plugin is
|
|
3079
3113
|
self-contained: its metadata is bundled at build time, so it installs with no
|
|
@@ -3111,7 +3145,9 @@ IntelliSense, hover, and diagnostics for `sz` props. Supports JSX, TSX, JS, TS,
|
|
|
3111
3145
|
|
|
3112
3146
|
- Key + value completions inside `sz={{ ... }}` (variant-aware, depth 1 and 2)
|
|
3113
3147
|
- Hover preview — shows generated Tailwind className + inline CSS variables via `transform()`
|
|
3114
|
-
- Diagnostics — unknown prop keys flagged as warnings;
|
|
3148
|
+
- Diagnostics — unknown prop keys flagged as warnings; removed aliases receive
|
|
3149
|
+
canonical migration hints (for example `padding` → `p`) and emit no class,
|
|
3150
|
+
while intentional custom keys remain available to Tailwind `@utility`
|
|
3115
3151
|
- TextMate grammar injection — syntax highlighting for `sz` attribute
|
|
3116
3152
|
|
|
3117
3153
|
**Settings:**
|
|
@@ -3656,7 +3692,7 @@ sz={{ scale: shrunk ? 75 : 100 }} // inline prop ternary — both lit
|
|
|
3656
3692
|
- Use `sz={var}` when no override needed (simpler)
|
|
3657
3693
|
- Use `sz={{ ...var, key: val }}` only when overriding/adding
|
|
3658
3694
|
- Variables in array elements, ternary branches, and chained initializers all resolve at build time
|
|
3659
|
-
- `build.importedStaticSz` (default TRUE) compiles a static sz object imported from another module — v1 covers a direct `sz={binding}` from a NAMED import of an `export const` object literal, written relative or through a project alias (read from the bundler's `resolve.alias` and tsconfig `compilerOptions.paths`);
|
|
3695
|
+
- `build.importedStaticSz` (default TRUE) compiles a static sz object imported from another module — v1 covers a direct `sz={binding}` from a NAMED import of an `export const` object literal, written relative or through a project alias (read from the bundler's `resolve.alias` and tsconfig `compilerOptions.paths`); a named re-export through a barrel is followed to the module that declares the value, up to eight modules deep; `export *`, package specifiers, absolute specifiers and nested positions keep the runtime fallback and report it; every lane defaults to on so nothing needs wiring, and turning it OFF must be done in all of them — `csszyxTurbopack({}, { importedStaticSz: false })` PLUS `csszyx next prebuild --no-imported-static-sz` PLUS `csszyx next watch --no-imported-static-sz` for dev — because a mismatch fails the production build on the config hash
|
|
3660
3696
|
- A shared sz object is a build-time value: the compiler reads it where it is DECLARED. Reassigning the binding (`let s = {...}; s = {...}`) is detected and falls back to the runtime; a property write (`s.p = 8`) is NOT detected and the class still describes the declared value. Declare once, never write to it — vary with spread overrides or `szv()`
|
|
3661
3697
|
- `sz={{ key: cond ? a : b }}` — both literal branches compile to static classes; a runtime branch uses a CSS variable. An opposite `undefined`, `null`, `false`, or `''` branch omits the utility and variable value (`0` remains valid)
|
|
3662
3698
|
- Keys whose value is a boolean — `border` and every side, `ring`, `outline`, `shadow`, `truncate` — never use a CSS variable: a runtime value on them compiles to `__szBoolClass(value, key, "border-b")`, which renders the bare class for `true`, nothing for `false`/`null`/`undefined`/`''`, and warns for any other type instead of emitting a utility that would style a different property. React discards booleans in `style`, so the variable form could never have applied
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@csszyx/mcp-server",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.2",
|
|
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,13 +30,13 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
32
32
|
"zod": "^4.4.3",
|
|
33
|
-
"@csszyx/cli": "0.14.
|
|
34
|
-
"@csszyx/unplugin": "0.14.
|
|
35
|
-
"@csszyx/compiler": "0.14.
|
|
33
|
+
"@csszyx/cli": "0.14.2",
|
|
34
|
+
"@csszyx/unplugin": "0.14.2",
|
|
35
|
+
"@csszyx/compiler": "0.14.2"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^22.20.1",
|
|
39
|
-
"tsx": "^4.23.
|
|
39
|
+
"tsx": "^4.23.11",
|
|
40
40
|
"typescript": "^6.0.3",
|
|
41
41
|
"unbuild": "^3.6.1",
|
|
42
42
|
"vitest": "^4.1.10"
|