-
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
71 additions
and
56 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@tokens-studio/figma-plugin": patch | ||
--- | ||
|
||
Changed logic when "Remove styles and variables without connection to a token" is enabled where we now look at all created tokens in this session and remove them, instead of looking at each theme individually |
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
22 changes: 22 additions & 0 deletions
22
.../tokens-studio-for-figma/src/plugin/asyncMessageHandlers/removeStylesWithoutConnection.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { AsyncMessageChannelHandlers } from '@/AsyncMessageChannel'; | ||
import { AsyncMessageTypes } from '@/types/AsyncMessages'; | ||
|
||
export const removeStylesWithoutConnection: AsyncMessageChannelHandlers[AsyncMessageTypes.REMOVE_STYLES_WITHOUT_CONNECTION] = async (msg) => { | ||
try { | ||
let count = 0; | ||
const localStyles = await Promise.all([ | ||
figma.getLocalPaintStylesAsync(), | ||
figma.getLocalTextStylesAsync(), | ||
figma.getLocalEffectStylesAsync(), | ||
]).then((results) => results.flat()); | ||
localStyles.forEach((style) => { | ||
if (!msg.usedStyleIds.includes(style.id)) { | ||
style.remove(); | ||
count += 1; | ||
} | ||
}); | ||
return { countOfRemovedStyles: count }; | ||
} catch (e) { | ||
return { countOfRemovedStyles: 0 }; | ||
} | ||
}; |
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