                         cursor (fn [s]
                                  (clj->js
                                   (conj s {"type" "none"
-                                           "id" (new-id)
                                            "beats" (repeat % [0])
                                            "params" {}}))))
             width-selection (fn [w s]

        (dom/tr nil (dom/td #js {:onClick #(om/set-state! owner :track-expanded true)
                                 :style #js {:color "#999"}} ">"))
        (dom/tr nil
                (dom/td #js {:onClick #(om/set-state! owner :track-expanded false)
                             :style #js {:color "#999"}} "<")
                (dom/td nil
                 (dom/table nil
                  (apply dom/tr nil

          :init (let [width (apply max (map #(count (get % "beats")) cursor))]
                  (if (= 0 (count cursor))
                    (dom/p style-grey
                           (dom/span #js {:onClick #(transition {:state :open})} "[+]"))
                    (dom/p style-grey
                           (dom/span #js {:onClick #(transition {:state :open})} "[+")
                           (width-selection width (str " " width))
                           (dom/span nil "]"))))
          :open (dom/p style-grey
                       (dom/span #js {:onClick #(transition {:state :init})} "[- ")
                       (width-selection 1 " 1")
                       (width-selection 2 " 2")
                       (width-selection 4 " 4")
                       (width-selection 8 " 8")
                       (width-selection 16 " 16")
                       (dom/span nil "]")))))))

(defn track-view [{:keys [cursor id delete-ch]} owner]
  (reify
