Skip to content

Commit

Permalink
Merge pull request #42 from stuarth/macro-fixes
Browse files Browse the repository at this point in the history
macros use rum.core ns
  • Loading branch information
tonsky committed Sep 21, 2015
2 parents f24915e + 353e66e commit 3665d78
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/rum/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
render-fn (map compile-body bodies)]
`(def ~name ~doc
(let [render-mixin# (~render-ctor (fn ~@render-fn))
class# (rum/build-class (concat [render-mixin#] ~mixins) ~(str name))
class# (rum.core/build-class (concat [render-mixin#] ~mixins) ~(str name))
ctor# (fn [& args#]
(let [state# (args->state args#)]
(rum/element class# state# nil)))]
(rum.core/element class# state# nil)))]
(with-meta ctor# {:rum/class class#})))))

(defmacro defc
Expand All @@ -51,7 +51,7 @@
(defc name doc-string? [< mixins+]? [params*] render-body+)"
[& body]
(-defc 'rum/render->mixin body))
(-defc 'rum.core/render->mixin body))

(defmacro defcs
"Same as defc, but render will take additional first argument: state
Expand All @@ -60,7 +60,7 @@
(defcs name doc-string? [< mixins+]? [state params*] render-body+)"
[& body]
(-defc 'rum/render-state->mixin body))
(-defc 'rum.core/render-state->mixin body))

(defmacro defcc
"Same as defc, but render will take additional first argument: react component
Expand All @@ -69,15 +69,15 @@
(defcc name doc-string? [< mixins+]? [comp params*] render-body+)"
[& body]
(-defc 'rum/render-comp->mixin body))
(-defc 'rum.core/render-comp->mixin body))

(defmacro with-props
"DEPRECATED. Use rum/with-key and rum/with-ref functions
"DEPRECATED. Use rum.core/with-key and rum.core/with-ref functions
Calling function returned by defc will get you component. To specify
special React properties, create component using with-props:
(rum/with-props <ctor> <arg1> <arg2> :rum/key <key>)
(rum.core/with-props <ctor> <arg1> <arg2> :rum/key <key>)
Special properties goes at the end of arguments list and should be namespaced.
For now only :rum/key and :rum/ref are supported"
Expand All @@ -88,6 +88,6 @@
ps (->> (drop-while #(not (props %)) args)
(partition 2)
(mapcat (fn [[k v]] [(props k) v])))]
`(rum/element (ctor->class ~ctor) (args->state [~@as]) (cljs.core/js-obj ~@ps))))
`(rum.core/element (ctor->class ~ctor) (args->state [~@as]) (cljs.core/js-obj ~@ps))))


0 comments on commit 3665d78

Please sign in to comment.