Merge remote-tracking branch 'upstream/next' into next
This commit is contained in:
commit
8737c7e2c1
6 changed files with 246 additions and 33 deletions
|
|
@ -1,7 +1,11 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
- "0.12"
|
||||
- "4.1"
|
||||
|
||||
script:
|
||||
- grunt test
|
||||
- grunt teste2e
|
||||
|
||||
sudo: false
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ Mithril is a client-side MVC framework - a tool to organize code in a way that i
|
|||
|
||||
### Light-weight
|
||||
|
||||
- Only 5kb gzipped, no dependencies
|
||||
- Only 7kb gzipped, no dependencies
|
||||
- Small API, small learning curve
|
||||
|
||||
### Robust
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ This page aims to provide a comparison between Mithril and some of the most wide
|
|||
|
||||
### Code Size
|
||||
|
||||
One of the most obvious differences between Mithril and most frameworks is in file size: Mithril is around 8kb gzipped and has no dependencies on other libraries.
|
||||
One of the most obvious differences between Mithril and most frameworks is in file size: Mithril is around 7kb gzipped and has no dependencies on other libraries.
|
||||
|
||||
Note that while a small gzipped size can look appealing, that number is often used to "hide the weight" of the uncompressed code: remember that the decompressed Javascript still needs to be parsed and evaluated on every page load, and this cost (which can be in the dozens of milliseconds range for some frameworks in some browsers) cannot be cached.
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
Mithril is a client-side Javascript MVC framework, i.e. it's a tool to make application code divided into a data layer (called **M**odel), a UI layer (called **V**iew), and a glue layer (called **C**ontroller)
|
||||
|
||||
Mithril is around 8kb gzipped thanks to its [small, focused, API](mithril.md). It provides a templating engine with a virtual DOM diff implementation for performant rendering, utilities for high-level modelling via functional composition, as well as support for routing and componentization.
|
||||
Mithril is around 7kb gzipped thanks to its [small, focused, API](mithril.md). It provides a templating engine with a virtual DOM diff implementation for performant rendering, utilities for high-level modelling via functional composition, as well as support for routing and componentization.
|
||||
|
||||
The goal of the framework is to make application code discoverable, readable and maintainable, and hopefully help you become an even better developer.
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
<div class="feature col(4,4,12)">
|
||||
<h2>Light-weight</h2>
|
||||
<ul>
|
||||
<li>Only 8kb gzipped, no dependencies</li>
|
||||
<li>Only 7kb gzipped, no dependencies</li>
|
||||
<li>Small API, small learning curve</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
|||
267
mithril.d.ts
vendored
267
mithril.d.ts
vendored
|
|
@ -28,22 +28,6 @@ declare module _mithril {
|
|||
MithrilComponent<T>>
|
||||
): MithrilVirtualElement<T>;
|
||||
|
||||
/**
|
||||
* Initializes a component for use with m.render, m.mount, etc.
|
||||
*
|
||||
* @param component A component.
|
||||
* @param args Arguments to optionally pass to the component.
|
||||
* @return A component.
|
||||
*
|
||||
* @see m.render
|
||||
* @see m.mount
|
||||
* @see m
|
||||
*/
|
||||
<T extends MithrilController>(
|
||||
component: MithrilComponent<T>,
|
||||
...args: any[]
|
||||
): MithrilComponent<T>;
|
||||
|
||||
/**
|
||||
* Creates a virtual element for use with m.render, m.mount, etc.
|
||||
*
|
||||
|
|
@ -67,18 +51,121 @@ declare module _mithril {
|
|||
* Initializes a component for use with m.render, m.mount, etc.
|
||||
* Shorthand for m.component.
|
||||
*
|
||||
* @param selector A component.
|
||||
* @param args Arguments to optionally pass to the component.
|
||||
* @return A component.
|
||||
* @param component A mithril component.
|
||||
* @return A mithril component.
|
||||
*
|
||||
* @see m.render
|
||||
* @see m.mount
|
||||
* @see m.component
|
||||
*/
|
||||
<T extends MithrilController>(
|
||||
component: MithrilComponent<T>,
|
||||
...args: any[]
|
||||
): MithrilComponent<T>;
|
||||
<TController extends MithrilController>(
|
||||
component: MithrilComponent<TController>
|
||||
): MithrilComponent<TController>;
|
||||
|
||||
/**
|
||||
* Initializes a component for use with m.render, m.mount, etc.
|
||||
* Shorthand for m.component.
|
||||
*
|
||||
* @param component A parameterized component.
|
||||
* @param arg1 First argument to bind to the component.
|
||||
* @return A component bound with the supplied arguments.
|
||||
*
|
||||
* @see m.render
|
||||
* @see m.mount
|
||||
* @see m.component
|
||||
*/
|
||||
<TController extends MithrilController, T1>(
|
||||
component: ParameterizedMithrilComponent<TController, T1, void, void, void>,
|
||||
arg1: T1
|
||||
): MithrilComponent<TController>;
|
||||
|
||||
/**
|
||||
* Initializes a component for use with m.render, m.mount, etc.
|
||||
* Shorthand for m.component.
|
||||
*
|
||||
* @param component A parameterized component.
|
||||
* @param arg1 First argument to bind to the component.
|
||||
* @param arg2 Second argument to bind to the component.
|
||||
* @return A component bound with the supplied arguments.
|
||||
*
|
||||
* @see m.render
|
||||
* @see m.mount
|
||||
* @see m.component
|
||||
*/
|
||||
<TController extends MithrilController, T1, T2>(
|
||||
component: ParameterizedMithrilComponent<TController, T1, T2, void, void>,
|
||||
arg1: T1,
|
||||
arg2: T2
|
||||
): MithrilComponent<TController>;
|
||||
|
||||
/**
|
||||
* Initializes a component for use with m.render, m.mount, etc.
|
||||
* Shorthand for m.component.
|
||||
*
|
||||
* @param component A parameterized component.
|
||||
* @param arg1 First argument to bind to the component.
|
||||
* @param arg2 Second argument to bind to the component.
|
||||
* @param arg3 Third argument to bind to the component.
|
||||
* @return A component bound with the supplied arguments.
|
||||
*
|
||||
* @see m.render
|
||||
* @see m.mount
|
||||
* @see m.component
|
||||
*/
|
||||
<TController extends MithrilController, T1, T2, T3>(
|
||||
component: ParameterizedMithrilComponent<TController, T1, T2, T3, void>,
|
||||
arg1: T1,
|
||||
arg2: T2,
|
||||
arg3: T3
|
||||
): MithrilComponent<TController>;
|
||||
|
||||
/**
|
||||
* Initializes a parameterized component for use with m.render, m.mount, etc.
|
||||
* Shorthand for m.component.
|
||||
*
|
||||
* @param component A parameterized component.
|
||||
* @param arg1 First argument to bind to the component.
|
||||
* @param arg2 Second argument to bind to the component.
|
||||
* @param arg3 Third argument to bind to the component.
|
||||
* @param arg4 Fourth argument to bind to the component.
|
||||
* @return A component bound with the supplied arguments.
|
||||
*
|
||||
* @see m.render
|
||||
* @see m.mount
|
||||
* @see m.component
|
||||
*/
|
||||
<TController extends MithrilController, T1, T2, T3, T4>(
|
||||
component: ParameterizedMithrilComponent<TController, T1, T2, T3, T4>,
|
||||
arg1: T1,
|
||||
arg2: T2,
|
||||
arg3: T3,
|
||||
arg4: T4
|
||||
): MithrilComponent<TController>;
|
||||
|
||||
/**
|
||||
* Initializes a parameterized component for use with m.render, m.mount, etc.
|
||||
* Shorthand for m.component.
|
||||
*
|
||||
* @param component A parameterized component.
|
||||
* @param arg1 First argument to bind to the component.
|
||||
* @param arg2 Second argument to bind to the component.
|
||||
* @param arg3 Third argument to bind to the component.
|
||||
* @param arg4 Fourth argument to bind to the component.
|
||||
* @param args Additional optional arguments which are not type checked.
|
||||
* @return A component bound with the supplied arguments.
|
||||
*
|
||||
* @see m.render
|
||||
* @see m.mount
|
||||
* @see m.component
|
||||
*/
|
||||
<TController extends MithrilController, T1, T2, T3, T4>(
|
||||
component: ParameterizedMithrilComponent<TController, T1, T2, T3, T4>,
|
||||
arg1: T1,
|
||||
arg2: T2,
|
||||
arg3: T3,
|
||||
arg4: T4,
|
||||
...args:any[]
|
||||
): MithrilComponent<TController>;
|
||||
|
||||
/**
|
||||
* Creates a getter-setter function that wraps a Mithril promise. Useful
|
||||
|
|
@ -149,18 +236,116 @@ declare module _mithril {
|
|||
/**
|
||||
* Initializes a component for use with m.render, m.mount, etc.
|
||||
*
|
||||
* @param selector A component.
|
||||
* @param args Arguments to optionally pass to the component.
|
||||
* @return A component.
|
||||
* @param component A mithril component.
|
||||
* @return A mithril component.
|
||||
*
|
||||
* @see m.render
|
||||
* @see m.mount
|
||||
* @see m
|
||||
*/
|
||||
component<T extends MithrilController>(
|
||||
component: MithrilComponent<T>,
|
||||
component<TController extends MithrilController>(
|
||||
component: MithrilComponent<TController>
|
||||
): MithrilComponent<TController>;
|
||||
|
||||
/**
|
||||
* Initializes a parameterized component for use with m.render, m.mount, etc.
|
||||
*
|
||||
* @param component A parameterized component.
|
||||
* @param arg1 First argument to bind to the component.
|
||||
* @return A component bound with the supplied arguments.
|
||||
*
|
||||
* @see m.render
|
||||
* @see m.mount
|
||||
* @see m
|
||||
*/
|
||||
component<TController extends MithrilController, T1>(
|
||||
component: ParameterizedMithrilComponent<TController, T1, void, void, void>,
|
||||
arg1: T1
|
||||
): MithrilComponent<TController>;
|
||||
|
||||
/**
|
||||
* Initializes a parameterized component for use with m.render, m.mount, etc.
|
||||
*
|
||||
* @param component A parameterized component.
|
||||
* @param arg1 First argument to bind to the component.
|
||||
* @param arg2 Second argument to bind to the component.
|
||||
* @return A component bound with the supplied arguments.
|
||||
*
|
||||
* @see m.render
|
||||
* @see m.mount
|
||||
* @see m
|
||||
*/
|
||||
component<TController extends MithrilController, T1, T2>(
|
||||
component: ParameterizedMithrilComponent<TController, T1, T2, void, void>,
|
||||
arg1: T1,
|
||||
arg2: T2
|
||||
): MithrilComponent<TController>;
|
||||
|
||||
/**
|
||||
* Initializes a parameterized component for use with m.render, m.mount, etc.
|
||||
*
|
||||
* @param component A parameterized component.
|
||||
* @param arg1 First argument to bind to the component.
|
||||
* @param arg2 Second argument to bind to the component.
|
||||
* @param arg3 Third argument to bind to the component.
|
||||
* @return A component bound with the supplied arguments.
|
||||
*
|
||||
* @see m.render
|
||||
* @see m.mount
|
||||
* @see m
|
||||
*/
|
||||
component<TController extends MithrilController, T1, T2, T3>(
|
||||
component: ParameterizedMithrilComponent<TController, T1, T2, T3, void>,
|
||||
arg1: T1,
|
||||
arg2: T2,
|
||||
arg3: T3
|
||||
): MithrilComponent<TController>;
|
||||
|
||||
/**
|
||||
* Initializes a parameterized component for use with m.render, m.mount, etc.
|
||||
*
|
||||
* @param component A parameterized component.
|
||||
* @param arg1 First argument to bind to the component.
|
||||
* @param arg2 Second argument to bind to the component.
|
||||
* @param arg3 Third argument to bind to the component.
|
||||
* @param arg4 Fourth argument to bind to the component.
|
||||
* @return A component bound with the supplied arguments.
|
||||
*
|
||||
* @see m.render
|
||||
* @see m.mount
|
||||
* @see m
|
||||
*/
|
||||
component<TController extends MithrilController, T1, T2, T3, T4>(
|
||||
component: ParameterizedMithrilComponent<TController, T1, T2, T3, T4>,
|
||||
arg1: T1,
|
||||
arg2: T2,
|
||||
arg3: T3,
|
||||
arg4: T4
|
||||
): MithrilComponent<TController>;
|
||||
|
||||
/**
|
||||
* Initializes a parameterized component for use with m.render, m.mount, etc.
|
||||
*
|
||||
* @param component A parameterized component.
|
||||
* @param arg1 First argument to bind to the component.
|
||||
* @param arg2 Second argument to bind to the component.
|
||||
* @param arg3 Third argument to bind to the component.
|
||||
* @param arg4 Fourth argument to bind to the component.
|
||||
* @param args Additional optional arguments which are not type checked.
|
||||
* @return A component bound with the supplied arguments.
|
||||
*
|
||||
* @see m.render
|
||||
* @see m.mount
|
||||
* @see m
|
||||
*/
|
||||
component<TController extends MithrilController, T1, T2, T3, T4>(
|
||||
component: ParameterizedMithrilComponent<TController, T1, T2, T3, T4>,
|
||||
arg1: T1,
|
||||
arg2: T2,
|
||||
arg3: T3,
|
||||
arg4: T4,
|
||||
...args: any[]
|
||||
): MithrilComponent<T>;
|
||||
): MithrilComponent<TController>;
|
||||
|
||||
/**
|
||||
* Trust this string of HTML.
|
||||
|
|
@ -599,6 +784,30 @@ declare module _mithril {
|
|||
view(ctrl: T): MithrilVirtualElement<T>;
|
||||
}
|
||||
|
||||
/**
|
||||
* This represents a parameterized MithrilComponent with up to six parameters,
|
||||
* intended to be instantiated via m.component().
|
||||
*
|
||||
* @see m
|
||||
* @see m.component
|
||||
*/
|
||||
interface ParameterizedMithrilComponent<TController extends MithrilController, T1, T2, T3, T4> {
|
||||
/**
|
||||
* The component's controller.
|
||||
*
|
||||
* @see m.component
|
||||
*/
|
||||
controller: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, ...args: any[]) => TController;
|
||||
|
||||
|
||||
/**
|
||||
* creates a view out of virtual elements.
|
||||
*
|
||||
* @see m.component
|
||||
*/
|
||||
view(ctrl: TController, arg1: T1, arg2: T2, arg3: T3, arg4: T4, ...args:any[]): MithrilVirtualElement<TController>;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the base interface for property getter-setters
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue