0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 15:39:50 -05:00

Replace random-uuid usage with uuid.core/random.

This commit is contained in:
Andrey Antukh 2016-04-24 22:01:43 +03:00
parent f102be51cb
commit f0ed85e53f
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95
5 changed files with 14 additions and 9 deletions

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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})))]

View file

@ -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)