Commit graph

34 commits

Author SHA1 Message Date
Isiah Meadows
512eef378e
Recast key docs to be much clearer and more accurate (#2540)
* Recast key docs to be much clearer and more accurate [skip ci]

Also, fix a couple broken hash links I noticed while making this.

* Ensure `diff` blocks are highlighted correctly
2019-10-11 04:29:11 -04:00
Isiah Meadows
48e7fd1711
Refactor scripts (#2465)
* Refactor all kinds of scripts

* Update docs to ensure linter passes
2019-07-27 15:12:49 -04:00
Isiah Meadows
234b1c9302 Update migration, fix various minor issues
- Lot of people couldn't migrate to v1 and plan to reevaluate when v2 is
  released.
- It's "npm" not "NPM". It doesn't stand for anything, and it never
  has - it was initially chosen simply because it was easy to type.
  It has a lot of unofficial backronyms with "Node Package Manager"
  being one of the most common ones, but it's never officially stood
  for anything as an acronym *or* initialism.
- Fixed a few errors in the change log, like non-breaking changes being
  included in the "Breaking Changes" section and an inaccuracy in the
  summary of a particular change.
- Fixed RawGit URLs to point to GitHack, which is a lighter proxy that
  offloads caching to Cloudflare instead of also implementing it itself.
  (It also just uses nginx for all the important server logic, so it
  scales better.)
- Add a few more v0.2 references as appropriate
2019-07-24 05:01:20 -04:00
Isiah Meadows
20f0759103
Fix docs (#2482)
* Fix #2414, address part of #1687

Also cleared the CSS up to be a lot more readable instead of smooshed
into a single line.

* Redo the testing docs page

- Addresses another part of #1687
- Also, fix a few linter issues in the ospec binary

* Add note about third-party cookies, tweak a line

* Make the JSX comparison much more meaningful

And let the code speak for itself. Don't fuel the flame wars any more
than what they've already become. We should be *unopinionated*, and so
I've updated those docs to remove the existing opinion.

* Remove a bunch of outdated ES6 references

* Remove the CSS page
2019-07-23 16:33:56 -04:00
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
Isiah Meadows
1f4b2cf49a
Deservicify core (#2458)
* De-servicify router (mostly)

Still uses the redraw service, but it no longer has an intermediate
service of its own.

Also, did a *lot* of test deduplication in this. About 30-40% of the
router service tests were already tested on the main router API instance
itself.

Bundle size decreased from 9560 to 9548 bytes min+gzip.

* Merge `m.mount` + `m.redraw`, update router

Simplifies the router and redraw mechanism, and makes it much easier to
keep predictable.

Bundle size down to 9433 bytes min+gzip, docs updated accordingly.

* Make `mithril/render` just return the `m.render` function directly.

* Deservicify `m.render`, revise `m.route`

- You now have to use `mithril/render/render` directly if you want an
  implicit redraw function. (This will likely be going away in v3.)
- Revise `m.route` to only `key` components

* Add `redraw` to `m.render`, deservicify requests

* Test error logging

* Update docs + changelog [skip ci]
2019-07-07 18:28:43 -04:00
Isiah Meadows
a23bcea7ee
Correct a bunch of incorrect/outdated references (#2457)
- Babel 7 has a whole different module API
- Traceur is basically dead
- JSX != HTML
- Some bits are just obvious from context what they are
- ES6 docs shouldn't be auto-installing JSX support
- Also, I decided it was worth clearing up some misleading docs in
  surrounding areas.
2019-07-06 03:41:01 -04:00
Isiah Meadows
6c562d2b9b
Fix keys, normalize holes (#2452)
* Fix #2434

* Treat holes as unkeyed, normalize boolean/null/undefined

This brings a lot better consistency with that API, even though it's
slightly breaking. (I had to update a bunch of tests to correspond with
it.)

* Fill in PR number [skip ci]
2019-07-03 17:05:44 -04:00
Ayush Jain
982fdf5737 Corrected the case issue of 'JavaScript' throughout the docs (#2401)
* corrected JavaScript spelling
2019-04-01 08:14:38 -04:00
Isiah Meadows
966e78bcab
Allow variadic arguments to m.fragment (#2328)
* Implement support for variadic arguments to `m.fragment`

While I was at it, I refactored the common logic out of `hyperscript`.

* Add a missed change from #2326

* Update docs + changelog [skip ci]

* Explain rationale for `hyperscriptVnode`'s calling convention

This way, it doesn't get erroneously "cleaned up" into something worse,
and so it's clearer how it'd be potentially optimized once ES5 support
is dropped.
2018-12-05 23:57:42 -05:00
Isiah Meadows
8134c51a48
Fix style updates to avoid unnecessary allocation (#2312)
* Fix style updates to avoid unnecessary allocation

- Drive-by: properly censor `cssFloat` -> css `float:` to match DOM
  behavior

* Document `style` syntax + custom property support. [skip ci]

* Add a missing test

* Add a few more descriptive comments.

* Update changelog [skip ci]
2018-12-03 14:31:08 -05:00
Boaz Blake
bf1afa06fd adding missing anchor (#2305) 2018-11-19 02:34:20 -05:00
spacejack
a147023f4e Docs - prioritize closure components for state (#2292)
* Emphasize closure components in components.md

* Use closure components for all stateful component examples

* Add change-log entry

* Edits and separate sections for closure, class & POJO state
2018-11-13 01:04:04 -05:00
spacejack
0e6223da73 Add docs about using EventListener objects (#2260)
* Add docs about using EventListener objects

* Fix typo

* Less misleading description of event handlers

* Fix a typo + grammar mistake

* More grammar/typo fixes
2018-10-27 16:41:21 -04:00
Isiah Meadows
1ecc30a064 Fix custom elements attribute application, improve key checking
- Fix custom elements attribute application to acknowledge that not all
  custom elements operate purely based on attributes. (Plus, those
  blasted things are verbose as heck when you're working with them in
  raw form. It's also not that uncommon for functionality to be exposed
  via property and *not* attribute.)
- Don't memoize the normalized value when we 1. only use it once in each
  branch, and 2. only use it for a few special cases.
- Centralize the "has property key" code, so it's easier to tune and
  read. I also inlined a couple functions while I was at it since they
  were small and only used once.
- Actually test for how attributes are applied to raw DOM elements vs
  when we choose to use keys. When I first developed the patch, it
  silently worked, when I should've been breaking things.
2018-09-20 15:08:49 -04:00
Pierre-Yves Gérardy
fed0846a11 [docs] #2174 docs and change log 2018-06-07 18:09:38 +02:00
Leo Horie
810228c442 fix tables in mobile 2017-01-17 22:36:34 -05:00
Patrik Johnson
7a4349c332 Fix small typos in the rewrite docs (#1533) 2017-01-11 15:41:15 -08:00
Leo Horie
7c00aad19c beef up docs and defrag setup flow 2017-01-08 10:53:54 -05:00
Leo Horie
bedcd8bdbf update docs re:onbeforeremove and clean up 2016-12-26 12:28:13 -05:00
Leo Horie
cdb9017a72 update docs, add descriptions for api methods 2016-12-02 17:51:07 -05:00
Leo Horie
9f6a1086e4 Merge remote-tracking branch 'origin/rewrite' into rewrite
# Conflicts:
#	mithril.min.js
2016-12-01 01:50:12 -05:00
Leo Horie
87dcbbf5c7 small tweaks to docs 2016-12-01 01:49:19 -05:00
Barney Carroll
2e43bf4f7b Add vnode caching warning under hyperscript documentation 2016-11-27 15:16:55 +00:00
Scott Simpson
17ee04c00a fix missing return in BetterLabeledComponent view (#1332) 2016-09-20 11:09:41 -07:00
Scott Simpson
6252a00bed small fixes in hyperscript.md (#1330)
Moved SVG/MathML section down to reflect the order of the TOC
Renamed "Avoid Anti-patterns" to enable TOC link
2016-09-20 10:24:08 -07:00
ludbek
0a736b5e76 linked component doc 2016-08-03 21:43:54 +05:45
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
impinball
b4fb21475c Add editorconfig, resolve differences
This includes newlines, tabs, among other things.
2016-06-18 03:22:12 -04:00
Leo Horie
4b6c4254ba s/shouldUpdate/onbeforeupdate 2016-06-06 09:59:35 -04:00
Leo Horie
7e98ad6d74 fix shouldUpdate docs 2016-05-26 15:26:04 -04:00
Leo Horie
e24e4e9a1a style fixes in docs 2016-05-19 01:46:46 -04:00
Leo Horie
cd8b8b12e6 Some documentation 2016-05-19 01:22:01 -04:00