Juho Teperi
bc677736ed
Merge pull request #283 from viebel/master
...
Make reagent self-host compatible
2017-05-19 20:07:59 +03:00
Juho Teperi
18cb1468a6
Update to React 15.5, use create-react-class
...
Fixes #292
2017-05-19 19:30:38 +03:00
Juho Teperi
93043e86c4
Throw error instead of assert false
2017-03-11 01:35:14 +02:00
Juho Teperi
82c4013a29
Use deftype constrcutor functions instead of interop, replaces #144
2017-03-11 01:19:35 +02:00
Yehonathan Sharvit
5f4f9a06aa
remove deprecated code in interop.clj
2017-01-02 09:06:03 +02:00
Yehonathan Sharvit
cb72f2172f
Update interop.clj
2016-12-29 23:45:25 +02:00
Juho Teperi
9d6359d816
Update to React 15.4.0 and drop dom-server functions from core
2016-11-17 02:11:35 +02:00
Yehonathan Sharvit
7603ab8a8c
remove java.io
2016-10-30 01:30:37 +03:00
Dan Holmsand
b65afde4d7
Use dom-node from reagent.dom in template
...
And make sure we don't try to access unmounted component's dom
node.
2016-09-16 12:14:10 +02:00
Juho Teperi
0303c6ddef
Use findDOMNode instead of ref to manage ReagentInput
2016-09-14 23:11:51 +03:00
Juho Teperi
b4ec13f003
Fix #259 : Call original ref in ReagentInput
2016-09-13 15:15:39 +03:00
Dan Holmsand
42ba1662cb
Fix lost onChange events on IE11
...
IE11 doesn't report onChange on every change, so we cannot trust
that the input elements value in in sync with what is reported.
To solve this keep track of the last known value of the input,
and only consult the input value when necessary.
2016-07-14 08:34:36 +02:00
Dan Holmsand
e89cad7c4c
Merge branch 'master' of https://github.com/sir-pinecone/reagent
2016-06-08 21:06:26 +02:00
Dan Holmsand
fed05ab7cd
Merge branch 'master' of https://github.com/yayitswei/reagent
2016-06-08 20:59:24 +02:00
Dan Holmsand
bb2faefcbe
Move add-on-dispose! to IDisposable
...
And pass the reaction to the dispose function.
2016-06-07 16:35:17 +02:00
Dan Holmsand
30c9402fe9
Add note about lazy cursors.
2016-06-07 16:23:13 +02:00
Dan Holmsand
1280f58201
Make sure after-render fn is called immediately after render
...
when after-render is called during rendering. This should happen both
if the render is a part of the normal rendering loop, or if it is
triggered by render or force-update.
2016-05-31 23:09:43 +02:00
Dan Holmsand
a4faf372fe
Clarify after-render doc string
2016-05-31 18:01:48 +02:00
Dan Holmsand
ff48b3653d
Clean up circular dependency avoidance
2016-05-27 11:35:31 +02:00
Dan Holmsand
072cce4844
Add add-on-dispose! to Reaction
2016-05-26 17:41:30 +02:00
Dan Holmsand
9681dd4dbf
Slightly better error message if React module is missing
...
Make sure to throw error even if asserts are disabled
2016-05-02 20:38:18 +02:00
Dan Holmsand
14366ccce3
Flush ratom queue before rendering
...
Make sure outstanding reactions etc are up-to-date.
2016-05-02 20:18:58 +02:00
Dan Holmsand
86b98dcdba
Make ratom-flush placeholder function a simple fn
2016-05-02 09:37:16 +02:00
Dan Holmsand
e128117788
Improve exception-handling in reactions
...
Make sure exceptions in children of reactions don't end up
being caught in the reaction itself.
2016-05-01 13:09:12 +02:00
Dan Holmsand
1d912f0eaf
Make sure force-update flushes queued reactions
2016-04-30 14:24:18 +02:00
Dan Holmsand
995acb6c34
Make reaction with error always throw on deref
2016-04-30 13:56:00 +02:00
Dan Holmsand
404ed67734
Import ReactDOM and ReactDOMServer lazily
...
This should allow the use of require to be optimized away when
using advanced compilation in e.g React native and node.
2016-04-30 11:34:48 +02:00
Dan Holmsand
9631021da7
Make sure reactions continue to run after throw
2016-04-29 20:42:05 +02:00
Dan Holmsand
37b2954c3a
Allow symbols, keywords and arbitrary cljs objects in markup
...
React no longer defaults to applying toString, and instead throws
confusing error messages when it encounters non-element objects.
This should make that happen less often.
2016-04-29 09:26:06 +02:00
Dan Holmsand
f76bce6a2f
Delay error reporting of missing ReactDOM[Server]
...
This should improve error messages, and allow Reagent to be used
without ReactDOM[Server] being present at all.
2016-02-24 13:34:26 +01:00
Wei Hsu
85fbff060c
Fix comment typos
2016-01-07 20:53:43 -08:00
Dan Holmsand
4dd57c0dfb
Doc for with-let
2015-12-21 07:43:21 +01:00
Dan Holmsand
b4dec115b2
Add docs for track, track! and dispose!
2015-12-18 14:57:16 +01:00
Michael Campagnaro
2ad5c262e2
Fix doc formatting
2015-11-27 11:13:45 -05:00
Dan Holmsand
2a63c0a214
Load React, ReactDOM etc on init
...
That should make error messages easier to see.
2015-11-20 19:15:25 +01:00
Dan Holmsand
443e7f45c5
Update React to 0.14.3, and use react-dom-server
2015-11-20 18:57:00 +01:00
Dan Holmsand
cdee524fed
Make argv more consistent when used from plain React
2015-10-28 12:43:35 +01:00
Dan Holmsand
91a8587b79
Make core/react a function
...
That allows us to make react loading lazy in the future.
2015-10-22 15:11:15 +02:00
Dan Holmsand
2f6f2a4491
Fix indentation and style
2015-10-22 13:44:14 +02:00
Dan Holmsand
63515236cb
Make sure empty [:input] doesn't throw exception
2015-10-22 13:31:58 +02:00
Dan Holmsand
45b93c8145
Rename .' and .! to $ and $! respectively
...
This seems to be necessary to avoid trouble with bootstrapped cljs.
The old macros are still around, but deprecated.
2015-10-22 13:23:49 +02:00
Dan Holmsand
7cbde6f115
Load ReactDOM and ReactDOMServer lazily
2015-10-15 13:56:05 +02:00
Dan Holmsand
f280e979c8
Add more convenient time macro
2015-10-15 13:19:36 +02:00
Dan Holmsand
4d00b44c7c
Update ClojureScript to 1.7.145
2015-10-14 16:09:02 +02:00
Dan Holmsand
73ba98bc93
ReactDOMServer doesn't seem to exist anywhere
...
So, don't look for it.
2015-10-14 15:10:46 +02:00
Dan Holmsand
54ecf706d5
Rethrow errors caught during try-run
2015-10-14 15:08:33 +02:00
Dan Holmsand
47c5fcf267
Unoptimize component...
...
Remove "optimizations" that didn't doo much good.
2015-10-12 22:30:49 +02:00
Dan Holmsand
92984c4c56
Add react to core for convenience
2015-10-12 17:29:03 +02:00
Dan Holmsand
776c47491c
Make sure lifecycle callbacks work when called as native component
2015-10-12 17:18:37 +02:00
Dan Holmsand
fbbc5e72c6
Flush should not mess with scheduled updates
2015-10-12 09:25:33 +02:00
Dan Holmsand
78fffe263e
Make next-tick more predictable, add after-render
2015-10-11 22:08:42 +02:00
Dan Holmsand
edf001cb62
Reuse react from util in server
2015-10-11 16:43:25 +02:00
Dan Holmsand
253cb999ba
Call component functions with this set to current component
...
This makes us more consistent with React classes, and gives more
informative stack traces sometimes.
Also stop wrapping unknown methods - let React deal with them directly.
2015-10-11 15:04:50 +02:00
Dan Holmsand
04325c2e0e
Stop trying to be too clever in render
...
There's no reliable way of making React forget a mounted tree
completely, and the old solution sometimes makes things worse.
2015-10-11 13:27:09 +02:00
Dan Holmsand
cdea2257f2
Revert to not munging names in interop
2015-10-11 13:26:43 +02:00
Dan Holmsand
d9ad7740ec
Make it easier to use with webpack and node
...
Demo and tests now can run with webpack-generated React
Use js/require, to make Reagent work better with node
2015-10-10 13:40:33 +02:00
Dan Holmsand
d30ef3aedb
Make copying of watches in ratom a little faster
2015-10-09 14:41:03 +02:00
Dan Holmsand
88d961563a
Simplify template.cljs a little
2015-10-09 13:32:30 +02:00
Dan Holmsand
47f49868ae
Optimize template.cljs a little
2015-10-09 09:40:41 +02:00
Dan Holmsand
9f07aa35f4
Experiment with js-object element in 0.14
...
Doesn't seem to do much for performance, unfortunately.
2015-10-08 18:37:48 +02:00
Dan Holmsand
3aea9849ec
One more step towards React 0.14
2015-10-08 16:19:40 +02:00
Dan Holmsand
fa48e61f47
Start move to React 0.14
2015-10-08 14:14:34 +02:00
Dan Holmsand
0c8269766f
Avoid calling flush! when flushing
2015-10-08 07:04:41 +02:00
Dan Holmsand
158fca953b
Make NativeWrapper thinner
2015-10-07 23:02:55 +02:00
Dan Holmsand
2a74cbb144
More tests for warnings
2015-10-07 21:37:26 +02:00
Dan Holmsand
1d1552960c
Start testing warnings from components
2015-10-07 20:38:19 +02:00
Dan Holmsand
ec769d0c3c
Print function names instead of source in warnings/errors
2015-10-07 19:50:29 +02:00
Dan Holmsand
b86e6278eb
Reformat to get rid of very long lines
2015-10-07 18:01:13 +02:00
Dan Holmsand
fefbcf109e
Use new hiccup-err more
2015-10-07 17:56:08 +02:00
Dan Holmsand
72e546128f
Avoid any overhead for supporting [:> comp ...]
2015-10-07 17:33:40 +02:00
Dan Holmsand
60427a3231
A little cleanup
2015-10-07 13:31:54 +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
4601b37ec5
Use functions to access argv
2015-10-06 10:46:59 +02:00
Dan Holmsand
eb359b301d
More property access to component.cljs
2015-10-06 10:40:11 +02:00
Dan Holmsand
52e729a294
Simplify class creation
2015-10-05 12:18:42 +02:00
Dan Holmsand
038b312dd0
Merge branch 'create-class'
2015-10-05 10:42:51 +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
9a2d632826
Refactor to avoid circular dependency in ratom
2015-10-04 11:27:47 +02:00
Dan Holmsand
69e39bf6f7
Use keyword as key in with-let
2015-10-04 10:39:18 +02:00
Dan Holmsand
6ad55160eb
Use set to simplify deref handling
2015-10-04 09:29:23 +02:00
Dan Holmsand
dabffb86b6
Cleanup new deref watching a bit
2015-10-03 22:36:40 +02:00
Dan Holmsand
c8b86af635
Get rid of complex deref watching code
2015-10-03 21:47:06 +02:00
Dan Holmsand
b399f30daf
Make Reaction a little smaller
2015-10-03 14:46:46 +02:00
Dan Holmsand
a31c410e08
Faster compare of derefed reactions, and refactor
2015-10-03 12:56:35 +02:00
Dan Holmsand
70dd2a5166
Simplify make-reaction and deref-handling a lot
2015-10-03 11:54:32 +02:00
Dan Holmsand
05fb3ed39d
Start simplifying reaction creation
2015-10-03 11:00:58 +02:00
Dan Holmsand
5d8f1ed116
Get rid of reaction-key
2015-10-03 09:22:33 +02:00
Dan Holmsand
4160704bdc
Store cached reactions directly on function/object
2015-10-02 21:49:35 +02:00
Dan Holmsand
4ee08ea18e
Use array for notify
2015-10-02 20:37:37 +02:00
Dan Holmsand
0cb0de8fc4
Cleanup and perf fixes
2015-10-02 17:34:08 +02:00
Dan Holmsand
4007e6db74
Simplify capture logic
2015-10-02 14:30:25 +02:00
Dan Holmsand
9a13446eea
Try to avoid allocating new array in notify-deref-watcher
2015-10-02 13:02:37 +02:00
Dan Holmsand
eb83776b3d
Use transients for better caching performance
2015-10-02 10:18:48 +02:00
Dan Holmsand
6aa26253d8
Use a plain method for running reaction internally
...
Gives quite a big speedup
2015-09-30 10:32:16 +02:00
Dan Holmsand
94ad9952d8
Use empty context instead of *flushing* in flush!
2015-09-30 09:49:11 +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
e39bb33ccc
Use plain array instead of set for tracking watched atoms
...
Turns out to be much, much faster in most cases
2015-09-27 16:04:06 +02:00
Dan Holmsand
7cd2d7d860
Do a little cleanup in template.cljs
2015-09-27 11:14:32 +02:00
Dan Holmsand
83b21167ea
Optimize common case of listening to one derefable
2015-09-27 11:11:15 +02:00
Dan Holmsand
97194b6fca
More cleanup in ratom.cljs: get rid of IComputedImpl
...
Calling object methods and plain functions is faster.
2015-09-27 09:46:44 +02:00
Dan Holmsand
6e3a2b415d
Fix stupid with-let bug
2015-09-27 00:07:19 +02:00
Dan Holmsand
4f629d0a34
Big cleanup of ratom.cljs
...
Use a couple of utility functions, and better formatting to
reduce noise.
Don't use some? in performance critical code - avoid a function call.
2015-09-26 23:10:31 +02:00
Dan Holmsand
ab36316c82
Swap arg order in _try-run
2015-09-26 18:13:07 +02:00
Dan Holmsand
5a23bcaad5
Don't call on-dispose in non-reactive deref for now
2015-09-26 18:00:30 +02:00
Dan Holmsand
f940ac3f38
Slimline batching a little
2015-09-26 14:31:06 +02:00
Dan Holmsand
6a206eccf3
Simplify with-let even more
2015-09-26 14:30:11 +02:00
Dan Holmsand
b17ff0a576
Pass state to on-dispose in Reaction
...
Use to simplify with-let some more
2015-09-26 13:59:43 +02:00
Dan Holmsand
415ecd64fd
Simplify with-let and tweak performance
2015-09-26 13:12:59 +02:00
Dan Holmsand
b1294d50e5
Start to make create-class return a proper React class
2015-09-25 20:49:48 +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
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
be1dfaeba7
Merge branch 'with-let'
2015-09-24 11:00:32 +02:00
Dan Holmsand
cfcf356743
Add track, track!, dispose! and with-let to core
2015-09-24 10:19:30 +02:00
Dan Holmsand
28d454ece9
Include size of cached reactions in tests
2015-09-24 07:48:03 +02:00
Dan Holmsand
d476222abb
Optimize track! and with-let a bit
2015-09-23 20:14:29 +02:00
Dan Holmsand
e1585f6730
Add more with-let tests, and fix dispose bug
2015-09-23 19:40:19 +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
ca5ce00c34
Rename monitor -> track, and monitor! -> track!
2015-09-19 16:49:13 +02:00
Dan Holmsand
ea7cd26cf5
Rename with-resource to with-kept and clean up
2015-09-19 16:36:49 +02:00
Dan Holmsand
0b553ef6bd
Reorg with-resource
2015-09-19 09:14:14 +02:00
Dan Holmsand
37703c2834
Make with-resource use a proper key
2015-09-19 08:46:26 +02:00
Dan Holmsand
6f448f296f
on-dispose should always be called in Reaction
2015-09-18 17:59:40 +02:00
Dan Holmsand
897b766624
Experiment with with-resource
2015-09-18 14:23:50 +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
ce1486a7cd
Make sure on-set is valid before allowing change of Reaction
2015-09-14 21:11:33 +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
9e9cf93016
Simmplify new cursor a bit
2015-09-14 18:02:13 +02:00
Dan Holmsand
fdef5e6c9f
Make cursor used cached reactions
2015-09-14 15:03:39 +02:00
Dan Holmsand
653e4c15f9
Prepare cursor for cached reaction
2015-09-14 14:47:38 +02:00
Dan Holmsand
3acfa689d9
Start to rework cursor
2015-09-14 14:03:32 +02:00
Dan Holmsand
995e110946
Setting dirty on on-set is not necessary any more
2015-09-14 13:34:17 +02:00
Dan Holmsand
e05c74e6a5
More tests for monitor
2015-09-14 09:09:04 +02:00
Dan Holmsand
aaf1d56edb
More work on monitor
2015-09-13 19:01:58 +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
bc711c4228
Add async reaction
2015-09-12 18:31:20 +02:00
Dan Holmsand
f18d4a7656
Get rid of norun
2015-09-12 09:37:15 +02:00
Dan Holmsand
bb1fa312d6
Use = in deref as well, for consistency
2015-09-11 22:13:36 +02:00
Dan Holmsand
b0395b5461
Make reaction notify only when it actually changes
2015-09-11 20:37:23 +02:00
Dan Holmsand
2895c9bed7
A little cleanup
2015-09-11 18:23:18 +02:00
Dan Holmsand
b1acdea090
Use lazy reactions in components
2015-09-11 15:06:42 +02:00
Dan Holmsand
679136f5d5
Make constants const
2015-09-11 12:35:06 +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