@csszyx/mcp-server 0.13.0 → 0.14.1
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 +6 -5
- package/llms-full.txt +36 -14
- 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,
|
|
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';
|
|
@@ -350,7 +350,8 @@ const RUNTIME_HELPERS = [
|
|
|
350
350
|
["__szvPick1", "usesSzvPick1"],
|
|
351
351
|
["__szColorVar", "usesColorVar"],
|
|
352
352
|
["__szSpacingVar", "usesSpacingVar"],
|
|
353
|
-
["__szUnitVar", "usesUnitVar"]
|
|
353
|
+
["__szUnitVar", "usesUnitVar"],
|
|
354
|
+
["__szBoolClass", "usesBoolClass"]
|
|
354
355
|
];
|
|
355
356
|
function restoreEnv(name, value) {
|
|
356
357
|
if (value === void 0) {
|
|
@@ -370,7 +371,7 @@ function compileWithDiagnostics(source, filename) {
|
|
|
370
371
|
process.env.NODE_ENV = "development";
|
|
371
372
|
delete process.env.CSSZYX_QUIET_SZ_WARNINGS;
|
|
372
373
|
try {
|
|
373
|
-
return { result:
|
|
374
|
+
return { result: transformSource(source, filename), warnings };
|
|
374
375
|
} finally {
|
|
375
376
|
console.warn = originalWarn;
|
|
376
377
|
restoreEnv("NODE_ENV", originalNodeEnv);
|
|
@@ -668,8 +669,8 @@ function validateEntry(key, value) {
|
|
|
668
669
|
suggestion: `Use { ${removed.key}: ${JSON.stringify(removed.value)} } instead.`
|
|
669
670
|
};
|
|
670
671
|
}
|
|
671
|
-
const isSpecial = ["
|
|
672
|
-
const isKnown = key in PROPERTY_MAP || BOOLEAN_SHORTHANDS.has(key) || KNOWN_VARIANTS.has(key) || isSpecial;
|
|
672
|
+
const isSpecial = ["@container", "*"].includes(key) || key.startsWith("@") || key.startsWith("[");
|
|
673
|
+
const isKnown = key in PROPERTY_MAP || BOOLEAN_SHORTHANDS.has(key) || KNOWN_SPECIAL_PROPERTIES.has(key) || KNOWN_VARIANTS.has(key) || isSpecial;
|
|
673
674
|
return isKnown ? void 0 : {
|
|
674
675
|
key,
|
|
675
676
|
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
|
|
@@ -1257,7 +1263,9 @@ moved into their layer (`{ maskLinear: { from } }` etc.), `maskShape` moved to
|
|
|
1257
1263
|
`{ maskRadial: { shape } }`, `maskVia` was removed with no equivalent (Tailwind
|
|
1258
1264
|
has no via stop for masks), and gradient layer values on `mask`
|
|
1259
1265
|
(`{ 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.
|
|
1266
|
+
mask-image: `none`, `url(…)`, a CSS variable, or an arbitrary value. The
|
|
1267
|
+
compiler warns and emits no class for every removed flat key; it never preserves
|
|
1268
|
+
them as custom-utility fallbacks.
|
|
1261
1269
|
|
|
1262
1270
|
### mask-image: Gradient Masks
|
|
1263
1271
|
|
|
@@ -3069,11 +3077,20 @@ needs "Use Workspace Version".
|
|
|
3069
3077
|
- Insert numeric suggestions without quotes and string suggestions with quotes. Suggestions are not validation: Tailwind 4 numeric values are open-ended.
|
|
3070
3078
|
- Preserve TypeScript's base completions. On cancellation, timeout, or internal failure, return the untouched base result.
|
|
3071
3079
|
|
|
3072
|
-
Defaults: `enabled: true`, `values: true`, `
|
|
3073
|
-
`deadlineMs: 20`, `failureThreshold: 3`. Usually emit only `{ "name":
|
|
3080
|
+
Defaults: `enabled: true`, `values: true`, `themeValues: false`,
|
|
3081
|
+
`maxEntries: 512`, `deadlineMs: 20`, `failureThreshold: 3`. Usually emit only `{ "name":
|
|
3074
3082
|
"@csszyx/ts-plugin" }`; do not add tuning options without a demonstrated need.
|
|
3075
3083
|
|
|
3076
|
-
**
|
|
3084
|
+
**Theme preview:** `themeValues: true` adds custom colors, spacings, fonts,
|
|
3085
|
+
text sizes, font weights, radii, shadows, and breakpoint keys from the leaf
|
|
3086
|
+
project's generated `.csszyx/theme.d.ts`. The declaration must already belong
|
|
3087
|
+
to the TypeScript Program. Parsing is AST-based and bounded (128 KiB source,
|
|
3088
|
+
2,000 tokens, 128 characters per token); missing/malformed input fails open.
|
|
3089
|
+
The plugin performs no CSS/filesystem scan, direct I/O, watcher, network, or
|
|
3090
|
+
Tailwind/config execution. VS Code extension users set
|
|
3091
|
+
`csszyx.themeValues: true`; the default remains off during host certification.
|
|
3092
|
+
|
|
3093
|
+
**Not provided by this plugin:** hover previews,
|
|
3077
3094
|
diagnostics, syntax highlighting, Tailwind config/plugin execution, network, or
|
|
3078
3095
|
telemetry. Those capabilities must not be inferred. The plugin is
|
|
3079
3096
|
self-contained: its metadata is bundled at build time, so it installs with no
|
|
@@ -3111,7 +3128,9 @@ IntelliSense, hover, and diagnostics for `sz` props. Supports JSX, TSX, JS, TS,
|
|
|
3111
3128
|
|
|
3112
3129
|
- Key + value completions inside `sz={{ ... }}` (variant-aware, depth 1 and 2)
|
|
3113
3130
|
- Hover preview — shows generated Tailwind className + inline CSS variables via `transform()`
|
|
3114
|
-
- Diagnostics — unknown prop keys flagged as warnings;
|
|
3131
|
+
- Diagnostics — unknown prop keys flagged as warnings; removed aliases receive
|
|
3132
|
+
canonical migration hints (for example `padding` → `p`) and emit no class,
|
|
3133
|
+
while intentional custom keys remain available to Tailwind `@utility`
|
|
3115
3134
|
- TextMate grammar injection — syntax highlighting for `sz` attribute
|
|
3116
3135
|
|
|
3117
3136
|
**Settings:**
|
|
@@ -3659,6 +3678,7 @@ sz={{ scale: shrunk ? 75 : 100 }} // inline prop ternary — both lit
|
|
|
3659
3678
|
- `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`); barrels, package specifiers, absolute specifiers, namespace/default imports 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
3679
|
- 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
3680
|
- `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)
|
|
3681
|
+
- 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
|
|
3662
3682
|
- When runtime `sz` values emit inline CSS variables beside one direct object-literal JSX spread, or one conditional whose branches are object literals, the compiler injects the variables into every spread branch's `style` so both authored and generated values survive. Keep unresolved or multiple spreads' style explicit; csszyx warns when it cannot prove a single-evaluation merge is safe
|
|
3663
3683
|
- `sz={{ ...(cond ? a : b), static: val }}` — conditional spread hoist: compiler resolves both branches at build time
|
|
3664
3684
|
- Imported variables / function call results fall back to `_sz()` runtime — a build-time compiler warning explains the fallback reason and suggests `szv()` or `dynamic()`. An expression rooted in an IMPORT collects no classes at all, so that warning is kept in production builds and survives `quiet: 'nudges'`; every other unresolved shape — including a forwarded `sz` prop, whose classes the caller contributes — stays dev-only advice
|
|
@@ -3905,15 +3925,17 @@ csszyx has two worlds; pick by "is the value set finite and known at build time?
|
|
|
3905
3925
|
- **Runtime (`dynamic()`):** unbounded values (CMS color, user `#hex`). CSS is
|
|
3906
3926
|
generated + injected in the browser via insertRule. Escape hatch only.
|
|
3907
3927
|
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3928
|
+
Engine (BUILD-TIME parse of JSX source only): ONE engine, two artifacts —
|
|
3929
|
+
`rust` (native addon, default) and `wasm` (the same engine compiled to
|
|
3930
|
+
WebAssembly, shipped inside `@csszyx/core`). Identical output by construction
|
|
3931
|
+
(same source, gate-pinned) — the artifact only affects build speed. The native
|
|
3932
|
+
binary ships as per-platform optional deps (`@csszyx/core-*`); if it's missing
|
|
3933
|
+
(unsupported arch, omitted optional deps, cross-platform frozen lockfile) the
|
|
3934
|
+
DEFAULT `rust` auto-degrades to `wasm` with a one-time warning — builds still
|
|
3935
|
+
succeed with identical classes. An EXPLICIT `parser:'rust'` (config or
|
|
3936
|
+
`CSSZYX_PARSER=rust`) hard-fails instead. Don't tell users a missing native
|
|
3937
|
+
binary breaks csszyx or changes classes; tell them to ignore the warning or set
|
|
3938
|
+
`build.parser:'wasm'`. The former `'oxc'`/`'babel'` values were removed. The RUNTIME
|
|
3917
3939
|
has no parser: `_sz`/`szr`/`szv`/`splitBox` are plain JS; `dynamic()` lowers an sz
|
|
3918
3940
|
OBJECT via `@csszyx/compiler/browser` (pure JS, no JSX parsing).
|
|
3919
3941
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@csszyx/mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
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/
|
|
34
|
-
"@csszyx/
|
|
35
|
-
"@csszyx/unplugin": "0.
|
|
33
|
+
"@csszyx/cli": "0.14.1",
|
|
34
|
+
"@csszyx/compiler": "0.14.1",
|
|
35
|
+
"@csszyx/unplugin": "0.14.1"
|
|
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"
|