一个用于构建用户界面的前端 JavaScript 库!
Mosaic is a declarative front-end JavaScript library for building user interfaces!
(Web) Component-Based: Mosaic uses the Custom Elements API to create web components that can keep track of their own data, actions, and more, and can be included in other components to create front-end web applications.
⚡️ Observable Data: Mosaic uses Observables to keep track of changes to a component's data. This means that there is no need to call "setState" or anything like that to update a component - instead just change the data directly.
Smart DOM: Updates in Mosaic work by remembering which nodes are dynamic (i.e. subject to change) and traveling directly to those nodes to make changes, rather than traversing the tree again.
Built-in Router: Comes with a basic, client-side router which allows Mosaic components to be used as separate pages.
State Manager: Comes with a built-in global state manager called Portfolio.
Lightweight: The minified Mosaic library comes in at a size of 28KB.
Tagged Template Literals: Views are written using tagged template literals, which means there is no need for a compiler:
const name = "Mosaic";
html`
Welcome to ${name}!
`Here is an example of a simple Mosaic application. All you need is an index.html file and an index.js file. For a more detailed example, run the project inside the "example" folder.
index.html:
My Mosaic App
index.js:
…The easiest way to use Mosaic is to first install the npm package by using:
npm install --save mosaic-frameworkyarn add mosaic-framework --saveor with a script tag.
(Optional) For fast builds and hot reloading, install the build tool "Parcel." This is not required, though, as Mosaic uses built-in JavaScript features. This means that no build tool is required, but any may be used if it helps the overall project structure.
npm install --save-dev parcel-bundlerNow you are ready to use Mosaic!
暂无开放 Issues,或尚未同步最近议题。