Remove all usage of mx/component and replace that with rumext.

This commit is contained in:
Andrey Antukh 2017-04-08 18:30:03 +02:00
parent 491d91b1ee
commit 671c2d912c
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95
78 changed files with 328 additions and 503 deletions

View file

@ -18,11 +18,12 @@
;; Runtime ;; Runtime
[com.cognitect/transit-cljs "0.8.239"] [com.cognitect/transit-cljs "0.8.239"]
[funcool/rumext "1.0.0"]
[rum "0.10.8" :exclusions [cljsjs/react cljsjs/react-dom]] [rum "0.10.8" :exclusions [cljsjs/react cljsjs/react-dom]]
;; [cljsjs/react-with-addons "15.4.2-2"] [cljsjs/react "15.5.0-0"]
[cljsjs/react "15.4.2-2"] [cljsjs/react-dom "15.5.0-0"]
[cljsjs/react-dom "15.4.2-2"] [cljsjs/react-dom-server "15.5.0-0"]
[cljsjs/react-dom-server "15.4.2-2"]
[funcool/beicon "3.2.0"] [funcool/beicon "3.2.0"]
[funcool/bide "1.4.0"] [funcool/bide "1.4.0"]

View file

@ -12,7 +12,7 @@
[uxbox.main.refs :as refs] [uxbox.main.refs :as refs]
[uxbox.main.streams :as streams] [uxbox.main.streams :as streams]
[uxbox.main.user-events :as uev] [uxbox.main.user-events :as uev]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.geom.point :as gpt])) [uxbox.util.geom.point :as gpt]))

View file

@ -11,7 +11,7 @@
[potok.core :as ptk] [potok.core :as ptk]
[uxbox.main.refs :as refs] [uxbox.main.refs :as refs]
[uxbox.main.streams :as streams] [uxbox.main.streams :as streams]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.geom.point :as gpt])) [uxbox.util.geom.point :as gpt]))

View file

@ -14,7 +14,7 @@
[uxbox.main.ui.shapes.path :refer [path-shape]] [uxbox.main.ui.shapes.path :refer [path-shape]]
[uxbox.main.ui.shapes.circle :refer [circle-shape]] [uxbox.main.ui.shapes.circle :refer [circle-shape]]
[uxbox.main.ui.shapes.image :refer [image-shape]] [uxbox.main.ui.shapes.image :refer [image-shape]]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
(def ^:dynamic *state* st/state) (def ^:dynamic *state* st/state)

View file

@ -29,7 +29,7 @@
[uxbox.util.i18n :refer [tr]] [uxbox.util.i18n :refer [tr]]
[uxbox.util.data :refer [parse-int uuid-str?]] [uxbox.util.data :refer [parse-int uuid-str?]]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
;; --- Constants ;; --- Constants

View file

@ -17,7 +17,7 @@
[uxbox.main.ui.navigation :as nav] [uxbox.main.ui.navigation :as nav]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.forms :as fm] [uxbox.util.forms :as fm]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.router :as rt])) [uxbox.util.router :as rt]))
(def form-data (fm/focus-data :login st/state)) (def form-data (fm/focus-data :login st/state))

View file

@ -16,7 +16,7 @@
[uxbox.main.ui.navigation :as nav] [uxbox.main.ui.navigation :as nav]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.forms :as fm] [uxbox.util.forms :as fm]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.router :as rt])) [uxbox.util.router :as rt]))
(def form-data (fm/focus-data :recovery st/state)) (def form-data (fm/focus-data :recovery st/state))

View file

@ -16,7 +16,7 @@
[uxbox.main.ui.navigation :as nav] [uxbox.main.ui.navigation :as nav]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.forms :as fm] [uxbox.util.forms :as fm]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.router :as rt])) [uxbox.util.router :as rt]))
(def form-data (fm/focus-data :recovery-request st/state)) (def form-data (fm/focus-data :recovery-request st/state))

View file

@ -16,7 +16,7 @@
[uxbox.main.ui.navigation :as nav] [uxbox.main.ui.navigation :as nav]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.forms :as fm] [uxbox.util.forms :as fm]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.router :as rt])) [uxbox.util.router :as rt]))
(def form-data (fm/focus-data :register st/state)) (def form-data (fm/focus-data :register st/state))

View file

