Commit Graph
471 Commits
Author SHA1 Message Date
bflatastic 1c5f6f60d0 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	docs/ui-parity.md
2026-11-27 14:40:03 +07:00
bflatastic 8ed8860632 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	docs/components-parity.md
2026-11-27 14:39:29 +07:00
BFlat 075e5a21c8 Merge pull request #2613 from denisg0mes/paste-library-main-as-instance
M3: a main pasted from its library file into another file is an instance of it
2026-11-27 14:39:11 +07:00
bflatastic bb02b6ff09 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	docs/ui-parity.md
2026-11-27 14:38:04 +07:00
bflatastic 3590abc9ff Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	docs/ui-parity.md
2026-11-27 14:06:34 +07:00
bflatastic 010bb86c0b Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	docs/components-parity.md
2026-11-27 14:06:19 +07:00
bflatastic eddba16aae Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	docs/components-parity.md
2026-11-27 14:06:02 +07:00
bflatastic 0aaa19ac25 Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	docs/ui-parity.md
2026-11-27 14:05:10 +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
BFlat de547a0d0d Merge pull request #2446 from B-uchi/pr/asset-handoff
M8: asset handoff for code projects
2026-11-27 13:46:59 +07:00
FredApps 0622efe1e1 Merge main into mind maps UI (code blocks and mind map nodes both handled in board.addNext, colour and docs) 2026-11-26 21:01:37 +07:00
Denis Gomes 5a875417e7 M8: frames, sections and components land on whole pixels
Figma's help says they "always snap to the pixel grid, even if Snap to
pixel grid is disabled". In FigCraft they followed the setting like any
layer, and since #2031 a snap to a layer off the grid wins over the
grid, so a frame dragged next to a neighbour at 100.4 landed at 100.4
and the whole numbers inside it sat between pixels.

A move, resize or draw of frames, sections, components, component sets
and instances now rounds to whole pixels before and after object
snapping, whatever Snap to pixel grid says. A moved one also lands on
whole pixels of its parent (`snap::settle_on_pixels`), so a frame
already off the grid comes back onto it. Other layers keep #2031's
order: the pixel grid first, then the snap to a layer wins.

The move rounds the drag itself rather than each layer afterwards, so
the preview keeps its shifted-layers fast path for frames already on
the grid.
2026-11-24 14:22:35 -05:00
Denis Gomes f9964e14ae Desktop: reopen the files open at quit instead of starting in a new file
The desktop app started in a new, empty file on every launch, and with a
control port open (FIGCRAFT_CONTROL_PORT set for an attached agent) even
the Start on the Home screen preference was overridden, so the files you
worked in had to be found and opened again each time.

Quitting now keeps the paths of the open tabs' files, in tab order, and the
one in front (Prefs::open_files, Prefs::front_file); the next start opens
them again and brings that one forward, as Figma's desktop app reopens its
tabs. Files without a path (new, imported, joined live) and branch tabs are
left out. A file named on the command line stays in front, a recovered
copy keeps its one tab (file.open switches to an open path), a file gone
since is skipped, and one that won't open is reported like a file named on
the command line.

With nothing to reopen the window starts on the Home screen; only with a
control port open does it still start in a new file (#874: control callers
expect a document). Start on the Home screen now means Home instead of the
reopened files.

The list is written at quit only, with the other preferences. Keeping it on
every tab change would cover a crash too, but a crash already brings back
the unsaved files through recovery copies, and the list from the last quit
is a fair fallback for the rest.
2026-11-24 03:00:57 -05:00
Denis Gomes fd45d4f05b M3: a main pasted from its library file into another file is an instance of it
Copying a main component in a library file and pasting it into another
file made a copy of the main there: a new component of that file, not
linked to the library. Copy then Paste of a main in its own file already
makes an instance, and pasting an instance from the library file already
uses the main from the library. Now a main the source file publishes is
an instance of it from that library too, which gets enabled the same way,
as Figma does with a published component. A variant is an instance of that
variant.

