From d549be33764f144055cb9a6b942b0547bfa4cfd0 Mon Sep 17 00:00:00 2001 From: Eva Marco Date: Wed, 22 Apr 2026 09:39:38 +0200 Subject: [PATCH] :recycle: Remove duplicated code (#9096) --- .../data/workspace/tokens/application.cljs | 40 ------------------- 1 file changed, 40 deletions(-) diff --git a/frontend/src/app/main/data/workspace/tokens/application.cljs b/frontend/src/app/main/data/workspace/tokens/application.cljs index 5f5b54e681..3ee7758284 100644 --- a/frontend/src/app/main/data/workspace/tokens/application.cljs +++ b/frontend/src/app/main/data/workspace/tokens/application.cljs @@ -607,46 +607,6 @@ :state state})] (apply rx/of (map #(%) actions))))))))) -(def attributes->shape-update - "Maps each attribute-set to the update function that applies it to a shape. - Used both here (to resolve the correct update fn when explicit attrs are - passed to toggle-token) and in propagation.cljs (re-exported from there)." - {ctt/border-radius-keys update-shape-radius-for-corners - ctt/color-keys update-fill-stroke - ctt/stroke-width-keys update-stroke-width - ctt/sizing-keys apply-dimensions-token - ctt/opacity-keys update-opacity - ctt/rotation-keys update-rotation - - ;; Typography - ctt/font-family-keys update-font-family - ctt/font-size-keys update-font-size - ctt/font-weight-keys update-font-weight - ctt/letter-spacing-keys update-letter-spacing - ctt/text-case-keys update-text-case - ctt/text-decoration-keys update-text-decoration - ctt/typography-token-keys update-typography - ctt/shadow-keys update-shadow - ctt/line-height-keys update-line-height - - ;; Layout - #{:x :y} update-shape-position - #{:p1 :p2 :p3 :p4} update-layout-padding - #{:m1 :m2 :m3 :m4} update-layout-item-margin - #{:column-gap :row-gap} update-layout-gap - #{:width :height} apply-dimensions-token - #{:layout-item-min-w :layout-item-min-h - :layout-item-max-w :layout-item-max-h} update-layout-sizing-limits}) - -;; Flattened per-individual-key version of attributes->shape-update. -;; Allows O(1) lookup of the update function for any single attribute. -(def ^:private attr->shape-update - (reduce - (fn [acc [attr-set update-fn]] - (into acc (map (fn [k] [k update-fn]) attr-set))) - {} - attributes->shape-update)) - ;; Events to apply / unapply tokens to shapes ------------------------------------------------------------ (def attributes->shape-update