Live wire response + component display with OOB swaps on all examples
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 3m56s

- All 6 examples show Component and Wire response as placeholders that
  fill with actual content when the demo is triggered (via OOB swaps)
- Wire response shows full wire content including component definitions
  (when not cached) and CSS style block
- Component display only includes defs the client doesn't already have,
  matching real sx_response() behaviour
- Add "Clear component cache" button to reset localStorage + in-memory
  component env so next interaction shows component download
- Rebuild tw.css with Tailwind v3.4.19 including sx content paths
- Optimize sx_response() CSS scanning to only scan sent comp_defs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-03 01:54:45 +00:00
parent ea18a402d6
commit 8024fa5b13
6 changed files with 289 additions and 65 deletions

View File

@@ -3,7 +3,8 @@ module.exports = {
safelist: [
// ~menu-row-sx builds bg-{colour}-{shade} dynamically via (str ...)
// Levels 14 produce shades 400100 (level 5+ yields 0 or negative = no match)
{ pattern: /^bg-sky-(100|200|300|400)$/ },
{ pattern: /^bg-sky-(100|200|300|400|500)$/ },
{ pattern: /^bg-violet-(100|200|300|400|500)$/ },
],
content: [
'/root/rose-ash/shared/sx/templates/**/*.sx',
@@ -30,6 +31,9 @@ module.exports = {
'/root/rose-ash/federation/sx/sx_components.py',
'/root/rose-ash/account/sx/sx_components.py',
'/root/rose-ash/orders/sx/sx_components.py',
'/root/rose-ash/sx/sxc/**/*.sx',
'/root/rose-ash/sx/sxc/sx_components.py',
'/root/rose-ash/sx/content/highlight.py',
],
theme: {
extend: {},

File diff suppressed because one or more lines are too long

View File

@@ -402,8 +402,6 @@ def sx_response(source_or_component: str, status: int = 200,
# On-demand CSS: scan source for classes, send only new rules
from .css_registry import scan_classes_from_sx, lookup_rules, registry_loaded, lookup_css_hash, store_css_hash
from .jinja_bridge import _COMPONENT_ENV
from .types import Component as _Component
new_classes: set[str] = set()
cumulative_classes: set[str] = set()
if registry_loaded():
@@ -411,10 +409,8 @@ def sx_response(source_or_component: str, status: int = 200,
# Include pre-computed helper classes (menu bars, admin nav, etc.)
new_classes.update(HELPER_CSS_CLASSES)
if comp_defs:
# Use pre-computed classes for components being sent
for key, val in _COMPONENT_ENV.items():
if isinstance(val, _Component) and val.css_classes:
new_classes.update(val.css_classes)
# Scan only the component definitions actually being sent
new_classes.update(scan_classes_from_sx(comp_defs))
# Resolve known classes from SX-Css header (hash or full list)
known_classes: set[str] = set()