@ -5,12 +5,10 @@
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.main.ui.colorpicker (ns uxbox.main.ui.colorpicker
(:require [sablono.core :as html :refer-macros [html]] (:require [lentes.core :as l]
[rum.core :as rum]
[lentes.core :as l]
[goog.events :as events] [goog.events :as events]
[uxbox.util.forms :as sc] [uxbox.util.forms :as sc]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.math :as mth] [uxbox.util.math :as mth]
[uxbox.util.data :as data] [uxbox.util.data :as data]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
@ -19,9 +17,8 @@
;; --- Picker Box ;; --- Picker Box
(defn- picker-box-render (mx/defc picker-box
[own] []
(html
[:svg {:width "100%" :height "100%" :version "1.1"} [:svg {:width "100%" :height "100%" :version "1.1"}
[:defs [:defs
[:linearGradient {:id "gradient-black" [:linearGradient {:id "gradient-black"
@ -37,19 +34,12 @@
[:rect {:x "0" :y "0" :width "100%" :height "100%" [:rect {:x "0" :y "0" :width "100%" :height "100%"
:fill "url(#gradient-white)"}] :fill "url(#gradient-white)"}]
[:rect {:x "0" :y "0" :width "100%" :height "100%" [:rect {:x "0" :y "0" :width "100%" :height "100%"
:fill "url(#gradient-black)"}]])) :fill "url(#gradient-black)"}]])
(def picker-box
(mx/component
{:render picker-box-render
:name "picker-box"
:mixins []}))
;; --- Slider Box ;; --- Slider Box
(defn slider-box-render (mx/defc slider-box
[own] []
(html
[:svg {:width "100%" :height "100%" :version "1.1"} [:svg {:width "100%" :height "100%" :version "1.1"}
[:defs [:defs
[:linearGradient {:id "gradient-hsv" [:linearGradient {:id "gradient-hsv"
@ -65,7 +55,7 @@
[:stop {:offset "88%" :stopColor "#FFFF00" :stopOpacity "1"}] [:stop {:offset "88%" :stopColor "#FFFF00" :stopOpacity "1"}]
[:stop {:offset "100%" :stopColor "#FF0000" :stopOpacity "1"}]]] [:stop {:offset "100%" :stopColor "#FF0000" :stopOpacity "1"}]]]
[:rect {:x 0 :y 0 :width "100%" :height "100%" [:rect {:x 0 :y 0 :width "100%" :height "100%"
:fill "url(#gradient-hsv)"}]])) :fill "url(#gradient-hsv)"}]])
(def default-dimensions (def default-dimensions
{:pi-height 5 {:pi-height 5
@ -83,12 +73,6 @@
:p-width 170 :p-width 170
:s-height 170}) :s-height 170})
(def slider-box
(mx/component
{:render slider-box-render
:name "slider-box"
:mixins []}))
;; --- Color Picker ;; --- Color Picker
(defn- on-picker-click (defn- on-picker-click
@ -116,11 +100,11 @@
(swap! local assoc :color hsv) (swap! local assoc :color hsv)
(on-change hex))) (on-change hex)))
(defn- colorpicker-render (mx/defcs colorpicker
[own & {:keys [value on-change theme] {:mixins [mx/static (mx/local)]}
[{:keys [rum/local] :as own} & {:keys [value on-change theme]
:or {value "#d4edfb" theme :default}}] :or {value "#d4edfb" theme :default}}]
(let [local (:rum/local own) (let [value-rgb (color/hex->rgb value)
value-rgb (color/hex->rgb value)
classes (case theme classes (case theme
:default "theme-default" :default "theme-default"
:small "theme-small") :small "theme-small")
@ -161,7 +145,6 @@
hex (color/rgb->hex rgb)] hex (color/rgb->hex rgb)]
(when (color/hex? hex) (when (color/hex? hex)
(on-change hex))))] (on-change hex))))]
(html
[:div.color-picker {:class classes} [:div.color-picker {:class classes}
[:div.picker-area [:div.picker-area
#_[:div.tester {:style {:width "100px" :height "100px" #_[:div.tester {:style {:width "100px" :height "100px"
@ -217,12 +200,4 @@
{:placeholder "B" {:placeholder "B"
:on-change (partial on-rgb-change value-rgb 2) :on-change (partial on-rgb-change value-rgb 2)
:value (nth value-rgb 2) :value (nth value-rgb 2)
:type "number"}]]]])))) :type "number"}]]]])))
(def colorpicker
(mx/component
{:render colorpicker-render
:name "colorpicker"
:mixins [mx/static (mx/local)]}))

View file

@ -6,15 +6,14 @@
;; Copyright (c) 2016 Juan de la Cruz <delacruzgarciajuan@gmail.com> ;; Copyright (c) 2016 Juan de la Cruz <delacruzgarciajuan@gmail.com>
(ns uxbox.main.ui.confirm (ns uxbox.main.ui.confirm
(:require [sablono.core :as html :refer-macros [html]] (:require [uxbox.main.data.lightbox :as udl]
[uxbox.main.data.lightbox :as udl]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.main.ui.lightbox :as lbx])) [uxbox.main.ui.lightbox :as lbx]))
(defn- confirm-dialog-render (mx/defc confirm-dialog
[own {:keys [on-accept on-cancel hint] :as ctx}] [{:keys [on-accept on-cancel hint] :as ctx}]
(letfn [(accept [event] (letfn [(accept [event]
(dom/prevent-default event) (dom/prevent-default event)
(udl/close!) (udl/close!)
@ -24,7 +23,6 @@
(udl/close!) (udl/close!)
(when on-cancel (when on-cancel
(on-cancel (dissoc ctx :on-accept :on-cancel))))] (on-cancel (dissoc ctx :on-accept :on-cancel))))]
(html
[:div.lightbox-body.confirm-dialog [:div.lightbox-body.confirm-dialog
[:h3 "Are you sure?"] [:h3 "Are you sure?"]
(if hint (if hint
@ -40,13 +38,7 @@
:on-click cancel}]] :on-click cancel}]]
[:a.close {:href "#" [:a.close {:href "#"
:on-click #(do (dom/prevent-default %) :on-click #(do (dom/prevent-default %)
(udl/close!))} i/close]]))) (udl/close!))} i/close]]))
(def confirm-dialog
(mx/component
{:render confirm-dialog-render
:name "confirm-dialog"
:mixins []}))
(defmethod lbx/render-lightbox :confirm (defmethod lbx/render-lightbox :confirm
[context] [context]

View file

@ -23,7 +23,7 @@
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.i18n :as t :refer (tr)] [uxbox.util.i18n :as t :refer (tr)]
[uxbox.util.lens :as ul] [uxbox.util.lens :as ul]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
;; --- Refs ;; --- Refs

View file

@ -12,7 +12,7 @@
[uxbox.main.data.dashboard :as dd] [uxbox.main.data.dashboard :as dd]
[uxbox.main.data.lightbox :as udl] [uxbox.main.data.lightbox :as udl]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.main.ui.lightbox :as lbx] [uxbox.main.ui.lightbox :as lbx]
[uxbox.main.ui.dashboard.header :refer (header)] [uxbox.main.ui.dashboard.header :refer (header)]
[uxbox.util.dom :as dom])) [uxbox.util.dom :as dom]))

View file

@ -14,7 +14,7 @@
[uxbox.main.ui.users :as ui.u] [uxbox.main.ui.users :as ui.u]
[uxbox.util.i18n :refer (tr)] [uxbox.util.i18n :refer (tr)]
[uxbox.util.router :as r] [uxbox.util.router :as r]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[potok.core :as ptk])) [potok.core :as ptk]))
(def header-ref (def header-ref

View file

@ -18,7 +18,7 @@
[uxbox.main.ui.keyboard :as kbd] [uxbox.main.ui.keyboard :as kbd]
[uxbox.util.i18n :as t :refer (tr)] [uxbox.util.i18n :as t :refer (tr)]
[uxbox.util.data :refer (read-string)] [uxbox.util.data :refer (read-string)]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.time :as dt] [uxbox.util.time :as dt]
[potok.core :as ptk] [potok.core :as ptk]
[uxbox.util.forms :as sc] [uxbox.util.forms :as sc]

View file

@ -14,7 +14,7 @@
[uxbox.main.data.lightbox :as udl] [uxbox.main.data.lightbox :as udl]
[uxbox.main.data.images :as di] [uxbox.main.data.images :as di]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.main.ui.lightbox :as lbx] [uxbox.main.ui.lightbox :as lbx]
[uxbox.main.ui.keyboard :as kbd] [uxbox.main.ui.keyboard :as kbd]
[uxbox.main.ui.dashboard.header :refer [header]] [uxbox.main.ui.dashboard.header :refer [header]]

