Improve styles and colours and composition
This commit is contained in:
parent
d04a114838
commit
11fcf21e2d
|
@ -1,15 +1,18 @@
|
||||||
(ns day8.re-frame.trace.styles)
|
(ns day8.re-frame.trace.styles)
|
||||||
|
|
||||||
(defonce panel-styles "
|
(defonce panel-styles "
|
||||||
|
#--re-frame-trace-- {
|
||||||
|
background: white;
|
||||||
|
color: black;
|
||||||
|
font-family: 'courier new', monospace;
|
||||||
|
}
|
||||||
#--re-frame-trace-- tbody {
|
#--re-frame-trace-- tbody {
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
}
|
}
|
||||||
#--re-frame-trace-- tr:nth-child(even) {
|
#--re-frame-trace-- tr:nth-child(even) {
|
||||||
background: aliceblue;
|
background: aliceblue;
|
||||||
}
|
}
|
||||||
#--re-frame-trace-- .button
|
#--re-frame-trace-- .button {
|
||||||
{
|
|
||||||
background: lightblue;
|
|
||||||
padding: 5px 5px 3px;
|
padding: 5px 5px 3px;
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
|
@ -20,20 +23,26 @@
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
#--re-frame-trace-- .icon-button {
|
#--re-frame-trace-- .icon-button {
|
||||||
vertical-align: middle;
|
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
#--re-frame-trace-- button.tab {
|
||||||
|
|
||||||
}
|
}
|
||||||
#--re-frame-trace-- .tab {
|
#--re-frame-trace-- .tab {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
border-bottom: 3px solid #eee;
|
|
||||||
padding-bottom: 1px;
|
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-family: monospace;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
padding-bottom: 4px;
|
||||||
|
vertical-align: bottom;
|
||||||
}
|
}
|
||||||
#--re-frame-trace-- .tab.active {
|
#--re-frame-trace-- .tab.active {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
border-bottom: 3px solid lightblue;
|
border-bottom: 3px solid lightblue;
|
||||||
padding-bottom: 1px;
|
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
|
padding-bottom: 1px;
|
||||||
}
|
}
|
||||||
#--re-frame-trace-- ul.filter-items {
|
#--re-frame-trace-- ul.filter-items {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
|
@ -41,13 +50,14 @@
|
||||||
margin: 0 -5px;
|
margin: 0 -5px;
|
||||||
}
|
}
|
||||||
#--re-frame-trace-- .filter-items li {
|
#--re-frame-trace-- .filter-items li {
|
||||||
background: lightblue;
|
color: #333;
|
||||||
color: #666;
|
background: #efefef;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
font-size: 0.9em;
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
}
|
}
|
||||||
#--re-frame-trace-- .filter-items li .filter-item-string {
|
#--re-frame-trace-- .filter-items li .filter-item-string {
|
||||||
color: #333;
|
color: #616cdb;
|
||||||
}
|
}
|
||||||
#--re-frame-trace-- .icon {
|
#--re-frame-trace-- .icon {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
@ -60,4 +70,22 @@
|
||||||
#--re-frame-trace-- .icon-remove {
|
#--re-frame-trace-- .icon-remove {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
#--re-frame-trace-- select {
|
||||||
|
background: white;
|
||||||
|
font-family: 'courier new', monospace;
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
#--re-frame-trace-- .nav {
|
||||||
|
background: #efeef1;
|
||||||
|
color: #222;
|
||||||
|
}
|
||||||
|
#--re-frame-trace-- .panel-content-top {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
#--re-frame-trace-- .panel-content-scrollable {
|
||||||
|
padding: 10px;
|
||||||
|
flex: 1 0 auto;
|
||||||
|
height: 100%;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
")
|
")
|
||||||
|
|
|
@ -63,9 +63,9 @@
|
||||||
(trace/with-trace {:op-type :render
|
(trace/with-trace {:op-type :render
|
||||||
:tags {:component-path (reagent.impl.component/component-path c)}
|
:tags {:component-path (reagent.impl.component/component-path c)}
|
||||||
:operation (last (str/split name #" > "))}
|
:operation (last (str/split name #" > "))}
|
||||||
(real-renderer c)
|
(real-renderer c)))))
|
||||||
|
|
||||||
|
|
||||||
))))
|
|
||||||
|
|
||||||
(set! reagent.impl.component/static-fns static-fns)
|
(set! reagent.impl.component/static-fns static-fns)
|
||||||
|
|
||||||
|
@ -90,8 +90,8 @@
|
||||||
#_(set! reagent.impl.batching/schedule schedule
|
#_(set! reagent.impl.batching/schedule schedule
|
||||||
#_(fn []
|
#_(fn []
|
||||||
(reagent.impl.batching/do-after-render (fn [] (trace/with-trace {:op-type :raf-end})))
|
(reagent.impl.batching/do-after-render (fn [] (trace/with-trace {:op-type :raf-end})))
|
||||||
(real-schedule)))
|
(real-schedule)))))
|
||||||
))
|
|
||||||
|
|
||||||
(def traces (interop/ratom []))
|
(def traces (interop/ratom []))
|
||||||
(defn log-trace? [trace]
|
(defn log-trace? [trace]
|
||||||
|
@ -115,8 +115,8 @@
|
||||||
(defn init-tracing!
|
(defn init-tracing!
|
||||||
"Sets up any intial state that needs to be there for tracing. Does not enable tracing."
|
"Sets up any intial state that needs to be there for tracing. Does not enable tracing."
|
||||||
[]
|
[]
|
||||||
(monkey-patch-reagent)
|
(monkey-patch-reagent))
|
||||||
)
|
|
||||||
|
|
||||||
(defn search-input [{:keys [title on-save on-change on-stop]}]
|
(defn search-input [{:keys [title on-save on-change on-stop]}]
|
||||||
(let [val (r/atom title)
|
(let [val (r/atom title)
|
||||||
|
@ -124,9 +124,9 @@
|
||||||
(when (pos? (count v))
|
(when (pos? (count v))
|
||||||
(on-save v)))]
|
(on-save v)))]
|
||||||
(fn []
|
(fn []
|
||||||
[:input {:type "text"
|
[:input {:style {:margin-left 7}
|
||||||
|
:type "text"
|
||||||
:value @val
|
:value @val
|
||||||
:style {:margin 7}
|
|
||||||
:auto-focus true
|
:auto-focus true
|
||||||
:on-change #(do (reset! val (-> % .-target .-value))
|
:on-change #(do (reset! val (-> % .-target .-value))
|
||||||
(on-change %))
|
(on-change %))
|
||||||
|
@ -185,8 +185,9 @@
|
||||||
:query (str/lower-case @filter-input)
|
:query (str/lower-case @filter-input)
|
||||||
:filter-type @filter-type}))]
|
:filter-type @filter-type}))]
|
||||||
[:div
|
[:div
|
||||||
{:style {:padding "10px"}}
|
[:div.filter-control {:style {:margin-bottom 20}}
|
||||||
[:span
|
[:div.filter-control-input
|
||||||
|
{:style {:margin-bottom 10}}
|
||||||
[:select {:value @filter-type :on-change (fn [e]
|
[:select {:value @filter-type :on-change (fn [e]
|
||||||
(reset! filter-type (.. e -target -value))
|
(reset! filter-type (.. e -target -value))
|
||||||
(println (.. e -target -value)))}
|
(println (.. e -target -value)))}
|
||||||
|
@ -194,7 +195,8 @@
|
||||||
[:option "slower than"]]
|
[:option "slower than"]]
|
||||||
[search-input {:on-save save-query
|
[search-input {:on-save save-query
|
||||||
:on-change #(reset! filter-input (.. % -target -value))}]
|
:on-change #(reset! filter-input (.. % -target -value))}]
|
||||||
[:button.button.icon-button {:on-click save-query}
|
[:button.button.icon-button {:on-click save-query
|
||||||
|
:style {:margin 0}}
|
||||||
[components/icon-add]]
|
[components/icon-add]]
|
||||||
;; [:button {:style {:background "#aae0ec"
|
;; [:button {:style {:background "#aae0ec"
|
||||||
;; :padding 7
|
;; :padding 7
|
||||||
|
@ -208,7 +210,7 @@
|
||||||
{:on-click (fn [event] (swap! filter-items #(remove (comp (partial = (:query item)) :query) %)))}
|
{:on-click (fn [event] (swap! filter-items #(remove (comp (partial = (:query item)) :query) %)))}
|
||||||
(:filter-type item) ": " [:span.filter-item-string (:query item)]
|
(:filter-type item) ": " [:span.filter-item-string (:query item)]
|
||||||
[:button.icon-button [components/icon-remove]]])
|
[:button.icon-button [components/icon-remove]]])
|
||||||
@filter-items)]
|
@filter-items)]]
|
||||||
[:table
|
[:table
|
||||||
{:cell-spacing "0" :width "100%"}
|
{:cell-spacing "0" :width "100%"}
|
||||||
[:thead>tr
|
[:thead>tr
|
||||||
|
@ -234,7 +236,7 @@
|
||||||
;; Add clear button
|
;; Add clear button
|
||||||
;; Filter out different trace types
|
;; Filter out different trace types
|
||||||
(let [position (r/atom :right)
|
(let [position (r/atom :right)
|
||||||
size (r/atom 0.3)
|
size (r/atom 0.35)
|
||||||
showing? (r/atom false)
|
showing? (r/atom false)
|
||||||
dragging? (r/atom false)
|
dragging? (r/atom false)
|
||||||
pin-to-bottom? (r/atom true)
|
pin-to-bottom? (r/atom true)
|
||||||
|
@ -265,11 +267,13 @@
|
||||||
transition (if @showing?
|
transition (if @showing?
|
||||||
ease-transition
|
ease-transition
|
||||||
(str ease-transition ", opacity 0.01s linear 0.2s"))]
|
(str ease-transition ", opacity 0.01s linear 0.2s"))]
|
||||||
[:div {:style {:position "fixed" :width "0px" :height "0px" :top "0px" :left "0px" :z-index 99999999}}
|
[:div.panel-wrapper
|
||||||
[:div {:style {:position "fixed" :z-index 1 :box-shadow "rgba(0, 0, 0, 0.298039) 0px 0px 4px" :background "white"
|
{:style {:position "fixed" :width "0px" :height "0px" :top "0px" :left "0px" :z-index 99999999}}
|
||||||
|
[:div.panel
|
||||||
|
{:style {:position "fixed" :z-index 1 :box-shadow "rgba(0, 0, 0, 0.298039) 0px 0px 4px" :background "white"
|
||||||
:left left :top "0px" :width (str (* 100 @size) "%") :height "100%"
|
:left left :top "0px" :width (str (* 100 @size) "%") :height "100%"
|
||||||
:transition transition}}
|
:transition transition}}
|
||||||
[:div.resizer {:style (resizer-style draggable-area)
|
[:div.panel-resizer {:style (resizer-style draggable-area)
|
||||||
:on-mouse-down #(reset! dragging? true)
|
:on-mouse-down #(reset! dragging? true)
|
||||||
:on-mouse-up #(reset! dragging? false)
|
:on-mouse-up #(reset! dragging? false)
|
||||||
:on-mouse-move (fn [e]
|
:on-mouse-move (fn [e]
|
||||||
|
@ -279,15 +283,19 @@
|
||||||
(.preventDefault e)
|
(.preventDefault e)
|
||||||
(reset! size (/ (- full-width x)
|
(reset! size (/ (- full-width x)
|
||||||
full-width)))))}]
|
full-width)))))}]
|
||||||
[:div {:style {:width "100%" :height "100%" :overflow "auto"}}
|
[:div.panel-content
|
||||||
|
{:style {:width "100%" :height "100%" :display "flex" :flex-direction "column"}}
|
||||||
|
[:div.panel-content-top
|
||||||
|
[:div.nav
|
||||||
[:button {:class (str "tab button " (when (= @selected-tab :traces) "active"))
|
[:button {:class (str "tab button " (when (= @selected-tab :traces) "active"))
|
||||||
:on-click #(reset! selected-tab :traces)} "Traces"]
|
:on-click #(reset! selected-tab :traces)} "Traces"]
|
||||||
[:button {:class (str "tab button " (when (= @selected-tab :subvis) "active"))
|
[:button {:class (str "tab button " (when (= @selected-tab :subvis) "active"))
|
||||||
:on-click #(reset! selected-tab :subvis)} "SubVis"]
|
:on-click #(reset! selected-tab :subvis)} "SubVis"]]]
|
||||||
|
[:div.panel-content-scrollable
|
||||||
(case @selected-tab
|
(case @selected-tab
|
||||||
:traces [render-trace-panel]
|
:traces [render-trace-panel]
|
||||||
:subvis [subvis/render-subvis traces]
|
:subvis [subvis/render-subvis traces]
|
||||||
[render-trace-panel])]]]))})))
|
[render-trace-panel])]]]]))})))
|
||||||
|
|
||||||
(defn panel-div []
|
(defn panel-div []
|
||||||
(let [id "--re-frame-trace--"
|
(let [id "--re-frame-trace--"
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
simulation-a (atom nil)]
|
simulation-a (atom nil)]
|
||||||
(fn []
|
(fn []
|
||||||
[:div
|
[:div
|
||||||
{:style {:padding "10px"}}
|
|
||||||
[d3t/create-d3
|
[d3t/create-d3
|
||||||
{:render-component (fn [ratom]
|
{:render-component (fn [ratom]
|
||||||
[:svg#d3cmp {:width width :height height}])
|
[:svg#d3cmp {:width width :height height}])
|
||||||
|
@ -183,9 +182,8 @@
|
||||||
|
|
||||||
(.. simulation
|
(.. simulation
|
||||||
(restart)
|
(restart)
|
||||||
(alpha 0.3)))))
|
(alpha 0.3)))))]))))}
|
||||||
]
|
|
||||||
))))}
|
|
||||||
traces-ratom]
|
traces-ratom]
|
||||||
[:hr]])))
|
[:hr]])))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue