Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
bf540f8
wip layout
softmarshmallow Oct 19, 2025
e599792
chore
softmarshmallow Oct 19, 2025
b6501de
polygon node geo trait
softmarshmallow Oct 19, 2025
bf027a2
position and constraints type
softmarshmallow Oct 20, 2025
4cea5a1
default for LayoutConstraints
softmarshmallow Oct 20, 2025
0410ee3
layoutstyle
softmarshmallow Oct 20, 2025
817468a
chore - add `end` in main axis select
softmarshmallow Oct 22, 2025
bdb138c
flex align ui
softmarshmallow Oct 22, 2025
17fa7f7
ux: layout select
softmarshmallow Oct 22, 2025
c472a47
add layout wrap control
softmarshmallow Oct 24, 2025
eac1e41
each axis gap
softmarshmallow Oct 24, 2025
48f9e88
docs: wg/layout
softmarshmallow Oct 24, 2025
a7fdfbe
container layout
softmarshmallow Oct 24, 2025
741b66e
fix gap, default align content
softmarshmallow Oct 24, 2025
6f0e3df
wasm 0.0.80-canary.0 - flex layout
softmarshmallow Oct 24, 2025
c7abbc9
fix wrap align content
softmarshmallow Oct 26, 2025
baac8b9
chore: organize
softmarshmallow Oct 26, 2025
7dbc1d0
padding gesture
softmarshmallow Oct 26, 2025
f63c691
fix non uniform padding
softmarshmallow Oct 26, 2025
4682acc
padding mirroring
softmarshmallow Oct 26, 2025
41952f3
padding axis mirroring
softmarshmallow Oct 26, 2025
2ddade0
fix dq
softmarshmallow Oct 26, 2025
4c00c6d
chore
softmarshmallow Oct 26, 2025
bef9c6b
commands.reLayout
softmarshmallow Oct 26, 2025
0b80651
padding control
softmarshmallow Oct 26, 2025
1b56361
surface z stack
softmarshmallow Oct 26, 2025
852a019
event order
softmarshmallow Oct 26, 2025
651498f
wasm 0.0.80-canary.1 - padding
softmarshmallow Oct 26, 2025
067ab12
Add layout_child support for various node types and improve layout ha…
softmarshmallow Oct 26, 2025
e678d35
chore: prevent toggle off
softmarshmallow Oct 26, 2025
75352ee
wasm 0.0.80-canary.2 - layout child
softmarshmallow Oct 26, 2025
bbe94be
changelog
softmarshmallow Oct 26, 2025
bf5b309
chore
softmarshmallow Oct 26, 2025
8207f68
Refactor geometry handling in canvas: replace path_bounds function wi…
softmarshmallow Oct 26, 2025
38c5d05
Add layout_child support for Vector and SVGPath nodes, enhance layout…
softmarshmallow Oct 26, 2025
16620e4
fix io
softmarshmallow Oct 27, 2025
4c00e64
chore
softmarshmallow Oct 27, 2025
86ce8f4
wasm 0.0.80-canary.3
softmarshmallow Oct 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/grida-canvas-wasm/lib/bin/grida-canvas-wasm.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions crates/grida-canvas-wasm/lib/bin/grida_canvas_wasm.wasm
Git LFS file not shown
2 changes: 1 addition & 1 deletion crates/grida-canvas-wasm/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@grida/canvas-wasm",
"description": "WASM bindings for Grida Canvas",
"version": "0.0.79",
"version": "0.0.80-canary.3",
"keywords": [
"grida",
"canvas",
Expand Down
28 changes: 28 additions & 0 deletions crates/grida-canvas/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,34 @@ cargo build
cargo run --example <example-name>
```

## Tools

### `tool_io_grida` - Grida File Validator

A CLI tool for validating `.grida` files and debugging parsing issues.

**Usage:**

```sh
cargo run --example tool_io_grida <path-to-grida-file>
```

**Features:**

- Validates `.grida` file structure and parses all nodes
- Reports total node count, scene references, and entry scene
- Provides node type breakdown (container, text, image, etc.)
- Detects parsing errors with detailed error messages
- Handles legacy file formats gracefully (missing fields, typos, etc.)

**Example:**

```sh
cargo run --example tool_io_grida ../../editor/public/examples/canvas/instagram-post-01.grida
```

See [examples/tool_io_grida.rs](./examples/tool_io_grida.rs) for full documentation.

## Package Docs

```sh
Expand Down
18 changes: 18 additions & 0 deletions crates/grida-canvas/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@ All notable changes to the grida-canvas crate will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [0.0.0-local.2] - 2025-10-19

### Added

- **Infinite Canvas + Flex Layout**: Root nodes (artboards) can be positioned anywhere in the viewport while their children participate in flex layout
- **Universal Flex Layout Support**: All node types (Rectangle, Ellipse, Image, Text, etc.) can now participate in flex layout with `layout_positioning` and `layout_grow` properties
- **Figma Layout Import**: Automatically map Figma's `layoutPositioning` to internal layout properties for all node types
- **Root Node Positioning**: Containers and shapes now respect their x, y coordinates when used as root nodes (infinite canvas)
- **Flex Layout Stacking**: Children are now properly positioned horizontally/vertically instead of stacking at (0, 0)
- **Gap Stretching**: Vertical gap no longer incorrectly grows when parent container height increases
- **Wrap Alignment**: Center alignment now works correctly with flex wrapping enabled
- **Absolute Positioning**: Absolutely positioned children are correctly excluded from flex flow and positioned relative to parent
- **Fixed-size Elements**: Elements maintain their specified dimensions instead of automatically shrinking when overflowing (flex_shrink: 0.0 default)

### Changed

- **Non-uniform Padding**: Support for CSS-style padding with individual values per side (`paddingTop`, `paddingRight`, `paddingBottom`, `paddingLeft`)

## [0.0.0-local.1] - 2025-10-16

### Added
Expand Down
3 changes: 2 additions & 1 deletion crates/grida-canvas/benches/bench_rectangles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn create_rectangles(count: usize, with_effects: bool) -> Scene {

// Create rectangles
let rectangles: Vec<Node> = (0..count)
.map(|i| {
.map(|_i| {
Node::Rectangle(RectangleNodeRec {
active: true,
opacity: 1.0,
Expand Down Expand Up @@ -39,6 +39,7 @@ fn create_rectangles(count: usize, with_effects: bool) -> Scene {
} else {
LayerEffects::default()
},
layout_child: None,
})
})
.collect();
Expand Down
9 changes: 4 additions & 5 deletions crates/grida-canvas/examples/golden_container_stroke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ async fn scene() -> Scene {
let mut graph = SceneGraph::new();

let mut container = nf.create_container_node();
container.size = Size {
width: 400.0,
height: 400.0,
};
container.layout_dimensions.width = Some(400.0);
container.layout_dimensions.height = Some(400.0);
container.stroke_width = 10.0;
container.stroke_align = StrokeAlign::Outside;
container.strokes = Paints::new([Paint::from(CGColor(255, 0, 0, 255))]);
container.set_fill(Paint::from(CGColor(255, 255, 255, 255)));
// Center the container in the 800x800 canvas
container.transform = AffineTransform::new(200.0, 200.0, 0.0);
container.position = CGPoint::new(200.0, 200.0).into();
container.rotation = 0.0;

// Create a circle that will overlap with the container's stroke
let mut circle = nf.create_ellipse_node();
Expand Down
Loading