mirror of
https://github.com/penpot/penpot.git
synced 2025-05-22 21:16:10 +02:00
♻️ Rename specs -> types
NO FUNCTIONALITY IS CHANGED in this commit, only moving things around
This commit is contained in:
parent
29220cd0d3
commit
6f94745aed
38 changed files with 348 additions and 352 deletions
|
@ -10,7 +10,7 @@
|
|||
[app.common.geom.point :as gpt]
|
||||
[app.common.pages.helpers :as cph]
|
||||
[app.common.spec :as us]
|
||||
[app.common.spec.interactions :as cti]
|
||||
[app.common.types.shape.interactions :as ctsi]
|
||||
[app.main.data.comments :as dcm]
|
||||
[app.main.data.fonts :as df]
|
||||
[app.main.repo :as rp]
|
||||
|
@ -389,7 +389,7 @@
|
|||
|
||||
([frame-id animation]
|
||||
(us/verify ::us/uuid frame-id)
|
||||
(us/verify (s/nilable ::cti/animation) animation)
|
||||
(us/verify (s/nilable ::ctsi/animation) animation)
|
||||
(ptk/reify ::go-to-frame
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
|
@ -480,7 +480,7 @@
|
|||
(us/verify ::gpt/point position)
|
||||
(us/verify (s/nilable ::us/boolean) close-click-outside)
|
||||
(us/verify (s/nilable ::us/boolean) background-overlay)
|
||||
(us/verify (s/nilable ::cti/animation) animation)
|
||||
(us/verify (s/nilable ::ctsi/animation) animation)
|
||||
(ptk/reify ::open-overlay
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
|
@ -505,7 +505,7 @@
|
|||
(us/verify ::gpt/point position)
|
||||
(us/verify (s/nilable ::us/boolean) close-click-outside)
|
||||
(us/verify (s/nilable ::us/boolean) background-overlay)
|
||||
(us/verify (s/nilable ::cti/animation) animation)
|
||||
(us/verify (s/nilable ::ctsi/animation) animation)
|
||||
(ptk/reify ::toggle-overlay
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
|
@ -524,13 +524,13 @@
|
|||
animation)
|
||||
(do-close-overlay state
|
||||
(:id frame)
|
||||
(cti/invert-direction animation)))))))
|
||||
(ctsi/invert-direction animation)))))))
|
||||
|
||||
(defn close-overlay
|
||||
([frame-id] (close-overlay frame-id nil))
|
||||
([frame-id animation]
|
||||
(us/verify ::us/uuid frame-id)
|
||||
(us/verify (s/nilable ::cti/animation) animation)
|
||||
(us/verify (s/nilable ::ctsi/animation) animation)
|
||||
(ptk/reify ::close-overlay
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
[app.common.pages.changes-builder :as pcb]
|
||||
[app.common.pages.helpers :as cph]
|
||||
[app.common.spec :as us]
|
||||
[app.common.spec.shape :as spec.shape]
|
||||
[app.common.text :as txt]
|
||||
[app.common.transit :as t]
|
||||
[app.common.types.shape :as cts]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.config :as cfg]
|
||||
[app.main.data.events :as ev]
|
||||
|
@ -62,7 +62,7 @@
|
|||
[cuerdas.core :as str]
|
||||
[potok.core :as ptk]))
|
||||
|
||||
(s/def ::shape-attrs ::spec.shape/shape-attrs)
|
||||
(s/def ::shape-attrs ::cts/shape-attrs)
|
||||
(s/def ::set-of-string
|
||||
(s/every string? :kind set?))
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
[app.common.logging :as log]
|
||||
[app.common.pages :as cp]
|
||||
[app.common.pages.changes-builder :as pcb]
|
||||
[app.common.pages.changes-spec :as pcs]
|
||||
[app.common.pages.helpers :as cph]
|
||||
[app.common.spec :as us]
|
||||
[app.common.spec.change :as spec.change]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[app.main.data.workspace.undo :as dwu]
|
||||
|
@ -159,8 +159,8 @@
|
|||
[:workspace-data]
|
||||
[:workspace-libraries file-id :data])]
|
||||
(try
|
||||
(us/assert ::spec.change/changes redo-changes)
|
||||
(us/assert ::spec.change/changes undo-changes)
|
||||
(us/assert ::pcs/changes redo-changes)
|
||||
(us/assert ::pcs/changes undo-changes)
|
||||
|
||||
(update-in state path (fn [file]
|
||||
(-> file
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
[app.common.pages.changes-builder :as pcb]
|
||||
[app.common.pages.helpers :as cph]
|
||||
[app.common.spec :as us]
|
||||
[app.common.spec.interactions :as csi]
|
||||
[app.common.spec.page :as csp]
|
||||
[app.common.spec.shape :as spec.shape]
|
||||
[app.common.types.page :as ctp]
|
||||
[app.common.types.shape :as cts]
|
||||
[app.common.types.shape.interactions :as ctsi]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.data.workspace.changes :as dch]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
|
@ -29,7 +29,7 @@
|
|||
;; Change this to :info :debug or :trace to debug this module
|
||||
(log/set-level! :warn)
|
||||
|
||||
(s/def ::shape-attrs ::spec.shape/shape-attrs)
|
||||
(s/def ::shape-attrs ::cts/shape-attrs)
|
||||
(s/def ::set-of-string (s/every string? :kind set?))
|
||||
(s/def ::ordered-set-of-uuid (s/every uuid? :kind d/ordered-set?))
|
||||
|
||||
|
@ -382,7 +382,7 @@
|
|||
;; If any of the deleted shapes is the destination of
|
||||
;; some interaction, this must be deleted, too.
|
||||
(let [interactions (:interactions shape)]
|
||||
(some #(and (csi/has-destination %)
|
||||
(some #(and (ctsi/has-destination %)
|
||||
(contains? ids (:destination %)))
|
||||
interactions)))
|
||||
(vals objects))
|
||||
|
@ -451,13 +451,13 @@
|
|||
(update shape :interactions
|
||||
(fn [interactions]
|
||||
(when interactions
|
||||
(d/removev #(and (csi/has-destination %)
|
||||
(d/removev #(and (ctsi/has-destination %)
|
||||
(contains? ids (:destination %)))
|
||||
interactions))))))
|
||||
(cond->
|
||||
(seq starting-flows)
|
||||
(pcb/update-page-option :flows (fn [flows]
|
||||
(reduce #(csp/remove-flow %1 (:id %2))
|
||||
(reduce #(ctp/remove-flow %1 (:id %2))
|
||||
flows
|
||||
starting-flows)))))]
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
[app.common.geom.shapes :as gsh]
|
||||
[app.common.pages.changes-builder :as pcb]
|
||||
[app.common.spec :as us]
|
||||
[app.common.spec.page :as csp]
|
||||
[app.common.types.page :as ctp]
|
||||
[app.main.data.workspace.changes :as dwc]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[beicon.core :as rx]
|
||||
|
@ -24,7 +24,7 @@
|
|||
(merge guide))))
|
||||
|
||||
(defn update-guides [guide]
|
||||
(us/verify ::csp/guide guide)
|
||||
(us/verify ::ctp/guide guide)
|
||||
(ptk/reify ::update-guides
|
||||
ptk/WatchEvent
|
||||
(watch [it state _]
|
||||
|
@ -36,7 +36,7 @@
|
|||
(rx/of (dwc/commit-changes changes))))))
|
||||
|
||||
(defn remove-guide [guide]
|
||||
(us/verify ::csp/guide guide)
|
||||
(us/verify ::ctp/guide guide)
|
||||
(ptk/reify ::remove-guide
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
[app.common.pages.changes-builder :as pcb]
|
||||
[app.common.pages.helpers :as cph]
|
||||
[app.common.spec :as us]
|
||||
[app.common.spec.interactions :as csi]
|
||||
[app.common.spec.page :as csp]
|
||||
[app.common.types.page :as ctp]
|
||||
[app.common.types.shape.interactions :as ctsi]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.data.workspace.changes :as dch]
|
||||
[app.main.data.workspace.common :as dwc]
|
||||
|
@ -41,7 +41,7 @@
|
|||
(rx/of (dch/commit-changes
|
||||
(-> (pcb/empty-changes it)
|
||||
(pcb/with-page page)
|
||||
(pcb/update-page-option :flows csp/add-flow new-flow))))))))
|
||||
(pcb/update-page-option :flows ctp/add-flow new-flow))))))))
|
||||
|
||||
(defn add-flow-selected-frame
|
||||
[]
|
||||
|
@ -61,7 +61,7 @@
|
|||
(rx/of (dch/commit-changes
|
||||
(-> (pcb/empty-changes it)
|
||||
(pcb/with-page page)
|
||||
(pcb/update-page-option :flows csp/remove-flow flow-id))))))))
|
||||
(pcb/update-page-option :flows ctp/remove-flow flow-id))))))))
|
||||
|
||||
(defn rename-flow
|
||||
[flow-id name]
|
||||
|
@ -74,8 +74,8 @@
|
|||
(rx/of (dch/commit-changes
|
||||
(-> (pcb/empty-changes it)
|
||||
(pcb/with-page page)
|
||||
(pcb/update-page-option :flows csp/update-flow flow-id
|
||||
#(csp/rename-flow % name)))))))))
|
||||
(pcb/update-page-option :flows ctp/update-flow flow-id
|
||||
#(ctp/rename-flow % name)))))))))
|
||||
|
||||
(defn start-rename-flow
|
||||
[id]
|
||||
|
@ -99,8 +99,8 @@
|
|||
in the page"
|
||||
[objects frame-id]
|
||||
(let [children (cph/get-children-with-self objects frame-id)]
|
||||
(or (some csi/flow-origin? (map :interactions children))
|
||||
(some #(csi/flow-to? % frame-id) (map :interactions (vals objects))))))
|
||||
(or (some ctsi/flow-origin? (map :interactions children))
|
||||
(some #(ctsi/flow-to? % frame-id) (map :interactions (vals objects))))))
|
||||
|
||||
(defn add-new-interaction
|
||||
([shape] (add-new-interaction shape nil))
|
||||
|
@ -116,15 +116,15 @@
|
|||
page-id
|
||||
:options
|
||||
:flows] [])
|
||||
flow (csp/get-frame-flow flows (:id frame))]
|
||||
flow (ctp/get-frame-flow flows (:id frame))]
|
||||
(rx/concat
|
||||
(rx/of (dch/update-shapes [(:id shape)]
|
||||
(fn [shape]
|
||||
(let [new-interaction (csi/set-destination
|
||||
csi/default-interaction
|
||||
(let [new-interaction (ctsi/set-destination
|
||||
ctsi/default-interaction
|
||||
destination)]
|
||||
(update shape :interactions
|
||||
csi/add-interaction new-interaction)))))
|
||||
ctsi/add-interaction new-interaction)))))
|
||||
(when (and (not (connected-frame? objects (:id frame)))
|
||||
(nil? flow))
|
||||
(rx/of (add-flow (:id frame))))))))))
|
||||
|
@ -137,7 +137,7 @@
|
|||
(rx/of (dch/update-shapes [(:id shape)]
|
||||
(fn [shape]
|
||||
(update shape :interactions
|
||||
csi/remove-interaction index)))))))
|
||||
ctsi/remove-interaction index)))))))
|
||||
|
||||
(defn update-interaction
|
||||
[shape index update-fn]
|
||||
|
@ -147,7 +147,7 @@
|
|||
(rx/of (dch/update-shapes [(:id shape)]
|
||||
(fn [shape]
|
||||
(update shape :interactions
|
||||
csi/update-interaction index update-fn)))))))
|
||||
ctsi/update-interaction index update-fn)))))))
|
||||
|
||||
(declare move-edit-interaction)
|
||||
(declare finish-edit-interaction)
|
||||
|
@ -219,11 +219,11 @@
|
|||
change-interaction
|
||||
(fn [interaction]
|
||||
(cond-> interaction
|
||||
(not (csi/has-destination interaction))
|
||||
(csi/set-action-type :navigate)
|
||||
(not (ctsi/has-destination interaction))
|
||||
(ctsi/set-action-type :navigate)
|
||||
|
||||
:always
|
||||
(csi/set-destination (:id target-frame))))]
|
||||
(ctsi/set-destination (:id target-frame))))]
|
||||
|
||||
(cond
|
||||
(or (nil? shape)
|
||||
|
@ -322,7 +322,7 @@
|
|||
|
||||
new-interactions
|
||||
(update interactions index
|
||||
#(csi/set-overlay-position % overlay-pos))]
|
||||
#(ctsi/set-overlay-position % overlay-pos))]
|
||||
|
||||
(rx/of (dch/update-shapes [(:id shape)] #(merge % {:interactions new-interactions})))))))
|
||||
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
[app.common.logging :as log]
|
||||
[app.common.pages :as cp]
|
||||
[app.common.pages.changes-builder :as pcb]
|
||||
[app.common.pages.changes-spec :as pcs]
|
||||
[app.common.pages.helpers :as cph]
|
||||
[app.common.spec :as us]
|
||||
[app.common.spec.change :as spec.change]
|
||||
[app.common.spec.color :as spec.color]
|
||||
[app.common.spec.file :as spec.file]
|
||||
[app.common.spec.typography :as spec.typography]
|
||||
[app.common.types.color :as ctc]
|
||||
[app.common.types.file :as ctf]
|
||||
[app.common.types.typography :as ctt]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.data.dashboard :as dd]
|
||||
[app.main.data.events :as ev]
|
||||
|
@ -98,7 +98,7 @@
|
|||
color (-> color
|
||||
(assoc :id id)
|
||||
(assoc :name (default-color-name color)))]
|
||||
(us/assert ::spec.color/color color)
|
||||
(us/assert ::ctc/color color)
|
||||
(ptk/reify ::add-color
|
||||
IDeref
|
||||
(-deref [_] color)
|
||||
|
@ -112,7 +112,7 @@
|
|||
|
||||
(defn add-recent-color
|
||||
[color]
|
||||
(us/assert ::spec.color/recent-color color)
|
||||
(us/assert ::ctc/recent-color color)
|
||||
(ptk/reify ::add-recent-color
|
||||
ptk/WatchEvent
|
||||
(watch [it _ _]
|
||||
|
@ -141,7 +141,7 @@
|
|||
|
||||
(defn update-color
|
||||
[color file-id]
|
||||
(us/assert ::spec.color/color color)
|
||||
(us/assert ::ctc/color color)
|
||||
(us/assert ::us/uuid file-id)
|
||||
(ptk/reify ::update-color
|
||||
ptk/WatchEvent
|
||||
|
@ -175,7 +175,7 @@
|
|||
|
||||
(defn add-media
|
||||
[media]
|
||||
(us/assert ::spec.file/media-object media)
|
||||
(us/assert ::ctf/media-object media)
|
||||
(ptk/reify ::add-media
|
||||
ptk/WatchEvent
|
||||
(watch [it _ _]
|
||||
|
@ -217,7 +217,7 @@
|
|||
([typography] (add-typography typography true))
|
||||
([typography edit?]
|
||||
(let [typography (update typography :id #(or % (uuid/next)))]
|
||||
(us/assert ::spec.typography/typography typography)
|
||||
(us/assert ::ctt/typography typography)
|
||||
(ptk/reify ::add-typography
|
||||
IDeref
|
||||
(-deref [_] typography)
|
||||
|
@ -244,7 +244,7 @@
|
|||
|
||||
(defn update-typography
|
||||
[typography file-id]
|
||||
(us/assert ::spec.typography/typography typography)
|
||||
(us/assert ::ctt/typography typography)
|
||||
(us/assert ::us/uuid file-id)
|
||||
(ptk/reify ::update-typography
|
||||
ptk/WatchEvent
|
||||
|
@ -462,7 +462,7 @@
|
|||
(defn ext-library-changed
|
||||
[file-id modified-at revn changes]
|
||||
(us/assert ::us/uuid file-id)
|
||||
(us/assert ::spec.change/changes changes)
|
||||
(us/assert ::pcs/changes changes)
|
||||
(ptk/reify ::ext-library-changed
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
[app.common.pages.changes-builder :as pcb]
|
||||
[app.common.pages.helpers :as cph]
|
||||
[app.common.spec :as us]
|
||||
[app.common.spec.color :as color]
|
||||
[app.common.text :as txt]
|
||||
[app.common.types.color :as ctc]
|
||||
[app.main.data.workspace.common :as dwc]
|
||||
[app.main.data.workspace.groups :as dwg]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
|
@ -299,7 +299,7 @@
|
|||
|
||||
(defmethod uses-assets? :colors
|
||||
[_ shape library-id _]
|
||||
(color/uses-library-colors? shape library-id))
|
||||
(ctc/uses-library-colors? shape library-id))
|
||||
|
||||
(defmethod uses-assets? :typographies
|
||||
[_ shape library-id _]
|
||||
|
@ -331,7 +331,7 @@
|
|||
(let [library-colors (get-assets library-id :colors state)]
|
||||
(pcb/update-shapes changes
|
||||
[(:id shape)]
|
||||
#(color/sync-shape-colors % library-id library-colors))))
|
||||
#(ctc/sync-shape-colors % library-id library-colors))))
|
||||
|
||||
(defmethod generate-sync-shape :typographies
|
||||
[_ changes library-id state container shape]
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
(ns app.main.data.workspace.notifications
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.pages.changes-spec :as pcs]
|
||||
[app.common.spec :as us]
|
||||
[app.common.spec.change :as spec.change]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.data.websocket :as dws]
|
||||
[app.main.data.workspace.changes :as dch]
|
||||
|
@ -184,7 +184,7 @@
|
|||
(s/def ::file-id uuid?)
|
||||
(s/def ::session-id uuid?)
|
||||
(s/def ::revn integer?)
|
||||
(s/def ::changes ::spec.change/changes)
|
||||
(s/def ::changes ::pcs/changes)
|
||||
|
||||
(s/def ::file-change-event
|
||||
(s/keys :req-un [::type ::profile-id ::file-id ::session-id ::revn ::changes]))
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
[app.common.data :as d]
|
||||
[app.common.logging :as log]
|
||||
[app.common.pages :as cp]
|
||||
[app.common.pages.changes-spec :as pcs]
|
||||
[app.common.spec :as us]
|
||||
[app.common.spec.change :as spec.change]
|
||||
[app.common.spec.file :as spec.file]
|
||||
[app.common.types.file :as ctf]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.config :as cf]
|
||||
[app.main.data.dashboard :as dd]
|
||||
|
@ -199,7 +199,7 @@
|
|||
:updated-at (dt/now)))))))
|
||||
|
||||
(s/def ::shapes-changes-persisted
|
||||
(s/keys :req-un [::revn ::spec.change/changes]))
|
||||
(s/keys :req-un [::revn ::pcs/changes]))
|
||||
|
||||
(defn shapes-persisted-event? [event]
|
||||
(= (ptk/type event) ::changes-persisted))
|
||||
|
@ -237,7 +237,7 @@
|
|||
(s/def ::version ::us/integer)
|
||||
(s/def ::revn ::us/integer)
|
||||
(s/def ::ordering ::us/integer)
|
||||
(s/def ::data ::spec.file/data)
|
||||
(s/def ::data ::ctf/data)
|
||||
|
||||
(s/def ::file ::dd/file)
|
||||
(s/def ::project ::dd/project)
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
[app.common.pages.changes-builder :as pcb]
|
||||
[app.common.pages.helpers :as cph]
|
||||
[app.common.spec :as us]
|
||||
[app.common.spec.interactions :as cti]
|
||||
[app.common.spec.page :as ctp]
|
||||
[app.common.types.page :as ctp]
|
||||
[app.common.types.shape.interactions :as ctsi]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.data.modal :as md]
|
||||
[app.main.data.workspace.changes :as dch]
|
||||
|
@ -326,7 +326,7 @@
|
|||
:shapes [])
|
||||
(dissoc :use-for-thumbnail?)
|
||||
(gsh/move delta)
|
||||
(d/update-when :interactions #(cti/remap-interactions % ids-map objects)))
|
||||
(d/update-when :interactions #(ctsi/remap-interactions % ids-map objects)))
|
||||
|
||||
changes (-> (pcb/add-object changes new-frame)
|
||||
(pcb/amend-last-change #(assoc % :old-id (:id obj))))
|
||||
|
@ -361,7 +361,7 @@
|
|||
:frame-id frame-id)
|
||||
(dissoc :shapes)
|
||||
(gsh/move delta)
|
||||
(d/update-when :interactions #(cti/remap-interactions % ids-map objects)))
|
||||
(d/update-when :interactions #(ctsi/remap-interactions % ids-map objects)))
|
||||
|
||||
changes (-> (pcb/add-object changes new-obj {:ignore-touched true})
|
||||
(pcb/amend-last-change #(assoc % :old-id (:id obj))))]
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
(ns app.main.data.workspace.undo
|
||||
(:require
|
||||
[app.common.pages.changes-spec :as pcs]
|
||||
[app.common.spec :as us]
|
||||
[app.common.spec.change :as spec.change]
|
||||
[cljs.spec.alpha :as s]
|
||||
[potok.core :as ptk]))
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
|||
;; Undo / Redo
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(s/def ::undo-changes ::spec.change/changes)
|
||||
(s/def ::redo-changes ::spec.change/changes)
|
||||
(s/def ::undo-changes ::pcs/changes)
|
||||
(s/def ::redo-changes ::pcs/changes)
|
||||
(s/def ::undo-entry
|
||||
(s/keys :req-un [::undo-changes ::redo-changes]))
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
[app.common.data :as d]
|
||||
[app.common.data.macros :as dm]
|
||||
[app.common.geom.shapes :as gsh]
|
||||
[app.common.spec.radius :as ctr]
|
||||
[app.common.spec.shape :refer [stroke-caps-line stroke-caps-marker]]
|
||||
[app.common.types.shape :refer [stroke-caps-line stroke-caps-marker]]
|
||||
[app.common.types.shape.radius :as ctsr]
|
||||
[app.main.ui.context :as muc]
|
||||
[app.util.object :as obj]
|
||||
[app.util.svg :as usvg]
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
|
||||
(defn add-border-radius [attrs {:keys [x y width height] :as shape}]
|
||||
(case (ctr/radius-mode shape)
|
||||
(case (ctsr/radius-mode shape)
|
||||
:radius-1
|
||||
(let [radius (gsh/shape-corners-1 shape)]
|
||||
(obj/merge! attrs #js {:rx radius :ry radius}))
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
(ns app.main.ui.viewer.handoff.attributes.layout
|
||||
(:require
|
||||
[app.common.spec.radius :as ctr]
|
||||
[app.common.types.shape.radius :as ctsr]
|
||||
[app.main.ui.components.copy-button :refer [copy-button]]
|
||||
[app.main.ui.formats :as fmt]
|
||||
[app.util.code-gen :as cg]
|
||||
|
@ -59,13 +59,13 @@
|
|||
[:div.attributes-value (fmt/format-pixels y)]
|
||||
[:& copy-button {:data (copy-data selrect :y)}]])
|
||||
|
||||
(when (ctr/radius-1? shape)
|
||||
(when (ctsr/radius-1? shape)
|
||||
[:div.attributes-unit-row
|
||||
[:div.attributes-label (tr "handoff.attributes.layout.radius")]
|
||||
[:div.attributes-value (fmt/format-pixels (:rx shape 0))]
|
||||
[:& copy-button {:data (copy-data shape :rx)}]])
|
||||
|
||||
(when (ctr/radius-4? shape)
|
||||
(when (ctsr/radius-4? shape)
|
||||
[:div.attributes-unit-row
|
||||
[:div.attributes-label (tr "handoff.attributes.layout.radius")]
|
||||
[:div.attributes-value
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
[app.common.geom.matrix :as gmt]
|
||||
[app.common.geom.point :as gpt]
|
||||
[app.common.pages.helpers :as cph]
|
||||
[app.common.spec.page :as csp]
|
||||
[app.common.types.page :as ctp]
|
||||
[app.main.data.comments :as dcm]
|
||||
[app.main.data.viewer :as dv]
|
||||
[app.main.refs :as refs]
|
||||
|
@ -108,7 +108,7 @@
|
|||
frames (:frames page)
|
||||
frame (get frames index)
|
||||
current-flow (mf/use-state
|
||||
(csp/get-frame-flow flows (:id frame)))
|
||||
(ctp/get-frame-flow flows (:id frame)))
|
||||
|
||||
show-dropdown? (mf/use-state false)
|
||||
toggle-dropdown (mf/use-fn #(swap! show-dropdown? not))
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
[app.common.data :as d]
|
||||
[app.common.geom.shapes :as gsh]
|
||||
[app.common.pages.helpers :as cph]
|
||||
[app.common.spec.interactions :as cti]
|
||||
[app.common.types.shape.interactions :as ctsi]
|
||||
[app.main.data.viewer :as dv]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
|
@ -56,10 +56,10 @@
|
|||
background-overlay (:background-overlay interaction)
|
||||
|
||||
dest-frame (get objects dest-frame-id)
|
||||
position (cti/calc-overlay-position interaction
|
||||
base-frame
|
||||
dest-frame
|
||||
frame-offset)]
|
||||
position (ctsi/calc-overlay-position interaction
|
||||
base-frame
|
||||
dest-frame
|
||||
frame-offset)]
|
||||
(when dest-frame-id
|
||||
(st/emit! (dv/open-overlay dest-frame-id
|
||||
position
|
||||
|
@ -123,10 +123,10 @@
|
|||
background-overlay (:background-overlay interaction)
|
||||
|
||||
dest-frame (get objects dest-frame-id)
|
||||
position (cti/calc-overlay-position interaction
|
||||
base-frame
|
||||
dest-frame
|
||||
frame-offset)]
|
||||
position (ctsi/calc-overlay-position interaction
|
||||
base-frame
|
||||
dest-frame
|
||||
frame-offset)]
|
||||
(when dest-frame-id
|
||||
(st/emit! (dv/open-overlay dest-frame-id
|
||||
position
|
||||
|
@ -235,7 +235,7 @@
|
|||
|
||||
(if-not svg-element?
|
||||
[:> shape-container {:shape shape
|
||||
:cursor (when (cti/actionable? interactions) "pointer")
|
||||
:cursor (when (ctsi/actionable? interactions) "pointer")
|
||||
:on-mouse-down #(on-mouse-down % shape base-frame frame-offset objects)
|
||||
:on-mouse-up #(on-mouse-up % shape base-frame frame-offset objects)
|
||||
:on-mouse-enter #(on-mouse-enter % shape base-frame frame-offset objects)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.pages.helpers :as cph]
|
||||
[app.common.spec.page :as csp]
|
||||
[app.common.types.page :as ctp]
|
||||
[app.main.data.events :as ev]
|
||||
[app.main.data.modal :as modal]
|
||||
[app.main.data.workspace :as dw]
|
||||
|
@ -329,7 +329,7 @@
|
|||
is-frame? (and single? has-frame?)]
|
||||
|
||||
(when (and prototype? is-frame?)
|
||||
(let [flow (csp/get-frame-flow flows (-> shapes first :id))]
|
||||
(let [flow (ctp/get-frame-flow flows (-> shapes first :id))]
|
||||
(if (some? flow)
|
||||
[:& menu-entry {:title (tr "workspace.shape.menu.delete-flow-start")
|
||||
:on-click (do-remove-flow flow)}]
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
[app.common.data :as d]
|
||||
[app.common.data.macros :as dm]
|
||||
[app.common.pages.helpers :as cph]
|
||||
[app.common.spec.interactions :as csi]
|
||||
[app.common.spec.page :as csp]
|
||||
[app.common.types.page :as ctp]
|
||||
[app.common.types.shape.interactions :as ctsi]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.data.workspace :as dw]
|
||||
[app.main.data.workspace.interactions :as dwi]
|
||||
|
@ -80,7 +80,7 @@
|
|||
{:dissolve (tr "workspace.options.interaction-animation-dissolve")
|
||||
:slide (tr "workspace.options.interaction-animation-slide")}
|
||||
|
||||
(csi/allow-push? (:action-type interaction))
|
||||
(ctsi/allow-push? (:action-type interaction))
|
||||
(assoc :push (tr "workspace.options.interaction-animation-push"))))
|
||||
|
||||
(defn- easing-names
|
||||
|
@ -166,7 +166,7 @@
|
|||
(mf/defc shape-flows
|
||||
[{:keys [flows shape]}]
|
||||
(when (= (:type shape) :frame)
|
||||
(let [flow (csp/get-frame-flow flows (:id shape))]
|
||||
(let [flow (ctp/get-frame-flow flows (:id shape))]
|
||||
[:div.element-set.interactions-options
|
||||
[:div.element-set-title
|
||||
[:span (tr "workspace.options.flows.flow-start")]]
|
||||
|
@ -202,27 +202,27 @@
|
|||
change-event-type
|
||||
(fn [event]
|
||||
(let [value (-> event dom/get-target dom/get-value d/read-string)]
|
||||
(update-interaction index #(csi/set-event-type % value shape))))
|
||||
(update-interaction index #(ctsi/set-event-type % value shape))))
|
||||
|
||||
change-action-type
|
||||
(fn [event]
|
||||
(let [value (-> event dom/get-target dom/get-value d/read-string)]
|
||||
(update-interaction index #(csi/set-action-type % value))))
|
||||
(update-interaction index #(ctsi/set-action-type % value))))
|
||||
|
||||
change-delay
|
||||
(fn [value]
|
||||
(update-interaction index #(csi/set-delay % value)))
|
||||
(update-interaction index #(ctsi/set-delay % value)))
|
||||
|
||||
change-destination
|
||||
(fn [event]
|
||||
(let [value (-> event dom/get-target dom/get-value)
|
||||
value (when (not= value "") (uuid/uuid value))]
|
||||
(update-interaction index #(csi/set-destination % value))))
|
||||
(update-interaction index #(ctsi/set-destination % value))))
|
||||
|
||||
change-preserve-scroll
|
||||
(fn [event]
|
||||
(let [value (-> event dom/get-target dom/checked?)]
|
||||
(update-interaction index #(csi/set-preserve-scroll % value))))
|
||||
(update-interaction index #(ctsi/set-preserve-scroll % value))))
|
||||
|
||||
change-url
|
||||
(fn [event]
|
||||
|
@ -238,55 +238,55 @@
|
|||
(if (dom/valid? target)
|
||||
(do
|
||||
(dom/remove-class! target "error")
|
||||
(update-interaction index #(csi/set-url % value)))
|
||||
(update-interaction index #(ctsi/set-url % value)))
|
||||
(dom/add-class! target "error"))))
|
||||
|
||||
change-overlay-pos-type
|
||||
(fn [event]
|
||||
(let [value (-> event dom/get-target dom/get-value d/read-string)]
|
||||
(update-interaction index #(csi/set-overlay-pos-type % value shape objects))))
|
||||
(update-interaction index #(ctsi/set-overlay-pos-type % value shape objects))))
|
||||
|
||||
toggle-overlay-pos-type
|
||||
(fn [pos-type]
|
||||
(update-interaction index #(csi/toggle-overlay-pos-type % pos-type shape objects)))
|
||||
(update-interaction index #(ctsi/toggle-overlay-pos-type % pos-type shape objects)))
|
||||
|
||||
change-close-click-outside
|
||||
(fn [event]
|
||||
(let [value (-> event dom/get-target dom/checked?)]
|
||||
(update-interaction index #(csi/set-close-click-outside % value))))
|
||||
(update-interaction index #(ctsi/set-close-click-outside % value))))
|
||||
|
||||
change-background-overlay
|
||||
(fn [event]
|
||||
(let [value (-> event dom/get-target dom/checked?)]
|
||||
(update-interaction index #(csi/set-background-overlay % value))))
|
||||
(update-interaction index #(ctsi/set-background-overlay % value))))
|
||||
|
||||
change-animation-type
|
||||
(fn [event]
|
||||
(let [value (-> event dom/get-target dom/get-value d/read-string)]
|
||||
(update-interaction index #(csi/set-animation-type % value))))
|
||||
(update-interaction index #(ctsi/set-animation-type % value))))
|
||||
|
||||
change-duration
|
||||
(fn [value]
|
||||
(update-interaction index #(csi/set-duration % value)))
|
||||
(update-interaction index #(ctsi/set-duration % value)))
|
||||
|
||||
change-easing
|
||||
(fn [event]
|
||||
(let [value (-> event dom/get-target dom/get-value d/read-string)]
|
||||
(update-interaction index #(csi/set-easing % value))))
|
||||
(update-interaction index #(ctsi/set-easing % value))))
|
||||
|
||||
change-way
|
||||
(fn [event]
|
||||
(let [value (-> event dom/get-target dom/get-value d/read-string)]
|
||||
(update-interaction index #(csi/set-way % value))))
|
||||
(update-interaction index #(ctsi/set-way % value))))
|
||||
|
||||
change-direction
|
||||
(fn [value]
|
||||
(update-interaction index #(csi/set-direction % value)))
|
||||
(update-interaction index #(ctsi/set-direction % value)))
|
||||
|
||||
change-offset-effect
|
||||
(fn [event]
|
||||
(let [value (-> event dom/get-target dom/checked?)]
|
||||
(update-interaction index #(csi/set-offset-effect % value))))
|
||||
(update-interaction index #(ctsi/set-offset-effect % value))))
|
||||
]
|
||||
|
||||
[:*
|
||||
|
@ -318,7 +318,7 @@
|
|||
:value (dm/str value)} name]))]]
|
||||
|
||||
; Delay
|
||||
(when (csi/has-delay interaction)
|
||||
(when (ctsi/has-delay interaction)
|
||||
[:div.interactions-element
|
||||
[:span.element-set-subtitle.wide (tr "workspace.options.interaction-delay")]
|
||||
[:div.input-element {:title (tr "workspace.options.interaction-ms")}
|
||||
|
@ -340,7 +340,7 @@
|
|||
:value (str value)} name])]]
|
||||
|
||||
; Destination
|
||||
(when (csi/has-destination interaction)
|
||||
(when (ctsi/has-destination interaction)
|
||||
[:div.interactions-element
|
||||
[:span.element-set-subtitle.wide (tr "workspace.options.interaction-destination")]
|
||||
[:select.input-select
|
||||
|
@ -356,7 +356,7 @@
|
|||
:value (str (:id frame))} (:name frame)]))]])
|
||||
|
||||
; Preserve scroll
|
||||
(when (csi/has-preserve-scroll interaction)
|
||||
(when (ctsi/has-preserve-scroll interaction)
|
||||
[:div.interactions-element
|
||||
[:div.input-checkbox
|
||||
[:input {:type "checkbox"
|
||||
|
@ -367,7 +367,7 @@
|
|||
(tr "workspace.options.interaction-preserve-scroll")]]])
|
||||
|
||||
; URL
|
||||
(when (csi/has-url interaction)
|
||||
(when (ctsi/has-url interaction)
|
||||
[:div.interactions-element
|
||||
[:span.element-set-subtitle.wide (tr "workspace.options.interaction-url")]
|
||||
[:input.input-text {:type "url"
|
||||
|
@ -375,7 +375,7 @@
|
|||
:default-value (str (:url interaction))
|
||||
:on-blur change-url}]])
|
||||
|
||||
(when (csi/has-overlay-opts interaction)
|
||||
(when (ctsi/has-overlay-opts interaction)
|
||||
[:*
|
||||
; Overlay position (select)
|
||||
[:div.interactions-element
|
||||
|
@ -437,7 +437,7 @@
|
|||
[:label {:for (str "background-" index)}
|
||||
(tr "workspace.options.interaction-background")]]]])
|
||||
|
||||
(when (csi/has-animation? interaction)
|
||||
(when (ctsi/has-animation? interaction)
|
||||
[:*
|
||||
; Animation select
|
||||
[:div.interactions-element.separator
|
||||
|
@ -450,7 +450,7 @@
|
|||
[:option {:value (str value)} name])]]
|
||||
|
||||
; Direction
|
||||
(when (csi/has-way? interaction)
|
||||
(when (ctsi/has-way? interaction)
|
||||
[:div.interactions-element.interactions-way-buttons
|
||||
[:div.input-radio
|
||||
[:input {:type "radio"
|
||||
|
@ -470,7 +470,7 @@
|
|||
[:label {:for "way-out"} (tr "workspace.options.interaction-out")]]])
|
||||
|
||||
; Direction
|
||||
(when (csi/has-direction? interaction)
|
||||
(when (ctsi/has-direction? interaction)
|
||||
[:div.interactions-element.interactions-direction-buttons
|
||||
[:div.element-set-actions-button
|
||||
{:class (dom/classnames :active (= direction :right))
|
||||
|
@ -490,7 +490,7 @@
|
|||
i/animate-up]])
|
||||
|
||||
; Duration
|
||||
(when (csi/has-duration? interaction)
|
||||
(when (ctsi/has-duration? interaction)
|
||||
[:div.interactions-element
|
||||
[:span.element-set-subtitle.wide (tr "workspace.options.interaction-duration")]
|
||||
[:div.input-element {:title (tr "workspace.options.interaction-ms")}
|
||||
|
@ -502,7 +502,7 @@
|
|||
[:span.after (tr "workspace.options.interaction-ms")]]])
|
||||
|
||||
; Easing
|
||||
(when (csi/has-easing? interaction)
|
||||
(when (ctsi/has-easing? interaction)
|
||||
[:div.interactions-element
|
||||
[:span.element-set-subtitle.wide (tr "workspace.options.interaction-easing")]
|
||||
[:select.input-select
|
||||
|
@ -519,7 +519,7 @@
|
|||
:ease-in-out i/easing-ease-in-out)]])
|
||||
|
||||
; Offset effect
|
||||
(when (csi/has-offset-effect? interaction)
|
||||
(when (ctsi/has-offset-effect? interaction)
|
||||
[:div.interactions-element
|
||||
[:div.input-checkbox
|
||||
[:input {:type "checkbox"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.geom.shapes :as gsh]
|
||||
[app.common.spec.radius :as ctr]
|
||||
[app.common.types.shape.radius :as ctsr]
|
||||
[app.main.constants :refer [size-presets]]
|
||||
[app.main.data.workspace :as udw]
|
||||
[app.main.data.workspace.changes :as dch]
|
||||
|
@ -99,8 +99,8 @@
|
|||
|
||||
show-presets-dropdown? (mf/use-state false)
|
||||
|
||||
radius-mode (ctr/radius-mode values)
|
||||
all-equal? (ctr/all-equal? values)
|
||||
radius-mode (ctsr/radius-mode values)
|
||||
all-equal? (ctsr/all-equal? values)
|
||||
radius-multi? (mf/use-state nil)
|
||||
radius-input-ref (mf/use-ref nil)
|
||||
|
||||
|
@ -154,7 +154,7 @@
|
|||
(fn [update-fn]
|
||||
(dch/update-shapes ids-with-children
|
||||
(fn [shape]
|
||||
(if (ctr/has-radius? shape)
|
||||
(if (ctsr/has-radius? shape)
|
||||
(update-fn shape)
|
||||
shape)))))
|
||||
|
||||
|
@ -163,21 +163,21 @@
|
|||
(mf/deps ids)
|
||||
(fn [_value]
|
||||
(if all-equal?
|
||||
(st/emit! (change-radius ctr/switch-to-radius-1))
|
||||
(st/emit! (change-radius ctsr/switch-to-radius-1))
|
||||
(reset! radius-multi? true))))
|
||||
|
||||
on-switch-to-radius-4
|
||||
(mf/use-callback
|
||||
(mf/deps ids)
|
||||
(fn [_value]
|
||||
(st/emit! (change-radius ctr/switch-to-radius-4))
|
||||
(st/emit! (change-radius ctsr/switch-to-radius-4))
|
||||
(reset! radius-multi? false)))
|
||||
|
||||
on-radius-1-change
|
||||
(mf/use-callback
|
||||
(mf/deps ids)
|
||||
(fn [value]
|
||||
(st/emit! (change-radius #(ctr/set-radius-1 % value)))))
|
||||
(st/emit! (change-radius #(ctsr/set-radius-1 % value)))))
|
||||
|
||||
on-radius-multi-change
|
||||
(mf/use-callback
|
||||
|
@ -185,15 +185,15 @@
|
|||
(fn [event]
|
||||
(let [value (-> event dom/get-target dom/get-value d/parse-integer)]
|
||||
(when (some? value)
|
||||
(st/emit! (change-radius ctr/switch-to-radius-1)
|
||||
(change-radius #(ctr/set-radius-1 % value)))
|
||||
(st/emit! (change-radius ctsr/switch-to-radius-1)
|
||||
(change-radius #(ctsr/set-radius-1 % value)))
|
||||
(reset! radius-multi? false)))))
|
||||
|
||||
on-radius-4-change
|
||||
(mf/use-callback
|
||||
(mf/deps ids)
|
||||
(fn [value attr]
|
||||
(st/emit! (change-radius #(ctr/set-radius-4 % attr value)))))
|
||||
(st/emit! (change-radius #(ctsr/set-radius-4 % attr value)))))
|
||||
|
||||
on-width-change #(on-size-change % :width)
|
||||
on-height-change #(on-size-change % :height)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
[app.common.data.macros :as dm]
|
||||
[app.common.geom.shapes :as gsh]
|
||||
[app.common.pages.helpers :as cph]
|
||||
[app.common.spec.interactions :as cti]
|
||||
[app.common.types.shape.interactions :as ctsi]
|
||||
[app.main.data.workspace :as dw]
|
||||
[app.main.refs :as refs]
|
||||
[app.main.store :as st]
|
||||
|
@ -275,7 +275,7 @@
|
|||
[:g.non-selected
|
||||
(for [shape active-shapes]
|
||||
(for [[index interaction] (d/enumerate (:interactions shape))]
|
||||
(let [dest-shape (when (cti/destination? interaction)
|
||||
(let [dest-shape (when (ctsi/destination? interaction)
|
||||
(get objects (:destination interaction)))
|
||||
selected? (contains? selected (:id shape))
|
||||
level (calc-level index (:interactions shape))]
|
||||
|
@ -304,7 +304,7 @@
|
|||
(if (seq (:interactions shape))
|
||||
(for [[index interaction] (d/enumerate (:interactions shape))]
|
||||
(when-not (= index editing-interaction-index)
|
||||
(let [dest-shape (when (cti/destination? interaction)
|
||||
(let [dest-shape (when (ctsi/destination? interaction)
|
||||
(get objects (:destination interaction)))
|
||||
level (calc-level index (:interactions shape))]
|
||||
[:g {:key (dm/str "interaction-path-" (:id shape) "-" index)}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
[app.common.data.macros :as dm]
|
||||
[app.common.geom.matrix :as gmt]
|
||||
[app.common.geom.point :as gpt]
|
||||
[app.common.spec.interactions :as cti]
|
||||
[app.common.types.shape.interactions :as ctsi]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.util.color :as uc]
|
||||
[app.util.json :as json]
|
||||
|
@ -939,17 +939,17 @@
|
|||
(let [interaction {:event-type (get-meta node :event-type keyword)
|
||||
:action-type (get-meta node :action-type keyword)}]
|
||||
(cond-> interaction
|
||||
(cti/has-delay interaction)
|
||||
(ctsi/has-delay interaction)
|
||||
(assoc :delay (get-meta node :delay d/parse-double))
|
||||
|
||||
(cti/has-destination interaction)
|
||||
(ctsi/has-destination interaction)
|
||||
(assoc :destination (get-meta node :destination uuid/uuid)
|
||||
:preserve-scroll (get-meta node :preserve-scroll str->bool))
|
||||
|
||||
(cti/has-url interaction)
|
||||
(ctsi/has-url interaction)
|
||||
(assoc :url (get-meta node :url str))
|
||||
|
||||
(cti/has-overlay-opts interaction)
|
||||
(ctsi/has-overlay-opts interaction)
|
||||
(assoc :overlay-pos-type (get-meta node :overlay-pos-type keyword)
|
||||
:overlay-position (gpt/point
|
||||
(get-meta node :overlay-position-x d/parse-double)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue