From fae327fd7f2ddb13c949a2e0ac6ab3f9b7e506e2 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 24 Nov 2026 09:42:25 +0000 Subject: [PATCH] :books: 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 --- .serena/memories/common/tokens.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.serena/memories/common/tokens.md b/.serena/memories/common/tokens.md index cf6d90f1d8..b9dfe98e65 100644 --- a/.serena/memories/common/tokens.md +++ b/.serena/memories/common/tokens.md @@ -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.