mirror of
https://github.com/penpot/penpot.git
synced 2025-03-20 03:31:24 -05: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
backend/src/app/srepl
common
frontend/src/app
|
@ -7,7 +7,6 @@
|
|||
[app.common.logging :as l]
|
||||
[app.common.pages :as cp]
|
||||
[app.common.pages.migrations :as pmg]
|
||||
[app.common.spec.file :as spec.file]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.config :as cfg]
|
||||
[app.db :as db]
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
[app.common.geom.matrix :as gmt]
|
||||
[app.common.geom.shapes :as gsh]
|
||||
[app.common.pages.changes :as ch]
|
||||
[app.common.pages.changes-spec :as pcs]
|
||||
[app.common.pages.init :as init]
|
||||
[app.common.spec :as us]
|
||||
[app.common.spec.change :as spec.change]
|
||||
[app.common.uuid :as uuid]
|
||||
[cuerdas.core :as str]))
|
||||
|
||||
|
@ -44,9 +44,9 @@
|
|||
:frame-id (:current-frame-id file)))]
|
||||
|
||||
(when fail-on-spec?
|
||||
(us/verify ::spec.change/change change))
|
||||
(us/verify ::pcs/change change))
|
||||
|
||||
(let [valid? (us/valid? ::spec.change/change change)]
|
||||
(let [valid? (us/valid? ::pcs/change change)]
|
||||
#?(:cljs
|
||||
(when-not valid? (.warn js/console "Invalid shape" (clj->js change))))
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
[app.common.pages.helpers :as cph]
|
||||
[app.common.pages.init :as init]
|
||||
[app.common.spec :as us]
|
||||
[app.common.spec.change :as spec.change]
|
||||
[app.common.spec.shape :as spec.shape]))
|
||||
[app.common.pages.changes-spec :as pcs]
|
||||
[app.common.types.shape :as cts]))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Specific helpers
|
||||
|
@ -49,7 +49,7 @@
|
|||
;; When verify? false we spec the schema validation. Currently used to make just
|
||||
;; 1 validation even if the changes are applied twice
|
||||
(when verify?
|
||||
(us/assert ::spec.change/changes items))
|
||||
(us/assert ::pcs/changes items))
|
||||
|
||||
(let [result (reduce #(or (process-change %1 %2) %1) data items)]
|
||||
;; Validate result shapes (only on the backend)
|
||||
|
@ -59,7 +59,7 @@
|
|||
(doseq [[id shape] (:objects page)]
|
||||
(when-not (= shape (get-in data [:pages-index page-id :objects id]))
|
||||
;; If object has change verify is correct
|
||||
(us/verify ::spec.shape/shape shape))))))
|
||||
(us/verify ::cts/shape shape))))))
|
||||
|
||||
result)))
|
||||
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
;;
|
||||
;; Copyright (c) UXBOX Labs SL
|
||||
|
||||
(ns app.common.spec.change
|
||||
(ns app.common.pages.changes-spec
|
||||
(:require
|
||||
[app.common.spec :as us]
|
||||
[app.common.spec.color :as color]
|
||||
[app.common.spec.file :as file]
|
||||
[app.common.spec.page :as page]
|
||||
[app.common.spec.shape :as shape]
|
||||
[app.common.spec.typography :as typg]
|
||||
[app.common.types.color :as ctc]
|
||||
[app.common.types.file :as ctf]
|
||||
[app.common.types.page :as ctp]
|
||||
[app.common.types.shape :as cts]
|
||||
[app.common.types.typography :as ctt]
|
||||
[clojure.spec.alpha :as s]))
|
||||
|
||||
(s/def ::index integer?)
|
||||
|
@ -52,7 +52,7 @@
|
|||
(s/keys :req-un [:internal.changes.set-option/option
|
||||
:internal.changes.set-option/value]))
|
||||
|
||||
(s/def :internal.changes.add-obj/obj ::shape/shape)
|
||||
(s/def :internal.changes.add-obj/obj ::cts/shape)
|
||||
|
||||
(defn- valid-container-id-frame?
|
||||
[o]
|
||||
|
@ -89,18 +89,18 @@
|
|||
valid-container-id?))
|
||||
|
||||
(defmethod change-spec :reg-objects [_]
|
||||
(s/and (s/keys :req-un [::shape/shapes]
|
||||
(s/and (s/keys :req-un [::cts/shapes]
|
||||
:opt-un [::page-id ::component-id])
|
||||
valid-container-id?))
|
||||
|
||||
(defmethod change-spec :mov-objects [_]
|
||||
(s/and (s/keys :req-un [::parent-id ::shape/shapes]
|
||||
(s/and (s/keys :req-un [::parent-id ::cts/shapes]
|
||||
:opt-un [::page-id ::component-id ::index])
|
||||
valid-container-id?))
|
||||
|
||||
(defmethod change-spec :add-page [_]
|
||||
(s/or :empty (s/keys :req-un [::id ::name])
|
||||
:complete (s/keys :req-un [::page/page])))
|
||||
:complete (s/keys :req-un [::ctp/page])))
|
||||
|
||||
(defmethod change-spec :mod-page [_]
|
||||
(s/keys :req-un [::id ::name]))
|
||||
|
@ -112,21 +112,21 @@
|
|||
(s/keys :req-un [::id ::index]))
|
||||
|
||||
(defmethod change-spec :add-color [_]
|
||||
(s/keys :req-un [::color/color]))
|
||||
(s/keys :req-un [::ctc/color]))
|
||||
|
||||
(defmethod change-spec :mod-color [_]
|
||||
(s/keys :req-un [::color/color]))
|
||||
(s/keys :req-un [::ctc/color]))
|
||||
|
||||
(defmethod change-spec :del-color [_]
|
||||
(s/keys :req-un [::id]))
|
||||
|
||||
(s/def :internal.changes.add-recent-color/color ::color/recent-color)
|
||||
(s/def :internal.changes.add-recent-color/color ::ctc/recent-color)
|
||||
|
||||
(defmethod change-spec :add-recent-color [_]
|
||||
(s/keys :req-un [:internal.changes.add-recent-color/color]))
|
||||
|
||||
|
||||
(s/def :internal.changes.add-media/object ::file/media-object)
|
||||
(s/def :internal.changes.add-media/object ::ctf/media-object)
|
||||
(defmethod change-spec :add-media [_]
|
||||
(s/keys :req-un [:internal.changes.add-media/object]))
|
||||
|
||||
|
@ -149,7 +149,7 @@
|
|||
(s/keys :req-un [::id]))
|
||||
|
||||
(s/def :internal.changes.add-component/shapes
|
||||
(s/coll-of ::shape/shape))
|
||||
(s/coll-of ::cts/shape))
|
||||
|
||||
(defmethod change-spec :add-component [_]
|
||||
(s/keys :req-un [::id ::name :internal.changes.add-component/shapes]
|
||||
|
@ -163,13 +163,13 @@
|
|||
(s/keys :req-un [::id]))
|
||||
|
||||
(defmethod change-spec :add-typography [_]
|
||||
(s/keys :req-un [::typg/typography]))
|
||||
(s/keys :req-un [::ctt/typography]))
|
||||
|
||||
(defmethod change-spec :mod-typography [_]
|
||||
(s/keys :req-un [::typg/typography]))
|
||||
(s/keys :req-un [::ctt/typography]))
|
||||
|
||||
(defmethod change-spec :del-typography [_]
|
||||
(s/keys :req-un [::typg/id]))
|
||||
(s/keys :req-un [::ctt/id]))
|
||||
|
||||
(s/def ::change (s/multi-spec change-spec :type))
|
||||
(s/def ::changes (s/coll-of ::change))
|
|
@ -11,7 +11,7 @@
|
|||
[app.common.geom.shapes :as gsh]
|
||||
[app.common.math :as mth]
|
||||
[app.common.spec :as us]
|
||||
[app.common.spec.page :as spec.page]
|
||||
[app.common.types.page :as ctp]
|
||||
[app.common.uuid :as uuid]
|
||||
[cuerdas.core :as str]))
|
||||
|
||||
|
@ -64,7 +64,7 @@
|
|||
|
||||
(defn get-shape
|
||||
[container shape-id]
|
||||
(us/assert ::spec.page/container container)
|
||||
(us/assert ::ctp/container container)
|
||||
(us/assert ::us/uuid shape-id)
|
||||
(-> container
|
||||
(get :objects)
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
[app.common.geom.shapes.path :as gsp]
|
||||
[app.common.path.bool :as pb]
|
||||
[app.common.path.commands :as pc]
|
||||
[app.common.spec.radius :as ctr]))
|
||||
[app.common.types.shape.radius :as ctsr]))
|
||||
|
||||
(def ^:const bezier-circle-c 0.551915024494)
|
||||
|
||||
|
@ -152,7 +152,7 @@
|
|||
(defn rect->path
|
||||
"Creates a bezier curve that approximates a rounded corner rectangle"
|
||||
[{:keys [x y width height] :as shape}]
|
||||
(case (ctr/radius-mode shape)
|
||||
(case (ctsr/radius-mode shape)
|
||||
:radius-1
|
||||
(let [radius (gso/shape-corners-1 shape)]
|
||||
(draw-rounded-rect-path x y width height radius))
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
;;
|
||||
;; Copyright (c) UXBOX Labs SL
|
||||
|
||||
(ns app.common.spec.color
|
||||
(ns app.common.types.color
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.spec :as us]
|
|
@ -4,12 +4,11 @@
|
|||
;;
|
||||
;; Copyright (c) UXBOX Labs SL
|
||||
|
||||
(ns app.common.spec.file
|
||||
(ns app.common.types.file
|
||||
(:require
|
||||
[app.common.spec :as us]
|
||||
[app.common.spec.color :as color]
|
||||
[app.common.spec.page :as page]
|
||||
[app.common.spec.typography]
|
||||
[app.common.types.color :as ctc]
|
||||
[app.common.types.page :as ctp]
|
||||
[clojure.spec.alpha :as s]))
|
||||
|
||||
(s/def :internal.media-object/name string?)
|
||||
|
@ -31,13 +30,13 @@
|
|||
:opt-un [:internal.media-object/path]))
|
||||
|
||||
(s/def ::colors
|
||||
(s/map-of uuid? ::color/color))
|
||||
(s/map-of uuid? ::ctc/color))
|
||||
|
||||
(s/def ::recent-colors
|
||||
(s/coll-of ::color/recent-color :kind vector?))
|
||||
(s/coll-of ::ctc/recent-color :kind vector?))
|
||||
|
||||
(s/def ::typographies
|
||||
(s/map-of uuid? :app.common.spec.typography/typography))
|
||||
(s/map-of uuid? :ctst/typography))
|
||||
|
||||
(s/def ::pages
|
||||
(s/coll-of uuid? :kind vector?))
|
||||
|
@ -46,10 +45,10 @@
|
|||
(s/map-of uuid? ::media-object))
|
||||
|
||||
(s/def ::pages-index
|
||||
(s/map-of uuid? ::page/page))
|
||||
(s/map-of uuid? ::ctp/page))
|
||||
|
||||
(s/def ::components
|
||||
(s/map-of uuid? ::page/container))
|
||||
(s/map-of uuid? ::ctp/container))
|
||||
|
||||
(s/def ::data
|
||||
(s/keys :req-un [::pages-index
|
|
@ -4,11 +4,11 @@
|
|||
;;
|
||||
;; Copyright (c) UXBOX Labs SL
|
||||
|
||||
(ns app.common.spec.page
|
||||
(ns app.common.types.page
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.spec :as us]
|
||||
[app.common.spec.shape :as shape]
|
||||
[app.common.types.shape :as cts]
|
||||
[clojure.spec.alpha :as s]))
|
||||
|
||||
;; --- Grid options
|
||||
|
@ -90,7 +90,7 @@
|
|||
|
||||
(s/def ::id uuid?)
|
||||
(s/def ::name string?)
|
||||
(s/def ::objects (s/map-of uuid? ::shape/shape))
|
||||
(s/def ::objects (s/map-of uuid? ::cts/shape))
|
||||
|
||||
(s/def ::page
|
||||
(s/keys :req-un [::id ::name ::objects ::options]))
|
|
@ -4,17 +4,17 @@
|
|||
;;
|
||||
;; Copyright (c) UXBOX Labs SL
|
||||
|
||||
(ns app.common.spec.shape
|
||||
(ns app.common.types.shape
|
||||
(:require
|
||||
[app.common.geom.matrix :as gmt]
|
||||
[app.common.geom.point :as gpt]
|
||||
[app.common.spec :as us]
|
||||
[app.common.spec.blur :as blur]
|
||||
[app.common.spec.color :as color]
|
||||
[app.common.spec.export :as export]
|
||||
[app.common.spec.interactions :as cti]
|
||||
[app.common.spec.radius :as radius]
|
||||
[app.common.spec.shadow :as shadow]
|
||||
[app.common.types.color :as ctc]
|
||||
[app.common.types.shape.blur :as ctsb]
|
||||
[app.common.types.shape.export :as ctse]
|
||||
[app.common.types.shape.interactions :as ctsi]
|
||||
[app.common.types.shape.radius :as ctsr]
|
||||
[app.common.types.shape.shadow :as ctss]
|
||||
[clojure.set :as set]
|
||||
[clojure.spec.alpha :as s]))
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
|||
|
||||
(s/def ::fill-color string?)
|
||||
(s/def ::fill-opacity ::us/safe-number)
|
||||
(s/def ::fill-color-gradient (s/nilable ::color/gradient))
|
||||
(s/def ::fill-color-gradient (s/nilable ::ctc/gradient))
|
||||
(s/def ::fill-color-ref-file (s/nilable uuid?))
|
||||
(s/def ::fill-color-ref-id (s/nilable uuid?))
|
||||
|
||||
|
@ -69,7 +69,7 @@
|
|||
(s/def ::proportion ::us/safe-number)
|
||||
(s/def ::proportion-lock boolean?)
|
||||
(s/def ::stroke-color string?)
|
||||
(s/def ::stroke-color-gradient (s/nilable ::color/gradient))
|
||||
(s/def ::stroke-color-gradient (s/nilable ::ctc/gradient))
|
||||
(s/def ::stroke-color-ref-file (s/nilable uuid?))
|
||||
(s/def ::stroke-color-ref-id (s/nilable uuid?))
|
||||
(s/def ::stroke-opacity ::us/safe-number)
|
||||
|
@ -102,7 +102,7 @@
|
|||
(s/keys :req-un [::x ::y ::x1 ::y1 ::x2 ::y2 ::width ::height]))
|
||||
|
||||
(s/def ::exports
|
||||
(s/coll-of ::export/export :kind vector?))
|
||||
(s/coll-of ::ctse/export :kind vector?))
|
||||
|
||||
(s/def ::points
|
||||
(s/every ::gpt/point :kind vector?))
|
||||
|
@ -187,12 +187,12 @@
|
|||
::constraints-h
|
||||
::constraints-v
|
||||
::fixed-scroll
|
||||
::radius/rx
|
||||
::radius/ry
|
||||
::radius/r1
|
||||
::radius/r2
|
||||
::radius/r3
|
||||
::radius/r4
|
||||
::ctsr/rx
|
||||
::ctsr/ry
|
||||
::ctsr/r1
|
||||
::ctsr/r2
|
||||
::ctsr/r3
|
||||
::ctsr/r4
|
||||
::x
|
||||
::y
|
||||
::exports
|
||||
|
@ -213,9 +213,9 @@
|
|||
::width
|
||||
::height
|
||||
::masked-group?
|
||||
::cti/interactions
|
||||
::shadow/shadow
|
||||
::blur/blur
|
||||
::ctsi/interactions
|
||||
::ctss/shadow
|
||||
::ctsb/blur
|
||||
::opacity
|
||||
::blend-mode]))
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
;;
|
||||
;; Copyright (c) UXBOX Labs SL
|
||||
|
||||
(ns app.common.spec.blur
|
||||
(ns app.common.types.shape.blur
|
||||
(:require
|
||||
[app.common.spec :as us]
|
||||
[clojure.spec.alpha :as s]))
|
|
@ -4,12 +4,11 @@
|
|||
;;
|
||||
;; Copyright (c) UXBOX Labs SL
|
||||
|
||||
(ns app.common.spec.export
|
||||
(ns app.common.types.shape.export
|
||||
(:require
|
||||
[app.common.spec :as us]
|
||||
[clojure.spec.alpha :as s]))
|
||||
|
||||
|
||||
(s/def ::suffix string?)
|
||||
(s/def ::scale ::us/safe-number)
|
||||
(s/def ::type keyword?)
|
||||
|
@ -19,4 +18,3 @@
|
|||
::suffix
|
||||
::scale]))
|
||||
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
;;
|
||||
;; Copyright (c) UXBOX Labs SL
|
||||
|
||||
(ns app.common.spec.interactions
|
||||
(ns app.common.types.shape.interactions
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.geom.point :as gpt]
|
|
@ -4,7 +4,7 @@
|
|||
;;
|
||||
;; Copyright (c) UXBOX Labs SL
|
||||
|
||||
(ns app.common.spec.radius
|
||||
(ns app.common.types.shape.radius
|
||||
(:require
|
||||
[app.common.pages.common :refer [editable-attrs]]
|
||||
[app.common.spec :as us]
|
|
@ -4,10 +4,10 @@
|
|||
;;
|
||||
;; Copyright (c) UXBOX Labs SL
|
||||
|
||||
(ns app.common.spec.shadow
|
||||
(ns app.common.types.shape.shadow
|
||||
(:require
|
||||
[app.common.spec :as us]
|
||||
[app.common.spec.color :as color]
|
||||
[app.common.types.color :as ctc]
|
||||
[clojure.spec.alpha :as s]))
|
||||
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
|||
|
||||
(s/def ::color string?)
|
||||
(s/def ::opacity ::us/safe-number)
|
||||
(s/def ::gradient (s/nilable ::color/gradient))
|
||||
(s/def ::gradient (s/nilable ::ctc/gradient))
|
||||
(s/def ::file-id (s/nilable uuid?))
|
||||
(s/def ::ref-id (s/nilable uuid?))
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
;;
|
||||
;; Copyright (c) UXBOX Labs SL
|
||||
|
||||
(ns app.common.spec.typography
|
||||
(ns app.common.types.typography
|
||||
(:require
|
||||
[clojure.spec.alpha :as s]))
|
||||
|
|
@ -10,62 +10,62 @@
|
|||
[clojure.pprint :refer [pprint]]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.pages.init :as cpi]
|
||||
[app.common.spec.interactions :as csi]
|
||||
[app.common.types.shape.interactions :as ctsi]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.common.geom.point :as gpt]))
|
||||
|
||||
(t/deftest set-event-type
|
||||
(let [interaction csi/default-interaction
|
||||
(let [interaction ctsi/default-interaction
|
||||
shape (cpi/make-minimal-shape :rect)
|
||||
frame (cpi/make-minimal-shape :frame)]
|
||||
|
||||
(t/testing "Set event type unchanged"
|
||||
(let [new-interaction
|
||||
(csi/set-event-type interaction :click shape)]
|
||||
(ctsi/set-event-type interaction :click shape)]
|
||||
(t/is (= :click (:event-type new-interaction)))))
|
||||
|
||||
(t/testing "Set event type changed"
|
||||
(let [new-interaction
|
||||
(csi/set-event-type interaction :mouse-press shape)]
|
||||
(ctsi/set-event-type interaction :mouse-press shape)]
|
||||
(t/is (= :mouse-press (:event-type new-interaction)))))
|
||||
|
||||
(t/testing "Set after delay on non-frame"
|
||||
(let [result (ex/try
|
||||
(csi/set-event-type interaction :after-delay shape))]
|
||||
(ctsi/set-event-type interaction :after-delay shape))]
|
||||
(t/is (ex/exception? result))))
|
||||
|
||||
(t/testing "Set after delay on frame"
|
||||
(let [new-interaction
|
||||
(csi/set-event-type interaction :after-delay frame)]
|
||||
(ctsi/set-event-type interaction :after-delay frame)]
|
||||
(t/is (= :after-delay (:event-type new-interaction)))
|
||||
(t/is (= 600 (:delay new-interaction)))))
|
||||
|
||||
(t/testing "Set after delay with previous data"
|
||||
(let [interaction (assoc interaction :delay 300)
|
||||
new-interaction
|
||||
(csi/set-event-type interaction :after-delay frame)]
|
||||
(ctsi/set-event-type interaction :after-delay frame)]
|
||||
(t/is (= :after-delay (:event-type new-interaction)))
|
||||
(t/is (= 300 (:delay new-interaction)))))))
|
||||
|
||||
|
||||
(t/deftest set-action-type
|
||||
(let [interaction csi/default-interaction]
|
||||
(let [interaction ctsi/default-interaction]
|
||||
|
||||
(t/testing "Set action type unchanged"
|
||||
(let [new-interaction
|
||||
(csi/set-action-type interaction :navigate)]
|
||||
(ctsi/set-action-type interaction :navigate)]
|
||||
(t/is (= :navigate (:action-type new-interaction)))))
|
||||
|
||||
(t/testing "Set action type changed"
|
||||
(let [new-interaction
|
||||
(csi/set-action-type interaction :prev-screen)]
|
||||
(ctsi/set-action-type interaction :prev-screen)]
|
||||
(t/is (= :prev-screen (:action-type new-interaction)))))
|
||||
|
||||
(t/testing "Set action type navigate"
|
||||
(let [interaction {:event-type :click
|
||||
:action-type :prev-screen}
|
||||
new-interaction
|
||||
(csi/set-action-type interaction :navigate)]
|
||||
(ctsi/set-action-type interaction :navigate)]
|
||||
(t/is (= :navigate (:action-type new-interaction)))
|
||||
(t/is (nil? (:destination new-interaction)))
|
||||
(t/is (= false (:preserve-scroll new-interaction)))))
|
||||
|
@ -77,14 +77,14 @@
|
|||
:destination destination
|
||||
:preserve-scroll true}
|
||||
new-interaction
|
||||
(csi/set-action-type interaction :navigate)]
|
||||
(ctsi/set-action-type interaction :navigate)]
|
||||
(t/is (= :navigate (:action-type new-interaction)))
|
||||
(t/is (= destination (:destination new-interaction)))
|
||||
(t/is (= true (:preserve-scroll new-interaction)))))
|
||||
|
||||
(t/testing "Set action type open-overlay"
|
||||
(let [new-interaction
|
||||
(csi/set-action-type interaction :open-overlay)]
|
||||
(ctsi/set-action-type interaction :open-overlay)]
|
||||
(t/is (= :open-overlay (:action-type new-interaction)))
|
||||
(t/is (= :center (:overlay-pos-type new-interaction)))
|
||||
(t/is (= (gpt/point 0 0) (:overlay-position new-interaction)))))
|
||||
|
@ -93,14 +93,14 @@
|
|||
(let [interaction (assoc interaction :overlay-pos-type :top-left
|
||||
:overlay-position (gpt/point 100 200))
|
||||
new-interaction
|
||||
(csi/set-action-type interaction :open-overlay)]
|
||||
(ctsi/set-action-type interaction :open-overlay)]
|
||||
(t/is (= :open-overlay (:action-type new-interaction)))
|
||||
(t/is (= :top-left (:overlay-pos-type new-interaction)))
|
||||
(t/is (= (gpt/point 100 200) (:overlay-position new-interaction)))))
|
||||
|
||||
(t/testing "Set action type toggle-overlay"
|
||||
(let [new-interaction
|
||||
(csi/set-action-type interaction :toggle-overlay)]
|
||||
(ctsi/set-action-type interaction :toggle-overlay)]
|
||||
(t/is (= :toggle-overlay (:action-type new-interaction)))
|
||||
(t/is (= :center (:overlay-pos-type new-interaction)))
|
||||
(t/is (= (gpt/point 0 0) (:overlay-position new-interaction)))))
|
||||
|
@ -109,14 +109,14 @@
|
|||
(let [interaction (assoc interaction :overlay-pos-type :top-left
|
||||
:overlay-position (gpt/point 100 200))
|
||||
new-interaction
|
||||
(csi/set-action-type interaction :toggle-overlay)]
|
||||
(ctsi/set-action-type interaction :toggle-overlay)]
|
||||
(t/is (= :toggle-overlay (:action-type new-interaction)))
|
||||
(t/is (= :top-left (:overlay-pos-type new-interaction)))
|
||||
(t/is (= (gpt/point 100 200) (:overlay-position new-interaction)))))
|
||||
|
||||
(t/testing "Set action type close-overlay"
|
||||
(let [new-interaction
|
||||
(csi/set-action-type interaction :close-overlay)]
|
||||
(ctsi/set-action-type interaction :close-overlay)]
|
||||
(t/is (= :close-overlay (:action-type new-interaction)))
|
||||
(t/is (nil? (:destination new-interaction)))))
|
||||
|
||||
|
@ -124,89 +124,89 @@
|
|||
(let [destination (uuid/next)
|
||||
interaction (assoc interaction :destination destination)
|
||||
new-interaction
|
||||
(csi/set-action-type interaction :close-overlay)]
|
||||
(ctsi/set-action-type interaction :close-overlay)]
|
||||
(t/is (= :close-overlay (:action-type new-interaction)))
|
||||
(t/is (= destination (:destination new-interaction)))))
|
||||
|
||||
(t/testing "Set action type prev-screen"
|
||||
(let [new-interaction
|
||||
(csi/set-action-type interaction :prev-screen)]
|
||||
(ctsi/set-action-type interaction :prev-screen)]
|
||||
(t/is (= :prev-screen (:action-type new-interaction)))))
|
||||
|
||||
(t/testing "Set action type open-url"
|
||||
(let [new-interaction
|
||||
(csi/set-action-type interaction :open-url)]
|
||||
(ctsi/set-action-type interaction :open-url)]
|
||||
(t/is (= :open-url (:action-type new-interaction)))
|
||||
(t/is (= "" (:url new-interaction)))))
|
||||
|
||||
(t/testing "Set action type open-url with previous data"
|
||||
(let [interaction (assoc interaction :url "https://example.com")
|
||||
new-interaction
|
||||
(csi/set-action-type interaction :open-url)]
|
||||
(ctsi/set-action-type interaction :open-url)]
|
||||
(t/is (= :open-url (:action-type new-interaction)))
|
||||
(t/is (= "https://example.com" (:url new-interaction)))))))
|
||||
|
||||
|
||||
(t/deftest option-delay
|
||||
(let [frame (cpi/make-minimal-shape :frame)
|
||||
i1 csi/default-interaction
|
||||
i2 (csi/set-event-type i1 :after-delay frame)]
|
||||
i1 ctsi/default-interaction
|
||||
i2 (ctsi/set-event-type i1 :after-delay frame)]
|
||||
|
||||
(t/testing "Has delay"
|
||||
(t/is (not (csi/has-delay i1)))
|
||||
(t/is (csi/has-delay i2)))
|
||||
(t/is (not (ctsi/has-delay i1)))
|
||||
(t/is (ctsi/has-delay i2)))
|
||||
|
||||
(t/testing "Set delay"
|
||||
(let [new-interaction (csi/set-delay i2 1000)]
|
||||
(let [new-interaction (ctsi/set-delay i2 1000)]
|
||||
(t/is (= 1000 (:delay new-interaction)))))))
|
||||
|
||||
|
||||
(t/deftest option-destination
|
||||
(let [destination (uuid/next)
|
||||
i1 csi/default-interaction
|
||||
i2 (csi/set-action-type i1 :prev-screen)
|
||||
i3 (csi/set-action-type i1 :open-overlay)]
|
||||
i1 ctsi/default-interaction
|
||||
i2 (ctsi/set-action-type i1 :prev-screen)
|
||||
i3 (ctsi/set-action-type i1 :open-overlay)]
|
||||
|
||||
(t/testing "Has destination"
|
||||
(t/is (csi/has-destination i1))
|
||||
(t/is (not (csi/has-destination i2))))
|
||||
(t/is (ctsi/has-destination i1))
|
||||
(t/is (not (ctsi/has-destination i2))))
|
||||
|
||||
(t/testing "Set destination"
|
||||
(let [new-interaction (csi/set-destination i1 destination)]
|
||||
(let [new-interaction (ctsi/set-destination i1 destination)]
|
||||
(t/is (= destination (:destination new-interaction)))
|
||||
(t/is (nil? (:overlay-pos-type new-interaction)))
|
||||
(t/is (nil? (:overlay-position new-interaction)))))
|
||||
|
||||
(t/testing "Set destination of overlay"
|
||||
(let [new-interaction (csi/set-destination i3 destination)]
|
||||
(let [new-interaction (ctsi/set-destination i3 destination)]
|
||||
(t/is (= destination (:destination new-interaction)))
|
||||
(t/is (= :center (:overlay-pos-type new-interaction)))
|
||||
(t/is (= (gpt/point 0 0) (:overlay-position new-interaction)))))))
|
||||
|
||||
|
||||
(t/deftest option-preserve-scroll
|
||||
(let [i1 csi/default-interaction
|
||||
i2 (csi/set-action-type i1 :prev-screen)]
|
||||
(let [i1 ctsi/default-interaction
|
||||
i2 (ctsi/set-action-type i1 :prev-screen)]
|
||||
|
||||
(t/testing "Has preserve-scroll"
|
||||
(t/is (csi/has-preserve-scroll i1))
|
||||
(t/is (not (csi/has-preserve-scroll i2))))
|
||||
(t/is (ctsi/has-preserve-scroll i1))
|
||||
(t/is (not (ctsi/has-preserve-scroll i2))))
|
||||
|
||||
(t/testing "Set preserve-scroll"
|
||||
(let [new-interaction (csi/set-preserve-scroll i1 true)]
|
||||
(let [new-interaction (ctsi/set-preserve-scroll i1 true)]
|
||||
(t/is (= true (:preserve-scroll new-interaction)))))))
|
||||
|
||||
|
||||
(t/deftest option-url
|
||||
(let [i1 csi/default-interaction
|
||||
i2 (csi/set-action-type i1 :open-url)]
|
||||
(let [i1 ctsi/default-interaction
|
||||
i2 (ctsi/set-action-type i1 :open-url)]
|
||||
|
||||
(t/testing "Has url"
|
||||
(t/is (not (csi/has-url i1)))
|
||||
(t/is (csi/has-url i2)))
|
||||
(t/is (not (ctsi/has-url i1)))
|
||||
(t/is (ctsi/has-url i2)))
|
||||
|
||||
(t/testing "Set url"
|
||||
(let [new-interaction (csi/set-url i2 "https://example.com")]
|
||||
(let [new-interaction (ctsi/set-url i2 "https://example.com")]
|
||||
(t/is (= "https://example.com" (:url new-interaction)))))))
|
||||
|
||||
|
||||
|
@ -220,35 +220,35 @@
|
|||
objects {(:id base-frame) base-frame
|
||||
(:id overlay-frame) overlay-frame}
|
||||
|
||||
i1 csi/default-interaction
|
||||
i2 (csi/set-action-type i1 :open-overlay)
|
||||
i1 ctsi/default-interaction
|
||||
i2 (ctsi/set-action-type i1 :open-overlay)
|
||||
i3 (-> i1
|
||||
(csi/set-action-type :open-overlay)
|
||||
(csi/set-destination (:id overlay-frame)))]
|
||||
(ctsi/set-action-type :open-overlay)
|
||||
(ctsi/set-destination (:id overlay-frame)))]
|
||||
|
||||
(t/testing "Has overlay options"
|
||||
(t/is (not (csi/has-overlay-opts i1)))
|
||||
(t/is (csi/has-overlay-opts i2)))
|
||||
(t/is (not (ctsi/has-overlay-opts i1)))
|
||||
(t/is (ctsi/has-overlay-opts i2)))
|
||||
|
||||
(t/testing "Set overlay-pos-type without destination"
|
||||
(let [new-interaction (csi/set-overlay-pos-type i2 :top-right base-frame objects)]
|
||||
(let [new-interaction (ctsi/set-overlay-pos-type i2 :top-right base-frame objects)]
|
||||
(t/is (= :top-right (:overlay-pos-type new-interaction)))
|
||||
(t/is (= (gpt/point 0 0) (:overlay-position new-interaction)))))
|
||||
|
||||
(t/testing "Set overlay-pos-type with destination and auto"
|
||||
(let [new-interaction (csi/set-overlay-pos-type i3 :bottom-right base-frame objects)]
|
||||
(let [new-interaction (ctsi/set-overlay-pos-type i3 :bottom-right base-frame objects)]
|
||||
(t/is (= :bottom-right (:overlay-pos-type new-interaction)))
|
||||
(t/is (= (gpt/point 0 0) (:overlay-position new-interaction)))))
|
||||
|
||||
(t/testing "Set overlay-pos-type with destination and manual"
|
||||
(let [new-interaction (csi/set-overlay-pos-type i3 :manual base-frame objects)]
|
||||
(let [new-interaction (ctsi/set-overlay-pos-type i3 :manual base-frame objects)]
|
||||
(t/is (= :manual (:overlay-pos-type new-interaction)))
|
||||
(t/is (= (gpt/point 35 40) (:overlay-position new-interaction)))))
|
||||
|
||||
(t/testing "Toggle overlay-pos-type"
|
||||
(let [new-interaction (csi/toggle-overlay-pos-type i3 :center base-frame objects)
|
||||
new-interaction-2 (csi/toggle-overlay-pos-type new-interaction :center base-frame objects)
|
||||
new-interaction-3 (csi/toggle-overlay-pos-type new-interaction-2 :top-right base-frame objects)]
|
||||
(let [new-interaction (ctsi/toggle-overlay-pos-type i3 :center base-frame objects)
|
||||
new-interaction-2 (ctsi/toggle-overlay-pos-type new-interaction :center base-frame objects)
|
||||
new-interaction-3 (ctsi/toggle-overlay-pos-type new-interaction-2 :top-right base-frame objects)]
|
||||
(t/is (= :manual (:overlay-pos-type new-interaction)))
|
||||
(t/is (= (gpt/point 35 40) (:overlay-position new-interaction)))
|
||||
(t/is (= :center (:overlay-pos-type new-interaction-2)))
|
||||
|
@ -257,73 +257,73 @@
|
|||
(t/is (= (gpt/point 0 0) (:overlay-position new-interaction-3)))))
|
||||
|
||||
(t/testing "Set overlay-position"
|
||||
(let [new-interaction (csi/set-overlay-position i3 (gpt/point 50 60))]
|
||||
(let [new-interaction (ctsi/set-overlay-position i3 (gpt/point 50 60))]
|
||||
(t/is (= :manual (:overlay-pos-type new-interaction)))
|
||||
(t/is (= (gpt/point 50 60) (:overlay-position new-interaction)))))
|
||||
|
||||
(t/testing "Set close-click-outside"
|
||||
(let [new-interaction (csi/set-close-click-outside i3 true)]
|
||||
(let [new-interaction (ctsi/set-close-click-outside i3 true)]
|
||||
(t/is (not (:close-click-outside i3)))
|
||||
(t/is (:close-click-outside new-interaction))))
|
||||
|
||||
(t/testing "Set background-overlay"
|
||||
(let [new-interaction (csi/set-background-overlay i3 true)]
|
||||
(let [new-interaction (ctsi/set-background-overlay i3 true)]
|
||||
(t/is (not (:background-overlay i3)))
|
||||
(t/is (:background-overlay new-interaction))))))
|
||||
|
||||
|
||||
(t/deftest animation-checks
|
||||
(let [i1 csi/default-interaction
|
||||
i2 (csi/set-action-type i1 :open-overlay)
|
||||
i3 (csi/set-action-type i1 :toggle-overlay)
|
||||
i4 (csi/set-action-type i1 :close-overlay)
|
||||
i5 (csi/set-action-type i1 :prev-screen)
|
||||
i6 (csi/set-action-type i1 :open-url)]
|
||||
(let [i1 ctsi/default-interaction
|
||||
i2 (ctsi/set-action-type i1 :open-overlay)
|
||||
i3 (ctsi/set-action-type i1 :toggle-overlay)
|
||||
i4 (ctsi/set-action-type i1 :close-overlay)
|
||||
i5 (ctsi/set-action-type i1 :prev-screen)
|
||||
i6 (ctsi/set-action-type i1 :open-url)]
|
||||
|
||||
(t/testing "Has animation?"
|
||||
(t/is (csi/has-animation? i1))
|
||||
(t/is (csi/has-animation? i2))
|
||||
(t/is (csi/has-animation? i3))
|
||||
(t/is (csi/has-animation? i4))
|
||||
(t/is (not (csi/has-animation? i5)))
|
||||
(t/is (not (csi/has-animation? i6))))
|
||||
(t/is (ctsi/has-animation? i1))
|
||||
(t/is (ctsi/has-animation? i2))
|
||||
(t/is (ctsi/has-animation? i3))
|
||||
(t/is (ctsi/has-animation? i4))
|
||||
(t/is (not (ctsi/has-animation? i5)))
|
||||
(t/is (not (ctsi/has-animation? i6))))
|
||||
|
||||
(t/testing "Valid push?"
|
||||
(t/is (csi/allow-push? (:action-type i1)))
|
||||
(t/is (not (csi/allow-push? (:action-type i2))))
|
||||
(t/is (not (csi/allow-push? (:action-type i3))))
|
||||
(t/is (not (csi/allow-push? (:action-type i4))))
|
||||
(t/is (not (csi/allow-push? (:action-type i5))))
|
||||
(t/is (not (csi/allow-push? (:action-type i6)))))))
|
||||
(t/is (ctsi/allow-push? (:action-type i1)))
|
||||
(t/is (not (ctsi/allow-push? (:action-type i2))))
|
||||
(t/is (not (ctsi/allow-push? (:action-type i3))))
|
||||
(t/is (not (ctsi/allow-push? (:action-type i4))))
|
||||
(t/is (not (ctsi/allow-push? (:action-type i5))))
|
||||
(t/is (not (ctsi/allow-push? (:action-type i6)))))))
|
||||
|
||||
|
||||
(t/deftest set-animation-type
|
||||
(let [i1 csi/default-interaction
|
||||
i2 (csi/set-animation-type i1 :dissolve)]
|
||||
(let [i1 ctsi/default-interaction
|
||||
i2 (ctsi/set-animation-type i1 :dissolve)]
|
||||
|
||||
(t/testing "Set animation type nil"
|
||||
(let [new-interaction
|
||||
(csi/set-animation-type i1 nil)]
|
||||
(ctsi/set-animation-type i1 nil)]
|
||||
(t/is (nil? (-> new-interaction :animation :animation-type)))))
|
||||
|
||||
(t/testing "Set animation type unchanged"
|
||||
(let [new-interaction
|
||||
(csi/set-animation-type i2 :dissolve)]
|
||||
(ctsi/set-animation-type i2 :dissolve)]
|
||||
(t/is (= :dissolve (-> new-interaction :animation :animation-type)))))
|
||||
|
||||
(t/testing "Set animation type changed"
|
||||
(let [new-interaction
|
||||
(csi/set-animation-type i2 :slide)]
|
||||
(ctsi/set-animation-type i2 :slide)]
|
||||
(t/is (= :slide (-> new-interaction :animation :animation-type)))))
|
||||
|
||||
(t/testing "Set animation type reset"
|
||||
(let [new-interaction
|
||||
(csi/set-animation-type i2 nil)]
|
||||
(ctsi/set-animation-type i2 nil)]
|
||||
(t/is (nil? (-> new-interaction :animation)))))
|
||||
|
||||
(t/testing "Set animation type dissolve"
|
||||
(let [new-interaction
|
||||
(csi/set-animation-type i1 :dissolve)]
|
||||
(ctsi/set-animation-type i1 :dissolve)]
|
||||
(t/is (= :dissolve (-> new-interaction :animation :animation-type)))
|
||||
(t/is (= 300 (-> new-interaction :animation :duration)))
|
||||
(t/is (= :linear (-> new-interaction :animation :easing)))))
|
||||
|
@ -336,14 +336,14 @@
|
|||
:direction :left
|
||||
:offset-effect true})
|
||||
new-interaction
|
||||
(csi/set-animation-type interaction :dissolve)]
|
||||
(ctsi/set-animation-type interaction :dissolve)]
|
||||
(t/is (= :dissolve (-> new-interaction :animation :animation-type)))
|
||||
(t/is (= 1000 (-> new-interaction :animation :duration)))
|
||||
(t/is (= :ease-out (-> new-interaction :animation :easing)))))
|
||||
|
||||
(t/testing "Set animation type slide"
|
||||
(let [new-interaction
|
||||
(csi/set-animation-type i1 :slide)]
|
||||
(ctsi/set-animation-type i1 :slide)]
|
||||
(t/is (= :slide (-> new-interaction :animation :animation-type)))
|
||||
(t/is (= 300 (-> new-interaction :animation :duration)))
|
||||
(t/is (= :linear (-> new-interaction :animation :easing)))
|
||||
|
@ -359,7 +359,7 @@
|
|||
:direction :left
|
||||
:offset-effect true})
|
||||
new-interaction
|
||||
(csi/set-animation-type interaction :slide)]
|
||||
(ctsi/set-animation-type interaction :slide)]
|
||||
(t/is (= :slide (-> new-interaction :animation :animation-type)))
|
||||
(t/is (= 1000 (-> new-interaction :animation :duration)))
|
||||
(t/is (= :ease-out (-> new-interaction :animation :easing)))
|
||||
|
@ -369,7 +369,7 @@
|
|||
|
||||
(t/testing "Set animation type push"
|
||||
(let [new-interaction
|
||||
(csi/set-animation-type i1 :push)]
|
||||
(ctsi/set-animation-type i1 :push)]
|
||||
(t/is (= :push (-> new-interaction :animation :animation-type)))
|
||||
(t/is (= 300 (-> new-interaction :animation :duration)))
|
||||
(t/is (= :linear (-> new-interaction :animation :easing)))
|
||||
|
@ -383,7 +383,7 @@
|
|||
:direction :left
|
||||
:offset-effect true})
|
||||
new-interaction
|
||||
(csi/set-animation-type interaction :push)]
|
||||
(ctsi/set-animation-type interaction :push)]
|
||||
(t/is (= :push (-> new-interaction :animation :animation-type)))
|
||||
(t/is (= 1000 (-> new-interaction :animation :duration)))
|
||||
(t/is (= :ease-out (-> new-interaction :animation :easing)))
|
||||
|
@ -391,9 +391,9 @@
|
|||
|
||||
|
||||
(t/deftest allowed-animation
|
||||
(let [i1 (csi/set-action-type csi/default-interaction :open-overlay)
|
||||
i2 (csi/set-action-type csi/default-interaction :close-overlay)
|
||||
i3 (csi/set-action-type csi/default-interaction :toggle-overlay)]
|
||||
(let [i1 (ctsi/set-action-type ctsi/default-interaction :open-overlay)
|
||||
i2 (ctsi/set-action-type ctsi/default-interaction :close-overlay)
|
||||
i3 (ctsi/set-action-type ctsi/default-interaction :toggle-overlay)]
|
||||
|
||||
(t/testing "Cannot use animation push for an overlay action"
|
||||
(let [bad-interaction-1 (assoc i1 :animation {:animation-type :push
|
||||
|
@ -408,72 +408,72 @@
|
|||
:duration 1000
|
||||
:easing :ease-out
|
||||
:direction :left})]
|
||||
(t/is (not (csi/allowed-animation? (:action-type bad-interaction-1)
|
||||
(t/is (not (ctsi/allowed-animation? (:action-type bad-interaction-1)
|
||||
(-> bad-interaction-1 :animation :animation-type))))
|
||||
(t/is (not (csi/allowed-animation? (:action-type bad-interaction-2)
|
||||
(t/is (not (ctsi/allowed-animation? (:action-type bad-interaction-2)
|
||||
(-> bad-interaction-1 :animation :animation-type))))
|
||||
(t/is (not (csi/allowed-animation? (:action-type bad-interaction-3)
|
||||
(t/is (not (ctsi/allowed-animation? (:action-type bad-interaction-3)
|
||||
(-> bad-interaction-1 :animation :animation-type))))))
|
||||
|
||||
(t/testing "Remove animation if moving to an forbidden state"
|
||||
(let [interaction (csi/set-animation-type csi/default-interaction :push)
|
||||
new-interaction (csi/set-action-type interaction :open-overlay)]
|
||||
(let [interaction (ctsi/set-animation-type ctsi/default-interaction :push)
|
||||
new-interaction (ctsi/set-action-type interaction :open-overlay)]
|
||||
(t/is (nil? (:animation new-interaction)))))))
|
||||
|
||||
|
||||
(t/deftest option-duration
|
||||
(let [i1 csi/default-interaction
|
||||
i2 (csi/set-animation-type csi/default-interaction :dissolve)]
|
||||
(let [i1 ctsi/default-interaction
|
||||
i2 (ctsi/set-animation-type ctsi/default-interaction :dissolve)]
|
||||
|
||||
(t/testing "Has duration?"
|
||||
(t/is (not (csi/has-duration? i1)))
|
||||
(t/is (csi/has-duration? i2)))
|
||||
(t/is (not (ctsi/has-duration? i1)))
|
||||
(t/is (ctsi/has-duration? i2)))
|
||||
|
||||
(t/testing "Set duration"
|
||||
(let [new-interaction (csi/set-duration i2 1000)]
|
||||
(let [new-interaction (ctsi/set-duration i2 1000)]
|
||||
(t/is (= 1000 (-> new-interaction :animation :duration)))))))
|
||||
|
||||
|
||||
(t/deftest option-easing
|
||||
(let [i1 csi/default-interaction
|
||||
i2 (csi/set-animation-type csi/default-interaction :dissolve)]
|
||||
(let [i1 ctsi/default-interaction
|
||||
i2 (ctsi/set-animation-type ctsi/default-interaction :dissolve)]
|
||||
|
||||
(t/testing "Has easing?"
|
||||
(t/is (not (csi/has-easing? i1)))
|
||||
(t/is (csi/has-easing? i2)))
|
||||
(t/is (not (ctsi/has-easing? i1)))
|
||||
(t/is (ctsi/has-easing? i2)))
|
||||
|
||||
(t/testing "Set easing"
|
||||
(let [new-interaction (csi/set-easing i2 :ease-in)]
|
||||
(let [new-interaction (ctsi/set-easing i2 :ease-in)]
|
||||
(t/is (= :ease-in (-> new-interaction :animation :easing)))))))
|
||||
|
||||
|
||||
(t/deftest option-way
|
||||
(let [i1 csi/default-interaction
|
||||
i2 (csi/set-animation-type csi/default-interaction :slide)
|
||||
i3 (csi/set-action-type i2 :open-overlay)]
|
||||
(let [i1 ctsi/default-interaction
|
||||
i2 (ctsi/set-animation-type ctsi/default-interaction :slide)
|
||||
i3 (ctsi/set-action-type i2 :open-overlay)]
|
||||
|
||||
(t/testing "Has way?"
|
||||
(t/is (not (csi/has-way? i1)))
|
||||
(t/is (csi/has-way? i2))
|
||||
(t/is (not (csi/has-way? i3)))
|
||||
(t/is (not (ctsi/has-way? i1)))
|
||||
(t/is (ctsi/has-way? i2))
|
||||
(t/is (not (ctsi/has-way? i3)))
|
||||
(t/is (some? (-> i3 :animation :way)))) ; <- it exists but is ignored
|
||||
|
||||
(t/testing "Set way"
|
||||
(let [new-interaction (csi/set-way i2 :out)]
|
||||
(let [new-interaction (ctsi/set-way i2 :out)]
|
||||
(t/is (= :out (-> new-interaction :animation :way)))))))
|
||||
|
||||
|
||||
(t/deftest option-direction
|
||||
(let [i1 csi/default-interaction
|
||||
i2 (csi/set-animation-type csi/default-interaction :push)
|
||||
i3 (csi/set-animation-type csi/default-interaction :dissolve)]
|
||||
(let [i1 ctsi/default-interaction
|
||||
i2 (ctsi/set-animation-type ctsi/default-interaction :push)
|
||||
i3 (ctsi/set-animation-type ctsi/default-interaction :dissolve)]
|
||||
|
||||
(t/testing "Has direction?"
|
||||
(t/is (not (csi/has-direction? i1)))
|
||||
(t/is (csi/has-direction? i2)))
|
||||
(t/is (not (ctsi/has-direction? i1)))
|
||||
(t/is (ctsi/has-direction? i2)))
|
||||
|
||||
(t/testing "Set direction"
|
||||
(let [new-interaction (csi/set-direction i2 :left)]
|
||||
(let [new-interaction (ctsi/set-direction i2 :left)]
|
||||
(t/is (= :left (-> new-interaction :animation :direction)))))
|
||||
|
||||
(t/testing "Invert direction"
|
||||
|
@ -483,12 +483,12 @@
|
|||
a-up (assoc a-right :direction :up)
|
||||
a-down (assoc a-right :direction :down)
|
||||
|
||||
a-nil' (csi/invert-direction nil)
|
||||
a-none' (csi/invert-direction a-none)
|
||||
a-right' (csi/invert-direction a-right)
|
||||
a-left' (csi/invert-direction a-left)
|
||||
a-up' (csi/invert-direction a-up)
|
||||
a-down' (csi/invert-direction a-down)]
|
||||
a-nil' (ctsi/invert-direction nil)
|
||||
a-none' (ctsi/invert-direction a-none)
|
||||
a-right' (ctsi/invert-direction a-right)
|
||||
a-left' (ctsi/invert-direction a-left)
|
||||
a-up' (ctsi/invert-direction a-up)
|
||||
a-down' (ctsi/invert-direction a-down)]
|
||||
|
||||
(t/is (nil? a-nil'))
|
||||
(t/is (nil? (:direction a-none')))
|
||||
|
@ -499,44 +499,44 @@
|
|||
|
||||
|
||||
(t/deftest option-offset-effect
|
||||
(let [i1 csi/default-interaction
|
||||
i2 (csi/set-animation-type csi/default-interaction :slide)
|
||||
i3 (csi/set-action-type i2 :open-overlay)]
|
||||
(let [i1 ctsi/default-interaction
|
||||
i2 (ctsi/set-animation-type ctsi/default-interaction :slide)
|
||||
i3 (ctsi/set-action-type i2 :open-overlay)]
|
||||
|
||||
(t/testing "Has offset-effect"
|
||||
(t/is (not (csi/has-offset-effect? i1)))
|
||||
(t/is (csi/has-offset-effect? i2))
|
||||
(t/is (not (csi/has-offset-effect? i3)))
|
||||
(t/is (not (ctsi/has-offset-effect? i1)))
|
||||
(t/is (ctsi/has-offset-effect? i2))
|
||||
(t/is (not (ctsi/has-offset-effect? i3)))
|
||||
(t/is (some? (-> i3 :animation :offset-effect)))) ; <- it exists but is ignored
|
||||
|
||||
(t/testing "Set offset-effect"
|
||||
(let [new-interaction (csi/set-offset-effect i2 true)]
|
||||
(let [new-interaction (ctsi/set-offset-effect i2 true)]
|
||||
(t/is (= true (-> new-interaction :animation :offset-effect)))))))
|
||||
|
||||
|
||||
(t/deftest modify-interactions
|
||||
(let [i1 (csi/set-action-type csi/default-interaction :open-overlay)
|
||||
i2 (csi/set-action-type csi/default-interaction :close-overlay)
|
||||
i3 (csi/set-action-type csi/default-interaction :prev-screen)
|
||||
(let [i1 (ctsi/set-action-type ctsi/default-interaction :open-overlay)
|
||||
i2 (ctsi/set-action-type ctsi/default-interaction :close-overlay)
|
||||
i3 (ctsi/set-action-type ctsi/default-interaction :prev-screen)
|
||||
interactions [i1 i2]]
|
||||
|
||||
(t/testing "Add interaction to nil"
|
||||
(let [new-interactions (csi/add-interaction nil i3)]
|
||||
(let [new-interactions (ctsi/add-interaction nil i3)]
|
||||
(t/is (= (count new-interactions) 1))
|
||||
(t/is (= (:action-type (last new-interactions)) :prev-screen))))
|
||||
|
||||
(t/testing "Add interaction to normal"
|
||||
(let [new-interactions (csi/add-interaction interactions i3)]
|
||||
(let [new-interactions (ctsi/add-interaction interactions i3)]
|
||||
(t/is (= (count new-interactions) 3))
|
||||
(t/is (= (:action-type (last new-interactions)) :prev-screen))))
|
||||
|
||||
(t/testing "Remove interaction"
|
||||
(let [new-interactions (csi/remove-interaction interactions 0)]
|
||||
(let [new-interactions (ctsi/remove-interaction interactions 0)]
|
||||
(t/is (= (count new-interactions) 1))
|
||||
(t/is (= (:action-type (last new-interactions)) :close-overlay))))
|
||||
|
||||
(t/testing "Update interaction"
|
||||
(let [new-interactions (csi/update-interaction interactions 1 #(csi/set-action-type % :open-url))]
|
||||
(let [new-interactions (ctsi/update-interaction interactions 1 #(ctsi/set-action-type % :open-url))]
|
||||
(t/is (= (count new-interactions) 2))
|
||||
(t/is (= (:action-type (last new-interactions)) :open-url))))))
|
||||
|
||||
|
@ -556,16 +556,16 @@
|
|||
ids-map {(:id frame1) (:id frame4)
|
||||
(:id frame2) (:id frame5)}
|
||||
|
||||
i1 (csi/set-destination csi/default-interaction (:id frame1))
|
||||
i2 (csi/set-destination csi/default-interaction (:id frame2))
|
||||
i3 (csi/set-destination csi/default-interaction (:id frame3))
|
||||
i4 (csi/set-destination csi/default-interaction nil)
|
||||
i5 (csi/set-destination csi/default-interaction (:id frame6))
|
||||
i1 (ctsi/set-destination ctsi/default-interaction (:id frame1))
|
||||
i2 (ctsi/set-destination ctsi/default-interaction (:id frame2))
|
||||
i3 (ctsi/set-destination ctsi/default-interaction (:id frame3))
|
||||
i4 (ctsi/set-destination ctsi/default-interaction nil)
|
||||
i5 (ctsi/set-destination ctsi/default-interaction (:id frame6))
|
||||
|
||||
interactions [i1 i2 i3 i4 i5]]
|
||||
|
||||
(t/testing "Remap interactions"
|
||||
(let [new-interactions (csi/remap-interactions interactions ids-map objects)]
|
||||
(let [new-interactions (ctsi/remap-interactions interactions ids-map objects)]
|
||||
(t/is (= (count new-interactions) 4))
|
||||
(t/is (= (:id frame4) (:destination (get new-interactions 0))))
|
||||
(t/is (= (:id frame5) (:destination (get new-interactions 1))))
|
||||
|
|
|
@ -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
Reference in a new issue