Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release next (Monorepo, React 18, ..) #2403

Merged
merged 340 commits into from
Aug 13, 2024
Merged

Release next (Monorepo, React 18, ..) #2403

merged 340 commits into from
Aug 13, 2024

Conversation

six7
Copy link
Collaborator

@six7 six7 commented Dec 2, 2023

Contains large-scale changes to the codebase

  • Move to monorepo
  • React 18
  • Integrate @tokens-studio/ui package which replaces many of the custom components from the plugin

And much more:

This one’s a massive release we’ve been working on over the last few months, and we’re excited to finally release this!

Here’s a few highlights:

  • W3C DTCG format
  • A new variables experience
  • Non-local variable references
  • Variables in typography styles, shadows, border tokens and gradients
  • Typography tokens
  • Bitbucket support
  • Tokens Studio (platform) support

What's in the release?

image

W3C Compliance

You can now choose to opt in to the W3C DTCG format allowing you to use the standardized format ($value, $type and so on)! You can do this on a per-provider level, meaning that this is stored along with your tokens. Note: If you intend to change your development pipeline, switching to Style Dictionary 4 (which we’ve been working on) is required as this also supports the new format. We also auto-detect if you’re using the new format in your token files, and will use that format. This comes with a change where you are now prohibited from creating tokens that contain { } or $ in their name.

Completely changed way of interacting with variables

The way we did styles and variables evolved over the lifetime of the plugin, and we constantly added new features  which made it quite confusing. So we completely refactored the way you interact with it. We now have a dedicated Export to Figma modal that allows you to choose what to export, and how to export. This is a start, and we’ll continue enhancing this. Let us know what’s missing from there!

Export to variables or styles based on token sets (free and pro)

You can now create variable collections without using themes! However, support is limited. You can also configure what sets will be used.

image

Use variables inside styles

You can now create styles with variable references! This allows you to use variables inside typography and color styles as well as shadow or blur effects. Simply refer to a token, create a composite token such as a typography, boxShadow token and notice that variables are being used inside those styles. In the new Options dialog and in the Styles & variables modal, there’s an option “Create styles with variable references”, and if that’s on, we’ll link your styles to variables as long as your tokens are linked to variables).

image

Non local variables!

You can now create variables in one file and have them act as references in other files, just as you do with styles To do so, create variables using the Styles & Variables menu and just select the theme groups that you’d want to create in that file. Publish your library and push your changes to your git provider. Then, move on to the second file, enable the remote library in Figma, pull in your tokens from Git, go to create variables and just select the collection that’s supposed to be created there. If your tokens are using a strict reference to another token (e.g. {colors.blue.500}), we’ll use the variable from file A as a reference for the variable in file B.

image

Choose if tokens should be applied as variables, styles or raw values

We added a new option to the Apply to menu. You can now choose if you want to apply variables and styles or just raw values. You can use this if you want to theme your frames but don't want to use Figma’s variable mode switcher. As an example, if you are using styles or variables and need a light and dark theme side by side, you can just duplicate your frame, change apply to raw values, and apply tokens  to the duplicated frame. That way you can see results but with the raw values applied.

Fallback when applying tokens that don’t have a direct variable connected

When applying variables and the token that is applied does not have a variable but the reference it is using has one, we’ll apply this instead. This allows you to have your component tokens applied but your semantic variables be visible to your designers, by just not creating component tokens as variables.

Typography tokens will be created as variables

Font family, font weight, letter spacing, line height, paragraph spacing and paragraph indent will be created as variables (mostly number). Font families will always be created as string, and font weight will be created either as string or as number (if numerical weights such as 400, 500 are used). Numerical weights are special as Figma now supports setting this properly, where we no longer have to use our font weight mapping hack.

image

Bitbucket sync

We’ve now shipped support for Bitbucket (huge thanks to @mattoliver for his help on this!), which allows you to sync your tokens to Bitbucket. You’ll need to use App Passwords with a repo scope (as well as account scope).

image

