Version 1, Update 10
New:
- Read-only access to prototyping properties is now available for all plugins
Fixed:
- Fixed a bug where cloning a page did not clone the prototyping connections
New:
Fixed:
New:
FrameNode documentation.Fixed:
FrameNode and GroupNode objects now have separate prototypes, which means that code such as 'strokes' in group will correctly return false. Note that we still recommend checking the .type property of node objects over using the in operator. We expect this to be an implementation detail -- however, let us know if this is causing you any issues.Proposed API (how do they work?):
Figma has released auto-layout!
As always, we try to make sure plugins don't break when we release new features. That being said, this release affects a lot of the core functionality of Figma and you may need to update your plugin to be aware of those concepts.
Auto-layout frames introduces new types of relations between layers. Existing APIs around size, positioning and children order have different behavior:
x and y position set automatically. Writing to the position of those nodes via the API will no-op. Similarly, setting relativeTransform may ignore the translation component (but retain the rotation component).resize(w, h) and resizeWithoutConstraints(w, h) will no-op in one or both dimensions if the auto-layout frame has a size set automatically by auto-layout.The plugin API is intended to always return the most up to date value for all properties (i.e. has auto-layout applied). As such, be aware of these new restrictions and side effects when setting properties.
Frame-like containers (frames, components & instances) now support new properties! The properties listed below now exist on nodes of type "FRAME", "COMPONENT" and "INSTANCE". Note that they are not available on nodes of type "GROUP".
Note that adding these new properties required re-organizing type definitions in the typings file. Notably, we've split FrameNode into FrameNode and GroupNode because a lot of properties are not supported on group nodes.
fillsfillStyleIdstrokesstrokeStyleIdstrokeWeightstrokeAlignstrokeCapstrokeJoindashPatterncornerRadiustopLeftRadiustopRightRadiusbottomLeftRadiusbottomRightRadiuscornerSmoothingTip: don't write code like if ('fills' in node) { ... } to check if a property exists on a node. This is not guaranteed to work, especially with group nodes. Compare against the node type instead. It also helps TypeScript infer properties about the node better.
function isFrameLike(node: BaseNode): node is FrameNode | ComponentNode | InstanceNode {
return node.type === 'FRAME' || node.type === 'COMPONENT' || node.type === 'INSTANCE'
}
if (isFrameLike(node)) {
console.log(node.fills, node.strokes, node.cornerRadius)
}
backgrounds propertyOn frame-like nodes, the backgrounds and backgroundStyleId properties are marked as DEPRECATED. Use the newly-introduced fills and fillStyleId properties instead. We made this change to be consistent with other types of nodes that also use the fills properties. We may remove the property entirely in a new version so you should not use it. In the meantime, backgrounds and backgroundStyleId will keep working as an alias for fills and fillStyleId (i.e. they read and write to the same value).
On group nodes, backgrounds and backgroundStyleId are no longer supported, both in the editor and the API. If you have existing frames with a background, you will notice that the backgrounds panel in the properties panel has been changed with a message prompting you to replace it with a fill. Consequently, in the API, writing to the backgrounds and backgroundStyleId properties of a group node will no-op.
On page nodes, backgrounds is not deprecated.
Coming soon!
(Also included: update 6)
New:
| symbol with PluginAPI['mixed'] for all properties that can return the special figma.mixed value. This new syntax also fixes the problem where TypeScript's control flow analysis was not able to understand if (node.prop !== figma.mixed) and narrow down the type.selectionchanged event could sometimes fire multiple times when the selection changed.Proposed API (how do they work?):
position option in figma.showUI(). Instead, plugins now always remember their last opened position by default.New:
figma.ui.on('message'), figma.on('selectionchange') and figma.on('currentpagechange') APIs, which were previously proposed APIs can now be used in published plugins.figma.on('close') API for allowing you to run shutdown actions when the plugin closes.Proposed API (how do they work?):
position option in figma.showUI() with possible values 'default' | 'last' | 'auto'New:
figma.on('selection')) as a proposed API.Fixed:
This update only contains bug fixes.
This update only contains bug fixes.
textStyleId to a text node required you to load the existing font on the text node, even though it is being replaced. This is now no longer necessary.text.setRangeFontName now requires you to load all existing fonts used in the text nodes, as they might still be present after the text node gets modified.text.setRangeXYZ functions would clear the textStyleId of characters outside the range that was being modified.This is the first update to the plugins API since launch! This update does not contain breaking changes, so all plugins receive these updates automatically. Please refer to Stability and Updates for more on our update and versioning policies.
figma.union, figma.subtract, figma.intersect, figma.exclude to replace figma.createBooleanOperation().figma.notify as an easy way to show messages to the userfigma.getLocalPaintStyles, figma.getLocalGridStyles, figma.getLocalTextStyles, figma.getLocalEffectStyles to enumerate local styles."MAX" layout grid type was not accepted when setting the value.