View file

@ -24,7 +24,7 @@
[uxbox.util.data :refer [read-string]] [uxbox.util.data :refer [read-string]]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.blob :as blob] [uxbox.util.blob :as blob]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.time :as dt])) [uxbox.util.time :as dt]))
;; --- Helpers & Constants ;; --- Helpers & Constants

View file

@ -20,7 +20,7 @@
[uxbox.util.forms :as fm] [uxbox.util.forms :as fm]
[uxbox.util.i18n :as t :refer [tr]] [uxbox.util.i18n :as t :refer [tr]]
[uxbox.util.router :as r] [uxbox.util.router :as r]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.time :as dt])) [uxbox.util.time :as dt]))
(def form-data (fm/focus-data :create-project st/state)) (def form-data (fm/focus-data :create-project st/state))

View file

@ -1,13 +1,11 @@
(ns uxbox.main.ui.lightbox (ns uxbox.main.ui.lightbox
(:require [sablono.core :as html :refer-macros [html]] (:require [lentes.core :as l]
[rum.core :as rum]
[lentes.core :as l]
[uxbox.main.store :as st] [uxbox.main.store :as st]
[uxbox.main.data.lightbox :as udl] [uxbox.main.data.lightbox :as udl]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.main.ui.keyboard :as k] [uxbox.main.ui.keyboard :as k]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.data :refer (classnames)] [uxbox.util.data :refer [classnames]]
[goog.events :as events]) [goog.events :as events])
(:import goog.events.EventType)) (:import goog.events.EventType))
@ -47,23 +45,17 @@
(events/unlistenByKey (::key own)) (events/unlistenByKey (::key own))
(dissoc own ::key)) (dissoc own ::key))
(defn- lightbox-render (mx/defcs lightbox
{:mixins [mx/reactive]
:will-mount lightbox-will-mount
:will-unmount lightbox-will-umount}
[own] [own]
(let [data (mx/react lightbox-ref) (let [data (mx/react lightbox-ref)
classes (classnames classes (classnames
:hide (nil? data) :hide (nil? data)
:transparent (:transparent? data))] :transparent (:transparent? data))]
(html
[:div.lightbox [:div.lightbox
{:class classes {:class classes
:ref "parent" :ref "parent"
:on-click (partial on-out-clicked own)} :on-click (partial on-out-clicked own)}
(render-lightbox data)]))) (render-lightbox data)]))
(def lightbox
(mx/component
{:name "lightbox"
:render lightbox-render
:will-mount lightbox-will-mount
:will-unmount lightbox-will-umount
:mixins [mx/reactive]}))

View file

@ -7,7 +7,7 @@
(ns uxbox.main.ui.loader (ns uxbox.main.ui.loader
(:require [uxbox.main.store :as st] (:require [uxbox.main.store :as st]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
;; --- Component ;; --- Component

View file

@ -2,7 +2,7 @@
(:require [lentes.core :as l] (:require [lentes.core :as l]
[uxbox.main.store :as st] [uxbox.main.store :as st]
[uxbox.util.messages :as uum] [uxbox.util.messages :as uum]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
(def ^:private message-ref (def ^:private message-ref
(-> (l/key :message) (-> (l/key :message)

View file

@ -12,7 +12,7 @@
[uxbox.util.router :as r] [uxbox.util.router :as r]
[potok.core :as ptk] [potok.core :as ptk]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.main.ui.settings.profile :as profile] [uxbox.main.ui.settings.profile :as profile]
[uxbox.main.ui.settings.password :as password] [uxbox.main.ui.settings.password :as password]

View file

@ -2,40 +2,37 @@
;; License, v. 2.0. If a copy of the MPL was not distributed with this ;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/. ;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;; ;;
;; Copyright (c) 2015-2016 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2015-2017 Andrey Antukh <niwi@niwi.nz>
;; Copyright (c) 2015-2016 Juan de la Cruz <delacruzgarciajuan@gmail.com> ;; Copyright (c) 2015-2017 Juan de la Cruz <delacruzgarciajuan@gmail.com>
(ns uxbox.main.ui.settings.header (ns uxbox.main.ui.settings.header
(:require [sablono.core :as html :refer-macros [html]] (:require [potok.core :as ptk]
[rum.core :as rum]
[lentes.core :as l] [lentes.core :as l]
[uxbox.util.i18n :refer (tr)] [uxbox.util.i18n :refer [tr]]
[uxbox.util.router :as r] [uxbox.util.router :as r]
[potok.core :as ptk]
[uxbox.main.store :as st] [uxbox.main.store :as st]
[uxbox.main.data.projects :as dp] [uxbox.main.data.projects :as dp]
[uxbox.main.ui.navigation :as nav] [uxbox.main.ui.navigation :as nav]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.main.ui.users :refer (user)] [uxbox.main.ui.users :refer [user]]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
(def ^:private section-ref (def ^:private section-ref
(-> (l/in [:route :id]) (-> (l/in [:route :id])
(l/derive st/state))) (l/derive st/state)))
(defn- header-link (mx/defc header-link
[section content] [section content]
(let [link (r/route-for section)] (let [link (r/route-for section)]
(html [:a {:href (str "/#" link)} content]))
[:a {:href (str "/#" link)} content])))
(defn header-render (mx/defc header
[own] {:mixins [mx/static mx/reactive]}
[]
(let [section (mx/react section-ref) (let [section (mx/react section-ref)
profile? (= section :settings/profile) profile? (= section :settings/profile)
password? (= section :settings/password) password? (= section :settings/password)
notifications? (= section :settings/notifications)] notifications? (= section :settings/notifications)]
(html
[:header#main-bar.main-bar [:header#main-bar.main-bar
[:div.main-logo [:div.main-logo
(header-link :dashboard/projects i/logo)] (header-link :dashboard/projects i/logo)]
@ -46,11 +43,5 @@
(header-link :settings/password (tr "settings.password"))] (header-link :settings/password (tr "settings.password"))]
[:li {:class (when notifications? "current")} [:li {:class (when notifications? "current")}
(header-link :settings/notifications (tr "settings.notifications"))]] (header-link :settings/notifications (tr "settings.notifications"))]]
(user)]))) (user)]))
(def header
(mx/component
{:render header-render
:name "header"
:mixins [rum/static
mx/reactive]}))

View file

@ -12,13 +12,13 @@
[uxbox.util.router :as r] [uxbox.util.router :as r]
[potok.core :as ptk] [potok.core :as ptk]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.main.ui.settings.header :refer (header)])) [uxbox.main.ui.settings.header :refer (header)]))
(defn notifications-page-render (mx/defc notifications-page
{:mixins [mx/static]}
[own] [own]
(html
[:main.dashboard-main [:main.dashboard-main
(header) (header)
[:section.dashboard-content.user-settings [:section.dashboard-content.user-settings
@ -26,17 +26,22 @@
[:span.user-settings-label "Prototype notifications"] [:span.user-settings-label "Prototype notifications"]
[:p "Get a roll up of prototype changes in your inbox."] [:p "Get a roll up of prototype changes in your inbox."]
[:div.input-radio.radio-primary [:div.input-radio.radio-primary
[:input {:type "radio" :id "notification-1" :name "notification-1" :value "none"}] [:input {:type "radio"
[:label {:for "notification-1" :value "None"} "None"] :id "notification-1"
[:input {:type "radio" :id "notification-2" :name "notification-2" :value "every-hour"}] :name "notification-1"
[:label {:for "notification-2" :value "Every hour"} "Every hour"] :value "none"}]
[:input {:type "radio" :id "notification-3" :name "notification-3" :value "every-day"}] [:label {:for "notification-1"
:value "None"} "None"]
[:input {:type "radio"
:id "notification-2"
:name "notification-2"
:value "every-hour"}]
[:label {:for "notification-2"
:value "Every hour"} "Every hour"]
[:input {:type "radio"
:id "notification-3"
:name "notification-3"
:value "every-day"}]
[:label {:for "notification-3" :value "Every day"} "Every day"]] [:label {:for "notification-3" :value "Every day"} "Every day"]]
[:input.btn-primary {:type "submit" :value "Update settings"}] [:input.btn-primary {:type "submit" :value "Update settings"}]
]]])) ]]])
(def notifications-page
(mx/component
{:render notifications-page-render
:name "notifications-page"
:mixins [mx/static]}))

