Bring Canvas back as a panel, named for the component it draws on - #28
Merged
Conversation
Canvas was removed on the argument that FreeformArrangement already says what absolute placement is. It does not say the same thing: a FreeformArrangement arranges a layout *slot's* content with one variant per size class, while a Canvas places elements inside a single coordinate space in the element tree. They sit at different levels, and dropping the panel left the tree with nowhere for a free-placement design surface to land. The name is not a choice either - `@cratis/components` ships `Canvas`, and that is the surface a Cratis application actually draws one on. A designer placing components on a canvas and the model recording where they landed should not need two words for the same thing. The reason it could be dropped without anything noticing was real, though: the old Canvas declared no properties, so nothing could tell it from a plain Panel in a model that carries no discriminator. It now declares its `Extent` - the coordinate space a `Canvas.Left`/`Canvas.Top` pair is measured against - which is both a genuine canvas property and what `isCanvas` recognizes it by. `panelLayout` renders it: the canvas becomes the positioned ancestor its children are placed against, sized to its extent, and a child naming any of the four edges is placed absolutely. A child naming none stays in flow rather than being pinned to the origin. Verified: 5 .NET projects / 0 warnings / 111 specs, 931 JS specs (up from 923), lint and build clean, five Storybooks build. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EGM8pbSNm2nS8KoKCpKNui
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added
Canvasis back as a panel, and carries anExtent— the coordinate space a child'sCanvas.Left/Canvas.Toppair is measured against. It was dropped on the argument thatFreeformArrangementalready covers absolute placement, but the two sit at different levels: aFreeformArrangementarranges a layout slot's content with one variant per size class, while aCanvasplaces elements inside a single coordinate space in the element tree. Without the panel there was nowhere for a free-placement design surface to land.isCanvasrecognizes a canvas by its extent, the same way the other panel guards recognize theirs by the property each one alone declares. The oldCanvasdeclared no properties at all, which is why nothing could tell it from a plainPanel— and why it could be removed without anything noticing.Changed
Canvas.Left,Canvas.Top,Canvas.RightorCanvas.Bottomplaced absolutely. A child that names none stays in flow rather than being pinned to the origin.@cratis/components'Canvas, which is the surface a Cratis application actually draws one on, rather than introducing a second word for the same thing.