Remove ^:const usage.

This commit is contained in:
Andrey Antukh 2016-07-10 11:57:45 +03:00
parent d7f21dc130
commit f1955c2a7c
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95
26 changed files with 65 additions and 65 deletions

View file

@ -7,16 +7,16 @@
(ns uxbox.main.constants) (ns uxbox.main.constants)
(def ^:const grid-x-axis 10) (def grid-x-axis 10)
(def ^:const grid-y-axis 10) (def grid-y-axis 10)
(def ^:const viewport-width 4000) (def viewport-width 4000)
(def ^:const viewport-height 4000) (def viewport-height 4000)
(def ^:const canvas-start-x 1200) (def canvas-start-x 1200)
(def ^:const canvas-start-y 1200) (def canvas-start-y 1200)
(def ^:const canvas-scroll-padding 50) (def canvas-scroll-padding 50)
(def ^:const canvas-start-scroll-x (- canvas-start-x canvas-scroll-padding)) (def canvas-start-scroll-x (- canvas-start-x canvas-scroll-padding))
(def ^:const canvas-start-scroll-y (- canvas-start-y canvas-scroll-padding)) (def canvas-start-scroll-y (- canvas-start-y canvas-scroll-padding))

View file

@ -13,7 +13,7 @@
;; --- Constants ;; --- Constants
(def ^:const +animation-timeout+ 600) (def +animation-timeout+ 600)
;; --- Message Event ;; --- Message Event

View file

@ -28,7 +28,7 @@
;; --- Constants ;; --- Constants
(def ^:const zoom-levels (def zoom-levels
[0.20 0.21 0.22 0.23 0.24 0.25 0.27 0.28 0.30 0.32 0.34 [0.20 0.21 0.22 0.23 0.24 0.25 0.27 0.28 0.30 0.32 0.34
0.36 0.38 0.40 0.42 0.44 0.46 0.48 0.51 0.54 0.57 0.60 0.36 0.38 0.40 0.42 0.44 0.46 0.48 0.51 0.54 0.57 0.60
0.63 0.66 0.69 0.73 0.77 0.81 0.85 0.90 0.95 1.00 1.05 0.63 0.66 0.69 0.73 0.77 0.81 0.85 0.90 0.95 1.00 1.05

View file

@ -12,7 +12,7 @@
;; --- Types ;; --- Types
(def ^:const +hierarchy+ (def +hierarchy+
(-> (make-hierarchy) (-> (make-hierarchy)
(derive ::rect ::shape) (derive ::rect ::shape)
(derive :icon ::rect) (derive :icon ::rect)

View file

@ -16,38 +16,38 @@
;; Colors ;; Colors
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(def ^:const +color-collections+ (def +color-collections+
colors/+collections+) colors/+collections+)
(def ^:const +color-collections-by-id+ (def +color-collections-by-id+
(index-by-id colors/+collections+)) (index-by-id colors/+collections+))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Icons ;; Icons
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(def ^:const +icon-collections+ (def +icon-collections+
icons/+collections+) icons/+collections+)
(def ^:const +icon-collections-by-id+ (def +icon-collections-by-id+
(index-by-id icons/+collections+)) (index-by-id icons/+collections+))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Images ;; Images
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(def ^:const +image-collections+ (def +image-collections+
images/+collections+) images/+collections+)
(def ^:const +image-collections-by-id+ (def +image-collections-by-id+
(index-by-id images/+collections+)) (index-by-id images/+collections+))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Fonts ;; Fonts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(def ^:const +fonts+ (def +fonts+
fonts/+collections+) fonts/+collections+)
(def ^:const +fonts-by-id+ (def +fonts-by-id+
(index-by-id fonts/+collections+)) (index-by-id fonts/+collections+))

View file

@ -7,7 +7,7 @@
(ns uxbox.main.library.fonts) (ns uxbox.main.library.fonts)
(def ^:const +collections+ (def +collections+
[{:id "sourcesanspro" [{:id "sourcesanspro"
:name "Source Sans Pro" :name "Source Sans Pro"
:styles [{:name "Extra-Light" :styles [{:name "Extra-Light"

View file

@ -1,6 +1,6 @@
(ns uxbox.main.state.clipboard) (ns uxbox.main.state.clipboard)
(defonce ^:private ^:const +max-items+ 5) (defonce ^:private +max-items+ 5)
(defn conj-item (defn conj-item
[state item] [state item]

View file

@ -33,13 +33,13 @@
;; --- Constants ;; --- Constants
(def ^:const +unrestricted+ (def +unrestricted+
#{:auth/login #{:auth/login
:auth/register :auth/register
:auth/recovery-request :auth/recovery-request
:auth/recovery}) :auth/recovery})
(def ^:const restricted? (def restricted?
(complement +unrestricted+)) (complement +unrestricted+))
(def route-ref (def route-ref

View file

@ -67,7 +67,7 @@
[:rect {:x 0 :y 0 :width "100%" :height "100%" [:rect {:x 0 :y 0 :width "100%" :height "100%"
:fill "url(#gradient-hsv)"}]])) :fill "url(#gradient-hsv)"}]]))
(def ^:const default-dimensions (def default-dimensions
{:pi-height 5 {:pi-height 5
:pi-width 5 :pi-width 5
:si-height 10 :si-height 10
@ -75,7 +75,7 @@
:p-width 200 :p-width 200
:s-height 200}) :s-height 200})
(def ^:const small-dimensions (def small-dimensions
{:pi-height 5 {:pi-height 5
:pi-width 5 :pi-width 5
:si-height 10 :si-height 10

View file

@ -29,7 +29,7 @@
[:span i/pencil] [:span i/pencil]
[:span i/trash]]])) [:span i/trash]]]))
(def ^:const ^:private page-title (def ^:private page-title
(mx/component (mx/component
{:render page-title-render {:render page-title-render
:name "page-title" :name "page-title"
@ -124,7 +124,7 @@
[:div.project-th-icon.edit i/pencil] [:div.project-th-icon.edit i/pencil]
[:div.project-th-icon.delete i/trash]]]]])) [:div.project-th-icon.delete i/trash]]]]]))
(def ^:const ^:private grid (def ^:private grid
(mx/component (mx/component
{:render grid-render {:render grid-render
:name "grid" :name "grid"
@ -180,7 +180,7 @@
(udl/close!))} (udl/close!))}
i/close]])) i/close]]))
(def ^:const ^:private new-element-lightbox (def ^:private new-element-lightbox
(mx/component (mx/component
{:render new-element-lightbox-render {:render new-element-lightbox-render
:name "new-element-lightbox"})) :name "new-element-lightbox"}))

