Commit graph

15 commits

Author SHA1 Message Date
Danila Poyarkov 8a976c1a0f Merge master into fix/create-component-drops-bound-variables 2026-09-02 01:09:01 +03:00
Danila Poyarkov 1d7e79c0ce test: update structured instance override coverage 2026-09-01 11:57:36 +03:00
Danila Poyarkov fcbd938b80 fix(fig): consolidate instance override propagation 2026-09-01 01:07:19 +03:00
Danila Poyarkov 01353e7ca7 fix(scene-graph): preserve text instance overrides 2026-09-01 01:04:22 +03:00
Danila Poyarkov 07e4cb2438 Merge remote-tracking branch 'origin/master' into consolidate-pr551-next 2026-09-01 01:02:35 +03:00
xemc 7dc46bb993 feat(figma-api): add exposeInstanceSwap for real instance-swap component properties
Adds figma.exposeInstanceSwap(slots, candidates, propertyName), which
exposes one or more nested instances as an instance-swap slot — the
enclosing component (or component set, walking up past intermediate
variant members) gets an INSTANCE_SWAP property offering the given
candidates, and each slot instance is tagged to respond to it. Mirrors
Figma's "Create component property > Instance swap", letting a designer
pick which component fills a slot (e.g. an icon on a button) instead of
the slot being baked-in static content.

Exposed as the expose_instance_swap MCP/CLI/chat tool.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-29 16:30:42 +03:00
Danila Poyarkov 33baf1eb7f style(figma-api): format component conversion test 2026-08-29 15:47:43 +03:00
Danila Poyarkov 7fdf3952a2 merge: sync component sizing fix with master 2026-08-29 15:42:24 +03:00
Danila Poyarkov cbfc93f9bc test(figma-api): cover padding after component conversion 2026-08-29 15:40:25 +03:00
xemc 814352ec90 fix(figma-api): preserve variable bindings when converting a node to a component
createComponentFromNode copied a hand-picked list of fields onto the new
COMPONENT node but omitted boundVariables/variableModes, silently dropping
any variable bindings on the frame itself (padding, radius, stroke, etc).
Child nodes were unaffected since they're copied via cloneTree, which
already carries bindings through cloneNodeProps.
2026-08-26 10:17:13 +10:00
xemc 1fd7990cd9 fix(figma-api): preserve auto-layout sizing mode when converting a node to a component
createComponentFromNode copied only a hand-picked list of fields onto the
new COMPONENT node, omitting primaryAxisSizing/counterAxisSizing. A HUG-sized
auto-layout frame silently reverted to FIXED sizing on conversion, so later
padding changes no longer resized the frame (itemSpacing still worked since
it doesn't affect the frame's own size).
2026-08-26 10:17:07 +10:00
Danila Poyarkov 1db92c4603 fix(figma-api): align variant combination behavior
- Match the Figma parent and insertion-index API contract\n- Reject duplicate component references before graph mutation\n- Share slash-name variant derivation with editor actions\n- Add structural regression coverage and changelog entry
2026-08-19 20:05:54 +03:00
xemc b01ed830e8 feat(figma-api): add combineAsVariants for real component variant sets
figma.combineAsVariants() was unimplemented in the scripting/automation
layer (figma-api/proxy.ts's compatibility surface), even though the editor
UI already has a full equivalent — createComponentSetFromComponents()
(editor/components.ts) plus wrapSelectionInContainer()
(editor/structure/container-wrap.ts) — wired to the app's own "Create
component set" menu action.

This ports that logic down to FigmaAPI (the class MCP tools, the CLI, and
AI chat scripting all run against): wraps selected COMPONENT nodes sharing
a parent into a COMPONENT_SET, and derives variant property definitions from
"Category/Value" node-name segments, matching the editor behavior exactly.
Drops the undo-stack push and selection-state writes the editor path has,
since neither concept exists at the scripting layer — everything else is
the same primitives (SceneGraph.createNode/insertChildAt/reparentNode),
which FigmaAPI already had direct access to.

Also adds a matching combine_as_variants tool (packages/core/src/tools/
create/components.ts) registered in EXTENDED_TOOLS, so it's exposed
through MCP, the CLI, and AI chat alongside the existing create_component/
create_instance tools.
2026-08-19 20:05:54 +03:00
xemc ff54a222d8 fix(fig): live edits to instance-descendant fields discarded on save
Editing a field on a node nested inside an INSTANCE (e.g. recoloring an
icon instance's fill) was silently reverted on the next save/reload.
Nothing recorded the edit as an override, and the lazy-population resync
that runs on every export (applySymbolOverrides, propagateResolvedFills)
unconditionally reapplied the stale, originally-imported override data
over the live graph.

Fix records instance-descendant edits via recordInstanceOverride (wired
into the shared FigmaNodeProxy updateNode helper) and has both resync
passes skip fields with a live override via a new hasLiveOverride check.
Also adds serializeFillOverrides so fill overrides are actually written
to the exported symbolOverrides payload (previously only :text overrides
were ever serialized).
2026-08-18 11:22:29 +10:00
Danila Poyarkov aad26b535e test: move prefixed splits into domain folders
- Move newly split tests under explicit domain subfolders
- Update nested helper imports after the moves
- Add a lint guard against repeating existing sibling domains as filename prefixes
2026-05-06 14:27:21 +03:00