View file

@ -19,7 +19,7 @@
[uxbox.util.forms :as fm] [uxbox.util.forms :as fm]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.messages :as um] [uxbox.util.messages :as um]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
(def form-data (fm/focus-data :profile-password st/state)) (def form-data (fm/focus-data :profile-password st/state))
(def form-errors (fm/focus-errors :profile-password st/state)) (def form-errors (fm/focus-errors :profile-password st/state))

View file

@ -17,7 +17,7 @@
[uxbox.main.data.users :as udu] [uxbox.main.data.users :as udu]
[uxbox.util.forms :as fm] [uxbox.util.forms :as fm]
[uxbox.util.router :as r] [uxbox.util.router :as r]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.interop :refer [iterable->seq]] [uxbox.util.interop :refer [iterable->seq]]
[uxbox.util.dom :as dom])) [uxbox.util.dom :as dom]))

View file

@ -13,7 +13,7 @@
[uxbox.util.data :refer [classnames]] [uxbox.util.data :refer [classnames]]
[uxbox.util.geom.matrix :as gmt] [uxbox.util.geom.matrix :as gmt]
[uxbox.util.geom.point :as gpt] [uxbox.util.geom.point :as gpt]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
;; --- Circle Component ;; --- Circle Component

View file

@ -19,7 +19,7 @@
[uxbox.main.ui.shapes.image :as image] [uxbox.main.ui.shapes.image :as image]
[uxbox.util.data :refer [classnames]] [uxbox.util.data :refer [classnames]]
[uxbox.util.geom.matrix :as gmt] [uxbox.util.geom.matrix :as gmt]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
;; --- Helpers ;; --- Helpers

View file

@ -12,7 +12,7 @@
[uxbox.util.data :refer [classnames]] [uxbox.util.data :refer [classnames]]
[uxbox.util.geom.matrix :as gmt] [uxbox.util.geom.matrix :as gmt]
[uxbox.util.geom.point :as gpt] [uxbox.util.geom.point :as gpt]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
;; --- Icon Component ;; --- Icon Component

View file

@ -16,7 +16,7 @@
[uxbox.main.data.images :as udi] [uxbox.main.data.images :as udi]
[uxbox.util.data :refer [classnames]] [uxbox.util.data :refer [classnames]]
[uxbox.util.geom.matrix :as gmt] [uxbox.util.geom.matrix :as gmt]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
;; --- Refs ;; --- Refs

View file

@ -16,7 +16,7 @@
[uxbox.util.data :refer [classnames]] [uxbox.util.data :refer [classnames]]
[uxbox.util.geom.matrix :as gmt] [uxbox.util.geom.matrix :as gmt]
[uxbox.util.geom.point :as gpt] [uxbox.util.geom.point :as gpt]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
;; --- Path Component ;; --- Path Component
(declare path-shape) (declare path-shape)

View file

@ -11,7 +11,7 @@
[uxbox.main.ui.shapes.attrs :as attrs] [uxbox.main.ui.shapes.attrs :as attrs]
[uxbox.util.geom.matrix :as gmt] [uxbox.util.geom.matrix :as gmt]
[uxbox.util.geom.point :as gpt] [uxbox.util.geom.point :as gpt]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.data :refer [classnames]] [uxbox.util.data :refer [classnames]]
[uxbox.util.dom :as dom])) [uxbox.util.dom :as dom]))

View file

@ -19,7 +19,7 @@
[uxbox.main.data.shapes :as uds] [uxbox.main.data.shapes :as uds]
[uxbox.main.ui.shapes.common :as scommon] [uxbox.main.ui.shapes.common :as scommon]
[uxbox.main.geom :as geom] [uxbox.main.geom :as geom]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.geom.matrix :as gmt] [uxbox.util.geom.matrix :as gmt]
[uxbox.util.geom.point :as gpt] [uxbox.util.geom.point :as gpt]
[uxbox.util.dom :as dom])) [uxbox.util.dom :as dom]))

View file

@ -19,7 +19,7 @@
[uxbox.util.data :refer [classnames]] [uxbox.util.data :refer [classnames]]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.geom.matrix :as gmt] [uxbox.util.geom.matrix :as gmt]
[uxbox.util.mixins :as mx :include-macros true]) [rumext.core :as mx :include-macros true])
(:import goog.events.EventType)) (:import goog.events.EventType))
;; --- Events ;; --- Events

View file

@ -14,7 +14,7 @@
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.main.ui.navigation :as nav] [uxbox.main.ui.navigation :as nav]
[uxbox.util.router :as rt] [uxbox.util.router :as rt]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
;; --- User Menu ;; --- User Menu

View file

@ -33,7 +33,7 @@
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.geom.point :as gpt] [uxbox.util.geom.point :as gpt]
[uxbox.util.data :refer [classnames]] [uxbox.util.data :refer [classnames]]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
;; --- Workspace ;; --- Workspace

View file

@ -29,7 +29,7 @@
[uxbox.util.geom.point :as gpt] [uxbox.util.geom.point :as gpt]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.data :refer [parse-int]] [uxbox.util.data :refer [parse-int]]
[uxbox.util.mixins :as mx :include-macros true]) [rumext.core :as mx :include-macros true])
(:import goog.events.EventType)) (:import goog.events.EventType))
;; --- Background ;; --- Background

View file

@ -7,13 +7,14 @@
(ns uxbox.main.ui.workspace.clipboard (ns uxbox.main.ui.workspace.clipboard
(:require [lentes.core :as l] (:require [lentes.core :as l]
[sablono.core :refer-macros [html]]
[uxbox.main.store :as st] [uxbox.main.store :as st]
[uxbox.main.data.lightbox :as udl] [uxbox.main.data.lightbox :as udl]
[uxbox.main.data.workspace :as udw] [uxbox.main.data.workspace :as udw]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.main.ui.lightbox :as lbx] [uxbox.main.ui.lightbox :as lbx]
[potok.core :as ptk] [potok.core :as ptk]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.time :as dt])) [uxbox.util.time :as dt]))
@ -30,15 +31,13 @@
(on-close [event] (on-close [event]
(dom/prevent-default event) (dom/prevent-default event)
(udl/close!))] (udl/close!))]
[:div.lightbox-body.clipboard [:div.lightbox-body.clipboard {}
[:div.clipboard-list [:div.clipboard-list {}
(for [item (mx/react clipboard-ref)] (mx/doseq [item (mx/react clipboard-ref)]
[:div.clipboard-item [:div.clipboard-item {:key (str (:id item))}
{:key (str (:id item)) [:span.clipboard-icon {} ^:inline i/box]
:on-click (partial on-paste item)} [:span {} ^String (str "Copied (" (dt/timeago (:created-at item)) ")")]])]
[:span.clipboard-icon i/box] [:a.close {:href "#"} ^:inline i/close]]))
[:span (str "Copied (" (dt/timeago (:created-at item)) ")")]])]
[:a.close {:href "#" :on-click on-close} i/close]]))
(defmethod lbx/render-lightbox :clipboard (defmethod lbx/render-lightbox :clipboard
[_] [_]

View file

@ -21,7 +21,7 @@
[uxbox.util.data :refer (read-string)] [uxbox.util.data :refer (read-string)]
[uxbox.util.color :refer (hex->rgb)] [uxbox.util.color :refer (hex->rgb)]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
(defn- get-selected-collection (defn- get-selected-collection
[local collections] [local collections]

View file

@ -19,7 +19,7 @@
[uxbox.main.ui.colorpicker :as cp] [uxbox.main.ui.colorpicker :as cp]
[uxbox.main.ui.workspace.recent-colors :refer [recent-colors]] [uxbox.main.ui.workspace.recent-colors :refer [recent-colors]]
[uxbox.util.router :as rt] [uxbox.util.router :as rt]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.data :refer [parse-int parse-float read-string]])) [uxbox.util.data :refer [parse-int parse-float read-string]]))

View file

@ -20,7 +20,7 @@
[uxbox.util.data :refer (read-string)] [uxbox.util.data :refer (read-string)]
[uxbox.util.time :as dt] [uxbox.util.time :as dt]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.zip :as zip])) [uxbox.util.zip :as zip]))
;; --- Refs ;; --- Refs

View file

@ -9,7 +9,7 @@
(:require [beicon.core :as rx] (:require [beicon.core :as rx]
[potok.core :as ptk] [potok.core :as ptk]
[lentes.core :as l] [lentes.core :as l]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.main.store :as st] [uxbox.main.store :as st]
[uxbox.main.constants :as c] [uxbox.main.constants :as c]
[uxbox.main.refs :as refs] [uxbox.main.refs :as refs]

View file

@ -9,7 +9,7 @@
(:require [cuerdas.core :as str] (:require [cuerdas.core :as str]
[uxbox.main.constants :as c] [uxbox.main.constants :as c]
[uxbox.main.refs :as refs] [uxbox.main.refs :as refs]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
;; --- Grid (Component) ;; --- Grid (Component)

View file

@ -24,7 +24,7 @@
[uxbox.util.data :refer [index-of]] [uxbox.util.data :refer [index-of]]
[uxbox.util.geom.point :as gpt] [uxbox.util.geom.point :as gpt]
[uxbox.util.math :as mth] [uxbox.util.math :as mth]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
;; --- Zoom Widget ;; --- Zoom Widget

View file

@ -18,7 +18,7 @@
[uxbox.main.ui.lightbox :as lbx] [uxbox.main.ui.lightbox :as lbx]
[uxbox.util.data :refer [read-string jscoll->vec]] [uxbox.util.data :refer [read-string jscoll->vec]]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.uuid :as uuid])) [uxbox.util.uuid :as uuid]))
;; --- Refs ;; --- Refs

View file

@ -12,7 +12,7 @@
[uxbox.main.refs :as refs] [uxbox.main.refs :as refs]
[uxbox.main.data.workspace :as dw] [uxbox.main.data.workspace :as dw]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.i18n :refer (tr)])) [uxbox.util.i18n :refer (tr)]))

View file

@ -16,7 +16,7 @@
[uxbox.main.store :as st] [uxbox.main.store :as st]
[uxbox.main.user-events :as uev] [uxbox.main.user-events :as uev]
[uxbox.util.math :as mth] [uxbox.util.math :as mth]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.geom.point :as gpt] [uxbox.util.geom.point :as gpt]
[uxbox.util.dom :as dom])) [uxbox.util.dom :as dom]))

View file

