feat(tree-list): configurable & themeable guide lines (guideStyle prop + astryx-tree-list-guide target)#4309
feat(tree-list): configurable & themeable guide lines (guideStyle prop + astryx-tree-list-guide target)#4309freddymeta wants to merge 1 commit into
Conversation
Add a public `guideStyle` prop ('segments' | 'none', default 'segments')
to control the hierarchy guide (connector) lines, and a dedicated
`astryx-tree-list-guide` theme target on the connector line element.
Consumers can now hide the guides ('none') or recolor them through
`defineTheme` — without hiding the built-in connectors and reimplementing
them with unlayered CSS. Defaults are byte-identical to before.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsTreeList · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
cixzhang
left a comment
There was a problem hiding this comment.
Thanks for this — the astryx-tree-list-guide theme target itself is great and follows the convention cleanly: the themeProps('tree-list-guide') call sites on the connector elements are recorded in TreeList.doc.mjs theming.targets (both docs and docsZh), with test + story + changeset. That part is welcome.
The blocker is scope: this PR also introduces new public API surface — the guideStyle?: TreeListGuideStyle prop on TreeListProps, plus a new exported TreeListGuideStyle type (from index.ts and TreeList.tsx) and the new type in TreeListTypes.ts. New public props/exports need to go through the API design review process rather than land via a lightweight theme-parity merge — a new prop is a long-term compatibility commitment and deserves that review (naming, value set, whether 'none' vs. a boolean, interaction with theming, etc.).
Could you split this into two PRs?
- Keep the
astryx-tree-list-guidetheme target here (target + call sites + doc entry + test + story + changeset) — that can merge on the theme-parity path. - Pull the
guideStyleprop +TreeListGuideStyletype into a separate PR that goes through the API/spec review.
Requesting changes to split out the prop; the theme-target half is good to go once separated.
Summary
TreeListdraws its hierarchy guide (connector) lines as per-row verticalsegments, with the guide color hardcoded to a token baked into StyleX. Today
consumers who want to hide those connectors — or recolor them per theme — have
no supported path: they have to hide the built-in guides and reimplement their
own with unlayered CSS, which fights the cascade and drifts from the system.
This PR makes the guides configurable and themeable, additively and with
defaults unchanged:
guideStyleprop —'segments' | 'none', default'segments'.'segments'is the current behavior (byte-identical).'none'omits theconnector lines entirely, for layouts that already convey nesting or themes
that supply their own connectors. Threaded through
TreeList → TreeListItem → TreeListBranchesthe same waydensityalreadyflows.
astryx-tree-list-guidetheme target — the connector line elementnow carries a stable theme target (via
themeProps), so a theme can recolorthe guides through
defineTheme(components['tree-list-guide']) instead ofreaching them through internal StyleX classes. Mirrors the existing
astryx-tree-list/astryx-tree-list-itemtargets.Why
The guide color being hardcoded (not overridable per theme), plus there being
no way to turn guides off, forces consumers into the exact anti-pattern the
theming model is meant to prevent: hiding a built-in element and re-drawing it
with raw CSS. A prop + a stable theme target keeps guide customization inside
the system.
What's in scope
TreeList/TreeListItem/TreeListBranches: prop type + threading +guide rendering + theme target
TreeList.test.tsx: default'segments'unchanged,'none'hides guides,the new target renders, and a
defineThemeoverride reaches itTreeList.doc.mjs: documents theguideStyleprop and addsastryx-tree-list-guidetotheming.targets(EN + ZH)NoGuidesandThemedGuidesstoriesDeferred: a
'rail'guide styleA third
'rail'mode — one continuous rail per group instead of per-rowsegments — was considered but intentionally left out. It is a structural
rendering change (a rail spanning a whole group rather than independent
per-row segments) and carries real visual-regression risk against the current
segment layout. It fits better alongside the deeper TreeList layout work rather
than being forced into this additive, default-unchanged change. This PR keeps
the surface to
'segments' | 'none'plus the themeable color, which fullycovers the "hide or recolor" need.
Testing
@astryxdesign/coretest suite (TreeList + themingTargets guard)sync-exports --check,check-sync,check-changesets, token-docs--check