Skip to content

Fix token-bound text, local token resolution and duplicate component vectors - #1

Open
lazartony wants to merge 5 commits into
bdlukaa:mainfrom
lazartony:fix/numeric-line-height
Open

lazartony wants to merge 5 commits into
bdlukaa:mainfrom
lazartony:fix/numeric-line-height

Conversation

@lazartony

Copy link
Copy Markdown

Hi! I hit a few errors using penpot2flutter on a file that binds typography and colour tokens to text and uses local components. These commits fix them; each has a test (114 passing).

  • Numeric line heights / font metrics (e.trim is not a function): token-bound text can report lineHeight and font metrics as numbers, and fontFamilies as an array. lineHeightMultiplier now accepts numbers and strings.
  • TOKEN_SET_ORDER_INVALID: the local file can appear in penpot.library.connected. Set order is now checked per library, and the local file is skipped when it lists itself.
  • LIBRARY_TOKEN_UNRESOLVED: shapes inside local components have sourceLibraryScope === "local"; their token bindings now resolve against the local file instead of a library.
  • ASSET_NAME_COLLISION: vectors inside component instances were exported once per instance. They're now exported once per component, from the main.

Happy to change anything to fit the project's conventions.

Generated with Claude Code

Penpot reports typography-token line heights (and sometimes font sizes)
as numbers, which crashed lineHeightMultiplier with 'e.trim is not a
function' while resolving design-system dependencies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LtGPP175JALEutZgvZEY2p
TOKEN_SET_ORDER_INVALID compared each set's per-catalog index with its
position in the merged local + shared list, so any extra catalog shifted
the expected index. Also ignore the current file if Penpot lists it among
connected libraries, which would duplicate every local set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LtGPP175JALEutZgvZEY2p
Local component trees are tagged with the current file's id, so their
token bindings were looked up as shared-library tokens and reported as
LIBRARY_TOKEN_UNRESOLVED once the file was no longer treated as its own
connected library.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LtGPP175JALEutZgvZEY2p
Resolved component instances render through their component widget, so
their subtrees no longer add asset candidates. This removes one duplicate
SVG (and an ASSET_NAME_COLLISION) per icon instance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LtGPP175JALEutZgvZEY2p
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LtGPP175JALEutZgvZEY2p

This branch has not been deployed

No deployments
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.

2 participants