Skip to content

Commit d1d4178

Browse files
committed
enhance naming
1 parent 3c92c69 commit d1d4178

File tree

11 files changed

+52
-52
lines changed

11 files changed

+52
-52
lines changed

src/renderer/db.cljs

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
[:pointer-pos [:tuple double? double?]]
1212
[:zoom-sensitivity double?]
1313
[:state keyword?]
14-
[:grid? boolean?]
15-
[:rulers? boolean?]
14+
[:grid-visible? boolean?]
15+
[:rulers-visible? boolean?]
1616
[:snap renderer.snap.db/snap]
1717
[:rulers-locked? boolean?]
1818
[:documents [:map-of :uuid renderer.document.db/document]]
@@ -38,8 +38,8 @@
3838
:debug-info? false
3939
:pen-mode? false
4040
:rulers-locked? false
41-
:grid? false
42-
:rulers? true
41+
:grid-visible? false
42+
:rulers-visible? true
4343
:snap {:enabled? true
4444
:threshold 100
4545
:options #{:centers :midpoints :corners :nodes}}

src/renderer/events.cljs

+3-3
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
(rf/reg-event-db
8585
:toggle-rulers
8686
(fn [db [_]]
87-
(update db :rulers? not)))
87+
(update db :rulers-visible? not)))
8888

8989
#_(rf/reg-event-db
9090
:toggle-rulers-locked
@@ -94,10 +94,10 @@
9494
(rf/reg-event-db
9595
:toggle-grid
9696
(fn [db [_]]
97-
(update db :grid? not)))
97+
(update db :grid-visible? not)))
9898

9999
(rf/reg-event-db
100-
:panel/toggle
100+
:toggle-panel
101101
[local-storage/persist
102102
(rf/path :panel)]
103103
(fn [db [_ key]]

src/renderer/menubar/views.cljs

+14-14
Original file line numberDiff line numberDiff line change
@@ -352,38 +352,38 @@
352352
:type :checkbox
353353
:icon "tree"
354354
:label "Element tree"
355-
:checked? [:panel/visible? :tree]
356-
:action [:panel/toggle :tree]}
355+
:checked? [:panel-visible? :tree]
356+
:action [:toggle-panel :tree]}
357357
{:key :toggle-props
358358
:type :checkbox
359359
:icon "properties"
360360
:label "Properties"
361-
:checked? [:panel/visible? :properties]
362-
:action [:panel/toggle :properties]}
361+
:checked? [:panel-visible? :properties]
362+
:action [:toggle-panel :properties]}
363363
{:key :toggle-xml
364364
:label "XML view"
365365
:type :checkbox
366366
:icon "code"
367-
:checked? [:panel/visible? :xml]
368-
:action [:panel/toggle :xml]}
367+
:checked? [:panel-visible? :xml]
368+
:action [:toggle-panel :xml]}
369369
{:key :toggle-history
370370
:label "History tree"
371371
:icon "history"
372372
:type :checkbox
373-
:checked? [:panel/visible? :history]
374-
:action [:panel/toggle :history]}
373+
:checked? [:panel-visible? :history]
374+
:action [:toggle-panel :history]}
375375
{:key :toggle-command-history
376376
:type :checkbox
377377
:label "Shell history"
378378
:icon "shell"
379-
:checked? [:panel/visible? :repl-history]
380-
:action [:panel/toggle :repl-history]}
379+
:checked? [:panel-visible? :repl-history]
380+
:action [:toggle-panel :repl-history]}
381381
{:key :toggle-timeline-panel
382382
:type :checkbox
383383
:label "Timeline editor"
384384
:icon "timeline"
385-
:checked? [:panel/visible? :timeline]
386-
:action [:panel/toggle :timeline]}
385+
:checked? [:panel-visible? :timeline]
386+
:action [:toggle-panel :timeline]}
387387
{:key :divider-2
388388
:type :separator}])
389389

