File tree 7 files changed +13621
-12063
lines changed
.clj-kondo/metosin/malli-types-cljs
7 files changed +13621
-12063
lines changed Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 133
133
(count (children-ids db (first parent-els)))))))
134
134
135
135
(m/=> siblings [:function
136
- [:-> App [:vector uuid?]]
137
- [:-> App uuid? [:vector uuid?]]])
136
+ [:-> App [:maybe [ : vector uuid?] ]]
137
+ [:-> App uuid? [:maybe [ : vector uuid?] ]]])
138
138
(defn siblings
139
139
([db]
140
140
(:children (parent db)))
182
182
of nested elements."
183
183
[db id]
184
184
(let [ancestor-els (reverse (ancestor-ids db id))]
185
- (conj (mapv #(index db %) ancestor-els)
186
- (index db id))))
185
+ (->> (index db id)
186
+ (conj (map #(index db %) ancestor-els))
187
+ (remove nil?)
188
+ (vec ))))
187
189
188
190
(m/=> descendant-ids [:function
189
191
[:-> App [:set uuid?]]
658
660
:parent (-> selected-elements first :parent )
659
661
:attrs (merge attrs {:d new-path})})))))
660
662
663
+ (m/=> paste-in-place [:function
664
+ [:-> App App]
665
+ [:-> App Element App]])
661
666
(defn paste-in-place
662
667
([db]
663
668
(reduce paste-in-place (deselect db) (:copied-elements db)))
664
669
([db el]
665
670
(reduce select (add db el) (selected-ids db))))
666
671
672
+ (m/=> paste [:function
673
+ [:-> App App]
674
+ [:-> App Element Element App]])
667
675
(defn paste
668
676
([db]
669
677
(let [parent-el (hovered-svg db)]
705
713
:attrs attrs
706
714
:parent id}) (selected-ids db))))
707
715
716
+ (m/=> paste-styles [:function
717
+ [:-> App App]
718
+ [:-> App uuid? App]])
708
719
(defn paste-styles
709
720
([db]
710
721
(reduce paste-styles db (selected-ids db)))
719
730
(update-attr id attr #(if % (-> attrs attr) disj))))
720
731
db style-attrs)) db)))
721
732
733
+ (m/=> inherit-attrs [:-> App Element uuid? App])
722
734
(defn inherit-attrs
723
735
[db source-el id]
724
736
(reduce
787
799
(-> (add db svg)
788
800
(collapse ))))
789
801
802
+ (m/=> snapping-points [:-> App [:maybe [:sequential Element]] [:vector Vec2D]])
790
803
(defn snapping-points
791
804
[db els]
792
805
(let [options (-> db :snap :options )]
Original file line number Diff line number Diff line change 27
27
(assoc nneighbor :base-point %)))
28
28
(remove nil?)))
29
29
30
+ (m/=> update-nearest-neighbors [:-> App App])
30
31
(defn update-nearest-neighbors
31
32
[db]
32
33
(let [zoom (get-in db [:documents (:active-document db) :zoom ])
Original file line number Diff line number Diff line change 75
75
[db]
76
76
(get-in db [:documents (:active-document db) :temp-element ]))
77
77
78
+ (m/=> create-temp-element [:-> App App])
78
79
(defn create-temp-element
79
80
[db]
80
81
(->> (temp db)
Original file line number Diff line number Diff line change 2
2
" Internationalization namespace
3
3
https://github.com/taoensso/tempura"
4
4
(:require
5
+ [malli.core :as m]
5
6
[re-frame.core :as rf]
6
7
[renderer.app.subs :as-alias app.s]
7
8
[taoensso.tempura :refer [tr] :refer-macros [load-resource-at-compile-time]]))
12
13
{:en-US (load-resource-at-compile-time " lang/en-US.edn" )
13
14
:el-GR (load-resource-at-compile-time " lang/el-GR.edn" )})
14
15
16
+ (m/=> lang? [:-> keyword? boolean?])
15
17
(defn lang?
16
18
[lang]
17
19
(contains? dictionary lang))
Original file line number Diff line number Diff line change 9
9
(def PathManipulation
10
10
[:enum :simplify :smooth :flatten :reverse ])
11
11
12
+ (m/=> get-d [:-> any? string?])
12
13
(defn get-d
13
14
[paper-path]
14
15
(-> paper-path
Original file line number Diff line number Diff line change 171
171
(is (= (-> @selected first :attrs :fill ) " black" ))
172
172
(not (-> @selected first :attrs :stroke )))))
173
173
174
- #_ (deftest boolean-operation
175
- (rf-test/run-test-sync
176
- (rf/dispatch [::app.e/initialize-db ])
177
- (rf/dispatch [::document.e/init ])
178
- (let [selected (rf/subscribe [::s/selected ])]
179
- (rf/dispatch [::e/add {:tag :rect
180
- :attrs {:x 100
181
- :y 100
182
- :width 100
183
- :height 100
184
- :fill " red"
185
- :stroke " black" }}])
186
- (rf/dispatch [::e/add {:tag :rect
187
- :attrs {:x 100
188
- :y 100
189
- :width 100
190
- :height 100 }}])
191
- (rf/dispatch [::e/select-all ])
192
- (rf/dispatch [::e/boolean-operation :unite ])
193
- (is (= (-> @selected first :tag ) :path ))
194
- (is (= (-> @selected first :attrs :fill ) " red" )))))
174
+ (deftest boolean-operation
175
+ (rf-test/run-test-sync
176
+ (rf/dispatch [::app.e/initialize-db ])
177
+ (rf/dispatch [::document.e/init ])
178
+ (let [selected (rf/subscribe [::s/selected ])]
179
+ (rf/dispatch [::e/add {:tag :rect
180
+ :attrs {:x 100
181
+ :y 100
182
+ :width 100
183
+ :height 100
184
+ :fill " red"
185
+ :stroke " black" }}])
186
+ (rf/dispatch [::e/add {:tag :rect
187
+ :attrs {:x 100
188
+ :y 100
189
+ :width 100
190
+ :height 100 }}])
191
+ (rf/dispatch [::e/select-all ])
192
+ (rf/dispatch [::e/boolean-operation :unite ])
193
+ (is (= (-> @selected first :tag ) :path ))
194
+ (is (= (-> @selected first :attrs :fill ) " red" )))))
195
195
196
196
(deftest import-svg
197
197
(rf-test/run-test-sync
You can’t perform that action at this time.
0 commit comments