Tokens Studio sync

Last but not least, we’ve been working hard on a dedicated platform to manage design tokens (and whole design systems). With this release we bring support to sync your tokens with this new platform of ours. The platform is built around the idea of logical design decisions, and our graph-engine that powers node-based algorithmic design is at the core of that. You can create color scales easily, and if you ever need to update them, doing so is a breeze. We’re already using this internally to drive our new design system, and we started onboarding the first users to the platform. This is still early, if you’d like to help us test this, let us know!

Other important changes

Removed the Update style options from the apply token dropdown. We now encourage users to make changes to their styles by using the Export to Figma dialog. (note: this is a big change which I think can have some side-effects with users not knowing about it, so i wonder how we can communicate this after launch, but it really helps to align various features)

We refactored the way renaming variables and styles work, located in the @❇️ New styles and variables options menu

Update existing styles and variable names: When this is on, we try to rename your styles and variables. Note that this only works when used in combination with Themes, as we do not track variables or styles when you are using the option to export using Sets

Remove styles and variables without connection to a token: When this is on we remove any tokens part of the touched collections that are not tied to a token. Use this is if you use the plugin as your source of truth. It will delete any variables or styles that are not connected to a theme or connected to the token names when used when exporting using Sets.

Other feature additions

You can now set max width and height tokens on component instances (not on their children) - #2426

Typography tokens such as line heights, font sizes, paragraph spacing, paragraph indent and letter spacing now take number and dimension tokens as suggested tokens - #2528

Options (use rem, convert numbers to dimensions) are now disabled by default for the Import variables dialog - #2742

Adds support for binding variables to stroke weight and opacity (Note: Opacity binding is currently not working, we’re working on this!) - #2414

The set sidebar on the left is now resizable! - #1962

