mirror of
https://github.com/penpot/penpot.git
synced 2025-05-10 20:16:37 +02:00
⬆️ Upgrade to beicon2 (part1)
This commit is contained in:
parent
ecee15af5b
commit
96f5a33f5f
151 changed files with 482 additions and 433 deletions
|
@ -15,7 +15,7 @@
|
|||
:hooks
|
||||
{:analyze-call
|
||||
{app.common.data.macros/export hooks.export/export
|
||||
potok.core/reify hooks.export/potok-reify
|
||||
potok.v2.core/reify hooks.export/potok-reify
|
||||
app.util.services/defmethod hooks.export/service-defmethod
|
||||
app.common.record/defrecord hooks.export/penpot-defrecord
|
||||
app.db/with-atomic hooks.export/penpot-with-atomic
|
||||
|
|
|
@ -6,10 +6,17 @@
|
|||
org.clojure/clojure {:mvn/version "1.11.1"}
|
||||
binaryage/devtools {:mvn/version "RELEASE"}
|
||||
metosin/reitit-core {:mvn/version "0.5.18"}
|
||||
|
||||
funcool/beicon {:mvn/version "2021.07.05-1"}
|
||||
funcool/okulary {:mvn/version "2022.04.11-16"}
|
||||
funcool/potok {:mvn/version "2022.12.16-71"}
|
||||
|
||||
funcool/potok2
|
||||
{:git/tag "v2.0"
|
||||
:git/sha "2bb377b"
|
||||
:git/url "https://github.com/funcool/potok.git"}
|
||||
|
||||
funcool/beicon2
|
||||
{:git/tag "v2.0"
|
||||
:git/sha "e7135e0"
|
||||
:git/url "https://github.com/funcool/beicon.git"}
|
||||
|
||||
funcool/rumext
|
||||
{:git/tag "v2.7"
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
"@storybook/react": "^7.5.3",
|
||||
"@storybook/react-vite": "^7.5.3",
|
||||
"@storybook/testing-library": "^0.2.2",
|
||||
"@types/node": "^20.10.5",
|
||||
"animate.css": "^4.1.1",
|
||||
"autoprefixer": "^10.4.15",
|
||||
"concurrently": "^8.2.2",
|
||||
|
@ -73,6 +74,7 @@
|
|||
"sass": "^1.66.1",
|
||||
"shadow-cljs": "2.26.2",
|
||||
"storybook": "^7.5.3",
|
||||
"typescript": "^5.3.3",
|
||||
"vite": "^5.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -90,7 +92,7 @@
|
|||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-virtualized": "^9.22.3",
|
||||
"rxjs": "~7.8.1",
|
||||
"rxjs": "8.0.0-alpha.13",
|
||||
"sax": "^1.2.4",
|
||||
"source-map-support": "^0.5.21",
|
||||
"tdigest": "^0.1.2",
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
[app.util.webapi :as wapi]
|
||||
[app.util.zip :as uz]
|
||||
[app.worker.export :as e]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[cuerdas.core :as str]))
|
||||
|
||||
(defn parse-data [data]
|
||||
|
@ -55,7 +55,7 @@
|
|||
|
||||
(->> (rx/from (vals media))
|
||||
(rx/map #(assoc % :file-id file-id))
|
||||
(rx/flat-map
|
||||
(rx/merge-map
|
||||
(fn [media]
|
||||
(let [file-path (str/concat file-id "/media/" (:id media) (cm/mtype->extension (:mtype media)))
|
||||
blob (data-uri->blob (:uri media))]
|
||||
|
@ -79,38 +79,38 @@
|
|||
|
||||
render-stream
|
||||
(->> files-stream
|
||||
(rx/flat-map vals)
|
||||
(rx/flat-map e/process-pages)
|
||||
(rx/merge-map vals)
|
||||
(rx/merge-map e/process-pages)
|
||||
(rx/observe-on :async)
|
||||
(rx/flat-map e/get-page-data)
|
||||
(rx/merge-map e/get-page-data)
|
||||
(rx/share))
|
||||
|
||||
colors-stream
|
||||
(->> files-stream
|
||||
(rx/flat-map vals)
|
||||
(rx/merge-map vals)
|
||||
(rx/map #(vector (:id %) (get-in % [:data :colors])))
|
||||
(rx/filter #(d/not-empty? (second %)))
|
||||
(rx/map e/parse-library-color))
|
||||
|
||||
typographies-stream
|
||||
(->> files-stream
|
||||
(rx/flat-map vals)
|
||||
(rx/merge-map vals)
|
||||
(rx/map #(vector (:id %) (get-in % [:data :typographies])))
|
||||
(rx/filter #(d/not-empty? (second %)))
|
||||
(rx/map e/parse-library-typographies))
|
||||
|
||||
media-stream
|
||||
(->> files-stream
|
||||
(rx/flat-map vals)
|
||||
(rx/merge-map vals)
|
||||
(rx/map #(vector (:id %) (get-in % [:data :media])))
|
||||
(rx/filter #(d/not-empty? (second %)))
|
||||
(rx/flat-map parse-library-media))
|
||||
(rx/merge-map parse-library-media))
|
||||
|
||||
components-stream
|
||||
(->> files-stream
|
||||
(rx/flat-map vals)
|
||||
(rx/merge-map vals)
|
||||
(rx/filter #(d/not-empty? (ctkl/components-seq (:data %))))
|
||||
(rx/flat-map e/parse-library-components))
|
||||
(rx/merge-map e/parse-library-components))
|
||||
|
||||
pages-stream
|
||||
(->> render-stream
|
||||
|
@ -132,7 +132,7 @@
|
|||
typographies-stream)
|
||||
(rx/reduce conj [])
|
||||
(rx/with-latest-from files-stream)
|
||||
(rx/flat-map (fn [[data _]]
|
||||
(rx/merge-map (fn [[data _]]
|
||||
(->> (uz/compress-files data)
|
||||
(rx/map #(vector file %)))))))))
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
(:require
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.render :as r]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[promesa.core :as p]))
|
||||
|
||||
(defn render-page-export
|
||||
|
@ -22,7 +22,7 @@
|
|||
(fn [resolve reject]
|
||||
(->> (r/render-page data)
|
||||
(rx/take 1)
|
||||
(rx/subs resolve reject))) )))
|
||||
(rx/subs! resolve reject))) )))
|
||||
|
||||
(defn exports []
|
||||
#js {:renderPage render-page-export})
|
||||
|
|
|
@ -28,10 +28,10 @@
|
|||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n]
|
||||
[app.util.theme :as theme]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[debug]
|
||||
[features]
|
||||
[potok.core :as ptk]
|
||||
[potok.v2.core :as ptk]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(log/setup! {:app :info})
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
(:require
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.transit :as t]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defrecord BroadcastMessage [id type data]
|
||||
cljs.core/IDeref
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
[app.common.uuid :as uuid]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[app.main.repo :as rp]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(def ^:private schema:comment-thread
|
||||
(sm/define
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
[app.main.features :as features]
|
||||
[app.main.repo :as rp]
|
||||
[app.util.i18n :refer [tr]]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; SHARE LINK
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
[app.util.time :as dt]
|
||||
[app.util.timers :as tm]
|
||||
[app.util.webapi :as wapi]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[clojure.set :as set]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(log/set-level! :warn)
|
||||
|
||||
|
@ -419,7 +419,7 @@
|
|||
(rx/map di/validate-file)
|
||||
(rx/map prepare)
|
||||
(rx/mapcat #(rp/cmd! :update-team-photo %))
|
||||
(rx/do on-success)
|
||||
(rx/tap on-success)
|
||||
(rx/map du/fetch-teams)
|
||||
(rx/catch on-error))))))
|
||||
|
||||
|
|
|
@ -17,9 +17,10 @@
|
|||
[app.util.object :as obj]
|
||||
[app.util.storage :refer [storage]]
|
||||
[app.util.time :as dt]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[beicon.v2.operators :as rxo]
|
||||
[lambdaisland.uri :as u]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(l/set-level! :info)
|
||||
|
||||
|
@ -238,7 +239,7 @@
|
|||
profile (->> (rx/from-atom storage {:emit-current-value? true})
|
||||
(rx/map :profile)
|
||||
(rx/map :id)
|
||||
(rx/dedupe))]
|
||||
(rx/pipe (rxo/distinct-contiguous)))]
|
||||
|
||||
(l/debug :hint "event instrumentation initialized")
|
||||
|
||||
|
@ -259,12 +260,12 @@
|
|||
(l/debug :hint "events chunk persisted" :total (count chunk))))
|
||||
(rx/map (constantly chunk))))))
|
||||
(rx/take-until stoper)
|
||||
(rx/subs (fn [chunk]
|
||||
(swap! buffer remove-from-buffer (count chunk)))
|
||||
(fn [cause]
|
||||
(l/error :hint "unexpected error on audit persistence" :cause cause))
|
||||
(fn []
|
||||
(l/debug :hint "audit persistence terminated"))))
|
||||
(rx/subs! (fn [chunk]
|
||||
(swap! buffer remove-from-buffer (count chunk)))
|
||||
(fn [cause]
|
||||
(l/error :hint "unexpected error on audit persistence" :cause cause))
|
||||
(fn []
|
||||
(l/debug :hint "audit persistence terminated"))))
|
||||
|
||||
(->> stream
|
||||
(rx/with-latest-from profile)
|
||||
|
@ -290,10 +291,10 @@
|
|||
|
||||
(rx/switch-map #(rx/timer (inst-ms session-timeout)))
|
||||
(rx/take-until stoper)
|
||||
(rx/subs (fn [_]
|
||||
(l/debug :hint "session reinitialized")
|
||||
(reset! session nil))
|
||||
(fn [cause]
|
||||
(l/error :hint "error on event batching stream" :cause cause))
|
||||
(fn []
|
||||
(l/debug :hitn "events batching stream terminated")))))))))
|
||||
(rx/subs! (fn [_]
|
||||
(l/debug :hint "session reinitialized")
|
||||
(reset! session nil))
|
||||
(fn [cause]
|
||||
(l/error :hint "error on event batching stream" :cause cause))
|
||||
(fn []
|
||||
(l/debug :hitn "events batching stream terminated")))))))))
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
[app.util.dom :as dom]
|
||||
[app.util.time :as dt]
|
||||
[app.util.websocket :as ws]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(def default-timeout 5000)
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
[app.util.i18n :refer [tr]]
|
||||
[app.util.storage :refer [storage]]
|
||||
[app.util.webapi :as wa]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[cuerdas.core :as str]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; General purpose events & IMPL
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
[app.main.data.messages :as dm]
|
||||
[app.main.store :as st]
|
||||
[app.util.i18n :refer [tr]]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[cljs.spec.alpha :as s]
|
||||
[cuerdas.core :as str]))
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
[app.common.data :as d]
|
||||
[app.common.data.macros :as dm]
|
||||
[app.common.schema :as sm]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(declare hide)
|
||||
(declare show)
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
[app.common.uuid :as uuid]
|
||||
[app.main.store :as st]
|
||||
[cljs.core :as c]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defonce components (atom {}))
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
[app.main.refs :as refs]
|
||||
[app.util.code-gen :as cg]
|
||||
[app.util.timers :as ts]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[clojure.set :as set]
|
||||
[cuerdas.core :as str]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(def style-type "css")
|
||||
(def markup-type "html")
|
||||
|
@ -80,7 +80,7 @@
|
|||
(rx/merge-map fonts/fetch-font-css)
|
||||
(rx/reduce conj [])
|
||||
(rx/map #(str/join "\n" %))
|
||||
(rx/subs
|
||||
(rx/subs!
|
||||
(fn [fontfaces-css]
|
||||
(let [style-code
|
||||
(dm/str
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
[app.common.schema :as sm]
|
||||
[app.config :as cf]
|
||||
[cuerdas.core :as str]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(log/set-level! :warn)
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
[app.util.i18n :as i18n]
|
||||
[app.util.router :as rt]
|
||||
[app.util.storage :refer [storage]]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;; --- SCHEMAS
|
||||
|
||||
|
@ -434,7 +434,7 @@
|
|||
(rx/map di/validate-file)
|
||||
(rx/map prepare)
|
||||
(rx/mapcat #(rp/cmd! :update-profile-photo %))
|
||||
(rx/do on-success)
|
||||
(rx/tap on-success)
|
||||
(rx/map (constantly (fetch-profile)))
|
||||
(rx/catch on-error))))))
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
[app.main.repo :as rp]
|
||||
[app.util.globals :as ug]
|
||||
[app.util.router :as rt]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;; --- Local State Initialization
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
[app.common.uri :as u]
|
||||
[app.config :as cf]
|
||||
[app.util.websocket :as ws]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(l/set-level! :error)
|
||||
|
||||
|
|
|
@ -78,10 +78,10 @@
|
|||
[app.util.router :as rt]
|
||||
[app.util.timers :as tm]
|
||||
[app.util.webapi :as wapi]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[cljs.spec.alpha :as s]
|
||||
[cuerdas.core :as str]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(def default-workspace-local {:zoom 1})
|
||||
|
||||
|
@ -444,7 +444,7 @@
|
|||
uris (into #{} xform (wsh/lookup-page-objects state page-id))]
|
||||
|
||||
(->> (rx/from uris)
|
||||
(rx/subs #(http/fetch-data-uri % false)))))))
|
||||
(rx/subs! #(http/fetch-data-uri % false)))))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Workspace Page CRUD
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
[app.main.data.workspace.changes :as dch]
|
||||
[app.main.data.workspace.selection :as dws]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[cuerdas.core :as str]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn selected-shapes-idx
|
||||
[state]
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
[app.main.data.workspace.undo :as dwu]
|
||||
[app.main.store :as st]
|
||||
[app.main.worker :as uw]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;; Change this to :info :debug or :trace to debug this module
|
||||
(log/set-level! :warn)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
(:require
|
||||
[app.common.files.helpers :as cfh]
|
||||
[app.common.uuid :as uuid]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;; --- Shape attrs (Layers Sidebar)
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
[app.main.data.workspace.undo :as dwu]
|
||||
[app.util.color :as uc]
|
||||
[app.util.storage :refer [storage]]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;; A set of keys that are used for shared state identifiers
|
||||
(def ^:const colorpicker-selected-broadcast-key ::colorpicker-selected)
|
||||
|
@ -353,7 +353,7 @@
|
|||
;; Stream that updates the stroke/width and stops if `esc` pressed
|
||||
(->> sub
|
||||
(rx/take-until stop?)
|
||||
(rx/flat-map update-events))
|
||||
(rx/merge-map update-events))
|
||||
|
||||
;; Hide the modal if the stop event is emitted
|
||||
(->> stop?
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
[app.main.streams :as ms]
|
||||
[app.util.mouse :as mse]
|
||||
[app.util.router :as rt]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(declare handle-interrupt)
|
||||
(declare handle-comment-layer-click)
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[app.main.data.workspace.undo :as dwu]
|
||||
[app.util.router :as rt]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;; Change this to :info :debug or :trace to debug this module
|
||||
(log/set-level! :warn)
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
[app.main.data.workspace.drawing.common :as common]
|
||||
[app.main.data.workspace.drawing.curve :as curve]
|
||||
[app.main.data.workspace.path :as path]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(declare start-drawing)
|
||||
(declare handle-drawing)
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
[app.main.snap :as snap]
|
||||
[app.main.streams :as ms]
|
||||
[app.util.mouse :as mse]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn adjust-ratio
|
||||
[point initial]
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[app.main.data.workspace.undo :as dwu]
|
||||
[app.main.worker :as uw]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn clear-drawing
|
||||
[]
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
[app.main.streams :as ms]
|
||||
[app.util.mouse :as mse]
|
||||
[app.util.path.simplify-curve :as ups]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(def simplify-tolerance 0.3)
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
[app.common.types.shape.layout :as ctl]
|
||||
[app.main.data.workspace.common :as dwc]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn interrupt? [e] (= e :interrupt))
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
[app.common.geom.shapes :as gsh]
|
||||
[app.main.data.workspace.changes :as dch]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;; This event will update the file so the boolean data has a pre-generated path data
|
||||
;; to increase performance.
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
(ns app.main.data.workspace.fix-broken-shapes
|
||||
(:require
|
||||
[app.main.data.workspace.changes :as dch]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn- generate-broken-link-changes
|
||||
[attr {:keys [objects id] :as container}]
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
[app.main.data.workspace.changes :as dch]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[app.main.fonts :as fonts]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;; This event will update the file so the texts with non existing custom fonts try to be fixed.
|
||||
;; This can happen when:
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
[app.common.files.changes-builder :as pcb]
|
||||
[app.main.data.workspace.changes :as dch]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Grid
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
[app.common.geom.rect :as grc]
|
||||
[app.common.types.shape.layout :as ctl]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn hover-grid-cell
|
||||
[grid-id cell-id add-to-set]
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
[app.main.data.workspace :as dw]
|
||||
[app.main.data.workspace.common :as dwc]
|
||||
[app.main.store :as st]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Shortcuts
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
[app.main.data.workspace.selection :as dws]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[app.main.data.workspace.undo :as dwu]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn shapes-for-grouping
|
||||
[objects selected]
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
[app.common.types.page :as ctp]
|
||||
[app.main.data.workspace.changes :as dwc]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn make-update-guide [guide]
|
||||
(fn [other]
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
(:require
|
||||
[app.common.data.macros :as dm]
|
||||
[clojure.set :as set]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;; --- Manage shape's highlight status
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
[app.main.data.workspace.undo :as dwu]
|
||||
[app.main.streams :as ms]
|
||||
[app.util.mouse :as mse]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;; --- Flows
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
[app.common.math :as mth]
|
||||
[app.main.data.workspace.changes :as dch]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[cuerdas.core :as str]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;; -- Opacity ----------------------------------------------------------
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
[app.common.data.macros :as dm]
|
||||
[app.util.storage :refer [storage]]
|
||||
[clojure.set :as set]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(def valid-flags
|
||||
#{:sitemap
|
||||
|
|
|
@ -45,9 +45,9 @@
|
|||
[app.util.i18n :refer [tr]]
|
||||
[app.util.router :as rt]
|
||||
[app.util.time :as dt]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[cuerdas.core :as str]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;; Change this to :info :debug or :trace to debug this module, or :warn to reset to default
|
||||
(log/set-level! :warn)
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
[app.main.store :as st]
|
||||
[app.util.http :as http]
|
||||
[app.util.i18n :refer [tr]]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[cuerdas.core :as str]
|
||||
[potok.core :as ptk]
|
||||
[potok.v2.core :as ptk]
|
||||
[promesa.core :as p]
|
||||
[tubax.core :as tubax]))
|
||||
|
||||
|
@ -122,13 +122,13 @@
|
|||
(->> (rx/from uris)
|
||||
(rx/filter (comp not svg-url?))
|
||||
(rx/mapcat upload)
|
||||
(rx/do on-image))
|
||||
(rx/tap on-image))
|
||||
|
||||
(->> (rx/from uris)
|
||||
(rx/filter svg-url?)
|
||||
(rx/merge-map (partial fetch-svg name))
|
||||
(rx/merge-map svg->clj)
|
||||
(rx/do on-svg)))))
|
||||
(rx/tap on-svg)))))
|
||||
|
||||
(defn- process-blobs
|
||||
[{:keys [file-id local? name blobs force-media on-image on-svg]}]
|
||||
|
@ -154,14 +154,14 @@
|
|||
(rx/filter (comp not svg-blob?))
|
||||
(rx/map prepare-blob)
|
||||
(rx/mapcat #(rp/cmd! :upload-file-media-object %))
|
||||
(rx/do on-image))
|
||||
(rx/tap on-image))
|
||||
|
||||
(->> (rx/from blobs)
|
||||
(rx/map dmm/validate-file)
|
||||
(rx/filter svg-blob?)
|
||||
(rx/merge-map extract-content)
|
||||
(rx/merge-map svg->clj)
|
||||
(rx/do on-svg)))))
|
||||
(rx/tap on-svg)))))
|
||||
|
||||
(defn handle-media-error [error on-error]
|
||||
(if (ex/ex-info? error)
|
||||
|
@ -278,7 +278,7 @@
|
|||
(rx/map dmm/validate-file)
|
||||
(rx/map prepare)
|
||||
(rx/mapcat #(rp/cmd! :upload-file-media-object %))
|
||||
(rx/do on-upload-success)
|
||||
(rx/tap on-upload-success)
|
||||
(rx/catch handle-media-error))))))
|
||||
|
||||
;; --- Upload File Media objects
|
||||
|
@ -423,7 +423,7 @@
|
|||
:timeout nil
|
||||
:tag :media-loading}))
|
||||
(->> (rp/cmd! :clone-file-media-object params)
|
||||
(rx/do on-success)
|
||||
(rx/tap on-success)
|
||||
(rx/catch on-error)
|
||||
(rx/finalize #(st/emit! (msg/hide-tag :media-loading)))))))))
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
[app.main.data.workspace.guides :as-alias dwg]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[app.main.data.workspace.undo :as dwu]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;; -- temporary modifiers -------------------------------------------
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
[app.util.mouse :as mse]
|
||||
[app.util.object :as obj]
|
||||
[app.util.time :as dt]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[clojure.set :as set]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(declare process-message)
|
||||
(declare handle-presence)
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
[app.main.data.workspace.path.helpers :as helpers]
|
||||
[app.main.data.workspace.path.state :as st]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn generate-path-changes
|
||||
"Generates changes to update the new content of the shape"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
(:require
|
||||
[app.common.schema :as sm]
|
||||
[app.main.data.workspace.path.state :as st]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(def valid-commands
|
||||
#{:move-to
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
[app.main.data.workspace.path.undo :as undo]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[app.util.mouse :as mse]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(declare change-edit-mode)
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
[app.main.streams :as ms]
|
||||
[app.util.mouse :as mse]
|
||||
[app.util.path.tools :as upt]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn modify-handler [id index prefix dx dy match-opposite?]
|
||||
(ptk/reify ::modify-handler
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
[app.common.svg.path.subpath :as ups]
|
||||
[app.main.data.workspace.path.common :as common]
|
||||
[app.util.mouse :as mse]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn end-path-event?
|
||||
[event]
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
[app.main.data.workspace.path.state :as st]
|
||||
[app.main.streams :as ms]
|
||||
[app.util.mouse :as mse]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn path-pointer-enter [position]
|
||||
(ptk/reify ::path-pointer-enter
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
[app.common.types.container :as ctn]
|
||||
[app.main.data.workspace.changes :as dch]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn convert-selected-to-path []
|
||||
(ptk/reify ::convert-selected-to-path
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
[app.main.data.workspace :as dw]
|
||||
[app.main.data.workspace.path :as drp]
|
||||
[app.main.store :as st]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Shortcuts
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
[app.main.store :as st]
|
||||
[app.main.streams :as ms]
|
||||
[app.util.mouse :as mse]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[okulary.core :as l]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defonce drag-threshold 5)
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
[app.main.data.workspace.path.state :as st]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[app.util.path.tools :as upt]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn process-path-tool
|
||||
"Generic function that executes path transformations with the content and selected nodes"
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
[app.main.data.workspace.path.changes :as changes]
|
||||
[app.main.data.workspace.path.state :as st]
|
||||
[app.main.store :as store]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[okulary.core :as l]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn undo-event?
|
||||
[event]
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
[app.main.store :as st]
|
||||
[app.util.router :as rt]
|
||||
[app.util.time :as dt]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[okulary.core :as l]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(log/set-level! :info)
|
||||
|
||||
|
|
|
@ -36,10 +36,11 @@
|
|||
[app.main.streams :as ms]
|
||||
[app.main.worker :as uw]
|
||||
[app.util.mouse :as mse]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[beicon.v2.operators :as rxo]
|
||||
[clojure.set :as set]
|
||||
[linked.set :as lks]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn interrupt?
|
||||
[e]
|
||||
|
@ -111,8 +112,8 @@
|
|||
|
||||
(->> selrect-stream
|
||||
(rx/buffer-time 100)
|
||||
(rx/map #(last %))
|
||||
(rx/dedupe)
|
||||
(rx/map last)
|
||||
(rx/pipe (rxo/distinct-contiguous))
|
||||
(rx/map #(select-shapes-by-current-selrect preserve? ignore-groups?))))
|
||||
|
||||
(->> (rx/of (update-selrect nil))
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
[app.main.data.workspace.shapes :as dws]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[app.main.data.workspace.undo :as dwu]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(def layout-keys
|
||||
[:layout
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[app.main.data.workspace.undo :as dwu]
|
||||
[app.main.features :as features]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn add-shape
|
||||
([shape]
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
[app.common.data :as d]
|
||||
[app.main.data.workspace.common :as-alias dwc]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn interrupt? [e] (or (= e :interrupt) (= e ::interrupt)))
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
[app.main.data.workspace.undo :as dwu]
|
||||
[app.main.repo :as rp]
|
||||
[app.util.webapi :as wapi]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[cuerdas.core :as str]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn extract-name [href]
|
||||
(let [query-idx (str/last-index-of href "?")
|
||||
|
|
|
@ -29,9 +29,9 @@
|
|||
[app.util.router :as rt]
|
||||
[app.util.text-editor :as ted]
|
||||
[app.util.timers :as ts]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[cuerdas.core :as str]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;; -- Attrs
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
[app.util.time :as tp]
|
||||
[app.util.timers :as tm]
|
||||
[app.util.webapi :as wapi]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(l/set-level! :info)
|
||||
|
||||
|
@ -246,7 +246,7 @@
|
|||
(rx/filter dch/commit-changes?)
|
||||
(rx/observe-on :async)
|
||||
(rx/with-latest-from workspace-data-s)
|
||||
(rx/flat-map (partial extract-frame-changes page-id))
|
||||
(rx/merge-map (partial extract-frame-changes page-id))
|
||||
(rx/tap #(l/trc :hint "inconming change" :origin "local" :frame-id (dm/str %))))
|
||||
|
||||
;; NOTIFICATIONS CHANGES
|
||||
|
@ -254,7 +254,7 @@
|
|||
(rx/filter (ptk/type? ::wnt/handle-file-change))
|
||||
(rx/observe-on :async)
|
||||
(rx/with-latest-from workspace-data-s)
|
||||
(rx/flat-map (partial extract-frame-changes page-id))
|
||||
(rx/merge-map (partial extract-frame-changes page-id))
|
||||
(rx/tap #(l/trc :hint "inconming change" :origin "notifications" :frame-id (dm/str %))))
|
||||
|
||||
;; PERSISTENCE CHANGES
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
[app.util.dom :as dom]
|
||||
[app.util.keyboard :as kbd]
|
||||
[app.util.mouse :as mse]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;; -- Helpers --------------------------------------------------------
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
[app.common.logging :as log]
|
||||
[app.common.schema :as sm]
|
||||
[app.util.time :as dt]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(def discard-transaction-time-millis (* 20 1000))
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
[app.common.math :as mth]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[app.util.mouse :as mse]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn initialize-viewport
|
||||
[{:keys [width height] :as size}]
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[app.main.streams :as ms]
|
||||
[app.util.mouse :as mse]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn- impl-update-zoom
|
||||
[{:keys [vbox] :as local} center zoom]
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
[app.util.storage :refer [storage]]
|
||||
[app.util.timers :as ts]
|
||||
[cuerdas.core :as str]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(defn- print-data!
|
||||
[data]
|
||||
|
|
|
@ -12,11 +12,11 @@
|
|||
[app.common.logging :as log]
|
||||
[app.config :as cf]
|
||||
[app.main.store :as st]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[clojure.set :as set]
|
||||
[cuerdas.core :as str]
|
||||
[okulary.core :as l]
|
||||
[potok.core :as ptk]
|
||||
[potok.v2.core :as ptk]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(log/set-level! :trace)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
(:require
|
||||
[app.common.transit :as t]
|
||||
[app.main.repo :as rp]
|
||||
[beicon.core :as rx]))
|
||||
[beicon.v2.core :as rx]))
|
||||
|
||||
(defn resolve-file
|
||||
[{:keys [id data] :as file}]
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
[app.util.globals :as globals]
|
||||
[app.util.http :as http]
|
||||
[app.util.object :as obj]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[clojure.set :as set]
|
||||
[cuerdas.core :as str]
|
||||
[lambdaisland.uri :as u]
|
||||
|
@ -144,7 +144,7 @@
|
|||
(->> (fetch-gfont-css url)
|
||||
(rx/map process-gfont-css)
|
||||
(rx/tap #(on-loaded id))
|
||||
(rx/subs (partial add-font-css! id)))
|
||||
(rx/subs! (partial add-font-css! id)))
|
||||
nil)))
|
||||
|
||||
;; --- LOADER: CUSTOM
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
[app.config :as cf]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.http :as http]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[cuerdas.core :as str]))
|
||||
|
||||
(defonce ready? false)
|
||||
|
@ -123,18 +123,18 @@
|
|||
(log/err :hint "rasterizer iframe blocked by adblocker" :origin origin :cause cause)
|
||||
(rx/of false)))
|
||||
|
||||
(rx/subs (fn [allowed?]
|
||||
(if allowed?
|
||||
(do
|
||||
(dom/append-child! js/document.body iframe)
|
||||
(set! instance iframe))
|
||||
(rx/subs! (fn [allowed?]
|
||||
(if allowed?
|
||||
(do
|
||||
(dom/append-child! js/document.body iframe)
|
||||
(set! instance iframe))
|
||||
|
||||
(let [new-origin (dm/str (assoc cf/public-uri :path "/rasterizer.html"))]
|
||||
(log/warn :hint "fallback to main domain" :origin new-origin)
|
||||
(let [new-origin (dm/str (assoc cf/public-uri :path "/rasterizer.html"))]
|
||||
(log/warn :hint "fallback to main domain" :origin new-origin)
|
||||
|
||||
(dom/set-attribute! iframe "src" new-origin)
|
||||
(dom/append-child! js/document.body iframe)
|
||||
(dom/set-attribute! iframe "src" new-origin)
|
||||
(dom/append-child! js/document.body iframe)
|
||||
|
||||
(set! origin new-origin)
|
||||
(set! cf/rasterizer-uri cf/public-uri)
|
||||
(set! instance iframe))))))))
|
||||
(set! origin new-origin)
|
||||
(set! cf/rasterizer-uri cf/public-uri)
|
||||
(set! instance iframe))))))))
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
[app.util.strings :as ust]
|
||||
[app.util.thumbnails :as th]
|
||||
[app.util.timers :as ts]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[clojure.set :as set]
|
||||
[cuerdas.core :as str]
|
||||
[rumext.v2 :as mf]))
|
||||
|
@ -550,7 +550,7 @@
|
|||
(mapcat get-image-data))]
|
||||
(->> (rx/from images)
|
||||
(rx/map #(cfg/resolve-file-media %))
|
||||
(rx/flat-map http/fetch-data-uri))))
|
||||
(rx/merge-map http/fetch-data-uri))))
|
||||
|
||||
(defn populate-fonts-cache [objects]
|
||||
(let [texts (->> objects
|
||||
|
@ -561,10 +561,10 @@
|
|||
(->> (rx/from texts)
|
||||
(rx/map fonts/get-content-fonts)
|
||||
(rx/reduce set/union #{})
|
||||
(rx/flat-map identity)
|
||||
(rx/flat-map fonts/fetch-font-css)
|
||||
(rx/flat-map fonts/extract-fontface-urls)
|
||||
(rx/flat-map http/fetch-data-uri))))
|
||||
(rx/merge-map identity)
|
||||
(rx/merge-map fonts/fetch-font-css)
|
||||
(rx/merge-map fonts/extract-fontface-urls)
|
||||
(rx/merge-map http/fetch-data-uri))))
|
||||
|
||||
(defn render-page
|
||||
[data]
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
[app.config :as cf]
|
||||
[app.util.http :as http]
|
||||
[app.util.sse :as sse]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[cuerdas.core :as str]))
|
||||
|
||||
(defn handle-response
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
[app.main.refs :as refs]
|
||||
[app.main.worker :as uw]
|
||||
[app.util.range-tree :as rt]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[clojure.set :as set]))
|
||||
|
||||
(def ^:const snap-accuracy 10)
|
||||
|
|
|
@ -9,9 +9,10 @@
|
|||
[app.common.logging :as log]
|
||||
[app.util.object :as obj]
|
||||
[app.util.timers :as tm]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[beicon.v2.operators :as rxo]
|
||||
[okulary.core :as l]
|
||||
[potok.core :as ptk]))
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
(log/set-level! :info)
|
||||
|
||||
|
@ -65,7 +66,7 @@
|
|||
(->> stream
|
||||
(rx/filter (ptk/type? :app.main.data.workspace.changes/commit-changes))
|
||||
(rx/map #(-> % deref :hint-origin str))
|
||||
(rx/dedupe))
|
||||
(rx/pipe (rxo/distinct-contiguous)))
|
||||
(->> stream
|
||||
(rx/map ptk/type)
|
||||
(rx/filter #(contains? allowed %))
|
||||
|
@ -75,7 +76,7 @@
|
|||
(> (count buffer) 20)
|
||||
(pop)))
|
||||
#queue [])
|
||||
(rx/subs #(reset! buffer (vec %))))
|
||||
(rx/subs! #(reset! buffer (vec %))))
|
||||
buffer))
|
||||
|
||||
(defn emit!
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
[app.util.globals :as globals]
|
||||
[app.util.keyboard :as kbd]
|
||||
[app.util.mouse :as mse]
|
||||
[beicon.core :as rx]))
|
||||
[beicon.v2.core :as rx]
|
||||
[beicon.v2.operators :as rxo]))
|
||||
|
||||
;; --- User Events
|
||||
|
||||
|
@ -33,23 +34,23 @@
|
|||
ob (->> pointer
|
||||
(rx/filter #(= :viewport (mse/get-pointer-source %)))
|
||||
(rx/map mse/get-pointer-position))]
|
||||
(rx/subscribe-with ob sub)
|
||||
(rx/sub! ob sub)
|
||||
sub))
|
||||
|
||||
(defonce mouse-position-ctrl
|
||||
(let [sub (rx/behavior-subject nil)
|
||||
ob (->> pointer
|
||||
(rx/map mse/get-pointer-ctrl-mod)
|
||||
(rx/dedupe))]
|
||||
(rx/subscribe-with ob sub)
|
||||
(rx/pipe (rxo/distinct-contiguous)))]
|
||||
(rx/sub! ob sub)
|
||||
sub))
|
||||
|
||||
(defonce mouse-position-meta
|
||||
(let [sub (rx/behavior-subject nil)
|
||||
ob (->> pointer
|
||||
(rx/map mse/get-pointer-meta-mod)
|
||||
(rx/dedupe))]
|
||||
(rx/subscribe-with ob sub)
|
||||
(rx/pipe (rxo/distinct-contiguous)))]
|
||||
(rx/sub! ob sub)
|
||||
sub))
|
||||
|
||||
(defonce mouse-position-mod
|
||||
|
@ -61,16 +62,16 @@
|
|||
(let [sub (rx/behavior-subject nil)
|
||||
ob (->> pointer
|
||||
(rx/map mse/get-pointer-shift-mod)
|
||||
(rx/dedupe))]
|
||||
(rx/subscribe-with ob sub)
|
||||
(rx/pipe (rxo/distinct-contiguous)))]
|
||||
(rx/sub! ob sub)
|
||||
sub))
|
||||
|
||||
(defonce mouse-position-alt
|
||||
(let [sub (rx/behavior-subject nil)
|
||||
ob (->> pointer
|
||||
(rx/map mse/get-pointer-alt-mod)
|
||||
(rx/dedupe))]
|
||||
(rx/subscribe-with ob sub)
|
||||
(rx/pipe (rxo/distinct-contiguous)))]
|
||||
(rx/sub! ob sub)
|
||||
sub))
|
||||
|
||||
(defonce ^:private window-blur
|
||||
|
@ -93,8 +94,8 @@
|
|||
;; registering the key pressed but on blurring the
|
||||
;; window (unfocus) the key down is never arrived.
|
||||
(rx/merge window-blur)
|
||||
(rx/dedupe))]
|
||||
(rx/subscribe-with ob sub)
|
||||
(rx/pipe (rxo/distinct-contiguous)))]
|
||||
(rx/sub! ob sub)
|
||||
sub))
|
||||
|
||||
(defonce keyboard-ctrl
|
||||
|
@ -107,8 +108,8 @@
|
|||
;; registering the key pressed but on blurring the
|
||||
;; window (unfocus) the key down is never arrived.
|
||||
(rx/merge window-blur)
|
||||
(rx/dedupe))]
|
||||
(rx/subscribe-with ob sub)
|
||||
(rx/pipe (rxo/distinct-contiguous)))]
|
||||
(rx/sub! ob sub)
|
||||
sub))
|
||||
|
||||
(defonce keyboard-meta
|
||||
|
@ -121,8 +122,8 @@
|
|||
;; registering the key pressed but on blurring the
|
||||
;; window (unfocus) the key down is never arrived.
|
||||
(rx/merge window-blur)
|
||||
(rx/dedupe))]
|
||||
(rx/subscribe-with ob sub)
|
||||
(rx/pipe (rxo/distinct-contiguous)))]
|
||||
(rx/sub! ob sub)
|
||||
sub))
|
||||
|
||||
(defonce keyboard-mod
|
||||
|
@ -136,6 +137,6 @@
|
|||
(rx/filter kbd/space?)
|
||||
(rx/filter (complement kbd/editing-event?))
|
||||
(rx/map kbd/key-down-event?)
|
||||
(rx/dedupe))]
|
||||
(rx/subscribe-with ob sub)
|
||||
(rx/pipe (rxo/distinct-contiguous)))]
|
||||
(rx/sub! ob sub)
|
||||
sub))
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
[app.util.i18n :refer [tr]]
|
||||
[app.util.keyboard :as k]
|
||||
[app.util.router :as rt]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[cljs.spec.alpha :as s]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
|||
[event provider params]
|
||||
(dom/prevent-default event)
|
||||
(->> (rp/cmd! :login-with-oidc (assoc params :provider provider))
|
||||
(rx/subs (fn [{:keys [redirect-uri] :as rsp}]
|
||||
(rx/subs! (fn [{:keys [redirect-uri] :as rsp}]
|
||||
(if redirect-uri
|
||||
(.replace js/location redirect-uri)
|
||||
(log/error :hint "unexpected response from OIDC method"
|
||||
|
@ -60,7 +60,7 @@
|
|||
(dom/stop-propagation event)
|
||||
(let [{:keys [on-error]} (meta params)]
|
||||
(->> (rp/cmd! :login-with-ldap params)
|
||||
(rx/subs (fn [profile]
|
||||
(rx/subs! (fn [profile]
|
||||
(if-let [token (:invitation-token profile)]
|
||||
(st/emit! (rt/nav :auth-verify-token {} {:token token}))
|
||||
(st/emit! (du/login-from-token {:profile profile}))))
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
[app.main.ui.icons :as i]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.router :as rt]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[cljs.spec.alpha :as s]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
[app.main.ui.messages :as msgs]
|
||||
[app.util.i18n :refer [tr tr-html]]
|
||||
[app.util.router :as rt]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[cljs.spec.alpha :as s]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
|
@ -109,7 +109,7 @@
|
|||
(->> (rp/cmd! :prepare-register-profile cdata)
|
||||
(rx/map #(merge % params))
|
||||
(rx/finalize #(reset! submitted? false))
|
||||
(rx/subs
|
||||
(rx/subs!
|
||||
on-success
|
||||
(partial handle-prepare-register-error form))))))]
|
||||
|
||||
|
@ -303,7 +303,7 @@
|
|||
(let [params (:clean-data @form)]
|
||||
(->> (rp/cmd! :register-profile params)
|
||||
(rx/finalize #(reset! submitted? false))
|
||||
(rx/subs on-success
|
||||
(rx/subs! on-success
|
||||
(partial handle-register-error form))))))]
|
||||
|
||||
(if new-css-system
|
||||
|
@ -375,7 +375,7 @@
|
|||
[:div {:class (stl/css :link-entry :go-back)}
|
||||
[:& lk/link {:action #(st/emit! (rt/nav :auth-register {} {}))}
|
||||
(tr "labels.go-back")]]]]
|
||||
|
||||
|
||||
;; OLD
|
||||
[:div.form-container
|
||||
[:h1 {:data-test "register-title"} (tr "auth.register-title")]
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.router :as rt]
|
||||
[app.util.timers :as ts]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(defmulti handle-token (fn [token] (:iss token)))
|
||||
|
@ -69,7 +69,7 @@
|
|||
(mf/with-effect []
|
||||
(dom/set-html-title (tr "title.default"))
|
||||
(->> (rp/cmd! :verify-token {:token token})
|
||||
(rx/subs
|
||||
(rx/subs!
|
||||
(fn [tdata]
|
||||
(handle-token tdata))
|
||||
(fn [{:keys [type code] :as error}]
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
[app.main.ui.icons :as i]
|
||||
[app.util.timers :as timers]
|
||||
[app.util.webapi :as wapi]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(mf/defc copy-button [{:keys [data on-copied children class]}]
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.keyboard :as kbd]
|
||||
[potok.core :as ptk]
|
||||
[potok.v2.core :as ptk]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(mf/defc comments-icon
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
[app.main.worker :as uw]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(def ^:const options [:all :merge :detach])
|
||||
|
@ -101,8 +101,9 @@
|
|||
:features features
|
||||
:export-type selected
|
||||
:files files})
|
||||
(rx/delay-emit 1000)
|
||||
(rx/subs
|
||||
(rx/mapcat #(->> (rx/of %)
|
||||
(rx/delay 1000)))
|
||||
(rx/subs!
|
||||
(fn [msg]
|
||||
(cond
|
||||
(= :error (:type msg))
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.router :as rt]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]
|
||||
[beicon.v2.core :as rx]
|
||||
[potok.v2.core :as ptk]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(defn get-project-name
|
||||
|
@ -195,7 +195,7 @@
|
|||
(when show?
|
||||
(->> (rp/cmd! :get-all-projects)
|
||||
(rx/map group-by-team)
|
||||
(rx/subs #(when (mf/ref-val mounted-ref)
|
||||
(rx/subs! #(when (mf/ref-val mounted-ref)
|
||||
(reset! teams %)))))))
|
||||
|
||||
(when current-team
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.keyboard :as kbd]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[cuerdas.core :as str]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
|
@ -75,7 +75,7 @@
|
|||
(mf/deps team installed-fonts)
|
||||
(fn [blobs]
|
||||
(->> (df/process-upload blobs (:id team))
|
||||
(rx/subs (fn [result]
|
||||
(rx/subs! (fn [result]
|
||||
(swap! fonts df/merge-and-group-fonts installed-fonts result))
|
||||
(fn [error]
|
||||
(js/console.error "error" error))))))
|
||||
|
@ -87,7 +87,7 @@
|
|||
(swap! uploading conj (:id item))
|
||||
(->> (rp/cmd! :create-font-variant item)
|
||||
(rx/delay-at-least 2000)
|
||||
(rx/subs (fn [font]
|
||||
(rx/subs! (fn [font]
|
||||
(swap! fonts dissoc (:id item))
|
||||
(swap! uploading disj (:id item))
|
||||
(st/emit! (df/add-font font)))
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
[app.util.keyboard :as kbd]
|
||||
[app.util.time :as dt]
|
||||
[app.util.timers :as ts]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[cuerdas.core :as str]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
|
@ -75,7 +75,7 @@
|
|||
(mf/with-effect [file-id revn visible? thumbnail-uri]
|
||||
(when (and visible? (not thumbnail-uri))
|
||||
(->> (ask-for-thumbnail file-id revn)
|
||||
(rx/subs (fn [url]
|
||||
(rx/subs! (fn [url]
|
||||
(st/emit! (dd/set-file-thumbnail file-id url)))
|
||||
(fn [cause]
|
||||
(log/error :hint "unable to render thumbnail"
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.keyboard :as kbd]
|
||||
[app.util.webapi :as wapi]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[cuerdas.core :as str]
|
||||
[potok.core :as ptk]
|
||||
[potok.v2.core :as ptk]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(log/set-level! :debug)
|
||||
|
@ -319,9 +319,9 @@
|
|||
(->> (uw/ask-many!
|
||||
{:cmd :analyze-import
|
||||
:files files})
|
||||
(rx/delay-emit emit-delay)
|
||||
(rx/mapcat #(rx/delay emit-delay (rx/of %)))
|
||||
(rx/filter some?)
|
||||
(rx/subs
|
||||
(rx/subs!
|
||||
(fn [{:keys [uri data error type] :as msg}]
|
||||
(if (some? error)
|
||||
(swap! state update :files set-analyze-error uri)
|
||||
|
@ -337,7 +337,7 @@
|
|||
:project-id project-id
|
||||
:files files
|
||||
:features @features/features-ref})
|
||||
(rx/subs
|
||||
(rx/subs!
|
||||
(fn [{:keys [file-id status message errors] :as msg}]
|
||||
(swap! state update :files update-status file-id status message errors))))))
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
[app.util.time :as dt]
|
||||
[cuerdas.core :as str]
|
||||
[okulary.core :as l]
|
||||
[potok.core :as ptk]
|
||||
[potok.v2.core :as ptk]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(mf/defc header
|
||||
|
|
|
@ -33,10 +33,10 @@
|
|||
[app.util.object :as obj]
|
||||
[app.util.router :as rt]
|
||||
[app.util.timers :as ts]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[cljs.spec.alpha :as s]
|
||||
[goog.functions :as f]
|
||||
[potok.core :as ptk]
|
||||
[potok.v2.core :as ptk]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(mf/defc sidebar-project
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
[app.main.ui.icons :as i]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[cljs.spec.alpha :as s]
|
||||
[cuerdas.core :as str]
|
||||
[rumext.v2 :as mf]))
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
[app.main.ui.icons :as i]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.router :as rt]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[cljs.spec.alpha :as s]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
[app.util.keyboard :as kbd]
|
||||
[app.util.router :as rt]
|
||||
[okulary.core :as l]
|
||||
[potok.core :as ptk]
|
||||
[potok.v2.core :as ptk]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
(def builtin-templates
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
[app.util.dom :as dom]
|
||||
[app.util.i18n :as i18n :refer [tr]]
|
||||
[app.util.keyboard :as k]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[goog.events :as events]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
|
@ -85,7 +85,7 @@
|
|||
(rx/mapcat identity)
|
||||
(rx/map (juxt :id :name))
|
||||
(rx/reduce conj [])
|
||||
(rx/subs #(reset! references* %))))
|
||||
(rx/subs! #(reset! references* %))))
|
||||
|
||||
(mf/with-effect [accept-fn]
|
||||
(letfn [(on-keydown [event]
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
[app.util.storage :refer [storage]]
|
||||
[app.util.timers :as ts]
|
||||
[app.util.webapi :as wapi]
|
||||
[beicon.core :as rx]
|
||||
[beicon.v2.core :as rx]
|
||||
[beicon.v2.operators :as rxo]
|
||||
[goog.functions :as f]
|
||||
[rumext.v2 :as mf]))
|
||||
|
||||
|
@ -35,8 +36,8 @@
|
|||
(let [[state reset-state!] (mf/useState #(if (satisfies? IDeref ob) @ob nil))]
|
||||
(mf/useEffect
|
||||
(fn []
|
||||
(let [sub (rx/subscribe ob #(reset-state! %))]
|
||||
#(rx/cancel! sub)))
|
||||
(let [sub (rx/sub! ob #(reset-state! %))]
|
||||
#(rx/dispose! sub)))
|
||||
#js [ob])
|
||||
state))
|
||||
|
||||
|
@ -106,7 +107,7 @@
|
|||
|
||||
cleanup
|
||||
(fn []
|
||||
(some-> (:subscr @state) rx/unsub!)
|
||||
(some-> (:subscr @state) rx/dispose!)
|
||||
(swap! state (fn [state]
|
||||
(-> state
|
||||
(cancel-timer)
|
||||
|
@ -217,7 +218,7 @@
|
|||
(mf/use-effect
|
||||
deps
|
||||
(fn []
|
||||
(let [sub (->> stream (rx/subs on-subscribe))]
|
||||
(let [sub (->> stream (rx/subs! on-subscribe))]
|
||||
#(rx/dispose! sub))))))
|
||||
|
||||
;; https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state
|
||||
|
@ -339,8 +340,8 @@
|
|||
|
||||
intersecting?)))
|
||||
|
||||
(rx/dedupe))
|
||||
subs (rx/subscribe stream update-state!)]
|
||||
(rx/pipe (rxo/distinct-contiguous)))
|
||||
subs (rx/sub! stream update-state!)]
|
||||
(.observe ^js @intersection-observer node)
|
||||
(fn []
|
||||
(.unobserve ^js @intersection-observer node)
|
||||
|
@ -383,7 +384,7 @@
|
|||
(let [node (mf/ref-val rowref)
|
||||
mnt? (volatile! true)
|
||||
sub (->> (wapi/observe-resize node)
|
||||
(rx/subs (fn [entries]
|
||||
(rx/subs! (fn [entries]
|
||||
(let [row (first entries)
|
||||
row-rect (.-contentRect ^js row)
|
||||
row-width (.-width ^js row-rect)]
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue