🐛 Fix applied tokens reading in shape proxy

This commit is contained in:
Andrés Moya 2026-02-12 16:38:16 +01:00
parent c626634610
commit a23ca6a1cb
3 changed files with 7 additions and 6 deletions

View File

@ -11,6 +11,7 @@
[app.common.files.helpers :as cfh]
[app.common.geom.rect :as grc]
[app.common.geom.shapes :as gsh]
[app.common.json :as json]
[app.common.path-names :as cpn]
[app.common.record :as crc]
[app.common.schema :as sm]
@ -1295,7 +1296,7 @@
(get :applied-tokens))]
(reduce
(fn [acc [prop name]]
(obj/set! acc (d/name prop) name))
(obj/set! acc (json/write-camel-key prop) name))
#js {}
tokens)))}

View File

@ -16,7 +16,7 @@
[app.main.data.workspace.tokens.application :as dwta]
[app.main.data.workspace.tokens.library-edit :as dwtl]
[app.main.store :as st]
;; [app.plugins.shape :as shape]
;; [app.plugins.shape :as shape]
[app.plugins.utils :as u]
[app.util.object :as obj]
[beicon.v2.core :as rx]
@ -118,12 +118,12 @@
;; should be fixed to keep the original proxy objects coming from the plugin.
;; [:vector [:fn shape/shape-proxy?]]
[:vector [:map [:id ::sm/uuid]]]
[:maybe [:set ::sm/keyword]]]
[:maybe [:set [:set [:and ::sm/keyword [:fn cto/token-attr?]]]]]]
:fn (fn [shapes attrs]
(apply-token-to-shapes file-id set-id id (map :id shapes) attrs))}
:applyToSelected
{:schema [:tuple [:maybe [:set ::sm/keyword]]]
{:schema [:tuple [:maybe [:set [:and ::sm/keyword [:fn cto/token-attr?]]]]]
:fn (fn [attrs]
(let [selected (get-in @st/state [:workspace-local :selected])]
(apply-token-to-shapes file-id set-id id selected attrs)))}))

View File

@ -3744,7 +3744,7 @@ export interface ShapeBase extends PluginData {
* and the value set to the attributes will depend on which sets are active
* (and will change if different sets or themes are activated later).
*/
readonly tokens: { [property: string]: string };
readonly tokens: { [property in TokenProperty]: string };
/**
* @return Returns true if the current shape is inside a component instance
@ -5221,7 +5221,7 @@ type TokenDimensionProps =
| 'y'
// Stroke width
| 'stroke-width';
| 'strokeWidth';
/**
* The properties that a FontFamilies token can be applied to.