Opacity tokens are now created as number variables when creating variables (note: We're working on supporting % based ones, so far only 0.5 works, but not 50%) - #2481

When a theme has no token sets active we properly show that in the overview - #2896

Deleting a token group, theme or individual token now shows the confirm dialog in a danger variant - #2647

Bulk remap now supports regex! This was a community contribution that made its way into v2 - #2726

Slightly improved the { mentions input and the suggestion input to offer more space for long token names - #2902

Improved token value inputs to grow in height to adjust for long values! You can finally see what you type - #2721

Fixed display of token names in theme management modal to display long names properly - #2757

When Gitlab sync throws an error that you cannot push to a protected branch, we now surface that to users. - #2822

When editing border tokens, when switching from input mode to reference mode, we now populate the fields with the values of that referenced token - #2823

You can now properly apply min/max-width tokens on layers that are instances. Note that you still are not able to apply this on any instance children, as this is not possible in Figma - #2426

The ‘add new sync provider’ menu has changed positions. You can now find it on the top of that list, and it will trigger a dialog to make space for all the new sync providers we added. - #2623

On the Inspect panel, when using any of the filters and selecting all tokens, and then removing tokens, we now properly only remove tokens that were returned from that filter, instead of all on the layer - #2707

When some styles are not created due to the ignore first part of token name setting, we now show an error message that actually fits in the small toast bar that we get from Figma - #2609

You can now see the resulting base font size token in the Settings screen, letting you know when there's been an override - #2845

When exporting files via the Export dialog we now close that dialog after export - #2841

Previous versions of the plugin had an issue where you sometimes could end up with “ghost” or “duplicate” tokens that would show the wrong value when hovered. We have fixed that bug, but sometimes your token files might still contain those duplicates. For those cases we added a triangle Icon button next to the Apply selector that lets you pick which of the duplicates you want to keep. - #2779

Bug Fixes

Fixed some issues around the token set tree where reordering token sets caused it to get stuck or other weird behaviour. - #2915

Fixes an issue where duplicating a token to another set incorrectly displayed an error message about token names needing to be unique. - #2165

Fixes an issue that caused going from URL storage to Local storage to be in read-only until plugin restart - #1279

Fixed an issue that caused updating tokens that contained a modified reference to update multiple modes at once, instead of just the affected one. - #2416

Fixed an issue with the plugins error boundary, error messages should now show up in the UI again - #2469

Token suggestions now ignore case, meaning you don’t have to type Blue to find a token called blue

Fixed an issue with 0px borders showing up as 0.001px in Figma’s DevMode - #2393

The internal ‘id’ property is now properly stored on the ‘studio.tokens’ key in the ‘$extensions’ object of a token - #749

After creating a new token set we now switch to this new set - #2500

Fixed an issue where cmd+clicking a token allowed you to edit even without edit rights - #2514

Fixed an issue where renaming a theme didn't rename the variable collection created but created duplicates - #2436

Fixed an issue when importing variables that caused created tokens to show up as [object, Object] or NaNrem - #2742

Copy link

changeset-bot bot commented Dec 2, 2023

🦋 Changeset detected

Latest commit: cd25082

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@tokens-studio/figma-plugin Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@six7 six7 changed the title Release 139 (Monorepo, React 18, ..) Release next (Monorepo, React 18, ..) Dec 8, 2023
six7 and others added 28 commits February 29, 2024 19:42
<!--
  Notes for authors:
  - Provide context with minimal words, keep it concise
  - Mark as a draft for work in progress PRs
  - Once ready for review, notify others in #code-reviews
- Remember, the review process is a learning opportunity for both
reviewers and authors, it's a way for us to share knowledge and avoid
silos.
-->

### Why does this PR exist?
When try to duplicate token to another token set with same name, there
is a error alert 'Token names must be unique'.

Closes #2165 <!-- link the related issue -->

<!--
Describe the problem you're addressing and the rationale behind this PR.
-->

### What does this pull request do?
Resolved to duplicate token to other token sets with same name.

<!--
Detailed summary of the changes, including any visual or interactive
updates.
For UI changes, add before/after screenshots. For interactive elements,
consider including a video or an animated gif.
Explain some of the choices you've made in the PR, if they're not
obvious.
-->

### Testing this change
Updated `EditTokenForm.tsx` and added a condition whether the
`activeTokenSet` is included in `selectedItems` (token sets which user
wants to duplicate the token to) list.

<!--
Describe how this change can be tested. Are there steps required to get
there? Explain what's required so a reviewer can test these changes
locally.

  If you have a review link available, add it here.
-->

### Additional Notes (if any)

<!--
  Add any other context or screenshots about the pull request
-->


https://github.com/tokens-studio/figma-plugin/assets/103296157/f1af8a8f-d613-4517-8d2e-77a721fb92a5

---------

Co-authored-by: Jan Six <[email protected]>
<!--
  Notes for authors:
  - Provide context with minimal words, keep it concise
  - Mark as a draft for work in progress PRs
  - Once ready for review, notify others in #code-reviews
- Remember, the review process is a learning opportunity for both
reviewers and authors, it's a way for us to share knowledge and avoid
silos.
-->

### Why does this PR exist?
User can't edit token to add nested levels.

Closes #2386 <!-- link the related issue -->

<!--
Describe the problem you're addressing and the rationale behind this PR.
-->

### What does this pull request do?
This PR gives ability to users to add nested levels to a token.

<!--
Detailed summary of the changes, including any visual or interactive
updates.
For UI changes, add before/after screenshots. For interactive elements,
consider including a video or an animated gif.
Explain some of the choices you've made in the PR, if they're not
obvious.
-->

### Testing this change
The current implementation has a if condition to check the new token
name starts with one of resolved tokens name to check if token share the
same name with group name which is a block to add nested levels.
This PR added a new condition here to check whether the user action is
`create` or `edit` token.

<!--
Describe how this change can be tested. Are there steps required to get
there? Explain what's required so a reviewer can test these changes
locally.

  If you have a review link available, add it here.
-->

### Additional Notes (if any)


https://github.com/tokens-studio/figma-plugin/assets/103296157/f2a98cdd-a053-4487-bbea-ca493ff3c733


<!--
  Add any other context or screenshots about the pull request
-->
…ts (#2498)

### Why does this PR exist?

Closes #2443

Figma recently added support for binding variables to effects such as
shadows. This PR adds support for this.

### What does this pull request do?

Changes seem big - which is because this PR includes a refactor of our
update function to make it WAY easier to parse and add new features. The
big `setValuesOnNode` file has been split into many.

I also added a way to retrieve tokens and references from the plugin
side from a central store instead of passing it through for every
function, i could imagine this was another sort for memory leaks.

This was required as otherwise we would not have a proper way to detect
the connected variables for a value in a composite token, for example a
color in a shadow, or any dimension value in any of the x, y, spread,
values of a shadow. Once Figma release typography variables this will
come in very handy as we'd already be prepared.

### Testing this change

Apply a couple of tokens. Composition tokens, tokens using references.
Create styles, create variables, give it a gooooood test.
- It adds: create token, update token, delete token
- added a key in tokens state to store the token set urns
(`tokenSetMetadata`) where we could add other metadata in the future
- when we pull tokens from Tokens Studio, for each token we also store
the token urn in `$extensions.id`
<!--
  Notes for authors:
  - Provide context with minimal words, keep it concise
  - Mark as a draft for work in progress PRs
  - Once ready for review, notify others in #code-reviews
- Remember, the review process is a learning opportunity for both
reviewers and authors, it's a way for us to share knowledge and avoid
silos.
-->

### Why does this PR exist?

Closes #0000 <!-- link the related issue -->

<!--
Describe the problem you're addressing and the rationale behind this PR.
-->

### What does this pull request do?

<!--
Detailed summary of the changes, including any visual or interactive
updates.
For UI changes, add before/after screenshots. For interactive elements,
consider including a video or an animated gif.
Explain some of the choices you've made in the PR, if they're not
obvious.
-->

### Testing this change

<!--
Describe how this change can be tested. Are there steps required to get
there? Explain what's required so a reviewer can test these changes
locally.

  If you have a review link available, add it here.
-->

### Additional Notes (if any)

<!--
  Add any other context or screenshots about the pull request
-->
no need for a changeset for internal changes
### Why does this PR exist?

Closes tokens-studio/studio-app#792

### What does this pull request do?

Added support for updating data in Tokens Studio from the plugin:
- duplicate token in multiple token sets
- create token set
- rename token set
- delete token set

### Testing this change
https://github.com/tokens-studio/figma-plugin/assets/19837930/24b37553-f547-4619-ae6d-204a8e904e8c
…nment

updated SDK to use prod environment
### Why does this PR exist?

Fixes several 2.0 branch related issues

### What does this pull request do?

Fixes DTCG not being available for local storage sync
Fixes dropdown for importing styles and variables being missing
Fixes create themes button not doing anything (removed it, feels like
we're better off without it here)
Adjusts apply selector size

### Testing this change

should be all good. famous last words.

### Additional Notes (if any)

<!--
  Add any other context or screenshots about the pull request
-->
### Why does this PR exist?

The call to token flow was using axios to trigger the post to token
flow, instead of requiring a package just for that let's use the native
fetch

### Testing this change

Try to launch tokenflow

### Additional Notes (if any)

<!--
  Add any other context or screenshots about the pull request
-->
<!--
  Notes for authors:
  - Provide context with minimal words, keep it concise
  - Mark as a draft for work in progress PRs
  - Once ready for review, notify others in #code-reviews
- Remember, the review process is a learning opportunity for both
reviewers and authors, it's a way for us to share knowledge and avoid
silos.
-->

### Why does this PR exist?
Current implementation exports all sets variables even user changed the
selection of sets.

Closes #2412<!-- link the related issue -->

<!--
Describe the problem you're addressing and the rationale behind this PR.
-->

### What does this pull request do?
Added a useEffect function to catch the unmount event of token sets
selection modal and updated `selectSets` based on user selection.

<!--
Detailed summary of the changes, including any visual or interactive
updates.
For UI changes, add before/after screenshots. For interactive elements,
consider including a video or an animated gif.
Explain some of the choices you've made in the PR, if they're not
obvious.
-->

### Testing this change

<!--
Describe how this change can be tested. Are there steps required to get
there? Explain what's required so a reviewer can test these changes
locally.

  If you have a review link available, add it here.
-->

### Additional Notes (if any)

<!--
  Add any other context or screenshots about the pull request
-->
<!--
  Notes for authors:
  - Provide context with minimal words, keep it concise
  - Mark as a draft for work in progress PRs
  - Once ready for review, notify others in #code-reviews
- Remember, the review process is a learning opportunity for both
reviewers and authors, it's a way for us to share knowledge and avoid
silos.
-->

### Why does this PR exist?

Changes styling of dark figma to be closer to Figma again (neutral
grays)

<!--
Describe the problem you're addressing and the rationale behind this PR.
-->

### What does this pull request do?

Import the newly created darkFigmaTheme from tokens-studio/tokens

<img width="532" alt="CleanShot 2024-03-28 at 08 58 49@2x"
src="https://github.com/tokens-studio/figma-plugin/assets/4548309/e91875e7-a1a1-448d-8d46-17d5228d339f">
…#2565)

### Why does this PR exist?

Closes #2528

### What does this pull request do?

Adds number and dimension token types to a couple of typography
suggested types
### Why does this PR exist?

Closes #2553
### Why does this PR exist?

Closes #2548

### What does this pull request do?

Adds email address to licnse key error message
…oth while exporting to figma (#2560)

<!--
  Notes for authors:
  - Provide context with minimal words, keep it concise
  - Mark as a draft for work in progress PRs
  - Once ready for review, notify others in #code-reviews
- Remember, the review process is a learning opportunity for both
reviewers and authors, it's a way for us to share knowledge and avoid
silos.
-->

### Why does this PR exist?
The current implementation only create styles based on selected sets.

Closes #2411 <!-- link the related issue -->

<!--
Describe the problem you're addressing and the rationale behind this PR.
-->

### What does this pull request do?
Provide a new feature that allow users to create styles based on
selected themes.

<!--
Detailed summary of the changes, including any visual or interactive
updates.
For UI changes, add before/after screenshots. For interactive elements,
consider including a video or an animated gif.
Explain some of the choices you've made in the PR, if they're not
obvious.
-->

### Testing this change

<!--
Describe how this change can be tested. Are there steps required to get
there? Explain what's required so a reviewer can test these changes
locally.

  If you have a review link available, add it here.
-->

### Additional Notes (if any)

<!--
  Add any other context or screenshots about the pull request
-->
### Why does this PR exist?

This is a partial implementation for
tokens-studio/studio-app#819

### What does this pull request do?

This PR adds support for:
- retrieving themes from Tokens Studio to the plugin
- retrieving token set order from Tokens Studio to the plugin and update
Tokens Studio when updates in the plugin are happening
<!--
  Notes for authors:
  - Provide context with minimal words, keep it concise
  - Mark as a draft for work in progress PRs
  - Once ready for review, notify others in #code-reviews
- Remember, the review process is a learning opportunity for both
reviewers and authors, it's a way for us to share knowledge and avoid
silos.
-->

### Why does this PR exist?

Closes #2250

<!--
Describe the problem you're addressing and the rationale behind this PR.
-->

### What does this pull request do?

Introduces ability for styles to link to variables, if the reference is
a pure reference (just `{tokenname}`).

<img width="1000" alt="CleanShot 2024-03-29 at 23 32 12@2x"
src="https://github.com/tokens-studio/figma-plugin/assets/4548309/c55b8db8-95a8-4963-aee1-d7652c187400">

Applies raw value if the reference does not exist as a variable

<img width="1244" alt="CleanShot 2024-03-29 at 23 33 08@2x"
src="https://github.com/tokens-studio/figma-plugin/assets/4548309/7be2035b-58bc-432b-a0ff-07bbc1462704">


Remembers setting if user doesnt want variables in their styles




https://github.com/tokens-studio/figma-plugin/assets/4548309/8e9c2de3-1d86-4b43-94a6-f857f3406f9a



### Testing this change

- Create a token set that has a color token. Create a theme with that,
and create variables so the variable is attached
- Create another token set that references that token, for this set
create styles.
- Note how the created style will contain a reference to the token

### Additional Notes (if any)

<!--
  Add any other context or screenshots about the pull request
-->
… sets (#2586)

<!--
  Notes for authors:
  - Provide context with minimal words, keep it concise
  - Mark as a draft for work in progress PRs
  - Once ready for review, notify others in #code-reviews
- Remember, the review process is a learning opportunity for both
reviewers and authors, it's a way for us to share knowledge and avoid
silos.
-->

### Why does this PR exist?
The current plugin has css issue which the portal modals (`Load
examples` and `Export Styles & Variables modals`) is behind the token
sets entries.

Closes #2585 <!-- link the related issue -->

<!--
Describe the problem you're addressing and the rationale behind this PR.
-->

### What does this pull request do?
Wrapped `DropdownMenu,Content` with `DropdownMenu,Portal`.

<!--
Detailed summary of the changes, including any visual or interactive
updates.
For UI changes, add before/after screenshots. For interactive elements,
consider including a video or an animated gif.
Explain some of the choices you've made in the PR, if they're not
obvious.
-->

### Testing this change

<!--
Describe how this change can be tested. Are there steps required to get
there? Explain what's required so a reviewer can test these changes
locally.

  If you have a review link available, add it here.
-->

### Additional Notes (if any)

<!--
  Add any other context or screenshots about the pull request
-->




https://github.com/tokens-studio/figma-plugin/assets/103296157/8dea4743-5b58-408f-a659-c84776058e95
akshay-gupta7 and others added 10 commits July 30, 2024 23:50
* fix: add update local tokens flag to decide when remote data should be also be cascaded into the plugin

* fix: set remote data in the state after data is pushed to providers

* fix: set remote data in the state after switching providers

* fix: ensure pulling tokens and choosing override sets them correctly

* chore: update tests
* add support to transform number variables

* fix: adds output for variables to true for all float transforms

---------

Co-authored-by: Celia Usero Navarro <[email protected]>
* fix: not a function for convertToFigmaColor when borderColor sides applied

* fix: removing individual border side widths

* fix: tests and strip stroke when all borders are zero

* tests: add border style test case

---------

Co-authored-by: macintoshhelper <[email protected]>
cuserox and others added 7 commits August 6, 2024 09:35
* fix: handle errors from figma when importing variables

* chore: update tests
…ew-in-typo-composition

chore: follow-up to abstract getTokenValueKey and getTokenTypeKey into utility functions
fix: update last synced sate at the same time as remote data
…ed (#3052)

* feat: add token format option to get exact resolved value

* revert the DTCG format

* fix: fix the figma style order reverse and update test cases
…3053)

* fix: export styles with theme prefix correctly

* fix: export styles ignoring first part of the name correctly
* fixes endless loader

* chore: move error to throw inside try / catch

---------

Co-authored-by: Celia Usero Navarro <[email protected]>
six7 and others added 2 commits August 9, 2024 12:25
* adjust how we set remote change when polling

* add new changedpullstate

* fix tests
…eme (#3059)

* feat: add token format option to get exact resolved value

* revert the DTCG format

* fix: fix css to set new theme component sticky on the top

* resolve comment
@six7 six7 marked this pull request as ready for review August 13, 2024 08:33
georgebuciuman and others added 3 commits August 13, 2024 11:33
* 1234: Fix complex tokens for Tokens Studio sync

* Add fix for create composition

* Fix test
…ucket

fix: position of name help text in BitBucket Form
@six7 six7 merged commit df4f9ca into main Aug 13, 2024
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants