mirror of
https://github.com/status-im/re-frame-10x.git
synced 2025-01-13 15:44:24 +00:00
Update bundled versions of re-frame and reagent
This commit is contained in:
parent
afd847eddb
commit
532657a44a
@ -1,6 +1,12 @@
|
||||
# Change Log
|
||||
All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Changed
|
||||
|
||||
* Updated bundled re-frame version to 0.10.3, and bundled reagent version to 0.7.0. This shouldn't impact your project's dependencies as they are source bundled via [mranderson](https://github.com/benedekfazekas/mranderson).
|
||||
|
||||
## [0.1.15] - 2018-01-24
|
||||
|
||||
### Added
|
||||
|
@ -5,7 +5,7 @@
|
||||
:dependencies [[org.clojure/clojure "1.9.0"]
|
||||
[org.clojure/clojurescript "1.9.671"]
|
||||
[reagent "0.6.0" :scope "provided"]
|
||||
[re-frame "0.10.3-alpha2" :scope "provided"]
|
||||
[re-frame "0.10.3" :scope "provided"]
|
||||
[binaryage/devtools "0.9.4"]
|
||||
[garden "1.3.3"]
|
||||
[cljsjs/react-flip-move "2.9.17-0"]]
|
||||
@ -31,7 +31,7 @@
|
||||
:target-path "resources/day8/re_frame/trace"}
|
||||
|
||||
:profiles {:dev {:dependencies [[binaryage/dirac "RELEASE"]]}
|
||||
:mranderson {:dependencies ^:replace [^:source-dep [re-frame "0.10.2"
|
||||
:mranderson {:dependencies ^:replace [^:source-dep [re-frame "0.10.3"
|
||||
:exclusions [org.clojure/clojurescript
|
||||
cljsjs/react
|
||||
cljsjs/react-dom
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
lein do clean
|
||||
lein with-profile mranderson source-deps
|
||||
cp -r target/srcdeps/mranderson047 src
|
||||
# Then delete the META-INF directories
|
||||
|
||||
rm -r target/srcdeps/mranderson047/reagent/v0v7v0/META-INF
|
||||
rm -r target/srcdeps/mranderson047/re-frame
|
||||
cp -r target/srcdeps/mranderson047 src
|
||||
|
@ -22,7 +22,7 @@
|
||||
[re-frame.interop :as interop]
|
||||
[devtools.formatters.core :as devtools]
|
||||
[mranderson047.re-frame.v0v10v2.re-frame.core :as rf]
|
||||
[mranderson047.reagent.v0v6v0.reagent.core :as r]))
|
||||
[mranderson047.reagent.v0v7v0.reagent.core :as r]))
|
||||
|
||||
(goog-define debug? false)
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
(ns day8.re-frame.trace.events
|
||||
(:require [mranderson047.re-frame.v0v10v2.re-frame.core :as rf]
|
||||
[mranderson047.reagent.v0v6v0.reagent.core :as r]
|
||||
[mranderson047.reagent.v0v7v0.reagent.core :as r]
|
||||
[cljs.tools.reader.edn]
|
||||
[day8.re-frame.trace.utils.utils :as utils]
|
||||
[day8.re-frame.trace.utils.localstorage :as localstorage]
|
||||
[clojure.string :as str]
|
||||
|
@ -18,7 +18,7 @@
|
||||
see additional properties that can be specified in options
|
||||
https://github.com/joshwcomeau/react-flip-move#options"
|
||||
(:require
|
||||
[mranderson047.reagent.v0v6v0.reagent.core :as reagent]
|
||||
[mranderson047.reagent.v0v7v0.reagent.core :as reagent]
|
||||
[cljsjs.react-flip-move]))
|
||||
|
||||
(def component
|
||||
|
@ -1,7 +1,7 @@
|
||||
(ns day8.re-frame.trace.utils.re-com
|
||||
"Shameless pilfered from re-com."
|
||||
(:require-macros [day8.re-frame.trace.utils.re-com :refer [handler-fn]])
|
||||
(:require [mranderson047.reagent.v0v6v0.reagent.ratom :as reagent :refer [RAtom Reaction RCursor Track Wrapper]]
|
||||
(:require [mranderson047.reagent.v0v7v0.reagent.ratom :as reagent :refer [RAtom Reaction RCursor Track Wrapper]]
|
||||
[clojure.string :as string]))
|
||||
|
||||
(defn px
|
||||
|
@ -5,7 +5,7 @@
|
||||
[day8.re-frame.trace.utils.animated :as animated]
|
||||
[day8.re-frame.trace.view.components :as components]
|
||||
[mranderson047.re-frame.v0v10v2.re-frame.core :as rf]
|
||||
[mranderson047.reagent.v0v6v0.reagent.core :as r]
|
||||
[mranderson047.reagent.v0v7v0.reagent.core :as r]
|
||||
[day8.re-frame.trace.utils.re-com :as rc :refer [css-join]]
|
||||
[day8.re-frame.trace.common-styles :as common]
|
||||
[clojure.data])
|
||||
|
@ -5,7 +5,7 @@
|
||||
[day8.re-frame.trace.utils.localstorage :as localstorage]
|
||||
[clojure.string :as str]
|
||||
[day8.re-frame.trace.utils.re-com :as rc]
|
||||
[mranderson047.reagent.v0v6v0.reagent.core :as r])
|
||||
[mranderson047.reagent.v0v7v0.reagent.core :as r])
|
||||
(:require-macros [day8.re-frame.trace.utils.macros :refer [with-cljs-devtools-prefs]]))
|
||||
|
||||
(defn search-input [{:keys [title placeholder on-save on-change on-stop]}]
|
||||
|
@ -1,6 +1,6 @@
|
||||
(ns day8.re-frame.trace.view.settings
|
||||
(:require [mranderson047.re-frame.v0v10v2.re-frame.core :as rf]
|
||||
[mranderson047.reagent.v0v6v0.reagent.core :as r]
|
||||
[mranderson047.reagent.v0v7v0.reagent.core :as r]
|
||||
[day8.re-frame.trace.utils.re-com :as rc :refer [css-join]]
|
||||
[day8.re-frame.trace.common-styles :as common]
|
||||
[garden.units :as units]
|
||||
|
@ -3,7 +3,7 @@
|
||||
[day8.re-frame.trace.utils.utils :as utils]
|
||||
[day8.re-frame.trace.utils.animated :as animated]
|
||||
[mranderson047.re-frame.v0v10v2.re-frame.core :as rf]
|
||||
[mranderson047.reagent.v0v6v0.reagent.core :as r]
|
||||
[mranderson047.reagent.v0v7v0.reagent.core :as r]
|
||||
[day8.re-frame.trace.utils.re-com :as rc :refer [css-join]]
|
||||
[day8.re-frame.trace.common-styles :as common]
|
||||
[day8.re-frame.trace.view.components :as components])
|
||||
|
@ -6,7 +6,7 @@
|
||||
[day8.re-frame.trace.utils.localstorage :as localstorage]
|
||||
[cljs.pprint :as pprint]
|
||||
[clojure.set :as set]
|
||||
[mranderson047.reagent.v0v6v0.reagent.core :as r]
|
||||
[mranderson047.reagent.v0v7v0.reagent.core :as r]
|
||||
[mranderson047.re-frame.v0v10v2.re-frame.core :as rf]
|
||||
[day8.re-frame.trace.utils.re-com :as rc]))
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
||||
(defn make-reaction
|
||||
"On JVM Clojure, return a `deref`-able thing which invokes the given function
|
||||
on every `deref`. That is, `make-reaction` here provides precisely none of the
|
||||
benefits of `mranderson047.reagent.v0v6v0.reagent.ratom/make-reaction` (which only invokes its function if
|
||||
benefits of `mranderson047.reagent.v0v7v0.reagent.ratom/make-reaction` (which only invokes its function if
|
||||
the reactions that the function derefs have changed value). But so long as `f`
|
||||
only depends on other reactions (which also behave themselves), the only
|
||||
difference is one of efficiency. That is, your tests should see no difference
|
||||
|
@ -1,13 +1,13 @@
|
||||
(ns mranderson047.re-frame.v0v10v2.re-frame.interop
|
||||
(:require [goog.async.nextTick]
|
||||
[mranderson047.reagent.v0v6v0.reagent.core]
|
||||
[mranderson047.reagent.v0v6v0.reagent.ratom]))
|
||||
[mranderson047.reagent.v0v7v0.reagent.core]
|
||||
[mranderson047.reagent.v0v7v0.reagent.ratom]))
|
||||
|
||||
(def next-tick goog.async.nextTick)
|
||||
|
||||
(def empty-queue #queue [])
|
||||
|
||||
(def after-render mranderson047.reagent.v0v6v0.reagent.core/after-render)
|
||||
(def after-render mranderson047.reagent.v0v7v0.reagent.core/after-render)
|
||||
|
||||
;; Make sure the Google Closure compiler sees this as a boolean constant,
|
||||
;; otherwise Dead Code Elimination won't happen in `:advanced` builds.
|
||||
@ -16,23 +16,23 @@
|
||||
(def ^boolean debug-enabled? "@define {boolean}" ^boolean js/goog.DEBUG)
|
||||
|
||||
(defn ratom [x]
|
||||
(mranderson047.reagent.v0v6v0.reagent.core/atom x))
|
||||
(mranderson047.reagent.v0v7v0.reagent.core/atom x))
|
||||
|
||||
(defn ratom? [x]
|
||||
(satisfies? mranderson047.reagent.v0v6v0.reagent.ratom/IReactiveAtom x))
|
||||
(satisfies? mranderson047.reagent.v0v7v0.reagent.ratom/IReactiveAtom x))
|
||||
|
||||
(defn deref? [x]
|
||||
(satisfies? IDeref x))
|
||||
|
||||
|
||||
(defn make-reaction [f]
|
||||
(mranderson047.reagent.v0v6v0.reagent.ratom/make-reaction f))
|
||||
(mranderson047.reagent.v0v7v0.reagent.ratom/make-reaction f))
|
||||
|
||||
(defn add-on-dispose! [a-ratom f]
|
||||
(mranderson047.reagent.v0v6v0.reagent.ratom/add-on-dispose! a-ratom f))
|
||||
(mranderson047.reagent.v0v7v0.reagent.ratom/add-on-dispose! a-ratom f))
|
||||
|
||||
(defn dispose! [a-ratom]
|
||||
(mranderson047.reagent.v0v6v0.reagent.ratom/dispose! a-ratom))
|
||||
(mranderson047.reagent.v0v7v0.reagent.ratom/dispose! a-ratom))
|
||||
|
||||
(defn set-timeout! [f ms]
|
||||
(js/setTimeout f ms))
|
||||
@ -46,11 +46,11 @@
|
||||
"Produces an id for reactive Reagent values
|
||||
e.g. reactions, ratoms, cursors."
|
||||
[reactive-val]
|
||||
(when (implements? mranderson047.reagent.v0v6v0.reagent.ratom/IReactiveAtom reactive-val)
|
||||
(when (implements? mranderson047.reagent.v0v7v0.reagent.ratom/IReactiveAtom reactive-val)
|
||||
(str (condp instance? reactive-val
|
||||
mranderson047.reagent.v0v6v0.reagent.ratom/RAtom "ra"
|
||||
mranderson047.reagent.v0v6v0.reagent.ratom/RCursor "rc"
|
||||
mranderson047.reagent.v0v6v0.reagent.ratom/Reaction "rx"
|
||||
mranderson047.reagent.v0v6v0.reagent.ratom/Track "tr"
|
||||
mranderson047.reagent.v0v7v0.reagent.ratom/RAtom "ra"
|
||||
mranderson047.reagent.v0v7v0.reagent.ratom/RCursor "rc"
|
||||
mranderson047.reagent.v0v7v0.reagent.ratom/Reaction "rx"
|
||||
mranderson047.reagent.v0v7v0.reagent.ratom/Track "tr"
|
||||
"other")
|
||||
(hash reactive-val))))
|
||||
|
@ -1,2 +0,0 @@
|
||||
(ns mranderson047.reagent.v0v6v0.reagent.interop
|
||||
(:require-macros [mranderson047.reagent.v0v6v0.reagent.interop]))
|
@ -1,5 +1,5 @@
|
||||
(ns mranderson047.reagent.v0v6v0.reagent.core
|
||||
(:require [mranderson047.reagent.v0v6v0.reagent.ratom :as ra]))
|
||||
(ns mranderson047.reagent.v0v7v0.reagent.core
|
||||
(:require [mranderson047.reagent.v0v7v0.reagent.ratom :as ra]))
|
||||
|
||||
(defmacro with-let [bindings & body]
|
||||
"Bind variables as with let, except that when used in a component
|
@ -1,15 +1,17 @@
|
||||
(ns mranderson047.reagent.v0v6v0.reagent.core
|
||||
(:require-macros [mranderson047.reagent.v0v6v0.reagent.core])
|
||||
(ns mranderson047.reagent.v0v7v0.reagent.core
|
||||
(:require-macros [mranderson047.reagent.v0v7v0.reagent.core])
|
||||
(:refer-clojure :exclude [partial atom flush])
|
||||
(:require [mranderson047.reagent.v0v6v0.reagent.impl.template :as tmpl]
|
||||
[mranderson047.reagent.v0v6v0.reagent.impl.component :as comp]
|
||||
[mranderson047.reagent.v0v6v0.reagent.impl.util :as util]
|
||||
[mranderson047.reagent.v0v6v0.reagent.impl.batching :as batch]
|
||||
[mranderson047.reagent.v0v6v0.reagent.ratom :as ratom]
|
||||
[mranderson047.reagent.v0v6v0.reagent.debug :as deb :refer-macros [dbg prn]]
|
||||
[mranderson047.reagent.v0v6v0.reagent.interop :refer-macros [$ $!]]
|
||||
[mranderson047.reagent.v0v6v0.reagent.dom :as dom]
|
||||
[mranderson047.reagent.v0v6v0.reagent.dom.server :as server]))
|
||||
(:require [mranderson047.reagent.v0v7v0.reagent.impl.template :as tmpl]
|
||||
[mranderson047.reagent.v0v7v0.reagent.impl.component :as comp]
|
||||
[mranderson047.reagent.v0v7v0.reagent.impl.util :as util]
|
||||
[mranderson047.reagent.v0v7v0.reagent.impl.batching :as batch]
|
||||
[mranderson047.reagent.v0v7v0.reagent.ratom :as ratom]
|
||||
[mranderson047.reagent.v0v7v0.reagent.debug :as deb :refer-macros [dbg prn
|
||||
assert-some assert-component
|
||||
assert-js-object assert-new-state
|
||||
assert-callable]]
|
||||
[mranderson047.reagent.v0v7v0.reagent.interop :refer-macros [$ $!]]
|
||||
[mranderson047.reagent.v0v7v0.reagent.dom :as dom]))
|
||||
|
||||
(def is-client util/is-client)
|
||||
|
||||
@ -31,13 +33,13 @@
|
||||
([type]
|
||||
(create-element type nil))
|
||||
([type props]
|
||||
(assert (not (map? props)))
|
||||
(assert-js-object props)
|
||||
($ react createElement type props))
|
||||
([type props child]
|
||||
(assert (not (map? props)))
|
||||
(assert-js-object props)
|
||||
($ react createElement type props child))
|
||||
([type props child & children]
|
||||
(assert (not (map? props)))
|
||||
(assert-js-object props)
|
||||
(apply ($ react :createElement) type props child children)))
|
||||
|
||||
(defn as-element
|
||||
@ -50,7 +52,7 @@
|
||||
"Returns an adapter for a native React class, that may be used
|
||||
just like a Reagent component function or class in Hiccup forms."
|
||||
[c]
|
||||
(assert c)
|
||||
(assert-some c "Component")
|
||||
(tmpl/adapt-react-class c))
|
||||
|
||||
(defn reactify-component
|
||||
@ -58,7 +60,7 @@
|
||||
React, for example in JSX. A single argument, props, is passed to
|
||||
the component, converted to a map."
|
||||
[c]
|
||||
(assert c)
|
||||
(assert-some c "Component")
|
||||
(comp/reactify-component c))
|
||||
|
||||
(defn render
|
||||
@ -79,20 +81,9 @@
|
||||
[container]
|
||||
(dom/unmount-component-at-node container))
|
||||
|
||||
(defn render-to-string
|
||||
"Turns a component into an HTML string."
|
||||
[component]
|
||||
(server/render-to-string component))
|
||||
|
||||
;; For backward compatibility
|
||||
(def as-component as-element)
|
||||
(def render-component render)
|
||||
(def render-component-to-string render-to-string)
|
||||
|
||||
(defn render-to-static-markup
|
||||
"Turns a component into an HTML string, without data-react-id attributes, etc."
|
||||
[component]
|
||||
(server/render-to-static-markup component))
|
||||
|
||||
(defn ^:export force-update-all
|
||||
"Force re-rendering of all mounted Reagent components. This is
|
||||
@ -137,30 +128,30 @@
|
||||
(defn state-atom
|
||||
"Returns an atom containing a components state."
|
||||
[this]
|
||||
(assert (comp/reagent-component? this))
|
||||
(assert-component this)
|
||||
(comp/state-atom this))
|
||||
|
||||
(defn state
|
||||
"Returns the state of a component, as set with replace-state or set-state.
|
||||
Equivalent to (deref (r/state-atom this))"
|
||||
[this]
|
||||
(assert (comp/reagent-component? this))
|
||||
(assert-component this)
|
||||
(deref (state-atom this)))
|
||||
|
||||
(defn replace-state
|
||||
"Set state of a component.
|
||||
Equivalent to (reset! (state-atom this) new-state)"
|
||||
[this new-state]
|
||||
(assert (comp/reagent-component? this))
|
||||
(assert (or (nil? new-state) (map? new-state)))
|
||||
(assert-component this)
|
||||
(assert-new-state new-state)
|
||||
(reset! (state-atom this) new-state))
|
||||
|
||||
(defn set-state
|
||||
"Merge component state with new-state.
|
||||
Equivalent to (swap! (state-atom this) merge new-state)"
|
||||
[this new-state]
|
||||
(assert (comp/reagent-component? this))
|
||||
(assert (or (nil? new-state) (map? new-state)))
|
||||
(assert-component this)
|
||||
(assert-new-state new-state)
|
||||
(swap! (state-atom this) merge new-state))
|
||||
|
||||
(defn force-update
|
||||
@ -178,19 +169,19 @@
|
||||
(defn props
|
||||
"Returns the props passed to a component."
|
||||
[this]
|
||||
(assert (comp/reagent-component? this))
|
||||
(assert-component this)
|
||||
(comp/get-props this))
|
||||
|
||||
(defn children
|
||||
"Returns the children passed to a component."
|
||||
[this]
|
||||
(assert (comp/reagent-component? this))
|
||||
(assert-component this)
|
||||
(comp/get-children this))
|
||||
|
||||
(defn argv
|
||||
"Returns the entire Hiccup form passed to the component."
|
||||
[this]
|
||||
(assert (comp/reagent-component? this))
|
||||
(assert-component this)
|
||||
(comp/get-argv this))
|
||||
|
||||
(defn dom-node
|
||||
@ -269,7 +260,7 @@
|
||||
|
||||
Probably useful only for passing to child components."
|
||||
[value reset-fn & args]
|
||||
(assert (ifn? reset-fn))
|
||||
(assert-callable reset-fn)
|
||||
(ratom/make-wrapper value reset-fn args))
|
||||
|
||||
|
||||
@ -346,10 +337,9 @@
|
||||
(batch/do-after-render f))
|
||||
|
||||
(defn partial
|
||||
"Works just like clojure.core/partial, except that it is an IFn, and
|
||||
the result can be compared with ="
|
||||
"Works just like clojure.core/partial, but the result can be compared with ="
|
||||
[f & args]
|
||||
(util/partial-ifn. f args nil))
|
||||
(util/make-partial-fn f args))
|
||||
|
||||
(defn component-path
|
||||
;; Try to return the path of component c as a string.
|
@ -1,19 +1,19 @@
|
||||
(ns mranderson047.reagent.v0v6v0.reagent.debug
|
||||
(ns mranderson047.reagent.v0v7v0.reagent.debug
|
||||
(:refer-clojure :exclude [prn println time]))
|
||||
|
||||
(defmacro log
|
||||
"Print with console.log, if it exists."
|
||||
[& forms]
|
||||
`(when mranderson047.reagent.v0v6v0.reagent.debug.has-console
|
||||
`(when mranderson047.reagent.v0v7v0.reagent.debug.has-console
|
||||
(.log js/console ~@forms)))
|
||||
|
||||
(defmacro warn
|
||||
"Print with console.warn."
|
||||
[& forms]
|
||||
(when *assert*
|
||||
`(when mranderson047.reagent.v0v6v0.reagent.debug.has-console
|
||||
(.warn (if mranderson047.reagent.v0v6v0.reagent.debug.tracking
|
||||
mranderson047.reagent.v0v6v0.reagent.debug.track-console js/console)
|
||||
`(when mranderson047.reagent.v0v7v0.reagent.debug.has-console
|
||||
(.warn (if mranderson047.reagent.v0v7v0.reagent.debug.tracking
|
||||
mranderson047.reagent.v0v7v0.reagent.debug.track-console js/console)
|
||||
(str "Warning: " ~@forms)))))
|
||||
|
||||
(defmacro warn-unless
|
||||
@ -26,9 +26,9 @@
|
||||
"Print with console.error."
|
||||
[& forms]
|
||||
(when *assert*
|
||||
`(when mranderson047.reagent.v0v6v0.reagent.debug.has-console
|
||||
(.error (if mranderson047.reagent.v0v6v0.reagent.debug.tracking
|
||||
mranderson047.reagent.v0v6v0.reagent.debug.track-console js/console)
|
||||
`(when mranderson047.reagent.v0v7v0.reagent.debug.has-console
|
||||
(.error (if mranderson047.reagent.v0v7v0.reagent.debug.tracking
|
||||
mranderson047.reagent.v0v7v0.reagent.debug.track-console js/console)
|
||||
(str ~@forms)))))
|
||||
|
||||
(defmacro println
|
||||
@ -71,3 +71,26 @@ as well as package name and line number. Returns x."
|
||||
~@forms)]
|
||||
(js/console.timeEnd label#)
|
||||
res#)))
|
||||
|
||||
(defmacro assert-some [value tag]
|
||||
`(assert ~value (str ~tag " must not be nil")))
|
||||
|
||||
(defmacro assert-component [value]
|
||||
`(assert (comp/reagent-component? ~value)
|
||||
(str "Expected a mranderson047.reagent.v0v7v0.reagent component, not "
|
||||
(pr-str ~value))))
|
||||
|
||||
(defmacro assert-js-object [value]
|
||||
`(assert (not (map? ~value))
|
||||
(str "Expected a JS object, not "
|
||||
(pr-str ~value))))
|
||||
|
||||
(defmacro assert-new-state [value]
|
||||
`(assert (or (nil? ~value) (map? ~value))
|
||||
(str "Expected a valid new state, not "
|
||||
(pr-str ~value))))
|
||||
|
||||
(defmacro assert-callable [value]
|
||||
`(assert (ifn? ~value)
|
||||
(str "Expected something callable, not "
|
||||
(pr-str ~value))))
|
@ -1,5 +1,5 @@
|
||||
(ns mranderson047.reagent.v0v6v0.reagent.debug
|
||||
(:require-macros [mranderson047.reagent.v0v6v0.reagent.debug]))
|
||||
(ns mranderson047.reagent.v0v7v0.reagent.debug
|
||||
(:require-macros [mranderson047.reagent.v0v7v0.reagent.debug]))
|
||||
|
||||
(def ^:const has-console (exists? js/console))
|
||||
|
@ -1,11 +1,11 @@
|
||||
(ns mranderson047.reagent.v0v6v0.reagent.dom
|
||||
(ns mranderson047.reagent.v0v7v0.reagent.dom
|
||||
(:require [cljsjs.react.dom]
|
||||
[mranderson047.reagent.v0v6v0.reagent.impl.util :as util]
|
||||
[mranderson047.reagent.v0v6v0.reagent.impl.template :as tmpl]
|
||||
[mranderson047.reagent.v0v6v0.reagent.impl.batching :as batch]
|
||||
[mranderson047.reagent.v0v6v0.reagent.ratom :as ratom]
|
||||
[mranderson047.reagent.v0v6v0.reagent.debug :refer-macros [dbg]]
|
||||
[mranderson047.reagent.v0v6v0.reagent.interop :refer-macros [$ $!]]))
|
||||
[mranderson047.reagent.v0v7v0.reagent.impl.util :as util]
|
||||
[mranderson047.reagent.v0v7v0.reagent.impl.template :as tmpl]
|
||||
[mranderson047.reagent.v0v7v0.reagent.impl.batching :as batch]
|
||||
[mranderson047.reagent.v0v7v0.reagent.ratom :as ratom]
|
||||
[mranderson047.reagent.v0v7v0.reagent.debug :refer-macros [dbg]]
|
||||
[mranderson047.reagent.v0v7v0.reagent.interop :refer-macros [$ $!]]))
|
||||
|
||||
(defonce ^:private imported nil)
|
||||
|
||||
@ -61,6 +61,8 @@
|
||||
[this]
|
||||
($ (module) findDOMNode this))
|
||||
|
||||
(set! tmpl/find-dom-node dom-node)
|
||||
|
||||
(defn force-update-all
|
||||
"Force re-rendering of all mounted Reagent components. This is
|
||||
probably only useful in a development environment, when you want to
|
@ -1,9 +1,9 @@
|
||||
(ns mranderson047.reagent.v0v6v0.reagent.dom.server
|
||||
(ns mranderson047.reagent.v0v7v0.reagent.dom.server
|
||||
(:require [cljsjs.react.dom.server]
|
||||
[mranderson047.reagent.v0v6v0.reagent.impl.util :as util]
|
||||
[mranderson047.reagent.v0v6v0.reagent.impl.template :as tmpl]
|
||||
[mranderson047.reagent.v0v6v0.reagent.ratom :as ratom]
|
||||
[mranderson047.reagent.v0v6v0.reagent.interop :refer-macros [$ $!]]))
|
||||
[mranderson047.reagent.v0v7v0.reagent.impl.util :as util]
|
||||
[mranderson047.reagent.v0v7v0.reagent.impl.template :as tmpl]
|
||||
[mranderson047.reagent.v0v7v0.reagent.ratom :as ratom]
|
||||
[mranderson047.reagent.v0v7v0.reagent.interop :refer-macros [$ $!]]))
|
||||
|
||||
(defonce ^:private imported nil)
|
||||
|
@ -1,8 +1,8 @@
|
||||
(ns mranderson047.reagent.v0v6v0.reagent.impl.batching
|
||||
(ns mranderson047.reagent.v0v7v0.reagent.impl.batching
|
||||
(:refer-clojure :exclude [flush])
|
||||
(:require [mranderson047.reagent.v0v6v0.reagent.debug :refer-macros [dbg]]
|
||||
[mranderson047.reagent.v0v6v0.reagent.interop :refer-macros [$ $!]]
|
||||
[mranderson047.reagent.v0v6v0.reagent.impl.util :refer [is-client]]
|
||||
(:require [mranderson047.reagent.v0v7v0.reagent.debug :refer-macros [dbg assert-some]]
|
||||
[mranderson047.reagent.v0v7v0.reagent.interop :refer-macros [$ $!]]
|
||||
[mranderson047.reagent.v0v7v0.reagent.impl.util :refer [is-client]]
|
||||
[clojure.string :as string]))
|
||||
|
||||
;;; Update batching
|
||||
@ -45,7 +45,7 @@
|
||||
(deftype RenderQueue [^:mutable ^boolean scheduled?]
|
||||
Object
|
||||
(enqueue [this k f]
|
||||
(assert (some? f))
|
||||
(assert-some f "Enqueued function")
|
||||
(when (nil? (aget this k))
|
||||
(aset this k (array)))
|
||||
(.push (aget this k) f)
|
||||
@ -86,7 +86,7 @@
|
||||
(run-queue cs))
|
||||
(.flush-after-render this)))
|
||||
|
||||
(defonce render-queue (RenderQueue. false))
|
||||
(defonce render-queue (->RenderQueue false))
|
||||
|
||||
(defn flush []
|
||||
(.flush-queues render-queue))
|
@ -1,9 +1,10 @@
|
||||
(ns mranderson047.reagent.v0v6v0.reagent.impl.component
|
||||
(:require [mranderson047.reagent.v0v6v0.reagent.impl.util :as util]
|
||||
[mranderson047.reagent.v0v6v0.reagent.impl.batching :as batch]
|
||||
[mranderson047.reagent.v0v6v0.reagent.ratom :as ratom]
|
||||
[mranderson047.reagent.v0v6v0.reagent.interop :refer-macros [$ $!]]
|
||||
[mranderson047.reagent.v0v6v0.reagent.debug :refer-macros [dbg prn dev? warn error warn-unless]]))
|
||||
(ns mranderson047.reagent.v0v7v0.reagent.impl.component
|
||||
(:require [mranderson047.reagent.v0v7v0.reagent.impl.util :as util]
|
||||
[mranderson047.reagent.v0v7v0.reagent.impl.batching :as batch]
|
||||
[mranderson047.reagent.v0v7v0.reagent.ratom :as ratom]
|
||||
[mranderson047.reagent.v0v7v0.reagent.interop :refer-macros [$ $!]]
|
||||
[mranderson047.reagent.v0v7v0.reagent.debug :refer-macros [dbg prn dev? warn error warn-unless
|
||||
assert-callable]]))
|
||||
|
||||
(declare ^:dynamic *current-component*)
|
||||
|
||||
@ -85,7 +86,7 @@
|
||||
|
||||
(defn wrap-render [c]
|
||||
(let [f ($ c :reagentRender)
|
||||
_ (assert (ifn? f))
|
||||
_ (assert-callable f)
|
||||
res (if (true? ($ c :cljsLegacyRender))
|
||||
(.call f c c)
|
||||
(let [v (get-argv c)
|
||||
@ -144,7 +145,7 @@
|
||||
(defn custom-wrapper [key f]
|
||||
(case key
|
||||
:getDefaultProps
|
||||
(assert false "getDefaultProps not supported")
|
||||
(throw (js/Error. "getDefaultProps not supported"))
|
||||
|
||||
:getInitialState
|
||||
(fn getInitialState []
|
||||
@ -201,8 +202,7 @@
|
||||
(defn get-wrapper [key f name]
|
||||
(let [wrap (custom-wrapper key f)]
|
||||
(when (and wrap f)
|
||||
(assert (ifn? f)
|
||||
(str "Expected function in " name key " but got " f)))
|
||||
(assert-callable f))
|
||||
(or wrap f)))
|
||||
|
||||
(def obligatory {:shouldComponentUpdate nil
|
||||
@ -225,8 +225,7 @@
|
||||
render-fun (-> renders vals first)]
|
||||
(assert (pos? (count renders)) "Missing reagent-render")
|
||||
(assert (== 1 (count renders)) "Too many render functions supplied")
|
||||
(assert (ifn? render-fun) (str "Render must be a function, not "
|
||||
(pr-str render-fun)))))
|
||||
(assert-callable render-fun)))
|
||||
(let [render-fun (or (:reagentRender fmap)
|
||||
(:componentFunction fmap))
|
||||
legacy-render (nil? render-fun)
|
||||
@ -264,7 +263,7 @@
|
||||
{:pre [(map? body)]}
|
||||
(->> body
|
||||
cljsify
|
||||
($ util/react createClass)))
|
||||
util/create-class))
|
||||
|
||||
(defn component-path [c]
|
||||
(let [elem (some-> (or (some-> c ($ :_reactInternalInstance))
|
||||
@ -291,7 +290,7 @@
|
||||
""))
|
||||
|
||||
(defn fn-to-class [f]
|
||||
(assert (ifn? f) (str "Expected a function, not " (pr-str f)))
|
||||
(assert-callable f)
|
||||
(warn-unless (not (and (react-class? f)
|
||||
(not (reagent-class? f))))
|
||||
"Using native React classes directly in Hiccup forms "
|
@ -1,12 +1,12 @@
|
||||
(ns mranderson047.reagent.v0v6v0.reagent.impl.template
|
||||
(ns mranderson047.reagent.v0v7v0.reagent.impl.template
|
||||
(:require [clojure.string :as string]
|
||||
[clojure.walk :refer [prewalk]]
|
||||
[mranderson047.reagent.v0v6v0.reagent.impl.util :as util :refer [is-client]]
|
||||
[mranderson047.reagent.v0v6v0.reagent.impl.component :as comp]
|
||||
[mranderson047.reagent.v0v6v0.reagent.impl.batching :as batch]
|
||||
[mranderson047.reagent.v0v6v0.reagent.ratom :as ratom]
|
||||
[mranderson047.reagent.v0v6v0.reagent.interop :refer-macros [$ $!]]
|
||||
[mranderson047.reagent.v0v6v0.reagent.debug :refer-macros [dbg prn println log dev?
|
||||
[mranderson047.reagent.v0v7v0.reagent.impl.util :as util :refer [is-client]]
|
||||
[mranderson047.reagent.v0v7v0.reagent.impl.component :as comp]
|
||||
[mranderson047.reagent.v0v7v0.reagent.impl.batching :as batch]
|
||||
[mranderson047.reagent.v0v7v0.reagent.ratom :as ratom]
|
||||
[mranderson047.reagent.v0v7v0.reagent.interop :refer-macros [$ $!]]
|
||||
[mranderson047.reagent.v0v7v0.reagent.debug :refer-macros [dbg prn println log dev?
|
||||
warn warn-unless]]))
|
||||
|
||||
;; From Weavejester's Hiccup, via pump:
|
||||
@ -98,6 +98,9 @@
|
||||
|
||||
;;; Specialization for input components
|
||||
|
||||
;; This gets set from mranderson047.reagent.v0v7v0.reagent.dom
|
||||
(defonce find-dom-node nil)
|
||||
|
||||
;; <input type="??" >
|
||||
;; The properites 'selectionStart' and 'selectionEnd' only exist on some inputs
|
||||
;; See: https://html.spec.whatwg.org/multipage/forms.html#do-not-apply
|
||||
@ -109,10 +112,11 @@
|
||||
(contains? these-inputs-have-selection-api input-type))
|
||||
|
||||
(defn input-set-value [this]
|
||||
(when-some [node ($ this :cljsInputElement)]
|
||||
(when ($ this :cljsInputLive)
|
||||
($! this :cljsInputDirty false)
|
||||
(let [rendered-value ($ this :cljsRenderedValue)
|
||||
dom-value ($ this :cljsDOMValue)]
|
||||
dom-value ($ this :cljsDOMValue)
|
||||
node (find-dom-node this)]
|
||||
(when (not= rendered-value dom-value)
|
||||
(if-not (and (identical? node ($ js/document :activeElement))
|
||||
(has-selection-api? ($ node :type))
|
||||
@ -172,18 +176,23 @@
|
||||
(when (and (some? jsprops)
|
||||
(.hasOwnProperty jsprops "onChange")
|
||||
(.hasOwnProperty jsprops "value"))
|
||||
(assert find-dom-node
|
||||
"reagent.dom needs to be loaded for controlled input to work")
|
||||
(let [v ($ jsprops :value)
|
||||
value (if (nil? v) "" v)
|
||||
on-change ($ jsprops :onChange)]
|
||||
(when (nil? ($ this :cljsInputElement))
|
||||
(when-not ($ this :cljsInputLive)
|
||||
;; set initial value
|
||||
($! this :cljsInputLive true)
|
||||
($! this :cljsDOMValue value))
|
||||
($! this :cljsRenderedValue value)
|
||||
(js-delete jsprops "value")
|
||||
(doto jsprops
|
||||
($! :defaultValue value)
|
||||
($! :onChange #(input-handle-change this on-change %))
|
||||
($! :ref #($! this :cljsInputElement %1))))))
|
||||
($! :onChange #(input-handle-change this on-change %))))))
|
||||
|
||||
(defn input-unmount [this]
|
||||
($! this :cljsInputLive nil))
|
||||
|
||||
(defn ^boolean input-component? [x]
|
||||
(case x
|
||||
@ -197,6 +206,7 @@
|
||||
(def input-spec
|
||||
{:display-name "ReagentInput"
|
||||
:component-did-update input-set-value
|
||||
:component-will-unmount input-unmount
|
||||
:reagent-render
|
||||
(fn [argv comp jsprops first-child]
|
||||
(let [this comp/*current-component*]
|
||||
@ -244,7 +254,7 @@
|
||||
($ util/react createElement c jsprops)))
|
||||
|
||||
(defn adapt-react-class [c]
|
||||
(doto (NativeWrapper.)
|
||||
(doto (->NativeWrapper)
|
||||
($! :name c)
|
||||
($! :id nil)
|
||||
($! :class nil)))
|
@ -1,7 +1,8 @@
|
||||
(ns mranderson047.reagent.v0v6v0.reagent.impl.util
|
||||
(ns mranderson047.reagent.v0v7v0.reagent.impl.util
|
||||
(:require [cljsjs.react]
|
||||
[mranderson047.reagent.v0v6v0.reagent.debug :refer-macros [dbg log warn]]
|
||||
[mranderson047.reagent.v0v6v0.reagent.interop :refer-macros [$ $!]]
|
||||
[cljsjs.create-react-class]
|
||||
[mranderson047.reagent.v0v7v0.reagent.debug :refer-macros [dbg log warn]]
|
||||
[mranderson047.reagent.v0v7v0.reagent.interop :refer-macros [$ $!]]
|
||||
[clojure.string :as string]))
|
||||
|
||||
(defonce react
|
||||
@ -10,6 +11,12 @@
|
||||
(throw (js/Error. "require('react') failed")))
|
||||
:else (throw (js/Error. "js/React is missing"))))
|
||||
|
||||
(defonce create-class
|
||||
(cond (exists? js/createReactClass) js/createReactClass
|
||||
(exists? js/require) (or (js/require "create-react-class")
|
||||
(throw (js/Error. "require('create-react-class') failed")))
|
||||
:else (throw (js/Error. "js/createReactClass is missing"))))
|
||||
|
||||
(def is-client (and (exists? js/window)
|
||||
(-> js/window ($ :document) nil? not)))
|
||||
|
||||
@ -58,17 +65,62 @@
|
||||
str
|
||||
(clojure.string/replace "$" "."))))
|
||||
|
||||
(deftype partial-ifn [f args ^:mutable p]
|
||||
(deftype PartialFn [pfn f args]
|
||||
Fn
|
||||
IFn
|
||||
(-invoke [_ & a]
|
||||
(or p (set! p (apply clojure.core/partial f args)))
|
||||
(apply p a))
|
||||
(-invoke [_]
|
||||
(pfn))
|
||||
(-invoke [_ a]
|
||||
(pfn a))
|
||||
(-invoke [_ a b]
|
||||
(pfn a b))
|
||||
(-invoke [_ a b c]
|
||||
(pfn a b c))
|
||||
(-invoke [_ a b c d]
|
||||
(pfn a b c d))
|
||||
(-invoke [_ a b c d e]
|
||||
(pfn a b c d e))
|
||||
(-invoke [_ a b c d e f]
|
||||
(pfn a b c d e f))
|
||||
(-invoke [_ a b c d e f g]
|
||||
(pfn a b c d e f g))
|
||||
(-invoke [_ a b c d e f g h]
|
||||
(pfn a b c d e f g h))
|
||||
(-invoke [_ a b c d e f g h i]
|
||||
(pfn a b c d e f g h i))
|
||||
(-invoke [_ a b c d e f g h i j]
|
||||
(pfn a b c d e f g h i j))
|
||||
(-invoke [_ a b c d e f g h i j k]
|
||||
(pfn a b c d e f g h i j k))
|
||||
(-invoke [_ a b c d e f g h i j k l]
|
||||
(pfn a b c d e f g h i j k l))
|
||||
(-invoke [_ a b c d e f g h i j k l m]
|
||||
(pfn a b c d e f g h i j k l m))
|
||||
(-invoke [_ a b c d e f g h i j k l m n]
|
||||
(pfn a b c d e f g h i j k l m n))
|
||||
(-invoke [_ a b c d e f g h i j k l m n o]
|
||||
(pfn a b c d e f g h i j k l m n o))
|
||||
(-invoke [_ a b c d e f g h i j k l m n o p]
|
||||
(pfn a b c d e f g h i j k l m n o p))
|
||||
(-invoke [_ a b c d e f g h i j k l m n o p q]
|
||||
(pfn a b c d e f g h i j k l m n o p q))
|
||||
(-invoke [_ a b c d e f g h i j k l m n o p q r]
|
||||
(pfn a b c d e f g h i j k l m n o p q r))
|
||||
(-invoke [_ a b c d e f g h i j k l m n o p q r s]
|
||||
(pfn a b c d e f g h i j k l m n o p q r s))
|
||||
(-invoke [_ a b c d e f g h i j k l m n o p q r s t]
|
||||
(pfn a b c d e f g h i j k l m n o p q r s t))
|
||||
(-invoke [_ a b c d e f g h i j k l m n o p q r s t rest]
|
||||
(apply pfn a b c d e f g h i j k l m n o p q r s t rest))
|
||||
IEquiv
|
||||
(-equiv [_ other]
|
||||
(and (= f (.-f other)) (= args (.-args other))))
|
||||
IHash
|
||||
(-hash [_] (hash [f args])))
|
||||
|
||||
(defn make-partial-fn [f args]
|
||||
(->PartialFn (apply partial f args) f args))
|
||||
|
||||
(defn- merge-class [p1 p2]
|
||||
(let [class (when-let [c1 (:class p1)]
|
||||
(when-let [c2 (:class p2)]
|
||||
@ -89,7 +141,8 @@
|
||||
(if (nil? p1)
|
||||
p2
|
||||
(do
|
||||
(assert (map? p1))
|
||||
(assert (map? p1)
|
||||
(str "Property must be a map, not " (pr-str p1)))
|
||||
(merge-style p1 (merge-class p1 (merge p1 p2))))))
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
(ns mranderson047.reagent.v0v6v0.reagent.interop
|
||||
(:require [clojure.string :as string :refer [join]]
|
||||
[clojure.java.io :as io]))
|
||||
(ns mranderson047.reagent.v0v7v0.reagent.interop
|
||||
(:require [clojure.string :as string :refer [join]]))
|
||||
|
||||
(defn- js-call [f args]
|
||||
(let [argstr (->> (repeat (count args) "~{}")
|
||||
@ -10,7 +9,7 @@
|
||||
(defn- dot-args [object member]
|
||||
(assert (or (symbol? member)
|
||||
(keyword? member))
|
||||
(str "Symbol or keyword expected, not " member))
|
||||
(str "Symbol or keyword expected, not " (pr-str member)))
|
||||
(assert (or (not (symbol? object))
|
||||
(not (re-find #"\." (name object))))
|
||||
(str "Dot not allowed in " object))
|
||||
@ -55,21 +54,3 @@
|
||||
(let [[field names] (dot-args object field)]
|
||||
(assert field (str "Field name must start with - in " field))
|
||||
`(aset ~object ~@names ~value)))
|
||||
|
||||
(defmacro .' [& args]
|
||||
;; Deprecated since names starting with . cause problems with bootstrapped cljs.
|
||||
(let [ns (str cljs.analyzer/*cljs-ns*)
|
||||
line (:line (meta &form))]
|
||||
(binding [*out* *err*]
|
||||
(println "WARNING: mranderson047.reagent.v0v6v0.reagent.interop/.' is deprecated in " ns " line " line
|
||||
". Use mranderson047.reagent.v0v6v0.reagent.interop/$ instead.")))
|
||||
`($ ~@args))
|
||||
|
||||
(defmacro .! [& args]
|
||||
;; Deprecated since names starting with . cause problems with bootstrapped cljs.
|
||||
(let [ns (str cljs.analyzer/*cljs-ns*)
|
||||
line (:line (meta &form))]
|
||||
(binding [*out* *err*]
|
||||
(println "WARNING: mranderson047.reagent.v0v6v0.reagent.interop/.! is deprecated in " ns " line " line
|
||||
". Use mranderson047.reagent.v0v6v0.reagent.interop/$! instead.")))
|
||||
`($! ~@args))
|
2
src/mranderson047/reagent/v0v7v0/reagent/interop.cljs
Normal file
2
src/mranderson047/reagent/v0v7v0/reagent/interop.cljs
Normal file
@ -0,0 +1,2 @@
|
||||
(ns mranderson047.reagent.v0v7v0.reagent.interop
|
||||
(:require-macros [mranderson047.reagent.v0v7v0.reagent.interop]))
|
@ -1,21 +1,23 @@
|
||||
(ns mranderson047.reagent.v0v6v0.reagent.ratom
|
||||
(ns mranderson047.reagent.v0v7v0.reagent.ratom
|
||||
(:refer-clojure :exclude [run!])
|
||||
(:require [mranderson047.reagent.v0v6v0.reagent.debug :as d]))
|
||||
(:require [mranderson047.reagent.v0v7v0.reagent.debug :as d]))
|
||||
|
||||
(defmacro reaction [& body]
|
||||
`(mranderson047.reagent.v0v6v0.reagent.ratom/make-reaction
|
||||
`(mranderson047.reagent.v0v7v0.reagent.ratom/make-reaction
|
||||
(fn [] ~@body)))
|
||||
|
||||
(defmacro run!
|
||||
"Runs body immediately, and runs again whenever atoms deferenced in the body change. Body should side effect."
|
||||
[& body]
|
||||
`(let [co# (mranderson047.reagent.v0v6v0.reagent.ratom/make-reaction (fn [] ~@body)
|
||||
`(let [co# (mranderson047.reagent.v0v7v0.reagent.ratom/make-reaction (fn [] ~@body)
|
||||
:auto-run true)]
|
||||
(deref co#)
|
||||
co#))
|
||||
|
||||
(defmacro with-let [bindings & body]
|
||||
(assert (vector? bindings))
|
||||
(assert (vector? bindings)
|
||||
(str "with-let bindings must be a vector, not "
|
||||
(pr-str bindings)))
|
||||
(let [v (gensym "with-let")
|
||||
k (keyword v)
|
||||
init (gensym "init")
|
||||
@ -35,14 +37,14 @@
|
||||
[body nil]))
|
||||
add-destroy (when destroy
|
||||
`(let [destroy# ~destroy]
|
||||
(if (mranderson047.reagent.v0v6v0.reagent.ratom/reactive?)
|
||||
(if (mranderson047.reagent.v0v7v0.reagent.ratom/reactive?)
|
||||
(when (nil? (.-destroy ~v))
|
||||
(set! (.-destroy ~v) destroy#))
|
||||
(destroy#))))
|
||||
asserting (if *assert* true false)]
|
||||
`(let [~v (mranderson047.reagent.v0v6v0.reagent.ratom/with-let-values ~k)]
|
||||
`(let [~v (mranderson047.reagent.v0v7v0.reagent.ratom/with-let-values ~k)]
|
||||
(when ~asserting
|
||||
(when-some [c# mranderson047.reagent.v0v6v0.reagent.ratom/*ratom-context*]
|
||||
(when-some [c# mranderson047.reagent.v0v7v0.reagent.ratom/*ratom-context*]
|
||||
(when (== (.-generation ~v) (.-ratomGeneration c#))
|
||||
(d/error "Warning: The same with-let is being used more "
|
||||
"than once in the same reactive context."))
|
@ -1,9 +1,9 @@
|
||||
(ns mranderson047.reagent.v0v6v0.reagent.ratom
|
||||
(ns mranderson047.reagent.v0v7v0.reagent.ratom
|
||||
(:refer-clojure :exclude [atom])
|
||||
(:require-macros [mranderson047.reagent.v0v6v0.reagent.ratom :refer [with-let]])
|
||||
(:require [mranderson047.reagent.v0v6v0.reagent.impl.util :as util]
|
||||
[mranderson047.reagent.v0v6v0.reagent.debug :refer-macros [dbg log warn error dev? time]]
|
||||
[mranderson047.reagent.v0v6v0.reagent.impl.batching :as batch]
|
||||
(:require-macros [mranderson047.reagent.v0v7v0.reagent.ratom :refer [with-let]])
|
||||
(:require [mranderson047.reagent.v0v7v0.reagent.impl.util :as util]
|
||||
[mranderson047.reagent.v0v7v0.reagent.debug :refer-macros [dbg log warn error dev? time]]
|
||||
[mranderson047.reagent.v0v7v0.reagent.impl.batching :as batch]
|
||||
[clojure.set :as s]))
|
||||
|
||||
(declare ^:dynamic *ratom-context*)
|
||||
@ -162,8 +162,8 @@
|
||||
|
||||
(defn atom
|
||||
"Like clojure.core/atom, except that it keeps track of derefs."
|
||||
([x] (RAtom. x nil nil nil))
|
||||
([x & {:keys [meta validator]}] (RAtom. x meta validator nil)))
|
||||
([x] (->RAtom x nil nil nil))
|
||||
([x & {:keys [meta validator]}] (->RAtom x meta validator nil)))
|
||||
|
||||
|
||||
;;; track
|
||||
@ -306,7 +306,7 @@
|
||||
(not (vector? src))))
|
||||
(str "src must be a reactive atom or a function, not "
|
||||
(pr-str src)))
|
||||
(RCursor. src path nil nil nil))
|
||||
(->RCursor src path nil nil nil))
|
||||
|
||||
|
||||
;;; with-let support
|
||||
@ -354,7 +354,7 @@
|
||||
|
||||
IReset
|
||||
(-reset! [a newval]
|
||||
(assert (fn? (.-on-set a)) "Reaction is read only.")
|
||||
(assert (fn? (.-on-set a)) "Reaction is read only; on-set is not allowed")
|
||||
(let [oldval state]
|
||||
(set! state newval)
|
||||
(.on-set a oldval newval)
|
||||
@ -486,7 +486,7 @@
|
||||
|
||||
|
||||
(defn make-reaction [f & {:keys [auto-run on-set on-dispose]}]
|
||||
(let [reaction (Reaction. f nil true false nil nil nil nil)]
|
||||
(let [reaction (->Reaction f nil true false nil nil nil nil)]
|
||||
(._set-opts reaction {:auto-run auto-run
|
||||
:on-set on-set
|
||||
:on-dispose on-dispose})
|
||||
@ -563,9 +563,9 @@
|
||||
(-pr-writer [a w opts] (pr-atom a w opts "Wrap:")))
|
||||
|
||||
(defn make-wrapper [value callback-fn args]
|
||||
(Wrapper. value
|
||||
(util/partial-ifn. callback-fn args nil)
|
||||
false nil))
|
||||
(->Wrapper value
|
||||
(util/make-partial-fn callback-fn args)
|
||||
false nil))
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user