mirror of
https://github.com/penpot/penpot.git
synced 2026-02-12 15:42:29 -05:00
Compare commits
3 Commits
develop
...
hiru-fix-p
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a23ca6a1cb | ||
|
|
c626634610 | ||
|
|
11eedd0368 |
@@ -35,7 +35,7 @@
|
||||
[::sm/text {:error/fn token-value-empty-fn}])
|
||||
|
||||
(def schema:token-value-font-family
|
||||
[:vector :string])
|
||||
[:vector ::sm/text])
|
||||
|
||||
(def schema:token-value-typography-map
|
||||
[:map
|
||||
|
||||
@@ -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)))}
|
||||
|
||||
|
||||
@@ -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]
|
||||
@@ -113,13 +113,17 @@
|
||||
|
||||
:applyToShapes
|
||||
{:schema [:tuple
|
||||
[:vector [:fn shape/shape-proxy?]]
|
||||
[:maybe [:set ::sm/keyword]]]
|
||||
;; 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?]]]]]]
|
||||
: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)))}))
|
||||
|
||||
@@ -251,7 +251,14 @@ function applyToken(
|
||||
token.applyToSelected(properties);
|
||||
}
|
||||
|
||||
// Alternatve way
|
||||
// Alternative way
|
||||
//
|
||||
// const selection = penpot.selection;
|
||||
// if (token && selection) {
|
||||
// token.applyToShapes(selection, properties);
|
||||
// }
|
||||
|
||||
// Other alternative way
|
||||
//
|
||||
// const selection = penpot.selection;
|
||||
// if (token && selection) {
|
||||
|
||||
4
plugins/libs/plugin-types/index.d.ts
vendored
4
plugins/libs/plugin-types/index.d.ts
vendored
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user