Florian Schrödl 3c4ae62db5
⚡ Resolve tokens incrementally with tokenscript (#12437)
With the tokenscript flag every resolution rebuilt the whole library:
each sidebar render, each propagation and each keystroke in a token
form. The adapter now keeps the interpreter state of the last
resolutions and updates it with set-sets, so only the tokens that
changed and their dependents are re-resolved and converted. Every other
output token stays the same object.

- common/deps.edn moves penpot/tokenscript-interpreter to v0.3.0:
  token readers and writers and a set-sets that looks only into changed
  sets (#1), on top of the DTCG import and export (#4) Penpot already
  uses.
- The sidebar, token propagation, token application and the plugin API
  pass the active sets unmerged (cfo/get-active-token-sets and its
  force variant); the interpreter merges them. The plugin API's own
  resolution cache is gone.
- The adapter hands Penpot's token records to the interpreter with a
  reader (value and DTCG type, an error for a token without a value)
  and a writer (the conversion to :resolved-value or :errors), which
  runs only for the re-resolved names.
- The cache resolves new sets from the last resolution with the same
  set ids, else from one sharing a set id, else from scratch.
- The token form controls resolve the draft in a set of its own on top
  of the library's sets, the selected set last
  (cfo/get-token-sets-for-edit). The form leaves the edited token's old
  name out of them (cfo/without-token). A keystroke re-resolves only
  the draft and its dependents. The last draft is cached apart, so
  typing doesn't evict the sidebar's resolutions. Without the flag the
  controls don't build these sets. The plugin API's token name and
  value setters validate the candidate the same way.
- The token form hint shows resolved font families as a name list.
- Tests cover the unmerged set helpers, a plugin rename to a name below
  the old one (which needs the old name left out), and compare renames,
  with and without updating the references, against StyleDictionary.

Signed-off-by: Florian Schroedl <flo.schroedl@gmail.com>
2026-11-20 13:54:15 +01:00
..
2026-11-17 13:28:33 +01:00
2022-11-08 13:02:14 +01:00