* ✨ Add an options button to color assets
Color assets could only be renamed, edited, duplicated or deleted from
the right-click menu, which tablet users can't open. Add a three-dot
options button, like the one on typography assets, that opens the same
menu below the button. It shows on hover and focus, and stays visible on
devices without hover.
Closes#12618
AI-assisted-by: Claude Opus 5.5
* 🐛 Keep the color asset options button reachable by keyboard
The options button was hidden with visibility, which also takes it out
of the tab order, so :focus-within could never reveal it from the
keyboard. Hide it with opacity instead, so Tab reaches the button and
shows it.
Open the menu through one helper for both the right click and the
button, so both keep clearing the selection first.
AI-assisted-by: Claude Opus 5.5
* 🐛 Toggle the color asset menu and fix its row and focus
---------
Co-authored-by: Luis de Dios <luis.dedios@kaleidos.net>
* 🐛 Show the full library name in a tooltip when it is cut
Long library names are cut with an ellipsis in the Libraries modal and
in the Assets panel, with no way to read the full name, so libraries
that share a long prefix cannot be told apart.
A new truncated-text* component shows the text and, only while CSS cuts
it, wraps it in the DS tooltip with the full text. A ResizeObserver
checks the size again when the box changes; it follows the node that the
tooltip mounts, so the tooltip also goes away when the text fits again.
The Libraries modal (new and legacy layouts) and the library titles in
the Assets panel use it.
Closes#13223
AI-assisted-by: claude-opus-5-5
* 🐛 Keep a cut library name visible inside its tooltip
The DS tooltip trigger sets line-height: 0. A cut name inside it
inherited that value and collapsed, so the Assets panel hid the name of
a long shared library. The trigger of truncated-text* now inherits the
line height of its parent through an inline style; a class would tie
with the trigger class and depend on the order of the stylesheets.
AI-assisted-by: claude-opus-5-5
Hovering a grid frame requested a full render. That clears the
canvas and walks every visible tile even though the overlay is
only UI. show_grid and hide_grid now re-present the last frame.
Warn that recovery may discard unsaved edits instead of implying that
reopening is the only recovery path. Update the API docs and test.
AI-assisted-by: gpt-6.1-terra
* 🐛 Keep fitted content clear of the rulers
Fit actions pass padding in document units, so the margin on screen
shrinks with the zoom. On large designs the margin became smaller than
the fixed 22px ruler overlay and part of the content was hidden under
it.
Add a :min-screen-padding option to adjust-to-viewport. The existing
design-space padding is kept when it already leaves enough margin on
screen; otherwise the viewport is fitted again with a fixed screen
margin. Use it in fit-to-all, fit-to-selected and fit-to-shapes so all
fit paths behave the same at any zoom level.
Closes#12609
AI-assisted-by: deepseek-v4.1-flash
* 🐛 Keep page-open fits clear of rulers
Pass the minimum screen padding when initializing the viewport, and cover all
four fit margins for wide and tall content with the call-site minimum zoom.
AI-assisted-by: gpt-6-luna
Switching a variant copy that sits inside another copy dropped a component
swapped inside it, and the new variant showed its default child. Undoing
a variant switch also lost a swapped child: the old variant came back with
no child in that place.
When the swap was made in the copy, the original shape of the swapped
child was looked up from the nearest main, which is the copy in the outer
main, so it had no match in the variant main. Look it up from the match
of its parent in the variant main instead.
When the swap was made in the outer main, the child had no slot of its
own, so it was deleted with the old copy and never moved. The new
ctf/get-outer-swaps finds these heads by walking their ref chain up to
the variant main. The delete step and keep-touched both use it, so they
pick the same heads: kept off the delete list, moved into the new copy
and pointed to the swapped-in component, with the slot of the child they
replace. The walk that advances the refs of a subtree moves to
ctf/get-advanced-refs, which the clipboard now shares.
When the switch kept a swapped child, the undo of its move into the new
copy put it back under the old copy id. That id is also the id of the new
copy, so undoing the creation of the new copy removed the child.
change-parent now takes the undo parent from its objects, as it already
did for the previous sibling.
When the new variant had no match for a swapped child, the child was
removed with the old copy, with no undo entry. Move it to the root first
and delete it from there, after the rest of the switch, so undo brings it
back after the old copy.
Closes#13179Closes#13181
AI-assisted-by: claude-opus-5-5
Plugins and the MCP could not tell whether the new render engine (WebGL)
or the SVG engine draws the open file.
Add file.features with the sorted features of the open file: its stored
features plus the features active in the session. render-wasm/v1 comes
from the session alone, so it is present only when WebGL draws the file,
whether the renderer comes from the wasm query param, the profile setting
or the workspace menu. The backend never stores that feature on the file,
so the stored features alone cannot answer it. For any other file, such
as a library or a File kept after opening another file, features is null.
Add penpotUtils.isWasmRenderer() to the MCP plugin and list it in the
MCP instructions. It throws a clear error when the Penpot version does
not expose the file features. Regenerate the MCP API docs, which also
picks up the missing penpot.location entry, and the plugin API test
suite surface.
Add plugin API test suite tests for the open file and for a file that is
not open. Note in the plugins memory that every new or changed Plugin API
member gets a suite test whenever the suite can reach the case.
Closes#13167
AI-assisted-by: claude-opus-5-5
* 🐛 Fix batch edit of colors in the selected colors menu
Restore the colorpicker flag that commit 20d2d22 lost when it replaced
the flag with the row index. Every change was treated as a picker change,
so the colors already applied were kept and reused by the next edit. That
made an edit on one row change the first color instead.
Direct edits of the color and opacity inputs now target the exact color
of the row. Picker changes keep the previous-color fallback needed while
the selected shapes are still updating.
Add unit tests for the new operation resolver.
AI-assisted-by: deepseek-v4.1-flash
* ♻️ Remove unused picker history from token detachment
Resolve token detachment operations directly from the current groups.
Picker color history is not needed for token detachment.
AI-assisted-by: gpt-6-luna
* ♻️ Clarify color row change arguments
Bind the row color once and name the change arguments.
Treat the picker flag as optional for direct edits.
AI-assisted-by: gpt-6-luna
* 🐛 Fix linting issue
Both menus get a Copy link option after Move to. The file menu copies
the workspace URL of the file and the project menu the URL of the
project page, then show a confirmation toast. A copy error shows a
toast that closes on its own; errors that are not clipboard ones are
also logged.
Also tidy both menus:
- Add a separator before Import Penpot files in the project menu.
- Rename "Open file in a new tab" to "Open in new tab".
- Add a separator before the download option in the multiple files
menu, as in the single file menu.
- Show Pin or Unpin depending on the project state.
Viewers already had no project menu in the project list and on the
project page. Disable it, and rename on double-click, for pinned
projects in the sidebar too, so viewers can copy file links but not
project links. The user guide documents both options.
New translation keys are in en and es only.
Closes#13182
AI-assisted-by: claude-opus-5-5
Page switches tear down the WebGL canvas before openPage resolves, so
font-stored? must not call _is_font_uploaded against a null resource
pool. Guard with wasm/live? like the other font FFI helpers, and cover
the skip path with a unit test.
Closes#13205
* 🐛 Center the disabled invite button in the empty invitations state
The disabled button sits inside a tooltip trigger, a fit-content grid
that the text-align of the empty state does not center. Center the
trigger with auto inline margins.
Closes#13173
AI-assisted-by: claude-opus-5-5
* 🐛 Make the disabled primary button label readable in the light theme
In the light theme the label of a disabled primary button used the
background secondary color on the muted accent background, so both were
almost the same. Use the tertiary accent for that label in the light
theme only, as design asked. The dark theme keeps its colors.
Closes#13171
AI-assisted-by: claude-opus-5-5
* 🐛 Check pages added with a full page value in soft mode
An :add-page change can carry a whole page under :page instead of an
id and a name. extract-affected-ids reads the page to check from the
change's top-level :id, so that form left the new page unchecked and
a referential error in it was stored.
Collect those page ids after the changes are applied and run the
affected check on them in soft mode: log the file id, the page ids
and the error codes, and never refuse the save. This is the first
step of the two-step rollout. The follow-up moves the page id into
extract-affected-ids and makes the check hard. The counters of
#12665 decide when to flip it.
Relates to #12666
AI-assisted-by: claude-opus-5-5, deepseek-v4.1-flash
Signed-off-by: Álvaro Tejero Cantero <alvorithm@teje.ro>
* 🐛 Collect the page of a whole-page add-page in the affected check
An `:add-page` change that carries the page alone, with its id inside
`:page` and none at the top level, escaped the referential check:
`extract-affected-ids` read only the top-level `:id`. The schema side
(`touched-page-ids`) already reads `(or id (:id page))`; the referential
side now does the same.
This replaces the separate soft-mode check of the first commit. The page
now goes through `validate-file-affected` like any page a save touches,
so the deployment's flags decide whether an invalid page is refused
(`:file-validation`) or only logged (`:soft-file-validation`), and no
second log hint or rollout step is needed.
AI-assisted-by: claude-opus-5-5
* 🐛 Check the page an add-page stores, not its top-level id
An :add-page that carries the page whole stores it under the id inside
:page. extract-affected-ids and touched-page-ids read the top-level :id
first, so a change whose two ids differ stored one page and checked
another, which does not exist. Both now read the id of the page first.
The unit test of the affected check moves to the common validate tests,
with a case for the differing ids on the referential and the schema
side. The backend test sends that form through update-file as well,
and a new test sends the page as a commit group, the way the editor
does, and expects the commit under :rejected and no stored page.
AI-assisted-by: claude-fable-5-2
* ♻️ Derive the add-page change ID from the page
Use the page ID for both redo and undo so the builder cannot emit
conflicting IDs. Keep the change format and the library API unchanged.
AI-assisted-by: gpt-6.2-sol
---------
Signed-off-by: Álvaro Tejero Cantero <alvorithm@teje.ro>
Co-authored-by: Andrey Antukh <niwi@niwi.nz>
* ♻️ Reduce the routes, viewer, theme and typography e2e specs
The five specs of Task 10 (routes, theme, viewer and roles) go from 14
tests to 6, and the two of Task 11 (missing font and add typography)
from 9 to 4. Nine unit tests cover rules that had none: five for the
private legacy-match and four for the viewer frame navigation. No
skipped test and no fixture removed.
The browser keeps the wiring: the known and unknown hash as two steps
of one test, the theme applied live without a reload, the viewer role
walked in two loads with the context menu counted instead of trusted,
and the typography states merged around shared fixtures. The viewer
zoom click comes back as a header step; the arrows e2e becomes unit
tests, with the Next button still clicked by the child-click test. The
missing-font test asserts the renamed, disabled typography button
instead of a hidden one it never described.
WorkspacePage gains reloadWorkspace, which clears the socket registry,
reloads and reopens the mock, and settles on the sitemap page name or
on the canvas when the restored sidebar tab hides it. layerRow matches
rows by anchored text, because a selected row's action buttons can join
its accessible name, and selectLayer accepts click options for the
shift-click steps. The font specs use both and no longer import
MockWebSocketHelper.
The viewer role asserts its two absences by testid: new-project-button
already existed and add-custom-font is new in fonts.cljs, the only
product change, with the visible side covered by dashboard.spec.
routes_test adds the path-params case for legacy-match; viewer_test
asserts the first event and the page id of the frame navigation, and
watch-events delivers asynchronously and handles the nil a watch can
return.
Measured at four workers: 23 to 10 tests; Task 10 from 141.3 to
68.5/72.3 worker-seconds and Task 11 from 150.1 to 109.0/109.3.
Closes#13058
AI-assisted-by: deepseek-v4.1-flash
* 🐛 Let the two reduced e2e steps fail when they should
The typography step selected the next layer with Shift, which in the layers
panel is a range selection: the range also brought in the text with a
typography token, so the button was hidden by the applied token and not by
the mixed values. A mod-click adds only that shape, and two new assertions
keep the token and the asset texts out of the selection.
The logo step clicked 100 px below the logo and asserted the URL, which
potok updates after the click returns, so the assertion matched the old URL
on its first poll. Probing elementFromPoint under the logo answers the
hit-area question directly.
AI-assisted-by: deepseek-v4.1-flash
* 🐛 Repair variant property set when removing a property
Removing a property could leave two variants with the same value
combination. The remaining property vectors now go through
ctv/sanitize-properties-set, and each main's variant name is refreshed, so
the set stays valid, as the 0038 migration leaves it.
On a clash, the variant higher in the layers panel keeps its values and
the lower one gets a " (n)" suffix. The plugin docs for removeProperty
say so.
The rename-in-layers path removes properties that are empty in every
variant. That cannot make two variants equal, so it skips the clean-up:
a duplicate made by the rename stays and its warning shows.
Closes#12959
AI-assisted-by: claude-opus-5-5
* 🐛 Keep the top variant on a clash in migration 0038
Migration 0038 cleaned the members of a set in :shapes order, so on a
value clash the bottom variant in the layers panel kept its values and
the top one got a " (n)" suffix. The top variant is the primary one, and
removing a property already keeps it. update-variant-container-properties
now passes the members top first, so both paths agree: the primary
variant keeps its values and its property names lead the set. 0038 is
not in a release yet, so it changes in place.
The removeProperty plugin docs now cover three or more clashing variants
and all-blank values, and the plugins CHANGELOG has an entry for the fix.
AI-assisted-by: claude-opus-5-5
The MCP controller restarts its runtime when the profile id changes, and
it compared ids by object identity. Leaving the workspace clears the
transit uuid cache, and on the first visit it also saves the
workspace-visited prop, which reloads the profile. The reloaded id came
back as a new uuid instance, so MCP init ran again: it closed the plugin,
dropped the WebSocket and left the new plugin disconnected.
Compare profile ids by value, and add a regression test that sends the
same id as two distinct uuid instances.
Closes#13128
AI-assisted-by: claude-opus-5-5
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>
The component sync emits a `:reg-objects` for the parents of every
shape it touches, so a component swap collected 291 of them for 36
containers. Recomputing a group's geometry N times in a row gives the
same result as doing it once, so most of that work was thrown away,
in the browser and on the server, on every save.
`mch/merge-reg-objects` collapses them into one per container, with
the union of the shapes. The merged change moves to the end of the
batch: a group has to be recomputed after the shapes that resized
it, not before, or it keeps a stale `:selrect` until something else
touches it. That is also why it must not stay in the position of the
first change it replaces.
It runs on every commit, redo and undo alike, so the undo stack gets
the same benefit, and again when the buffer is batched for saving.
Measured on the swap that motivated this: 291 `:reg-objects` become
36, and the batch goes from 806 changes / 6.4 MB to 551 / 324 KB.
AI-assisted-by: space-bunny
Move the pure subscription rules out of the browser specs and into unit
tests, then keep only the cases a browser can prove.
- Extract show-manage-subscription-link? and show-main-menu-power-up? from
the dashboard team panel and the workspace main menu, and use them at
both call sites. A new subscription_dashboard_test.cljs covers which
plan a subscription reads to, including unpaid and canceled demotion, the
owner and enterprise sides of both affordances, and the banner and
members-CTA boundaries: four editors over the seats, no usage data, and
the demoted plans.
- Add get-versions-stored-days tests to workspace_versions_test.cljs: an
active nitrate or enterprise license keeps 90 days, a canceled one lets
the team plan decide, a license without the admin console does not count,
and unlimited, enterprise, professional and planless teams keep 30, 90
and 7 days.
- Rewrite the profile usage tests as async tests with mock/with-mocks* and
an async transport double: the editors from the usage call reach
[:props :subscription :editors], a failing call leaves the profile
untouched and logs once, and the call is skipped without the
subscriptions flag.
- Cut the e2e suite from 13 cases to 7. Five dashboard cases keep the menu
icon, the two sidebar plan names, the owner-only settings link and the
members CTA; two workspace cases keep the translated days warning with
the upsell step and the enterprise menu with no upsell. Assert the
unlimited glyph and drop the CTA count.
- Drop the three get-team-info mocks the dashboard never calls and six
unreferenced subscription fixtures, reusing the invitations fixture.
- Sort the subscription test requires in runner.cljs: cljfmt's
:sort-ns-references? wants subscription-dashboard-test first.
Closes#13005
AI-assisted-by: deepseek-v4.1-flash
When pasting, read each child to advance from the objects being built,
not from the page, so a later change to the parent cannot make it read a
stale shape.
Fix the docs of ignore-children-fn in get-children-ids and delete-shapes:
it receives a shape id, not a shape.
Add a unit test for ctf/get-swap-level, a paste test where the swap sits
at the last level the copied head drops, and a detach test where the
swapped copy sits under two non-swapped nested copies.
AI-assisted-by: claude-opus-5-5
Copying a copy nested inside another copy moved the shape-ref of every
shape under it up by the same number of levels. Below a nested copy that
was swapped in one of the dropped levels that count is too high: the swap
already points it into the swapped-in main, so its children ended up one
level too far and the paste failed to save with :missing-slot.
Count the levels per nested head instead, stopping at the level where it
was swapped (new ctf/get-swap-level), for the copied head too. The ref
chain used to collect touched flags now also follows deleted components,
like advance-shape-ref already did, so inherited slots are kept.
Closes#13076
AI-assisted-by: claude-opus-5-5
* ✨ Explain why a library cannot be disconnected in its modal
A library that another connected library uses cannot be disconnected from
a file, but the Libraries modal showed it with the same disconnect button
as any other library, only disabled, and said nothing about why.
Replace that button with an icon and a tooltip. A nested library ("Connected
through ...") says it is inherited from its parent, and a direct library
that another connected library uses says which one. Both name the library
to disconnect first. A library nothing else uses keeps its button.
library-disconnect-hint decides the case from the same data the disabled
state used, so the buttons that were disabled are the ones that change.
The legacy libraries tab keeps its button.
Closes#12838
AI-assisted-by: claude-opus-5-5
AI-assisted-by: claude-sonnet-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
* 🐛 Name every library to disconnect in the disconnect hint
The hint named only the parent of a nested library as the one to
disconnect. That was wrong when several libraries use it (disconnecting
one leaves it linked through the others) and no help when the parent is
nested too and has no disconnect button either.
The removal step now lists the libraries the user can actually disconnect:
those that use the library directly or through others, and that no linked
library uses. The parent is still named as the reason it is inherited. In
a cycle nothing is removable, so the parent is named as before.
Tests cover a shared dependency, a deep chain and a cycle.
AI-assisted-by: claude-opus-5-5
AI-assisted-by: claude-sonnet-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
* 🐛 List directly linked libraries in the disconnect hint
A library linked to the file directly stays until the user disconnects
it, even when another linked library uses it. The hint skipped those: for
a file linked to A and B, with A using B and B using C, it told the user
to disconnect only A, and C stayed linked through B.
Collect the libraries that use it, however far up, and that are either
linked directly or used by no linked library. A directly linked library
that another one uses cannot be disconnected yet, and its own tooltip
says to disconnect that one first.
The test covers a directly linked intermediate library.
AI-assisted-by: claude-opus-5-5
AI-assisted-by: claude-sonnet-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
* 🐛 Count a library linked in this session as direct in the hint
Only the libraries fetched when the workspace opens carry :is-indirect.
One linked afterwards comes back without it, so the hint did not treat it
as directly linked: after connecting B (which uses C) and then A (which
uses B) without reloading, C's tooltip said to disconnect only A, and C
stayed linked through B.
A library the user linked has no flag and is direct by construction, so
only one known to be indirect is skipped.
The test covers that sequence.
AI-assisted-by: claude-opus-5-5
AI-assisted-by: claude-sonnet-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
* 🐛 Flag libraries linked in this session as direct or indirect
Only the libraries fetched when the workspace opens carried :is-indirect.
Linking a library afterwards loads it and its dependencies through
load-library-file, and none of them got the flag, so a missing flag could
mean either. The disconnect hint in the Libraries modal reads it to tell
which libraries the user can disconnect, and it listed the wrong ones for
a chain connected in the same session (it named a dependency that has no
disconnect button).
Set the flag where the library is loaded: the library the user links is
direct and the libraries it brings in are indirect. The hint is back to
trusting only a flag that says false, because a missing one no longer
means a direct link.
The test links a library with one dependency and checks both flags.
AI-assisted-by: claude-opus-5-5
AI-assisted-by: claude-sonnet-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
* 🐛 Keep a library's direct flag when it is loaded twice
When links overlap, a library can be requested twice: once because the
user linked it and once because a library linked right after brings it
in. Each load stored its own :is-indirect value, so whichever answer
landed last won, and an indirect one could erase the direct link. The
disconnect hint then listed the wrong libraries.
Store a loaded library through one event that never turns a known direct
link into an indirect one. The reverse order already ends direct, since
the user's link is stored with the flag false.
The test links a library and then one that uses it before the first
answer arrives, and answers in the order that used to lose the flag.
AI-assisted-by: claude-opus-5-5
AI-assisted-by: claude-sonnet-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
* 🐛 Scope a library's kept direct flag to the file it belongs to
The flag kept when a library is loaded twice was read from :files, which
outlives a workspace. A library that was a direct link of the file visited
before could keep that flag in the next file, where another library only
brings it in, and the disconnect hint then listed one library too many.
Keep the flag only when it was recorded for the file being loaded, using
the :library-of the entry already carries.
The test leaves a library flagged direct for another file and links a
library that brings it in.
AI-assisted-by: claude-opus-5-5
AI-assisted-by: claude-sonnet-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
* 💄 Name the libraries in the disconnect hint as design asked
The nested library hint now reads "Connected through <parent>. To
remove it, disconnect <libraries>." instead of "Inherited from ...".
The library names in both hints (connected through and used by) show
in the primary foreground color, so they stand out from the text.
The translation is split on its two placeholders instead of rendered
as HTML, because the library names are written by users. The full
plain sentence stays as the aria label of the icon.
The new key is workspace.libraries.connected-through-hint, since
workspace.libraries.connected-through already labels the parent in the
list.
AI-assisted-by: claude-sonnet-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
---------
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
Co-authored-by: Eva Marco <evamarcod@gmail.com>
* ✨ Copy stable deep link to selected boards from context menu
The workspace "Copy link" action copied the raw current location, which
only carries file and page ids, so the link did not point at any specific
board. Build the link from the current route plus a `board-id` query param
derived from the selection: a selected board contributes its own id, and a
selected shape contributes the id of the board it belongs to.
`board-id` is an existing workspace route param (`zoom-to-frame` already
selects and zooms to it on load), and board ids are stable across renames
and reordering, so the link keeps resolving to the same board. When the
selection contains no board, it falls back to the previous behavior.
Relates to #4584
AI-assisted-by: claude-opus-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
* 📎 Add tests for copying a stable board link
copy-link-to-clipboard now links to the boards of the selection through
their ids, and nothing covered it. The tests run the event on a state
with two boards, a rectangle in each and a rectangle on the root, with
the router and the clipboard replaced.
They check that a selected board, and a shape in a board, link to that
board; that shapes in two boards link to both and a board with its child
gives one id; that the route params are kept next to the board ids; and
that an empty selection, or a shape on the root, copies the current
location. The five board cases fail on the version of the function before
the change.
AI-assisted-by: claude-opus-5-5
AI-assisted-by: claude-sonnet-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
* ♻️ Share how the selection maps to its boards
select-shape and copy-link-to-clipboard each worked out which boards
a selection belongs to, with slightly different rules for a shape on
the root. Both now call selected-board-ids.
A selection with a shape on the root has no board to point at, so the
URL and the copied link both leave out the board ids. Before, the
copied link kept the boards of the rest of the selection. The URL also
lists each board once now, and has no board-id for an empty selection.
AI-assisted-by: claude-opus-5-5
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
---------
Signed-off-by: Filip Sajdak <filip.sajdak@siili.com>
Co-authored-by: Eva Marco <eva.marco@kaleidos.net>
After a font size change on a main text, the main resizes itself in a
commit that stacks onto the edit's undo entry. That commit still took
the group its undo transaction was opened with, and the component sync
it starts inherited that group. So the sync became a separate undo
entry: the first Ctrl+Z undid only that sync, the copies were measured
again right away, and nothing visible changed. The user had to press
Ctrl+Z twice to undo the edit.
A stack-undo? commit that records undo (save-undo? and undo changes,
the same test the history watcher uses) and has no undo group of its
own now takes the group of the entry at the current undo index. The
commits it starts, such as the component sync, inherit it, so one
Ctrl+Z reverts the edit, the resize and the sync.
A stacked commit that records no undo joins no entry, so it keeps a
group of its own: the automatic text heals must not take the rollback
unit of the user's last action. A stacked commit that joins an open
transaction that already holds changes keeps the transaction's group,
as append-undo adds it to the transaction.
The rule for commit groups in
mem:frontend/workspace-state-persistence-subtleties now includes the
stacked-entry step.
Tests: frontend-tests.data.workspace-undo-test covers a stacked commit
with no transaction, in an empty transaction and in a transaction that
already holds changes; a stacked commit that records no undo; and one
undo over an edit, its stacked commit and a follow-up commit of the
same group. frontend-tests.data.workspace-heal-undo-test drives the
real resize-text and component watcher on a main text with a copy:
one undo reverts the edit, the resize and the syncs on both.
Closes#13207
Relates to #12721
Relates to #13065
AI-assisted-by: claude-opus-5-5
On the WebGL renderer, a face that failed to load counts as ready,
because WASM lays the text out with a fallback font. The page-open
check skipped only texts waiting for a font, so it measured texts with
a failed face using the fallback and saved that size with no undo
step, on every page open. A team font that was deleted or returns 404
changed the size of every auto-grow text using it.
The check after fonts load had the same problem: a face that was
pending at page load and then failed was measured with the fallback
and resized, also without undo.
Both checks now skip texts that use a failed face, as the SVG :check
phase already does. The font relayout still runs for them, so they
show in the fallback font, but their stored size stays as it was.
app.render-wasm.api.fonts/font-failed? reports a failed face, and
shape-ids-for-failed-fonts finds the texts that use one.
Tests: frontend-tests.render-wasm.stale-text-selrects-test covers a
page load and a font load where one stale text uses a failed face;
only the other text is resized. The tests now mock font-failed?, so
they do not read failed faces left by other tests.
Relates to #12721
AI-assisted-by: claude-opus-5-5
On the WebGL renderer, a sync re-measure of copies shared a 40 ms
batch with user resizes of the main text. The batch skipped the
component sync when any request asked for that. So a resize of the
main (grow type, font size, paste, search and replace) often never
reached copies on other pages or in other files, and the viewer and
exports showed the old size.
A batch now skips the sync only when every request asks for it, the
same rule as :save-undo?. Such an edit costs one extra short sync
round. That round holds only skip requests, so it stops after one
pass.
A copy that the sync switched from fixed to auto-grow was never
re-measured, because the check read the grow type before the sync.
The check now reads the grow type that the change sets. A copy that
the sync makes fixed is not re-measured.
A sync started without an undo group (library update dialog, color
and typography sync) committed with a fresh group, and its re-measure
and layout pass took other ones. Ctrl+Z first undid only the
re-measure and left the copies in the old box. The sync now picks its
group when it runs: inside an undo transaction (color, typography and
asset deletes) it takes the transaction's, otherwise a fresh one. The
re-measure and layout pass share it, so one undo reverts the edit, the
sync and its follow-ups, and a failed save rolls them back together.
On the SVG renderer, opening a page resized a copy with no position
data even when its size had not drifted. Measured sizes round up, so
17.4 became 18. The measurement from that resize then landed on the
user's last undo entry. The heal now reports whether it resized, and
the check phase resizes only when the size drifted.
The SVG page-open check covered only texts with overridden content.
A copy loses its touched flags, so a label overridden inside a main
(a Button label in a Card main) was never checked in the main's
copies, and its heal skips the component sync. The check now covers
every auto-grow text inside a copy, as the WebGL check does. The
heal's reflow now skips the component sync too: without undo it
touched the main component on every page open.
A page-open check measured with a font that failed to load wrote the
fallback font size. It now writes no size then; a copy without
position data still gets it. The WebGL and SVG renderers can measure
a text differently; a gap over 1 px makes each page open by a user of
the other renderer write the size back. Two browsers on the SVG
renderer can do the same: a long auto-width line can differ by more
than 1 px, and an auto-height text can wrap a line differently. This is
a known limit, noted in the text-heal docstring.
The drift check moves to text-size-drifted? in
app.common.geom.shapes.text, and takes a tolerance. Both renderers use
it: 1 px for the SVG check and the WebGL page-open check, 0.1 px for
the WebGL font-load check. The WebGL check did not skip axes that fill
their layout parent, so those texts looked stale on every page open
and were resized for nothing. It now reads the stored width and height
and skips fill axes.
The sync docstring and a test message gave the wrong reason for
:skip-component-sync?. :ignore-touched stops the resize from marking
:geometry-group. :skip-component-sync? stops the re-measure commit from
starting another sync. "Remasure" is now "re-measure" in
identifiers, test names and comments. The sync docstring now states
that an auto-grow copy takes the main's size on each geometry sync,
also with overridden content, until the re-measure or the page-open
check corrects it. The sync's undo comment no longer says the layout
pass gets the sync's undo group: the layout buffer drops it, and the
pass joins the same undo entry through :stack-undo?.
Tests: heal undo tests cover mixed user and sync batches in both
orders, and undo for both renderers. A heal leaves the undo stack
unchanged, and undo reverts the user edit. A heal reflow skips the
component sync. Sync tests cover a copy that becomes auto-grow
(re-measured) and one that becomes fixed (not), and a sync with no
undo group that shares one with its re-measure, also inside an undo
transaction, with and without a group of the edit. Viewport tests cover
no resize without drift, a drifted copy that resizes and settles, the
check of every auto-grow text in a copy, and no size write from a
failed font. Component tests mount the SVG renderer: a drifted copy is
measured once to check and once to settle, with no undo step, and a
matching copy is measured once. Stale-selrect tests cover skipped fill
axes. The drift tests move to common-tests.geom-shapes-text-test, with
tolerance and grow-type cases.
Relates to #12721
AI-assisted-by: claude-opus-5-5
On the WebGL renderer, a sync from a main component re-measures every
auto-grow text it changes on the page. The sync runs on every edit to
a main component, so an edit that cannot change a text size, such as
opacity, shadow or text color, still re-measures and re-lays out every
synced text.
The sync now re-measures a text only when the change sets an attribute
that can change its size: :grow-type, :width, :height,
:layout-item-h-sizing, :layout-item-v-sizing, or :content that differs
in more than its fills. A text color change reaches copies as a
:content change, so fills are removed from both contents before
comparing. Sync emits operations only for attributes that changed, so
the operation attributes are enough. Moves (x and y only) do not
re-measure.
Tests: frontend-tests.data.workspace-sync-text-wasm-test adds cases for
a fill change and an opacity change on the main text (no re-measure),
and for a font size change and a width change on an auto-height text
(re-measure).
Relates to #12721
AI-assisted-by: claude-opus-5-5
On the SVG renderer, opening a page measures auto-grow text copies
with overridden content and writes back their size and position data
when they drifted. The write went through the normal text commits,
which stack onto the user's last undo entry. So the first Ctrl+Z after
opening a page also reverted the heal.
A component sync also set the position data of a copy to nil, even
for a fill change on the main. Such a copy skipped the check and went
through the normal path, with undo.
Heal requests now take :save-undo? false. resize-text and
update-position-data accept optional opts, and a request with
:save-undo? false marks its text as a heal for the current batch. A
later user request for the same text in the batch removes that mark.
The batch commit splits in two. User texts commit as before. Heal
texts commit with :save-undo? false and :skip-component-sync? true,
so each copy heals on its own page open instead of syncing.
The heal resize asks for the parents' reflow with :save-undo? false.
The layout buffer lays out heal updates apart from user ones and
passes the flag to apply-modifiers, so the reflow records no undo
step either.
The :check phase also heals a copy without position data, with no
undo. When the size drifted, the text moves to a new :settle phase.
The measurement that the heal resize causes also commits without undo.
Known limit: when the heal's reflow moves the text (for example,
re-centering it in a flex parent), the renderer measures the text
again with no phase. That position-data commit still stacks onto the
last undo entry. Left for a follow-up.
Tests: frontend-tests.data.workspace-heal-undo-test (SVG store) covers
a heal resize with no undo, no component sync and a reflow without
undo; a heal and a user change in one batch; a user request after a
heal of the same text; and the layout buffer keeping a heal's reflow
apart. frontend-tests.ui.viewport-texts-html-test covers the options
each phase sends: drifted copy, matching copy, copy without position
data, unmeasurable text, settle, and no phase.
Relates to #12721
Relates to #13065
AI-assisted-by: claude-opus-5-5
On the WebGL renderer, the workspace resizes auto-grow texts whose
stored size no longer matches their WASM layout. This runs when a page
opens and when fonts finish loading. These resizes are not user
actions, but each one recorded an undo step. So the first Ctrl+Z after
opening a page undid the resize instead of the user's last edit, and
the copy went back to the wrong size.
The listener for the stale-text event now asks for the resize with
:save-undo? false. The flag passes through the resize debounce to the
commit, which hands it to apply-wasm-modifiers, so the shape update
records no undo step.
Resizes are batched in a debounce window. A batch skips the undo step
only when every request in it asked for that. A user resize that lands
in the same window keeps its undo entry. Batch options are now merged
for every request, including those without options, so this check
works.
Tests: frontend-tests.data.workspace-heal-undo-test covers a heal
resize that commits without an undo step, a resize without the flag
that still records one, a mixed batch that keeps the undo step in
either order, and a batch of heals that skips it.
Relates to #12721
Relates to #13065
AI-assisted-by: claude-opus-5-5
On the SVG renderer, a text is measured only when its text
properties change or when it has no position-data. A component copy
with overridden text content keeps its own position-data. If its
main changes while the page is closed, the copy takes the main's
size, and nothing measures it when the page opens. It keeps the
main's height, so its flex siblings overlap the extra lines.
When a page opens, each auto-width or auto-height text with
overridden content on a copy starts in a :check phase and gets one
hidden HTML measurement. In :check, the result is written (size and
position-data) only if the size differs by more than 1px on the axis
the text grows on. Otherwise nothing is written, though the text
modifier is still cleaned. The phase is then dropped, so later
measurements work as before. A copy with no position-data skips the
check and is measured and committed as usual.
The new dwt/text-size-drifted? holds the 1px rule. It ignores an axis
that fills its layout parent, because the layout sets that size and
the check would otherwise find drift on every open. The 1px tolerance
matches the WebGL page-load check. SVG stores whole pixels, rounded
up, so smaller gaps are only rounding. A finer tolerance would
rewrite the same texts each time a page opened.
Each content-overridden auto-grow copy costs one extra measurement
per page open.
Tests: frontend-tests.data.workspace-texts-test covers
text-size-drifted? for sub-pixel and exact 1px gaps, the growing axis
only, and fill axes. frontend-tests.ui.viewport-texts-html-test covers
which copies start in :check, the drifted, matching and unmeasurable
cases, and the 1px commit when no phase is set.
Known limit: the heal commits like any SVG measurement, so it adds to
the user's last undo entry.
Relates to #12721
Relates to #13065
With the WebGL renderer, a component copy synced while its page was
closed takes the main's size for its auto-width or auto-height text.
Nothing measured it again when the page opened. The only check of stored
text sizes against the WASM layout ran after font loads, and only for
texts that waited for a font. Once fonts were loaded, which is true for
every page after the first in a session, the stale copy kept the main's
size. Its flex siblings then overlapped the extra lines.
Page loads now check every auto-grow text they bring into WASM. This
covers the sync path for small pages and the chunked async path for
pages with 100 or more shapes. A stale text goes through the existing
stale-text event, so the workspace resizes it. Texts still waiting for a
font skip the check, since the font check handles them when the font
arrives. So no text is resized twice.
The page check uses a 1px tolerance, and the font check keeps 0.1px. The
classic renderer stores whole pixels and WASM stores fractions, so a
finer tolerance would rewrite the same texts each time a page opened.
Shape updates made while editing do not run the check, so typing does
not resize texts.
Tests: new frontend-tests.render-wasm.stale-text-selrects-test covers
small and large page loads, sub-pixel gaps, fixed texts, texts waiting
for a font, and shape updates while editing.
Note: set-objects also serves thumbnails, the viewer and the export
worker, where nothing listens to the event. There the check costs one
cached size read per auto-grow text, the same cost the font check already
had for texts that waited for a font.
Relates to #12721
Relates to #13065
* 🐛 Fix Chinese browser language autodetection
* ♻️ Pass the browser language to autodetect
* ♻️ Share locale resolution between autodetect and set-locale
Hosts need a vendor-agnostic way to react to named audit events in the
browser (for example SaaS config.js). Penpot exposes
penpotAddEventCallback / penpotEventCallbacks, loads an early stub before
config.js, and invokes matching callbacks after make-event, without
coupling to any analytics SDK.
Closes#13091
AI-assisted-by: Composer
Chrome fails Continue on a large .penpot when the worker re-fetches the
blob: URL. Keep the dropped File on the entry and upload it from the
main thread instead.
Closes#13165
AI-assisted-by: composer
The analysis of a package reads the metadata of every media and
thumbnail of its container to attribute the shared objects to each
file. It read them all at once, one promise per entry, and the
container of a big file holds thousands of them: every read opens its
own decompression stream, and Chromium fails the whole analysis under
that load while Firefox keeps up. The failure is masked by zip.js with
a generic "Cannot close a ERRORED writable stream".
The references now go through an observable, one entry at a time, and a
reference that cannot be read leaves its file without a size instead of
failing the package: a number that misses one of the objects of the
file is worse than no number.
Closes#13022
AI-assisted-by: deepseek-v4.1-flash
* 🐛 Keep fill copies laid out after a component sync in the WebGL render
Lay out other pages in CLJS and reflow nested layouts that keep their size.
Closes#13015
AI-assisted-by: claude-opus-5-5
* ⚡ Skip the nested layout pass during WebGL drag previews
Gap, padding and margin drags keep the cost they had before the fix.
Relates to #13015
AI-assisted-by: claude-opus-5-5
Plugins and the MCP could not learn which Penpot instance they run on,
so agents guessed the domain when they wrote links to files.
Add penpot.location with the instance base URL (baseUrl), the URL of
the current screen (href) and its query params (params). It works in
the dashboard and the workspace and requires content:read. Params that
carry secrets (share-id, the MCP authorize params, and any key ending
in token, secret or password) are left out, and href is rebuilt from
the remaining params so it never carries one.
The MCP instructions tell agents to use href instead of building links.
The plugin API test suite checks location against the open file, and
its API surface is regenerated from the current types.
Closes#13013
AI-assisted-by: claude-opus-5-5
* ⚡ Avoid iterating over every object in frame-titles*
Similarly to #13075, frame-titles* used to iterate over every object to work
out the frames at the root that need titles.
For files with lots of objects this can be slow, but we can just get the root
frames by looking at the root object's children.
We need to remove non-main-component instances to copy the behaviour of
`get-frame-ids :skip-copies? true`. This also now causes the title to be drawn
on a child frame whenever it's focused.
AI-assisted-by: claude-opus-5-5
* 🐛 Don't show frame title on focused frames
Restores the existing behaviour when focused