-
@create-figma-plugin/utilities- Added
isLockedandisVisibleutilities (#75)
- Added
-
Added a recipe for disabling the automatic swapping of React imports using a
build-figma-plugin.ui.jsfile
@create-figma-plugin/build- Allow
parameterOnlyto be set tofalse(#74)
- Allow
-
@create-figma-plugin/build- Suppressed TypeScript error that occurs when the type definition of an imported package contains
<reference types="node" />(#71)
- Suppressed TypeScript error that occurs when the type definition of an imported package contains
-
@create-figma-plugin/utilitiescomputeBoundingBox– Accounted forCodeBlocknode which does not have arotationproperty
-
Bumped dependencies in all packages
-
Replaced
ts-nodewithtsm -
Use
stylelint-config-idiomatic-orderinstead ofstylelint-config-rational-order(viastylelint-config-yuanqing)
- Documentation updates
-
@create-figma-plugin/build- Added support for building FigJam widgets
- Added new configuration options
widgetApi,containsWidget, andpermissions
- Added new configuration options
- Renamed the
apiVersionconfiguration option toapi, to be aligned with the pluginmanifest.jsonAPI
- Added support for building FigJam widgets
-
@create-figma-plugin/ui -
create-figma-plugin- Refactored the
create-figma-pluginCLI; a template can now be selected via an interactive interface - Added a
widget/notepadtemplate, and reorganized existing templates
- Refactored the
-
Documentation updates
-
@create-figma-plugin/ui- Fixed positioning logic in the
Modalcomponent
- Fixed positioning logic in the
-
@create-figma-plugin/utilities- Added
traverseNodeAsync
- Added
- Documentation updates
-
@create-figma-plugin/build- Made
build-figma-plugin --watchaware of changes tobuild-figma-plugin.*.jsfiles
- Made
-
@create-figma-plugin/ui- Added a
Modalcomponent (#47) - Added new components
Disclosure,IconChevronDown32,IconChevronLeft32IconChevronRight32, andIconChevronUp32 - Regenerated all icon components
- Added a
useWindowResizehook (#59) - Added a call to
useEffectin theuseFocusTraphook - Added CSS variables
--box-shadow-menu,--box-shadow-modal, and--font-family-code - Made
computeBoundingBoxcompatibile with@figma/plugin-typings@1.37.0
- Added a
-
create-figma-plugin- Renamed the
uitemplate topreact-rectangles - Added new templates
preact-resizableandreact-editor - Updated the
@figma/plugin-typingsversion to1.37.0
- Renamed the
-
Bumped dependencies in all packages
- Moved constants
MIXED_NUMBERandMIXED_STRINGfrom@create-figma-plugin/uito@create-figma-plugin/utilities
-
@create-figma-plugin/build- Restart the TypeScript watcher when changes are made to
tsconfig.json(#56) - Enabled usage of React components by swapping out
reactandreact-domimports withpreact/compat - Added the ability to import “global” CSS by adding a
!prefix before the CSS file path (#60) - Accounted for the case where
figma.commandisundefined(eg. in a FigJam widget)
- Restart the TypeScript watcher when changes are made to
-
@create-figma-plugin/utilities- Added support for FigJam nodes in
loadFontsAsync(#57)
- Added support for FigJam nodes in
-
Improved documentation
-
@create-figma-plugin/build- Suppressed the
Cannot redeclare block-scoped variable 'console'.type-check error when using@figma/plugin-typings@^1.32.0(#54) - Added an escape hatch for modifying the
manifest.jsonfile just before it gets written to disk
- Suppressed the
-
@create-figma-plugin/utilitiescomputeBoundingBox– Accounted for FigJam-specific nodes (eg.Connector,Sticky) which do not have arotationproperty
-
create-figma-plugin- Removed the
--yesflag and the ability to customize the display name - Removed the CLI interactive prompt
- Updated the plugin installation instructions in all templates
- Removed the
-
Bumped dependencies in all packages
-
create-figma-plugin- Pinned to a specific version of
@figma/plugin-typingsin all plugin templates
- Pinned to a specific version of
-
@create-figma-plugin/utilities- Returned
variantdata invalidateGumroadLicenseKeyMainAsyncandvalidateGumroadLicenseKeyUiAsync
- Returned
- Added docs for
editorType
-
@create-figma-plugin/build- Fixed the building of CSS Module typings in Windows (#51)
-
Improved documentation
-
@create-figma-plugin/build- Updated the configuration JSON schema
-
@create-figma-plugin/utilities- Added
deduplicateArray
- Added
-
Added docs for
parametersandparameterOnly
-
@create-figma-plugin/build- Added support for the new
editorType,parametersandparameterOnlyconfig
- Added support for the new
-
@create-figma-plugin/monetization- This package is deprecated; all monetization-related utility functions have been moved into
@create-figma-plugin/utilities
- This package is deprecated; all monetization-related utility functions have been moved into
@create-figma-plugin/build- Fixed a bug with the
build-figma-pluginCLI throwing an error when the current working directory absolute path contains spaces (#49)
- Fixed a bug with the
@create-figma-plugin/build- Fixed a bug with how CSS file paths are resolved (#48)
- Added a recipe for using image assets in the plugin UI (#45)
-
create-figma-plugin- Added a
uitemplate - Simplified the CLI; now, only a
name,displayNameandtemplateare necessary - Fixed a bug with CLI arguments parsing (#41)
- Added a
-
Added a recipe for customizing the underlying esbuild configuration
-
@create-figma-plugin/build- Added the ability to override the esbuild configuration for the main bundle (via a
build-figma-plugin.main.jsfile) and the UI bundle (via abuild-figma-plugin.ui.jsfile) (#34) - Improved the UX of the
build-figma-plugin --watch --typecheckterminal output (#38)- Fixed a bug with watch mode terminating on error (#40)
- Added the ability to override the esbuild configuration for the main bundle (via a
-
@create-figma-plugin/monetization- This is a new package that includes utilities for:
- Tracking the number of plugin runs
- Verifying a Gumroad license key
- This is a new package that includes utilities for:
-
@create-figma-plugin/ui- New features:
- Added
BannerandIconButtoncomponents - Added a
validateOnBlurprop toTextbox,TextboxNumeric, andTextboxMultiline
- Added
- Bug fixes:
- Allow pressing
Tabto hide the menu in theDropdowncomponent - Fixed a bug for when the
suffixprop is specified inTextboxNumeric - Fixed UI bugs in the
useFocusTrapanduseScrollableMenuhooks - Middle-aligned the
iconrelative to the height of the textbox in theTextbox,TextboxAutocomplete,TextboxNumericcomponents - Adjusted the focused style (the height of the blue outlined box) and the selected style (the background color of the selected text) of all textboxes (ie.
Textboxetc.) to be identical to that in the Figma editor - Prevent menu items in
DropdownandTextboxAutocompletefrom wrapping - Dynamically adjust the horizontal menu position of
Dropdown(#37)
- Allow pressing
- CSS:
- Added colors
--color-black-6-translucent,--color-black-3-translucent, and--color-blue-30-translucentto@create-figma-plugin/ui/lib/css/base.css
- Added colors
- New features:
-
@create-figma-plugin/utilities- New features:
convertHexColorToRgbColorconvertNamedColorToHexColorconvertRgbColorToHexColorisValidHexColorunsetRelaunchButton
- Bug fixes:
- When
setRelaunchButtonis called, any relaunch buttons (with a differentrelaunchButtonId) previously set by the plugin on the particular node will be retained rather than overriden
- When
- New features:
@create-figma-plugin/ui- New features:
TextboxColor– Added a new component for receiving a user input hex color with opacityDropdown,TextboxAutocomplete– Allow individual menu options to bedisabledSearchTextbox,Textbox,TextboxAutocomplete,TextboxMultiline,TextboxNumeric– Added aspellCheckprop that defaults tofalseto hide the red squiggly lines from the browser’s spellchecking
- Bug fixes:
Dropdown,TextboxAutocomplete– Fixed az-indexbug with the menu, hide the menu on clicking anywhere outside the pluginiframe(previously the menu only hides when clicking outside the menu but within the pluginiframe)TextboxNumeric– Fixed a bug withrevertOnEscapeKeyDownnot working as expected when thesuffixprop is also setDropdown– Fixed dynamic positioning of the menuButton,SearchTextbox,Textbox,TextboxAutocomplete,TextboxMultiline,TextboxNumeric– Set thebackground-colorof the root element totransparent
- New features:
create-figma-plugin- Added
src/**/*.tsxto the"include"key of thedefaulttemplate’stsconfig.json
- Added
-
@create-figma-plugin/ui- Made the
--box-shadowstyle identical to that in the Figma CSS - Fixed the style of disabled options in the
SegmentedControlcomponent
- Made the
-
create-figma-plugin- Included
plugin-templates/*/.gitignorein the published package - Added a
^prefix to@create-figma-plugin/*version numbers in thedefaulttemplate
- Included
-
Improved documentation
Note: 1.0.0 requires Node.js v14.
@create-figma-plugin/build@1@create-figma-plugin/tsconfig@1@create-figma-plugin/ui@1@create-figma-plugin/utilities@1
-
The
build-figma-pluginCLI is now powered by esbuild, replacing Webpack. esbuild is extremely fast, and building any non-trivial plugin should reliably take less than 1 second. (esbuild actually runs within a couple hundred milliseconds, but some parts of the build process – compiling and generating.d.tsfiles for CSS modules, generating themanifest.jsonfile – still runs in Node.js-land.) -
Given the move away from Webpack, the ability to override the build process via a
figma-plugin.config.jsfile has also been removed. -
Minification and type checking of your plugin code is now disabled by default in the
build-figma-pluginCLI. Thebuildandwatchscripts in yourpackage.jsonshould be updated as follows:{ ... "scripts": { - "build": "build-figma-plugin", + "build": "build-figma-plugin --typecheck --minify", - "watch": "build-figma-plugin --watch", + "watch": "build-figma-plugin --typecheck --watch", ... }, ... } -
The ability to use SCSS in CSS Modules has been removed. Now, only “vanilla” CSS Modules is supported. To migrate, use the
sassCLI to do a one-off conversion of your.scssfiles to.css, then update your UI code to reference the generated.cssfiles. -
There’s now a JSON schema for validating the plugin configuration in your
package.jsonfile. To enable autocomplete and inline validation of your plugin configuration in Visual Studio Code, create a.vscode/settings.jsonfile containing the following:{ "json.schemas": [ { "fileMatch": [ "package.json" ], "url": "https://yuanqing.github.io/create-figma-plugin/figma-plugin.json" } ] }
-
The
tsconfig.jsonfile has changed significantly, given the move to esbuild.{ "compilerOptions": { "esModuleInterop": true, "isolatedModules": true, "jsx": "react", "jsxFactory": "h", "lib": ["DOM", "ES2020"], "module": "ES2020", "moduleResolution": "Node", "strict": true } } -
Either copy the above to your project’s
tsconfig.json, or directly extend from@create-figma-plugin/tsconfig. You should at least ensure that the"isolatedModules"option is enabled in yourtsconfig.json.
-
There are many breaking changes and new features. Your best bet for migrating to
v1might be to try to build your plugin using thebuild-figma-plugin --typecheck --watchcommand, and then incrementally fixing the errors surfaced by the TypeScript compiler. Otherwise, refer to usage examples of all the components in the Storybook, or see below for a detailed breakdown of all component changes. -
One of the most significant changes is that the
onChangeprop of all components now has the signature(event: JSX.TargetedEvent<HTMLInputElement>) => void. See the before and after, using theCheckboxcomponent as an example:// Before `v1` const [state, setState] = useState({ foo: false }) // ... <Checkbox name="foo" onChange={setState} value={state.foo}> Text </Checkbox>
// `v1` const [value, setValue] = useState(false) function handleChange(event: JSX.TargetedEvent<HTMLInputElement>) { const newValue = event.currentTarget.checked console.log(newValue) //=> either `true` or `false` setValue(newValue) } // ... <Checkbox onChange={handleChange} value={value}> Text </Checkbox>
-
An alternative to using the
onChangeprop to listen to state changes is to use the newonValueChangeprop. This prop is available on all components that also have anonChangeprop. TheonValueChangehandler has the signature<Value, Name extends string>(newValue: Value, name?: Name) => void, and it is called on every DOMchangeevent. The secondnameparameter passed to the handler is precisely thenameprop that was set on the component. Again, using theCheckboxcomponent as an example:const [value, setValue] = useState(false) function handleChange(newValue: boolean, name: undefined | string) { console.log(newValue) //=> either `true` or `false` console.log(name) //=> 'foo' setValue(newValue) } // ... <Checkbox name="foo" onValueChange={handleValueChange} value={value}> Text </Checkbox>
-
The
onChangeprop has been removed from theSearchTextbox,Textbox,TextboxAutocomplete, andTextboxNumericcomponents. (This prop was inaccurately named for these components because the handler is actually called on every DOMinputevent.) Instead, use theonInputandonValueInputprops to handle the DOMinputevent. -
The
DropdownMenucomponent has been removed. Use the newDropdowncomponent, which has an improved UI design and component API. -
All component styles are now written as “vanilla” CSS modules rather than SCSS. The previous SCSS variables are now expressed as CSS variables on
:root. Refer to thebase.cssfile in@create-figma-plugin/uifor the list of CSS variables that are available for use in your custom CSS. -
Added new components
Dropdown,MiddleAlign,TextboxMultilineandToggle, in addition to 175 icon components extracted from Figma’s official “UI2” design system file on Figma Community.
-
All icons are now exported as Preact functional components. Refer to the following mapping to migrate existing icons to their equivalents in
v1:checkCircleIcon→<IconCheckCircle32 />checkIcon→<IconMenuCheckmarkChecked16 />componentIcon→<IconLayerComponent16 />crossIcon→<IconCross32 />frameIcon→<IconLayerFrame16 />imageIcon→<IconLayerImage16 />moveDownIcon→<IconMoveDown16 />moveRightIcon→<IconMoveRight16 />searchIcon→<IconSearch32 />spaceHorizontalIcon→<IconSpacingHorizontal16 />spaceVerticalIcon→<IconSpacingVertical16 />
Note that
IconCheckCircle32,IconCross32andIconSearch32all have a dimension of32px, which is double the size of the corresponding icons in versions of@create-figma-plugin/uiprior tov1. -
All icons also now take a
colorprop for customizing thefillcolour of the iconsvg.
- The
focusedprop has been removed.
- The
focusedprop has been removed. - The
onChangeprop now has the signature(event: JSX.TargetedEvent<HTMLInputElement>) => void. - There’s a new
onValueChangeprop with the signature(newValue: boolean, name?: string) => void.
- The
focusedandonClickprops have been removed. - The
onSelectedFilesprop now has the signature(files: Array<File>) => void.
- The
onSelectedFilesprop now has the signature(files: Array<File>) => void.
- This component has an almost entirely new API. (The
onClick,selected, andtypeprops have been removed. New props includebold,onChange,onValueChange,icon,color, andvalue.)
- There’s a new
colorprop for customizing thefillcolour of thesvgrepresenting the loading indicator.
- The
valueprop can now benull, or aboolean,number, orstring. - The
focusedprop has been removed. - The
onChangeprop now has the signature(event: JSX.TargetedEvent<HTMLInputElement>) => void. - There’s a new
onValueChangeprop with the signature(newValue: boolean | number | string, name?: string) => void. - For the
RadioButtonsOptiontype:- The
textkey has been renamed tochildren. valuecan now only be aboolean,number, orstring.
- The
- The
focusedandonChangeprops have been removed. - There’s a new
onInputprop with the signature(event: JSX.TargetedEvent<HTMLInputElement>) => void. - There’s a new
onValueInputprop with the signature(newValue: string, name?: string) => void.
- The height of the component is now
24px(reduced from36px) to be identical to the height of segmented controls in the Figma editor UI. - The style of the component’s focused state has been tweaked to follow that of segmented controls in the Figma editor UI.
- The
valueprop cannot benulland can now only be aboolean,number, orstring. - The
focusedprop has been removed. - The
onChangeprop now has the signature(event: JSX.TargetedEvent<HTMLInputElement>) => void. - There’s a new
onValueChangeprop with the signature(newValue: boolean | number | string, name?: string) => void. - In the
SegmentedControlOptiontype:- The
textkey has been renamed tochildren. valuecannot benulland can now only be aboolean,number, orstring.
- The
- The
onKeyDownprop has been removed. - The
onChangeprop now has the signature(event: JSX.TargetedEvent<HTMLInputElement>) => void. - There’s a new
onValueChangeprop with the signature(newValue: boolean, name?: string) => void.
- The
focusedprop has been removed. - The
onChangeprop now has the signature(event: JSX.TargetedEvent<HTMLInputElement>) => void. - There’s a new
onValueChangeprop with the signature(newValue: string, name?: string) => void. - In the
TabsOptiontype:- The
disabledandtextkeys have been removed. - The
viewkey has been renamed tochildren. valuecan now only be astring.
- The
- The height of the component is now
28px(reduced from32px) to be identical to the height of textboxes in the Figma editor UI. - The
valueprop cannot benulland can now only be astring.- A “Mixed” value is represented by the
MIXED_STRINGconstant from@create-figma-plugin/utilities.
- A “Mixed” value is represented by the
- The
focused,onChange, andtypeprops have been removed. - There’s a new
onInputprop with the signature(event: JSX.TargetedEvent<HTMLInputElement>) => void. - There’s a new
onValueInputprop with the signature(newValue: string, name?: string) => void. - There’s a new
passwordprop for changing the display to a password field. (Previously, you’d set thetypeprop to'password'.) - There’s a new
revertOnEscapeKeyDownprop to enable reverting the originalvaluewhen theEsckey is pressed.
- The height of the component is now
28px(reduced from32px) to be identical to the height of textboxes in the Figma editor UI. - The height of the autocomplete menu will dynamically expand (while still keeping within the dimensions of
window) so as to fit as many items as possible in the menu. - The
focusedandonChangeprops have been removed. - There’s a new
onInputprop with the signature(event: JSX.TargetedEvent<HTMLInputElement>) => void. - There’s a new
onValueInputprop with the signature(newValue: string, name?: string) => void. - There’s a new
revertOnEscapeKeyDownprop to enable reverting the originalvaluewhen theEsckey is pressed.
- The height of the component is now
28px(reduced from32px) to be identical to the height of textboxes in the Figma editor UI. - The
valueprop cannot benulland can now only be astring.- A “Mixed” value is represented by the
MIXED_STRINGconstant from@create-figma-plugin/utilities.
- A “Mixed” value is represented by the
- The
focused, andonChangeprops have been removed. - There’s a new
onInputprop with the signature(event: JSX.TargetedEvent<HTMLInputElement>) => void. - There’s a new
onValueInputprop with the signature(newValue: string, name?: string) => void. - There’s a new
onNumericValueInputprop with the signature(newValue: null | number, name?: string) => void, wherenewValueis the result of evaluatingvalueas a numeric expression.- If
valueis the empty string, thennewValueis null. - If
valueis theMIXED_STRINGconstant from@create-figma-plugin/utilities, thennewValuewill be theMIXED_NUMBERconstant from the same.
- If
- There’s a new
revertOnEscapeKeyDownprop to enable reverting the originalvaluewhen theEsckey is pressed. - There’s a new
suffixprop for automatically appending an arbitrary string to the numeric textbox.
compareArrayshas been removed. UsecompareObjectsinstead.isWithinInstancehas been renamed toisWithinInstanceNode.computeSiblingNodes,deduplicateNodes,sortNodesByCanonicalOrder, andsortNodesByNameall now take a type parameter<Node extends SceneNode>. This type parameter allows these functions to accept and return arrays of specific node types, rather than merely an array ofSceneNode.loadSettingsAsyncandsaveSettingsAsyncboth now take an optional second argument for customizing the key for loading from or saving tofigma.clientStorage.- Added new utilities
compareStringArrays,getParentNode, andgetSceneNodeById.