mirror of
https://github.com/penpot/penpot.git
synced 2025-08-04 07:38:21 +02:00
♻️ Refactor state locality
The main purpose of this refactor is reduce a custom state from different pages and unify them under common access patterns
This commit is contained in:
parent
f62aecb383
commit
85746e7cb2
110 changed files with 2254 additions and 2125 deletions
|
@ -1,6 +1,7 @@
|
|||
(ns frontend-tests.tokens.helpers.state
|
||||
(:require
|
||||
[app.common.types.tokens-lib :as ctob]
|
||||
[app.main.data.helpers :as dsh]
|
||||
[app.main.ui.workspace.tokens.style-dictionary :as sd]
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
@ -22,10 +23,11 @@
|
|||
(ptk/reify ::end+
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(->> (rx/from (-> (get-in state [:workspace-data :tokens-lib])
|
||||
(ctob/get-active-themes-set-tokens)
|
||||
(sd/resolve-tokens+)))
|
||||
(rx/mapcat #(rx/of (end)))))))
|
||||
(let [data (dsh/lookup-file-data state)]
|
||||
(->> (rx/from (-> (get data :tokens-lib)
|
||||
(ctob/get-active-themes-set-tokens)
|
||||
(sd/resolve-tokens+)))
|
||||
(rx/mapcat #(rx/of (end))))))))
|
||||
|
||||
(defn stop-on
|
||||
"Helper function to be used with async version of run-store.
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
(ctob/get-active-themes-set-tokens)
|
||||
(get name)))
|
||||
|
||||
(defn apply-token-to-shape [file shape-label token-label attributes]
|
||||
(defn apply-token-to-shape
|
||||
[file shape-label token-label attributes]
|
||||
(let [first-page-id (get-in file [:data :pages 0])
|
||||
shape-id (thi/id shape-label)
|
||||
token (get-token file token-label)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue