mirror of
https://github.com/penpot/penpot.git
synced 2025-05-24 05:46:13 +02:00
Minor project structure improvement.
This commit is contained in:
parent
a2c313dfc0
commit
b317ee4904
17 changed files with 106 additions and 115 deletions
28
frontend/uxbox/util/lens.cljs
Normal file
28
frontend/uxbox/util/lens.cljs
Normal file
|
@ -0,0 +1,28 @@
|
|||
(ns uxbox.util.lens
|
||||
(:refer-clojure :exclude [derive])
|
||||
(:require [cats.labs.lens :as l]))
|
||||
|
||||
(defn dep-in
|
||||
[where link]
|
||||
{:pre [(vector? where) (vector? link)]}
|
||||
(l/lens
|
||||
(fn [s]
|
||||
(let [value (get-in s link)
|
||||
path (conj where value)]
|
||||
(get-in s path)))
|
||||
(fn [s f]
|
||||
(throw (ex-info "Not implemented" {})))))
|
||||
|
||||
(defn getter
|
||||
[f]
|
||||
(l/lens f #(throw (ex-info "Not implemented" {}))))
|
||||
|
||||
(defn derive
|
||||
[a path]
|
||||
(l/focus-atom (l/in path) a))
|
||||
|
||||
(defn focus
|
||||
([state]
|
||||
(l/focus-atom l/id state))
|
||||
([lens state]
|
||||
(l/focus-atom lens state)))
|
Loading…
Add table
Add a link
Reference in a new issue