Commit Graph

117 Commits

Author SHA1 Message Date
Dan Holmsand a1a244e573 Merge branch 'master' of https://github.com/seancorfield/reagent 2014-10-20 13:29:19 +02:00
Dan Holmsand 6ce5bc16f5 Add test for null component return 2014-09-16 16:31:29 +02:00
Sean Corfield 5d2fc0254e Add cursor support.
Adds RCursor type: wraps Reagent's RAtom along with a path that provides focus into a specific part of that atom.

Adds reagent.ratom/cursor as a constructor for the RCursor type.

Adds reagent.core/cursor as the public API. This can be called with just a path, and returns a function that accepts a Reagent atom, or with both a path and an atom.

Dereferences of a cursor behave like get-in on the underlying atom with the specified path.

If you reset! a cursor, it behaves like a swap! assoc-in on the underlying atom. If swap! a cursor, it behaves like a swap! update-in on the underlying atom.
2014-09-08 19:31:05 -07:00
Dan Holmsand 429ed50fab Make demo code more Light Table-friendly 2014-04-01 19:50:28 +02:00
Dan Holmsand 4060bfc6fe Simplify the fvar macro 2014-04-01 15:17:33 +02:00
Dan Holmsand 2e0e369d93 Use new javascript interop macros 2014-03-25 12:37:28 +01:00
Dan Holmsand 976cf8ef0b Add fvar macro 2014-03-25 11:33:15 +01:00
Dan Holmsand 6389a3889a Add better javascript interop macros 2014-03-25 07:58:22 +01:00
Dan Holmsand 907a85db9c Update React to 0.10.0 2014-03-25 06:23:44 +01:00
Dan Holmsand 0f2136d4b4 Allow render-component to take a function returning a component 2014-03-18 16:43:19 +01:00
Dan Holmsand ba995c2e0d Add force-update-all, to make LightTable integration easier
force-update-all re-mounts all root components, and makes all
their children re-render.
2014-03-18 13:09:55 +01:00
Dan Holmsand 82a1dd73eb Make javascript interop macros more like aset and aget
Drop js-global, probably not worth the trouble
2014-03-17 12:02:26 +01:00
Dan Holmsand e21e58e509 Rename jget to get. etc 2014-03-14 11:45:44 +01:00
Dan Holmsand 8b59d1509b Add macros for more convenient javascript interop 2014-03-14 10:27:49 +01:00
Jacob Maine 6302c8ecd6 Make multimethods work as component functions.
This is actually a bug in ClojureScript
(http://dev.clojure.org/jira/browse/CLJS-777).  In regular Clojure a
`MultiFn` is `ifn?`, but in ClojureScript it wasn't.  The bug is now
fixed
(525154f2a4)
but not yet released.

This code can be reverted after Reagent's ClojureScript version is
updated.
2014-03-03 17:55:40 +02:00
Dan Holmsand 2bb32eb21f Make set-state etc async as well, by using an atom 2014-02-15 11:57:52 +01:00
Dan Holmsand b2bfc14afb Move test code for partial 2014-02-14 11:27:45 +01:00
Dan Holmsand b041427e94 Allow Hiccup tags to be strings and symbols as well 2014-02-11 12:03:44 +01:00
Dan Holmsand ed4cf4e389 Allow component functions to be anything that satisfies ifn? 2014-02-11 11:36:58 +01:00
Dan Holmsand 805264ea61 Warn on deref in seqs instead of silently failing
Use warning to improve color palette demo
Fix page title
Move more code to util.cljs
2014-02-10 23:54:30 +01:00
Dan Holmsand 8f1c02b273 Render without allocating ratom unless necessary 2014-02-10 15:29:38 +01:00
Dan Holmsand 16a41f67e4 Remove replace-args
Probably not very useful, and easy to add back if need be
2014-02-10 09:31:25 +01:00
Dan Holmsand 3c2c63402e Breaking change: Allow arbitrary arguments to component functions
Previously, the first argument had to be a map, and the rest of the
arguments where passed as a vector as the second argument.

Now [my-comp foo...] generally behaves as (my-comp foo...).

Since `this` is no longer passed to component functions, add
current-component function.

Also change signatures of React callbacks, to reflect that arbitrary
arguments can be passed.

Remove set-props and replace-props for the same reason.

Add argv accessor and set-args instead.
2014-02-08 13:55:01 +01:00
Dan Holmsand aca69347b7 Merge branch 'delayed'
Conflicts:
	src/reagent/impl/template.cljs
2014-02-03 14:07:02 +01:00
Dan Holmsand e7f066177b Make sure changes to state in render fn don't cause disaster 2014-02-03 13:58:31 +01:00
Dan Holmsand d3407ff664 Consider symbols to be "identical"
And test some more obscure should-component-update variants.
2014-01-30 10:34:41 +01:00
Dan Holmsand d1851d5a42 Allow dynamic id with hiccup-style classes
And id in props wins over static id.

Fixes #11
2014-01-28 18:00:15 +01:00
Dan Holmsand 8b4ec9fda6 Make managed inputs work better with async rendering 2014-01-28 17:23:39 +01:00
Dan Holmsand dfe0eb41d5 Batch updates properly by rendering parents before children 2014-01-27 16:17:37 +01:00
Dan Holmsand eb381f13bb Start experimenting with batched rendering with requestAnimationFrame 2014-01-27 13:37:59 +01:00
Dan Holmsand 23a5f80197 Fix test-running under advanced compilation
Turns out that clojurescript.test breaks unless the test
directory is included first, but only with advanced compilation
and only on the first run...
2014-01-25 17:02:58 +01:00
Dan Holmsand f9d0b58af8 Allow data-* and aria-* attrs, pass string attrs as-is to React 2014-01-25 13:47:41 +01:00
Dan Holmsand 8110b1aca8 Tweak demo and testing 2014-01-24 11:03:01 +01:00
Dan Holmsand 8e542292a2 Cloact -> Reagent 2014-01-17 11:12:11 +01:00
Dan Holmsand fb7310870a Fix test-running in advanced compilation 2014-01-10 14:27:59 +01:00
Dan Holmsand 94cdfd6a2f Move demo to separate directory 2014-01-10 11:49:36 +01:00
Dan Holmsand 97799ae63c Improve demo a bit 2014-01-09 14:37:11 +01:00
Dan Holmsand c0744c7fed Call render functions with props, children, component 2014-01-08 16:51:10 +01:00
Dan Holmsand 6bf6b3f7d4 More cleanup
todomvc is now down to 87 lines!
2014-01-08 16:34:36 +01:00
Dan Holmsand 176f7b885c Make ratom macros less fancy 2014-01-07 20:32:00 +01:00
Dan Holmsand 53fef42768 Breaking change: Stop implementing IDeref in cloact components
Introduce set-state, replace-state and state functions instead.

Since we already have our own atom, it doesn't make any sense
to duplicate functionality. Also, the implementation was necessarily
very messy, and fragile.
2014-01-07 19:57:40 +01:00
Dan Holmsand 00317991ee More docs 2014-01-07 17:01:28 +01:00
Dan Holmsand 062fb33cb3 Make demo a little prettier 2014-01-07 12:45:08 +01:00
Dan Holmsand f9e0dfe4b3 Syntaxify comments 2014-01-06 22:27:22 +01:00
Dan Holmsand 2c093bf47c Simplify example by not trying to be fancy 2014-01-06 20:58:39 +01:00
Dan Holmsand c159984024 Include examples and tests in demo page 2014-01-06 19:16:53 +01:00
Dan Holmsand 3dc2c0950a Refactor demo 2014-01-06 12:46:58 +01:00
Dan Holmsand d16d0b2405 Color parens of different levels differently 2014-01-05 15:52:51 +01:00
Dan Holmsand 5031284e81 Improve syntax highlighting a little 2014-01-05 14:47:06 +01:00
Dan Holmsand 62322c474f Add a couple of asserts, and a link 2014-01-05 13:29:22 +01:00
Dan Holmsand 2c2dca026c Generate demo page 2014-01-05 11:16:01 +01:00
Dan Holmsand 93759f6043 Improve demo a little 2014-01-04 15:05:42 +01:00
Dan Holmsand 0f45462034 One more example 2014-01-04 10:56:21 +01:00
Dan Holmsand 7381678bc2 Use :key in example, and explain why 2014-01-03 16:52:05 +01:00
Dan Holmsand af45084966 Remove support for refs for now
It shouldn't be necessary for Cloact, since we can share data
between components using atoms. And it was broken and untested
anyway...
2014-01-03 16:40:10 +01:00
Dan Holmsand 059e190841 Document render-component 2014-01-03 15:52:18 +01:00
Dan Holmsand dc6b50e864 Documentation for atom 2014-01-03 13:22:41 +01:00
Dan Holmsand 21823e12d0 Started writing some documentation 2014-01-03 10:56:15 +01:00
Dan Holmsand 1bb8f7e3e9 Add simple syntax highlighting 2014-01-02 17:45:31 +01:00
Dan Holmsand 3aa5f57c05 Add BMI-calculator 2014-01-02 16:18:21 +01:00
Dan Holmsand 454a7af31d Start on docs and demos 2014-01-02 14:04:30 +01:00
Dan Holmsand c26d3550f4 Make test work with node 2013-12-18 12:14:57 +01:00
Dan Holmsand 88d6361540 Make to-string more convenient 2013-12-18 09:13:16 +01:00
Dan Holmsand 6191a4c0bc Add some animation to todomvc 2013-12-17 22:25:11 +01:00
Dan Holmsand 59333443a7 Simplify the few tests we have 2013-12-17 13:25:21 +01:00
Dan Holmsand 89e7392269 Compare state with identical? in shouldComponentUpdate
And fix render bug
2013-12-17 12:26:23 +01:00
Dan Holmsand 12566ced7b Initial version 2013-12-16 23:19:36 +01:00