mirror of
https://github.com/penpot/penpot.git
synced 2025-05-31 11:46:11 +02:00
✨ Don't register shadow schema
It is not really necessary, we can use the schema var directly.
This commit is contained in:
parent
ccbf17106d
commit
151dc352c8
4 changed files with 8 additions and 9 deletions
|
@ -848,9 +848,6 @@
|
||||||
(update :pages-index update-vals update-container)
|
(update :pages-index update-vals update-container)
|
||||||
(update :components update-vals update-container))))
|
(update :components update-vals update-container))))
|
||||||
|
|
||||||
(def ^:private valid-shadow?
|
|
||||||
(sm/lazy-validator ::ctss/shadow))
|
|
||||||
|
|
||||||
(defmethod migrate-data "legacy-44"
|
(defmethod migrate-data "legacy-44"
|
||||||
[data _]
|
[data _]
|
||||||
(letfn [(fix-shadow [shadow]
|
(letfn [(fix-shadow [shadow]
|
||||||
|
@ -862,7 +859,7 @@
|
||||||
|
|
||||||
(update-object [object]
|
(update-object [object]
|
||||||
(let [xform (comp (map fix-shadow)
|
(let [xform (comp (map fix-shadow)
|
||||||
(filter valid-shadow?))]
|
(filter ctss/valid-shadow?))]
|
||||||
(d/update-when object :shadow #(into [] xform %))))
|
(d/update-when object :shadow #(into [] xform %))))
|
||||||
|
|
||||||
(update-container [container]
|
(update-container [container]
|
||||||
|
@ -1037,7 +1034,7 @@
|
||||||
|
|
||||||
(update-shape [shape]
|
(update-shape [shape]
|
||||||
(let [xform (comp (map fix-shadow)
|
(let [xform (comp (map fix-shadow)
|
||||||
(filter valid-shadow?))]
|
(filter ctss/valid-shadow?))]
|
||||||
(d/update-when shape :shadow #(into [] xform %))))
|
(d/update-when shape :shadow #(into [] xform %))))
|
||||||
|
|
||||||
(update-container [container]
|
(update-container [container]
|
||||||
|
|
|
@ -211,7 +211,7 @@
|
||||||
[:interactions {:optional true}
|
[:interactions {:optional true}
|
||||||
[:vector {:gen/max 2} ::ctsi/interaction]]
|
[:vector {:gen/max 2} ::ctsi/interaction]]
|
||||||
[:shadow {:optional true}
|
[:shadow {:optional true}
|
||||||
[:vector {:gen/max 1} ::ctss/shadow]]
|
[:vector {:gen/max 1} ctss/schema:shadow]]
|
||||||
[:blur {:optional true} ::ctsb/blur]
|
[:blur {:optional true} ::ctsb/blur]
|
||||||
[:grow-type {:optional true}
|
[:grow-type {:optional true}
|
||||||
[::sm/one-of grow-types]]
|
[::sm/one-of grow-types]]
|
||||||
|
|
|
@ -26,7 +26,9 @@
|
||||||
[:hidden :boolean]
|
[:hidden :boolean]
|
||||||
[:color ::ctc/color]])
|
[:color ::ctc/color]])
|
||||||
|
|
||||||
(sm/register! ::shadow schema:shadow)
|
|
||||||
|
|
||||||
(def check-shadow
|
(def check-shadow
|
||||||
(sm/check-fn schema:shadow))
|
(sm/check-fn schema:shadow))
|
||||||
|
|
||||||
|
(def valid-shadow?
|
||||||
|
(sm/validator schema:shadow))
|
||||||
|
|
||||||
|
|
|
@ -432,7 +432,7 @@
|
||||||
(let [id (obj/get self "$id")
|
(let [id (obj/get self "$id")
|
||||||
value (mapv #(shadow-defaults (parser/parse-shadow %)) value)]
|
value (mapv #(shadow-defaults (parser/parse-shadow %)) value)]
|
||||||
(cond
|
(cond
|
||||||
(not (sm/validate [:vector ::ctss/shadow] value))
|
(not (sm/validate [:vector ctss/schema:shadow] value))
|
||||||
(u/display-not-valid :shadows value)
|
(u/display-not-valid :shadows value)
|
||||||
|
|
||||||
(not (r/check-permission plugin-id "content:write"))
|
(not (r/check-permission plugin-id "content:write"))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue