Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3 proposal #2982

Open
wants to merge 95 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
c636c2f
Enable ES2015 lint and minifier code gen support
dead-claudia Sep 26, 2024
3e97cc9
Optimize generated IIFE slightly
dead-claudia Sep 26, 2024
f07feb9
Add keyed perf tests, assert no duplicates in keyed fragments
dead-claudia Sep 26, 2024
f291d28
Add duplicate key check, deduplicate code, use ES6
dead-claudia Sep 26, 2024
0106367
Normalize xlink, simplify attrs update a bit
dead-claudia Sep 26, 2024
c3e90f5
Drop `m.trust` support
dead-claudia Sep 26, 2024
ca65f7a
Drop object component support
dead-claudia Sep 27, 2024
e9fad45
`key` attr -> `m.key(...)`, drop `domSize`, remove redundancy
dead-claudia Oct 2, 2024
2707de3
Use the `.state` property for keys
dead-claudia Oct 2, 2024
ae28e2a
Move the DOM event listener to `vnode.instance`
dead-claudia Oct 2, 2024
7aca843
Move state object creation to hyperscript
dead-claudia Oct 2, 2024
b724902
Move `m.render` out of initialization closure
dead-claudia Oct 2, 2024
3ade35c
Drop `m.request`
dead-claudia Oct 3, 2024
a452105
Migrate `m.buildPathname` to `m.p` and remove the path params argumen…
dead-claudia Oct 3, 2024
8c619c3
Add a `m.withProgress` to replace `onprogress` with `fetch`.
dead-claudia Oct 3, 2024
1b0818e
Have `m.mount` mount a view function rather than a full component
dead-claudia Oct 3, 2024
6caacf2
Drop a couple forgotten tests
dead-claudia Oct 3, 2024
57edf21
Add lazy loader
dead-claudia Oct 3, 2024
6b3c7b3
Toss the "route" part of the router
dead-claudia Oct 3, 2024
ccea9a1
Merge `Vnode` with the hyperscript module
dead-claudia Oct 3, 2024
dae2208
Rename and move lone remaining `pathname` submodule to make more sense
dead-claudia Oct 3, 2024
3668dc7
Drop remaining reference to `assign`
dead-claudia Oct 3, 2024
03fd640
Merge query string building into `m.p`, drop unused query string parser
dead-claudia Oct 3, 2024
eb0031c
Normalize the callback style in `test-p.js`.
dead-claudia Oct 3, 2024
b04519d
Make the event dictionary a proper class
dead-claudia Oct 3, 2024
8fbc46a
Finish ES6ifying hyperscript factories
dead-claudia Oct 3, 2024
1418bd3
Drop stale recycling tests
dead-claudia Oct 3, 2024
13c2e63
Add `m.tracked` utility for tracking delayed removals
dead-claudia Oct 3, 2024
cd20a00
Make `m.lazy` not a higher-order factory - it doesn't need to be one
dead-claudia Oct 3, 2024
454f8e7
Drop `onbeforeremove`
dead-claudia Oct 3, 2024
60de2e1
`onbeforeremove` -> `m.retain()`
dead-claudia Oct 4, 2024
1efdb78
Re-duplicate children
dead-claudia Oct 4, 2024
537f828
Drop `handleEvent` method support, wait for promises in event listeners
dead-claudia Oct 4, 2024
9070429
Revise a comment
dead-claudia Oct 4, 2024
5c2bf31
Drop `oninit`, replace all remaining lifecycle methods with `m.layout`
dead-claudia Oct 4, 2024
2942ea5
Drop old vnode state stuff except for components
dead-claudia Oct 4, 2024
168b403
Add `m.init` and `m.use` convenience utilities, simplify fragments, f…
dead-claudia Oct 4, 2024
b168f74
Migrate components to simple functions and closures
dead-claudia Oct 4, 2024
d652f98
Drop `m.fragment`, try to create attrs object less in hyperscript fac…
dead-claudia Oct 4, 2024
bd09d8a
Stop propagating hooks, correct the circular rendering check
dead-claudia Oct 4, 2024
933d4b5
Improve perf tests
dead-claudia Oct 5, 2024
d7d8bef
Simplify the keyed diff fuzzer
dead-claudia Oct 5, 2024
67a30f4
Simplify the renderer, strip outdated and redundant tests, reject reu…
dead-claudia Oct 5, 2024
84b0950
Split code + tests, move source into dedicated directory
dead-claudia Oct 5, 2024
49ec364
Redo build and pack system, simplify a few remaining bits
dead-claudia Oct 5, 2024
55a8071
Knock out all the intermediate closures, do a better job cleaning up,…
dead-claudia Oct 6, 2024
c0821cb
Try to get a better profile view
dead-claudia Oct 6, 2024
210d997
Improve bundle size, move to type masks to boost performance
dead-claudia Oct 11, 2024
044d1b8
Switch from `m.layout` signal out `m.remove`, merge create/update cal…
dead-claudia Oct 11, 2024
8ddc288
Add context, migrate router to use it
dead-claudia Oct 11, 2024
21085ce
Rearrange tests to mirror source
dead-claudia Oct 11, 2024
beaad3b
Optimize stream, remove deprecated bit, simplify `combine`
dead-claudia Oct 11, 2024
84472c4
Move `redraw` to an options bag
dead-claudia Oct 11, 2024
70cc05b
Move router functions to arrow functions to save a little space
dead-claudia Oct 11, 2024
1cf9de3
`undefined` -> `null` to save a few bytes
dead-claudia Oct 12, 2024
455765a
Add bi-edge debouncing + throttling rate limiters
dead-claudia Oct 12, 2024
118d748
Stub out error handling
dead-claudia Oct 12, 2024
4137f97
Fix stray outdated benchmark reference
dead-claudia Oct 12, 2024
313d004
Add ops per sec counter
dead-claudia Oct 12, 2024
726e79f
Optimize error handling
dead-claudia Oct 12, 2024
2a60973
Ensure `is` is always set in custom elements
dead-claudia Oct 12, 2024
f48beca
Normalize the render vnode input to a single unitary vnode, not an array
dead-claudia Oct 12, 2024
b889448
Clean up the router on remove, remove unneeded hashchange event
dead-claudia Oct 12, 2024
3b7788b
Remove the no-longer-necessary options parameter to `{add,remove}Even…
dead-claudia Oct 12, 2024
95897a3
Diff final URL before redrawing, to prevent unnecessary redraws
dead-claudia Oct 12, 2024
966d1c0
Allow building query strings independently of paths (again)
dead-claudia Oct 12, 2024
30e5ed1
Restore current size
dead-claudia Oct 12, 2024
86b3c31
Update the copy a bit, drop official IE support
dead-claudia Oct 12, 2024
2872ca2
Stop displaying size in the README
dead-claudia Oct 12, 2024
9099bcc
Forgot to port the actual key assignment over in the benchmark
dead-claudia Oct 12, 2024
1fb5104
Unrestrict a bunch of actually valid syntax
dead-claudia Oct 20, 2024
c5c4b2f
Add `m.match`, optimize `m.p` a ton
dead-claudia Oct 20, 2024
fa39b98
Remove some useless `Object.assign`s
dead-claudia Oct 20, 2024
310a32b
Remove unnecessary `finally` block
dead-claudia Oct 20, 2024
b33349a
Improve post-perf UI a little
dead-claudia Oct 20, 2024
3da7a1d
Pre-render tree in benchmark so it's only checking update in `render …
dead-claudia Oct 20, 2024
01fc41e
ES6ify an event handler (and fix its name)
dead-claudia Oct 20, 2024
9dd8d17
Improve benchmark more
dead-claudia Oct 21, 2024
fee0cca
Boost `m.p` performance by a lot
dead-claudia Oct 21, 2024
451aa18
Tolerate absence of `/dist`
dead-claudia Oct 21, 2024
36d4cb3
Resolve remaining issues with benchmarks, explain with a lengthy just…
dead-claudia Oct 29, 2024
2e75897
Address some feedback around naming and (indirectly) `m.key`, optimiz…
dead-claudia Oct 30, 2024
5018ad0
Move context to `this` argument
dead-claudia Oct 30, 2024
5d79b07
Make routed links more concise, stop throwing when retaining nothing,…
dead-claudia Oct 30, 2024
f99850e
Further simplify routing
dead-claudia Oct 30, 2024
0c99734
Use `queueMicrotask` to avoid some awkward `await 0`s.
dead-claudia Oct 30, 2024
814261f
Add more type checks, unify auto-redraw logic, optimize element creat…
dead-claudia Oct 30, 2024
cd26097
Revise an outdated comment, cheat a little bit on redraw context
dead-claudia Oct 30, 2024
8cafcfe
Fix a type comment, make things use a shared noop where helpful
dead-claudia Oct 30, 2024
953665e
Add a single-value tracker, optimize tracked handle.
dead-claudia Oct 31, 2024
3220a25
Bring back `m.request` - it's too useful.
dead-claudia Oct 31, 2024
76389d4
Avoid splicing samples
dead-claudia Nov 4, 2024
17e89ea
Add Node.js types for a better autocomplete experience in scripts
dead-claudia Nov 4, 2024
584069f
Optimize the style property update flow and reduce its overhead
dead-claudia Nov 6, 2024
7c5d9b7
Revise some test names
dead-claudia Nov 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,4 @@
/.eslintcache

# These are artifacts from various scripts
/mithril.js
/mithril.min.js
/stream/stream.min.js
/dist
105 changes: 96 additions & 9 deletions .eslintrc.js β†’ .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,102 @@
"use strict"
{
"overrides": [
{"files": "*.cjs", "parserOptions": {"sourceType": "script"}},
{
"files": ["scripts/**"],
"env": {
"node": true,
"es2022": true
},
"parserOptions": {
"ecmaVersion": 2022
},
"rules": {
"no-process-env": "off",
"no-restricted-syntax": "off"
}
},
{
"files": ["performance/**"],
"env": {
"browser": true
},
"rules": {
"no-restricted-syntax": ["error",
{"selector": "Literal[bigint]", "message": "BigInts are not supported in ES2018"},
{"selector": "ChainExpression", "message": "Optional chaining is not supported in ES2018"},
{"selector": "BinaryExpression[operator='??']", "message": "Nullish coalescing is not supported in ES2018"},
{"selector": "MetaProperty[meta.name='import'][property.name='meta']", "message": "`import.meta` is not supported in ES2018"},
{"selector": "ExportAllDeclaration[exported!=null]", "message": "`export * as foo from ...` is not supported in ES2018"},
{"selector": "CatchClause[param=null]", "message": "Omitted `catch` bindings are not supported in ES2018"},
{"selector": "Literal[regex.flags=/s/]", "message": "`/.../s` is not supported in ES2018"},
{"selector": "Literal[regex.flags=/v/]", "message": "`/.../v` is not supported in ES2018"},

{"selector": "MemberExpression[property.name='matchAll']", "message": "`string.matchAll` is not supported in ES2018"},
{"selector": "MemberExpression[property.name='trimStart']", "message": "`string.trimStart` is not supported in ES2018"}
]
}
},
{
"files": ["tests/**", "test-utils/**"],
"env": {
"node": true
},
"rules": {
"no-process-env": "off",
"no-restricted-syntax": ["error",
{"selector": "Literal[bigint]", "message": "BigInts are not supported in ES2018"},
{"selector": "ChainExpression", "message": "Optional chaining is not supported in ES2018"},
{"selector": "BinaryExpression[operator='??']", "message": "Nullish coalescing is not supported in ES2018"},
{"selector": "MetaProperty[meta.name='import'][property.name='meta']", "message": "`import.meta` is not supported in ES2018"},
{"selector": "ExportAllDeclaration[exported!=null]", "message": "`export * as foo from ...` is not supported in ES2018"},
{"selector": "CatchClause[param=null]", "message": "Omitted `catch` bindings are not supported in ES2018"},
{"selector": "Literal[regex.flags=/s/]", "message": "`/.../s` is not supported in ES2018"},
{"selector": "Literal[regex.flags=/v/]", "message": "`/.../v` is not supported in ES2018"},

module.exports = {
{"selector": "MemberExpression[property.name='matchAll']", "message": "`string.matchAll` is not supported in ES2018"},
{"selector": "MemberExpression[property.name='trimStart']", "message": "`string.trimStart` is not supported in ES2018"}
]
}
}
],
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
"es2018": true
},
"globals": {
"ReadableStream": true,
"Response": true,
"queueMicrotask": true,
"URL": true,
"URLSearchParams": true,
"AbortController": true,
"console": true
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"extends": "eslint:recommended",
"rules": {
"no-restricted-syntax": ["error",
{"selector": "Literal[bigint]", "message": "BigInts are not supported in ES2018"},
{"selector": "ChainExpression", "message": "Optional chaining is not supported in ES2018"},
{"selector": "BinaryExpression[operator='??']", "message": "Nullish coalescing is not supported in ES2018"},
{"selector": "MetaProperty[meta.name='import'][property.name='meta']", "message": "`import.meta` is not supported in ES2018"},
{"selector": "ExportAllDeclaration[exported!=null]", "message": "`export * as foo from ...` is not supported in ES2018"},
{"selector": "CatchClause[param=null]", "message": "Omitted `catch` bindings are not supported in ES2018"},
{"selector": "Function[async=true][generator=true]", "message": "Async generators are not supported in ES2018"},
{"selector": "Literal[regex.flags=/v/]", "message": "`/.../v` is not supported in ES2018"},

{"selector": "MemberExpression[property.name='matchAll']", "message": "`string.matchAll` is not supported in ES2018"},
{"selector": "MemberExpression[property.name='trimStart']", "message": "`string.trimStart` is not supported in ES2018"},

{"selector": "VariableDeclaration[kind!='var']", "message": "Keep to `var` in `src/` to ensure the module compresses better"}
],
"no-restricted-properties": ["error",
{"object": "Promise", "property": "allSettled", "message": "`Promise.allSettled` is not supported in ES2018"},
{"object": "Object", "property": "fromEntries", "message": "`Object.fromEntries` is not supported in ES2018"}
],

"accessor-pairs": "error",
"array-bracket-spacing": [
"error",
Expand Down Expand Up @@ -141,7 +229,6 @@ module.exports = {
"no-restricted-globals": "error",
"no-restricted-imports": "error",
"no-restricted-modules": "error",
"no-restricted-syntax": "error",
"no-return-assign": "off",
"no-script-url": "error",
"no-self-compare": "error",
Expand Down Expand Up @@ -207,7 +294,7 @@ module.exports = {
"require-yield": "error",
"semi": "off",
"semi-spacing": "off",
"sort-imports": "error",
"sort-imports": ["error", {"allowSeparatedGroups": true}],
"sort-vars": "off",
"space-before-blocks": "off",
"space-before-function-paren": "off",
Expand All @@ -228,4 +315,4 @@ module.exports = {
"yoda": "off"
},
"root": true
};
}
2 changes: 0 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
* text=auto
/mithril.js binary
/mithril.min.js binary

# Assets
*.png binary
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,10 @@
/.vscode
/.DS_Store
/.eslintcache

# Exclude the compiled output. It's available through prerelease publishes anyways, so there's no
# need to keep a spare copy in the repo.
/dist

# For an easier time working with console logs from profiles.
/*.log
22 changes: 0 additions & 22 deletions .npmignore

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2017 Leo Horie
Copyright (c) 2024 Mithril Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

## What is Mithril.js?

A modern client-side JavaScript framework for building Single Page Applications. It's small (<!-- size -->9.05 KB<!-- /size --> gzipped), fast and provides routing and XHR utilities out of the box.
A modern client-side JavaScript framework for web applications big and small. It's small, fast, and highly stable. And it offers utilities for routing, state management, and more right out of the box.

Mithril.js is used by companies like Vimeo and Nike, and open source platforms like Lichess πŸ‘.
Mithril.js has been used by companies like Vimeo, Nike, and Amazon, and open source platforms like Lichess. πŸ‘

Mithril.js supports IE11, Firefox ESR, and the last two versions of Firefox, Edge, Safari, and Chrome. No polyfills required. πŸ‘Œ
Mithril.js supports Firefox ESR and the last two versions of Firefox, Edge, Safari, and Chrome. No polyfills required. πŸ‘Œ

## Installation

Expand Down
49 changes: 0 additions & 49 deletions api/mount-redraw.js

This file was deleted.

Loading