mirror of
https://github.com/penpot/penpot.git
synced 2025-08-07 14:38:33 +02:00
Merge remote-tracking branch 'origin/staging' into develop
This commit is contained in:
commit
88ed08916e
12 changed files with 149 additions and 138 deletions
|
@ -65,6 +65,7 @@ on-premises instances** that want to keep up to date.
|
||||||
- Misalignments at Create account [Taiga #11315](https://tree.taiga.io/project/penpot/issue/11315)
|
- Misalignments at Create account [Taiga #11315](https://tree.taiga.io/project/penpot/issue/11315)
|
||||||
- Fix issue with importing files where flex/grid is used [Taiga #11334](https://tree.taiga.io/project/penpot/issue/11334)
|
- Fix issue with importing files where flex/grid is used [Taiga #11334](https://tree.taiga.io/project/penpot/issue/11334)
|
||||||
- Fix wrong color in the export progress bar [Taiga #11299](https://tree.taiga.io/project/penpot/issue/11299)
|
- Fix wrong color in the export progress bar [Taiga #11299](https://tree.taiga.io/project/penpot/issue/11299)
|
||||||
|
- Fix right sidebar width overflow on long layer names [Taiga #11212](https://tree.taiga.io/project/penpot/issue/11212)
|
||||||
|
|
||||||
## 2.7.2
|
## 2.7.2
|
||||||
|
|
||||||
|
|
|
@ -231,13 +231,14 @@
|
||||||
:hint "email has complaint reports")))
|
:hint "email has complaint reports")))
|
||||||
|
|
||||||
(defn prepare-register
|
(defn prepare-register
|
||||||
[{:keys [::db/pool] :as cfg} {:keys [email accept-newsletter-updates] :as params}]
|
[{:keys [::db/pool] :as cfg} {:keys [fullname email accept-newsletter-updates] :as params}]
|
||||||
|
|
||||||
(validate-register-attempt! cfg params)
|
(validate-register-attempt! cfg params)
|
||||||
|
|
||||||
(let [email (profile/clean-email email)
|
(let [email (profile/clean-email email)
|
||||||
profile (profile/get-profile-by-email pool email)
|
profile (profile/get-profile-by-email pool email)
|
||||||
params {:email email
|
params {:email email
|
||||||
|
:fullname fullname
|
||||||
:password (:password params)
|
:password (:password params)
|
||||||
:invitation-token (:invitation-token params)
|
:invitation-token (:invitation-token params)
|
||||||
:backend "penpot"
|
:backend "penpot"
|
||||||
|
@ -254,8 +255,10 @@
|
||||||
|
|
||||||
(def schema:prepare-register-profile
|
(def schema:prepare-register-profile
|
||||||
[:map {:title "prepare-register-profile"}
|
[:map {:title "prepare-register-profile"}
|
||||||
|
[:fullname ::sm/text]
|
||||||
[:email ::sm/email]
|
[:email ::sm/email]
|
||||||
[:password schema:password]
|
[:password schema:password]
|
||||||
|
[:create-welcome-file {:optional true} :boolean]
|
||||||
[:invitation-token {:optional true} schema:token]])
|
[:invitation-token {:optional true} schema:token]])
|
||||||
|
|
||||||
(sv/defmethod ::prepare-register-profile
|
(sv/defmethod ::prepare-register-profile
|
||||||
|
@ -359,13 +362,9 @@
|
||||||
:extra-data ptoken})))
|
:extra-data ptoken})))
|
||||||
|
|
||||||
(defn register-profile
|
(defn register-profile
|
||||||
[{:keys [::db/conn ::wrk/executor] :as cfg} {:keys [token fullname theme] :as params}]
|
[{:keys [::db/conn ::wrk/executor] :as cfg} {:keys [token] :as params}]
|
||||||
(let [theme (when (= theme "light") theme)
|
(let [claims (tokens/verify (::setup/props cfg) {:token token :iss :prepared-register})
|
||||||
claims (tokens/verify (::setup/props cfg) {:token token :iss :prepared-register})
|
params (into claims params)
|
||||||
params (-> claims
|
|
||||||
(into params)
|
|
||||||
(assoc :fullname fullname)
|
|
||||||
(assoc :theme theme))
|
|
||||||
|
|
||||||
profile (if-let [profile-id (:profile-id claims)]
|
profile (if-let [profile-id (:profile-id claims)]
|
||||||
(profile/get-profile conn profile-id)
|
(profile/get-profile conn profile-id)
|
||||||
|
@ -479,10 +478,7 @@
|
||||||
|
|
||||||
(def schema:register-profile
|
(def schema:register-profile
|
||||||
[:map {:title "register-profile"}
|
[:map {:title "register-profile"}
|
||||||
[:token schema:token]
|
[:token schema:token]])
|
||||||
[:fullname [::sm/word-string {:max 100}]]
|
|
||||||
[:theme {:optional true} [:string {:max 10}]]
|
|
||||||
[:create-welcome-file {:optional true} :boolean]])
|
|
||||||
|
|
||||||
(sv/defmethod ::register-profile
|
(sv/defmethod ::register-profile
|
||||||
{::rpc/auth false
|
{::rpc/auth false
|
||||||
|
|
|
@ -379,15 +379,14 @@
|
||||||
(t/deftest prepare-register-and-register-profile-1
|
(t/deftest prepare-register-and-register-profile-1
|
||||||
(let [data {::th/type :prepare-register-profile
|
(let [data {::th/type :prepare-register-profile
|
||||||
:email "user@example.com"
|
:email "user@example.com"
|
||||||
|
:fullname "foobar"
|
||||||
:password "foobar"}
|
:password "foobar"}
|
||||||
out (th/command! data)
|
out (th/command! data)
|
||||||
token (get-in out [:result :token])]
|
token (get-in out [:result :token])]
|
||||||
(t/is (string? token))
|
(t/is (string? token))
|
||||||
|
|
||||||
;; try register without token
|
;; try register without token
|
||||||
(let [data {::th/type :register-profile
|
(let [data {::th/type :register-profile}
|
||||||
:fullname "foobar"
|
|
||||||
:accept-terms-and-privacy true}
|
|
||||||
out (th/command! data)]
|
out (th/command! data)]
|
||||||
;; (th/print-result! out)
|
;; (th/print-result! out)
|
||||||
(let [error (:error out)]
|
(let [error (:error out)]
|
||||||
|
@ -398,11 +397,8 @@
|
||||||
;; try correct register
|
;; try correct register
|
||||||
(let [data {::th/type :register-profile
|
(let [data {::th/type :register-profile
|
||||||
:token token
|
:token token
|
||||||
:fullname "foobar"
|
|
||||||
:utm_campaign "utma"
|
:utm_campaign "utma"
|
||||||
:mtm_campaign "mtma"
|
:mtm_campaign "mtma"}]
|
||||||
:accept-terms-and-privacy true
|
|
||||||
:accept-newsletter-subscription true}]
|
|
||||||
(let [{:keys [result error]} (th/command! data)]
|
(let [{:keys [result error]} (th/command! data)]
|
||||||
(t/is (nil? error))))
|
(t/is (nil? error))))
|
||||||
|
|
||||||
|
@ -424,6 +420,7 @@
|
||||||
;; PREPARE REGISTER
|
;; PREPARE REGISTER
|
||||||
(let [data {::th/type :prepare-register-profile
|
(let [data {::th/type :prepare-register-profile
|
||||||
:email "hello@example.com"
|
:email "hello@example.com"
|
||||||
|
:fullname "foobar"
|
||||||
:password "foobar"}
|
:password "foobar"}
|
||||||
out (th/command! data)
|
out (th/command! data)
|
||||||
token (get-in out [:result :token])]
|
token (get-in out [:result :token])]
|
||||||
|
@ -432,10 +429,7 @@
|
||||||
|
|
||||||
;; DO REGISTRATION
|
;; DO REGISTRATION
|
||||||
(let [data {::th/type :register-profile
|
(let [data {::th/type :register-profile
|
||||||
:token @current-token
|
:token @current-token}
|
||||||
:fullname "foobar"
|
|
||||||
:accept-terms-and-privacy true
|
|
||||||
:accept-newsletter-subscription true}
|
|
||||||
out (th/command! data)]
|
out (th/command! data)]
|
||||||
(t/is (nil? (:error out)))
|
(t/is (nil? (:error out)))
|
||||||
(t/is (= 1 (:call-count @mock))))
|
(t/is (= 1 (:call-count @mock))))
|
||||||
|
@ -445,6 +439,7 @@
|
||||||
;; PREPARE REGISTER: second attempt
|
;; PREPARE REGISTER: second attempt
|
||||||
(let [data {::th/type :prepare-register-profile
|
(let [data {::th/type :prepare-register-profile
|
||||||
:email "hello@example.com"
|
:email "hello@example.com"
|
||||||
|
:fullname "foobar"
|
||||||
:password "foobar"}
|
:password "foobar"}
|
||||||
out (th/command! data)
|
out (th/command! data)
|
||||||
token (get-in out [:result :token])]
|
token (get-in out [:result :token])]
|
||||||
|
@ -479,6 +474,7 @@
|
||||||
;; PREPARE REGISTER
|
;; PREPARE REGISTER
|
||||||
(let [data {::th/type :prepare-register-profile
|
(let [data {::th/type :prepare-register-profile
|
||||||
:email "hello@example.com"
|
:email "hello@example.com"
|
||||||
|
:fullname "foobar"
|
||||||
:password "foobar"}
|
:password "foobar"}
|
||||||
out (th/command! data)
|
out (th/command! data)
|
||||||
token (get-in out [:result :token])]
|
token (get-in out [:result :token])]
|
||||||
|
@ -487,10 +483,7 @@
|
||||||
|
|
||||||
;; DO REGISTRATION
|
;; DO REGISTRATION
|
||||||
(let [data {::th/type :register-profile
|
(let [data {::th/type :register-profile
|
||||||
:token @current-token
|
:token @current-token}
|
||||||
:fullname "foobar"
|
|
||||||
:accept-terms-and-privacy true
|
|
||||||
:accept-newsletter-subscription true}
|
|
||||||
out (th/command! data)]
|
out (th/command! data)]
|
||||||
(t/is (nil? (:error out)))
|
(t/is (nil? (:error out)))
|
||||||
(t/is (= 1 (:call-count @mock))))
|
(t/is (= 1 (:call-count @mock))))
|
||||||
|
@ -504,6 +497,7 @@
|
||||||
;; PREPARE REGISTER: second attempt
|
;; PREPARE REGISTER: second attempt
|
||||||
(let [data {::th/type :prepare-register-profile
|
(let [data {::th/type :prepare-register-profile
|
||||||
:email "hello@example.com"
|
:email "hello@example.com"
|
||||||
|
:fullname "foobar"
|
||||||
:password "foobar"}
|
:password "foobar"}
|
||||||
out (th/command! data)
|
out (th/command! data)
|
||||||
token (get-in out [:result :token])]
|
token (get-in out [:result :token])]
|
||||||
|
@ -514,10 +508,7 @@
|
||||||
:return true}]
|
:return true}]
|
||||||
;; DO REGISTRATION: second attempt
|
;; DO REGISTRATION: second attempt
|
||||||
(let [data {::th/type :register-profile
|
(let [data {::th/type :register-profile
|
||||||
:token @current-token
|
:token @current-token}
|
||||||
:fullname "foobar"
|
|
||||||
:accept-terms-and-privacy true
|
|
||||||
:accept-newsletter-subscription true}
|
|
||||||
out (th/command! data)]
|
out (th/command! data)]
|
||||||
(t/is (nil? (:error out)))
|
(t/is (nil? (:error out)))
|
||||||
(t/is (= 0 (:call-count @mock))))))))
|
(t/is (= 0 (:call-count @mock))))))))
|
||||||
|
@ -532,6 +523,7 @@
|
||||||
:member-email "user@example.com"})
|
:member-email "user@example.com"})
|
||||||
data {::th/type :prepare-register-profile
|
data {::th/type :prepare-register-profile
|
||||||
:invitation-token itoken
|
:invitation-token itoken
|
||||||
|
:fullname "foobar"
|
||||||
:email "user@example.com"
|
:email "user@example.com"
|
||||||
:password "foobar"}
|
:password "foobar"}
|
||||||
|
|
||||||
|
@ -542,8 +534,7 @@
|
||||||
|
|
||||||
(let [rtoken (:token result)
|
(let [rtoken (:token result)
|
||||||
data {::th/type :register-profile
|
data {::th/type :register-profile
|
||||||
:token rtoken
|
:token rtoken}
|
||||||
:fullname "foobar"}
|
|
||||||
|
|
||||||
{:keys [result error] :as out} (th/command! data)]
|
{:keys [result error] :as out} (th/command! data)]
|
||||||
;; (th/print-result! out)
|
;; (th/print-result! out)
|
||||||
|
@ -563,6 +554,7 @@
|
||||||
data {::th/type :prepare-register-profile
|
data {::th/type :prepare-register-profile
|
||||||
:invitation-token itoken
|
:invitation-token itoken
|
||||||
:email "user@example.com"
|
:email "user@example.com"
|
||||||
|
:fullname "foobar"
|
||||||
:password "foobar"}
|
:password "foobar"}
|
||||||
out (th/command! data)]
|
out (th/command! data)]
|
||||||
|
|
||||||
|
@ -582,6 +574,7 @@
|
||||||
:member-email "user@example.com"})
|
:member-email "user@example.com"})
|
||||||
data {::th/type :prepare-register-profile
|
data {::th/type :prepare-register-profile
|
||||||
:invitation-token itoken
|
:invitation-token itoken
|
||||||
|
:fullname "foobar"
|
||||||
:email "user@example.com"
|
:email "user@example.com"
|
||||||
:password "foobar"}
|
:password "foobar"}
|
||||||
out (th/command! data)]
|
out (th/command! data)]
|
||||||
|
@ -604,6 +597,7 @@
|
||||||
data {::th/type :prepare-register-profile
|
data {::th/type :prepare-register-profile
|
||||||
:invitation-token itoken
|
:invitation-token itoken
|
||||||
:email "user@example.com"
|
:email "user@example.com"
|
||||||
|
:fullname "foobar"
|
||||||
:password "foobar"}
|
:password "foobar"}
|
||||||
out (th/command! data)]
|
out (th/command! data)]
|
||||||
|
|
||||||
|
@ -624,6 +618,7 @@
|
||||||
|
|
||||||
data {::th/type :prepare-register-profile
|
data {::th/type :prepare-register-profile
|
||||||
:invitation-token itoken
|
:invitation-token itoken
|
||||||
|
:fullname "foobar"
|
||||||
:email "user@example.com"
|
:email "user@example.com"
|
||||||
:password "foobar"}
|
:password "foobar"}
|
||||||
out (th/command! data)]
|
out (th/command! data)]
|
||||||
|
@ -636,6 +631,7 @@
|
||||||
(t/deftest prepare-register-with-registration-disabled
|
(t/deftest prepare-register-with-registration-disabled
|
||||||
(with-redefs [app.config/flags #{}]
|
(with-redefs [app.config/flags #{}]
|
||||||
(let [data {::th/type :prepare-register-profile
|
(let [data {::th/type :prepare-register-profile
|
||||||
|
:fullname "foobar"
|
||||||
:email "user@example.com"
|
:email "user@example.com"
|
||||||
:password "foobar"}
|
:password "foobar"}
|
||||||
out (th/command! data)]
|
out (th/command! data)]
|
||||||
|
@ -648,6 +644,7 @@
|
||||||
(t/deftest prepare-register-with-existing-user
|
(t/deftest prepare-register-with-existing-user
|
||||||
(let [profile (th/create-profile* 1)
|
(let [profile (th/create-profile* 1)
|
||||||
data {::th/type :prepare-register-profile
|
data {::th/type :prepare-register-profile
|
||||||
|
:fullname "foobar"
|
||||||
:email (:email profile)
|
:email (:email profile)
|
||||||
:password "foobar"}
|
:password "foobar"}
|
||||||
out (th/command! data)]
|
out (th/command! data)]
|
||||||
|
@ -660,6 +657,7 @@
|
||||||
|
|
||||||
(let [pool (:app.db/pool th/*system*)
|
(let [pool (:app.db/pool th/*system*)
|
||||||
data {::th/type :prepare-register-profile
|
data {::th/type :prepare-register-profile
|
||||||
|
:fullname "foobar"
|
||||||
:email "user@example.com"
|
:email "user@example.com"
|
||||||
:password "foobar"}]
|
:password "foobar"}]
|
||||||
|
|
||||||
|
@ -674,6 +672,7 @@
|
||||||
(t/deftest register-profile-with-complained-email
|
(t/deftest register-profile-with-complained-email
|
||||||
(let [pool (:app.db/pool th/*system*)
|
(let [pool (:app.db/pool th/*system*)
|
||||||
data {::th/type :prepare-register-profile
|
data {::th/type :prepare-register-profile
|
||||||
|
:fullname "foobar"
|
||||||
:email "user@example.com"
|
:email "user@example.com"
|
||||||
:password "foobar"}]
|
:password "foobar"}]
|
||||||
|
|
||||||
|
@ -688,6 +687,7 @@
|
||||||
|
|
||||||
(t/deftest register-profile-with-email-as-password
|
(t/deftest register-profile-with-email-as-password
|
||||||
(let [data {::th/type :prepare-register-profile
|
(let [data {::th/type :prepare-register-profile
|
||||||
|
:fullname "foobar"
|
||||||
:email "user@example.com"
|
:email "user@example.com"
|
||||||
:password "USER@example.com"}
|
:password "USER@example.com"}
|
||||||
out (th/command! data)]
|
out (th/command! data)]
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
;; SCHEMAS & TYPES
|
;; SCHEMAS & TYPES
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(def valid-color-attrs
|
(def ^:private required-color-attrs
|
||||||
"A set used for proper check if color should contain only one of the
|
"A set used for proper check if color should contain only one of the
|
||||||
attrs listed in this set."
|
attrs listed in this set."
|
||||||
#{:image :gradient :color})
|
#{:image :gradient :color})
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
"Check if color has correct color attrs"
|
"Check if color has correct color attrs"
|
||||||
[color]
|
[color]
|
||||||
(let [attrs (set (keys color))
|
(let [attrs (set (keys color))
|
||||||
result (set/intersection attrs valid-color-attrs)]
|
result (set/intersection attrs required-color-attrs)]
|
||||||
(= 1 (count result))))
|
(= 1 (count result))))
|
||||||
|
|
||||||
(def ^:private hex-color-rx
|
(def ^:private hex-color-rx
|
||||||
|
@ -126,6 +126,9 @@
|
||||||
(sm/optional-keys schema:image-color)]
|
(sm/optional-keys schema:image-color)]
|
||||||
[:fn has-valid-color-attrs?]])
|
[:fn has-valid-color-attrs?]])
|
||||||
|
|
||||||
|
(def color-attrs
|
||||||
|
(into required-color-attrs (sm/keys schema:color-attrs)))
|
||||||
|
|
||||||
(def schema:library-color-attrs
|
(def schema:library-color-attrs
|
||||||
[:map {:title "ColorAttrs" :closed true}
|
[:map {:title "ColorAttrs" :closed true}
|
||||||
[:id ::sm/uuid]
|
[:id ::sm/uuid]
|
||||||
|
|
|
@ -98,7 +98,7 @@
|
||||||
(defn segment->point
|
(defn segment->point
|
||||||
([segment] (segment->point segment :x))
|
([segment] (segment->point segment :x))
|
||||||
([segment coord]
|
([segment coord]
|
||||||
(let [params (get segment :params)]
|
(when-let [params (get segment :params)]
|
||||||
(case coord
|
(case coord
|
||||||
:c1 (gpt/point (get params :c1x)
|
:c1 (gpt/point (get params :c1x)
|
||||||
(get params :c1y))
|
(get params :c1y))
|
||||||
|
|
|
@ -363,7 +363,7 @@
|
||||||
(defn make-curve-point
|
(defn make-curve-point
|
||||||
"Changes the content to make the point a 'curve'. The handlers will be
|
"Changes the content to make the point a 'curve'. The handlers will be
|
||||||
positioned in the same vector that results from the previous->next
|
positioned in the same vector that results from the previous->next
|
||||||
points but with fixed length."
|
points but with fixed length; return a plain segments vector"
|
||||||
[content point]
|
[content point]
|
||||||
|
|
||||||
(let [;; We perform this operation before because it can be
|
(let [;; We perform this operation before because it can be
|
||||||
|
@ -372,17 +372,21 @@
|
||||||
indices
|
indices
|
||||||
(point-indices content point)
|
(point-indices content point)
|
||||||
|
|
||||||
|
;; We transform content to a plain format for execute the
|
||||||
|
;; algorithm because right now is the only way to execute it
|
||||||
|
content
|
||||||
|
(vec content)
|
||||||
|
|
||||||
vectors
|
vectors
|
||||||
(map (fn [index]
|
(map (fn [index]
|
||||||
(let [segment (nth content index)
|
(let [segment (get content index)
|
||||||
prev-i (dec index)
|
prev-i (dec index)
|
||||||
prev (when (not (= :move-to (:command segment)))
|
prev (when (not (= :move-to (:command segment)))
|
||||||
(get content prev-i))
|
(get content prev-i))
|
||||||
next-i (inc index)
|
next-i (inc index)
|
||||||
next (get content next-i)
|
next (get content next-i)
|
||||||
|
next (when (not (= :move-to (:command next)))
|
||||||
next (when (not (= :move-to (:command next)))
|
next)]
|
||||||
next)]
|
|
||||||
{:index index
|
{:index index
|
||||||
:prev-i (when (some? prev) prev-i)
|
:prev-i (when (some? prev) prev-i)
|
||||||
:prev-c prev
|
:prev-c prev
|
||||||
|
@ -394,81 +398,73 @@
|
||||||
indices)
|
indices)
|
||||||
|
|
||||||
points
|
points
|
||||||
(into #{} xf:mapcat-points vectors)
|
(into #{} xf:mapcat-points vectors)]
|
||||||
|
|
||||||
;; We transform content to a plain format for execute the
|
(if (= (count points) 2)
|
||||||
;; algorithm because right now is the only way to execute it
|
(let [[fpoint spoint] (vec points)
|
||||||
content
|
v1 (gpt/to-vec fpoint point)
|
||||||
(vec content)
|
v2 (gpt/to-vec fpoint spoint)
|
||||||
|
vp (gpt/project v1 v2)
|
||||||
|
vh (gpt/subtract v1 vp)
|
||||||
|
|
||||||
content
|
add-curve
|
||||||
(if (= (count points) 2)
|
(fn [content {:keys [index prev-p next-p next-i]}]
|
||||||
(let [[fpoint spoint] (vec points)
|
(let [curr-segment (get content index)
|
||||||
v1 (gpt/to-vec fpoint point)
|
curr-command (get curr-segment :command)
|
||||||
v2 (gpt/to-vec fpoint spoint)
|
|
||||||
vp (gpt/project v1 v2)
|
|
||||||
vh (gpt/subtract v1 vp)
|
|
||||||
|
|
||||||
add-curve
|
next-segment (get content next-i)
|
||||||
(fn [content {:keys [index prev-p next-p next-i]}]
|
next-command (get next-segment :command)
|
||||||
(let [curr-segment (get content index)
|
|
||||||
curr-command (get curr-segment :command)
|
|
||||||
|
|
||||||
next-segment (get content next-i)
|
;; New handlers for prev-point and next-point
|
||||||
next-command (get next-segment :command)
|
prev-h
|
||||||
|
(when (some? prev-p) (gpt/add prev-p vh))
|
||||||
|
|
||||||
;; New handlers for prev-point and next-point
|
next-h
|
||||||
prev-h
|
(when (some? next-p) (gpt/add next-p vh))
|
||||||
(when (some? prev-p) (gpt/add prev-p vh))
|
|
||||||
|
|
||||||
next-h
|
;; Correct 1/3 to the point improves the curve
|
||||||
(when (some? next-p) (gpt/add next-p vh))
|
prev-correction
|
||||||
|
(when (some? prev-h) (gpt/scale (gpt/to-vec prev-h point) (/ 1 3)))
|
||||||
|
|
||||||
;; Correct 1/3 to the point improves the curve
|
next-correction
|
||||||
prev-correction
|
(when (some? next-h) (gpt/scale (gpt/to-vec next-h point) (/ 1 3)))
|
||||||
(when (some? prev-h) (gpt/scale (gpt/to-vec prev-h point) (/ 1 3)))
|
|
||||||
|
|
||||||
next-correction
|
prev-h
|
||||||
(when (some? next-h) (gpt/scale (gpt/to-vec next-h point) (/ 1 3)))
|
(when (some? prev-h) (gpt/add prev-h prev-correction))
|
||||||
|
|
||||||
prev-h
|
next-h
|
||||||
(when (some? prev-h) (gpt/add prev-h prev-correction))
|
(when (some? next-h) (gpt/add next-h next-correction))]
|
||||||
|
|
||||||
next-h
|
(cond-> content
|
||||||
(when (some? next-h) (gpt/add next-h next-correction))]
|
(and (= :line-to curr-command) (some? prev-p))
|
||||||
|
(update index helpers/update-curve-to prev-p prev-h)
|
||||||
|
|
||||||
(cond-> content
|
(and (= :line-to next-command) (some? next-p))
|
||||||
(and (= :line-to curr-command) (some? prev-p))
|
(update next-i helpers/update-curve-to next-h next-p)
|
||||||
(update index helpers/update-curve-to prev-p prev-h)
|
|
||||||
|
|
||||||
(and (= :line-to next-command) (some? next-p))
|
(and (= :curve-to curr-command) (some? prev-p))
|
||||||
(update next-i helpers/update-curve-to next-h next-p)
|
(update index update-handler :c2 prev-h)
|
||||||
|
|
||||||
(and (= :curve-to curr-command) (some? prev-p))
|
(and (= :curve-to next-command) (some? next-p))
|
||||||
(update index update-handler :c2 prev-h)
|
(update next-i update-handler :c1 next-h))))]
|
||||||
|
|
||||||
(and (= :curve-to next-command) (some? next-p))
|
(reduce add-curve content vectors))
|
||||||
(update next-i update-handler :c1 next-h))))]
|
|
||||||
|
|
||||||
(reduce add-curve content vectors))
|
(let [add-curve
|
||||||
|
(fn [content {:keys [index segment prev-p next-c next-i]}]
|
||||||
|
(cond-> content
|
||||||
|
(= :line-to (:command segment))
|
||||||
|
(update index #(line->curve prev-p %))
|
||||||
|
|
||||||
(let [add-curve
|
(= :curve-to (:command segment))
|
||||||
(fn [content {:keys [index segment prev-p next-c next-i]}]
|
(update index #(line->curve prev-p %))
|
||||||
(cond-> content
|
|
||||||
(= :line-to (:command segment))
|
|
||||||
(update index #(line->curve prev-p %))
|
|
||||||
|
|
||||||
(= :curve-to (:command segment))
|
(= :line-to (:command next-c))
|
||||||
(update index #(line->curve prev-p %))
|
(update next-i #(line->curve point %))
|
||||||
|
|
||||||
(= :line-to (:command next-c))
|
(= :curve-to (:command next-c))
|
||||||
(update next-i #(line->curve point %))
|
(update next-i #(line->curve point %))))]
|
||||||
|
(reduce add-curve content vectors)))))
|
||||||
(= :curve-to (:command next-c))
|
|
||||||
(update next-i #(line->curve point %))))]
|
|
||||||
(reduce add-curve content vectors)))]
|
|
||||||
|
|
||||||
(impl/from-plain content)))
|
|
||||||
|
|
||||||
(defn get-segments-with-points
|
(defn get-segments-with-points
|
||||||
"Given a content and a set of points return all the segments in the path
|
"Given a content and a set of points return all the segments in the path
|
||||||
|
@ -628,27 +624,38 @@
|
||||||
(rest content))))))))
|
(rest content))))))))
|
||||||
|
|
||||||
(defn join-nodes
|
(defn join-nodes
|
||||||
"Creates new segments between points that weren't previously"
|
"Creates new segments between points that weren't previously.
|
||||||
|
Returns plain segments vector."
|
||||||
[content points]
|
[content points]
|
||||||
|
|
||||||
(let [segments-set (into #{}
|
(let [;; Materialize the content to a vector (plain format)
|
||||||
(map (juxt :start :end))
|
content
|
||||||
(get-segments-with-points content points))
|
(vec content)
|
||||||
|
|
||||||
create-line-command (fn [point other]
|
segments-set
|
||||||
[(helpers/make-move-to point)
|
(into #{}
|
||||||
(helpers/make-line-to other)])
|
(map (juxt :start :end))
|
||||||
|
(get-segments-with-points content points))
|
||||||
|
|
||||||
not-segment? (fn [point other] (and (not (contains? segments-set [point other]))
|
create-line-segment
|
||||||
(not (contains? segments-set [other point]))))
|
(fn [point other]
|
||||||
|
[(helpers/make-move-to point)
|
||||||
|
(helpers/make-line-to other)])
|
||||||
|
|
||||||
new-content (->> (d/map-perm create-line-command not-segment? points)
|
not-segment?
|
||||||
(flatten)
|
(fn [point other]
|
||||||
(into []))]
|
(and (not (contains? segments-set [point other]))
|
||||||
|
(not (contains? segments-set [other point]))))
|
||||||
|
|
||||||
|
;; FIXME: implement map-perm in terms of transducer, will
|
||||||
|
;; improve performance and remove the need to use flatten
|
||||||
|
new-content
|
||||||
|
(->> (d/map-perm create-line-segment not-segment? points)
|
||||||
|
(flatten)
|
||||||
|
(into []))]
|
||||||
|
|
||||||
(into content new-content)))
|
(into content new-content)))
|
||||||
|
|
||||||
|
|
||||||
(defn separate-nodes
|
(defn separate-nodes
|
||||||
"Removes the segments between the points given"
|
"Removes the segments between the points given"
|
||||||
[content points]
|
[content points]
|
||||||
|
|
|
@ -141,8 +141,8 @@
|
||||||
|
|
||||||
proc (-> (p/do
|
proc (-> (p/do
|
||||||
(p/loop [exports (seq exports)]
|
(p/loop [exports (seq exports)]
|
||||||
(when-let [export (-> (first exports)
|
(when-let [export (some-> (first exports)
|
||||||
(assoc :skip-children skip-children))]
|
(assoc :skip-children skip-children))]
|
||||||
(p/do
|
(p/do
|
||||||
(rd/render export append)
|
(rd/render export append)
|
||||||
(p/recur (rest exports)))))
|
(p/recur (rest exports)))))
|
||||||
|
|
|
@ -82,7 +82,7 @@
|
||||||
|
|
||||||
on-error
|
on-error
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(fn [form cause]
|
(fn [cause]
|
||||||
(let [{:keys [type code] :as edata} (ex-data cause)]
|
(let [{:keys [type code] :as edata} (ex-data cause)]
|
||||||
(condp = [type code]
|
(condp = [type code]
|
||||||
[:restriction :registration-disabled]
|
[:restriction :registration-disabled]
|
||||||
|
@ -101,7 +101,10 @@
|
||||||
(swap! form assoc-in [:errors :password]
|
(swap! form assoc-in [:errors :password]
|
||||||
{:message (tr "errors.email-as-password")})
|
{:message (tr "errors.email-as-password")})
|
||||||
|
|
||||||
(st/emit! (ntf/error (tr "errors.generic")))))))
|
(do
|
||||||
|
(when-let [explain (get edata :explain)]
|
||||||
|
(println explain))
|
||||||
|
(st/emit! (ntf/error (tr "errors.generic"))))))))
|
||||||
|
|
||||||
on-success
|
on-success
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
|
@ -109,10 +112,9 @@
|
||||||
(fn [params]
|
(fn [params]
|
||||||
(if (fn? on-success-callback)
|
(if (fn? on-success-callback)
|
||||||
(on-success-callback (:email params))
|
(on-success-callback (:email params))
|
||||||
|
|
||||||
(cond
|
(cond
|
||||||
(some? (:token params))
|
(some? (:invitation-token params))
|
||||||
(let [token (:token params)]
|
(let [token (:invitation-token params)]
|
||||||
(st/emit! (rt/nav :auth-verify-token {:token token})))
|
(st/emit! (rt/nav :auth-verify-token {:token token})))
|
||||||
|
|
||||||
(:is-active params)
|
(:is-active params)
|
||||||
|
@ -126,25 +128,25 @@
|
||||||
on-register-profile
|
on-register-profile
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps on-success on-error)
|
(mf/deps on-success on-error)
|
||||||
(fn [form]
|
(fn [params]
|
||||||
(reset! submitted? true)
|
(reset! submitted? true)
|
||||||
(let [create-welcome-file?
|
(->> (rp/cmd! :register-profile params)
|
||||||
(cf/external-feature-flag "onboarding-03" "test")
|
(rx/subs! on-success on-error #(reset! submitted? false)))))
|
||||||
|
|
||||||
params
|
|
||||||
(cond-> form
|
|
||||||
create-welcome-file? (assoc :create-welcome-file true))]
|
|
||||||
(->> (rp/cmd! :register-profile params)
|
|
||||||
(rx/subs! on-success on-error #(reset! submitted? false))))))
|
|
||||||
|
|
||||||
on-submit
|
on-submit
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps on-success-callback)
|
(mf/deps on-success-callback)
|
||||||
(fn [form _event]
|
(fn [form _event]
|
||||||
(reset! submitted? true)
|
(reset! submitted? true)
|
||||||
(let [cdata (:clean-data @form)]
|
(let [create-welcome-file?
|
||||||
|
(cf/external-feature-flag "onboarding-03" "test")
|
||||||
|
|
||||||
|
cdata
|
||||||
|
(cond-> (:clean-data @form)
|
||||||
|
create-welcome-file?
|
||||||
|
(assoc :create-welcome-file true))]
|
||||||
|
|
||||||
(->> (rp/cmd! :prepare-register-profile cdata)
|
(->> (rp/cmd! :prepare-register-profile cdata)
|
||||||
(rx/map #(merge % cdata))
|
|
||||||
(rx/finalize #(reset! submitted? false))
|
(rx/finalize #(reset! submitted? false))
|
||||||
(rx/subs! on-register-profile)))))]
|
(rx/subs! on-register-profile)))))]
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
.shape-row {
|
.shape-row {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: auto 1fr;
|
grid-template-columns: auto minmax(0, 1fr);
|
||||||
gap: $s-8;
|
gap: $s-8;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: $s-32;
|
height: $s-32;
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
(update :lang #(or % ""))
|
(update :lang #(or % ""))
|
||||||
(update :theme #(if (= % "default")
|
(update :theme #(if (= % "default")
|
||||||
"dark"
|
"dark"
|
||||||
%))))
|
(or % "dark")))))
|
||||||
|
|
||||||
form (fm/use-form :schema schema:options-form
|
form (fm/use-form :schema schema:options-form
|
||||||
:initial initial)]
|
:initial initial)]
|
||||||
|
|
|
@ -63,7 +63,7 @@ $width-settings-bar-max: $sz-500;
|
||||||
.right-settings-bar {
|
.right-settings-bar {
|
||||||
grid-area: right-sidebar;
|
grid-area: right-sidebar;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-rows: auto 1fr;
|
grid-template-rows: auto minmax(0, 1fr);
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
width: $width-settings-bar;
|
width: $width-settings-bar;
|
||||||
background-color: var(--panel-background-color);
|
background-color: var(--panel-background-color);
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
[app.common.colors :as cc]
|
[app.common.colors :as cc]
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[app.common.data.macros :as dm]
|
[app.common.data.macros :as dm]
|
||||||
|
[app.common.types.color :as types.color]
|
||||||
[app.common.types.shape.attrs :refer [default-color]]
|
[app.common.types.shape.attrs :refer [default-color]]
|
||||||
[app.main.data.modal :as modal]
|
[app.main.data.modal :as modal]
|
||||||
[app.main.data.workspace.colors :as dwc]
|
[app.main.data.workspace.colors :as dwc]
|
||||||
|
@ -125,7 +126,8 @@
|
||||||
(fn [value]
|
(fn [value]
|
||||||
(let [color (-> color
|
(let [color (-> color
|
||||||
(assoc :opacity (/ value 100))
|
(assoc :opacity (/ value 100))
|
||||||
(dissoc :ref-id :ref-file))]
|
(dissoc :ref-id :ref-file)
|
||||||
|
(select-keys types.color/color-attrs))]
|
||||||
(st/emit! (dwc/add-recent-color color)
|
(st/emit! (dwc/add-recent-color color)
|
||||||
(on-change color)))))
|
(on-change color)))))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue