<commit_before>(ns ^:figwheel-always pepa.style
    (:require [garden.core :refer [css]]
              [garden.units :as u :refer [px em pt]]
              [garden.stylesheet :refer [at-keyframes cssfn]]

              [nom.ui :as ui]
              [pepa.navigation :refer [navigation-elements]]

              [clojure.string :as s]
              [goog.string :as gstring]))

;;; Colors

(def grey-1 "#303030")
(def grey-2 "#575757")
(def grey-3 "#6f6f6f")

(def dark-background "#f7f7f7")
(def darker-background "#dddddd")
(def light-background "#ffffff")
(def light-blue-background "#d6e3eb")
(def blue-background "#2780ba")

(def sidebar-color dark-background)
(def header-color dark-background)

(def text-color-disabled "#999999")
(def blue-text "#37698c")
(def default-text grey-2)

(def tags-text default-text)
(def tags-background dark-background)
(def tags-selected-background light-blue-background)
(def tags-border "#e8e8e8")


(def border-light "#f0f0f0")
(def border-dark "#cbcbcb")
(def border-buttons "#a2a2a2")

(def editable-background tags-border)

(def dashboard-page-count-color "#aaaaaa")
(def dashboard-selection-color "#bedbff")

;;; Font

(def default-font  ["Helvetica Neue"
                    "Helvetic"
                    "Arial"
                    "Comic Sans MS"])

;;; Sizes

(def default-sidebar-width 250)
(def max-sidebar-width 600)
(def min-sidebar-width 200)

;;; Helper functions

(def a4-ratio (/ 1 (Math/sqrt 2)))
(def x43-ratio (/ 3 4))

;;; Hack to generate calc() expressions

