Dan Holmsand
1d1552960c
Start testing warnings from components
2015-10-07 20:38:19 +02:00
Dan Holmsand
7f189d7595
Fix lifecycle test
2015-10-07 19:58:00 +02:00
Dan Holmsand
ec769d0c3c
Print function names instead of source in warnings/errors
2015-10-07 19:50:29 +02:00
Dan Holmsand
e79132c1f3
Always queue updates in reactions, even when flushing
2015-10-07 11:32:42 +02:00
Dan Holmsand
e6b32c6aee
Allow raw React classes to be used with [:> comp ...]
2015-10-06 14:27:44 +02:00
Dan Holmsand
533c05aaca
Allow output from create-class to be used directly by React
2015-10-06 12:49:47 +02:00
Dan Holmsand
de1e4d4ad5
Get rid of silent in ratom
...
And some small cleanup
2015-10-04 12:53:23 +02:00
Dan Holmsand
d0f480f3f2
Remove hack to support sync reactions
...
It became too messy, risky and confusing to be worth it.
2015-09-30 09:40:57 +02:00
Dan Holmsand
3fca2e5d41
Make reactions async by queueing changes instead
...
Reactions now put themselves in a queue when they get a
callback from an atom. The queue is flushed before rendering, and
on deref on individual reactions.
This turns out to perform much better in many cases.
2015-09-30 08:56:06 +02:00
Dan Holmsand
6e3a2b415d
Fix stupid with-let bug
2015-09-27 00:07:19 +02:00
Dan Holmsand
415ecd64fd
Simplify with-let and tweak performance
2015-09-26 13:12:59 +02:00
Dan Holmsand
5fceda2aae
Add tests for lifecycle methods
2015-09-25 13:44:10 +02:00
Dan Holmsand
64d1e11966
Add obj and munging to interop
...
.' and .! now behaves just like builtin interop, except that
they work the same under advanced compilation.
2015-09-25 11:48:50 +02:00
Dan Holmsand
55a4b4e1df
Omit tests running in node
2015-09-25 11:48:11 +02:00
Dan Holmsand
e4fee70ac2
Add support for trapping warning/error messages
...
And use in test for with-let
2015-09-24 17:02:18 +02:00
Dan Holmsand
cfcf356743
Add track, track!, dispose! and with-let to core
2015-09-24 10:19:30 +02:00
Dan Holmsand
034ffa6b7f
More tests for with-let
2015-09-24 09:23:21 +02:00
Dan Holmsand
28d454ece9
Include size of cached reactions in tests
2015-09-24 07:48:03 +02:00
Dan Holmsand
e1585f6730
Add more with-let tests, and fix dispose bug
2015-09-23 19:40:19 +02:00
Dan Holmsand
9163695832
Start adding more tests for with-let
2015-09-23 17:02:48 +02:00
Dan Holmsand
119fbfe173
Add a couple of more tests for with-let
2015-09-23 15:55:57 +02:00
Dan Holmsand
51163c1d07
Rename to with-let, add basic test
2015-09-23 10:39:49 +02:00
Dan Holmsand
a73761e72e
Warn if the same with-kept is used more than once
2015-09-21 10:49:43 +02:00
Dan Holmsand
6c9f71e511
Rename testmonitor
2015-09-19 19:03:29 +02:00
Dan Holmsand
ca5ce00c34
Rename monitor -> track, and monitor! -> track!
2015-09-19 16:49:13 +02:00
Dan Holmsand
54ca0f927f
Make monitor! run immediately
...
and async reaction not schedule anything from start
2015-09-15 18:11:36 +02:00
Dan Holmsand
87758ae396
Extend test for rswap!
2015-09-14 19:39:44 +02:00
Dan Holmsand
e11c881aa7
Add rswap!
...
Works just like swap!, except that it allows recursive swaps on
the same atom, and it always returns nil.
2015-09-14 19:35:48 +02:00
Dan Holmsand
8e7624ea45
Add a test for monitor!
2015-09-14 18:14:13 +02:00
Dan Holmsand
d362e0a26c
Mix calling style a bit in tests
2015-09-14 13:34:54 +02:00
Dan Holmsand
e05c74e6a5
More tests for monitor
2015-09-14 09:09:04 +02:00
Dan Holmsand
b0d86598ce
Start to add tests for monitor
2015-09-13 20:31:31 +02:00
Dan Holmsand
ee72c60d3a
Start implementing monitor
2015-09-13 18:17:38 +02:00
Dan Holmsand
e12716da5d
Log caught errors instead of rethrowing
2015-09-13 14:30:19 +02:00
Dan Holmsand
04daf6ac57
Exceptions from reactions are now thrown on deref only
2015-09-13 11:00:46 +02:00
Dan Holmsand
b036cf938e
Complete async testing
2015-09-12 19:13:31 +02:00
Dan Holmsand
544a3339d0
Start testing async reaction
2015-09-12 18:34:10 +02:00
Dan Holmsand
b0395b5461
Make reaction notify only when it actually changes
2015-09-11 20:37:23 +02:00
Dan Holmsand
b1acdea090
Use lazy reactions in components
2015-09-11 15:06:42 +02:00
Dan Holmsand
f785362b46
Some cleanup
2015-09-10 21:27:02 +02:00
Dan Holmsand
0b77d9af31
Get rid of active?
2015-09-10 20:51:09 +02:00
Dan Holmsand
80a3c27fac
Some performance tweaking
2015-09-10 18:30:00 +02:00
Dan Holmsand
e09534c8cd
Experiment with alternative to set
2015-09-10 17:40:55 +02:00
Dan Holmsand
c4cd8c2921
wip: tests pass
2015-08-31 11:36:42 +02:00
Dan Holmsand
be7bb69548
wip
2015-08-31 10:59:59 +02:00
Dan Holmsand
6c345db29e
Now almost working
2015-08-31 10:39:17 +02:00
Dan Holmsand
1782ff1832
wip - not working
2015-08-31 10:05:53 +02:00
Dan Holmsand
b77b182d67
Work around clojurescript problem with sorted-maps
2015-08-31 08:18:45 +02:00
Dan Holmsand
3defd24c35
Add a test for component-path
2015-08-30 18:29:27 +02:00
Dan Holmsand
eed924311e
Add force-update
2015-08-20 14:59:13 +02:00
Dan Holmsand
5d24b9be65
Deprecate calling the result of create-class as a function
...
In the future, I'd like to make it possible to use Reagent classes
usable directly from React, in order to make interop easier.
2015-08-20 09:35:24 +02:00
Dan Holmsand
a979a36a92
Drop test for key warning
...
React will sometimes warn, even if we don't.
Also, small fix for async demo.
2015-08-19 10:14:02 +02:00
Dan Holmsand
51048c7a7f
Avoid unnecessary warning about missing :key
...
:key is not necessary in seqs in render-to-string et al.
2015-07-31 16:18:51 +02:00
Dan Holmsand
b2210c2bf3
atom -> r/atom everywhere else, for consistency
2015-07-31 15:13:27 +02:00
Dan Holmsand
2628edabf8
Add tests for extended hiccup syntax
2015-07-30 20:26:16 +02:00
Stephen Caraher
e8cd105348
add test for cursor variadic swap!
2015-07-23 23:10:35 +10:00
Stephen Caraher
1363e05e62
add test for atom and wrapper variadic swap!
2015-07-23 22:54:46 +10:00
Dan Holmsand
569322949b
Take advantage of new figwheel
2015-05-31 11:51:11 +02:00
Dan Holmsand
cdd3c851a0
Fix cursor bug
...
Cursor wasn't updated when changing both the cursor and an
underlying atom at once.
2015-05-25 21:31:43 +02:00
Dan Holmsand
767410d8d8
Update clojurescript, figwheel and cljsbuild.
...
Stop using :figwheel-always, that seems to be broken in the new
figwheel.
2015-03-21 13:53:37 +01:00
Dan Holmsand
7568b6843e
Support running site in dev mode without tests
2015-02-11 19:06:38 +01:00
Dan Holmsand
526dfa61ea
Make swap! on non-active Reaction correct
2015-02-11 06:38:57 +01:00
Dan Holmsand
73d0478607
Simplify setup of doc site and testing
...
Take advantage of figwheel 0.2.3
2015-02-10 18:20:48 +01:00
Dan Holmsand
163308a392
Make site and examples work with ClojureScript 2816
...
ClojureScript all of a sudden complains about "single segment
namespaces", which forces a rather massive reorg.
Also, cljs.test/run-tests is broken.
2015-02-10 14:35:12 +01:00
Dan Holmsand
8feaccca88
Add IReactiveAtom type, and use in cursor asserts
2015-02-09 13:19:12 +01:00
Dan Holmsand
a2b5acb68f
Make warning for missing keys print data
...
That will hopefully make finding the offending code easier
to find.
2015-02-08 12:24:52 +01:00
Dan Holmsand
8b5905c9e1
Add reactify-component: adapts Reagent component for use in JSX
2015-02-08 00:04:45 +01:00
Dan Holmsand
017fa9c106
Rename :component-function to :reagent-render
...
But keep :component-function as alias for the time being
2015-02-04 22:45:39 +01:00
Dan Holmsand
c862792624
Revert experiment with lazy reaction
...
Needs more surgery to get this to work properly
2015-02-04 22:14:04 +01:00
Dan Holmsand
d39656624d
Make Reaction and cursors lazy
...
Their value will now only be calculated as needed (i.e when deref
is called), which should make debugging them much easier.
This also makes updating the atom they are relying on cheaper.
2015-02-04 16:03:35 +01:00
Dan Holmsand
15acc0d6ff
Added adapt-react-class
2015-02-02 15:19:43 +01:00
Dan Holmsand
6e0e9ed564
Make wrap watchable
2015-02-01 19:43:26 +01:00
Dan Holmsand
83fd1361df
Remove bundled React
...
No longer needed, since we use cljsjs/react instead.
Also remove obsolete interop macros, and some general cleanup
2015-02-01 15:13:08 +01:00
Dan Holmsand
744165737f
Make Reaction always call watches
...
Even if it is not executed automatically
2015-02-01 00:41:59 +01:00
Dan Holmsand
dfd3e540f3
Use cljs.test
2015-01-31 23:09:42 +01:00
Dan Holmsand
6d9bb35996
Deprecate calling cursor with atom as second argument
2015-01-31 14:29:01 +01:00
Dan Holmsand
86bf871329
Swap order of arguments to cursor
...
So now it should be called as (r/cursor atom path). The old order
still works though.
2015-01-31 14:08:19 +01:00
Dan Holmsand
976d8ba4f6
Make cursor more general and flexible
...
Instead of passing an atom, you can now pass a function.
That function is passed one argument (the path provided to cursor)
when deref-ing, and two arguments (path and new value) when
resetting.
Remove the old setter, and the currying version.
2015-01-31 13:32:48 +01:00
Dan Holmsand
a28dc812ae
Check for memory leaks
2015-01-31 12:22:53 +01:00
Dan Holmsand
00b5c1d330
Add tests from reagent-cursor
2015-01-31 11:01:35 +01:00
Dan Holmsand
0e7f5518c0
Allow deref of Reaction outside active Reaction
2015-01-30 21:20:02 +01:00
Dan Holmsand
0e8ca42a37
Add test for force-update-all
2014-12-09 12:58:30 +01:00
Dan Holmsand
fc2c59c3e1
Add docs for create-element, and one-argument version
...
And add a fix for the benefit of Light Table
2014-12-07 20:26:29 +01:00
Dan Holmsand
1a2417a14b
Fix tests when macros change
2014-12-07 16:38:28 +01:00
Dan Holmsand
0215a4a093
Make browser tests clean up after themselves properly
2014-12-03 16:14:07 +01:00
Dan Holmsand
e193518292
Add a few more tests for wrap
2014-12-03 16:07:58 +01:00
Dan Holmsand
7a035387b7
Add a few tests for wrap
2014-12-03 14:50:03 +01:00
Dan Holmsand
0a8bc67d5f
Introduce create-element
2014-12-02 11:44:42 +01:00
Dan Holmsand
723a1aa379
Really make advanced mode tests work
2014-11-29 23:47:57 +01:00
Dan Holmsand
17375490fe
Got site generation and tests working with advanced compilation
2014-11-29 23:26:42 +01:00
Dan Holmsand
bffbae231d
Reorganize build, tests and doc site
...
Tests and doc site can now run without node, using only
"lein figwheel". Tests and site are then re-run automatically
whenever a source file changes.
The doc site is now generated into "outsite/public", and can be
copied into the "gh-pages" branch with "make build-gh-pages".
"make push-gh-pages" builds the doc site and pushes it upstream
to the gh-pages branch there.
Generation of html pages is now handled completely in
ClojureScript, loaded from "bin/gen-site.js".
Link handling is a bit simplified.
2014-11-29 18:30:24 +01:00
Dan Holmsand
3bf98230ca
Merge branch 'morecursor'
2014-11-23 21:09:56 +01:00
Dan Holmsand
7244ffc25d
Add test for wrap
2014-11-22 11:08:17 +01:00
Dan Holmsand
f94fcd5542
Add equality test for cursor
2014-11-22 10:45:36 +01:00
Dan Holmsand
6b87349d88
Make sure returning new class from render works
2014-11-22 09:42:31 +01:00
Dan Holmsand
02ffe6bcfa
Update cursor test
2014-11-13 19:58:56 +01:00
Dan Holmsand
3f696a3922
Make sure render-to-string etc work better in a browser
...
Previously, they would be reactive, which could lead to all
kinds of strangeness.
Also fix pesky Closure warning.
2014-11-06 19:18:56 +01:00
Dan Holmsand
12d475fc62
Introduce render, render-to-string and render-to-static-markup
...
The new names correspond to changes in React in 0.12.0.
Both render-component and render-component-to-string are kept for
backward compatibility.
Call React.render etc to avoid deprecation warnings from React.
2014-11-06 11:34:51 +01:00
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