@ -13,7 +13,7 @@
[uxbox.main.constants :as c] [uxbox.main.constants :as c]
[uxbox.main.refs :as refs] [uxbox.main.refs :as refs]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
;; --- Constants & Helpers ;; --- Constants & Helpers

View file

@ -10,7 +10,7 @@
(:require [beicon.core :as rx] (:require [beicon.core :as rx]
[potok.core :as ptk] [potok.core :as ptk]
[uxbox.main.refs :as refs] [uxbox.main.refs :as refs]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.geom.point :as gpt])) [uxbox.util.geom.point :as gpt]))

View file

@ -13,7 +13,7 @@
[uxbox.main.ui.workspace.sidebar.history :refer [history-toolbox]] [uxbox.main.ui.workspace.sidebar.history :refer [history-toolbox]]
[uxbox.main.ui.workspace.sidebar.icons :refer [icons-toolbox]] [uxbox.main.ui.workspace.sidebar.icons :refer [icons-toolbox]]
[uxbox.main.ui.workspace.sidebar.drawtools :refer [draw-toolbox]] [uxbox.main.ui.workspace.sidebar.drawtools :refer [draw-toolbox]]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
;; --- Left Sidebar (Component) ;; --- Left Sidebar (Component)

View file

@ -19,7 +19,7 @@
[uxbox.util.i18n :refer (tr)] [uxbox.util.i18n :refer (tr)]
[uxbox.util.router :as r] [uxbox.util.router :as r]
[uxbox.util.data :refer (read-string)] [uxbox.util.data :refer (read-string)]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.dom :as dom])) [uxbox.util.dom :as dom]))
;; --- Refs ;; --- Refs

View file

@ -15,7 +15,7 @@
[uxbox.util.data :refer [read-string]] [uxbox.util.data :refer [read-string]]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.i18n :refer [tr]] [uxbox.util.i18n :refer [tr]]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.router :as r] [uxbox.util.router :as r]
[uxbox.util.time :as dt])) [uxbox.util.time :as dt]))

View file

@ -16,7 +16,7 @@
[uxbox.main.ui.shapes.icon :as icon] [uxbox.main.ui.shapes.icon :as icon]
[uxbox.main.ui.dashboard.icons :as icons] [uxbox.main.ui.dashboard.icons :as icons]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.data :refer (read-string)])) [uxbox.util.data :refer (read-string)]))

View file

@ -19,7 +19,7 @@
[uxbox.main.ui.keyboard :as kbd] [uxbox.main.ui.keyboard :as kbd]
[uxbox.util.data :refer (read-string classnames)] [uxbox.util.data :refer (read-string classnames)]
[uxbox.util.router :as r] [uxbox.util.router :as r]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.dom.dnd :as dnd] [uxbox.util.dom.dnd :as dnd]
[uxbox.util.dom :as dom]) [uxbox.util.dom :as dom])
(:import goog.events.EventType)) (:import goog.events.EventType))

View file

@ -28,7 +28,7 @@
[uxbox.main.geom :as geom] [uxbox.main.geom :as geom]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.data :as data] [uxbox.util.data :as data]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
;; --- Constants ;; --- Constants

View file

@ -16,7 +16,7 @@
[uxbox.main.data.workspace :as udw] [uxbox.main.data.workspace :as udw]
[uxbox.main.data.shapes :as uds] [uxbox.main.data.shapes :as uds]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.main.geom :as geom] [uxbox.main.geom :as geom]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.geom.point :as gpt] [uxbox.util.geom.point :as gpt]

View file

@ -14,7 +14,7 @@
[uxbox.main.data.shapes :as uds] [uxbox.main.data.shapes :as uds]
[uxbox.main.data.lightbox :as udl] [uxbox.main.data.lightbox :as udl]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.data :refer (parse-int parse-float read-string)] [uxbox.util.data :refer (parse-int parse-float read-string)]
[uxbox.util.spec :refer (color?)])) [uxbox.util.spec :refer (color?)]))

View file

@ -6,25 +6,24 @@
;; Copyright (c) 2015-2016 Juan de la Cruz <delacruzgarciajuan@gmail.com> ;; Copyright (c) 2015-2016 Juan de la Cruz <delacruzgarciajuan@gmail.com>
(ns uxbox.main.ui.workspace.sidebar.options.icon-measures (ns uxbox.main.ui.workspace.sidebar.options.icon-measures
(:require [sablono.core :as html :refer-macros [html]] (:require [lentes.core :as l]
[rum.core :as rum]
[lentes.core :as l]
[uxbox.util.i18n :refer (tr)]
[uxbox.util.router :as r]
[potok.core :as ptk] [potok.core :as ptk]
[uxbox.builtins.icons :as i]
[uxbox.util.i18n :refer [tr]]
[uxbox.util.router :as r]
[uxbox.main.store :as st] [uxbox.main.store :as st]
[uxbox.main.data.workspace :as udw] [uxbox.main.data.workspace :as udw]
[uxbox.main.data.shapes :as uds] [uxbox.main.data.shapes :as uds]
[uxbox.builtins.icons :as i]
[uxbox.util.mixins :as mx :include-macros true]
[uxbox.main.geom :as geom] [uxbox.main.geom :as geom]
[rumext.core :as mx :include-macros true]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.geom.point :as gpt] [uxbox.util.geom.point :as gpt]
[uxbox.util.data :refer (parse-int parse-float read-string)] [uxbox.util.data :refer [parse-int parse-float read-string]]
[uxbox.util.math :refer (precision-or-0)])) [uxbox.util.math :refer [precision-or-0]]))
(defn- icon-measures-menu-render (mx/defc icon-measures-menu
[own menu shape] {:mixins [mx/static]}
[menu shape]
(letfn [(on-size-change [attr event] (letfn [(on-size-change [attr event]
(let [value (dom/event->value event) (let [value (dom/event->value event)
value (parse-int value 0) value (parse-int value 0)
@ -47,7 +46,6 @@
(st/emit! (uds/unlock-proportions (:id shape))) (st/emit! (uds/unlock-proportions (:id shape)))
(st/emit! (uds/lock-proportions (:id shape)))))] (st/emit! (uds/lock-proportions (:id shape)))))]
(let [size (geom/size shape)] (let [size (geom/size shape)]
(html
[:div.element-set {:key (str (:id menu))} [:div.element-set {:key (str (:id menu))}
[:div.element-set-title (:name menu)] [:div.element-set-title (:name menu)]
[:div.element-set-content [:div.element-set-content
@ -109,10 +107,4 @@
}]] }]]
[:input.input-text [:input.input-text
{:style {:visibility "hidden"}}] {:style {:visibility "hidden"}}]
]]])))) ]]])))
(def icon-measures-menu
(mx/component
{:render icon-measures-menu-render
:name "icon-measures-menu"
:mixins [mx/static]}))

