diff --git a/src/uxbox/data/dashboard.cljs b/src/uxbox/data/dashboard.cljs index ab7bc0bfa..6b18392a0 100644 --- a/src/uxbox/data/dashboard.cljs +++ b/src/uxbox/data/dashboard.cljs @@ -7,6 +7,7 @@ (ns uxbox.data.dashboard (:require [beicon.core :as rx] + [uuid.core :as uuid] [uxbox.rstore :as rs] [uxbox.router :as r] [uxbox.state :as st] @@ -102,7 +103,7 @@ (reify rs/UpdateEvent (-apply-update [_ state] - (let [id (random-uuid) + (let [id (uuid/random) coll {:name "Unnamed collection" :id id :colors #{}}] (-> state diff --git a/src/uxbox/data/shapes.cljs b/src/uxbox/data/shapes.cljs index 84b0e78da..a18b6f760 100644 --- a/src/uxbox/data/shapes.cljs +++ b/src/uxbox/data/shapes.cljs @@ -7,6 +7,7 @@ (ns uxbox.data.shapes (:require [beicon.core :as rx] + [uuid.core :as uuid] [uxbox.constants :as c] [uxbox.rstore :as rs] [uxbox.router :as r] @@ -392,7 +393,7 @@ rs/UpdateEvent (-apply-update [_ state] (let [shapes-by-id (get state :shapes-by-id) - sid (random-uuid) + sid (uuid/random) pid (get-in state [:workspace :page]) selected (get-in state [:workspace :selected]) selected' (map #(get shapes-by-id %) selected) diff --git a/src/uxbox/data/workspace.cljs b/src/uxbox/data/workspace.cljs index b963d9527..f61934b6a 100644 --- a/src/uxbox/data/workspace.cljs +++ b/src/uxbox/data/workspace.cljs @@ -7,6 +7,7 @@ (ns uxbox.data.workspace (:require [beicon.core :as rx] + [uuid.core :as uuid] [uxbox.constants :as c] [uxbox.rstore :as rs] [uxbox.state.shapes :as stsh] @@ -133,7 +134,7 @@ rs/UpdateEvent (-apply-update [_ state] (let [selected (get-in state [:workspace :selected]) - item {:id (random-uuid) + item {:id (uuid/random) :created-at (dt/now) :items selected} clipboard (-> (:clipboard state) diff --git a/src/uxbox/state/shapes.cljs b/src/uxbox/state/shapes.cljs index 8a1cc94ab..593f91f1e 100644 --- a/src/uxbox/state/shapes.cljs +++ b/src/uxbox/state/shapes.cljs @@ -1,13 +1,14 @@ (ns uxbox.state.shapes "A collection of functions for manage shapes insinde the state." - (:require [uxbox.util.data :refer (index-of)] + (:require [uuid.core :as uuid] + [uxbox.util.data :refer (index-of)] [uxbox.util.geom :as geom])) ;; --- Shape Creation (defn assoc-shape-to-page [state shape page] - (let [sid (random-uuid) + (let [sid (uuid/random) shape (merge shape {:id sid :page page})] (as-> state $ (update-in $ [:pages-by-id page :shapes] #(into [] (cons sid %))) @@ -19,7 +20,7 @@ ([state shapes page group] (letfn [(duplicate-shape [state shape page group] (if (= (:type shape) :group) - (let [id (random-uuid) + (let [id (uuid/random) items (:items shape) shape (assoc shape :id id :page page :items []) state (if (nil? group) @@ -31,7 +32,7 @@ (assoc-in $ [:shapes-by-id id] shape)))] (->> (map #(get-in state [:shapes-by-id %]) items) (reduce #(duplicate-shape %1 %2 page id) state))) - (let [id (random-uuid) + (let [id (uuid/random) shape (-> (dissoc shape :group) (assoc :id id :page page) (merge (when group {:group group})))] diff --git a/src/uxbox/util/workers.cljs b/src/uxbox/util/workers.cljs index e96b9a1dd..cc9327cdb 100644 --- a/src/uxbox/util/workers.cljs +++ b/src/uxbox/util/workers.cljs @@ -7,6 +7,7 @@ (ns uxbox.util.workers "A lightweight layer on top of webworkers api." (:require [beicon.core :as rx] + [uuid.core :as uuid] [uxbox.util.transit :as t])) ;; --- Implementation @@ -18,7 +19,7 @@ (deftype WebWorker [stream wrk] IWorker (-ask [this message] - (let [sender (random-uuid) + (let [sender (uuid/random) data (assoc message :sender sender) data (t/encode data)] (.postMessage wrk data) @@ -27,7 +28,7 @@ (rx/take 1)))) (-send [this message] - (let [sender (random-uuid) + (let [sender (uuid/random) data (assoc message :sender sender) data (t/encode data)] (.postMessage wrk data)