From d7203ef24c9f006068bccbc450b9623dc4b0ea27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Thu, 12 Feb 2026 11:21:43 +0100 Subject: [PATCH 01/11] :wrench: Fix the plugin bundle build command --- .github/workflows/plugins-deploy-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/plugins-deploy-package.yml b/.github/workflows/plugins-deploy-package.yml index cad4b1524f..ae61d3105d 100644 --- a/.github/workflows/plugins-deploy-package.yml +++ b/.github/workflows/plugins-deploy-package.yml @@ -80,7 +80,7 @@ jobs: - name: "Build package for ${{ inputs.plugin_name }}-plugin" working-directory: plugins shell: bash - run: npx nx build ${{ inputs.plugin_name }}-plugin + run: pnpm --filter ${{ inputs.plugin_name }}-plugin build - name: Select Worker name run: | From 1349789a7b0f5f3b61a3d41b0c565c5e2bd97022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Fri, 13 Feb 2026 14:05:54 +0100 Subject: [PATCH 02/11] :wrench: Fix the plugin style documentation build command --- .github/workflows/plugins-deploy-styles-doc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/plugins-deploy-styles-doc.yml b/.github/workflows/plugins-deploy-styles-doc.yml index 0ab376cb6e..1e2b39e74d 100644 --- a/.github/workflows/plugins-deploy-styles-doc.yml +++ b/.github/workflows/plugins-deploy-styles-doc.yml @@ -78,7 +78,7 @@ jobs: - name: Build styles working-directory: plugins shell: bash - run: npx nx run example-styles:build + run: pnpm run build:styles-example - name: Select Worker name run: | From ce63bae92dfa7a58da3178e5e6a5c512b673e1b9 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 13 Feb 2026 12:17:23 +0100 Subject: [PATCH 03/11] :sparkles: Add better approach for error handling to obj/reify --- frontend/src/app/util/object.cljc | 121 ++++++++++++++++++++---------- 1 file changed, 80 insertions(+), 41 deletions(-) diff --git a/frontend/src/app/util/object.cljc b/frontend/src/app/util/object.cljc index 723444b4d5..bb5ae6c5a4 100644 --- a/frontend/src/app/util/object.cljc +++ b/frontend/src/app/util/object.cljc @@ -10,6 +10,7 @@ (:refer-clojure :exclude [set! new get merge clone contains? array? into-array reify class]) #?(:cljs (:require-macros [app.util.object])) (:require + [app.common.data :as d] [app.common.json :as json] [app.common.schema :as sm] [clojure.core :as c] @@ -156,6 +157,7 @@ this-sym (with-meta (gensym (str rsym "-this-")) {:tag 'js}) target-sym (with-meta (gensym (str rsym "-target-")) {:tag 'js}) + cause-sym (gensym "cause-") make-sym (fn [pname prefix] @@ -176,6 +178,7 @@ wrap (c/get params :wrap) schema-1 (c/get params :schema-1) this? (c/get params :this false) + on-error (c/get params :on-error) decode-expr (c/get params :decode/fn) @@ -214,7 +217,16 @@ (with-meta {:tag 'function})) val-sym - (gensym (str "val-" (str/slug pname) "-"))] + (gensym (str "val-" (str/slug pname) "-")) + + wrap-error-handling + (if on-error + (fn [expr] + `(try + ~expr + (catch :default ~cause-sym + (~on-error ~cause-sym)))) + identity)] (concat (when wrap @@ -226,8 +238,13 @@ `(fn [] (let [~this-sym (~'js* "this") ~fn-sym ~get-expr] - (.call ~fn-sym ~this-sym ~this-sym))) - get-expr)]) + ~(wrap-error-handling + `(.call ~fn-sym ~this-sym ~this-sym)))) + `(fn [] + (let [~this-sym (~'js* "this") + ~fn-sym ~get-expr] + ~(wrap-error-handling + `(.call ~fn-sym ~this-sym)))))]) (when set-expr [schema-sym schema-n @@ -241,28 +258,35 @@ (make-sym pname "set-fn") `(fn [~val-sym] - (let [~this-sym (~'js* "this") - ~fn-sym ~set-expr + ~(wrap-error-handling + `(let [~this-sym (~'js* "this") + ~fn-sym ~set-expr - ;; We only emit schema and coercer bindings if - ;; schema-n is provided - ~@(if (some? schema-n) - [schema-sym `(if (fn? ~schema-sym) - (~schema-sym ~val-sym) - ~schema-sym) + ;; We only emit schema and coercer bindings if + ;; schema-n is provided + ~@(if (some? schema-n) + [schema-sym + `(if (fn? ~schema-sym) + (~schema-sym ~val-sym) + ~schema-sym) - coercer-sym `(if (nil? ~coercer-sym) - (sm/coercer ~schema-sym) - ~coercer-sym) - val-sym (if (not= decode-expr 'app.common.json/->clj) - `(~decode-sym ~val-sym) - `(~decode-sym ~val-sym ~decode-options)) - val-sym `(~coercer-sym ~val-sym)] - [])] + coercer-sym + `(if (nil? ~coercer-sym) + (sm/coercer ~schema-sym) + ~coercer-sym) - ~(if this? - `(.call ~fn-sym ~this-sym ~this-sym ~val-sym) - `(.call ~fn-sym ~this-sym ~val-sym))))]) + val-sym + (if (not= decode-expr 'app.common.json/->clj) + `(~decode-sym ~val-sym) + `(~decode-sym ~val-sym ~decode-options)) + + val-sym + `(~coercer-sym ~val-sym)] + [])] + + ~(if this? + `(.call ~fn-sym ~this-sym ~this-sym ~val-sym) + `(.call ~fn-sym ~this-sym ~val-sym)))))]) (when fn-expr [schema-sym (or schema-n schema-1) @@ -275,7 +299,12 @@ (make-sym pname "get-fn") `(fn [] (let [~this-sym (~'js* "this") - ~fn-sym ~fn-expr + ~fn-sym ~(if (and (list? fn-expr) + (= 'fn (first fn-expr))) + (let [[sa sb & sother] fn-expr] + `(~sa ~sb ~(wrap-error-handling `(do ~@sother)))) + fn-expr) + ~fn-sym ~(if this? `(.bind ~fn-sym ~this-sym ~this-sym) `(.bind ~fn-sym ~this-sym)) @@ -284,25 +313,31 @@ ;; schema-n or schema-1 is provided ~@(if (or schema-n schema-1) [fn-sym `(fn* [~@(if schema-1 [val-sym] [])] - (let [~@(if schema-n - [val-sym `(into-array (cljs.core/js-arguments))] - []) - ~val-sym ~(if (not= decode-expr 'app.common.json/->clj) - `(~decode-sym ~val-sym) - `(~decode-sym ~val-sym ~decode-options)) + ~(wrap-error-handling + `(let [~@(if schema-n + [val-sym `(into-array (cljs.core/js-arguments))] + []) + ~val-sym + ~(if (not= decode-expr 'app.common.json/->clj) + `(~decode-sym ~val-sym) + `(~decode-sym ~val-sym ~decode-options)) - ~schema-sym (if (fn? ~schema-sym) - (~schema-sym ~val-sym) - ~schema-sym) + ~schema-sym + (if (fn? ~schema-sym) + (~schema-sym ~val-sym) + ~schema-sym) - ~coercer-sym (if (nil? ~coercer-sym) - (sm/coercer ~schema-sym) - ~coercer-sym) + ~coercer-sym + (if (nil? ~coercer-sym) + (sm/coercer ~schema-sym) + ~coercer-sym) - ~val-sym (~coercer-sym ~val-sym)] - ~(if schema-1 - `(~fn-sym ~val-sym) - `(apply ~fn-sym ~val-sym))))] + ~val-sym + (~coercer-sym ~val-sym)] + + ~(if schema-1 + `(~fn-sym ~val-sym) + `(apply ~fn-sym ~val-sym)))))] [])] ~(if wrap `(~wrap-sym ~fn-sym) @@ -375,12 +410,16 @@ (let [definition (first params)] (if (some? definition) (let [definition (if (map? definition) - (c/merge {:wrap (:wrap tmeta)} definition) + (c/merge {:wrap (:wrap tmeta) + :on-error (:on-error tmeta)} + definition) (-> {:enumerable false} (c/merge (meta definition)) (assoc :wrap (:wrap tmeta)) + (assoc :on-error (:on-error tmeta)) (assoc :fn definition) - (dissoc :get :set))) + (dissoc :get :set :line :column) + (d/without-nils))) definition (assoc definition :name (name ckey))] (recur (rest params) From b6427ecaac4e4a37f3d29a14601cc635f293194b Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 16 Feb 2026 14:16:29 +0100 Subject: [PATCH 04/11] :bug: Revert yetti upgrade Because of regression introduced on undertow-core 2.3.19 --- backend/deps.edn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/deps.edn b/backend/deps.edn index af73aecbc8..27d052c510 100644 --- a/backend/deps.edn +++ b/backend/deps.edn @@ -28,8 +28,8 @@ com.google.guava/guava {:mvn/version "33.4.8-jre"} funcool/yetti - {:git/tag "v11.9" - :git/sha "5fad7a9" + {:git/tag "v11.8" + :git/sha "1d1b33f" :git/url "https://github.com/funcool/yetti.git" :exclusions [org.slf4j/slf4j-api]} From b281870c5004ca07f1d3fe4bd4fc801ee28c0036 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 16 Feb 2026 14:27:33 +0100 Subject: [PATCH 05/11] :books: Update changelog --- CHANGES.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 58e9c0a9a5..0874c7783d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,12 @@ # CHANGELOG +## 2.13.2 + +### :bug: Bugs fixed + +- Revert yetti (http server) update, because that caused a regression on multipart uploads + + ## 2.13.1 ### :bug: Bugs fixed From 1f2a234458cb85b08f51a9383dd5eacc783ae094 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 16 Feb 2026 14:32:28 +0100 Subject: [PATCH 06/11] :books: Update changelog --- CHANGES.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 0874c7783d..824a7a8da4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,10 +1,17 @@ # CHANGELOG +## 2.13.3 + +### :bug: Bugs fixed + +- Revert yetti (http server) update, because that caused a regression on multipart uploads + + ## 2.13.2 ### :bug: Bugs fixed -- Revert yetti (http server) update, because that caused a regression on multipart uploads +- Fix arbitrary file read security issue on create-font-variant rpc method (https://github.com/penpot/penpot/security/advisories/GHSA-xp3f-g8rq-9px2) ## 2.13.1 From 813c804d4573e46bf2922b16e10dcef809b0d348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Moya?= Date: Mon, 16 Feb 2026 11:18:55 +0100 Subject: [PATCH 07/11] :wrench: Enhance schema validation of token application --- frontend/src/app/plugins/shape.cljs | 27 ++++++++++++++++---------- frontend/src/app/plugins/tokens.cljs | 23 +++++++++++----------- frontend/src/app/plugins/utils.cljs | 29 ++++++++++++---------------- 3 files changed, 40 insertions(+), 39 deletions(-) diff --git a/frontend/src/app/plugins/shape.cljs b/frontend/src/app/plugins/shape.cljs index 3f8d655a5b..014736e4d8 100644 --- a/frontend/src/app/plugins/shape.cljs +++ b/frontend/src/app/plugins/shape.cljs @@ -175,6 +175,10 @@ (defn shape-proxy? [p] (obj/type-of? p "ShapeProxy")) +;; Cannot use token/token-proxy? here because of circular dependency in applyToShapes in token proxy +(defn token-proxy? [t] + (obj/type-of? t "TokenProxy")) + (defn shape-proxy ([plugin-id id] (shape-proxy plugin-id (:current-file-id @st/state) (:current-page-id @st/state) id)) @@ -1301,16 +1305,19 @@ tokens)))} :applyToken - (fn [token attrs] - (let [token (u/locate-token file-id (obj/get token "$set-id") (obj/get token "$id")) - kw-attrs (into #{} (map keyword attrs))] - (if (some #(not (cto/token-attr? %)) kw-attrs) - (u/display-not-valid :applyToken attrs) - (st/emit! - (dwta/toggle-token {:token token - :attrs kw-attrs - :shape-ids [id] - :expand-with-children false}))))) + {:schema [:tuple + [:fn token-proxy?] + [:maybe [:set [:and ::sm/keyword [:fn cto/token-attr?]]]]] + :fn (fn [token attrs] + (let [token (u/locate-token file-id (obj/get token "$set-id") (obj/get token "$id")) + kw-attrs (into #{} (map keyword attrs))] + (if (some #(not (cto/token-attr? %)) kw-attrs) + (u/display-not-valid :applyToken attrs) + (st/emit! + (dwta/toggle-token {:token token + :attrs kw-attrs + :shape-ids [id] + :expand-with-children false})))))} :isVariantHead (fn [] diff --git a/frontend/src/app/plugins/tokens.cljs b/frontend/src/app/plugins/tokens.cljs index f46722884a..99eb45b093 100644 --- a/frontend/src/app/plugins/tokens.cljs +++ b/frontend/src/app/plugins/tokens.cljs @@ -16,7 +16,6 @@ [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.utils :as u] [app.util.object :as obj] [beicon.v2.core :as rx] @@ -38,10 +37,14 @@ (defn token-proxy? [p] (obj/type-of? p "TokenProxy")) +;; Cannot use shape/shape-proxy? here because of circular dependency in applyToken in shape proxy +(defn shape-proxy? [s] + (obj/type-of? s "ShapeProxy")) + (defn token-proxy [plugin-id file-id set-id id] (obj/reify {:name "TokenProxy" - :wrap u/wrap-errors} + :on-error u/handle-error} :$plugin {:enumerable false :get (constantly plugin-id)} :$file-id {:enumerable false :get (constantly file-id)} :$set-id {:enumerable false :get (constantly set-id)} @@ -113,14 +116,10 @@ :applyToShapes {:schema [:tuple - ;; FIXME: the schema decoder is interpreting the array of shape-proxys and converting - ;; them to plain maps. For now we adapt the schema to accept it, but the decoder - ;; 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 [:set [:and ::sm/keyword [:fn cto/token-attr?]]]]]] + [:vector [:fn shape-proxy?]] + [:maybe [: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))} + (apply-token-to-shapes file-id set-id id (map #(obj/get % "$id") shapes) attrs))} :applyToSelected {:schema [:tuple [:maybe [:set [:and ::sm/keyword [:fn cto/token-attr?]]]]] @@ -136,7 +135,7 @@ (defn token-set-proxy [plugin-id file-id id] (obj/reify {:name "TokenSetProxy" - :wrap u/wrap-errors} + :on-error u/handle-error} :$plugin {:enumerable false :get (constantly plugin-id)} :$file-id {:enumerable false :get (constantly file-id)} :$id {:enumerable false :get (constantly id)} @@ -257,7 +256,7 @@ (defn token-theme-proxy [plugin-id file-id id] (obj/reify {:name "TokenThemeProxy" - :wrap u/wrap-errors} + :on-error u/handle-error} :$plugin {:enumerable false :get (constantly plugin-id)} :$file-id {:enumerable false :get (constantly file-id)} :$id {:enumerable false :get (constantly id)} @@ -352,7 +351,7 @@ (defn tokens-catalog [plugin-id file-id] (obj/reify {:name "TokensCatalog" - :wrap u/wrap-errors} + :on-error u/handle-error} :$plugin {:enumerable false :get (constantly plugin-id)} :$id {:enumerable false :get (constantly file-id)} diff --git a/frontend/src/app/plugins/utils.cljs b/frontend/src/app/plugins/utils.cljs index 8df47b2995..dfb8242a12 100644 --- a/frontend/src/app/plugins/utils.cljs +++ b/frontend/src/app/plugins/utils.cljs @@ -223,7 +223,9 @@ (defn display-not-valid [code value] - (.error js/console (dm/str "[PENPOT PLUGIN] Value not valid: " value ". Code: " code)) + (if (some? value) + (.error js/console (dm/str "[PENPOT PLUGIN] Value not valid: " value ". Code: " code)) + (.error js/console (dm/str "[PENPOT PLUGIN] Value not valid. Code: " code))) nil) (defn reject-not-valid @@ -248,19 +250,12 @@ (let [s (set values)] (if (= (count s) 1) (first s) "mixed"))) -(defn wrap-errors - "Function wrapper to be used in plugin proxies methods to handle errors. - When an exception is thrown, a readable error message is output to the console - and the exception is captured." - [f] - (fn [] - (let [args (js-arguments)] - (try - (.apply f nil args) - (catch :default cause - (display-not-valid (ex-message cause) (obj/stringify args)) - (if-let [explain (-> cause ex-data ::sm/explain)] - (println (sm/humanize-explain explain)) - (js/console.log (ex-data cause))) - (js/console.log (.-stack cause)) - nil))))) \ No newline at end of file +(defn handle-error + "Function to be used in plugin proxies methods to handle errors and print a readable + message to the console." + [cause] + (display-not-valid (ex-message cause) nil) + (if-let [explain (-> cause ex-data ::sm/explain)] + (println (sm/humanize-explain explain)) + (js/console.log (ex-data cause))) + (js/console.log (.-stack cause))) \ No newline at end of file From 619e2387dce1116f7137b6d9513777307f21b9f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Moya?= Date: Mon, 16 Feb 2026 13:29:04 +0100 Subject: [PATCH 08/11] :bug: Fix applied tokens property names --- plugins/libs/plugin-types/index.d.ts | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/plugins/libs/plugin-types/index.d.ts b/plugins/libs/plugin-types/index.d.ts index d302adabf6..d7b77dccd5 100644 --- a/plugins/libs/plugin-types/index.d.ts +++ b/plugins/libs/plugin-types/index.d.ts @@ -5226,27 +5226,27 @@ type TokenDimensionProps = /** * The properties that a FontFamilies token can be applied to. */ -type TokenFontFamiliesProps = 'font-families'; +type TokenFontFamiliesProps = 'fontFamilies'; /** * The properties that a FontSizes token can be applied to. */ -type TokenFontSizesProps = 'font-size'; +type TokenFontSizesProps = 'fontSize'; /** * The properties that a FontWeight token can be applied to. */ -type TokenFontWeightProps = 'font-weight'; +type TokenFontWeightProps = 'fontWeight'; /** * The properties that a LetterSpacing token can be applied to. */ -type TokenLetterSpacingProps = 'letter-spacing'; +type TokenLetterSpacingProps = 'letterSpacing'; /** * The properties that a Number token can be applied to. */ -type TokenNumberProps = 'rotation' | 'line-height'; +type TokenNumberProps = 'rotation'; /** * The properties that an Opacity token can be applied to. @@ -5262,18 +5262,18 @@ type TokenSizingProps = | 'height' // Layout - | 'layout-item-min-w' - | 'layout-item-max-w' - | 'layout-item-min-h' - | 'layout-item-max-h'; + | 'layoutItemMinW' + | 'layoutItemMaxW' + | 'layoutItemMinH' + | 'layoutItemMaxH'; /** * The properties that a Spacing token can be applied to. */ type TokenSpacingProps = // Spacing / Gap - | 'row-gap' - | 'column-gap' + | 'rowGap' + | 'columnGap' // Spacing / Padding | 'p1' @@ -5290,17 +5290,17 @@ type TokenSpacingProps = /** * The properties that a BorderWidth token can be applied to. */ -type TokenBorderWidthProps = 'stroke-width'; +type TokenBorderWidthProps = 'strokeWidth'; /** * The properties that a TextCase token can be applied to. */ -type TokenTextCaseProps = 'text-case'; +type TokenTextCaseProps = 'textCase'; /** * The properties that a TextDecoration token can be applied to. */ -type TokenTextDecorationProps = 'text-decoration'; +type TokenTextDecorationProps = 'textDecoration'; /** * The properties that a Typography token can be applied to. From 166dc05ff2cbecf7bd6aec78712e7af3d11b0b4d Mon Sep 17 00:00:00 2001 From: Luis de Dios Date: Mon, 16 Feb 2026 16:39:39 +0100 Subject: [PATCH 09/11] :bug: Fix incorrect icons in grid view (#8373) --- .../workspace/sidebar/options/menus/layout_container.cljs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_container.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_container.cljs index ed6187e73f..655c00867d 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_container.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_container.cljs @@ -867,15 +867,15 @@ :on-change on-change :name (dm/str "flex-align-items-" type) :options [{:id (dm/str "align-items-start-" type) - :icon (get-layout-flex-icon :align-items :start is-column) + :icon (get-layout-grid-icon :align-items :start is-column) :label "Align items start" :value "start"} {:id (dm/str "align-items-center-" type) - :icon (get-layout-flex-icon :align-items :center is-column) + :icon (get-layout-grid-icon :align-items :center is-column) :label "Align items center" :value "center"} {:id (dm/str "align-items-end-" type) - :icon (get-layout-flex-icon :align-items :end is-column) + :icon (get-layout-grid-icon :align-items :end is-column) :label "Align items end" :value "end"}]}])) From 643cd6f61f88c5160b6ea952c44eea6c02a43a81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Moya?= Date: Tue, 17 Feb 2026 09:20:04 +0100 Subject: [PATCH 10/11] :bug: Add resolved value to tokens in plugins API (#8372) --- frontend/src/app/plugins/tokens.cljs | 29 +++++++++++++++++++ .../src/app/app.component.html | 4 ++- .../src/app/app.component.ts | 1 + plugins/apps/poc-tokens-plugin/src/plugin.ts | 1 + plugins/libs/plugin-types/index.d.ts | 9 ++++++ 5 files changed, 43 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/plugins/tokens.cljs b/frontend/src/app/plugins/tokens.cljs index 99eb45b093..c11f8dc373 100644 --- a/frontend/src/app/plugins/tokens.cljs +++ b/frontend/src/app/plugins/tokens.cljs @@ -13,6 +13,7 @@ [app.common.types.tokens-lib :as ctob] [app.common.uuid :as uuid] [app.main.data.style-dictionary :as sd] + [app.main.data.tokenscript :as ts] [app.main.data.workspace.tokens.application :as dwta] [app.main.data.workspace.tokens.library-edit :as dwtl] [app.main.store :as st] @@ -34,6 +35,14 @@ :shape-ids shape-ids :expand-with-children false}))))) +(defn- get-resolved-value + [token tokens-tree] + (let [resolved-tokens (ts/resolve-tokens tokens-tree) + resolved-value (-> resolved-tokens + (dm/get-in [(:name token) :resolved-value]) + (ts/tokenscript-symbols->penpot-unit))] + resolved-value)) + (defn token-proxy? [p] (obj/type-of? p "TokenProxy")) @@ -85,6 +94,26 @@ (fn [_ value] (st/emit! (dwtl/update-token set-id id {:value value})))} + :resolvedValue + {:this true + :enumerable false + :get + (fn [_] + (let [token (u/locate-token file-id set-id id) + tokens-lib (u/locate-tokens-lib file-id) + tokens-tree (ctob/get-tokens-in-active-sets tokens-lib)] + (get-resolved-value token tokens-tree)))} + + :resolvedValueString + {:this true + :enumerable false + :get + (fn [_] + (let [token (u/locate-token file-id set-id id) + tokens-lib (u/locate-tokens-lib file-id) + tokens-tree (ctob/get-tokens-in-active-sets tokens-lib)] + (str (get-resolved-value token tokens-tree))))} + :description {:this true :get diff --git a/plugins/apps/poc-tokens-plugin/src/app/app.component.html b/plugins/apps/poc-tokens-plugin/src/app/app.component.html index 5be709cb57..f5ef5ff940 100644 --- a/plugins/apps/poc-tokens-plugin/src/app/app.component.html +++ b/plugins/apps/poc-tokens-plugin/src/app/app.component.html @@ -113,7 +113,9 @@ class="body-m panel-item token-item" (click)="applyToken(token.id)" > - {{ token.name }} + + {{ token.name }} +