View file

@ -47,7 +47,7 @@
[:span {:on-click (constantly nil)} [:span {:on-click (constantly nil)}
i/trash]])]))) i/trash]])])))
(def ^:const ^:private page-title (def ^:private page-title
(mx/component (mx/component
{:render page-title-render {:render page-title-render
:name "page-title" :name "page-title"
@ -88,7 +88,7 @@
[:span.element-subtitle [:span.element-subtitle
(str (count (:icons props)) " elements")]])]]]))) (str (count (:icons props)) " elements")]])]]])))
(def ^:const ^:private nav (def ^:private nav
(mx/component (mx/component
{:render nav-render {:render nav-render
:name "nav" :name "nav"

View file

@ -13,7 +13,7 @@
;; --- Lentes ;; --- Lentes
(def ^:const ^:private lightbox-ref (def ^:private lightbox-ref
(-> (l/key :lightbox) (-> (l/key :lightbox)
(l/derive st/state))) (l/derive st/state)))

View file

@ -12,7 +12,7 @@
;; --- Lenses ;; --- Lenses
(def ^:const ^:private message-ref (def ^:private message-ref
(-> (l/key :message) (-> (l/key :message)
(l/derive st/state))) (l/derive st/state)))
@ -84,7 +84,7 @@
:dialog (dialog-box message) :dialog (dialog-box message)
nil))) nil)))
(def ^:const messages (def messages
(mx/component (mx/component
{:render messages-render {:render messages-render
:name "messages" :name "messages"

View file

@ -17,11 +17,11 @@
;; --- Lenses ;; --- Lenses
(def ^:const selected-shapes-ref (def selected-shapes-ref
(-> (l/in [:workspace :selected]) (-> (l/in [:workspace :selected])
(l/derive st/state))) (l/derive st/state)))
(def ^:const drawing-state-ref (def drawing-state-ref
(-> (l/in [:workspace :drawing]) (-> (l/in [:workspace :drawing])
(l/derive st/state))) (l/derive st/state)))

View file

@ -70,8 +70,8 @@
;; --- Text Styles Helpers ;; --- Text Styles Helpers
(def ^:const +style-attrs+ [:font-size]) (def +style-attrs+ [:font-size])
(def ^:const +select-rect-attrs+ (def +select-rect-attrs+
{:stroke-dasharray "5,5" {:stroke-dasharray "5,5"
:style {:stroke "#333" :fill "transparent" :style {:stroke "#333" :fill "transparent"
:stroke-opacity "0.4"}}) :stroke-opacity "0.4"}})

View file

@ -38,27 +38,27 @@
(-> (l/lens getter) (-> (l/lens getter)
(l/derive st/state)))) (l/derive st/state))))
(def ^:const selected-shapes-ref (def selected-shapes-ref
(as-> (l/in [:selected]) $ (as-> (l/in [:selected]) $
(l/derive $ workspace-ref))) (l/derive $ workspace-ref)))
(def ^:const toolboxes-ref (def toolboxes-ref
(as-> (l/in [:toolboxes]) $ (as-> (l/in [:toolboxes]) $
(l/derive $ workspace-ref))) (l/derive $ workspace-ref)))
(def ^:const flags-ref (def flags-ref
(as-> (l/in [:flags]) $ (as-> (l/in [:flags]) $
(l/derive $ workspace-ref))) (l/derive $ workspace-ref)))
(def ^:const shapes-by-id-ref (def shapes-by-id-ref
(as-> (l/key :shapes-by-id) $ (as-> (l/key :shapes-by-id) $
(l/derive $ st/state))) (l/derive $ st/state)))
(def ^:const zoom-ref (def zoom-ref
(-> (l/in [:workspace :zoom]) (-> (l/in [:workspace :zoom])
(l/derive st/state))) (l/derive st/state)))
(def ^:const alignment-ref (def alignment-ref
(letfn [(getter [flags] (letfn [(getter [flags]
(and (contains? flags :grid/indexed) (and (contains? flags :grid/indexed)
(contains? flags :grid/alignment) (contains? flags :grid/alignment)

View file

@ -21,7 +21,7 @@
;; --- Lenses ;; --- Lenses
(def ^:const ^:private clipboard-ref (def ^:private clipboard-ref
(-> (l/key :clipboard) (-> (l/key :clipboard)
(l/derive st/state))) (l/derive st/state)))

View file

@ -17,7 +17,7 @@
[uxbox.main.geom.point :as gpt] [uxbox.main.geom.point :as gpt]
[uxbox.util.dom :as dom])) [uxbox.util.dom :as dom]))
(def ^:private ^:const immanted-zones (def ^:private immanted-zones
(let [transform #(vector (- % 7) (+ % 7) %)] (let [transform #(vector (- % 7) (+ % 7) %)]
(concat (concat
(mapv transform (range 0 181 15)) (mapv transform (range 0 181 15))
@ -105,7 +105,7 @@
(if (and p1 p2) (if (and p1 p2)
(overlay-line-render own p1 p2))]))) (overlay-line-render own p1 p2))])))
(def ^:const overlay (def overlay
(mx/component (mx/component
{:render #(overlay-render % (:rum/local %)) {:render #(overlay-render % (:rum/local %))
:will-mount #(overlay-will-mount % (:rum/local %)) :will-mount #(overlay-will-mount % (:rum/local %))

View file

@ -18,17 +18,17 @@
;; --- Constants & Helpers ;; --- Constants & Helpers
(def ^:const step-padding 20) (def step-padding 20)
(def ^:const step-size 10) (def step-size 10)
(defn big-ticks-mod [zoom] (/ 100 zoom)) (defn big-ticks-mod [zoom] (/ 100 zoom))
(defn mid-ticks-mod [zoom] (/ 50 zoom)) (defn mid-ticks-mod [zoom] (/ 50 zoom))
(def ^:const +ticks+ (def +ticks+
(concat (range (- (/ c/viewport-width 1)) 0 step-size) (concat (range (- (/ c/viewport-width 1)) 0 step-size)
(range 0 (/ c/viewport-width 1) step-size))) (range 0 (/ c/viewport-width 1) step-size)))
(def ^:const rule-padding 20) (def rule-padding 20)
(defn- make-vertical-tick (defn- make-vertical-tick
[zoom acc value] [zoom acc value]
@ -115,7 +115,7 @@
[:path {:d (str/join " " path) :stroke "#9da2a6"}] [:path {:d (str/join " " path) :stroke "#9da2a6"}]
labels]))) labels])))
(def ^:const ^:private horizontal-rule-ticks (def ^:private horizontal-rule-ticks
(mx/component (mx/component
{:render horizontal-rule-ticks-render {:render horizontal-rule-ticks-render
:name "horizontal-rule-ticks" :name "horizontal-rule-ticks"
@ -134,7 +134,7 @@
[:path {:d (str/join " " path) :stroke "#9da2a6"}] [:path {:d (str/join " " path) :stroke "#9da2a6"}]
labels]))) labels])))
(def ^:const ^:private vertical-rule-ticks (def ^:private vertical-rule-ticks
(mx/component (mx/component
{:render vertical-rule-ticks-render {:render vertical-rule-ticks-render
:name "vertical-rule-ticks" :name "vertical-rule-ticks"

View file

@ -18,7 +18,7 @@
;; --- Constants ;; --- Constants
(def ^:const +circle-props+ (def +circle-props+
{:r 6 {:r 6
:style {:fillOpacity "1" :style {:fillOpacity "1"
:strokeWidth "1px" :strokeWidth "1px"
@ -28,7 +28,7 @@
;; --- Lenses ;; --- Lenses
(def ^:const selected-shapes-ref (def selected-shapes-ref
(letfn [(getter [state] (letfn [(getter [state]
(let [selected (get-in state [:workspace :selected])] (let [selected (get-in state [:workspace :selected])]
(mapv #(get-in state [:shapes-by-id %]) selected)))] (mapv #(get-in state [:shapes-by-id %]) selected)))]

View file

@ -23,7 +23,7 @@
;; --- Shortcuts ;; --- Shortcuts
(defonce ^:const +shortcuts+ (defonce +shortcuts+
{:shift+g #(rs/emit! (dw/toggle-flag :grid)) {:shift+g #(rs/emit! (dw/toggle-flag :grid))
:ctrl+g #(rs/emit! (uds/group-selected)) :ctrl+g #(rs/emit! (uds/group-selected))
:ctrl+shift+g #(rs/emit! (uds/degroup-selected)) :ctrl+shift+g #(rs/emit! (uds/degroup-selected))

View file

@ -37,27 +37,27 @@
;; Draw Tools ;; Draw Tools
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(def ^:const +draw-tool-rect+ (def +draw-tool-rect+
{:type :rect {:type :rect
:name "Rect" :name "Rect"
:stroke "#000000"}) :stroke "#000000"})
(def ^:const +draw-tool-circle+ (def +draw-tool-circle+
{:type :circle {:type :circle
:name "Circle"}) :name "Circle"})
(def ^:const +draw-tool-line+ (def +draw-tool-line+
{:type :line {:type :line
:name "Line" :name "Line"
:stroke-type :solid :stroke-type :solid
:stroke "#000000"}) :stroke "#000000"})
(def ^:const +draw-tool-text+ (def +draw-tool-text+
{:type :text {:type :text
:name "Text" :name "Text"
:content "Hello world"}) :content "Hello world"})
(def ^:const +draw-tools+ (def +draw-tools+
{:rect {:rect
{:icon i/box {:icon i/box
:help (tr "ds.help.rect") :help (tr "ds.help.rect")

View file

@ -27,7 +27,7 @@
;; --- Lenses ;; --- Lenses
(def ^:const history-ref (def history-ref
(as-> (l/in [:workspace :history]) $ (as-> (l/in [:workspace :history]) $
(l/derive $ st/state))) (l/derive $ st/state)))

View file

@ -25,7 +25,7 @@
;; Lenses ;; Lenses
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(def ^:private ^:const drawing-shape (def ^:private drawing-shape
"A focused vision of the drawing property "A focused vision of the drawing property
of the workspace status. This avoids of the workspace status. This avoids
rerender the whole toolbox on each workspace rerender the whole toolbox on each workspace

View file

@ -106,7 +106,7 @@
:name "options" :name "options"
:mixins [mx/static (mx/local)]})) :mixins [mx/static (mx/local)]}))
(def ^:const selected-shape-ref (def selected-shape-ref
(letfn [(getter [state] (letfn [(getter [state]
(let [selected (get-in state [:workspace :selected])] (let [selected (get-in state [:workspace :selected])]
(when (= 1 (count selected)) (when (= 1 (count selected))

View file

@ -105,7 +105,7 @@
;; --- Lightbox ;; --- Lightbox
(def ^:const +page-defaults+ (def +page-defaults+
{:width 1920 {:width 1920
:height 1080 :height 1080
:layout :desktop}) :layout :desktop})