Commit Graph
98 Commits
Author SHA1 Message Date
bflatastic 2161144dad Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	ROADMAP.md
2026-11-28 15:06:05 +07:00
FredApps bc9c97c7d2 Merge branch 'main' into uno/U1-01-layer-code 2026-11-28 08:11:36 +01:00
FredApps a7486a5dce Merge branch 'main' into feat/shift-a-defaults 2026-11-28 08:11:35 +01:00
FredApps 9562640d75 Merge branch 'main' into uno/U1-01-layer-code 2026-11-28 07:40:32 +01:00
FredApps 784b6e6e69 Merge branch 'main' into feat/shift-a-defaults 2026-11-28 07:38:41 +01:00
FredApps 4caba4a7d3 Merge branch 'main' into pr/visual-compare 2026-11-28 07:26:27 +01:00
bflatastic e07c9944eb M4: superscript and subscript per range of characters (text.style textPosition, Type settings while editing, text styles, CSS) (#2338) 2026-11-28 08:06:10 +07:00
bflatastic 38ee5533a9 Merge remote-tracking branch 'origin/main' into HEAD 2026-11-28 02:47:01 +07:00
B-uchi 92a82a5fda M8: visual compare draws only the frame's area and blames the layer a difference shows through
- The design was drawn over its export area, which takes in strokes, effects and layers past an
  edge that doesn't clip, then fitted to the frame's grid, so it shifted against the capture. It
  is now drawn over the frame's own rectangle (`render_area`), as the capture holds it.
- Every grid is sized from the compared scale itself, never rebuilt from a rounded overlap: a
  capture a few pixels across can't make the frame's grid enormous. The scale has no floor, so a
  gigantic frame gets a coarser grid instead of a bigger one.
- A layer claimed every pixel of its box, so the see-through corners of an ellipse over a changed
  rectangle took the rectangle's difference. A layer with an unclaimed difference now claims only
  the pixels it draws on, from its own drawing at the compared scale, up to 300 layers; past that
  a layer is matched by its box and the result says how many (`truncated.matchedByBox`).
2026-11-27 13:47:28 +01:00
B-uchi f4b6e0d885 M8: visual compare refuses a layer that isn't a frame, component or instance
`inspect.compare` checked only how many targets it had and that the target had a size, so with a
rectangle selected it compared the page against the rectangle, used the rectangle as the viewport,
and returned a result that looked like a real answer. A page is built from a frame, a component or
an instance of one: any other layer, named outright or selected, is now refused before the capture
is read, with what it is and what to pick. The command's and the tool's descriptions and the docs
say so.
2026-11-27 13:19:44 +01:00
B-uchi d53d02b7cd M8: an agent can compare a capture of the page it built with the frame
An agent building a page can't see whether it matches the design. `inspect.compare` and the MCP
tool `compare_design` take a capture the agent's own browser tools made and compare it with a
frame, on this computer. A browser's text and antialiasing never match pixel for pixel, so the
answer isn't one score: it is the layers that differ, each on the deepest layer it belongs to and
largest first, as a position difference (with its offset), a colour difference (expected and
actual) or a content difference. Text is held to twice the tolerance. A capture at 2x is the same
design: the frame's width sets the density.

Explicit targets are validated, and one frame is compared at a time. Parameters of the wrong type
are refused, and so are a path and data together. The capture is size-checked before it is
decoded, the comparison scale is bounded by the larger of the frame and the capture, the layer walk
is iterative and capped (`truncated` says so), and only the 100 differences listed are searched
for a move.
2026-11-27 12:10:51 +01:00
bflatastic 0f8f278c65 M10: SwiftUI, Compose and Flutter code export keeps image fills in paint order
Image fills were dropped by the native targets, so a photo under a colour overlay vanished (#2271). Each image fill is now written in its paint-order place as the asset file.exportAssets hands over, named by the same content hash, fitted by its scale mode with its opacity. A pattern fill is left out with a comment line.
2026-11-27 17:45:47 +07:00
bflatastic d61e0d6978 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	ROADMAP.md
#	crates/engine/src/lib.rs
2026-11-27 15:27:12 +07:00
bflatastic 522c55e62f Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	crates/engine/src/design_context_tests.rs
#	crates/ui-egui/src/panels/dev_mode.rs
#	docs/dev-mode-parity.md
2026-11-27 14:39:13 +07:00
bflatastic f6f5902842 Dev mode: the stroke-overflow codegen test measures the stroke as drawn 2026-11-27 14:32:52 +07:00
BFlat 91501b2be7 Merge pull request #2466 from B-uchi/pr/code-connect-agents
M8: Code Connect for agents
2026-11-27 14:30:09 +07:00
BFlat c7a88c6d65 Merge pull request #2622 from Ap3pp3rs94/fix/vector-code-assets
fix(dev): use SVG assets for vector code
2026-11-27 14:17:15 +07:00
bflatastic e309dee7d4 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	crates/mcp/src/tools.rs
#	docs/mcp.md
2026-11-27 13:57:58 +07:00
bflatastic 17adfae82d Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	ROADMAP.md
#	crates/engine/src/cmd.rs
2026-11-27 13:57:00 +07:00
ATOM 777ccdcc24 fix(dev): preserve vector asset bounds 2026-11-25 09:38:41 -06:00
ATOM 91de53c586 fix(dev): embed node-local vector assets 2026-11-25 01:30:37 -06:00
ATOM ab7c0e2225 fix(dev): align vector asset references 2026-11-24 23:35:42 -06:00
ATOM 26b25644cf fix(dev): use SVG assets for vector code 2026-11-24 21:54:38 -06:00
B-uchi f8bc54cd44 M8: screen sizes join the design context and read only what is a mark
- `inspect.designContext` returns the target's responsive context under `responsive`, and names
  the missing breakpoints only when nothing was stated.
- `responsive.set` marks frames and sections only, as the Inspect section shows; a component or
  instance is refused. `group: null` goes back to the frame's name, and emptying the field in the
  Inspect tab sends it.
- A stored viewport that isn't mobile, tablet or desktop is ignored, and an empty or over-long
  group reads as none (`node.set {pluginData}` can write anything there).
- The walk for rules counts each layer once and stops at its cap without collecting a whole
  subtree first, so overlapping targets don't use it up; `near` is searched by binary search.
- `responsive.rule` refuses a page before making the category, as `annotation.add` does.
- Developer Mode makes responsive edits, like its annotations (`dev_mode_allows`).
- The Inspect tab keeps a rule's draft per document and keeps it when the rule is refused.
- Status line, row and revision row in docs/dev-mode-parity.md.
2026-11-19 03:07:40 +01:00
B-uchi a61c2b33f6 M8: a frame can say which screen size it is and carry rules for other sizes
A design file has no breakpoints, so an agent implementing a frame can only guess how it should
respond. The designer can now say it outright: `responsive.set` marks frames as the mobile, tablet
or desktop version of a design (layer data, so the file format is unchanged), and
`responsive.rule` adds a note to the Responsive annotation category, made if the file lacks it.
`responsive.list` returns what was stated about the given layers, the layers above them and those
inside them, and never infers anything from names or sizes. The Inspect tab gets a Screen sizes
section for frames.

Explicit targets are checked rather than falling back to the selection, a rule keeps to the
limits `annotation.add` has (note length, annotations per layer, number of categories), and the
result says `truncated` when there were too many layers to read every rule.
2026-11-19 02:28:40 +01:00
B-uchi d243347fd0 M8: Code Connect keeps a connect file it can't read, and maps values as it checks them
- Export refuses to write over a connect file it can't read (not JSON, not an object, or over
  4 MB) instead of replacing it with this design's links alone.
- Import skips an entry whose `values` is malformed, with a warning, instead of replacing the
  component's link with one that maps nothing.
- `{Property ? "a" : "b"}` reads the design's value, so mapping Off to `inactive` doesn't make the
  condition true.
- A `values` key that is only a parameter name (`state` for State) is reported as unknown, since
  the mapping is read by property name and it would do nothing.
2026-11-19 01:54:56 +01:00
B-uchi dbccabce41 M8: design context gives Code Connect links as the connect file does
`inspect.designContext` wrote a component's links through `camel`, which renames keys at every
depth, so a mapped design value such as `extra_large` came out as `extraLarge`. Its components and
the code it gives each connected layer now use Code Connect's own link JSON: value names stay as
written, and the code carries the link's `source` and `notes`. Export also sorts its links once,
after merging the file's other links.
2026-11-19 01:54:50 +01:00
B-uchi d23c8b6456 M8: Code Connect for agents
A link can say where the code component lives (`source`, a path inside the
repository), what a property's design values are called in code (`values`:
{"State": {"Hover": "hovered"}} renders `hovered`; a value without an entry
keeps its design name) and `notes`, through codeConnect.set, the connect file
and Inspect ▸ Connect to code (a Source file field and a row per variant
value). The fields are skipped when empty, so existing files and exports don't
change.