View file

@ -19,7 +19,7 @@
[uxbox.util.geom.point :as gpt] [uxbox.util.geom.point :as gpt]
[uxbox.util.data :refer (parse-int parse-float read-string)] [uxbox.util.data :refer (parse-int parse-float read-string)]
[uxbox.util.math :refer (precision-or-0)] [uxbox.util.math :refer (precision-or-0)]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
(mx/defc image-measures-menu (mx/defc image-measures-menu
{:mixins [mx/static]} {:mixins [mx/static]}

View file

@ -19,7 +19,7 @@
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.data :refer [read-string]] [uxbox.util.data :refer [read-string]]
[uxbox.util.spec :refer [color?]] [uxbox.util.spec :refer [color?]]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
;; --- Helpers ;; --- Helpers
@ -442,8 +442,7 @@
(when (or (not= (:animation form :none) :none) (when (or (not= (:animation form :none) :none)
(and (only-easing? (:action form)) (and (only-easing? (:action form))
(:element form))) (:element form)))
(mx/concat (list (easing-input form-ref)
(easing-input form-ref)
(duration-input form-ref))) (duration-input form-ref)))
])) ]))

View file

@ -18,7 +18,7 @@
[uxbox.main.data.lightbox :as udl] [uxbox.main.data.lightbox :as udl]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.main.ui.workspace.colorpicker] [uxbox.main.ui.workspace.colorpicker]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.data :refer [parse-int]] [uxbox.util.data :refer [parse-int]]
[uxbox.util.spec :refer [color?]] [uxbox.util.spec :refer [color?]]
[uxbox.util.dom :as dom])) [uxbox.util.dom :as dom]))

View file

@ -14,7 +14,7 @@
[uxbox.main.data.workspace :as udw] [uxbox.main.data.workspace :as udw]
[uxbox.main.data.shapes :as uds] [uxbox.main.data.shapes :as uds]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.main.geom :as geom] [uxbox.main.geom :as geom]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.geom.point :as gpt] [uxbox.util.geom.point :as gpt]

View file

@ -14,7 +14,7 @@
[uxbox.main.data.shapes :as uds] [uxbox.main.data.shapes :as uds]
[uxbox.main.data.lightbox :as udl] [uxbox.main.data.lightbox :as udl]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.data :refer (parse-int parse-float read-string)] [uxbox.util.data :refer (parse-int parse-float read-string)]
[uxbox.util.math :refer (precision-or-0)] [uxbox.util.math :refer (precision-or-0)]

View file

@ -15,7 +15,7 @@
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.util.i18n :refer (tr)] [uxbox.util.i18n :refer (tr)]
[uxbox.util.router :as r] [uxbox.util.router :as r]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.math :refer (precision-or-0)] [uxbox.util.math :refer (precision-or-0)]
[uxbox.util.data :refer (parse-int [uxbox.util.data :refer (parse-int

View file

@ -22,7 +22,7 @@
[uxbox.util.data :refer [classnames]] [uxbox.util.data :refer [classnames]]
[uxbox.util.dom.dnd :as dnd] [uxbox.util.dom.dnd :as dnd]
[uxbox.util.dom :as dom] [uxbox.util.dom :as dom]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
(mx/defcs page-item (mx/defcs page-item
{:mixins [(mx/local) mx/static mx/reactive]} {:mixins [(mx/local) mx/static mx/reactive]}

View file

@ -19,7 +19,7 @@
[uxbox.util.forms :as fm] [uxbox.util.forms :as fm]
[uxbox.util.i18n :refer [tr]] [uxbox.util.i18n :refer [tr]]
[uxbox.util.router :as r] [uxbox.util.router :as r]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
(def form-data (fm/focus-data :workspace-page-form st/state)) (def form-data (fm/focus-data :workspace-page-form st/state))

View file

@ -10,7 +10,7 @@
[lentes.core :as l] [lentes.core :as l]
[beicon.core :as rx] [beicon.core :as rx]
[potok.core :as ptk] [potok.core :as ptk]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.i18n :refer [tr]])) [uxbox.util.i18n :refer [tr]]))
;; --- Form Validation Api ;; --- Form Validation Api

View file

@ -12,7 +12,7 @@
[potok.core :as ptk] [potok.core :as ptk]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.util.timers :as ts] [uxbox.util.timers :as ts]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.data :refer [classnames]] [uxbox.util.data :refer [classnames]]
[uxbox.util.dom :as dom])) [uxbox.util.dom :as dom]))

View file

@ -1,53 +0,0 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) 2016-2017 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.util.mixins
(:require [rum.core :as rum]
[sablono.compiler :as s]))
(defn- parse-defc
[args]
(loop [r {}
s 0
v (first args)
n (rest args)]
(case s
0 (if (symbol? v)
(recur (assoc r :name v) (inc s) (first n) (rest n))
(throw (ex-info "Invalid" {})))
1 (if (string? v)
(recur (assoc r :doc v) (inc s) (first n) (rest n))
(recur r (inc s) v n))
2 (if (map? v)
(if-let [mixins (:mixins v)]
(let [spec (dissoc v :mixins)
mixins (if (empty? spec)
mixins
(conj mixins spec))]
(recur (assoc r :mixins mixins) (inc s) (first n) (rest n)))
(recur (assoc r :mixins [v]) (inc s) (first n) (rest n)))
(recur r (inc s) v n))
3 (if (vector? v)
(recur (assoc r :args v) (inc s) (first n) (rest n))
(throw (ex-info "Invalid" {})))
4 (let [sym (:name r)
args (:args r)
func (if (map? v)
`(fn ~args ~v ~(s/compile-html `(do ~@n)))
`(fn ~args ~(s/compile-html `(do ~@(cons v n)))))]
[func (:doc r) (:mixins r) sym]))))
(defmacro defc
[& args]
(let [[render doc mixins cname] (parse-defc args)]
`(def ~cname ~doc (uxbox.util.mixins/lazy-component rum/build-defc ~render ~mixins ~(str cname)))))
(defmacro defcs
[& args]
(let [[render doc mixins cname] (parse-defc args)]
`(def ~cname ~doc (uxbox.util.mixins/lazy-component rum/build-defcs ~render ~mixins ~(str cname)))))

