mirror of
https://github.com/penpot/penpot.git
synced 2025-04-13 15:31:26 -05:00
Remove ^:const usage.
This commit is contained in:
parent
d7f21dc130
commit
f1955c2a7c
26 changed files with 65 additions and 65 deletions
|
@ -7,16 +7,16 @@
|
|||
|
||||
(ns uxbox.main.constants)
|
||||
|
||||
(def ^:const grid-x-axis 10)
|
||||
(def ^:const grid-y-axis 10)
|
||||
(def grid-x-axis 10)
|
||||
(def grid-y-axis 10)
|
||||
|
||||
(def ^:const viewport-width 4000)
|
||||
(def ^:const viewport-height 4000)
|
||||
(def viewport-width 4000)
|
||||
(def viewport-height 4000)
|
||||
|
||||
(def ^:const canvas-start-x 1200)
|
||||
(def ^:const canvas-start-y 1200)
|
||||
(def ^:const canvas-scroll-padding 50)
|
||||
(def ^:const 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-x 1200)
|
||||
(def canvas-start-y 1200)
|
||||
(def canvas-scroll-padding 50)
|
||||
(def canvas-start-scroll-x (- canvas-start-x canvas-scroll-padding))
|
||||
(def canvas-start-scroll-y (- canvas-start-y canvas-scroll-padding))
|
||||
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
;; --- Constants
|
||||
|
||||
(def ^:const +animation-timeout+ 600)
|
||||
(def +animation-timeout+ 600)
|
||||
|
||||
;; --- Message Event
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
;; --- 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.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
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
;; --- Types
|
||||
|
||||
(def ^:const +hierarchy+
|
||||
(def +hierarchy+
|
||||
(-> (make-hierarchy)
|
||||
(derive ::rect ::shape)
|
||||
(derive :icon ::rect)
|
||||
|
|
|
@ -16,38 +16,38 @@
|
|||
;; Colors
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(def ^:const +color-collections+
|
||||
(def +color-collections+
|
||||
colors/+collections+)
|
||||
|
||||
(def ^:const +color-collections-by-id+
|
||||
(def +color-collections-by-id+
|
||||
(index-by-id colors/+collections+))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Icons
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(def ^:const +icon-collections+
|
||||
(def +icon-collections+
|
||||
icons/+collections+)
|
||||
|
||||
(def ^:const +icon-collections-by-id+
|
||||
(def +icon-collections-by-id+
|
||||
(index-by-id icons/+collections+))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Images
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(def ^:const +image-collections+
|
||||
(def +image-collections+
|
||||
images/+collections+)
|
||||
|
||||
(def ^:const +image-collections-by-id+
|
||||
(def +image-collections-by-id+
|
||||
(index-by-id images/+collections+))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Fonts
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(def ^:const +fonts+
|
||||
(def +fonts+
|
||||
fonts/+collections+)
|
||||
|
||||
(def ^:const +fonts-by-id+
|
||||
(def +fonts-by-id+
|
||||
(index-by-id fonts/+collections+))
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
(ns uxbox.main.library.fonts)
|
||||
|
||||
(def ^:const +collections+
|
||||
(def +collections+
|
||||
[{:id "sourcesanspro"
|
||||
:name "Source Sans Pro"
|
||||
:styles [{:name "Extra-Light"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
(ns uxbox.main.state.clipboard)
|
||||
|
||||
(defonce ^:private ^:const +max-items+ 5)
|
||||
(defonce ^:private +max-items+ 5)
|
||||
|
||||
(defn conj-item
|
||||
[state item]
|
||||
|
|
|
@ -33,13 +33,13 @@
|
|||
|
||||
;; --- Constants
|
||||
|
||||
(def ^:const +unrestricted+
|
||||
(def +unrestricted+
|
||||
#{:auth/login
|
||||
:auth/register
|
||||
:auth/recovery-request
|
||||
:auth/recovery})
|
||||
|
||||
(def ^:const restricted?
|
||||
(def restricted?
|
||||
(complement +unrestricted+))
|
||||
|
||||
(def route-ref
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
[:rect {:x 0 :y 0 :width "100%" :height "100%"
|
||||
:fill "url(#gradient-hsv)"}]]))
|
||||
|
||||
(def ^:const default-dimensions
|
||||
(def default-dimensions
|
||||
{:pi-height 5
|
||||
:pi-width 5
|
||||
:si-height 10
|
||||
|
@ -75,7 +75,7 @@
|
|||
:p-width 200
|
||||
:s-height 200})
|
||||
|
||||
(def ^:const small-dimensions
|
||||
(def small-dimensions
|
||||
{:pi-height 5
|
||||
:pi-width 5
|
||||
:si-height 10
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
[:span i/pencil]
|
||||
[:span i/trash]]]))
|
||||
|
||||
(def ^:const ^:private page-title
|
||||
(def ^:private page-title
|
||||
(mx/component
|
||||
{:render page-title-render
|
||||
:name "page-title"
|
||||
|
@ -124,7 +124,7 @@
|
|||
[:div.project-th-icon.edit i/pencil]
|
||||
[:div.project-th-icon.delete i/trash]]]]]))
|
||||
|
||||
(def ^:const ^:private grid
|
||||
(def ^:private grid
|
||||
(mx/component
|
||||
{:render grid-render
|
||||
:name "grid"
|
||||
|
@ -180,7 +180,7 @@
|
|||
(udl/close!))}
|
||||
i/close]]))
|
||||
|
||||
(def ^:const ^:private new-element-lightbox
|
||||
(def ^:private new-element-lightbox
|
||||
(mx/component
|
||||
{:render new-element-lightbox-render
|
||||
:name "new-element-lightbox"}))
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
[:span {:on-click (constantly nil)}
|
||||
i/trash]])])))
|
||||
|
||||
(def ^:const ^:private page-title
|
||||
(def ^:private page-title
|
||||
(mx/component
|
||||
{:render page-title-render
|
||||
:name "page-title"
|
||||
|
@ -88,7 +88,7 @@
|
|||
[:span.element-subtitle
|
||||
(str (count (:icons props)) " elements")]])]]])))
|
||||
|
||||
(def ^:const ^:private nav
|
||||
(def ^:private nav
|
||||
(mx/component
|
||||
{:render nav-render
|
||||
:name "nav"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
;; --- Lentes
|
||||
|
||||
(def ^:const ^:private lightbox-ref
|
||||
(def ^:private lightbox-ref
|
||||
(-> (l/key :lightbox)
|
||||
(l/derive st/state)))
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
;; --- Lenses
|
||||
|
||||
(def ^:const ^:private message-ref
|
||||
(def ^:private message-ref
|
||||
(-> (l/key :message)
|
||||
(l/derive st/state)))
|
||||
|
||||
|
@ -84,7 +84,7 @@
|
|||
:dialog (dialog-box message)
|
||||
nil)))
|
||||
|
||||
(def ^:const messages
|
||||
(def messages
|
||||
(mx/component
|
||||
{:render messages-render
|
||||
:name "messages"
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
|
||||
;; --- Lenses
|
||||
|
||||
(def ^:const selected-shapes-ref
|
||||
(def selected-shapes-ref
|
||||
(-> (l/in [:workspace :selected])
|
||||
(l/derive st/state)))
|
||||
|
||||
(def ^:const drawing-state-ref
|
||||
(def drawing-state-ref
|
||||
(-> (l/in [:workspace :drawing])
|
||||
(l/derive st/state)))
|
||||
|
||||
|
|
|
@ -70,8 +70,8 @@
|
|||
|
||||
;; --- Text Styles Helpers
|
||||
|
||||
(def ^:const +style-attrs+ [:font-size])
|
||||
(def ^:const +select-rect-attrs+
|
||||
(def +style-attrs+ [:font-size])
|
||||
(def +select-rect-attrs+
|
||||
{:stroke-dasharray "5,5"
|
||||
:style {:stroke "#333" :fill "transparent"
|
||||
:stroke-opacity "0.4"}})
|
||||
|
|
|
@ -38,27 +38,27 @@
|
|||
(-> (l/lens getter)
|
||||
(l/derive st/state))))
|
||||
|
||||
(def ^:const selected-shapes-ref
|
||||
(def selected-shapes-ref
|
||||
(as-> (l/in [:selected]) $
|
||||
(l/derive $ workspace-ref)))
|
||||
|
||||
(def ^:const toolboxes-ref
|
||||
(def toolboxes-ref
|
||||
(as-> (l/in [:toolboxes]) $
|
||||
(l/derive $ workspace-ref)))
|
||||
|
||||
(def ^:const flags-ref
|
||||
(def flags-ref
|
||||
(as-> (l/in [:flags]) $
|
||||
(l/derive $ workspace-ref)))
|
||||
|
||||
(def ^:const shapes-by-id-ref
|
||||
(def shapes-by-id-ref
|
||||
(as-> (l/key :shapes-by-id) $
|
||||
(l/derive $ st/state)))
|
||||
|
||||
(def ^:const zoom-ref
|
||||
(def zoom-ref
|
||||
(-> (l/in [:workspace :zoom])
|
||||
(l/derive st/state)))
|
||||
|
||||
(def ^:const alignment-ref
|
||||
(def alignment-ref
|
||||
(letfn [(getter [flags]
|
||||
(and (contains? flags :grid/indexed)
|
||||
(contains? flags :grid/alignment)
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
;; --- Lenses
|
||||
|
||||
(def ^:const ^:private clipboard-ref
|
||||
(def ^:private clipboard-ref
|
||||
(-> (l/key :clipboard)
|
||||
(l/derive st/state)))
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
[uxbox.main.geom.point :as gpt]
|
||||
[uxbox.util.dom :as dom]))
|
||||
|
||||
(def ^:private ^:const immanted-zones
|
||||
(def ^:private immanted-zones
|
||||
(let [transform #(vector (- % 7) (+ % 7) %)]
|
||||
(concat
|
||||
(mapv transform (range 0 181 15))
|
||||
|
@ -105,7 +105,7 @@
|
|||
(if (and p1 p2)
|
||||
(overlay-line-render own p1 p2))])))
|
||||
|
||||
(def ^:const overlay
|
||||
(def overlay
|
||||
(mx/component
|
||||
{:render #(overlay-render % (:rum/local %))
|
||||
:will-mount #(overlay-will-mount % (:rum/local %))
|
||||
|
|
|
@ -18,17 +18,17 @@
|
|||
|
||||
;; --- Constants & Helpers
|
||||
|
||||
(def ^:const step-padding 20)
|
||||
(def ^:const step-size 10)
|
||||
(def step-padding 20)
|
||||
(def step-size 10)
|
||||
|
||||
(defn big-ticks-mod [zoom] (/ 100 zoom))
|
||||
(defn mid-ticks-mod [zoom] (/ 50 zoom))
|
||||
|
||||
(def ^:const +ticks+
|
||||
(def +ticks+
|
||||
(concat (range (- (/ c/viewport-width 1)) 0 step-size)
|
||||
(range 0 (/ c/viewport-width 1) step-size)))
|
||||
|
||||
(def ^:const rule-padding 20)
|
||||
(def rule-padding 20)
|
||||
|
||||
(defn- make-vertical-tick
|
||||
[zoom acc value]
|
||||
|
@ -115,7 +115,7 @@
|
|||
[:path {:d (str/join " " path) :stroke "#9da2a6"}]
|
||||
labels])))
|
||||
|
||||
(def ^:const ^:private horizontal-rule-ticks
|
||||
(def ^:private horizontal-rule-ticks
|
||||
(mx/component
|
||||
{:render horizontal-rule-ticks-render
|
||||
:name "horizontal-rule-ticks"
|
||||
|
@ -134,7 +134,7 @@
|
|||
[:path {:d (str/join " " path) :stroke "#9da2a6"}]
|
||||
labels])))
|
||||
|
||||
(def ^:const ^:private vertical-rule-ticks
|
||||
(def ^:private vertical-rule-ticks
|
||||
(mx/component
|
||||
{:render vertical-rule-ticks-render
|
||||
:name "vertical-rule-ticks"
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
;; --- Constants
|
||||
|
||||
(def ^:const +circle-props+
|
||||
(def +circle-props+
|
||||
{:r 6
|
||||
:style {:fillOpacity "1"
|
||||
:strokeWidth "1px"
|
||||
|
@ -28,7 +28,7 @@
|
|||
|
||||
;; --- Lenses
|
||||
|
||||
(def ^:const selected-shapes-ref
|
||||
(def selected-shapes-ref
|
||||
(letfn [(getter [state]
|
||||
(let [selected (get-in state [:workspace :selected])]
|
||||
(mapv #(get-in state [:shapes-by-id %]) selected)))]
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
;; --- Shortcuts
|
||||
|
||||
(defonce ^:const +shortcuts+
|
||||
(defonce +shortcuts+
|
||||
{:shift+g #(rs/emit! (dw/toggle-flag :grid))
|
||||
:ctrl+g #(rs/emit! (uds/group-selected))
|
||||
:ctrl+shift+g #(rs/emit! (uds/degroup-selected))
|
||||
|
|
|
@ -37,27 +37,27 @@
|
|||
;; Draw Tools
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(def ^:const +draw-tool-rect+
|
||||
(def +draw-tool-rect+
|
||||
{:type :rect
|
||||
:name "Rect"
|
||||
:stroke "#000000"})
|
||||
|
||||
(def ^:const +draw-tool-circle+
|
||||
(def +draw-tool-circle+
|
||||
{:type :circle
|
||||
:name "Circle"})
|
||||
|
||||
(def ^:const +draw-tool-line+
|
||||
(def +draw-tool-line+
|
||||
{:type :line
|
||||
:name "Line"
|
||||
:stroke-type :solid
|
||||
:stroke "#000000"})
|
||||
|
||||
(def ^:const +draw-tool-text+
|
||||
(def +draw-tool-text+
|
||||
{:type :text
|
||||
:name "Text"
|
||||
:content "Hello world"})
|
||||
|
||||
(def ^:const +draw-tools+
|
||||
(def +draw-tools+
|
||||
{:rect
|
||||
{:icon i/box
|
||||
:help (tr "ds.help.rect")
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
;; --- Lenses
|
||||
|
||||
(def ^:const history-ref
|
||||
(def history-ref
|
||||
(as-> (l/in [:workspace :history]) $
|
||||
(l/derive $ st/state)))
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
;; Lenses
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(def ^:private ^:const drawing-shape
|
||||
(def ^:private drawing-shape
|
||||
"A focused vision of the drawing property
|
||||
of the workspace status. This avoids
|
||||
rerender the whole toolbox on each workspace
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
:name "options"
|
||||
:mixins [mx/static (mx/local)]}))
|
||||
|
||||
(def ^:const selected-shape-ref
|
||||
(def selected-shape-ref
|
||||
(letfn [(getter [state]
|
||||
(let [selected (get-in state [:workspace :selected])]
|
||||
(when (= 1 (count selected))
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
|
||||
;; --- Lightbox
|
||||
|
||||
(def ^:const +page-defaults+
|
||||
(def +page-defaults+
|
||||
{:width 1920
|
||||
:height 1080
|
||||
:layout :desktop})
|
||||
|
|
Loading…
Add table
Reference in a new issue