astryx icon indicating copy to clipboard operation
astryx copied to clipboard

Templates need an XDS primitive for dynamic/runtime pixel sizing (resizable panels)

Open ernestt opened this issue 5 months ago • 0 comments

Problem

Page templates that use useResizable (e.g. the IDE template) must drop to a raw <div style={{ height: ... }}> to apply the hook's runtime pixel size, because no XDS layout primitive accepts a dynamic, runtime-updated pixel dimension.

Example — packages/cli/templates/pages/ide/page.tsx (resizable terminal panel):

{!bottomPanel.isCollapsed && (
  <div
    style={{
      height: bottomPanel.size, // runtime px value from useResizable, updates on every drag
      flexShrink: 0,
      overflow: 'hidden',
    }}>
    {/* ...terminal content... */}
  </div>
)}

XDSStack / XDSStackItem only accept design-token sizing, and XDSLayoutPanel width/size isn't wired to a per-render dynamic value in the content flow. So this raw <div> is currently an unavoidable exception.

Why it matters

The Template Grading Rubric counts raw HTML against XDS Component Purity. Resizable multi-pane templates are forced to take a purity hit (or document a "necessary" raw element) purely for dynamic sizing.

Proposed fix

Provide a first-class way to apply a runtime pixel size without raw HTML, e.g. one of:

  • A polymorphic sizing primitive (e.g. XDSBox / XDSStackItem accepting a runtime width/height number for px), or
  • Wire useResizable's size onto XDSLayoutPanel / a content-area wrapper so resizable panes in the content flow are XDS-native.

References

  • File: packages/cli/templates/pages/ide/page.tsx
  • PR: facebook/astryx#2985 (template hardening; this <div> is left as a documented necessary exception)

ernestt avatar Jun 23 '26 00:06 ernestt