View file

@ -1,59 +0,0 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
(ns uxbox.util.mixins
(:refer-clojure :exclude [concat])
(:require [sablono.core :refer-macros [html]]
[sablono.server :as server]
[rum.core :as rum]
[lentes.core :as l]
[goog.dom.forms :as gforms]))
(extend-type cljs.core.UUID
INamed
(-name [this] (str this))
(-namespace [_] ""))
(defn component
[{:keys [render] :as spec}]
{:pre [(ifn? render)]}
(let [name (or (:name spec) (str (gensym "rum-")))
mixins (or (:mixins spec) [])
spec (dissoc spec :name :mixins :render)
render' (fn [state]
[(apply render state (:rum/args state)) state])
mixins (conj mixins spec)]
(rum/build-ctor render' mixins name)))
(defn concat
[& elements]
(html
(for [[i element] (map-indexed vector elements)]
(rum/with-key element (str i)))))
(defn local
([]
(rum/local {} :rum/local))
([initial]
(rum/local initial :rum/local))
([initial key]
(rum/local initial key)))
(defn lazy-component
[builder render mixins display-name]
(let [ctor (delay (builder render mixins display-name))]
(fn [& args]
(apply @ctor args))))
(def mount rum/mount)
(def static rum/static)
(def ref-node rum/ref-node)
(def dom-node rum/dom-node)
(def react rum/react)
(def reactive rum/reactive)
(def with-key rum/with-key)
(def render-html server/render)
(def render-static-html server/render-static)

View file

@ -16,7 +16,7 @@
[uxbox.util.i18n :refer [tr]] [uxbox.util.i18n :refer [tr]]
[uxbox.util.data :refer [parse-int]] [uxbox.util.data :refer [parse-int]]
[uxbox.util.messages :as uum] [uxbox.util.messages :as uum]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.dom :as dom])) [uxbox.util.dom :as dom]))

View file

@ -7,7 +7,7 @@
(ns uxbox.view.ui.loader (ns uxbox.view.ui.loader
(:require [uxbox.builtins.icons :as i] (:require [uxbox.builtins.icons :as i]
[uxbox.view.store :as st] [uxbox.view.store :as st]
[uxbox.util.mixins :as mx :include-macros true])) [rumext.core :as mx :include-macros true]))
;; --- Component ;; --- Component

View file

@ -2,22 +2,13 @@
;; License, v. 2.0. If a copy of the MPL was not distributed with this ;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/. ;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;; ;;
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz> ;; Copyright (c) 2016-2017 Andrey Antukh <niwi@niwi.nz>
;; Copyright (c) 2016 Juan de la Cruz <delacruzgarciajuan@gmail.com> ;; Copyright (c) 2016-2017 Juan de la Cruz <delacruzgarciajuan@gmail.com>
(ns uxbox.view.ui.notfound (ns uxbox.view.ui.notfound
(:require [sablono.core :refer-macros [html]] (:require [rumext.core :as mx :include-macros true]))
[uxbox.util.mixins :as mx :include-macros true]))
(defn notfound-page-render (mx/defc notfound-page
[own] []
(html
[:div [:div
[:strong "Not Found"]])) [:strong "Not Found"]])
(def notfound-page
(mx/component
{:render notfound-page-render
:name "notfound-page"
:mixins [mx/static]}))

View file

@ -9,7 +9,7 @@
(:require [lentes.core :as l] (:require [lentes.core :as l]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.util.i18n :refer [tr]] [uxbox.util.i18n :refer [tr]]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.view.store :as st] [uxbox.view.store :as st]
[uxbox.view.data.viewer :as dv] [uxbox.view.data.viewer :as dv]
[uxbox.view.ui.viewer.nav :refer [nav]] [uxbox.view.ui.viewer.nav :refer [nav]]

View file

@ -6,7 +6,7 @@
;; Copyright (c) 2016-2017 Juan de la Cruz <delacruzgarciajuan@gmail.com> ;; Copyright (c) 2016-2017 Juan de la Cruz <delacruzgarciajuan@gmail.com>
(ns uxbox.view.ui.viewer.canvas (ns uxbox.view.ui.viewer.canvas
(:require [uxbox.util.mixins :as mx :include-macros true] (:require [rumext.core :as mx :include-macros true]
[uxbox.view.ui.viewer.shapes :as shapes])) [uxbox.view.ui.viewer.shapes :as shapes]))
;; --- Background (Component) ;; --- Background (Component)

View file

@ -8,7 +8,7 @@
(ns uxbox.view.ui.viewer.nav (ns uxbox.view.ui.viewer.nav
(:require [potok.core :as ptk] (:require [potok.core :as ptk]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.view.store :as st] [uxbox.view.store :as st]
[uxbox.view.data.viewer :as dv])) [uxbox.view.data.viewer :as dv]))

View file

@ -19,7 +19,7 @@
[uxbox.main.ui.shapes.path :refer [path-shape]] [uxbox.main.ui.shapes.path :refer [path-shape]]
[uxbox.main.ui.shapes.circle :refer [circle-shape]] [uxbox.main.ui.shapes.circle :refer [circle-shape]]
[uxbox.main.ui.shapes.image :refer [image-shape]] [uxbox.main.ui.shapes.image :refer [image-shape]]
[uxbox.util.mixins :as mx :include-macros true]) [rumext.core :as mx :include-macros true])
(:import goog.events.EventType)) (:import goog.events.EventType))
(def itx-flag-ref (def itx-flag-ref

View file

@ -11,7 +11,7 @@
[potok.core :as ptk] [potok.core :as ptk]
[uxbox.builtins.icons :as i] [uxbox.builtins.icons :as i]
[uxbox.util.i18n :refer [tr]] [uxbox.util.i18n :refer [tr]]
[uxbox.util.mixins :as mx :include-macros true] [rumext.core :as mx :include-macros true]
[uxbox.util.data :refer [parse-int]] [uxbox.util.data :refer [parse-int]]
[uxbox.view.data.viewer :as dv] [uxbox.view.data.viewer :as dv]
[uxbox.view.store :as st])) [uxbox.view.store :as st]))