diff --git a/docs/404.md b/docs/404.md new file mode 100644 index 000000000..75ed8f44c --- /dev/null +++ b/docs/404.md @@ -0,0 +1,7 @@ +# 404 Not Found + +Oops, the page you requested cannot be found. + +The URL may be misspelled or the page you're looking for is no longer available. + +Go to the [home page](https://mithril.js.org). diff --git a/docs/changelog.md b/docs/changelog.md index 790de1804..88b379430 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -25,6 +25,7 @@ Official change log for Mithril.js PSA: changes to [`mithril/stream`](stream.md) are now specified in this changelog. I've also moved the old stream changelog into this file [here](#mithril-stream-change-log). +- Updated web design, fixed most obvious UX, UI, and design flaws, fixed obviously incorrect content [@tbreuss](https://github.com/tbreuss) - Added `m.Fragment = "["` for an easier time with JSX setups. ([#2744](https://github.com/MithrilJS/mithril.js/pull/2744) [@dead-claudia](https://github.com/dead-claudia)) - Reduced package download size substantially by removing the archive of previous releases' documentation. ([#2561](https://github.com/MithrilJS/mithril.js/pull/2561) [@cztomsik](https://github.com/cztomsik)) - Improved error messages in multiple places. ([#2536](https://github.com/MithrilJS/mithril.js/pull/2536) [@dead-claudia](https://github.com/dead-claudia)) diff --git a/docs/code-of-conduct.md b/docs/code-of-conduct.md index 5c392e9bd..ea308da15 100644 --- a/docs/code-of-conduct.md +++ b/docs/code-of-conduct.md @@ -4,7 +4,7 @@ Code of Conduct Covenant for contributors to the Mithril.js project # Contributor Covenant Code of Conduct -## Our Pledge +### Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and @@ -13,7 +13,7 @@ size, disability, ethnicity, gender identity and expression, level of experience nationality, personal appearance, race, religion, or sexual identity and orientation. -## Our Standards +### Our Standards Examples of behavior that contributes to creating a positive environment include: @@ -35,7 +35,7 @@ advances * Other conduct which could reasonably be considered inappropriate in a professional setting -## Our Responsibilities +### Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in @@ -47,7 +47,7 @@ that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. -## Scope +### Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of @@ -56,7 +56,7 @@ address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. -## Enforcement +### Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [contact@claudiameadows.dev](mailto:contact@claudiameadows.dev?subject=Mithril%20Code%20of%20Conduct). All @@ -71,7 +71,7 @@ members of the project's leadership. As a general policy, we generally do not disclose any particular action taken in accordance with this Code of Conduct beyond those who need to know. -## Attribution +### Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [https://contributor-covenant.org/version/1/4][version] diff --git a/docs/contributing.md b/docs/contributing.md index d6b7c74ba..af2dab86a 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -3,36 +3,34 @@ Contribution guide for Mithril.js --> # Contributing FAQs +Contribution guide for Mithril.js. + - [How do I go about contributing ideas or new features?](#how-do-i-go-about-contributing-ideas-or-new-features?) - [How should I report bugs?](#how-should-i-report-bugs?) - [How do I send a pull request?](#how-do-i-send-a-pull-request?) - [I'm submitting a PR. How do I run tests?](#i'm-submitting-a-pr-how-do-i-run-tests?) -- [How do I build Mithril.js?](#how-do-i-build-mithril?) +- [How do I build Mithril.js?](#how-do-i-build-mithriljs?) - [Is there a style guide?](#is-there-a-style-guide?) -- [How do I embed live previews in docs?](#how-do-I-embed-live-previews-in-docs?) +- [How do I embed live previews in docs?](#how-do-i-embed-live-previews-in-docs?) - [Why do tests mock the browser APIs?](#why-do-tests-mock-the-browser-apis?) -- [Why does Mithril.js use its own testing framework and not Mocha/Jasmine/Tape?](#why-does-mithril-use-its-own-testing-framework-and-not-mochajasminetape?) -- [Why doesn't the Mithril.js codebase use ES6 via Babel or Bublé? Would a PR to upgrade be welcome?](#why-doesn't-the-mithril-codebase-use-es6-via-babel-or-bublé?-would-a-pr-to-upgrade-be-welcome?) -- [Why doesn't the Mithril.js codebase use trailing semi-colons? Would a PR to add them be welcome?](#why-doesn't-the-mithril-codebase-use-trailing-semi-colons?-would-a-pr-to-add-them-be-welcome?) -- [Why does the Mithril.js codebase use a mix of `instanceof` and `typeof` checks instead of `Object.prototype.toString.call`, `Array.isArray`, etc? Would a PR to refactor those checks be welcome?](#why-does-the-mithril-codebase-use-a-mix-of-instanceof-and-typeof-checks-instead-of-objectprototypetostringcall,-arrayisarray,-etc?-would-a-pr-to-refactor-those-checks-be-welcome?) -- [What should I know in advance when attempting a performance related contribution?](#What-should-I-know-in-advance-when-attempting-a-performance-related-contribution?) +- [Why does Mithril.js use its own testing framework and not Mocha/Jasmine/Tape?](#why-does-mithriljs-use-its-own-testing-framework-and-not-mochajasminetape?) +- [Why doesn't the Mithril.js codebase use ES6 via Babel or Bublé? Would a PR to upgrade be welcome?](#why-doesn't-the-mithriljs-codebase-use-es6-via-babel-or-bublé?-would-a-pr-to-upgrade-be-welcome?) +- [Why doesn't the Mithril.js codebase use trailing semi-colons? Would a PR to add them be welcome?](#why-doesn't-the-mithriljs-codebase-use-trailing-semi-colons?-would-a-pr-to-add-them-be-welcome?) +- [Why does the Mithril.js codebase use a mix of `instanceof` and `typeof` checks instead of `Object.prototype.toString.call`, `Array.isArray`, etc? Would a PR to refactor those checks be welcome?](#why-does-the-mithriljs-codebase-use-a-mix-of-instanceof-and-typeof-checks-instead-of-objectprototypetostringcall,-arrayisarray,-etc?-would-a-pr-to-refactor-those-checks-be-welcome?) +- [What should I know in advance when attempting a performance related contribution?](#what-should-i-know-in-advance-when-attempting-a-performance-related-contribution?) - [Do you all accept donations?](#do-you-all-accept-donations?) -## How do I go about contributing ideas or new features? +### How do I go about contributing ideas or new features? Create an [issue thread on GitHub](https://github.com/MithrilJS/mithril.js/issues/new) to suggest your idea so the community can discuss it. If the consensus is that it's a good idea, the fastest way to get it into a release is to send a pull request. Without a PR, the time to implement the feature will depend on the bandwidth of the development team and its list of priorities. - - -## How should I report bugs? +### How should I report bugs? Ideally, the best way to report bugs is to provide a small snippet of code where the issue can be reproduced (via jsfiddle, jsbin, a gist, etc). Even better would be to submit a pull request with a fix and tests. If you don't know how to test your fix, or lint or whatever, submit anyways, and we can help you. - - -## How do I send a pull request? +### How do I send a pull request? To send a pull request: @@ -45,80 +43,58 @@ To send a pull request: - push your changes to your fork - submit a pull request (go to the pull requests tab in GitHub, click the green button and select your feature branch) - - -## I'm submitting a PR. How do I run tests? +### I'm submitting a PR. How do I run tests? After having run `npm install` (a one-time operation), run `npm run test` from the command line to run all tests. While testing, you can modify a test to use `o.only(description, test)` instead of `o(description, test)` if you wish to run only a specific test to speed up your debugging experience. Don't forget to remove the `.only` after you're done! - - -## How do I build Mithril.js? +### How do I build Mithril.js? If all you're trying to do is run examples in the codebase, you don't need to build Mithril.js, you can just open the various html files and things should just work. To generate the bundled file for testing, run `npm run dev` from the command line. To generate the minified file, run `npm run build`. - - -## Is there a style guide? +### Is there a style guide? Yes, there's an `eslint` configuration, but it's not strict about formatting at all. If your contribution passes `npm run lint`, it's good enough for a PR (and it can still be accepted even if it doesn't pass). Spacing and formatting inconsistencies may be fixed after the fact, and we don't want that kind of stuff getting in the way of contributing. - - -## How do I embed live previews in docs? +### How do I embed live previews in docs? Any code tag marked as `js` and not `javascript` will automatically be wrapped in a live Flems preview. - - -## Why do tests mock the browser APIs? +### Why do tests mock the browser APIs? Most notoriously, because it's impossible to test the router and some side effects properly otherwise. Also, mocks allow the tests to run under Node.js without requiring heavy dependencies like PhantomJS/ChromeDriver/JSDOM. Another important reason is that it allows us to document browser API quirks via code, through the tests for the mocks. - - -## Why does Mithril.js use its own testing framework and not Mocha/Jasmine/Tape? +### Why does Mithril.js use its own testing framework and not Mocha/Jasmine/Tape? Mainly to avoid requiring dependencies. `ospec` is customized to provide only essential information for common testing workflows (namely, no spamming ok's on pass, and accurate noiseless errors on failure) - - -## Why doesn't the Mithril.js codebase use ES6 via Babel or Bublé? Would a PR to upgrade be welcome? +### Why doesn't the Mithril.js codebase use ES6 via Babel or Bublé? Would a PR to upgrade be welcome? Being able to run Mithril.js' raw source code in all supported browsers is a requirement for all browser-related modules in this repo. In addition, transpiled code is generally much bulkier. - - -## Why doesn't the Mithril.js codebase use trailing semi-colons? Would a PR to add them be welcome? +### Why doesn't the Mithril.js codebase use trailing semi-colons? Would a PR to add them be welcome? I don't use them. Adding them means the semi-colon usage in the codebase will eventually become inconsistent. Besides, [we aren't the only one who've decided to drop the semicolon](https://standardjs.com/#who-uses-javascript-standard-style). (We don't use Standard, though.) - - -## Why does the Mithril.js codebase use a mix of `instanceof` and `typeof` checks instead of `Object.prototype.toString.call`, `Array.isArray`, etc? Would a PR to refactor those checks be welcome? +### Why does the Mithril.js codebase use a mix of `instanceof` and `typeof` checks instead of `Object.prototype.toString.call`, `Array.isArray`, etc? Would a PR to refactor those checks be welcome? Mithril.js avoids peeking at objects' [[class]] string for performance considerations. Many type checks are seemingly inconsistent, weird or convoluted because those specific constructs demonstrated the best performance profile in benchmarks compared to alternatives. Type checks are generally already irreducible expressions and having micro-modules for type checking subroutines would add maintenance overhead. - - -## What should I know in advance when attempting a performance related contribution? +### What should I know in advance when attempting a performance related contribution? You should be trying to reduce the number of DOM operations or reduce algorithmic complexity in a hot spot. Anything else is likely a waste of time. Specifically, micro-optimizations like caching array lengths, caching object property values and inlining functions won't have any positive impact in modern JavaScript engines. Keep object properties consistent (i.e. ensure the data objects always have the same properties and that properties are always in the same order) to allow the engine to keep using JIT'ed structs instead of hashmaps. Always place null checks first in compound type checking expressions to allow the JavaScript engine to optimize to type-specific code paths. Prefer for loops over Array methods and try to pull conditionals out of loops if possible. - - -## Do you all accept donations? +### Do you all accept donations? Yes, we do, over at [our OpenCollective page](https://opencollective.com/mithriljs). We don't actively seek donations, but they are very much appreciated and are used to support development and related expenses. Both one-time and recurring donations are accepted. diff --git a/docs/framework-comparison.md b/docs/framework-comparison.md index 1612baa4c..bdd7b6110 100644 --- a/docs/framework-comparison.md +++ b/docs/framework-comparison.md @@ -5,7 +5,7 @@ Detailed comparison between Mithril.js and other popular frameworks # Framework comparison - [Why not X?](#why-not-insert-favorite-framework-here?) -- [Why use Mithril.js?](#why-use-mithril?) +- [Why use Mithril.js?](#why-use-mithriljs?) - [React](#react) - [Angular](#angular) - [Vue](#vue) diff --git a/docs/installation.md b/docs/installation.md index 07ac4db89..3816f0580 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -4,7 +4,7 @@ Instructions on how to install Mithril.js # Installation -- [CDN and online playground](#cdn) +- [CDN and online playground](#cdn-and-online-playground) - [npm](#npm) - [Quick start with Webpack](#quick-start-with-webpack) diff --git a/docs/integrating-libs.md b/docs/integrating-libs.md index a4d7fd63b..9c3555183 100644 --- a/docs/integrating-libs.md +++ b/docs/integrating-libs.md @@ -6,7 +6,7 @@ How you can integrate a third party library into a Mithril.js application, using Integration with third party libraries or vanilla JavaScript code can be achieved via [lifecycle methods](lifecycle-methods.md). -## noUiSlider Example +### noUiSlider Example ```javascript /** NoUiSlider wrapper component */ @@ -70,7 +70,7 @@ m.mount(document.body, Demo) [Live Demo](https://flems.io/#0=N4IgZglgNgpgziAXAbVAOwIYFsZJAOgAsAXLKEAGhAGMB7NYmBvEAXwvW10QICsEqdBk2J4A9ACoJAAgBytAKoQAylAgATGACdpAdy0YADoe3S6WQ-RHSJYgDpowAVzTViEetNUbtACgCU0sAO0tIAbhg6cGqaWg4h0lowxE5aaEEJofTUSRiMiNLOru70vmFotJqBwemhdWJi0gCSaBDuGGoAXjDSAMxa6tKGkcQAntJqAEbShNowmXXRPjoAvNIVSt6x+DkweTBlFZr46rRYFBm1dYvEIwUADBQL1wZoAOYwBcBYEGgPF1gMAAPAoARnu91Yz2krH80KW21KAHInIZ1PskRcim4PGgyh0nPBqtDQuVKjB8HliFo4Ph6ABhQgYd4HCJQQlwZD3AC6cKu12kWHwSXUBl0AWhsIW7AW9CSWFoYU+hRcONKxP5oQa0npsGZqL6AyGI3GU2knnlio68Ji2hO8GptFGEv5Mv5YQgMF0BWxJTxGoFiWSqXSWF8SPUEDCSL51yhtXj8YckhkABEYArpEZDGYzpY0NZbA5fbjpOmFQFLqFYMRpHBCLRdFtTGswB04PNajXwgSemt7vFakkUmkq3UPV6faq-ZWaoHhyHBeHKcZMSSl0jDGvNQKw0jJk5iMR6NvA4G52fA2MTAV94fj2hT5eBdk1NQANZT4q42fry-1xtm1WaQAEIAKbW04h3S942fOo3Tg0JwKA6QAH5pDsEB0zgR1xiAzDpAKTD6VyRgvEgzC-2kWMz38J5oLrBsIOWaQADJWKXICLgvS8GSZFkvzVPEwgDRC2UJaQ1jCKjYLPWF6MvPctwucSYBo651JhBJE0HIUFRcYhfFOagnBwBh8EmSpRguctaD5NgOBATAcDwHY4AEGh6EYZgeDYbkqDUNB3wQFBOBcngKicCAEW0SgQFScgeBIYhDDgRAGhcQx3zeHYzjESLosggABUEACZ8FBfB7jESMcK0CAD0YfLaCimKtHwfg4uvbgQDgHIIEMUR2DCnqCratyPISvBktS9KxEy7LcqwZrWuKsqKqqmroupBrDxgFbCuWCautGEw8Bw0ZYAcka8B+YhCHq8gqCmpKj1mjK0CynLzDEO6HugEqNoANl+tp-qgDqPO687+sGvzWCAA) -## Bootstrap FullCalendar Example +### Bootstrap FullCalendar Example ```javascript /** FullCalendar wrapper component */ diff --git a/docs/jsx.md b/docs/jsx.md index 10df264f8..561cec3d0 100644 --- a/docs/jsx.md +++ b/docs/jsx.md @@ -6,8 +6,8 @@ Explanation, examples, and build notes on how to use JSX in your Mithril.js-base - [Description](#description) - [Setup](#setup) -- [Production build](#production-build) - [Using Babel with Webpack](#using-babel-with-webpack) +- [Production build](#production-build) - [Differences with React](#differences-with-react) - [JSX vs hyperscript](#jsx-vs-hyperscript) - [Tips and Tricks](#tips-and-tricks) diff --git a/docs/keys.md b/docs/keys.md index 6ac6b7e89..3c0c6e107 100644 --- a/docs/keys.md +++ b/docs/keys.md @@ -6,7 +6,7 @@ Documentation on the special "key" attribute in Mithril.js, which tracks vnodes' - [What are keys?](#what-are-keys?) - [Key restrictions](#key-restrictions) -- [Linking model data in lists of views](#linking-model-data-to-views) +- [Linking model data in lists of views](#linking-model-data-in-lists-of-views) - [Keeping collections of animated objects glitch-free](#keeping-collections-of-animated-objects-glitch-free) - [Reinitializing views with single-child keyed fragments](#reinitializing-views-with-single-child-keyed-fragments) - [Common gotchas](#common-gotchas) @@ -438,7 +438,7 @@ users.map(function(user) { }) ``` -The first binds the key to the `User` component, but the outer fragment created by `users.map(...)` is entirely unkeyed. Wrapping a keyed element this way doesn't work, and the result could be anything ranging from extra requests each time the list is changed to inner form inputs losing their state. The resulting behavior would similar to the [post list's broken example](#linking-model-data-to-views), but without the issue of state corruption. +The first binds the key to the `User` component, but the outer fragment created by `users.map(...)` is entirely unkeyed. Wrapping a keyed element this way doesn't work, and the result could be anything ranging from extra requests each time the list is changed to inner form inputs losing their state. The resulting behavior would similar to the [post list's broken example](#linking-model-data-in-lists-of-views), but without the issue of state corruption. The second binds it to the `.wrapper` element, ensuring the outer fragment *is* keyed. This does what you likely wanted to do all along, and removing a user won't pose any issues with the state of other user instances. diff --git a/docs/layout.html b/docs/layout.html index 3e0fe4cd6..363019412 100644 --- a/docs/layout.html +++ b/docs/layout.html @@ -4,41 +4,48 @@