codeConnect.list and the MCP tool component_mappings say which code
component each design component is: import line, name, ready snippet,
properties and variants, and with a repository root whether each source file
is there. sync_mappings imports or exports a repository's connect file.
codeConnect.export {path} keeps the file's other top-level keys and the links
of components this design doesn't have, so several designs can share one file.
2026-11-19 01:39:29 +01:00
B-uchi bfe9a42678 M8: asset handoff reports an image rotation as it is drawn, and reads targets with req_targets
From review: `ImagePaint::rotation` is unbounded, so `rotation * 90` could
overflow and reported 4 quarter turns as 360 and -1 as -90. The renderer draws
`rotation.rem_euclid(4)` quarter turns; the adjustment now reports that, and
none for whole turns. A regression test covers 4, -1, 1, a very large value
and i32::MIN. Targets go through params::req_targets like other commands,
keeping the whole page when nothing is named or selected.
2026-11-19 01:13:51 +01:00
B-uchi 0042cba629 M8: asset handoff refuses a malformed target instead of reading the selection 2026-11-19 01:13:51 +01:00
B-uchi d09c82010d M8: asset handoff for code projects
file.exportAssets and the MCP tool export_assets write a design's images and
vectors into a folder: images as the bytes the file holds, never re-encoded,
vectors through the SVG export, and layers with export settings by those
settings. Each file says whether it is original, vector or rendered. Files are
named by the first 16 hex digits of their SHA-256, so one asset has one file
used by every layer listed and exporting again writes nothing. What a layer
does to an image that isn't in its bytes (filters, crop, rotation, opacity) is
listed, as is why an asset couldn't be handed over. Writes go through
file_access, so automation roots confine them.
2026-11-19 01:13:51 +01:00
B-uchi 8dffbf87a1 M8: design context keeps its assets to the layers returned and says when a join stops
From review: the asset list follows the layers placed in the tree, so a
smaller tree (maxNodes, or the MCP tool's retry for maxBytes) means a smaller
list, and `truncated.assetsLeftOut` counts the rest; following aliases reports
`truncated.variables` when it stops at its budget with variables still to
read; and a font is checked with figcraft_text::has_family by its trimmed name,
as the missing-fonts list does, so a family stored with outer spaces isn't
taken for installed. A regression test for each fails without its fix.
2026-11-18 20:59:19 +01:00
B-uchi ae592a0d71 M8: design context joins aliased and style-bound variables, and reads only valid targets
From review: the variables a style binds and those an alias or colour
calculation reads are joined too, followed to any depth; fonts come from the
text layers placed in the tree, so a second target's font isn't lost to a
separate walk's budget; and a malformed `id` or `ids` entry is an error
instead of reading the selection or dropping the entry. A regression test for
each fails without its fix.
2026-11-18 20:37:44 +01:00
B-uchi 2d4309c9aa M8: design context for AI agents
inspect.designContext and the MCP tool design_context read the selection (or
ids, or a scope) in one call. Each layer keeps apart the values the designer
set (explicit), those layout or the file worked out (derived) and those with no
direct CSS equivalent (unsupported, with the reason). The variables (every
mode's stored and resolved value), styles, components, fonts and assets the
tree uses are joined once, and `missing` says what the design doesn't specify.
A connected instance gives its code snippet instead of its layers. Large trees
are capped and say so, and the MCP tool asks for fewer layers until the result
fits the client.
2026-11-18 20:37:44 +01:00
NetterSilverandClaude Haiku 5.5 5897a41a7f Clip text gradient fills to the glyphs in inspect.code
Fixes #2429

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 17:21:26 +00:00
Andrej Skvorc d0457d5f07 M6: Uno auto layout: the exported frame hugs where it hugs, and a clip only on a fixed frame
An auto layout frame that is the exported layer kept the size it has in the design, so content that grows (a longer text, a larger gap) was cut off or left space. It now hugs on the axes where it hugs, as FigCraft lays it out. A clip is a fixed rectangle, so it is written only on a frame fixed on both axes; one that hugs or fills gets a note instead.
2026-11-16 20:53:54 +01:00
Andrej Skvorc b141a42983 M6: Uno vectors: a path longer than one literal is an image
Path data longer than the 10,000 characters a C# literal is cut at would lose its last commands, so such an outline now falls back to the PNG asset like one with too many elements. Found in review.
2026-11-16 13:10:26 +01:00
Andrej Skvorc 395392f3ab M6: Uno text: tight line heights with BlockLineHeight
A line height below the font's natural height keeps LineHeight as written and
adds LineStackingStrategy.BlockLineHeight, which Uno draws as FigCraft does
(the lines overlap). No padding or margin shift; a looser line height keeps
the half-leading shift. Docs updated.
2026-11-16 13:10:26 +01:00
Andrej Skvorc 7e28fb9efc M6: Uno code: layer names as anchor comments
Every layer's name is the last comment line directly above the statement that
creates its outermost element, below any warning line, so a plugin that
post-processes the code can pair elements with layers. Not-mapped notes stay
in the chain below the constructor. Hidden layers and slices write nothing.
2026-11-16 13:10:26 +01:00
Andrej Skvorc fe7b9d0495 M6: Uno vectors as Path and docs for the layer code card
Vectors, booleans and shapes are a Microsoft.UI.Xaml.Shapes.Path with path
data from the node's outline (F1 non-zero, F0 even-odd, at most 5,000
elements), one solid fill and one solid stroke; stroke inside or outside is a
note. Gradients, several paints, effects and over-cap outlines fall back to a
PNG Image. Docs: parity, MCP, gaps, ROADMAP.
2026-11-16 13:10:26 +01:00
Andrej Skvorc 7429df2c13 M6: Uno text: half-leading for explicit line heights
An explicit line height puts half the leading above the first line in
FigCraft and all of it below in Uno. Text moves down by
h = (L - (ascent + descent) / upem * size) / 2 from the face FigCraft draws
with: a top padding with a negative bottom margin in a panel (merged with an
independent child's margin), the offset in a Canvas. A line height below the
font's natural height and a family that is not installed are notes.
2026-11-16 13:10:26 +01:00
Andrej Skvorc 9217f27cd8 M6: Uno auto layout: grid mode and wrap note
A frame with grid auto layout is a WinUI Grid: column and row definitions
(pixels, Auto, whole-number stars), column and row spacing, padding less the
stroke weight, and each child in the cell FigCraft's layout gives it, with
spans and the alignment in the cell. Fractional stars are scaled to whole
numbers or rounded with a note, at most 64 tracks per axis are written, and a
wrapping layout is one line with a note.
2026-11-16 13:10:26 +01:00
Andrej Skvorc 457a7bec60 M6: Uno auto layout: sizing, absolute children, z-order
A child sizes per axis in its AutoLayout parent: fixed writes the length,
hug writes none, fill stretches with the attached AutoLayout call; min and
max lengths go on the child. Text hugs (one line), fills (wraps) or is
fixed. A child that ignores the layout is independent at its offset, and a
hugging parent with such a child is written at its size. reverse_z paints
with descending Canvas.ZIndex and keeps the order.
2026-11-16 13:10:26 +01:00
Andrej Skvorc 1c3924a978 M6: Uno code: add children with Children.Add and Child =
Fluent .Children(...) and .Child(...) double the load time with every level
of nesting. Each element is now a local with fluent property setters; its
children are added with Children.Add(x) or Child = x, and the view sets
Content = root. A test pins that no output has .Children( or .Child(.
2026-11-16 13:10:26 +01:00
Andrej Skvorc d63aa8a9b7 M6: Uno auto layout: AutoLayout panels
A frame with horizontal or vertical auto layout is a Toolkit AutoLayout that
takes the box itself: orientation, spacing, padding less the stroke weight,
primary and counter axis alignment, space between. Space around and evenly
and baseline alignment are notes. Frames without auto layout keep the
Canvas, with one warning per view that counts them.
2026-11-16 13:10:26 +01:00
Andrej Skvorc dcefb38707 M6: Uno C# Markup code target: frames, text and images 2026-11-16 13:10:25 +01:00
Andrej Skvorc 32967e849d M6: Uno C# Markup code target: wiring 2026-11-16 13:10:09 +01:00
Trevor BrownandClaude Sonnet 5.5 a55979ada1 Merge upstream/main into feat/shift-a-defaults
Keeps both sides' tests in al_behaviour_tests.rs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Model-Effort: Opus 5.5 drove; Opus 5.5 briefed; Sonnet 5.5 wrote at medium
2026-11-13 15:04:58 -05:00
bflatastic aef88e0197 Merge main into #2320 2026-11-13 23:39:40 +07:00
BFlat 1f7e6e0482 Merge pull request #2321 from TrevorBrown-dev/fix/flutter-space-distribution-spacing
M10: Flutter code writes no spacing beside a space distribution
2026-11-13 22:48:28 +07:00