A main the library doesn't offer (hidden from publishing, added since the
last publish) and a main from a file that publishes no library still paste
as a copy. Making those an instance as well was rejected: their main would
stay in the other file, so the instance would show a missing main.

The part of adopt_pasted that brings published components in is now
from_published, shared with the new published_main.
2026-11-24 03:00:27 -05:00
Denis Gomes 8056e20dcf M3: a variant switch keeps typed text the other variant nests in other frames
Switching an instance to another variant matched its old layers to the
new variant's by source and then by name path. When the two variants nest
the same text layer differently (text > Label in one, div > text > Label
in the other), the path differs, the typed layer matched nothing, and the
new variant's own text came back.

A text layer of the new variant that nothing else matched now takes the
old text layer of the same name, when exactly one layer on each side has
that name. Two of one name stay unmatched, since either could be the one
typed into. Layers inside nested instances are left to their own mains'
rebuild, so a text layer never moves between instances.

Matching every layer kind by name alone was left out: a fill or size kept
from another place in the tree would land on a layer that only shares a
name, while text is what was typed and the layer most likely to be the
same one.
2026-11-24 02:57:37 -05: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 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
bflatastic fb21b3c389 M6: svg import drops the scanners craft-svg replaced, so main builds and passes fmt again (#2468)
#2468 moved SVG import onto craft_svg::tree::parse, which runs the size,
entity, attribute and nesting checks itself, but left FigCraft's own
scanners (too_wide, too_deep, nesting) and import/budget.rs unused and
import.rs unformatted: main failed cargo fmt, clippy -D warnings and the
svg tests, which still passed budget::Limits to import_within.

The dead code goes; budget_tests use craft-svg's tree::Limits (bytes,
embedded_bytes, embedded_depth) and its error texts, and hostile_tests
check attribute width with craft_svg::guard::too_wide at the default
limits and the nesting refusal at craft-svg's 256 levels.
2026-11-19 06:00:08 +07:00
BFlat f8b1dc7373 Merge pull request #2444 from B-uchi/pr/design-context
M8: design context for AI agents
2026-11-19 05:51:53 +07: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
Trevor Brown 0d70c332b1 M12: boards: code blocks (doc and engine): a board code block that hugs its lines, with a language (#2237) (#2282)
The change from #2282 by @TrevorBrown-dev, as one commit.
2026-11-19 02:00:46 +07:00
bflatastic e4bc567855 M3: library analytics count insertions and detachments of styles and variables
Applying a style or variable, or copying or duplicating content that uses it,
inserts it; the Detach button detaches it; an instance counts as its component
alone. Show usage and library.usage give them over the chosen period.
2026-11-18 19:38:54 +07:00
FredApps 1f50d696a5 Merge branch 'main' into feat/mind-maps-ui-2226
Signed-off-by: FredApps <153173854+FredApps@users.noreply.github.com>
2026-11-18 18:32:17 +07:00
Trevor Brown d494fad166 M2: Fill across a hugging axis takes the line, as Figma does
In a hugging parent, Fill on the other axis follows the line the way
Figma does, instead of forcing the parent Fixed. This also covers item 2
of #2090 on both axes: a hugging main that becomes Fixed is followed by
its instances' roots.

Fixes #2091 item 3. Fixes #2034. Fixes item 2 of #2090.
2026-11-18 18:31:20 +07:00
Trevor BrownandClaude Opus 5.5 4a42da449d Merge upstream/main into feat/mind-maps-ui-2226
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Model-Effort: Opus 5.5 driver, no subagent
2026-11-17 06:34:03 -05:00
BFlat 9b27f7bae6 Merge pull request #2374 from adikshan11/fix/automation-roots-network-prefix
Automation roots: same_file doesn't open a path on another computer, native NT link targets and names Windows trims are refused, and the docs say network paths are refused
2026-11-17 18:11:29 +07:00
bflatastic 5baf4d80b3 MCP: the instructions tell agents to place copies as instances and use properties and variants 2026-11-17 17:41:27 +07:00
Adithya Shankaran d4e2641fa0 Automation roots: same_file doesn't open a path outside the roots, native NT link targets and names Windows trims are refused, and the docs say network paths are refused 2026-11-15 18:24:05 +05:30
Trevor BrownandClaude Opus 5.5 634c1e1f76 Merge upstream/main into feat/mind-maps-ui-2226
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 01:35:24 -05:00
Trevor BrownandClaude Sonnet 5.5 3bbd1d3ce5 Pages: Set as opening page, so a shared file opens on the page the team chooses (#1817) (#1972)
* M9: page.setOpening sets the page a shared file opens on, for everyone who joins (#1817)

A file on a figcraft-server opened on the page current at publish time, with no way to change it:
`DocProp::CurrentPage` was synced but nothing wrote it (`page.select` is each viewer's own page,
only a local save stamps the document). `page.setOpening {id?}` writes `doc.current_page` as a
document edit: one undo step, a synced change in a live session, so every later join opens on it;
the current page when none is named; a divider or a layer refused; nobody's own page moves. The
pages list's context menu gets "Set as opening page". Docs: mcp.md, collaboration-parity.md.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* M9: the pages menu's new string is in the English catalog (#1817)

The gate's i18n test wants every tr() key in locales/en.toml.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Opening page: the parity doc states the default when no opening page is set (#1972 issue)

With none set, a file opens on its saved current page, not the first page, and a link cannot name a page, so the row is partial.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Opening page: one sharing row, and the spotlight exception on the opening-page row (#1972 issue)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Opening page: the parity row states where the joiner's page comes from (#1972 issue)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Opening page: a no-op set adds no step, deleting the opening page falls back, and the tests cover junk ids, refusals, undo and the menu item (#1817)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* M5: the chosen opening page is saved with the file and opens it for everyone (#1817)

The opening-page flag now lives on the page node (NodeKind::Page opening), so it syncs
through the existing node kind. Saving writes the flagged page as current_page instead of
the page the saver was viewing. A duplicated page does not copy the flag, and deleting the
page removes it.

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

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-15 00:05:48 -06:00
Trevor BrownandClaude Opus 5.5 94d7289f66 M12: docs/mcp.md keeps one Select entry, with the mind map sibling note (#2226)
The last merge of main kept both versions of the Select bullet. Main's
bullet (locked layers listed, the locked flag) stays, and takes this
PR's note that Tab and Shift+Tab on a mind map node go to its next or
previous sibling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 13:34:49 -05:00
Trevor BrownandClaude Sonnet 5.5 a469e7327b Merge upstream/main into feat/mind-maps-ui-2226
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 12:47:10 -05:00
bflatastic 35aa524f8a Merge main into #2291 2026-11-13 23:42:21 +07:00
Trevor BrownandClaude Sonnet 5.5 7a4f83cae7 Merge remote-tracking branch 'upstream/main' into feat/mind-maps-ui-2226
Conflicts resolved by keeping both sides: the new tests from main (#2327 and
the sticky size menu) and this PR's mind map UI tests, and the board_bar
imports (ToolId plus STICKY_SIZES).

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 11:37:48 -05:00
Trevor BrownandClaude Sonnet 5.5 e0e57dd42a M12: a mind map in a section or frame without a place is centred on the view
board.mindMap's default x and y came from the view's centre, which is on the page, but x and y are the root's place in its parent: under a section at (1000, 500) the map landed 1000 right and 500 down of the view's centre. The default now takes the centre through the parent's inverse world transform (a parent that can't be inverted gives a non-finite centre, which the coordinate check refuses). Explicit x and y stay parent-local. Tests: two in board_mindmap_tests (a section; a frame turned 30 degrees, with a given place carried through the frame).

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 00:45:11 -05:00
Trevor BrownandClaude Opus 5.5 3be1a6a60b Merge upstream/main into feat/select-layer-locked-1560
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 22:19:23 -05:00
Trevor BrownandClaude Opus 5.5 aac94bb3db Merge upstream/main into feat/mind-maps-ui-2226
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 22:13:47 -05:00
Trevor BrownandClaude Sonnet 5.5 3d22c606a7 M10: Tailwind mobile merge keeps a max-width both frames share (#2272) (#2296)
inspect.code {language: "tailwind", mobile} dropped every mobile max-width and put the desktop one behind lg:, so a fixed-size layer that is the same size on both frames (a 48 x 48 badge) stretched to the full width below 1024 px. A mobile max-width that equals the desktop one is now kept as a plain class, with no lg: copy. A differing max-width still goes fluid on mobile with the desktop cap behind lg:.

Tests: the issue's two frames (a 1440 and a 390 page, each with a 48 x 48 badge) keep max-w-[48px] unprefixed, and a page-wide banner still gets its lg: cap only. The slashed-names test gave the CTAs frame the same 342 px on both frames, which the new rule rightly keeps, so its desktop frame is now 600 px wide. docs/mcp.md notes the rule.


Model-Effort: Opus 5.5 drove; Fable 5.2 queued; Opus 5.5 briefed; Sonnet 5.5 wrote at medium

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-13 01:44:17 +01:00
Trevor BrownandClaude Opus 5.5 f27de18ffc Merge upstream/main into feat/mind-maps-ui-2226
Code conflicts kept both sides: the tool list in tool.set's params gains main's annotation beside the mind map, ToolId::ALL holds 28 tools, and the shortcut counts are (137, 136, 1, 0, 2, 58).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Model-Effort: Opus 5.5 drove and merged
2026-11-12 03:46:59 -05:00
Trevor BrownandClaude Sonnet 5.5 6cb015d4f8 M5: Select layer lists locked layers with a padlock and picks them (#1560)
The context menu's Select layer now lists locked layers (and what a locked frame holds) with a padlock in the leading column, and picking one selects it, as the help center's "Lock and unlock layers" says and as measured in Figma's web app, 2026-11-10. The submenu shows only with more than one layer under the pointer (measured on a single locked layer only, the least certain rule). Clicks, hover and marquee still never reach a locked layer.

- doc: geometry::HitOpts { locked } and layers_at_opts; layers_at and the other public hit functions keep their signatures and pass the default.
- engine: select.layersAt lists locked layers and its rows gain locked (the layer or an ancestor is locked).
- ui-egui: indented_item takes locked and paints the Layers panel's padlock icon; a row both selected and locked shows the check.
- docs: ui-parity Select layer row, revision row and status line; mcp.md select.layersAt.

Tests: layers_at_a_point_list_locked_layers_with_a_flag_and_select_set_takes_them, select_layer_marks_locked_layers_with_a_padlock_and_picks_them, select_layer_needs_more_than_one_layer_under_the_pointer.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Model-Effort: Opus 5.5 drove; Fable 5.1 briefed; Sonnet 5.5 wrote at medium
2026-11-12 03:03:25 -05:00
bflatastic 39b7c54766 Merge main into #2200 2026-11-12 13:13:38 +07:00
bflatastic 4e0a2e2a35 Merge main into #2200 2026-11-12 11:34:51 +07:00
bflatastic 6bbd92856c Merge main into #2224 2026-11-12 11:24:51 +07:00
BFlat a49817259d Merge pull request #2106 from TrevorBrown-dev/fix/arrow-pan-step-measured
View: the arrow keys pan 64 px, 320 with Shift, as measured in Figma
2026-11-12 11:22:17 +07:00
bflatastic ebca682595 Merge main into #2224 2026-11-12 11:12:04 +07:00
bflatastic 7ecb6f1c03 Merge main into #2094 2026-11-12 11:07:19 +07:00