diff --git a/common/uxbox/common/data.cljc b/common/uxbox/common/data.cljc index d1c4bb607..48ec9b884 100644 --- a/common/uxbox/common/data.cljc +++ b/common/uxbox/common/data.cljc @@ -64,19 +64,23 @@ (persistent! (reduce #(assoc! %1 (getter %2) %2) (transient {}) coll))) -(defn index-of - [coll v] +(defn index-of-pred + [coll pred] (loop [c (first coll) coll (rest coll) index 0] (if (nil? c) nil - (if (= c v) + (if (pred c) index (recur (first coll) (rest coll) (inc index)))))) +(defn index-of + [coll v] + (index-of-pred coll #(= % v))) + (defn remove-nil-vals "Given a map, return a map removing key-value pairs when value is `nil`." diff --git a/common/uxbox/common/pages.cljc b/common/uxbox/common/pages.cljc index 27fa2431e..89cac2cef 100644 --- a/common/uxbox/common/pages.cljc +++ b/common/uxbox/common/pages.cljc @@ -135,6 +135,19 @@ ::grid-x ::grid-color])) +;; Interactions + +(s/def ::event-type #{:click}) ; In the future we will have more options +(s/def ::action-type #{:navigate}) +(s/def ::destination uuid?) + +(s/def ::interaction + (s/keys :req-un [::event-type + ::action-type + ::destination])) + +(s/def ::interactions (s/coll-of ::interaction :kind vector?)) + ;; Page Data related (s/def ::blocked boolean?) (s/def ::collapsed boolean?) @@ -194,7 +207,8 @@ ::stroke-width ::stroke-alignment ::text-align - ::width ::height])) + ::width ::height + ::interactions])) (s/def ::minimal-shape (s/keys :req-un [::type ::name] diff --git a/docs/02-Frontend-Developer-Guide.md b/docs/02-Frontend-Developer-Guide.md index 6f5b2b58f..006ba681a 100644 --- a/docs/02-Frontend-Developer-Guide.md +++ b/docs/02-Frontend-Developer-Guide.md @@ -26,12 +26,19 @@ You can deactivate debug mode with (-debug!