(defn ^:private fn->symbol [fn]
  (condp = fn
    + '+
    - '-
    * '*
    / '/))

(defn ^:private calc-expression [& ops]
  (let [ops (map #(cond
                    (number? %) (px %)
                    (fn? %) (fn->symbol %)
                    :else %)
                 ops)]
    ((cssfn :calc) ops)))

(defn ^:private calc-str [& ops]
  (garden.compiler/render-css (apply calc-expression ops)))

(defn calc-property
  "Generates css rule map(s) for `property' with calc(ops...)."
  [property [& ops]]
  (let [expr (apply calc-expression ops)
        exprs (map #(str "-" (name %) "-" (apply calc-str ops)) [:moz :webkit])]
    (cons {property expr}
          (for [expr exprs]
            {property expr}))))


(defn image-url [image]
  (str "url(" (str "/img/" image) ")"))

;;; Header

(def header-padding 10)
(def header-height (- 72 header-padding))

(def generic-header-css
  ;; TODO(mu): Position header buttons here
  (let [header-height (px (- header-height 2))] ;handle border
    [:header {:min-height header-height
              :max-height header-height
              :line-height header-height
              :z-index 110
              :background-color header-color
              :padding {:left (px header-padding)
                        :right (px header-padding)}}]))

(def draggable-size 24)
(defn draggable-css [position]
  [:.draggable (assoc
                {:position :absolute
                 :top (px 0)
                 :width (px draggable-size)
                 :height (px draggable-size)
                 :z-index 120
                 :cursor :ew-resize
                 :background {:image (image-url "resize.svg")
                              :size [(px draggable-size)
                                     (px draggable-size)]}
                 :opacity 0.5}
                (or position :left)
                (px (if (= position :right)
                      0
                      (* -1 draggable-size))))
   [:&:hover {:opacity 1.0}]])

(def sidebar-header-css
  (list
   generic-header-css
   [:header {:text-decoration :none
             :font-size (em 1.2)
             :display :flex
             :justify-content :flex-start
             :flex-direction :row}]))

(def search-css
  (let [margin-horizontal (px 10)
        margin-vertical (px 15)
        search-input-padding 5]
    [:form.search {:position :relative
                   :display :flex
                   :align-items :center
                   :justify-content :space-around}
     [:>input {:margin {:left margin-horizontal
                        :right margin-horizontal
                        :top margin-vertical
                        :bottom margin-vertical}
               :padding (px search-input-padding)
               :padding-right (px (* 5 search-input-padding))
               :width "100%"
               :color default-text
               :background {:image (image-url "glass.svg")
                            :repeat :no-repeat
                            :position "center right"}
               :border-radius (px search-input-padding)}]]))

(def sidebar-css
  (let [search-height 80]
    [:#sidebar {:height "100%"
                :display :flex
                :background-color sidebar-color
                :position :relative
                :flex-direction :column}
     (draggable-css :right)
     sidebar-header-css

     ;; Sections
     [:nav.workflows (list
                      {:overflow-y :auto}
                      (calc-property :height ["100%"
                                              - 1 ; border
                                              ]))
      [:ul {:padding-left 0, :margin 0}
       (let [item-height 50
             padding (/ item-height 8)
             line-height (/ item-height 1.5)
             icon-size 20
             padding-left 20]
         [:li {:list-style-type :none
               :height (px line-height)
               :line-height (px line-height)
               :padding {:top (px padding)
                         :bottom (px padding)}
               :background {:repeat :no-repeat
                            :size (px icon-size)
                            :position [[(px padding-left) :center]]}
               :user-select :none}
          (for [row (map (comp name second) navigation-elements)]
            (let [selector (keyword (str "&." row))]
              [selector
               [:.menu-link
                [:.title<commit_msg>[style] start simplifying sidebar.<commit_after>(ns ^:figwheel-always pepa.style
    (:require [garden.core :refer [css]]
              [garden.units :as u :refer [px em pt]]
              [garden.stylesheet :refer [at-keyframes cssfn]]

              [nom.ui :as ui]
              [pepa.navigation :refer [navigation-elements]]

              [clojure.string :as s]
              [goog.string :as gstring]))

;;; Colors

(def grey-1 "#303030")
(def grey-2 "#575757")
(def grey-3 "#6f6f6f")

(def dark-background "#f7f7f7")
(def darker-background "#dddddd")
(def light-background "#ffffff")
(def light-blue-background "#d6e3eb")
(def blue-background "#2780ba")

(def sidebar-color dark-background)
(def header-color dark-background)

(def text-color-disabled "#999999")
(def blue-text "#37698c")
(def default-text grey-2)

(def tags-text default-text)
(def tags-background dark-background)
(def tags-selected-background light-blue-background)
(def tags-border "#e8e8e8")


(def border-light "#f0f0f0")
(def border-dark "#cbcbcb")
(def border-buttons "#a2a2a2")

(def editable-background tags-border)

(def dashboard-page-count-color "#aaaaaa")
(def dashboard-selection-color "#bedbff")

;;; Font

(def default-font  ["Helvetica Neue"
                    "Helvetic"
                    "Arial"
                    "Comic Sans MS"])

;;; Sizes

(def default-sidebar-width 250)
(def max-sidebar-width 600)
(def min-sidebar-width 200)

;;; Helper functions

(def a4-ratio (/ 1 (Math/sqrt 2)))
(def x43-ratio (/ 3 4))

;;; Hack to generate calc() expressions

(defn ^:private fn->symbol [fn]
  (condp = fn
    + '+
    - '-
    * '*
    / '/))

(defn ^:private calc-expression [& ops]
  (let [ops (map #(cond
                    (number? %) (px %)
                    (fn? %) (fn->symbol %)
                    :else %)
                 ops)]
    ((cssfn :calc) ops)))

(defn ^:private calc-str [& ops]
  (garden.compiler/render-css (apply calc-expression ops)))

(defn calc-property
  "Generates css rule map(s) for `property' with calc(ops...)."
  [property [& ops]]
  (let [expr (apply calc-expression ops)
        exprs (map #(str "-" (name %) "-" (apply calc-str ops)) [:moz :webkit])]
    (cons {property expr}
          (for [expr exprs]
            {property expr}))))


(defn image-url [image]
  (str "url(" (str "/img/" image) ")"))

;;; Header

(def header-padding 10)
(def header-height (- 72 header-padding))

(def generic-header-css
  ;; TODO(mu): Position header buttons here
  (let [header-height (px (- header-height 2))] ;handle border
    [:header {:min-height header-height
              :max-height header-height
              :line-height header-height
              :z-index 110
              :background-color header-color
              :padding {:left (px header-padding)
                        :right (px header-padding)}}]))

(def draggable-size 24)
(defn draggable-css [position]
  [:.draggable (assoc
                {:position :absolute
                 :top (px 0)
                 :width (px draggable-size)
                 :height (px draggable-size)
                 :z-index 120
                 :cursor :ew-resize
                 :background {:image (image-url "resize.svg")
                              :size [(px draggable-size)
                                     (px draggable-size)]}
                 :opacity 0.5}
                (or position :left)
                (px (if (= position :right)
                      0
                      (* -1 draggable-size))))
   [:&:hover {:opacity 1.0}]])

(def sidebar-header-css
  (list
   generic-header-css
   [:header {:text-decoration :none
             :font-size (em 1.2)
             :display :flex
             :justify-content :flex-start
             :flex-direction :row}]))

(def search-css
  (let [margin-horizontal (px 10)
        margin-vertical (px 15)
        search-input-padding 5]
    [:form.search {:position :relative
                   :display :flex
                   :align-items :center
                   :justify-content :space-around}
     [:>input {:margin {:left margin-horizontal
                        :right margin-horizontal
                        :top margin-vertical
                        :bottom margin-vertical}
               :padding (px search-input-padding)
               :padding-right (px (* 5 search-input-padding))
               :width "100%"
               :color default-text
               :background {:image (image-url "glass.svg")
                            :repeat :no-repeat
                            :position "center right"}
               :border-radius (px search-input-padding)}]]))

(def sidebar-css
  (let [search-height 80]
    [:#sidebar {:height "100%"
                :display :flex
                :background-color sidebar-color
                :position :relative
                :flex-direction :column}
     (draggable-css :right)
     sidebar-header-css

     ;; Sections
     [:nav.workflows {:overflow-y :auto
                      :flex-grow 1}
      [:>ul {:padding-left 0, :margin 0}
       (let [item-height 50
             padding (/ item-height 8)
             line-height (/ item-height 1.5)
             icon-size 20
             padding-left 20]
         [:li {:list-style-type :none
               :height (px line-height)
               :line-height (px line-height)
               :padding {:top (px padding)
                         :bottom (px padding)}
               :background {:repeat :no-repeat
                            :size (px icon-size)
                            :position [[(px padding-left) :center]]}
               :user-select :none}
          (for [row (map (comp name second) navigation-elements)]
            (let [selector (keyword (str "&." row))]
              [selector
               [:.menu-link
                [:.title
{'fraction_non_alphanumeric': 0.13726155150487496, 'fraction_numerical': 0.019245442984315388, 'mean_word_length': 1.6513823331085637, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4117442', 'n_tokens_mistral': 3713, 'n_tokens_neox': 3391, 'n_words': 908}