Commit graph

55 commits

Author SHA1 Message Date
Isiah Meadows
582bda56dc
Partially recast the router API to be a lot more intuitive. (#2469)
* Recast the router API to be a lot more intuitive.

Fixes #2387
Fixes #2072
Fixes quite a few issues reported on Gitter.

For `m.route.Link`:

- More intuitive
- More accessible
- More ergonomic
- It can be disabled
- It can be cancelled
- It can be changed
- Oh, and you can use it isomorphically.

For `m.route.prefix`

- You can *read* it.
- You can write to it, of course.
- It's literally just setting a property.

For the router itself (and the rest of Mithril):

- You can now `require("mithril")` and all its submodules without a DOM
  at all. There is a catch: you can't instantiate any routes, you can't
  mount anything, and you can't invoke `m.render` in any capacity. You
  can only use `m.route.Link`, `m.route.prefix`, hyperscript stuff, and
  `mithril/stream`, and you can use `m.request` with `background: true`
  if you use a global XHR polyfill. (You can't use `m.request` without
  `background: true` except with a DOM to redraw with.) The goal here is
  to try to get out of the way for simple testing and to defer the
  inevitable `TypeError`s for the relevant DOM methods to runtime.

  The factory requires no arguments, and in terms of globals, you can
  just figure out based on what errors are thrown what globals to
  define. Their values don't matter - they just need to be set to
  *something*, even if it's just `null` or `undefined`, before Mithril
  executes.

Had to make quite a few other changes throughout the docs and tests to
update them accordingly. Oh, and that massive router overhaul enabled me
to do all this.

Also, slip in a few drive-by fixes to the mocks so they're a little
easier to work with and can accept more URLs. This was required for a
few of the tests.

* Update changelog + numbers, add forgotten bundle option

* Add PR numbers to changelog [skip ci]

* Allow continuing to the next match by returning `false`.

* Update numbers again
2019-07-12 15:29:37 -04:00
Arun Cvf
853a54ae79 Fix mixed content error. (#2383)
Mixed Content: The page at 'https://cdn.rawgit.com/MithrilJS/mithril.js/master/examples/threaditjs/index.html' was loaded over HTTPS, but requested an insecure stylesheet 'http://threaditjs.com/reset.css'. This request has been blocked; the content must be served over HTTPS.
2019-03-02 02:22:39 -05:00
Isiah Meadows
99a61a09dc
Update a few dependencies, update ospec to version 3.1.0 (#2370) 2019-02-05 13:20:55 -05:00
Oliver Adria
1aaa2ff568 Fix typo in examples/editor (#2350)
* Small typo prevented Markdown Editor example from working
2018-12-29 23:26:03 -05:00
Isiah Meadows
aacfda739a Merge branch 'next' 2018-12-06 00:34:15 -05:00
Isiah Meadows
26b8d994ce
Remove m.prop + m.withAttr (#2317)
* Remove `m.prop` + `m.withAttr`

- For many uses, `m.withAttr` is *more* verbose than just directly using
  an event handler
- If you're using it with a bound callback, you're literally wasting a
  single character in the human readable version (and you're *saving*
  them in the minified output).
- It sometimes obscures your intent, if overused.
- Functions are easier to compress than `m.withAttr`, resulting in
  slightly smaller bundles.
- `m.withAttr` is overused anyways.
- `m.prop` is basically useless without `m.withAttr`, and the API
  doesn't have the same benefits it had with 0.2.x.

* Update changelog
2018-11-30 20:41:24 -05:00
Dmitri Zaitsev
0cae0b078b Examples: Pure reactive clone of the animation example (#1830)
* Replace run by stream

* Switch to m.stream.scan

* view switched to pure function

* Separate view from render

* Remove the state from globals

* Remove global, side-effects and stuff

* Extract position function

* Cleanup

* More cleanup
2018-11-07 15:35:03 -05:00
dmitriz
95ca2ce47d Prevent create empty item 2017-05-01 13:27:22 +01:00
Gampol T
450570d4c9 fix ui.save not detect escape key
change event from onkeypress to onkeyup because onkeypress cannot detect escape key press
if (e.keyCode === 27)
2017-02-23 17:48:13 +07:00
Gampol T
f6e627a891 fix state.update not destroy when edit text blank
if (state.editing.title === "") should call state.destroy() instead of destroy()
2017-02-23 17:45:25 +07:00
Leo
1620b147da clean up repo 2017-01-30 11:18:47 -05:00
Leo
6ab2b6b6c3 merge to next 2017-01-30 11:04:14 -05:00
Leo Horie
6ff5265bf8 docs on animation and css 2017-01-11 13:36:05 -05:00
Leo Horie
4a4bd7a548 use animation best practices in dbmon 2016-12-02 20:44:03 -05:00
Leo Horie
62724a1143 simplify scripts in examples 2016-11-16 00:09:52 -05:00
Paul D. Fernhout
7c5e06d2ec Fix todomvc to reflect All/Active/Completed choice 2016-11-14 21:12:34 -05:00
Leo Horie
bc8cf4ed76 change m.request return value from stream to promise
remove m.prop
add m.Promise
update tests and examples
2016-11-13 22:44:22 -05:00
Leo Horie
37735f1772 remove redundant abstraction level in todomvc example 2016-10-28 09:51:42 -04:00
Leo Horie
9ea1cf0ae0 make editor and todomvc example more idiomatic 2016-10-28 00:56:59 -04:00
Leo Horie
86fdcdafaa simplify other examples 2016-10-27 20:37:14 -04:00
Leo Horie
845633c88d clean up dbmon 2016-10-27 20:29:29 -04:00
Zach Dahl
51e50bd450 add vue 2 dbmonster example 2016-10-27 18:22:47 -05:00
Leo Horie
16759da0d7 upgrade react in dbmon 2016-10-24 10:48:35 -04:00
Hugo Freitas
1583c76e3d Update react links
fb.me is blocked on certain LAN's breaking the example and isn't the recommended link in https://facebook.github.io/react/downloads.html
2016-09-26 09:58:58 -03:00
Leo Horie
b8ef290acd improved bundler, handle width/height atts 2016-09-23 10:31:33 -04:00
Leo Horie
158dcc8e8d fix dbmon requires 2016-09-20 14:38:49 -04:00
Leo Horie
55026e1986 fix react dbmon 2016-08-03 17:28:54 -04:00
Leo Horie
7c736b511a rename node to vnode 2016-07-29 22:04:04 -04:00
Leo Horie
0ac6ef44b8 update README 2016-07-28 23:39:44 -04:00
Leo Horie
a988276e9b Revert "don't copy state anymore"
This reverts commit cece44d4ac.
2016-07-08 10:24:48 -04:00
Leo Horie
cece44d4ac don't copy state anymore 2016-07-08 00:40:52 -04:00
Pierre-Yves Gérardy
05c8c411ad Remove the injection of Stream into requestService
I guess the leftovers of a previous version...
2016-06-20 18:37:17 +02:00
Leo Horie
bce2abbffd Merge remote-tracking branch 'origin/rewrite' into rewrite
Conflicts:
	docs/keys.md
	docs/signatures.md
	docs/v1.x-migration.md
	index.js
	ospec/bin/ospec.cmd
	request/request.js
	request/tests/test-xhr.js
	util/prop.js
	util/tests/index.html
	util/tests/test-prop.js
2016-06-20 09:34:14 -04:00
Leo Horie
ce0c30a235 update docs 2016-06-20 09:22:00 -04:00
Leo Horie
b9ce90765d streams implementation 2016-06-20 09:21:25 -04:00
Isiah Meadows
02cc4ec1d6 Fix whitespace/etc. in examples (#1115) 2016-06-18 03:39:55 -04:00
Pat Cavit
fbcdcf93e2 Add mithril bundle version of dbmonster 2016-05-19 13:24:28 -07:00
Leo Horie
b4903538f3 prevent recycling for vnodes w/ integration methods 2016-05-19 01:20:21 -04:00
Leo Horie
5ec06e7c08 init state, fix examples 2016-05-15 11:14:38 -04:00
Leo Horie
5265697cb2 semi-working bundle 2016-05-14 01:01:35 -04:00
Leo Horie
3666aa747e Merge pull request #1027 from tivac/legacy-dbmon
Add mithril@0.2.x version for comparison
2016-05-10 10:29:19 -04:00
Leo Horie
ead2e8ac0b shouldUpdate, component oninit order fix 2016-05-05 23:20:31 -04:00
Leo Horie
d61a6169ea fix submission 2016-05-04 13:45:42 -04:00
Leo Horie
965f700cc4 remove dead code 2016-05-04 00:36:18 -04:00
Leo Horie
d78084ab90 example cleanup 2016-05-04 00:34:59 -04:00
Leo Horie
31c5b21220 s/spaces/tab 2016-05-03 23:50:41 -04:00
Leo Horie
5ec12aafc0 link to rawgit dbmon pages 2016-05-03 23:45:10 -04:00
Leo Horie
a9cad2c45b Merge branch 'rewrite' of github.com:lhorie/mithril.js into rewrite 2016-05-03 23:39:16 -04:00
Leo Horie
3282ef3f77 components, angular dbmon 2016-05-03 23:39:01 -04:00
Stefan Keim
5fe5b5029b correct index
```todos.splice(index, 1)``` in destroy makes the elements shift; therefor loops index has to be aligned has to be corrected
2016-04-27 08:50:54 +02:00