Repository navigation
feat(templates): add the Canvas Editor page template - #6237
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
TreeList takes rows as data, so nothing handed back the row's element. That blocks StyleX markers specifically: a marker's class is the only way to scope when.ancestor() to one row, so revealing an endContent action on its own row's hover had nothing to mark and had to mark the whole tree, which reveals every row's action at once. Item already accepts className for this, so the gap surfaced as a regression when converting a list to a tree. The class lands on the row box rather than the <li> — the boundary a consumer means by 'this row' — and merges last so it wins ties. Co-authored-by: Cursor <[email protected]>
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: 36 accessibility violation(s) found — 2 critical, 34 serious. Button pattern - 1 issue(s)
ChatComposer - 1 issue(s)
ChatComposerInput - 1 issue(s)
ChatReasoning - 1 issue(s)
ChatToolCalls - 1 issue(s)
Checkbox pattern - 1 issue(s)
CheckboxList - 1 issue(s)
ClickableCard - 1 issue(s)
CodeEditor - 1 issue(s)
CodeEditorPerf - 1 issue(s)
CodeEditorTheme - 1 issue(s)
CodeTheme - 1 issue(s)
DateRangeInput - 1 issue(s)
FileInput - 1 issue(s)
GridMasonry - 1 issue(s)
Heading - 1 issue(s)
Icon - 1 issue(s)
LogStream - 1 issue(s)
MediaTheme Auto - 1 issue(s)
PowerSearch - 1 issue(s)
ProgressBar - 1 issue(s)
Radio group pattern - 1 issue(s)
RadioList - 1 issue(s)
RichTextEditor - 2 issue(s)
SelectableCard - 1 issue(s)
Stepper - 1 issue(s)
TableGroupedRows - 1 issue(s)
TableTree - 1 issue(s)
Text - 1 issue(s)
Theme - 1 issue(s)
PopArt - 1 issue(s)
Thumbnail - 1 issue(s)
Timestamp - 1 issue(s)
Token - 1 issue(s)
Tokenizer - 1 issue(s)
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
44 templates reference /template-assets/*, which only the docsite's public dir serves. The viewer had no publicDir, so every one of those previews rendered a broken image. Point it at the docsite's public dir so a preview here matches what the docsite shows. Co-authored-by: Cursor <[email protected]>
A layered-artboard workspace, staged hidden: a layer rail and asset library on the left, the artboard centered on a muted backdrop under a floating tool pill that sets zoom, and a property inspector on the right whose fields retarget to the selected layer. It fills the gap next to Tools - Page Editor. That one composes a document; this one moves objects on a fixed 1080x1920 frame, where position and size are coordinates rather than an order. The artboard runs under its own defineTheme pinned to mode="light", so the poster keeps its palette when the editor goes dark. The theme carries what belongs to the poster as a whole -- face, leading, uppercase treatment, frame margins. Per-layer size and tracking stay on the layer, where the inspector edits them live. Zoom is a transform, not a re-layout: the artboard lays out once at native size and the frame scales the painted result, so the theme's numbers stay in artboard pixels and the poster does not reflow between zoom steps. Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
Text layers get colour, line height, alignment on both axes, slant, decoration, transform, a text shadow and a stroke; image layers get fit and the nine CSS filters, each on a paired number and slider. Border, Shadow and Fill stop being text fields and become swatch-triggered colour pickers, with the shadow's X/Y/Blur/Spread in the same popover. The picker is built from Popover and TextInput plus a painted saturation/value plane and hue rail, since neither exists as a component. Both carry role=slider, arrow keys and pointer capture. Row actions drop IconButton for bare icon buttons, which is what gets the layer rail from 36px to the 28px compact density asks for -- the smallest IconButton is 28px on its own and cannot fit inside it.
Slider exposes slider-track as a theming target, so the spectrum can be a defineTheme override on a real Slider instead of a div reimplementing drag, arrow keys and ARIA. Scoped under its own Theme so the nine filter sliders in the same panel keep a plain track. Only the saturation/value plane stays painted, since it is two axes at once and no slider is. Also captions the text layer's shadow row 'Shadow' to match its reference and fit the label column, while keeping 'Text shadow' and 'Box shadow' as the accessible names -- the section heading disambiguates the two visually, but not for a screen reader.
An action beside a field goes back to IconButton size=sm so its box ends level with the input's: clear, rotate, per-side, per-corner, and the colour swatch and image thumbnail, which take the same 28px square. Rows now read as one band instead of a field with something small floating next to it. Only an action nested inside a row stays small, because a 28px compact row has no space for a 28px button. That is the layer rail's lock, and RowIcon is renamed ItemAction to say so at the call site. Sliders stay 20px and centred -- a slider is a line to aim at, not a box to stack.
Left rail gutter drops to 8px so its rows read as a list; the inspector goes to 12px, carried by each section rather than by the panel so the rules between sections stay full-bleed -- padding the panel would inset every divider by the gutter. Swatches and the image thumbnail round to --radius-element, the token the inputs beside them use, rather than the tighter --radius-inner. At 28px next to a 28px field the two curves read as different families.
The rail was a flat List, which left the reader to infer from sort order that the two text layers belong together and the images belong together. A tree states it, and gives documents with more layers than fit a way to fold the groups away. Rows are supplied as data because TreeList owns the disclosure state, the guide lines and the roving focus a hand-rolled tree would reimplement. The trade is that no per-row element survives to carry a hover marker, so the marker moves to the rail and the locks reveal together on rail hover rather than one row at a time. Locked layers still show at rest, so the state stays visible even when the affordance is not. Co-authored-by: Cursor <[email protected]>
The trailing zoom control is a ghost, so edge compensation pulled it out to the card's edge to optically align its label. That is right when the control is alone in a container; here it left the bar with 8px on the leading end and nothing on the trailing one. The step goes back on a wrapper rather than the control's own xstyle: Selector forwards xstyle to an inner node, so a margin set there leaves the field where it was. Co-authored-by: Cursor <[email protected]>
The Edit row's thumbnail looked like a control and did nothing. It now opens a native image picker. FileInput is the obvious component and is not usable here: it is fixed at the medium element height, and this inspector holds a 28px rhythm the row would break. The picker is driven from the thumbnail instead, with the file input hidden in the DOM rather than unmounted so the button has something to open. Choosing a file names it in the adjacent field and stops there. A template has no upload endpoint to post to, and repainting the artboard from a local object URL would show something the template does not ship. Co-authored-by: Cursor <[email protected]>
The rail's locks all revealed at once because the hover marker sat on a wrapper around the tree; TreeListItemData.className now marks each row, so the selector scopes to the row being pointed at. Groups take the frame mark instead of repeating a child's glyph — a parent is a container, not another layer of that kind — which frees the tabs to carry a pen. Rail glyphs all resolve to the secondary icon token. It and its text counterpart agree at the theme root but diverge under this editor's theme, so the lock, keyed to the text ramp, rendered darker than the layer glyphs on its own row. Tabs dim icon and label together; dimming the label alone left the icon at full strength and read as half-active. Co-authored-by: Cursor <[email protected]>
Fading a control that still occupies its box costs the tab's name 20px permanently to hold room for something usually invisible. The close now collapses to zero width at rest and takes its 20px back on hover, so the space belongs to the name until the close is actually wanted. That needs a set tab width. With content sizing the label has nothing to shrink against, so revealing the close would push every tab to its right: the strip reflows under the pointer and the tab being reached for moves out from under it. Also swaps the per-side padding button to square-square, which reads as a box inside a box rather than as one more dashed outline among the axis inputs beside it. Co-authored-by: Cursor <[email protected]>
Separate tabs with a 16px vertical Divider, dropped either side of the open document — tabs are one width, so the rule marks a boundary rather than a midpoint, and the open tab already reads as separate by its fill. Hidden rather than unmounted so changing the selection does not add or remove a flex item and slide the strip under the pointer that just clicked it. Tabs take the file mark: a tab stands for an open file, and the frame mark belongs to the layer groups where it names an actual container. The strip's new-document + joins the rest of the chrome on the secondary icon token. The close reveal is instant. Easing a width reflows the label for the length of the animation, so the name wobbled every time the pointer crossed a tab. Widen the set tab width to hold the longest seeded name with its close showing, since the open document never hides one. Swap the hand-rolled button-wrapping-an-img in the image row for Thumbnail, which already carries the button semantics, hover overlay, accessible name and radius it was re-deriving. It ships at 64px for media grids, so it takes a width override to join a row of 28px controls. Co-authored-by: Cursor <[email protected]>
A tab sits at its widest and gives ground as documents are added or the window narrows, spending the label's slack before truncating and stopping at a floor so a crowded strip scrolls rather than grinding every tab to a sliver. The ceiling has to be width and not flex-basis: a basis does not raise an item's max-content contribution, so the strip sized itself to the tabs' content and then squeezed them back under their own basis, leaving every tab short with the bar half empty. The strip caps itself too. It sits in Toolbar's start slot, and that is not the slot built to give way — only the centre slot carries min-width: 0, so a start slot grows to its content and pushes the bar wider. Widening the start slot in core would change every toolbar to suit one page, so the cap is local, measured in cqw against the header. The new-document button moved out of the strip: it is not one of the open documents the group is named for, and inside a scrolling strip it would be the first thing to scroll out of reach. Both side panels fold below a width rather than being switched off, so the View menu's toggles keep recording intent and a panel that vanished for room returns when the window grows. The inspector goes first, the rail later, and each resize handle folds with its panel. Tabs also separate with a 16px rule, dropped either side of the open tab and hidden rather than unmounted so changing selection does not slide the strip. Co-authored-by: Cursor <[email protected]>
|
@ernestt this looks great - is it going to get merged? |
# Conflicts: # apps/template-viewer/package.json
Reuse the template theme for the hue track, adopt the shared container reveal primitive for row actions, and complete TreeList per-item styling support. Normalize both Changesets with the pull request reference and owner attribution.
TreeListItemData accepts xstyle, style, and className; all three compose on the Item row box in the precedence the TreeList contract records (component styles, then xstyle, then className, then inline style, merged after the private indent custom property). Completes FR5 of the TreeList component contract, which requires all three mechanisms on the same row rather than className alone.
# Conflicts: # .changeset/tree-list-item-classname.md
A table reflow in the DialogHeader module contract and a trailing blank line in the TextInput tests rode along with an earlier merge. Neither belongs to this template, and the branch should touch no packages/core file.
|
Restructured against the TreeList contract that landed in #6406.
Verified on the merged branch: core and neutral-theme builds, CLI strict and template-doc typechecks, and the docsite template-preview coverage test all pass. On #6238: 85 TreeList tests, core typecheck, Still open here, unchanged: the inspector controls that update state the artboard does not read. |
There was a problem hiding this comment.
Requesting changes for one material issue: the inspector exposes editable layer controls whose values never reach the artboard. I reviewed exact head 411cc6a9a57237817ab64537aa0a1b5a072dd935; focused TreeList tests (85/85), the generated docsite preview test, builds, typechecks, and formatting pass. The supplied exact-head light/dark screenshots render the editor, but the state-to-render binding is incomplete as noted inline.
| icon={GLYPH.x} | ||
| label="Horizontal position" | ||
| value={selected.x} | ||
| onChange={next => updateSelected({x: next})} |
There was a problem hiding this comment.
Make the geometry and appearance controls affect the selected artboard layer (or remove them from this slice). This handler updates selected.x, but the artboard render above never reads x, y, width, height, padding, radius, border, fill, box shadow, or rotation; image fit and text family/weight are likewise stored but unused. In the normal editor flow, a person can change these apparently functional controls and see no visual change, so the template does not deliver its core fixed-coordinate inspector workflow. Please wire the supported controls into rendering and add an interaction test that changes one of these values and verifies the artboard output.
not intended to be functional
What
A layered-artboard workspace — the design-tool pattern the gallery did not have.
Tools - Canvas Editoris a new category besideTools - Page Editor.The distinction from Page Editor is the line the description ends on. That one composes a document: a palette of blocks dropped into a flow that reflows around them. This one moves objects on a fixed 1080×1920 frame, where position and size are coordinates rather than an order — so the inspector reads X/Y/W/H, moving one layer never moves another, and the canvas needs a zoom control at all.
A File/Edit/View/Object/Help menubar and document tabs head it; a layer rail and asset library sit on the left, the artboard is centered on a muted backdrop under a floating tool bar that sets zoom, and the property inspector is on the right. Both rails drag to resize.
The parts worth looking at
The inspector is the substance of it. A text layer gets font, weight, colour, size, line height, letter spacing, horizontal and vertical alignment, slant, decoration, transform, a text shadow and a stroke; an image layer gets fit and the nine CSS filters, each on a number and a rail that move together. Everything that can reach the artboard does — typing in Transform recases the poster, dragging Sepia tints the photograph.
The artboard is themed, not styled. It runs under its own
defineThemepinned tomode="light", so the poster keeps its palette when the editor goes dark. A poster is artwork — it should not invert because the tool around it did. That is the dark shot in the details below: chrome flips, artboard does not.Document tabs are
Items, not a hand-rolled strip.TabListis the obvious reach and it does not fit: its label lives in internallabelText/labelSizerspans withwhiteSpace: nowrapand notext-overflowanywhere in the directory, so a tab cannot truncate — and document names have to. Its selected state is an internal 2px accent underline span with no prop to suppress it, and a document tab is a filled pill.Itemgives all of it: truncation, a fill, 28px atdensity="compact", an icon slot and a close inendContent.Two things needed care.
Item's 8px gap and symmetric padding left 96px for a label that wants 102, so the active tab truncated to "Salzburg pos…" — a 6px gap and a tightened end padding buy the 8px back. AndisSelectedpaints--color-accent-muted, which in dark mode islight-dark(#f1f1f1, #262626)— the samergb(38,38,38)as the header bar behind it, so the active tab vanished. It takes--color-background-mutedthroughxstyleinstead, which merges afterItem's own styles.A nested row action is a real
IconButton. It was a hand-rolled 20pxbuttonbecause the element scale stops at 28px and a control the row's own height would push a 28px row to 36. Asize="sm"IconButtonpulled in by the row's padding step on every edge —margin: calc(-1 * var(--spacing-1))— lays out as 20px while staying 28px to the pointer. The glyph does not move: it stays 18px in from the row's right edge, measured before and after.No tooltip on these. A bubble opening off a 28px row covers the row above it, and a padlock and an × already say what they do;
labelstill names them for assistive tech.The top bar is a
LayoutHeader, not aToolbar. It reads like a toolbar and it is not one. A toolbar is a set of peer commands that arrow keys walk across, and the document tabs break that twice: arrowing off a tab landed on that tab's own close button (Brand sheet → Close Brand sheet → Untitled draft), and a strip of open documents is not a band of tools in the first place.It fought the padding too. A toolbar sizes its gutters for a band heading content, and app chrome wants to sit tighter — which took a
--astryx-section-padding-inlineoverride plus a newpaddingBlockprop onToolbarto keep the ghost-trigger edge compensation honest.LayoutHeaderis the component for the slot this already sat in, andpadding={1}settles all of it: 4px on every edge puts the menu button's box exactly where the ghost inset used to pull it, so the glyph lands on the same pixel with nothing pulled back out.Measured identical before and after — 45px bar, 18px glyph centre, 34px strip origin, same 1px divider — minus a
rolethat was describing the wrong thing. This removed theToolbarcore change entirely;Toolbar.tsxis byte-identical tomainagain. The floating canvas tool bar stays aToolbar, because that one really is a row of peer commands, and it still rovesUndo → Redo → Add frame.One honest note: arrow keys in the tab strip now do nothing rather than doing the wrong thing.
Tabmoves between tabs, which is what a group of buttons should do. Making the strip a true arrow-navigabletablistis a separate change —TabListitself can't take it, for the reasons above.One widget is hand-rolled, and it is the colour picker. A saturation/value plane, a hue rail and a hex field. The hue rail is a real themed
Slider; the plane is not, and cannot be — there is no two-axis picker in core, and nothing composes into one. Four of this template's seven raw tags are this widget, and it is the single largest thing standing between the score below and an A. It stays hand-rolled deliberately: the lab→core loop is longer than this template's runway.Remaining states — dark, layer rail, menubar
Stacked on #6238
This PR contains no
packages/corechanges, and its base branch is #6238 rather thanmain, so GitHub computes the diff against that branch and the eleven files below are template, CLI, docsite and tooling only. Merge #6238 first and this retargets tomainon its own.#6238 is the one core change the template needs:
TreeListItemDatagainsxstyle,className, andstyleon the row box, which is what letsuseContainerRevealscope the layer rail's per-row action to a single row instead of the whole tree. It implements FR5 of the now-current TreeList contract.Two earlier core changes on this branch are gone rather than split out: a
paddingBlockprop onToolbar(see the header section below for why it stopped being necessary), and a hand-rolledstylex.defaultMarker()reveal, replaced byuseContainerReveal.Rubric score: 87/100 (B)
Self-assessed. The ledger fetches its rubric from the wiki and I could not reach it from here, so this is scored against the seven categories and weights in
scripts/template-score-ledger.mjs, calibrated by measuring all 54 page templates on the same axes. Worth a maintainer's check rather than taking at face value.Icon; one custom SVG factoryLayoutroot,LayoutPanel/Content/Footer,Resizable,Section,Toolbar/template-assets,AspectRatiofor the artboard,Thumbnailfor the pickertsc --noEmitandeslintboth cleanWhere the 13 points go:
The 7 raw tags (−6). Four are the colour picker above. One is the
<img>insideAspectRatio, which is that component's documented child rather than a workaround. One is ahiddenfile input that never renders — Astryx'sFileInputis fixed at the medium element height and this row is on the 28px rhythm, so the picker is driven from theThumbnailand the input just sits there to be opened. One is the SVG below. Only 20 of 54 templates carry any raw tag at all, so this is a real deduction and not a rounding error; it is also concentrated in one missing primitive.The custom SVG (−2).
glyph()draws letterforms — X, Y, W, H — on the same 24px grid Lucide uses, for the start-icon slot of the geometry fields. A design tool names a numeric field from inside it so the row reads as one control, and Lucide ships no letterforms. They inheritcurrentColorand the slot's sizing, so a letter and an icon are interchangeable in the same position.The CSS (−5). 69 declarations over 2,935 lines is 2.4 per 100, against a median of 0 — second only to
table-filter. It is mostly the price of the artboard: a zoomable, pannable plane and a scaled frame are geometry no layout prop expresses. Of the 69, 15 go throughvar(--…)and the rest are structural (display,position,overflow,flex). Only four are literal values, and three of them are the colour-picker thumb — a white ring with a dark halo that has to read against any hue the user picks, so a theme token would be the wrong answer there, not the right one.A two-axis colour picker in core takes this to roughly 95.
Test plan
pnpm -F @astryxdesign/cli typecheck— clean.[role=toolbar]count on the page drops from 2 to 1.eslinton the template — clean.check:*scripts) — clean on every commit.astryx template --listshows the new name and description, with no(WIP)marker.Made with Cursor