@@ -406,13 +406,13 @@
406406
:type :checkbox
407407
:label "Grid"
408408
:icon "grid"
409-
:checked? [:grid?]
409+
:checked? [:grid-visible?]
410410
:action [:toggle-grid]}
411411
{:key :toggle-rulers
412412
:type :checkbox
413413
:label "Rulers"
414414
:icon "ruler-combined"
415-
:checked? [:rulers?]
415+
:checked? [:rulers-visible?]
416416
:action [:toggle-rulers]}
417417
{:key :toggle-debug-info
418418
:type :checkbox

src/renderer/reepl/core.cljs

+3-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
:complete-word
7979
:on-change]))]}
8080
(let [{:keys [_pos _count _text]} @state
81-
repl-history? @(rf/subscribe [:panel/visible? :repl-history])]
81+
repl-history? @(rf/subscribe [:panel-visible? :repl-history])]
8282
[:div.flex.p-0.5.items-center.m-1
8383
[:div.flex.text-xs.self-start {:class "m-0.5"} (replumb/get-prompt)]
8484
^{:key (str (hash (:js-cm-opts cm-opts)))}
@@ -98,7 +98,7 @@
9898
:active-text "Hide command output"
9999
:inactive-icon "chevron-up"
100100
:inactive-text "Show command output"
101-
:action #(rf/dispatch [:panel/toggle :repl-history])}
101+
:action #(rf/dispatch [:toggle-panel :repl-history])}
102102
{:style {:height "16px"}}]]))
103103

