mirror of
https://github.com/penpot/penpot.git
synced 2026-11-26 21:00:32 +00:00
📚 Clarify token source and activation rules
Distinguish detaching a token source from absorbing its library and record when a direct set change clears active themes. AI-assisted-by: gpt-6.1-terra
This commit is contained in:
parent
71cd3c5bd5
commit
fae327fd7f
@ -1,7 +1,8 @@
|
||||
# Design tokens
|
||||
|
||||
- Start at `app.common.types.tokens-lib`, `app.common.types.tokens-status`, `app.common.files.tokens` and `app.main.data.workspace.tokens`. Current file activation is stored separately in `TokensStatus` as theme and set IDs. Legacy `TokensLib` activation and its hidden theme support import and migration; workspace theme lists hide that internal theme.
|
||||
- `get-tokens-in-active-sets` resolves the status's active set IDs in library order, so later active sets override earlier tokens with the same name. Activating a theme deactivates other themes in its group and recomputes active sets; directly changing a set clears active themes. When migrating legacy data, `make-tokens-status-from-lib` converts active paths and sets to IDs.
|
||||
- `get-tokens-in-active-sets` resolves the status's active set IDs in library order, so later active sets override earlier tokens with the same name. Activating a theme deactivates other themes in its group and recomputes active sets; `set-set-active` clears active themes only when the set exists and its state changes. When migrating legacy data, `make-tokens-status-from-lib` converts active paths and sets to IDs.
|
||||
- A file using an external `:tokens-source` can retain its own inactive tokens library and `:own-tokens-status`. `detach-tokens-source` returns to that library and restores the saved status, or removes the status if none was saved. `absorb-tokens-lib` instead copies an available external library into the file, preserving the file's current status when present; see its docstring for missing-library cases. Source and status tests are in `common/test/common_tests/files/tokens_test.cljc` and `frontend/test/frontend_tests/tokens/logic/tokens_source_test.cljs`.
|
||||
- DTCG export omits the internal hidden theme; the status-aware path derives `activeThemes` and `activeSets` from `TokensStatus`, while the legacy overload derives them from the library. Single-set imports reject input with no supported tokens. Multi-set imports normalize names, omit unsupported token types and ignore theme references to missing sets; `import-decoded-json` reports dropped or unknown input.
|
||||
- Shapes store token names in `:applied-tokens`, not IDs. Token and group renames must update those paths. Transport uses Transit handlers; internal file-data storage uses Fressian handlers and migrations for older token-lib versions.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user