webstudio-is / webstudio

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
https://webstudio.is
GNU Affero General Public License v3.0
5.32k stars 643 forks source link

Merge UI for conflicting Tokens and CSS vars #3490

Open kof opened 5 months ago

kof commented 5 months ago

When I am pasting instances from libraries and other projects I will often copy paste an instance with the same token. If its literally the same token, meaning internal id matches, we already don't duplicate that token, but if token has a different id we will create a new token, potentially leading to creation of tokens with the same name and even with the same styles.

The question is what's the ideal way to resolve these things, comparing styles can be very complex, the simplest algorithm we could think of is going by name, similar to how operating systems

  1. User pastes an instance that has a token with a name that is already in the project
  2. We show a prompt where we ask: "Token X already exists, should we use an existing one?"
  3. If user hits Yes, then we use existing one, if user hits No, we add a new one with a numeric suffix (1)
  4. We add a checkbox "Remember the decision for this token for this session", it will remember the decision per token name, in memory, until user reloads the browser

We need this resolution to work for pasting from ANY source:

johnsicili commented 1 week ago

Related: https://github.com/webstudio-is/webstudio/issues/3442