0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-08 16:18:11 -05:00

Update rumext and adapt code to changes.

This commit is contained in:
Andrey Antukh 2019-07-21 19:10:04 +02:00
parent 14d97511e6
commit 125e7375c0
16 changed files with 58 additions and 59 deletions

View file

@ -4,7 +4,7 @@
com.cognitect/transit-cljs {:mvn/version "0.8.256"}
funcool/rumext {:git/url "https://github.com/funcool/rumext.git"
:sha "19d7a87725bdd621084dc6e5e160f57bf2534d5a"}
:sha "18739f966f12ff7aab3a9bde1fe37a5594f46b8d"}
cljsjs/react-dom-server {:mvn/version "16.8.6-0"}

View file

@ -1,6 +1,6 @@
(ns uxbox.main.ui.dashboard
(:require
[rumext.core :as mx :include-macros true]
[rumext.alpha :as mf]
[uxbox.main.ui.dashboard.header :refer [header]]
[uxbox.main.ui.dashboard.projects :as projects]
;; [uxbox.main.ui.dashboard.elements :as elements]
@ -15,9 +15,8 @@
(def images-page images/images-page)
(def colors-page colors/colors-page)
(mx/defc dashboard
(mf/defc dashboard
[props]
(prn "dashboard" props)
[:main.dashboard-main
(messages-widget)
(header)

View file

@ -41,7 +41,7 @@
;; --- Page Title
(mf/def page-title
:mixins [(mf/local) mf/static mf/reactive]
:mixins [(mf/local) mf/memo mf/reactive]
:render
(fn [{:keys [::mf/local] :as own}
@ -93,7 +93,7 @@
;; --- Nav
(mf/def nav-item
:mixins [(mf/local) mf/static]
:mixins [(mf/local) mf/memo]
:render
(fn [{:keys [::mf/local] :as own}
@ -134,7 +134,7 @@
(tr "ds.num-elements" (t/c colors))]]))))
(mf/def nav
:mixins [mf/static mf/reactive]
:mixins [mf/memo mf/reactive]
:render
(fn [own {:keys [id type] :as props}]
@ -179,7 +179,7 @@
[:span (tr "ds.color-new")]])
(mf/def grid-options-tooltip
:mixins [mf/reactive mf/static]
:mixins [mf/reactive mf/memo]
:render
(fn [own {:keys [selected on-select title]}]
@ -202,7 +202,7 @@
[:a {:on-click #(on-select % id)} name]])])))
(mf/def grid-options
:mixins [mf/static (mf/local)]
:mixins [mf/memo (mf/local)]
:render
(fn [{:keys [::mf/local] :as own}
@ -267,7 +267,7 @@
(mf/def grid-item
:key-fn :color
:mixins [mf/static]
:mixins [mf/memo]
:render
(fn [own {:keys [color selected?] :as props}]
@ -285,7 +285,7 @@
[:span.color-data (apply str "RGB " (interpose ", " (hex->rgb color)))]])))
(mf/def grid
:mixins [mf/static]
:mixins [mf/memo]
:render
(fn [own {:keys [selected ::coll] :as props}]
@ -301,7 +301,7 @@
(grid-item {:color color :selected? selected?})))]])))
(mf/def content
:mixins [mf/reactive mf/static]
:mixins [mf/reactive mf/memo]
:init
(fn [own {:keys [id] :as props}]
@ -323,7 +323,7 @@
(mf/def colors-page
:key-fn identity
:mixins #{mf/static mf/reactive}
:mixins #{mf/memo mf/reactive}
:init
(fn [own props]

View file

@ -14,7 +14,7 @@
[uxbox.main.data.projects :as dp]
[uxbox.main.store :as st]
[uxbox.main.ui.navigation :as nav]
[uxbox.main.ui.users :as ui.u]
[uxbox.main.ui.users :refer [user]]
[uxbox.util.i18n :refer (tr)]
[uxbox.util.router :as rt]))
@ -57,6 +57,6 @@
[:li {:class (when colors? "current")}
(header-link {:section :dashboard/colors
:content (tr "ds.colors")})]]
(ui.u/user)])))
[:& user]])))

View file