104104
(defn set-print!
@@ -180,7 +180,7 @@
180180

181181
(set-print! add-log)
182182
[:<>
183-
(when @(rf/subscribe [:panel/visible? :repl-history])
183+
(when @(rf/subscribe [:panel-visible? :repl-history])
184184
[repl-items-panel @items show-value-opts set-text])
185185

186186
[:div.relative.whitespace-pre-wrap.font-mono

src/renderer/subs.cljs

+6-6
Original file line numberDiff line numberDiff line change
@@ -135,20 +135,20 @@
135135
:-> :rulers-locked?)
136136

137137
(rf/reg-sub
138-
:rulers?
139-
:-> :rulers?)
138+
:rulers-visible?
139+
:-> :rulers-visible?)
140140

141141
(rf/reg-sub
142-
:grid?
143-
:-> :grid?)
142+
:grid-visible?
143+
:-> :grid-visible?)
144144

145145
(rf/reg-sub
146-
:panel/visible?
146+
:panel-visible?
147147
(fn [db [_ key]]
148148
(-> db :panel key :visible?)))
149149

150150
(rf/reg-sub
151-
:theme/mode
151+
:theme-mode
152152
(fn [db _]
153153
(-> db :theme :mode)))
154154

src/renderer/timeline/views.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
[snap-controls]
112112
[comp/icon-button "times"
113113
{:title "Hide timeline"
114-
:on-click #(rf/dispatch [:panel/toggle :timeline])}]]))
114+
:on-click #(rf/dispatch [:toggle-panel :timeline])}]]))
115115

116116
(defn register-listeners
117117
[timeline-ref]
@@ -152,7 +152,7 @@
152152
[]
153153
(let [time @(rf/subscribe [::timeline.s/time])
154154
end @(rf/subscribe [::timeline.s/end])
155-
timeline? @(rf/subscribe [:panel/visible? :timeline])]
155+
timeline? @(rf/subscribe [:panel-visible? :timeline])]
156156
[:div.h-px.block
157157
{:style {:width (str (* (/ time end) 100) "%")
158158
:background (when-not (or (zero? time) (zero? end) timeline?)

src/renderer/tool/container/canvas.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
tool @(rf/subscribe [:tool])
3838
primary-tool @(rf/subscribe [:primary-tool])
3939
rotate @(rf/subscribe [::document.s/rotate])
40-
grid? @(rf/subscribe [:grid?])
40+
grid? @(rf/subscribe [:grid-visible?])
4141
state @(rf/subscribe [:state])
4242
pointer-handler #(pointer/event-handler % element)
4343
pivot-point @(rf/subscribe [:pivot-point])

src/renderer/toolbar/status.cljs

+9-9
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,25 @@
4747

4848
(def view-radio-buttons
4949
[{:title "Timeline"
50-
:active? [:panel/visible? :timeline]
50+
:active? [:panel-visible? :timeline]
5151
:icon "timeline"
52-
:action [:panel/toggle :timeline]}
52+
:action [:toggle-panel :timeline]}
5353
{:title "Grid"
54-
:active? [:grid?]
54+
:active? [:grid-visible?]
5555
:icon "grid"
5656
:action [:toggle-grid]}
5757
{:title "Rulers"
58-
:active? [:rulers?]
58+
:active? [:rulers-visible?]
5959
:icon "ruler-combined"
6060
:action [:toggle-rulers]}
6161
{:title "History"
62-
:active? [:panel/visible? :history]
62+
:active? [:panel-visible? :history]
6363
:icon "history"
64-
:action [:panel/toggle :history]}
64+
:action [:toggle-panel :history]}
6565
{:title "XML"
66-
:active? [:panel/visible? :xml]
66+
:active? [:panel-visible? :xml]
6767
:icon "code"
68-
:action [:panel/toggle :xml]}])
68+
:action [:toggle-panel :xml]}])
6969

7070
(defn set-zoom
7171
[e v]
@@ -102,7 +102,7 @@
102102

103103
(defn root []
104104
(let [zoom @(rf/subscribe [::document.s/zoom])
105-
timeline? @(rf/subscribe [:panel/visible? :timeline])]
105+
timeline? @(rf/subscribe [:panel-visible? :timeline])]
106106
[:<>
107107
[:div.toolbar.bg-primary.mt-px
108108
[color-v/picker]

src/renderer/utils/keyboard.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@
8080
[{:keyCode (key-codes "P")
8181
:ctrlKey true
8282
:shiftKey true}]]
83-
[[:panel/toggle :tree]
83+
[[:toggle-panel :tree]
8484
[{:keyCode (key-codes "T")
8585
:ctrlKey true}]]
86-
[[:panel/toggle :properties]
86+
[[:toggle-panel :properties]
8787
[{:keyCode (key-codes "P")
8888
:ctrlKey true}]]
8989
[[::element.e/stroke->path]

src/renderer/views.cljs

+7-7
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
(defn frame-panel
2929
[]
30-
(let [rulers? @(rf/subscribe [:rulers?])
30+
(let [rulers? @(rf/subscribe [:rulers-visible?])
3131
read-only? @(rf/subscribe [::document.s/read-only?])
3232
loading? @(rf/subscribe [::worker.s/loading?])]
3333
[:div.flex.flex-col.flex-1.h-full
@@ -82,7 +82,7 @@
8282
{:id "frame-panel"
8383
:order 1}
8484
[frame-panel]]
85-
(when @(rf/subscribe [:panel/visible? :history])
85+
(when @(rf/subscribe [:panel-visible? :history])
8686
[:<>
8787
[:> PanelResizeHandle
8888
{:id "history-resize-handle"
@@ -94,7 +94,7 @@
9494
[:div.v-scroll.p-1.bg-primary.h-full.ml-px
9595
[history/root]]]])
9696

97-
(when @(rf/subscribe [:panel/visible? :xml])
97+
(when @(rf/subscribe [:panel-visible? :xml])
9898
(let [xml @(rf/subscribe [::element.s/xml])]
9999
[:<>
100100
[:> PanelResizeHandle
@@ -111,8 +111,8 @@
111111

112112
(defn editor
113113
[]
114-
(let [timeline? @(rf/subscribe [:panel/visible? :timeline])
115-
repl-history? @(rf/subscribe [:panel/visible? :repl-history])]
114+
(let [timeline? @(rf/subscribe [:panel-visible? :timeline])
115+
repl-history? @(rf/subscribe [:panel-visible? :repl-history])]
116116
[:> PanelGroup
117117
;; REVIEW: We need to rerender the group to properly resize the panels.
118118
{:key (str timeline? repl-history?)
@@ -133,7 +133,7 @@
133133
[win/app-header]
134134
(if (seq @(rf/subscribe [:documents]))
135135
[:div.flex.h-full.flex-1.overflow-hidden
136-
(when @(rf/subscribe [:panel/visible? :tree])
136+
(when @(rf/subscribe [:panel-visible? :tree])
137137
[:div.flex.flex-col
138138
{:style {:width "227px"}}
139139
[doc/actions]
@@ -143,7 +143,7 @@
143143
[:div.flex.h-full.flex-1
144144
[:div.flex.h-full.flex-col.flex-1
145145
[editor]]
146-
(when @(rf/subscribe [:panel/visible? :properties])
146+
(when @(rf/subscribe [:panel-visible? :properties])
147147
[:div.flex
148148
{:style {:width "300px"}}
149149
[attr/form]])

src/renderer/window/views.cljs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
[:div.flex.h-full.flex-1.drag]
5353
[button {:action [:theme/cycle-mode]
5454
:title "Theme mode"
55-
:icon (name @(rf/subscribe [:theme/mode]))
55+
:icon (name @(rf/subscribe [:theme-mode]))
5656
:class "bg-primary"}]
5757
(when (and platform/electron? (not fullscreen?) (not platform/mac?))
5858
(into [:div.text-right]

0 commit comments

Comments
 (0)