-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# [Example project with a flex gap](https://utopia.fish/p/71b4ada2-boatneck-lamp/?branch_name=feature-style-plugins) ## Problem The canvas controls can't edit elements that are styled with Tailwind ## Fix Add a plugin system, where each plugin provides a data source that strategies can read from (so as of this PR, either Tailwind or the inline style), and a function that takes props from the inline style, and moves them to the right place the style element. For example, the plugin that implements Tailwind styling takes the inline style props, converts them to the right tailwind classes, and adds them to the `className` prop. The flex gap strategy and the flex gap control is updated to use the data provided by the plugin system to read the necessary data. ### Out of scope There's one known limitation of this system as implemented in this PR: props that are removed by a strategy don't get removed by the normalization step in plugins. This is only a problem for the Tailwind plugin (since the inline style plugin leaves the inline style prop as the strategies left them, so the fix for this will come on a follow-up PR after this one (the actual fix is already implemented here for anyone interested b2fc141) ### Details - Types for the plugin system, and two concrete plugin implementations are added in the `canvas/plugins` folder - The data provided by the plugins is added to `InteractionCanvasState` as the `styleInfoReader` function - The normalization step provided by the plugins is hooked into the strategy lifecycle in `interactionFinished` - The flex gap strategy/controls are updated to use `styleInfoReader` - `UpdateClassList` is fixed so that it can write the `className` prop even if it doesn't exist on element at the start of the command --------- Co-authored-by: Federico Ruggi <1081051+ruggi@users.noreply.github.com>
- Loading branch information
Showing
16 changed files
with
533 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.