@csszyx/mcp-server 0.10.1 → 0.10.3
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/llms-full.txt +57 -0
- package/package.json +4 -4
package/llms-full.txt
CHANGED
|
@@ -3560,6 +3560,63 @@ function Box({ sz, ...rest }) {
|
|
|
3560
3560
|
}
|
|
3561
3561
|
```
|
|
3562
3562
|
|
|
3563
|
+
## Build-time vs runtime (when does sz become CSS)
|
|
3564
|
+
|
|
3565
|
+
csszyx has two worlds; pick by "is the value set finite and known at build time?".
|
|
3566
|
+
|
|
3567
|
+
- **Static (build-time, default):** literals + `szv` variants. The compiler lowers
|
|
3568
|
+
sz → Tailwind classes and safelists them; Tailwind generates CSS at build. Zero
|
|
3569
|
+
runtime, SSR-safe.
|
|
3570
|
+
- **Runtime (`dynamic()`):** unbounded values (CMS color, user `#hex`). CSS is
|
|
3571
|
+
generated + injected in the browser via insertRule. Escape hatch only.
|
|
3572
|
+
|
|
3573
|
+
Engines (BUILD-TIME parse of JSX source only): Rust native (default) → oxc (JS
|
|
3574
|
+
fallback) → babel (last resort). The RUNTIME has no parser: `_sz`/`szv`/`splitBox`
|
|
3575
|
+
are plain JS; `dynamic()` lowers an sz OBJECT via `@csszyx/compiler/browser` (pure
|
|
3576
|
+
JS, no JSX parsing).
|
|
3577
|
+
|
|
3578
|
+
Helper build-time/runtime:
|
|
3579
|
+
|
|
3580
|
+
- `sz={{…}}` literal → build-time (extracted + safelisted).
|
|
3581
|
+
- `szv` → build-time: the compiler extracts the `szv({…})` config from its
|
|
3582
|
+
DECLARATION, regardless of how the factory output is used (direct sz=, through
|
|
3583
|
+
splitBoxSz, or unused). Indirection does NOT break safelisting.
|
|
3584
|
+
- `splitBox`/`splitBoxSz` → RUNTIME routing only (pure JS). They re-partition
|
|
3585
|
+
existing classes; they emit no new CSS and do NOT force `dynamic()`. CSS comes
|
|
3586
|
+
from the static source (a literal or a szv config).
|
|
3587
|
+
- `dynamic()` → the only helper that generates CSS at runtime, and only for a
|
|
3588
|
+
class not already in the built CSS.
|
|
3589
|
+
|
|
3590
|
+
Safelist requires a statically analyzable position (a literal sz, or a szv config
|
|
3591
|
+
literal). File-discovery gap: the prescan only scans files containing `sz=`/`sz:`,
|
|
3592
|
+
so a standalone szv-config file (no JSX) is skipped → co-locate szv in the
|
|
3593
|
+
component file that has a `sz=` usage. For a sibling workspace package, opt it in
|
|
3594
|
+
with `compilePackages: ['name']`.
|
|
3595
|
+
|
|
3596
|
+
Tree-shaking is content-presence (same as Tailwind), not import-graph. Co-locating
|
|
3597
|
+
szv makes the component the shaking unit.
|
|
3598
|
+
|
|
3599
|
+
Specificity: a `dynamic()`-injected rule is UNLAYERED → beats static sz / Tailwind
|
|
3600
|
+
`@layer utilities` at equal specificity (CSS Cascade Level 5). They don't collide
|
|
3601
|
+
by design (dynamic injects only not-yet-built classes); prefer all-static in a
|
|
3602
|
+
component.
|
|
3603
|
+
|
|
3604
|
+
CRITICAL — sz on an HTML tag vs a component: the compiler rewrites `sz=` to
|
|
3605
|
+
`className=` on ANY element. On an html tag (`<div sz>`) the class lands on the DOM
|
|
3606
|
+
and applies. On a COMPONENT (`<Box sz={{p:4}}>` → `<Box className="p-4">`) the
|
|
3607
|
+
class becomes a `className` PROP — the component does NOT receive an sz object and
|
|
3608
|
+
MUST forward `className` onto a real html tag, else the style is lost. Putting sz
|
|
3609
|
+
on a component is NOT enough; every style must reach an html tag.
|
|
3610
|
+
|
|
3611
|
+
Design-system rules: (1) a component is styled from the app via the `className` it
|
|
3612
|
+
receives (the compiled app sz); forward it to a DOM tag
|
|
3613
|
+
(`function Box({className}) { return <div className={className}/> }`). NEVER
|
|
3614
|
+
`dynamic(sz)` inside a component (makes every consumer runtime). (2) a multi-part
|
|
3615
|
+
component receives ONE className and routes it with `splitBox(className)` (STRING),
|
|
3616
|
+
combining with its own base classes on plain className (don't mix sz= and
|
|
3617
|
+
className= on one element). `splitBoxSz` (object) is only for routing an sz object
|
|
3618
|
+
the component builds internally (e.g. from szv) onto nested sz= props.
|
|
3619
|
+
|
|
3563
3620
|
## Security — untrusted sz
|
|
3564
3621
|
|
|
3565
3622
|
csszyx is safe-by-default for AUTHORED sz (compiled to class strings at build time). When sz comes from UNTRUSTED input (JSON-driven UI, CMS, user data), it controls keys and values that reach the runtime CSS pipeline — purify it.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@csszyx/mcp-server",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3",
|
|
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": "^3.23.8",
|
|
33
|
-
"@csszyx/compiler": "0.10.
|
|
34
|
-
"@csszyx/cli": "0.10.
|
|
35
|
-
"@csszyx/unplugin": "0.10.
|
|
33
|
+
"@csszyx/compiler": "0.10.3",
|
|
34
|
+
"@csszyx/cli": "0.10.3",
|
|
35
|
+
"@csszyx/unplugin": "0.10.3"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"typescript": "^6.0.3",
|