Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First, this change involves a refactor of some of the module structure of the code to be consistent. Next, there is a new Moon View Language (MVL). It has three types of nodes: * Node: A node that is equivalent to the contents of the expression within it, analogous to a variable reference. - `<{node}#>` * Data Node: A node that is equivalent to a function call that can call a function with an expression directly or attributes to represent an object. - `<{node} {data}/>` - `<{node} foo="bar" bar="baz"/>` * Data & Children Node: A node that is equivalent to a function call with attributes representing an object along with support for children, which can include text, dynamic text blocks, and other nodes. - `<{node} foo="bar" bar="baz">Text {dynamic} <node#></>` - `<p>Hello Moon!</p>` This means that all nodes must now be functions, so `Moon.view.m` is now an object with keys being HTML elements and a special `text` element which takes a `value` data property. All elements must then usually be imported or declared at the top of files. The new parser uses parser combinators and comes with better error reporting that displays the line of the error, the surrounding lines, and the exact position where something was expected. It also supports full JavaScript syntax along with MVL, *without* needing parentheses around nodes. The new generator is much simpler and only generates function calls or variable references as appropriate for the node type in question. It doesn't do any static function call optimization as the nodes can be dynamic at any time. This can easily be done by the developer and included with a reference using a normal variable reference node. Lastly, work on the router has started. There is a simple file structure set up, a basic driver that changes the route using the `history` API, and a basic `Link` component that creates `a` elements with the data provided. Nothing fancy for now.
- Loading branch information