Remove CSSX style dictionary infrastructure — styling is just components
The entire parallel CSS system (StyleValue type, style dictionary, keyword atom resolver, content-addressed class generation, runtime CSS injection, localStorage caching) was built but never adopted — the codebase already uses :class strings with defcomp components for all styling. Remove ~3,000 lines of unused infrastructure. Deleted: - cssx.sx spec module (317 lines) - style_dict.py (782 lines) and style_resolver.py (254 lines) - StyleValue type, defkeyframes special form, build-keyframes platform fn - Style dict JSON delivery (<script type="text/sx-styles">), cookies, localStorage - css/merge-styles primitives, inject-style-value, fnv1a-hash platform interface Simplified: - defstyle now binds any value (string, function) — no StyleValue type needed - render-attrs no longer special-cases :style StyleValue → class conversion - Boot sequence skips style dict init step Preserved: - tw.css parsing + CSS class delivery (SX-Css headers, <style id="sx-css">) - All component infrastructure (defcomp, caching, bundling, deps) - defstyle as a binding form for reusable class strings Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -147,48 +147,6 @@ def scan_classes_from_sx(source: str) -> set[str]:
|
||||
return classes
|
||||
|
||||
|
||||
def register_generated_rule(style_val: Any) -> None:
|
||||
"""Register a generated StyleValue's CSS rules in the registry.
|
||||
|
||||
This allows generated class names (``sx-a3f2c1``) to flow through
|
||||
the existing ``lookup_rules()`` → ``SX-Css`` delta pipeline.
|
||||
"""
|
||||
from .style_dict import CHILD_SELECTOR_ATOMS
|
||||
cn = style_val.class_name
|
||||
if cn in _REGISTRY:
|
||||
return # already registered
|
||||
|
||||
parts: list[str] = []
|
||||
|
||||
# Base declarations
|
||||
if style_val.declarations:
|
||||
parts.append(f".{cn}{{{style_val.declarations}}}")
|
||||
|
||||
# Pseudo-class rules
|
||||
for sel, decls in style_val.pseudo_rules:
|
||||
if sel.startswith("::"):
|
||||
parts.append(f".{cn}{sel}{{{decls}}}")
|
||||
elif "&" in sel:
|
||||
# group-hover pattern: ":is(.group:hover) &" → .group:hover .sx-abc
|
||||
expanded = sel.replace("&", f".{cn}")
|
||||
parts.append(f"{expanded}{{{decls}}}")
|
||||
else:
|
||||
parts.append(f".{cn}{sel}{{{decls}}}")
|
||||
|
||||
# Media-query rules
|
||||
for query, decls in style_val.media_rules:
|
||||
parts.append(f"@media {query}{{.{cn}{{{decls}}}}}")
|
||||
|
||||
# Keyframes
|
||||
for _name, kf_rule in style_val.keyframes:
|
||||
parts.append(kf_rule)
|
||||
|
||||
rule_text = "".join(parts)
|
||||
order = len(_RULE_ORDER) + 10000 # after all tw.css rules
|
||||
_REGISTRY[cn] = rule_text
|
||||
_RULE_ORDER[cn] = order
|
||||
|
||||
|
||||
def registry_loaded() -> bool:
|
||||
"""True if the registry has been populated."""
|
||||
return bool(_REGISTRY)
|
||||
|
||||
Reference in New Issue
Block a user