Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: MithrilJS/mithril.js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: panoply/mithril.js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: next
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 17 commits
  • 13 files changed
  • 7 contributors

Commits on Feb 7, 2023

  1. Bump minimatch from 3.0.4 to 3.1.2

    Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2.
    - [Release notes](https://github.com/isaacs/minimatch/releases)
    - [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
    - [Commits](isaacs/minimatch@v3.0.4...v3.1.2)
    
    ---
    updated-dependencies:
    - dependency-name: minimatch
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    dependabot[bot] committed Feb 7, 2023
    Copy the full SHA
    726d3bf View commit details
  2. Bump async from 2.6.3 to 2.6.4

    Bumps [async](https://github.com/caolan/async) from 2.6.3 to 2.6.4.
    - [Release notes](https://github.com/caolan/async/releases)
    - [Changelog](https://github.com/caolan/async/blob/v2.6.4/CHANGELOG.md)
    - [Commits](caolan/async@v2.6.3...v2.6.4)
    
    ---
    updated-dependencies:
    - dependency-name: async
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    dependabot[bot] committed Feb 7, 2023
    Copy the full SHA
    a1159b7 View commit details

Commits on Feb 23, 2023

  1. Copy the full SHA
    88da9e5 View commit details

Commits on Mar 12, 2023

  1. Fix typos in stream() docs (#2825)

    Co-authored-by: Claudia Meadows <[email protected]>
    mtsknn and dead-claudia authored Mar 12, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    ad9aa97 View commit details

Commits on May 4, 2023

  1. Copy the full SHA
    8cce14c View commit details
  2. Copy the full SHA
    2b897c4 View commit details

Commits on May 20, 2023

  1. Add missing m.censor to API navigation

    Not sure how I forgot about this when I added the method.
    dead-claudia committed May 20, 2023
    Copy the full SHA
    3c77beb View commit details

Commits on May 23, 2023

  1. Bump yaml and lint-staged

    Bumps [yaml](https://github.com/eemeli/yaml) to 2.2.2 and updates ancestor dependency [lint-staged](https://github.com/okonet/lint-staged). These dependencies need to be updated together.
    
    
    Updates `yaml` from 1.10.2 to 2.2.2
    - [Release notes](https://github.com/eemeli/yaml/releases)
    - [Commits](eemeli/yaml@v1.10.2...v2.2.2)
    
    Updates `lint-staged` from 12.3.4 to 13.2.1
    - [Release notes](https://github.com/okonet/lint-staged/releases)
    - [Commits](lint-staged/lint-staged@v12.3.4...v13.2.1)
    
    ---
    updated-dependencies:
    - dependency-name: yaml
      dependency-type: indirect
    - dependency-name: lint-staged
      dependency-type: direct:development
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    dependabot[bot] authored and dead-claudia committed May 23, 2023
    Copy the full SHA
    71ce364 View commit details

Commits on Jul 31, 2023

  1. Bump word-wrap from 1.2.3 to 1.2.4

    Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
    - [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
    - [Commits](jonschlinkert/word-wrap@1.2.3...1.2.4)
    
    ---
    updated-dependencies:
    - dependency-name: word-wrap
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    dependabot[bot] committed Jul 31, 2023
    Copy the full SHA
    03fabe5 View commit details
  2. Copy the full SHA
    1a12c67 View commit details
  3. Copy the full SHA
    ee7dcdf View commit details

Commits on Apr 23, 2024

  1. Bump gh-pages from 2.1.1 to 5.0.0

    Bumps [gh-pages](https://github.com/tschaub/gh-pages) from 2.1.1 to 5.0.0.
    - [Release notes](https://github.com/tschaub/gh-pages/releases)
    - [Changelog](https://github.com/tschaub/gh-pages/blob/main/changelog.md)
    - [Commits](tschaub/gh-pages@v2.1.1...v5.0.0)
    
    ---
    updated-dependencies:
    - dependency-name: gh-pages
      dependency-type: direct:development
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    dependabot[bot] authored and dead-claudia committed Apr 23, 2024
    Copy the full SHA
    2a8412e View commit details

Commits on Jun 8, 2024

  1. Temporarily host REM on fly to fix the docs

    JAForbes authored and dead-claudia committed Jun 8, 2024
    Copy the full SHA
    8c87814 View commit details
  2. Move from individual code owners to just pinging all collaborators

    Most collaborators have commit access, and it'd make it a little easier (and more likely) for pull requests to get reviewed. Also, most collaborators have merge access as well.
    dead-claudia committed Jun 8, 2024
    Copy the full SHA
    505d2d9 View commit details
  3. Bump qs from 6.5.2 to 6.5.3

    Bumps [qs](https://github.com/ljharb/qs) from 6.5.2 to 6.5.3.
    - [Release notes](https://github.com/ljharb/qs/releases)
    - [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md)
    - [Commits](ljharb/qs@v6.5.2...v6.5.3)
    
    ---
    updated-dependencies:
    - dependency-name: qs
      dependency-type: indirect
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    dependabot[bot] authored and dead-claudia committed Jun 8, 2024
    Copy the full SHA
    0443cc4 View commit details
  4. Tweak docs with warning to fix #2508 (#2895)

    Co-authored-by: Barney Carroll <[email protected]>
    dead-claudia and barneycarroll authored Jun 8, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    948bf52 View commit details

Commits on Jun 18, 2024

  1. Bump braces from 3.0.2 to 3.0.3 (#2896)

    dependabot[bot] authored Jun 18, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    86f49b0 View commit details
Showing with 599 additions and 519 deletions.
  1. +1 −1 .github/CODEOWNERS
  2. +1 −1 README.md
  3. +3 −3 docs/index.md
  4. +1 −0 docs/nav-methods.md
  5. +9 −9 docs/simple-application.md
  6. +4 −4 docs/stream.md
  7. +3 −3 docs/vnodes.md
  8. +2 −2 examples/editor/index.html
  9. +561 −491 package-lock.json
  10. +2 −2 package.json
  11. +1 −1 render/hyperscript.js
  12. +9 −0 render/tests/test-hyperscript.js
  13. +2 −2 scripts/generate-docs.js
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @dead-claudia @StephanHoyer
* @MithrilJS/Collaborators
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
[![Donate at OpenCollective](https://img.shields.io/opencollective/all/mithriljs.svg?colorB=brightgreen)](https://opencollective.com/mithriljs) &nbsp;
[![Zulip, join chat](https://img.shields.io/badge/zulip-join_chat-brightgreen.svg)](https://mithril.zulipchat.com/)

- [What is Mithril.js?](#what-is-mithriljs?)
- [What is Mithril.js?](#what-is-mithriljs)
- [Installation](#installation)
- [Documentation](#documentation)
- [Getting Help](#getting-help)
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -321,7 +321,7 @@ m.route(root, "/splash", {

Basically, XHR is just a way to talk to a server.

Let's change our click counter to make it save data on a server. For the server, we'll use [REM](https://rem-rest-api.herokuapp.com), a mock REST API designed for toy apps like this tutorial.
Let's change our click counter to make it save data on a server. For the server, we'll use [REM](https://mithril-rem.fly.dev), a mock REST API designed for toy apps like this tutorial.

First we create a function that calls `m.request`. The `url` specifies an endpoint that represents a resource, the `method` specifies the type of action we're taking (typically the `PUT` method [upserts](https://en.wiktionary.org/wiki/upsert)), `body` is the payload that we're sending to the endpoint and `withCredentials` means to enable cookies (a requirement for the REM API to work)

@@ -330,7 +330,7 @@ var count = 0
var increment = function() {
m.request({
method: "PUT",
url: "//rem-rest-api.herokuapp.com/api/tutorial/1",
url: "//mithril-rem.fly.dev/api/tutorial/1",
body: {count: count + 1},
withCredentials: true,
})
@@ -366,7 +366,7 @@ var count = 0
var increment = function() {
m.request({
method: "PUT",
url: "//rem-rest-api.herokuapp.com/api/tutorial/1",
url: "//mithril-rem.fly.dev/api/tutorial/1",
body: {count: count + 1},
withCredentials: true,
})
1 change: 1 addition & 0 deletions docs/nav-methods.md
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@
- [m.trust](trust.md)
- [m.fragment](fragment.md)
- [m.redraw](redraw.md)
- [m.censor](censor.md)
- Optional
- [Stream](stream.md)
- Tooling
18 changes: 9 additions & 9 deletions docs/simple-application.md
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ A complete walkthrough tutorial for building your first simple application in Mi

Let's develop a simple application that shows off how to do most of the major things you would need to deal with while using Mithril.

*An interactive example of the end result can be seen [here](https://flems.io/#0=N4IgzgpgNhDGAuEAmIBcICqkBOBZA9ktAHQBWYIANCAGYCWMFqA2qAHYCGAthGpjgSJQyFarHxtEkvgDcO2AARYIigLwLgAHTYLdCqHTDxUC5gF1K2vfvwckAGUPGFNAK5sEdCQAoAlBqtrPWwIeFdsHS5iEIBHVwgjby0dINSeeAALQhNNEABxAFEAFVzLFNTrcKgckAz4eAAHMFQAehaQrgBaEKNOjga6YgyVfABrV36G4nEuFv66FtccMFLAir0AdzpMgGEQokk6DihmhXhseLL1gF9fNaDiTIg2bzcPeC8XntcoeH9k9bWZTYYgGIwKdTfX7EJAceAce7WW73a5le6wcIhSQmYCo+5QWxIExvTw+OhIf6I4KhcKRaIQOIJeBJKlpUJZIkKXKFEpUVlBKo1OqNZptDrdJl9AZDEbjSbTfCzeaLZYtXIKADUCnJV0Bui2u32zw+x1O50u-OR5QeTxeJI+PihfwC1vWwOmmONEIUTstd2teLY9zAHBkEGJ7lJL0prupYQiCiisXiiQBesT7OyXJAAAUMLzdXrBdnhU1Wu0IF0evApYNhtgxhMGlMZnMBiqVGA1SBNUocB7sFj4MQdfzrAAjQgATxM7oxg+NhcBBoye2QxqOJxM5ogS6R-qR2mu2io4GgcAdbCYIAAjKgbwBmECo9jcXjoYGOIwiU-iST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ohWOAoG8AA2BosCABqKhYScAANyBDorTaCJgABMAAGfx4TPLaG0KPFuaZIk02id4hJsDFpRySboOiINOhbCQJkEwN44nVMSb-IMbB55sFcCNTJ2S4kKHaQ+XJSSPKpO0uREa5FOhGCnDAdxEgICFMTM7NpHScm1JSA0OwSBoI0xMHEnpKSGn9N0vpeKaZxya1GDTBs7hOTwIWpcjgUzJzYBod4-xCgwD4AMEgBQ8CkCfKmeIAk2ATDwIfICqZKywAaxnAoccBJYCjCma0tg6y5k3gWboJZnzVkmAAByPJvAAVmRWcCAYNOhEHENgOEnxxlsEmXUvpOAdK9D2agLIYZFBplBjWElwVyUSBMGclQBgqWbPqf7U6UARogrBSYSFGCYURJmfCuZ7S8UgyFaktWI1bn3KRbA55rz3mfKQDc4KCNuh2DoEsEwD58WThKWAOgAAvdFELjWkRtcCwwkqIVQtlSkOFCL2lVPxailZbA1nzNgbi-FZSKk5LiQAUlVQ02OUcdAHKOScvibBzkQBzUau5kiHk6peeSfVXzAiatImSlZFqFBWpVYEH5wV-mAofO60FqlwXQQFRATo0roWwvlf68NUzg1OsDRG5VUz2XErgFyy8lLqXJOFcmnlzKVAavTacrN-yIAYt3buoVz4LAgAFaMJgrBS5vnAdscSDBTxVD4KWUUixvrHIVLMPqmRsAMAAAIxOIHE4gAAWFon7b3CD6g04B-1AZ8DALAb9DQorXDMNcIAA)*
*An interactive example of the end result can be seen [here](https://flems.io/#0=N4IgzgpgNhDGAuEAmIBcICqkBOBZA9ktAHQBWYIANCAGYCWMFqA2qAHYCGAthGpjgSJQyFarHxtEkvgDcO2AARYIigLwLgAHTYLdCqHTDxUC5gF1K2vfvwckAGUPGFNAK5sEdCQAoAlBqtrPWwIeFdsHS5iEIBHVwgjby0dINSeeAALQhNNEABxAFEAFVzLFNTrcKgckAz4eAAHMFQAehauOkzsBgBaEKiaKABPYiIZFo4GuhbXHDBSwIq9AHdOjIBhEKJJOg4oZoV4bHiypYBfX0Wg4kyINm83D3gve5CwVyh4f2Sl62Vs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Y31rlOnwFwUsIooAAAF7zEGScQU8AGJIMHosPauIB-qAz4GAWA3QGjRTOGYM4QA)*

First let's create an entry point for the application. Create a file `index.html`:

@@ -80,7 +80,7 @@ var User = {
module.exports = User
```

Then we can add an `m.request` call to make an XHR request. For this tutorial, we'll make XHR calls to the REM (DEAD LINK, FIXME: https //rem-rest-api.herokuapp.com/) API, a mock REST API designed for rapid prototyping. This API returns a list of users from the `GET https://rem-rest-api.herokuapp.com/api/users` endpoint. Let's use `m.request` to make an XHR request and populate our data with the response of that endpoint.
Then we can add an `m.request` call to make an XHR request. For this tutorial, we'll make XHR calls to the REM (DEAD LINK, FIXME: https //rem-rest-api.herokuapp.com/) API, a mock REST API designed for rapid prototyping. This API returns a list of users from the `GET https://mithril-rem.fly.dev/api/users` endpoint. Let's use `m.request` to make an XHR request and populate our data with the response of that endpoint.

*Note: third-party cookies may have to be enabled for the REM endpoint to work.*

@@ -93,7 +93,7 @@ var User = {
loadList: function() {
return m.request({
method: "GET",
url: "https://rem-rest-api.herokuapp.com/api/users",
url: "https://mithril-rem.fly.dev/api/users",
withCredentials: true,
})
.then(function(result) {
@@ -422,7 +422,7 @@ var User = {
loadList: function() {
return m.request({
method: "GET",
url: "https://rem-rest-api.herokuapp.com/api/users",
url: "https://mithril-rem.fly.dev/api/users",
withCredentials: true,
})
.then(function(result) {
@@ -445,7 +445,7 @@ var User = {
loadList: function() {
return m.request({
method: "GET",
url: "https://rem-rest-api.herokuapp.com/api/users",
url: "https://mithril-rem.fly.dev/api/users",
withCredentials: true,
})
.then(function(result) {
@@ -457,7 +457,7 @@ var User = {
load: function(id) {
return m.request({
method: "GET",
url: "https://rem-rest-api.herokuapp.com/api/users/" + id,
url: "https://mithril-rem.fly.dev/api/users/" + id,
withCredentials: true,
})
.then(function(result) {
@@ -563,7 +563,7 @@ var User = {
loadList: function() {
return m.request({
method: "GET",
url: "https://rem-rest-api.herokuapp.com/api/users",
url: "https://mithril-rem.fly.dev/api/users",
withCredentials: true,
})
.then(function(result) {
@@ -575,7 +575,7 @@ var User = {
load: function(id) {
return m.request({
method: "GET",
url: "https://rem-rest-api.herokuapp.com/api/users/" + id,
url: "https://mithril-rem.fly.dev/api/users/" + id,
withCredentials: true,
})
.then(function(result) {
@@ -586,7 +586,7 @@ var User = {
save: function() {
return m.request({
method: "PUT",
url: "https://rem-rest-api.herokuapp.com/api/users/" + User.current.id,
url: "https://mithril-rem.fly.dev/api/users/" + User.current.id,
body: User.current,
withCredentials: true,
})
8 changes: 4 additions & 4 deletions docs/stream.md
Original file line number Diff line number Diff line change
@@ -462,7 +462,7 @@ Pending streams can be created by calling `stream()` with no parameters.
var pending = stream()
```

If a stream is dependent on more than one stream, any of its parent streams is in a pending state, the dependent streams is also in a pending state, and does not update its value.
If a stream is dependent on more than one stream and any of its parent streams is in a pending state, the dependent stream is also in a pending state, and does not update its value.

```javascript
var a = stream(5)
@@ -558,13 +558,13 @@ console.log(serialized) // logs 123

Unlike libraries like Knockout, Mithril.js streams do not trigger re-rendering of templates. Redrawing happens in response to event handlers defined in Mithril.js component views, route changes, or after [`m.request`](request.md) calls resolve.

If redrawing is desired in response to other asynchronous events (e.g. `setTimeout`/`setInterval`, websocket subscription, 3rd party library event handler, etc), you should manually call [`m.redraw()`](redraw.md)
If redrawing is desired in response to other asynchronous events (e.g. `setTimeout`/`setInterval`, websocket subscription, 3rd party library event handler, etc.), you should manually call [`m.redraw()`](redraw.md).

---

### What is Fantasy Land

[Fantasy Land](https://github.com/fantasyland/fantasy-land) specifies interoperability of common algebraic structures. In plain english, that means that libraries that conform to Fantasy Land specs can be used to write generic functional style code that works regardless of how these libraries implement the constructs.
[Fantasy Land](https://github.com/fantasyland/fantasy-land) specifies interoperability of common algebraic structures. In plain English, that means that libraries that conform to Fantasy Land specs can be used to write generic functional style code that works regardless of how these libraries implement the constructs.

For example, say we want to create a generic function called `plusOne`. The naive implementation would look like this:

@@ -574,7 +574,7 @@ function plusOne(a) {
}
```

The problem with this implementation is that it can only be used with a number. However it's possible that whatever logic produces a value for `a` could also produce an error state (wrapped in a Maybe or an Either from a library like [Sanctuary](https://github.com/sanctuary-js/sanctuary) or [Ramda-Fantasy](https://github.com/ramda/ramda-fantasy)), or it could be a Mithril.js stream, or a [flyd](https://github.com/paldepind/flyd) stream, etc. Ideally, we wouldn't want to write a similar version of the same function for every possible type that `a` could have and we wouldn't want to be writing wrapping/unwrapping/error handling code repeatedly.
The problem with this implementation is that it can only be used with a number. However it's possible that whatever logic produces a value for `a` could also produce an error state (wrapped in a Maybe or an Either from a library like [Sanctuary](https://github.com/sanctuary-js/sanctuary) or [Ramda-Fantasy](https://github.com/ramda/ramda-fantasy)), or it could be a Mithril.js stream, a [Flyd](https://github.com/paldepind/flyd) stream, etc. Ideally, we wouldn't want to write a similar version of the same function for every possible type that `a` could have and we wouldn't want to be writing wrapping/unwrapping/error handling code repeatedly.

This is where Fantasy Land can help. Let's rewrite that function in terms of a Fantasy Land algebra:

6 changes: 3 additions & 3 deletions docs/vnodes.md
Original file line number Diff line number Diff line change
@@ -112,11 +112,11 @@ When creating libraries that emit vnodes, you should use this module instead of

### Avoid anti-patterns

#### Avoid memoizing mutable vnodes
#### Avoid reusing vnodes

Vnodes are supposed to represent the state of the DOM at a certain point in time. Mithril.js' rendering engine assumes a reused vnode is unchanged, so modifying a vnode that was used in a previous render will result in undefined behavior.
Vnodes are supposed to represent the state of the DOM at a certain point in time. Mithril.js's rendering engine assumes a reused vnode is unchanged, so modifying a vnode that was used in a previous render will result in undefined behavior.

It is possible to reuse vnodes to prevent a diff, but it's preferable to use the `onbeforeupdate` hook to make your intent clear to other developers (or your future self).
It is possible to reuse vnodes in place to prevent a diff, but it's preferable to use the [`onbeforeupdate`](lifecycle.md#onbeforeupdate).

#### Avoid passing model data directly to components via attributes

4 changes: 2 additions & 2 deletions examples/editor/index.html
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
</head>
<body>
<div id="editor"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/0.6.0/marked.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/5.0.2/marked.min.js"></script>
<script src="../../mithril.js"></script>
<script>
//model
@@ -31,7 +31,7 @@
oninput: function (e) { state.update(e.target.value) },
value: state.text
}),
m(".preview", m.trust(marked(state.text))),
m(".preview", m.trust(marked.parse(state.text))),
]
}
}
Loading