@ -73,7 +73,7 @@
;; --- Page Title
(mf/def page-title
:mixins [(mf/local) mf/static]
:mixins [(mf/local) mf/memo]
:render
(fn [{:keys [::mf/local] :as own} {:keys [id type] :as coll}]
@ -134,7 +134,7 @@
(mf/def nav-item
:key-fn :id
:mixins [(mf/local) mf/static mf/reactive]
:mixins [(mf/local) mf/memo mf/reactive]
:init
(fn [own {:keys [id] :as props}]
@ -180,7 +180,7 @@
(tr "ds.num-elements" (t/c num-icons))]]))))
(mf/def nav
:mixins [mf/static mf/reactive]
:mixins [mf/memo mf/reactive]
:render
(fn [own {:keys [id type] :as props}]
@ -239,7 +239,7 @@
:on-change on-file-selected}]]))
(mf/def grid-options-tooltip
:mixins [mf/reactive mf/static]
:mixins [mf/reactive mf/memo]
:render
(fn [own {:keys [selected on-select title]}]
@ -264,7 +264,7 @@
[:a {:on-click #(on-select % id)} name]])])))
(mf/def grid-options
:mixins [(mf/local) mf/static]
:mixins [(mf/local) mf/memo]
:render
(fn [{:keys [::mf/local] :as own}
@ -335,7 +335,7 @@
(mf/def grid-item
:key-fn :id
:mixins [mf/static]
:mixins [mf/memo]
:render
(fn [own {:keys [id created-at ::selected? ::edition?] :as icon}]
(letfn [(toggle-selection [event]
@ -405,7 +405,7 @@
;; --- Menu
(mf/def menu
:mixins [mf/static mf/reactive]
:mixins [mf/memo mf/reactive]
:init
(fn [own {:keys [id] :as props}]
@ -449,7 +449,7 @@
i/close]]]]))))
(mf/def content
:mixins [mf/reactive mf/static]
:mixins [mf/reactive mf/memo]
:init
(fn [own {:keys [id] :as props}]
@ -474,7 +474,7 @@
(mf/def icons-page
:key-fn identity
:mixins #{mf/static mf/reactive}
:mixins #{mf/memo mf/reactive}
:init
(fn [own props]

View file

@ -123,7 +123,7 @@
(mf/def nav-item
:key-fn :id
:mixins [(mf/local) mf/static mf/reactive]
:mixins [(mf/local) mf/memo mf/reactive]
:init
(fn [own {:keys [id] :as props}]
@ -167,7 +167,7 @@
(tr "ds.num-elements" (t/c (or num-images (mf/react (::num-images-ref own)))))]])))
(mf/def nav
:mixins [mf/static mf/reactive]
:mixins [mf/memo mf/reactive]
:render
(fn [own {:keys [id type] :as props}]
@ -209,7 +209,7 @@
;; --- Grid
(mf/def grid-form
:mixins #{mf/static}
:mixins #{mf/memo}
:init
(fn [own props]
@ -238,7 +238,7 @@
:on-change on-file-selected}]]))))
(mf/def grid-options-tooltip
:mixins [mf/reactive mf/static]
:mixins [mf/reactive mf/memo]
:render
(fn [own {:keys [selected on-select title]}]
@ -333,7 +333,7 @@
(mf/def grid-item
:key-fn :id
:mixins [mf/static]
:mixins [mf/memo]
:render
(fn [own {:keys [id created-at ::selected? ::edition?] :as image}]
@ -399,7 +399,7 @@
;; --- Menu
(mf/def menu
:mixins [mf/reactive mf/static]
:mixins [mf/reactive mf/memo]
;; :init
;; (fn [own {:keys [id] :as props}]
@ -448,7 +448,7 @@
i/close]]]]))))
(mf/def content
:mixins [mf/reactive mf/static]
:mixins [mf/reactive mf/memo]
:init
(fn [own {:keys [id] :as props}]
@ -472,7 +472,7 @@
(mf/def images-page
:key-fn identity
:mixins #{mf/static mf/reactive}
:mixins #{mf/memo mf/reactive}
:init
(fn [own props]

View file

@ -61,7 +61,7 @@
;; --- Menu (Filter & Sort)
(mf/def menu
:mixins #{mf/static mf/reactive}
:mixins #{mf/memo mf/reactive}
:init
(fn [own props]
(assoc own ::num-projects (-> (comp (l/key :projects)
@ -111,7 +111,7 @@
;; --- Grid Item Thumbnail
(mf/def grid-item-thumbnail
:mixins #{mf/static}
:mixins #{mf/memo}
:init
(fn [own project]
@ -140,7 +140,7 @@
(mf/def grid-item
:key-fn :id
:mixins #{mf/static (mf/local)}
:mixins #{mf/memo (mf/local)}
:render
(fn [{:keys [::mf/local] :as own} project]
@ -194,7 +194,7 @@
;; --- Grid
(mf/def grid
:mixins #{mf/static mf/reactive}
:mixins #{mf/memo mf/reactive}
:init
(fn [own props]
@ -222,7 +222,7 @@
;; --- Projects Page
(mf/def projects-page
:mixins [mf/static mf/reactive]
:mixins [mf/memo mf/reactive]
:init
(fn [own props]

View file

@ -247,7 +247,7 @@
:fill "transparent"}}]]))
(mf/def selection-handlers
:mixins [mf/reactive mf/static]
:mixins [mf/reactive mf/memo]
:render
(fn [own props]
(let [shapes (mf/react selected-shapes-ref)

View file

@ -66,7 +66,7 @@
(mf/def workspace
:key-fn vector
:mixins #{mf/static
:mixins #{mf/memo
mf/reactive
shortcuts-mixin}

View file

@ -37,7 +37,7 @@
;; --- Background
(mf/def background
:mixins [mf/static]
:mixins [mf/memo]
:render
(fn [own {:keys [background] :as metadata}]
[:rect
@ -49,7 +49,7 @@
;; --- Coordinates Widget
(mf/def coordinates
:mixins [mf/reactive mf/static]
:mixins [mf/reactive mf/memo]
:render
(fn [own props]
(let [zoom (mf/react refs/selected-zoom)
@ -69,7 +69,7 @@
(l/derive refs/workspace)))
(mf/def selrect
:mixins [mf/static mf/reactive]
:mixins [mf/memo mf/reactive]
:render
(fn [own props]
(when-let [rect (mf/react selrect-ref)]
@ -95,7 +95,7 @@
nil))
(mf/def cursor-tooltip
:mixins [mf/reactive mf/static]
:mixins [mf/reactive mf/memo]
:render
(fn [own tooltip]
(let [coords (mf/react refs/window-mouse-position)]
@ -109,7 +109,7 @@
;; --- Canvas
(mf/def canvas
:mixins [mf/static mf/reactive]
:mixins [mf/memo mf/reactive]
:render
(fn [own {:keys [page zoom] :as props}]
(let [{:keys [metadata id]} page

View file

@ -18,7 +18,7 @@
(declare horizontal-line)
(mf/def grid
:mixins [mf/static mf/reactive]
:mixins [mf/memo mf/reactive]
:render
(fn [own props]
(let [options (:metadata (mf/react refs/selected-page))

View file

@ -18,7 +18,7 @@
[uxbox.main.data.undo :as udu]
[uxbox.main.data.lightbox :as udl]
[uxbox.main.ui.workspace.clipboard]
[uxbox.main.ui.users :as ui.u]
[uxbox.main.ui.users :refer [user]]
[uxbox.main.ui.navigation :as nav]
[uxbox.util.router :as r]
[uxbox.util.data :refer [index-of]]
@ -146,4 +146,4 @@
:on-click #(on-view-clicked % project page)}
i/play]]
(zoom-widget)]
(ui.u/user)]))
[:& user]]))

View file

@ -105,7 +105,7 @@
;; --- Horizontal Rule Ticks (Component)
(mf/def horizontal-rule-ticks
:mixins #{mf/static}
:mixins #{mf/memo}
:render
(fn [own zoom]
(let [zoom (or zoom 1)
@ -118,7 +118,7 @@
;; --- Vertical Rule Ticks (Component)
(mf/def vertical-rule-ticks
:mixins #{mf/static}
:mixins #{mf/memo}
:render
(fn [own zoom]
(let [zoom (or zoom 1)
@ -131,7 +131,7 @@
;; --- Horizontal Rule (Component)
(mf/def horizontal-rule
:mixins #{mf/static mf/reactive}
:mixins #{mf/memo mf/reactive}
:render
(fn [own props]
(let [scroll (mf/react refs/workspace-scroll)
@ -149,7 +149,7 @@
;; --- Vertical Rule (Component)
(mf/def vertical-rule
:mixins #{mf/static mf/reactive}
:mixins #{mf/memo mf/reactive}
:render
(fn [own props]
(let [scroll (mf/react refs/workspace-scroll)

View file

@ -22,7 +22,7 @@
;; --- History Item (Component)
(mf/def history-item
:mixins [mf/static]
:mixins [mf/memo]
:key-fn :id
:render
(fn [own {:keys [::selected] :as item}]
@ -47,7 +47,7 @@
;; --- History List (Component)
(mf/def history-list
:mixins [mf/static mf/reactive]
:mixins [mf/memo mf/reactive]
:render
(fn [own {:keys [selected items min-version] :as history}]
(let [items (reverse (sort-by :version items))
@ -65,7 +65,7 @@
;; --- History Pinned List (Component)
(mf/def history-pinned-list
:mixins [mf/static]
:mixins [mf/memo]
:render
(fn [own {:keys [pinned selected] :as history}]
[:ul.history-content
@ -76,7 +76,7 @@
;; --- History Toolbox (Component)
(mf/def history-toolbox
:mixins [mf/static mf/reactive]
:mixins [mf/memo mf/reactive]
:init
(fn [own page-id]
@ -119,7 +119,7 @@
;; --- History Dialog
(mf/def history-dialog
:mixins [mf/static mf/reactive]
:mixins [mf/memo mf/reactive]
:render
(fn [own]
(let [history (mf/react refs/history)

View file

@ -91,7 +91,7 @@
;; --- Shape Name (Component)
(mf/def shape-name
:mixins [mf/static (mf/local)]
:mixins [mf/memo (mf/local)]
:render
(fn [{:keys [::mf/local] :as own} {:keys [id] :as shape}]
(letfn [(on-blur [event]

View file

@ -26,7 +26,7 @@
[uxbox.util.router :as r]))
(mf/def page-item
:mixins [(mf/local) mf/static mf/reactive]
:mixins [(mf/local) mf/memo mf/reactive]
:key-fn :id
:render
@ -107,7 +107,7 @@
[:a {:on-click on-delete} i/trash])]]]))))
(mf/def sitemap-toolbox
:mixins [mf/static mf/reactive]
:mixins [mf/memo mf/reactive]
:render
(fn [own current-page-id]